3
我試圖使用Fusiontables.Table.ImportRows將csv文件導入到融合表中。但是當我運行execute()時,我得到一個NullPointerException,沒有額外的信息。fusiontables NPE執行ImportRows時
我真的使用FusionOAuth2樣本代碼並執行一個額外的方法:
private static void importRows(final String tableId){
try {
final String text = "Text,Number,Location\n" +
"company,13,my street 14";
final ByteArrayContent byteArrayContent = ByteArrayContent.fromString("text/comma-separated-values", text);
final Fusiontables.Table.ImportRows importRows = fusiontables.table().importRows(tableId, byteArrayContent);
importRows.setEncoding("UTF-8");
importRows.execute();
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
這是例外:
java.lang.NullPointerException
at java.net.URI$Parser.parse(URI.java:3003)
at java.net.URI.<init>(URI.java:578)
at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:100)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:269)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:408)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
at com.google.api.services.samples.fusiontables.cmdline.FusionTablesSample.importRows(FusionTablesSample.java:185)
我缺少什麼?
不,我沒有改變初始化。 – vogelinho
像createTable所有其他方法正在工作。 – vogelinho