I am trying to upload a file using the AWS S3 Download APIs (I am using SDK 1.8.1). I can successfully complete the download.
But with interruptions, I get this exception.
July 31, 2014 4:39:38 com.amazonaws.http.AmazonHttpClient executeHelper INFO: cannot execute HTTP request: Connection resetjava.net.SocketException: connection reset in java.net.SocketInputStream.read (SocketInputStream.java:189) in java .net.SocketInputStream.read (SocketInputStream.java:121) at sun.security.ssl.InputRecord.readFully (InputRecord.javahaps12) at sun.security.ssl.InputRecord.read (InputRecord.javahaps50) in sun. security.ssl.SSLSocketImpl.readRecord (SSLSocketImpl.java:927) at sun.security.ssl.SSLSocketImpl.readDataRecord (SSLSocketImpl.java:884) at sun.security.ssl.AppInputStream.read (AppInputStream.java:102) at org .apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer (AbstractSessionInputBuffer.java:166) in org.apache.http.impl.io.SocketInputBuffer.fillBuffer (SocketInputBuffer.java:90) in org.apache.http.impl.io .AbstractSessionInputBuffer.readLine (AbstractSessionInputBuffer.java:281) in org.apache.http.impl.conn.DefaultHttpResponse Parser.parseHead (DefaultHttpResponseParser.java:92) in org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead (DefaultHttpResponseParser.java:62) in org.apache.http.impl.ioparmeageParage.arbessage 254) in org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader (AbstractHttpClientConnection.java:289) in org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader (DefaultClientConnection.javaap.plava.pl .conn.ManagedClientConnectionImpl.receiveResponseHeader (ManagedClientConnectionImpl.java:191) in org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse (HttpRequestExecutor.quava.hava.dava.hava. ) in org.apache.http.protocol.HttpRequestExecutor.execute (HttpRequestExecutor.java:127) in org.apache.http.impl.client.DefaultRequestDirector.tryExecute (DefaultRequestDirector.java:717) in org.apachehtt. client.Defaul tRequestDirector.execute (DefaultRequestDirector.java<22) in org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java:906) in org.apache.http.impl.client.AbstractHttpClient.execute Abstract 805) in com.amazonaws.http.AmazonHttpClient.executeHelper (AmazonHttpClient.java:402) in com.amazonaws.http.AmazonHttpClient.execute (AmazonHttpClient.java:245) in com.amazonaws.services.s3.AmazonSientClient .java: 3711) in com.amazonaws.services.s3.AmazonS3Client.uploadPart (AmazonS3Client.java:2809) in the cloud. <-filename →. writeContent (<-filename →. java: <-linenumber →)
in the following code
try { _partETags.add(_s3.uploadPart(uploadPartReq).getPartETag()); } catch (AmazonClientException e) { System.out.println("Amazon service error. Retrying..."); printException(e); } catch (Exception e) { printException(e); throw new UserException("Received an exception while performing upload part"); }
If I look at the documentation, he says that the uploadPart function will only throw two classes, AmazonClientException and AmazonServiceException.
Link: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3.html#uploadPart(com.amazonaws.services.s3.model.UploadPartRequest)
<documentation> ... UploadPartResult uploadPart(UploadPartRequest request) throws AmazonClientException, AmazonServiceException ... Throws: AmazonClientException - If any errors are encountered in the client while making the request or handling the response. AmazonServiceException - If any errors occurred in Amazon S3 while processing the request. ... </documentation>
But I get in another exception.
I have the following questions:
- Is this the expected behavior, if not how to solve this problem?
- Why is my catch try block unable to catch this exception?
- In the case of AmazonClient or AmazonServiceException, is it recommended that we reload the download, or if they are considered irreparable errors?
source share