[jboss-jira] [JBoss JIRA] Created: (JASSIST-45) Desc.getClazz(String) should throw RuntimeException with more descriptive message

Martin Burger (JIRA) jira-events at lists.jboss.org
Fri Feb 22 07:50:42 EST 2008


Desc.getClazz(String) should throw RuntimeException with more descriptive message 
----------------------------------------------------------------------------------

                 Key: JASSIST-45
                 URL: http://jira.jboss.com/jira/browse/JASSIST-45
             Project: Javassist
          Issue Type: Feature Request
         Environment: Javassist 3.7.0
            Reporter: Martin Burger
         Assigned To: Shigeru Chiba


The method javassist.runtime.Desc.getClazz(String) throws an RuntimeException if the given class name cannot be resolved. The message of that exception is "$class: internal error". So, if that exception is thrown in an own project, the developer hasn't a clue about the reason.

I suggest the following message:

	public static Class getClazz(String name) {
		try {
			return getClassObject(name);
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(
					"$class: internal error, could not find class '" + name
							+ "' (Desc.useContextClassLoader: "
							+ Boolean.toString(useContextClassLoader) + ")", e);
		}
	}

The message should include the state of Desc.useContextClassLoader to warn the developer that there could be a problem with different class loaders.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list