[jboss-jira] [JBoss JIRA] Resolved: (JASSIST-83) NullPointerException in Handler#getType

Shigeru Chiba (JIRA) jira-events at lists.jboss.org
Tue Jun 9 04:51:57 EDT 2009


     [ https://jira.jboss.org/jira/browse/JASSIST-83?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shigeru Chiba resolved JASSIST-83.
----------------------------------

    Fix Version/s: 3.11.0.GA
       Resolution: Done


> NullPointerException in Handler#getType
> ---------------------------------------
>
>                 Key: JASSIST-83
>                 URL: https://jira.jboss.org/jira/browse/JASSIST-83
>             Project: Javassist
>          Issue Type: Bug
>         Environment: JA version 3.4, Windows Vista and JDK 1.6.0_10
>            Reporter: Hans-Joerg Adel
>            Assignee: Shigeru Chiba
>            Priority: Optional
>             Fix For: 3.11.0.GA
>
>         Attachments: Sample.java, SampleClass.java
>
>
> Hi!
> When I use ExprEditor#edit(Handler) to access a try-statement without a catch-clause I get a NullPointerException. 
> To reproduce the bug, please use this source
> /*--- (C) 1999-2008 Techniker Krankenkasse ---*/
> package samplepackage;
> import javassist.CannotCompileException;
> import javassist.ClassPool;
> import javassist.CtClass;
> import javassist.NotFoundException;
> import javassist.expr.ExprEditor;
> import javassist.expr.Handler;
> public class Sample {
> 	public static void main(String[] args) throws NotFoundException, CannotCompileException {
> 		ClassPool classPool = ClassPool.getDefault();
> 		CtClass ctClass = classPool.get("samplepackage.SampleClass");
> 		ctClass.instrument(new MyExprEditor());
> 	}
> 	static class MyExprEditor extends ExprEditor {
> 		@Override
> 		public void edit(Handler h) throws CannotCompileException {
> 			try {
> 				h.getType();
> 			} catch (NotFoundException e) {
> 			}
> 		}
> 	}
> }
> Stacktrace:
> Exception in thread "main" java.lang.NullPointerException
> 	at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:517)
> 	at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:499)
> 	at javassist.expr.Handler.getType(Handler.java:76)
> 	at samplepackage.Sample$MyExprEditor.edit(Sample.java:25)
> 	at javassist.expr.ExprEditor.doit(ExprEditor.java:97)
> 	at javassist.CtClassType.instrument(CtClassType.java:1224)
> 	at samplepackage.Sample.main(Sample.java:17)
> I would expect that h.getType() returns null.
> I am using JA version 3.4, Windows Vista and JDK 1.6.0_10.
> Cheers
> Ruwen
> iA Hans-Joerg Adel

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

        



More information about the jboss-jira mailing list