How to fix java.io.IOException: Attempted read from closed stream? -
How to fix java.io.IOException: Attempted read from closed stream? -
i have below code throwing io error @ sec print statement. not able figure out why throwing. can 1 help me out. if comment line working fine. understood using response object 2 times should able utilize more 1 time.
response response=customerresource.customeroperations("post", mdfcommonutil.getinstance() .readfileasstring("commonfiles/payloadforpost.xml"),null); system.out.println("inside methid=="+response.getstatuscode()); system.out.println("inside methid=="+response.asstring());
stack trace:
java.io.ioexception: attempted read on closed stream. @ org.apache.http.conn.eofsensorinputstream.isreadallowed(eofsensorinputstream.java:110) @ org.apache.http.conn.eofsensorinputstream.read(eofsensorinputstream.java:136) @ sun.nio.cs.streamdecoder.readbytes(unknown source) @ sun.nio.cs.streamdecoder.implread(unknown source) @ sun.nio.cs.streamdecoder.read(unknown source) @ java.io.inputstreamreader.read(unknown source) @ java.io.bufferedreader.fill(unknown source) @ java.io.bufferedreader.read1(unknown source) @ java.io.bufferedreader.read(unknown source) @ java.io.reader.read(unknown source) @ java_io_reader$read.call(unknown source) @ com.jayway.restassured.internal.restassuredresponseimpl.convertstreamtostring(restassuredresponseimpl.groovy:366) @ com.jayway.restassured.internal.restassuredresponseimpl.this$2$convertstreamtostring(restassuredresponseimpl.groovy) @ com.jayway.restassured.internal.restassuredresponseimpl$this$2$convertstreamtostring.callcurrent(unknown source) @ com.jayway.restassured.internal.restassuredresponseimpl.asstring(restassuredresponseimpl.groovy:144) @ mdf.test.rest.testcases.testcustomerresource.postcustomerfeature2(testcustomerresource.java:60) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.testng.internal.methodinvocationhelper.invokemethod(methodinvocationhelper.java:84) @ org.testng.internal.invoker.invokemethod(invoker.java:714) @ org.testng.internal.invoker.invoketestmethod(invoker.java:901) @ org.testng.internal.invoker.invoketestmethods(invoker.java:1231) @ org.testng.internal.testmethodworker.invoketestmethods(testmethodworker.java:127) @ org.testng.internal.testmethodworker.run(testmethodworker.java:111) @ org.testng.testrunner.privaterun(testrunner.java:767) @ org.testng.testrunner.run(testrunner.java:617) @ org.testng.suiterunner.runtest(suiterunner.java:334) @ org.testng.suiterunner.runsequentially(suiterunner.java:329) @ org.testng.suiterunner.privaterun(suiterunner.java:291) @ org.testng.suiterunner.run(suiterunner.java:240) @ org.testng.suiterunnerworker.runsuite(suiterunnerworker.java:52) @ org.testng.suiterunnerworker.run(suiterunnerworker.java:86) @ org.testng.testng.runsuitessequentially(testng.java:1224) @ org.testng.testng.runsuiteslocally(testng.java:1149) @ org.testng.testng.run(testng.java:1057) @ org.testng.remote.remotetestng.run(remotetestng.java:111) @ org.testng.remote.remotetestng.initandrun(remotetestng.java:204) @ org.testng.remote.remotetestng.main(remotetestng.java:175)
java ioexception rest-assured
Comments
Post a Comment