eclipse-ee4j / glassfish-security-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeProcessorImpl.java leaves file open - causes failure in windows build of glassfish v5

glassfishrobot opened this issue · comments

Glassfish - https://github.com/javaee/glassfish.git,
fails to build on Windows 10 and has refused to build since prior (1-2 months) to my first notice in 12/2017.
I have debugged the cause - and have tested a fix that works for me on windows.

The cause is that a file is left open by this plugin that results in an error in a different plugin used in the build of glassfish.

I can provide much detail if required and have emailed the report of the issue to glassfish@javaee.groups.io with subject 'gfv5 window 10 build fails with latest maven and jdk 8' .

from that email,

This is an update of the below previous post in Dec/2017.

Glassfish still does not build on windows 10 64 bit with java 8 and maven 3.5.2.

This afternoon I determined the reason and a fix.

The reason the default file cannot be deleted is that it is open in windows.
file: glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default
It gets opened in the command-security-maven-plugin project code,
from the repo https://github.com/javaee/command-security-maven-plugin.git

The file I changed is command-security-maven-plugin\src\main\java\org\glassfish\module\maven\commandsecurityplugin\TypeProcessorImpl.java .
The method is : private List findInhabitantsInModule(final BufferedReader br) throws IOException is passed the BufferedReader br
that has the file open. When the method returns the file is still open. I determined it was safe to call br.close(); before the return of the method,
and after adding the br.close call I can now successfully build Glassfish.
snippet:
}
br.close(); //newly added
return result;
} // last line of method