FELIX-1726 : Enhance error messages in case of missing project dependencies
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@880725 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/ClassUtil.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/ClassUtil.java
index e774483..d84f4cb 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/ClassUtil.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/ClassUtil.java
@@ -50,8 +50,6 @@
return new String[] {value.toString()};
}
return null;
- } catch (NoClassDefFoundError e) {
- // ignore and just return null
} catch (Exception e) {
// ignore and just return null
}
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/Util.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/Util.java
index d8e98ad..ddb2c8f 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/Util.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/Util.java
@@ -21,11 +21,7 @@
import java.util.List;
import org.apache.felix.scrplugin.SCRDescriptorException;
-import org.apache.felix.scrplugin.tags.ClassUtil;
-import org.apache.felix.scrplugin.tags.JavaClassDescription;
-import org.apache.felix.scrplugin.tags.JavaField;
-import org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription;
-import org.apache.felix.scrplugin.tags.annotation.AnnotationJavaField;
+import org.apache.felix.scrplugin.tags.*;
import com.thoughtworks.qdox.model.Annotation;
import com.thoughtworks.qdox.model.annotation.AnnotationFieldRef;
@@ -352,7 +348,7 @@
{
EvaluatingVisitor evaluatingVisitor = new EvaluatingVisitor() {
-
+
public Object visitAnnotationFieldRef( AnnotationFieldRef fieldRef ) {
// during prescan of AnnotationTagProviderManager#hasScrPluginAnnotation this method is called without desc attribute
// avoid NPE in this case and just skip value resolving
@@ -385,6 +381,11 @@
}
throw new IllegalArgumentException("Something is wrong: " + s);
}
+ catch (NoClassDefFoundError ncdfe)
+ {
+ throw new IllegalArgumentException("A class could not be found while parsing class " + desc.getName() +
+ ". Please check this stracktrace and add a dependency with the missing class to your project.", ncdfe);
+ }
catch (SCRDescriptorException mee)
{
throw new IllegalArgumentException(mee);
@@ -396,7 +397,7 @@
// is never called because visitAnnotationFieldRef is overridden as well
return null;
}
-
+
};
List<Object> valueList = evaluatingVisitor.getListValue(annotation, name);
if (valueList==null) {