Код ошибки @ 5fa01e33 в Java, полученный в результате доступа к данным Google API - PullRequest
0 голосов
/ 07 января 2012

У меня проблемы с программированием на Java. Эта Java вызывает Google API, который предоставляет мне доступ к GData

У меня проблемы с запросом какого-либо запроса, в результате @ 5fa01e33. Это мой код:

    package com.thegroovie;

import java.net.URL;

import javax.swing.JOptionPane;

import com.google.gdata.client.DocumentQuery;
import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.docs.DocumentListFeed;

public class GDataExample {
    public static void main(String[] args) {
    String username = JOptionPane.showInputDialog(null,"Input Username");
    String password = JOptionPane.showInputDialog(null,"Input Password");

    try{
        DocsService service = new DocsService("Document List demo");
        service.setProtocolVersion(DocsService.Versions.V3);
        service.setUserCredentials(username, password);

        URL documentListFeedUrl = new
            URL("https://docs.google.com/feeds/default/private/full");

        DocumentListFeed feed = service.getFeed(documentListFeedUrl, DocumentListFeed.class);

        for(DocumentListEntry entry : feed.getEntries()){
            System.out.println(entry.getTitle().getPlainText());
        }
        System.out.println("*******************************");
        String input_query = JOptionPane.showInputDialog(null,"Search : ");
        DocumentQuery query = new DocumentQuery(documentListFeedUrl);
        query.setFullTextQuery(input_query);
        DocumentListFeed feeds = service.getFeed(query, DocumentListFeed.class);
        System.out.print(feeds);        
      } 
    catch (Exception ex){
          System.err.println("Exception "+ ex.getMessage());
      }
    }


}   

Как это решить?

Спасибо

1 Ответ

1 голос
/ 07 января 2012

Это не похоже на код ошибки. Вместо этого вы печатаете объект DocumentListFeed, тип которого не имеет переопределенного метода toString. Вы можете получить доступ к содержимому канала с помощью соответствующих методов доступа, описанных в документации.

...