Skip to content

Error in walking libs subfolder on uno package creation #85

Description

@jragan-work

After updating LoEclipse i found out, that my extension no longer builds.
I get Error launching configuration with following exception:

!MESSAGE Error launching configuration.
!STACK 0
java.lang.IllegalArgumentException: pFile [C:\Users\jragan\eclipse-workspace-LOswing\Harmonogram\libs\commons-net-3.6.jar] is not a file
	at org.libreoffice.plugin.core.model.UnoPackage.addOtherFile(UnoPackage.java:587)
	at org.libreoffice.ide.eclipse.java.JavaBuilder.fillUnoPackage(JavaBuilder.java:289)
	at org.libreoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper.createMinimalUnoPackage(UnoidlProjectHelper.java:513)
	at org.libreoffice.ide.eclipse.core.gui.PackageContentSelector.createPackage(PackageContentSelector.java:185)
	at org.libreoffice.ide.eclipse.core.launch.office.OfficeLaunchDelegate.exportComponent(OfficeLaunchDelegate.java:177)
	at org.libreoffice.ide.eclipse.core.launch.office.OfficeLaunchDelegate.launch(OfficeLaunchDelegate.java:109)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:807)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:718)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I have narrowed down the problem to JavaBuilder.java modification from commit 074eab8. The problem happens because the new version of getLibs(...) method calls new method getLibsFromLibsDir(...) and it cuts out subdirectories somehow. The correct path to the above mentioned file is:
C:\Users\jragan\eclipse-workspace-LOswing\Harmonogram\libs\commons-net-3.6\commons-net-3.6.jar
I have also checked in debugger data for other files with subdirectories, and their directories were also cut out.

I think it is in this part, but since I don't use collections much, I just can't wrap my head around the code (starting from line 357):

            try (Stream<java.nio.file.Path> walk = Files.walk(Paths.get(libFolderOsString))) {
                libs = walk.map(jarFile -> {
                    return libFolder.getFile(jarFile.getFileName().toString());
                }).filter(f -> f.getFileExtension() != null && f.getFileExtension().equalsIgnoreCase("jar"))
                    .collect(Collectors.toList());
            } catch (IOException e) {
                PluginLogger.error(
                    Messages.getString("JavaBuilder.GetExternalLibsFailed"), e);
            }

Temporary fix for this is to move all jars to main libs folder.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions