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

[Bug]: Compiler crash when dependency name is not defined in Ballerina.toml #42472

Closed
SasinduDilshara opened this issue Apr 4, 2024 · 1 comment · Fixed by #42697
Closed
Assignees
Labels
Area/ProjectAPI Crash All issues caused by NPE, CCE, etc Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Bug

Comments

@SasinduDilshara
Copy link
Contributor

Description

ballerina.toml

[package]
org = "admin"
name = "jsonpath_test"
version = "0.1.0"
distribution = "2201.8.6"

[[dependency]]
org = "ballerina"
name1 = "data.jsondata"
version = "0.1.0"
repository = "local"

In here the package name field is wrong(name1).
This gives a compiler crash error

We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2024-04-04 11:40:15,128] SEVERE {b7a.log.crash} - Cannot invoke "String.isEmpty()" because "segment" is null 
java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "segment" is null
        at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:271)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at io.ballerina.projects.util.ProjectUtils.getRelativeBalaPath(ProjectUtils.java:454)
        at io.ballerina.projects.internal.repositories.FileSystemRepository.getPackagePath(FileSystemRepository.java:306)
        at io.ballerina.projects.internal.repositories.FileSystemRepository.isPackageExists(FileSystemRepository.java:141)
        at io.ballerina.projects.internal.BlendedManifest.from(BlendedManifest.java:104)
        at io.ballerina.projects.PackageResolution.createBlendedManifest(PackageResolution.java:488)
        at io.ballerina.projects.PackageResolution.<init>(PackageResolution.java:98)
        at io.ballerina.projects.PackageResolution.from(PackageResolution.java:110)
        at io.ballerina.projects.PackageContext.getResolution(PackageContext.java:251)
        at io.ballerina.projects.Package.getResolution(Package.java:154)
        at io.ballerina.cli.task.CompileTask.execute(CompileTask.java:112)
        at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
        at io.ballerina.cli.cmd.RunCommand.execute(RunCommand.java:223)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.ballerina.cli.launcher.Main.main(Main.java:58)We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2024-04-04 11:40:15,128] SEVERE {b7a.log.crash} - Cannot invoke "String.isEmpty()" because "segment" is null 
java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "segment" is null
        at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:271)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at io.ballerina.projects.util.ProjectUtils.getRelativeBalaPath(ProjectUtils.java:454)
        at io.ballerina.projects.internal.repositories.FileSystemRepository.getPackagePath(FileSystemRepository.java:306)
        at io.ballerina.projects.internal.repositories.FileSystemRepository.isPackageExists(FileSystemRepository.java:141)
        at io.ballerina.projects.internal.BlendedManifest.from(BlendedManifest.java:104)
        at io.ballerina.projects.PackageResolution.createBlendedManifest(PackageResolution.java:488)
        at io.ballerina.projects.PackageResolution.<init>(PackageResolution.java:98)
        at io.ballerina.projects.PackageResolution.from(PackageResolution.java:110)
        at io.ballerina.projects.PackageContext.getResolution(PackageContext.java:251)
        at io.ballerina.projects.Package.getResolution(Package.java:154)
        at io.ballerina.cli.task.CompileTask.execute(CompileTask.java:112)
        at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
        at io.ballerina.cli.cmd.RunCommand.execute(RunCommand.java:223)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.ballerina.cli.launcher.Main.main(Main.java:58)

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Apr 4, 2024
@SasinduDilshara SasinduDilshara added Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Area/ProjectAPI and removed needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Apr 4, 2024
@nipunayf nipunayf added the Crash All issues caused by NPE, CCE, etc label Apr 4, 2024
@ShammiL ShammiL self-assigned this Apr 15, 2024
Copy link

github-actions bot commented May 9, 2024

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/ProjectAPI Crash All issues caused by NPE, CCE, etc Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Bug
Projects
Archived in project
5 participants