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

“NullPointerException”The number passed in the api is AImage is a null pointer. #2776

Open
Cici-Musse-Lee opened this issue May 24, 2022 · 0 comments

Comments

@Cici-Musse-Lee
Copy link

Cici-Musse-Lee commented May 24, 2022

The file path is org.zkoss.image.AImage.
In our test case, pass inputStream=null into the function whose api is AImage. In this api, a null pointer is introduced when the function init() is called for initialization, and a null pointer exception will be generated.
source code:

public AImage(String name,InputStream is)throws IOException{
    try{
          init (name,Files.readAll(is));
     }finally{
          is.close();
     }
}

test code:

java.lang.string string1 ="{\"key\":null}";
java.io.InputStream inputstream2 = null;
org.zkoss.image.AImage aImage0 = new org.zkoss.image.AImage(string1,inputstream2);
aImage0.isContentDisposition ();

test result

java.lang.NullPointerException:Cannot invoke "java.io.InputStream.close()"because "is"is nullat org.zkoss.image.Almage.<init>(Almage.java:86)
at org.zkoss.image.Almage_Test.test_isContentDisposition_4_64(Almage_Test.java:898)
at java.base/jdk.internal.reflect.NativeMethodAccessorlmpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorlmpl.invoke0(NativeMethodAccessorlmpl.java:77)
at java.base/jdk.internal.reflect.DeleqatingMethodAccessorlmplinvoke(DeleqatingMethodAccessorlmpl.java:43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant