vl106
vl106

Reputation: 118

Polarion Java API throws exception in sessionService.logIn

I try to use the Polarion Open Java API as given in https://testdrive.polarion.com/polarion/sdk/index.html. So far I only used the REST API with Perl. But the Polarion REST API is not yet feature complete.

My Java code is a (mere) copy of the SDK example com.polarion.example.importer (https://testdrive.polarion.com/polarion/sdk/examples/com.polarion.example.importer/).

So far it works up to the invocation of the logIn method:

    System.out.println("Connectiong to " + address + " ...");
    WebServiceFactory factory = new WebServiceFactory(address);

    SessionWebService sessionService = factory.getSessionService();
    ProjectWebService projectService = factory.getProjectService();
    TrackerWebService trackerService = factory.getTrackerService();

    sessionService.logIn( // <-- IOException: Attempted read from closed stream
        properties.getProperty("USER"), 
        properties.getProperty("PASSWORD"));

I am not really a Java guy but the backtrace shows how the method invocation makes its way down to the lower networking layer. The decoding then stops as I am somehow "running out of bytes".

        at Demo.main(Demo.java:45)
Caused by: java.io.IOException: Attempted read from closed stream.
        at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:165)
        at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
        at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)
        at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)
        at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
        at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177)
        at java.base/java.io.Reader.read(Reader.java:250)
        at org.apache.http.util.EntityUtils.toString(EntityUtils.java:227)
        at org.apache.http.util.EntityUtils.toString(EntityUtils.java:308)
        at com.polarion.alm.ws.client.internal.connection.CommonsHTTPSender.invoke(CommonsHTTPSender.java:278)

As the original example has the same issue I am a afraid it's rather a generic Java issue?

PS: I use java 17.0.11 2024-04-16 LTS

Upvotes: -1

Views: 151

Answers (1)

vl106
vl106

Reputation: 118

I was told that issue comes from outdated Apache axis being used. As I am not in the mood to fiddle with Java's package mania it's the dead end for my tool.

Upvotes: 0

Related Questions