You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Paul Russell (JIRA)" <hi...@jakarta.apache.org> on 2004/11/21 23:52:23 UTC
[jira] Created: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
-----------------------------------------------------------------------------------------------------
Key: HIVEMIND-78
URL: http://nagoya.apache.org/jira/browse/HIVEMIND-78
Project: HiveMind
Type: Bug
Components: framework
Versions: 1.0, 1.1
Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
Reporter: Paul Russell
MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
java.lang.ExceptionInInitializerError
at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
... lots more
Caused by: java.lang.NullPointerException
at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
... 59 more
The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
String lReferenceClassName = referenceClass.getName();
String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "Paul Russell (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-78?page=comments#action_58559 ]
Paul Russell commented on HIVEMIND-78:
--------------------------------------
Setting maven.junit.fork=true in your project properties seems to work around this issue. Anyone had a chance to look at that patch?
Thanks,
Paul
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://issues.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
> Attachments: hivemind-package-defect.diff
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Updated: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "Paul Russell (JIRA)" <hi...@jakarta.apache.org>.
[ http://nagoya.apache.org/jira/browse/HIVEMIND-78?page=history ]
Paul Russell updated HIVEMIND-78:
---------------------------------
Attachment: hivemind-package-defect.diff
Patch to fix this defect. Clover indicates good code coverage in this area, and unit tests pass, but I haven't checked the unit tests in detail to determine if they functionally test this particular piece of code. Apologies for this -- it's half one in the morning here, and time for bed!
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://nagoya.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
> Attachments: hivemind-package-defect.diff
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "Howard M. Lewis Ship (JIRA)" <hi...@jakarta.apache.org>.
[ http://nagoya.apache.org/jira/browse/HIVEMIND-78?page=comments#action_55733 ]
Howard M. Lewis Ship commented on HIVEMIND-78:
----------------------------------------------
I suspect a workaround is to use the fork option on the Ant <junit> task; this should take the Ant class loaders out of the mix. Could you verify this?
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://nagoya.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Closed: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-78?page=all ]
James Carman closed HIVEMIND-78:
--------------------------------
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://issues.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
> Assignee: James Carman
> Fix For: 1.1
> Attachments: hivemind-package-defect.diff
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Resolved: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-78?page=all ]
James Carman resolved HIVEMIND-78:
----------------------------------
Resolution: Fixed
Fix Version: 1.1
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://issues.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
> Assignee: James Carman
> Fix For: 1.1
> Attachments: hivemind-package-defect.diff
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Assigned: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-78?page=all ]
James Carman reassigned HIVEMIND-78:
------------------------------------
Assign To: James Carman
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://issues.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
> Assignee: James Carman
> Fix For: 1.1
> Attachments: hivemind-package-defect.diff
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-78) Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
Posted by "Paul Russell (JIRA)" <hi...@jakarta.apache.org>.
[ http://nagoya.apache.org/jira/browse/HIVEMIND-78?page=comments#action_55873 ]
Paul Russell commented on HIVEMIND-78:
--------------------------------------
Unfortunately(!), I'm using Maven, so I'm not sure I can run Ant in forked mode :( As a temporary 'work around', I point a remote debugger at the build process and try and determine what's done wrong by looking at the message keys. I'll check-out hivemind and attach a patch.
> Certain classloaders (AntClassLoader for example) cause NullPointerException in impl.MessageFormatter
> -----------------------------------------------------------------------------------------------------
>
> Key: HIVEMIND-78
> URL: http://nagoya.apache.org/jira/browse/HIVEMIND-78
> Project: HiveMind
> Type: Bug
> Components: framework
> Versions: 1.0, 1.1
> Environment: MacOSX. Running unit tests of code running within hivemind using JUnit inside Ant inside Maven.
> Reporter: Paul Russell
>
> MessageFormat uses java.lang.Class.getPackage() to obtain the name of the package for the 'reference class' in order to choose an appropriate resource bundle. Unfortunately, java.lang.Class.getPackage() does not guarantee to return a Package object.
> It may return 'null' if (a) the reference class is loaded by the primordial classloader, or (b) if the classloader didn't create a package object and associated it with the class.
> I am seeing this problem while running unit tests of my application within Maven. Example stacktrace follows:
> java.lang.ExceptionInInitializerError
> at org.apache.hivemind.impl.RegistryImpl.getServicePoint(RegistryImpl.java:142)
> at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:149)
> at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
> ... lots more
> Caused by: java.lang.NullPointerException
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:49)
> at org.apache.hivemind.impl.MessageFormatter.<init>(MessageFormatter.java:44)
> at org.apache.hivemind.impl.ImplMessages.<clinit>(ImplMessages.java:45)
> ... 59 more
> The only safe way that I can see to achieve the same effect as Class.getPackage().getName() is to do something like:
> String lReferenceClassName = referenceClass.getName();
> String lPackageName = lReferenceClassName.substring(0,lReferenceClassName.lastIndexOf('.'));
> ... probably as a private function within MessageFormat itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org