gpt4 book ai didi

android - Amazon S3 分段上传期间出现 javax.net.ssl.SSLException

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:45:03 25 4
gpt4 key购买 nike

我正在使用 Simpl3r,a simple high level Android API for robust and resumable multipart file uploads using the Amazon S3 service , 将媒体文件上传到我的存储桶。

在某些上传中,我收到 SSLException 错误。下面是抛出异常的代码:

(根据 Simpl3r 示例,我的类是 IntentService 的子类)

@Override
protected void onHandleIntent(Intent intent) {

String filePath = intent.getStringExtra(ARG_FILE_PATH);
final String s3ObjectKey = intent.getStringExtra(ARG_OBJECT_KEY);
File fileToUpload = new File(filePath);
String s3BucketName = getString(R.string.s3_bucket);

final String msg = "Uploading " + s3ObjectKey + "...";

// create a new uploader for this file
uploader = new Uploader(this, s3Client, s3BucketName, s3ObjectKey, fileToUpload);

// listen for progress updates and broadcast/notify them appropriately
uploader.setProgressListener(new UploadProgressListener() {
@Override
public void progressChanged(ProgressEvent progressEvent,
long bytesUploaded, int percentUploaded) {

Notification notification = buildNotification(msg, percentUploaded);
nm.notify(NOTIFY_ID_UPLOAD, notification);
broadcastState(s3ObjectKey, percentUploaded, msg);
}
});

// broadcast/notify that our upload is starting
Notification notification = buildNotification(msg, 0);
nm.notify(NOTIFY_ID_UPLOAD, notification);
broadcastState(s3ObjectKey, 0, msg);

try {
String s3Location = uploader.start(); // initiate the upload
broadcastStateDone(s3ObjectKey, s3Location, "File successfully uploaded to " + s3Location);
} catch (UploadIterruptedException uie) {
broadcastStateError(s3ObjectKey, "User interrupted");
} catch (Exception e) {
e.printStackTrace();
broadcastStateError(s3ObjectKey, "Error: " + e.getMessage());
}
}

这是堆栈跟踪:

04-28 10:18:35.482  28236-28304/org.dornad.s3test I/AmazonHttpClient﹕ Unable to execute HTTP request: Write error: ssl=0x5c7c7760: I/O error during system call, Connection reset by peer
javax.net.ssl.SSLException: Write error: ssl=0x5c7c7760: I/O error during system call, Connection reset by peer
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_write(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:706)
at com.amazonaws.org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:169)
at com.amazonaws.org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:119)
at com.amazonaws.org.apache.http.entity.InputStreamEntity.writeTo(InputStreamEntity.java:102)
at com.amazonaws.http.RepeatableInputStreamRequestEntity.writeTo(Unknown Source)
at com.amazonaws.org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98)
at com.amazonaws.org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
at com.amazonaws.org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:122)
at com.amazonaws.org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:271)
at com.amazonaws.org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:197)
at com.amazonaws.org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:257)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doSendRequest(Unknown Source)
at com.amazonaws.org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:717)
at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:522)
at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at com.amazonaws.http.AmazonHttpClient.executeHelper(Unknown Source)
at com.amazonaws.http.AmazonHttpClient.execute(Unknown Source)
at com.amazonaws.services.s3.AmazonS3Client.invoke(Unknown Source)
at com.amazonaws.services.s3.AmazonS3Client.uploadPart(Unknown Source)
at com.readystatesoftware.simpl3r.Uploader.start(Uploader.java:162)
at org.dornad.s3test.service.UploadService.onHandleIntent(UploadService.java:96)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)

异常没有被我的 Exception 子句捕获。这意味着该应用程序卡在永不结束的“上传”状态。

有什么想法吗?

最佳答案

这些上传需要多长时间?你能重置吗?

关于android - Amazon S3 分段上传期间出现 javax.net.ssl.SSLException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23343930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com