Issue in PreparedAttachment in Cloudant

两盒软妹~` 提交于 2019-12-12 03:33:41

问题


Last 2 or 3 days i am getting issue in attachment download when app are sync first time with cloudant.

Error log is:-

W/PreparedAttachment: Problem reading from input or writing to output stream java.net.ProtocolException: unexpected end of stream 
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:449)

at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
at java.io.InputStream.read(InputStream.java:162)
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:83)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213)
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037)
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136)
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386)
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252)
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177)
at java.lang.Thread.run(Thread.java:818)

E/PullStrategy: There was a problem downloading an attachment to the datastore, terminating replication
com.cloudant.sync.datastore.AttachmentNotSavedException: java.net.ProtocolException: unexpected end of stream
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:90)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213)
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037)
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136)
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386)
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252)
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.net.ProtocolException: unexpected end of stream
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:449)
at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
at java.io.InputStream.read(InputStream.java:162)
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:83)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213) 
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037) 
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136) 
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386) 
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252) 
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177) 
at java.lang.Thread.run(Thread.java:818) 

please give me your help. thank you.


回答1:


The problem isn't with PreparedAttachment its with the underlying networking. It would appear that server sent more bytes than then Content-Length header stipulated. This is probably a bug with the server you using.



来源:https://stackoverflow.com/questions/41313089/issue-in-preparedattachment-in-cloudant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!