[ http://jira.codehaus.org/browse/MNG-1313?page=comments#action_50074 ]
Christian Schulte commented on MNG-1313: ---------------------------------------- If the surefire-plugin would contain the boot classpath this would not lead to ClassLoader.getSystemClassLoader(), as used in the JDK during CharsetProvider discovery, to catch the jar files in the surefire classpath. So I think this is not a duplicate of MNG-1303. Its the opposite. The classloader you get from ClassLoader.getSystemClassLoader() needs to have the jars to test in its classpath. I could be wrong since I do not know if getSystemClassLoader() returns the classloader used by surefire-plugin but I think it doesn't. > maven-surefire-plugin cannot test custom charset providers specified in > META-INF/services/java.nio.charset.spi.CharsetProvider > ------------------------------------------------------------------------------------------------------------------------------ > > Key: MNG-1313 > URL: http://jira.codehaus.org/browse/MNG-1313 > Project: Maven 2 > Type: Bug > Components: maven-surefire-plugin > Versions: 2.0 > Environment: All > Reporter: Christian Schulte > Assignee: Brett Porter > Priority: Blocker > > > maven-surefire-plugin cannot run a jUnit test for a custom charset provider > specified in the jar file's > META-INF/services/java.nio.charset.spi.CharsetProvider file. Class > java.nio.charset.Charset performs a lookup using > ClassLoader.getSystemClassLoader(); which does not have the jar file in its > classpath and thus fails with e.g. junit.framework.AssertionFailedError: > java.io.UnsupportedEncodingException: DIN_66003 although the jar file itself > is correct. I think this is due to the plugin using its own classloader and > the JDK using the system classloader but I may be totally wrong and > everything is fine with the plugin. > The method from java.nio.charset.Charset performing the lookup beings with > private static Iterator providers() { > return new Iterator() { > Class c = java.nio.charset.spi.CharsetProvider.class; > ClassLoader cl = ClassLoader.getSystemClassLoader(); > Iterator i = Service.providers(c, cl); > Object next = null; > As it seems org.codehaus.surefire.SurefireBooter does not promote the jar > files to the classpath of the system classloader. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]