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]: bal pack crashes when [[dependency]] section is missing in the CompilerPlugin.toml file #41418

Closed
gabilang opened this issue Sep 20, 2023 · 4 comments · Fixed by #43426
Assignees
Labels
Credits/20 Hacktoberfest 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

@gabilang
Copy link
Contributor

gabilang commented Sep 20, 2023

Description

$Subject
When a Ballerina project has CompilerPlugin.toml file with no [[dependency]] sections specified, executing bal pack gives the following crash log:

[2023-09-20 15:19:48,152] SEVERE {b7a.log.crash} - Index 0 out of bounds for length 0 
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
        at java.base/java.util.Objects.checkIndex(Objects.java:361)
        at java.base/java.util.ArrayList.get(ArrayList.java:427)
        at io.ballerina.projects.JBallerinaBalaWriter.addCompilerPlugin(JBallerinaBalaWriter.java:121)
        at io.ballerina.projects.BalaWriter.populateBalaArchive(BalaWriter.java:135)
        at io.ballerina.projects.BalaWriter.write(BalaWriter.java:108)
        at io.ballerina.projects.JBallerinaBackend.emitBala(JBallerinaBackend.java:241)
        at io.ballerina.projects.JBallerinaBackend.emit(JBallerinaBackend.java:218)
        at io.ballerina.cli.task.CreateBalaTask.execute(CreateBalaTask.java:79)
        at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
        at io.ballerina.cli.cmd.PackCommand.execute(PackCommand.java:256)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.ballerina.cli.launcher.Main.main(Main.java:58)

Steps to Reproduce

Add an empty CompilerPlugin.toml file or with only [plugin] section to a Ballerina project.

CompilerPlugin.toml

[plugin]
id = "id"
class = "path.to.class"

Affected Version(s)

ballerina-lang master, update-8 RC1
NPE observed with earlier versions when an empty CompilerPlugin.toml file added.

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

@azinneera
Copy link
Contributor

azinneera commented Oct 4, 2024

@Shadow-Devil Assigning you to this as requested in issue #42120

@azinneera
Copy link
Contributor

@Shadow-Devil can you comment on this issue so that I can assign you?

@Shadow-Devil
Copy link
Contributor

Sure, please assign me :)

Copy link

github-actions bot commented Oct 8, 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.

@gimantha gimantha added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Credits/20 Hacktoberfest 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
Status: Done
4 participants