SilverHoodCorp / gdata-java-client

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

Unexpected ParseException when calling getWorksheet() on SpreadsheetEntry #248

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

@Test
public void test() throws IOException, ServiceException, 
DocumentListException, InterruptedException {
// insert an existing spreadsheet here
SpreadsheetEntry someSpreadsheet = ...;
String title = "The worksheet's title";
WorksheetEntry worksheet = new WorksheetEntry();
worksheet.setTitle(new PlainTextConstruct(title));
worksheet.setRowCount(100);
worksheet.setColCount(10);
URL worksheetFeedUrl = someSpreadsheet.getWorksheetFeedUrl();
// spreadsheetService is a working instance of SpreadsheetService
spreadsheetService.insert(worksheetFeedUrl, worksheet);
WorksheetEntry matchingEntry = null;
// The following line throws the exception:
List<WorksheetEntry> worksheets = someSpreadsheet.getWorksheets();
for (WorksheetEntry entry : worksheets) {
if (entry.getTitle().getPlainText().equalsIgnoreCase(title)) {
matchingEntry = entry;
break;
}
}
// We never get here because of the exception:
Assert.assertEquals(matchingEntry.getTitle().getPlainText(), title);
}

Here is the Exception thrown by the line
List<WorksheetEntry> worksheets = spreadsheet.getWorksheets();
throws the following exception (truncated):

com.google.gdata.util.ParseException: [Line 1, Column 2577, element 
gs:rowCount] The count must be specified.
at 
com.google.gdata.util.XmlParser.throwParseException(XmlParser.java:722)
...
at com.google.gdata.client.Service.getFeed(Service.java:955)
at 
com.google.gdata.data.spreadsheet.SpreadsheetEntry.getWorksheets(Sprea
dsheetEntry.java:128)
at de.mypackage.SpreadsheetTest.test (SpreadsheetTest.java:238)

What version of the product are you using? On what operating system?
gdata-java-client library 1.40.3 on MacOS X (Snow Leopard)

Please provide any additional information below.
The code above used to work.

Original issue reported on code.google.com by stefan.u...@gmail.com on 16 Mar 2010 at 4:33

GoogleCodeExporter commented 9 years ago
i actually think this is a higher priority issue. None of our insert 
spreadsheet code
in our app now works.  calling at Service.getFeed() will throw this error as 
well and
I even tried going to the latest 1.43 gdata client that was published yesterday.

Original comment by nghia...@gmail.com on 17 Mar 2010 at 3:37

GoogleCodeExporter commented 9 years ago
I tested some more and it seems that the DocsService.insert() method is creating
invalid spreadsheet. What I mean by this is that when I create a new 
spreadsheet as
in the sample/docs/DocList.java createNew() method, and I try to access this
spreadsheet via the Google Docs Web-GUI, I can open the spreadsheet but are not 
able
to edit it.

Original comment by stefan.u...@gmail.com on 17 Mar 2010 at 5:38

GoogleCodeExporter commented 9 years ago
I see, this is our sample code.  You're saying the insertSpreadSheet() makes an
invalid one which causes the rest to break.  It's rather sucky, I wonder if 
there's a
way to flag this so they'll take a look at it quicker?

<code>
        SpreadsheetEntry spreadSheetEntry = m_docService.insertSpreadSheet(
"newtestnonbatch" );
        m_spreadSheetService = new SpreadsheetService( "CreateDocumentSpreadsheet" );
        m_spreadSheetService.setUserCredentials( m_username, m_password );
        WorksheetFeed worksheetFeed = m_spreadSheetService.getFeed(
spreadSheetEntry.getWorksheetFeedUrl(), WorksheetFeed.class );
        WorksheetEntry workSheetEntry = worksheetFeed.getEntries().get( 0 );
</code>

Original comment by nghia...@gmail.com on 17 Mar 2010 at 5:44

GoogleCodeExporter commented 9 years ago
The client expects the worksheets have "rowCount" element in the response. We 
are
looking into this issue, and will get back to you as soon as possible.

Original comment by vbarat...@gmail.com on 18 Mar 2010 at 2:35

GoogleCodeExporter commented 9 years ago
This seems to have been fixed, probably as part of 
http://code.google.com/p/gdata-
issues/issues/detail?id=1953

Original comment by stefan.u...@gmail.com on 22 Mar 2010 at 5:41

GoogleCodeExporter commented 9 years ago
So is this issue fixed in production? Because we're still getting the error.

Original comment by nghia...@gmail.com on 22 Mar 2010 at 5:46

GoogleCodeExporter commented 9 years ago
@nghie.le, like I said, it works for me (I am not working for Google so I have 
access
to the same environment as you). Note that any of my existing 
spreadsheets/worksheets
that exhibited this problem (i.e. that made my tests fail) still do not work. 
But
manually deleting them (via the GUI) and re-creating them via the API now works.

Hopefully someone from Google can confirm this.

Original comment by stefan.u...@gmail.com on 22 Mar 2010 at 6:15

GoogleCodeExporter commented 9 years ago
Ok as of today, It is now working in our code, so we're happy as clams again.

Original comment by nghia...@gmail.com on 23 Mar 2010 at 8:38

GoogleCodeExporter commented 9 years ago

Original comment by vbarat...@gmail.com on 24 Mar 2010 at 11:35