Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Nava2 opened this issue Aug 26, 2015 · 1 comment
Closed
Assignees
Labels
attributes Component-SyntaxAndParsing Related to the Umple grammar and the parser that builds the abstract syntax tree and analyses models Priority-Medium This problem or request is likely to be of significant benefit if dealt with syntax Type-Defect

Comments

@Nava2
Copy link
Contributor

Nava2 commented Aug 26, 2015

Originally reported on Google Code with ID 394
Owned by atojet


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.(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.


Reported by atojet on 2013-06-04 18:01:11

@Nava2
Copy link
Contributor Author

Nava2 commented Aug 26, 2015

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


Reported by @umple on 2013-06-04 18:40:17

  • Status changed: Invalid

@Nava2 Nava2 added Type-Defect Priority-Medium This problem or request is likely to be of significant benefit if dealt with syntax Component-SyntaxAndParsing Related to the Umple grammar and the parser that builds the abstract syntax tree and analyses models attributes Status-Invalid labels Aug 26, 2015
@Nava2 Nava2 closed this as completed Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes Component-SyntaxAndParsing Related to the Umple grammar and the parser that builds the abstract syntax tree and analyses models Priority-Medium This problem or request is likely to be of significant benefit if dealt with syntax Type-Defect
Projects
None yet
Development

No branches or pull requests

2 participants