athibanraj / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

Error Uploading spreadsheets (.xls, .ods) #111

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using next Java code to upload files:

private static final String DOCS_DEF_FEED_HOST = "docs.google.com";
private static final String DOCS_FEED_URL_PATH =
"/feeds/documents/private/full";
...

DocumentEntry newDocument = new DocumentEntry();
// newDocument.setFile(documentFile);
MediaType mediaType = MediaType.fromFileName(documentFile.getName());
newDocument.setFile(documentFile, mediaType.getMimeType());
newDocument.setTitle(new PlainTextConstruct(documentFile.getName()));

URL documentListFeedUrl;
documentListFeedUrl = new URL("http://" + DOCS_DEF_FEED_HOST
                + DOCS_FEED_URL_PATH);

DocumentListEntry uploaded = docsService.insert(documentListFeedUrl,
                newDocument);

2. Error when uploading spreadsheets .xls, .ods (for .doc, .odt, .txt, .ppt
it is working fine.)
3.

What is the expected output? What do you see instead?
 1) When trying to upload an .xls file, next exception occurs:
com.google.gdata.util.ServiceException: Internal Server Error
Invalid document id: trix.pby5sRxZqEj7LrbUHUTjAVA

        at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataReque
st.java:529)
        at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataR
equest.java:555)
        at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.jav
a:480)
        at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:459)
        at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
527)
        at
com.google.gdata.client.media.MediaService.insert(MediaService.java:339)
        at
fr.silogic.kplab.google.ws.docs.impl.GoogleDocsImpl.uploadFile(GoogleDocsImpl.ja
va:415)
        at
fr.silogic.kplab.google.ws.docs.impl.GoogleDocsImpl.uploadDocument(GoogleDocsImp
l.java:371)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
        at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
        at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.jav
a:257)
        at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
        at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
        at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:44
4)
        at
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
        at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:
135)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.
java:129)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate
.java:160)
        at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:188)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
13)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
74)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.jav
a:525)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.josso.tc55.agent.SSOAgentValve.invoke(SSOAgentValve.java:271)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108
)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConne
ction(Http11BasePro
tocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:52
8)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorker
Thread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:68
9)
        at java.lang.Thread.run(Thread.java:595)
5 fÚvr. 2009 10:32:50 com.sun.xml.ws.server.sei.EndpointMethodHandler invoke
GRAVE: com.google.gdata.util.ServiceException: Internal Server Error
Invalid document id: trix.pby5sRxZqEj7LrbUHUTjAVA

javax.xml.ws.WebServiceException: com.google.gdata.util.ServiceException:
Internal Server Error
Invalid document id: trix.pby5sRxZqEj7LrbUHUTjAVA

2)  1) When trying to upload an .ods file, next exception occurs:
5 fÚvr. 2009 10:34:07 com.sun.xml.ws.server.sei.EndpointMethodHandler invoke
GRAVE: com.google.gdata.util.InvalidEntryException: Bad Request
Could not convert document.

javax.xml.ws.WebServiceException:
com.google.gdata.util.InvalidEntryException: Bad Request
Could not convert document.

        at
fr.silogic.kplab.google.ws.docs.impl.GoogleDocsImpl.uploadDocument(GoogleDocsImp
l.java:377)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
        at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
        at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.jav
a:257)
        at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
        at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
        at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:44
4)
        at
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
        at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:
135)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.
java:129)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate
.java:160)
        at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:188)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
13)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
74)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.jav
a:525)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.josso.tc55.agent.SSOAgentValve.invoke(SSOAgentValve.java:271)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108
)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConne
ction(Http11BasePro
tocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:52
8)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorker
Thread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:68
9)
        at java.lang.Thread.run(Thread.java:595)
Caused by: com.google.gdata.util.InvalidEntryException: Bad Request
Could not convert document.

        at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataReque
st.java:502)
        at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataR
equest.java:555)
        at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.jav
a:480)
        at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:459)
        at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
527)
        at
com.google.gdata.client.media.MediaService.insert(MediaService.java:339)
        at
fr.silogic.kplab.google.ws.docs.impl.GoogleDocsImpl.uploadFile(GoogleDocsImpl.ja
va:415)
        at
fr.silogic.kplab.google.ws.docs.impl.GoogleDocsImpl.uploadDocument(GoogleDocsImp
l.java:371)
        ... 37 more

What version of the product are you using? On what operating system?
JAVA API gdata 1.29.0 (same issue with orevious versions)
WIN XP SP2, WIN 2000 Professional

Please provide any additional information below.
The code provided before working fine with .doc, .odt, .txt, .ppt fie types.

Thank you.

Original issue reported on code.google.com by kplab.to...@googlemail.com on 5 Feb 2009 at 10:18

GoogleCodeExporter commented 9 years ago
Thank you for reporting this issue.

