• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revisión3d6a6983497365d8fe15cd749bf5745aaadc5189 (tree)
Tiempo2012-06-27 19:45:54
Autorhayashi <hayashi.yuu@gmai...>
Commiterhayashi

Log Message

StringIndexOutOfBoundsException: String index out of range: -1
hayashi.kiban.ConvBusstopGML.outputDb(ConvBusstopGML.java:331)

Cambiar Resumen

Diferencia incremental

--- a/src/hayashi/kiban/ConvBusstopGML.java
+++ b/src/hayashi/kiban/ConvBusstopGML.java
@@ -299,57 +299,58 @@ public class ConvBusstopGML {
299299 ResultSet rset9 = ps9.executeQuery();
300300 while (rset9.next()) {
301301 String idref = rset9.getString(1);
302+ if ((idref != null) && (!idref.equals(""))) {
303+ ps8.setString(1, idref);
304+ ResultSet rset8 = ps8.executeQuery();
305+ if (rset8.next()) {
306+ stopCount++;
307+ String name = rset8.getString(1);
308+ Double lat = rset8.getDouble(2);
309+ Double lon = rset8.getDouble(3);
310+ int fixed = rset8.getInt(4);
311+
312+ if (lat > maxLat) {
313+ maxLat = lat;
314+ }
315+ if (lon > maxLon) {
316+ maxLon = lon;
317+ }
318+ if (lat < minLat) {
319+ minLat = lat;
320+ }
321+ if (lon < minLon) {
322+ minLon = lon;
323+ }
302324
303- ps8.setString(1, idref);
304- ResultSet rset8 = ps8.executeQuery();
305- if (rset8.next()) {
306- stopCount++;
307- String name = rset8.getString(1);
308- Double lat = rset8.getDouble(2);
309- Double lon = rset8.getDouble(3);
310- int fixed = rset8.getInt(4);
311-
312- if (lat > maxLat) {
313- maxLat = lat;
314- }
315- if (lon > maxLon) {
316- maxLon = lon;
317- }
318- if (lat < minLat) {
319- minLat = lat;
320- }
321- if (lon < minLon) {
322- minLon = lon;
323- }
324-
325- System.out.println("\tway point = "+ idref);
326- fixedCount += fixed;
327- if (fixed == 0) {
328- unfixedCount++;
329-
330- // OSM node
331- int nodeid = Integer.parseInt(idref.substring(1)) * -1;
332- String osm_node = nodeBusstop(nodeid, name, lat, lon, timeStampStr);
333- ow.write(osm_node);
334- ow.newLine();
335-
336- // TEXT node
337- File txtFile = new File(dir, iCode + idref +".txt");
338- BufferedWriter gw2 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(txtFile), "UTF-8"));
339- gw2.write(osm_node);
340- gw2.newLine();
341- gw2.close();
342-
343- // GPX waypoint
344- gw.write("<wpt lat=\""+ lat +"\" lon=\""+ lon +"\">\n");
345- gw.write(" <time>"+ timeStampStr +"Z</time>\n");
346- gw.write(" <name><![CDATA["+ name +"]]></name>\n");
347- gw.write(" <link href=\""+ txtFile.getName() +"\"><text>"+ idref +"</text></link>\n");
348- gw.write("</wpt>\n");
349- gw.newLine();
325+ System.out.println("\tway point = "+ idref);
326+ fixedCount += fixed;
327+ if (fixed == 0) {
328+ unfixedCount++;
329+
330+ // OSM node
331+ int nodeid = Integer.parseInt(idref.substring(1)) * -1;
332+ String osm_node = nodeBusstop(nodeid, name, lat, lon, timeStampStr);
333+ ow.write(osm_node);
334+ ow.newLine();
335+
336+ // TEXT node
337+ File txtFile = new File(dir, iCode + idref +".txt");
338+ BufferedWriter gw2 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(txtFile), "UTF-8"));
339+ gw2.write(osm_node);
340+ gw2.newLine();
341+ gw2.close();
342+
343+ // GPX waypoint
344+ gw.write("<wpt lat=\""+ lat +"\" lon=\""+ lon +"\">\n");
345+ gw.write(" <time>"+ timeStampStr +"Z</time>\n");
346+ gw.write(" <name><![CDATA["+ name +"]]></name>\n");
347+ gw.write(" <link href=\""+ txtFile.getName() +"\"><text>"+ idref +"</text></link>\n");
348+ gw.write("</wpt>\n");
349+ gw.newLine();
350+ }
350351 }
352+ rset8.close();
351353 }
352- rset8.close();
353354 }
354355 rset9.close();
355356