It appears that increasing the log level may cause issues with uploading files.
How to reproduce:
set the com.ibm.watson.developer_cloud.util.HttpLogging#LOG level to ALL
Call a Watson service with which uploads a file, for example the Visual Recognition service:
IamOptions options = new IamOptions.Builder()
.apiKey("{apikey}")
.build();
VisualRecognition service = new VisualRecognition("2018-03-19", options);
DetectFacesOptions detectFacesOptions = new DetectFacesOptions.Builder()
.imagesFile(new File("./Ginni_Rometty.jpg"))
.build();
DetectedFaces result = service.detectFaces(detectFacesOptions).execute();
System.out.println(result);
`HttpLoggingInterceptor` logs the request body by calling `com.ibm.watson.developer_cloud.http.InputStreamRequestBody#writeTo`, and then the actual upload is done by calling `writeTo` a second time for the same `InputStream`.
The second `writeTo` call (the one which actually does the real upload) fails because the stream is already closed.
It appears that increasing the log level may cause issues with uploading files.
How to reproduce:
com.ibm.watson.developer_cloud.util.HttpLogging#LOG
level toALL
VisualRecognition service = new VisualRecognition("2018-03-19", options);
DetectFacesOptions detectFacesOptions = new DetectFacesOptions.Builder() .imagesFile(new File("./Ginni_Rometty.jpg")) .build(); DetectedFaces result = service.detectFaces(detectFacesOptions).execute(); System.out.println(result);