Aurélien Pupier created OLINGO-1647:
---------------------------------------

             Summary: NPE in tests 
ODataVersionConformanceITCase.validODataMaxVersionHeader()
                 Key: OLINGO-1647
                 URL: https://issues.apache.org/jira/browse/OLINGO-1647
             Project: Olingo
          Issue Type: Bug
    Affects Versions: Version (Java) V4 5.0.0
            Reporter: Aurélien Pupier


On main branch, there are 2 failing tests with an NPE:
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase.validODataMaxVersionHeader()

{noformat}
[ERROR] Tests run: 8, Failures: 0, Errors: 
2, Skipped: 0, Time elapsed: 4.037 s <<< FAILURE! -- in 
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase
[ERROR] 
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase.validODataVersionAndMaxVersionHeader
 -- Time elapsed: 0.029 s <<< ERROR!
java.lang.NullPointerException
        at java.base/java.io.Reader.<init>(Reader.java:168)
        at 
java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:112)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:1152)
        at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
        at 
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase.validODataVersionAndMaxVersionHeader(ODataVersionConformanceITCase.java:117)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

[ERROR] 
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase.validODataMaxVersionHeader
 -- Time elapsed: 0.021 s <<< ERROR!
java.lang.NullPointerException
        at java.base/java.io.Reader.<init>(Reader.java:168)
        at 
java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:112)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:1152)
        at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
        at 
org.apache.olingo.fit.tecsvc.http.ODataVersionConformanceITCase.validODataMaxVersionHeader(ODataVersionConformanceITCase.java:101)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
{noformat}

In version 4.10, with Java 8, this is the content of the errorstream:
{noformat}
{"error":{"code":null,"message":"The content-type range ' *; q=.2' is not 
supported as value of the Accept header."}}
{noformat}

In version 5.0.0, with Java 17, 21 and 25, the error stream is null meaning 
that nothing is written to the errorstream.
I'm wondering why the test was expecting something non-null in the errorstream 
given that the test name is called "valid"

I cannot test 4.10 with Java 11+ due to:
{noformat}
[ERROR] 
/home/apupier/git/olingo-odata4/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SearchHandler.java:[26,22]
 package javax.xml.bind does not exist
[ERROR] 
/home/apupier/git/olingo-odata4/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SearchHandler.java:[99,14]
 cannot find symbol
[ERROR]   symbol:   variable DatatypeConverter
[ERROR]   location: class 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.SearchHandler
[ERROR] 
/home/apupier/git/olingo-odata4/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SearchHandler.java:[101,14]
 cannot find symbol
[ERROR]   symbol:   variable DatatypeConverter
[ERROR]   location: class 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.SearchHandler
{noformat}
I cannot test Java 8 with 5.0 due to compilation error too



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to