You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2013/02/28 22:27:24 UTC

svn commit: r1451360 - /uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java

Author: rec
Date: Thu Feb 28 21:27:24 2013
New Revision: 1451360

URL: http://svn.apache.org/r1451360
Log:
[UIMA-2613] Switch from Eclipse JDT to qdox
https://issues.apache.org/jira/browse/UIMA-2613
- Fixed NPE when no name constant field has been defined for a parameter field

Modified:
    uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java

Modified: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java?rev=1451360&r1=1451359&r2=1451360&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/main/java/org/apache/uima/fit/maven/EnhanceMojo.java Thu Feb 28 21:27:24 2013
@@ -333,7 +333,7 @@ public class EnhanceMojo extends Abstrac
   private void enhanceConfigurationParameter(JavaSource aAST, Class<?> aClazz, CtClass aCtClazz)
           throws MojoExecutionException {
     // Get the parameter name constants
-    Map<String, Field> nameFields = getParameterConstants(aClazz);
+    Map<String, String> nameFields = getParameterConstants(aClazz);
 
     // Fetch configuration parameters from the @ConfigurationParameter annotations in the
     // compiled class. We only need the fields in the class itself. Superclasses should be
@@ -349,7 +349,7 @@ public class EnhanceMojo extends Abstrac
 
       // Extract JavaDoc for this parameter from the source file
       String pdesc = Util.getParameterDocumentation(aAST, field.getName(),
-              nameFields.get(p.getName()).getName());
+              nameFields.get(p.getName()));
       if (pdesc == null) {
         getLog().warn("No description found for parameter [" + p.getName() + "]");
         continue;
@@ -398,15 +398,15 @@ public class EnhanceMojo extends Abstrac
    * Get a map of parameter name to parameter name constant field, e.g. ("value",
    * Field("PARAM_VALUE")).
    */
-  private Map<String, Field> getParameterConstants(Class<?> aClazz) {
-    Map<String, Field> result = new HashMap<String, Field>();
+  private Map<String, String> getParameterConstants(Class<?> aClazz) {
+    Map<String, String> result = new HashMap<String, String>();
     for (Field f : aClazz.getFields()) {
       if (!f.getName().startsWith("PARAM_")) {
         continue;
       }
       try {
         String parameterName = (String) f.get(null);
-        result.put(parameterName, f);
+        result.put(parameterName, f.getName());
       } catch (IllegalAccessException e) {
         getLog().warn(
                 "Unable to access parameter name constant field [" + f.getName() + "]: "