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

Empty scenario header causes exception #187

Closed
Clashsoft opened this issue Sep 21, 2020 · 1 comment · Fixed by #193
Closed

Empty scenario header causes exception #187

Clashsoft opened this issue Sep 21, 2020 · 1 comment · Fixed by #193
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Clashsoft
Copy link
Member

Clashsoft commented Sep 21, 2020

Example

# 

(there is a single space character after the #)

Output

// failed to execute phase 'CodeGenerator' due to exception:
// java.lang.StringIndexOutOfBoundsException
// 	(12 internal calls)
// 	at org.fulib.scenarios.visitor.codegen.CodeGenerator.visit(CodeGenerator.java:51)
// 	at org.fulib.scenarios.ast.CompilationContext.accept(CompilationContext.java:24)
// 	(3 internal calls)
// 	at org.fulib.webapp.tool.Tools.scenarioc(Tools.java:83)
// 	at org.fulib.webapp.tool.Tools.genCompileRun(Tools.java:161)
// 	at org.fulib.webapp.tool.RunCodeGen.run(RunCodeGen.java:148)
// 	at org.fulib.webapp.tool.RunCodeGen.handle(RunCodeGen.java:50)
// 	(21 internal calls)
// Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
// 	(2 internal calls)
// 	at org.fulib.yaml.StrUtil.downFirstChar(StrUtil.java:55)
// 	at org.fulib.yaml.IdMap.generateUniqueKey(IdMap.java:203)
// 	at org.fulib.yaml.IdMap.addToObjIdMap(IdMap.java:188)
// 	at org.fulib.yaml.IdMap.putObject(IdMap.java:115)
// 	at org.fulib.yaml.YamlIdMap.collectObjects(YamlIdMap.java:746)
// 	at org.fulib.yaml.YamlIdMap.encode(YamlIdMap.java:777)
// 	at org.fulib.AbstractGenerator.saveNewClassModel(AbstractGenerator.java:186)
// 	at org.fulib.AbstractGenerator.generate(AbstractGenerator.java:110)
// 	at org.fulib.scenarios.visitor.codegen.CodeGenerator.visit(CodeGenerator.java:152)
// 	at org.fulib.scenarios.visitor.codegen.CodeGenerator.visit(CodeGenerator.java:31)
// 	at org.fulib.scenarios.ast.ScenarioGroup.accept(ScenarioGroup.java:26)
// 	at org.fulib.scenarios.visitor.codegen.CodeGenerator.lambda$visit$0(CodeGenerator.java:55)
// 	(9 internal calls)
@Clashsoft Clashsoft added the bug Something isn't working label Sep 21, 2020
@Clashsoft Clashsoft added this to the v1.5.0 milestone Sep 21, 2020
@Clashsoft Clashsoft self-assigned this Sep 21, 2020
@Clashsoft
Copy link
Member Author

Clashsoft commented Sep 22, 2020

There are actually multiple issues that come together here:

  1. fulibScenarios does not properly diagnose the empty scenario name. (Sanitize test method name by prepending underscore #193)
  2. fulib does not check the name of FMethods. (Check for syntax errors in FMethod.setDeclaration fulib#72)
  3. fulib does not define a getId method for FMethods. (Add FMethod.getId fulib#73)
  4. fulibYaml cannot handle a getName or getId method returning an empty string. (Exception when custom ID is empty fulibYaml#21)

Clashsoft added a commit that referenced this issue Sep 24, 2020
This is useful when the scenario name is empty or starts with a number.

Closes #187
@Clashsoft Clashsoft linked a pull request Sep 24, 2020 that will close this issue
@Clashsoft Clashsoft changed the title Empty scenario header causes compiler error Empty scenario header causes exception Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant