Author: nbelaevski
Date: 2010-07-11 17:43:10 -0400 (Sun, 11 Jul 2010)
New Revision: 17931
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaMethod.java
Log:
Fix for NPE in CDK
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaMethod.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaMethod.java 2010-07-11
15:48:21 UTC (rev 17930)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaMethod.java 2010-07-11
21:43:10 UTC (rev 17931)
@@ -22,6 +22,7 @@
package org.richfaces.cdk.templatecompiler.builder.model;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.richfaces.cdk.templatecompiler.el.types.ELType;
@@ -80,7 +81,15 @@
public Iterable<JavaImport> getRequiredImports() {
Iterable<JavaImport> exceptionsImports =
Iterables.concat(Iterables.transform(getExceptions(), RequireImports.IMPORTS_TRANSFORM));
Iterable<JavaImport> argumentsImports =
Iterables.concat(Iterables.transform(getArguments(), RequireImports.IMPORTS_TRANSFORM));
- Iterable<JavaImport> imports =
Iterables.concat(getReturnType().getRequiredImports(),getMethodBody().getRequiredImports(),exceptionsImports,argumentsImports);
+
+ Iterable<JavaImport> methodBodyImports = Collections.emptySet();
+
+ JavaStatement methodBody = getMethodBody();
+ if (methodBody != null) {
+ methodBodyImports = methodBody.getRequiredImports();
+ }
+
+ Iterable<JavaImport> imports =
Iterables.concat(getReturnType().getRequiredImports(),methodBodyImports,exceptionsImports,argumentsImports);
return imports;
}
}
Show replies by date