From 6d936298d3d89361e828e5c4a2558647a8a31ca3 Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Mon, 28 Apr 2014 21:34:44 +0000 Subject: [PATCH] [MPLUGIN-242] NullPointerException in MojoClassVisitor.visit() fix Submitted by: Mikolaj Izdebski git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1590811 13f79535-47bb-0310-9956-ffa450edef68 --- .../annotations/scanner/visitors/MojoClassVisitor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java index 31891db..449093d 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java @@ -107,8 +107,11 @@ public class MojoClassVisitor public void visit( int version, int access, String name, String signature, String superName, String[] interfaces ) { mojoAnnotatedClass = new MojoAnnotatedClass(); - mojoAnnotatedClass.setClassName( Type.getObjectType( name ).getClassName() ).setParentClassName( - Type.getObjectType( superName ).getClassName() ); + mojoAnnotatedClass.setClassName( Type.getObjectType( name ).getClassName() ); + if ( superName != null ) + { + mojoAnnotatedClass.setParentClassName( Type.getObjectType( superName ).getClassName() ); + } } public AnnotationVisitor visitAnnotation( String desc, boolean visible )