Could you please attach two sample files (one xml, one ods) that has this 
issue.  Or
is it for all xls and ods files?

Original comment by vbarat...@gmail.com on 5 Feb 2009 at 1:14

GoogleCodeExporter commented 9 years ago
Hi,

Thank you for your reactivuty.

Unfortunatelly, it seems it is for all .xls and .ods files. An I include in the 
list
.csv files ( Bad Request Could not convert document.)

Regards

Original comment by kplab.to...@googlemail.com on 5 Feb 2009 at 4:31

GoogleCodeExporter commented 9 years ago
Hi,

In fact, despite the error (thrown exception) the .xls are correctly uploaded. 
On the other hand, the .ods and .csv are not.

Regards,

Original comment by kplab.to...@googlemail.com on 5 Feb 2009 at 4:54

GoogleCodeExporter commented 9 years ago
I have exactly the same problem using:
OS: Linux 2.6.25 SMP x86_64
Java: 1.6.0_12-ea (64 bits)
Gdata-client: 1.29.0

I tried uploading an Excel sheet created by Apache POI and one created by Open 
Office
Calc. Both resulted in the exception mentioned in the original bugreport. 
Uploading
odt (Open Office Writer) files works fine. I used "application/vnd.ms-excel" as 
the
mime-type for the Excel sheets.

Original comment by t.salfis...@gmail.com on 6 Feb 2009 at 2:15

GoogleCodeExporter commented 9 years ago
I've come across a similar problem before and now getting this one. First came 
across
this problem.

http://code.google.com/p/gdata-issues/issues/detail?id=897&q=API:DocumentsList&c
olspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary

I noticed that the document has been created though. Problem occurred uploading 
a
blank csv file or populated csv exporting data from our app. Mime type set to 
"text/csv".

Way we get around it is:

catch (ServiceException se) {
            if (se.getMessage().equalsIgnoreCase("service unavailable") ||
se.getMessage().equalsIgnoreCase("internal server error")) {
    // Try and find the document based upon document title.
    DocumentListEntry document = findDocument(docTitle);

findDocument:

DocumentQuery documentQuery = new DocumentQuery(documentListFeedUrl);
documentQuery.setTitleQuery(documentName);
documentQuery.setTitleExact(true);

// Get current date in dd/mm/yyyy format
String today = ConversionHelper.calendarToString(Calendar.getInstance());
documentQuery.setUpdatedMin(DateTime.parseDateTime(formatDate(today) + 
"T00:00:00"));
documentQuery.setUpdatedMax(DateTime.parseDateTime(formatDate(today) + 
"T23:59:59"));

DocumentListFeed feed = docsService.query(documentQuery, 
DocumentListFeed.class);

Hope this helps.

Original comment by stephen....@gmail.com on 9 Feb 2009 at 2:10

GoogleCodeExporter commented 9 years ago
FYI: We are investigating this issue.

(internal bug tracker id: 1641954)

Original comment by vbarat...@gmail.com on 10 Feb 2009 at 3:29

GoogleCodeExporter commented 9 years ago
I'm seeing very similar bad behavior.

Original comment by johnbray...@gmail.com on 7 Jun 2009 at 2:21

GoogleCodeExporter commented 9 years ago
My behavior is very strange: yesterday i uploaded an .xls file to google docs 
(via
web UI), i checked if conversion was successful (and it was!) and then i 
started to
develop my gdata-java-client powered app.

Now, re-uploading the same file via  the application i get :

Caused by: com.google.gdata.util.InvalidEntryException: Could not convert 
document.
<errors xmlns='http://schemas.google.com/g/2005'>
<error>
<domain>GData</domain>
<code>InvalidEntryException</code>
<internalReason>Could not convert document.</internalReason>
</error>
</errors>

        at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataReque
st.java:590)

but the thing more strange is that if now i try to re-upload the same file that 
i
uploaded successfully yesterday i get: 
(Sorry, there was an error saving the file. Please try again.)

i Hope in a temporary bug.

Original comment by garr.com...@gmail.com on 4 Jun 2010 at 3:16

GoogleCodeExporter commented 9 years ago
Hi,

I have the same issue with uploading file with Google Apps:
Could not convert document.
<errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>Inva
lidEntryException</code><internalReason>Could not convert 
document.</internalReason></error></errors>

Could you provide eny information about this issue.

Thanks

Original comment by taras...@gmail.com on 27 Jan 2011 at 10:38

GoogleCodeExporter commented 9 years ago
I need to make a feed using the standard feed you tube but for categories like 
science and technology but when I do that the following error appears.  Do not 
know if it's how I'm passing the parameter category

Invalid id
<errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>Inva
lidRequestUriException</code><internalReason>Invalid 
id</internalReason></error></errors>

Original comment by jhonatha...@gmail.com on 17 Oct 2012 at 4:27