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]: NullPointerException when invoking a service resource with optional parameter containing keyword #41057

Closed
anuruddhal opened this issue Jul 19, 2023 · 2 comments · Fixed by #41075
Assignees
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Milestone

Comments

@anuruddhal
Copy link
Member

Description

Invoking the following getPackage resource without limit results in a null pointer exception.

import ballerina/http;

listener http:Listener webAPIEP = new (9090);

service / on webAPIEP {

    isolated resource function get packages(int? 'limit = (), string? package = (), boolean? user\-packages = false) returns http:Ok|http:BadRequest|http:InternalServerError|http:Unauthorized {
        return <http:Ok>{
            body: "hello"
        };
    }

}

Following curl results in a null pointer.

curl http://localhost:9090/packages\?package=jbl
[2023-07-19 14:55:42,625] SEVERE {b7a.log.crash} - null
java.lang.NullPointerException
	at bctestorg.hellowin.0.creators.$_function_calls.call(Unknown Source)
	at bctestorg.hellowin.0.$_init.call(hellowin)
	at io.ballerina.runtime.internal.scheduling.AsyncUtils.lambda$callDefaultValueFunction$0(AsyncUtils.java:218)
	at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
	at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:306)
	at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:273)
	at java.base/java.lang.Thread.run(Thread.java:829)

error: java.lang.NullPointerException

Invoking with limit parameter works.

curl http://localhost:9090/packages\?limit\=1\&package=jbl
hello%

Steps to Reproduce

No response

Affected Version(s)

2201.7.0

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label Jul 19, 2023
@anuruddhal anuruddhal changed the title [Bug]: NullPointerException when invoking a service resource with optional parameter with keyword [Bug]: NullPointerException when invoking a service resource with optional parameter containing keyword Jul 19, 2023
@HindujaB
Copy link
Contributor

The issue happens due to this change
adb7633

@github-actions
Copy link

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.

@HindujaB HindujaB added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants