Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremerks2006-12-01 07:11:59 -0500
committeremerks2006-12-01 07:11:59 -0500
commit92b19498822608bc5405623c41c7063eef70c33b (patch)
treefe87a002312345c80bcf16c2211f84641e08998d /examples/org.eclipse.emf.examples.generator.validator
parent520fa63865bf9ec730dfe318870276fa7b18855e (diff)
downloadorg.eclipse.emf-92b19498822608bc5405623c41c7063eef70c33b.tar.gz
org.eclipse.emf-92b19498822608bc5405623c41c7063eef70c33b.tar.xz
org.eclipse.emf-92b19498822608bc5405623c41c7063eef70c33b.zip
[166470] Fix null pointer exception in getTypeExpression and infinite loop when processing GenParameters.
Diffstat (limited to 'examples/org.eclipse.emf.examples.generator.validator')
-rw-r--r--examples/org.eclipse.emf.examples.generator.validator/src/org/eclipse/emf/examples/generator/validator/ValidatorGeneratorUtil.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/org.eclipse.emf.examples.generator.validator/src/org/eclipse/emf/examples/generator/validator/ValidatorGeneratorUtil.java b/examples/org.eclipse.emf.examples.generator.validator/src/org/eclipse/emf/examples/generator/validator/ValidatorGeneratorUtil.java
index c3e417789..883070982 100644
--- a/examples/org.eclipse.emf.examples.generator.validator/src/org/eclipse/emf/examples/generator/validator/ValidatorGeneratorUtil.java
+++ b/examples/org.eclipse.emf.examples.generator.validator/src/org/eclipse/emf/examples/generator/validator/ValidatorGeneratorUtil.java
@@ -12,7 +12,7 @@
*
* </copyright>
*
- * $Id: ValidatorGeneratorUtil.java,v 1.1 2006/11/10 23:04:27 davidms Exp $
+ * $Id: ValidatorGeneratorUtil.java,v 1.2 2006/12/01 12:11:59 emerks Exp $
*/
package org.eclipse.emf.examples.generator.validator;
@@ -20,8 +20,10 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
+import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier;
import org.eclipse.emf.codegen.ecore.genmodel.GenOperation;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.codegen.ecore.genmodel.GenParameter;
import org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement;
import org.eclipse.emf.codegen.util.ImportManager;
import org.eclipse.emf.ecore.ETypedElement;
@@ -87,7 +89,8 @@ public class ValidatorGeneratorUtil
public static String getTypeExpression(GenTypedElement genTypedElement)
{
StringBuffer result = new StringBuffer();
- result.append(genTypedElement.getTypeGenClassifier().getName());
+ GenClassifier genClassifier = genTypedElement.getTypeGenClassifier();
+ result.append(genClassifier == null ? "void" : genClassifier.getName());
ETypedElement eTypedElement = (ETypedElement)genTypedElement.getEcoreModelElement();
int lowerBound = eTypedElement.getLowerBound();
@@ -123,7 +126,8 @@ public class ValidatorGeneratorUtil
for (Iterator i = genOperation.getGenParameters().iterator(); i.hasNext(); )
{
- result.append(getTypeExpression(genOperation));
+ GenParameter genParameter = (GenParameter)i.next();
+ result.append(getTypeExpression(genParameter));
if (i.hasNext())
{
result.append(", ");
@@ -132,6 +136,5 @@ public class ValidatorGeneratorUtil
result.append(')');
return result.toString();
}
-
}

Back to the top