google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

analyzeAttribute throwing NullPointException when [^name] clause is used #394

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to reproduce in revision 2787:
in the umple_classes.grammar file, make the following change

- simpleAttribute- : [~name] ;
+ simpleAttribute- : [^name] ;

build with 'ant -f build.umple.xml -Dmyenv=local umpleSelf compile 
packageMainJar' and observe the exception being thrown:

umpleSelf:
     [java] cruise.umple/src/Master.ump
     [java] Umple compiler error. Stack trace follows
     [java] To locate the error in the original Umple source, set GeneratedSourcePath to where the generated Java is located:
     [java] e.g. setenv GeneratedSourcePath ~/umple/cruise.umple/src-gen-umple
     [java] Exception java.lang.NullPointerException in
     [java] java.lang.NullPointerException
     [java]     at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
     [java]     at java.util.regex.Matcher.reset(Matcher.java:308)
     [java]     at java.util.regex.Matcher.<init>(Matcher.java:228)
     [java]     at java.util.regex.Pattern.matcher(Pattern.java:1088)
     [java]     at java.util.regex.Pattern.matches(Pattern.java:1129)
     [java]     at cruise.umple.compiler.Token.isValidIdentifier(Parser_Code.ump:94)
     [java]     at cruise.umple.compiler.Token.isValidIdentifier(Parser_Code.ump:101)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeAttribute(UmpleInternalParser_CodeClass.ump:1817)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeClassToken(UmpleInternalParser_CodeClass.ump:162)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeToken(UmpleInternalParser_Code.ump:162)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeAllTokens(UmpleInternalParser_Code.ump:138)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeClass(UmpleInternalParser.java:1281)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeClassToken(UmpleInternalParser_CodeClass.ump:82)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeToken(UmpleInternalParser_Code.ump:152)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyzeAllTokens(UmpleInternalParser_Code.ump:114)
     [java]     at cruise.umple.compiler.UmpleInternalParser.analyze(UmpleInternalParser_Code.ump:80)
     [java]     at cruise.umple.compiler.UmpleModel.run(Umple_Code.ump:172)
     [java]     at cruise.umple.UmpleConsoleMain.main(Main_Code.ump:69)

This appears to be happening because the subToken "name" is being parsed as 
"^name" instead, so a getValue("name") is failing and isValidIdentifier is 
being called with a null value being passed as parameter.

Original issue reported on code.google.com by atojet on 4 Jun 2013 at 6:01

GoogleCodeExporter commented 9 years ago
This was a bug in the documentation that caused an attempt to use this invalid 
grammar element.  Documentation fix submitted as r2788

Original comment by TimothyCLethbridge on 4 Jun 2013 at 6:40