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

CLI gives null-pointer exception #1650

Closed
edwardalee opened this issue Mar 15, 2023 · 1 comment · Fixed by #1580
Closed

CLI gives null-pointer exception #1650

edwardalee opened this issue Mar 15, 2023 · 1 comment · Fixed by #1580
Assignees
Labels
bug Something isn't working cli

Comments

@edwardalee
Copy link
Collaborator

The following valid LF program gives an NPE coming from the CLI code.
Contents of file ExtendsBugInside.lf:

target C
reactor C(
    period: time(5 ms)
) {
    timer t(0, period)
}

reactor A(
    period: time(5 ms)
) {    
    a = new C(period = period)
}

Contents of file ExtendsBug.lf:

target C

import A from "ExtendsBugInside.lf"

reactor B extends A {}

main reactor {
    a = new B()
}

Result of trying to compile:

ealmac:C eal$ lfc src/rosace/ExtendsBug.lf 
lfc: fatal error: An unexpected error occurred:
java.lang.NullPointerException: Cannot invoke "org.eclipse.emf.common.util.URI.isPlatform()" because "uri" is null
	at org.lflang.util.FileUtil.toIPath(FileUtil.java:88)
	at org.lflang.util.FileUtil.toPath(FileUtil.java:71)
	at org.lflang.cli.CliBase.validateResource(CliBase.java:225)
	at org.lflang.cli.Lfc.invokeGenerator(Lfc.java:193)
	at org.lflang.cli.Lfc.run(Lfc.java:165)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.lflang.cli.CliBase.cliMain(CliBase.java:103)
	at org.lflang.cli.Lfc.main(Lfc.java:150)
	at org.lflang.cli.Lfc.main(Lfc.java:140)
@edwardalee edwardalee added bug Something isn't working cli labels Mar 15, 2023
@lhstrh lhstrh assigned patilatharva and unassigned cmnrd Mar 15, 2023
cmnrd added a commit that referenced this issue Mar 15, 2023
The lfc tool currently fails with an NPE if an issue is reported without an
associated resource (see #1650).
This PR fixes this NPE, but not the source of the error in the program mentioned
in #1650.
@cmnrd
Copy link
Collaborator

cmnrd commented Mar 15, 2023

The NPE is fixed by #1655. However, this NPE occurred in the error reporting and only masked another problem. With #1655, I get this output:

lfc: error: Error executing EValidator


lfc: fatal error: Aborting due to 1 previous error.

This indicates an exception in the validator. Unfortunately, the validator does not tell us where it occurs...

However, the problem disappears with #1580. I am not sure if it is an actual fix to the problem or just masking it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants