waiheke
YaBB Newbies
Offline
Posts: 2
Help...Java.lang error ArrayIndexOutOfBoundsExcept
Oct 16th , 2009, 4:59pm
Error copied here- starts at line: data[0][i][1] = lst[1]; in code copied below... I'm using a MaxOSX 10.5.8 and Processing )135 Beta Error:------------------------------------------------------------ java.lang.ArrayIndexOutOfBoundsException: 1 at Temporary_1237_5347.numData(Temporary_1237_5347.java:176) at Temporary_1237_5347.draw(Temporary_1237_5347.java:59) at processing.core.PApplet.handleDisplay(PApplet.java:1465) at processing.core.PGraphics.requestDisplay(PGraphics.java:690) at processing.core.PApplet.run(PApplet.java:1562) at java.lang.Thread.run(Thread.java:552) java.lang.ArrayIndexOutOfBoundsException: 1 at Temporary_1237_5347.numData(Temporary_1237_5347.java:176) at Temporary_1237_5347.draw(Temporary_1237_5347.java:59) at processing.core.PApplet.handleDisplay(PApplet.java:1465) at processing.core.PGraphics.requestDisplay(PGraphics.java:690) at processing.core.PApplet.run(PApplet.java:1562) at java.lang.Thread.run(Thread.java:552) Code:-------------------------------- } //fill array //println("there are " + datalength[0] + " earthquakes in the last hour."); for(int i=1;i<lineshour.length;i++){ String dat = lineshour[i]; String lst[] = split(dat,','); data[0][i][0] = lst[0]; data[0][i][1] = lst[1]; data[0][i][2] = lst[2]; data[0][i][3] = lst[3]+lst[4]; data[0][i][4] = lst[5]; data[0][i][5] = lst[6]; data[0][i][6] = lst[7]; data[0][i][7] = lst[8]; data[0][i][8] = lst[9]; //println(i + " : lat " + data[0][i][4] + " , lon " + data[0][i][5] + " , mag " + data[0][i][6]); } for(int i=1;i<linesday.length;i++){ String dat = linesday[i]; String lst[] = split(dat,','); data[1][i][0] = lst[0]; data[1][i][1] = lst[1]; data[1][i][2] = lst[2]; data[1][i][3] = lst[3]+lst[4]; data[1][i][4] = lst[5]; data[1][i][5] = lst[6]; data[1][i][6] = lst[7]; data[1][i][7] = lst[8]; data[1][i][8] = lst[9]; } for(int i=1;i<lines7days.length;i++){ String dat = lines7days[i]; String lst[] = split(dat,','); data[2][i][0] = lst[0]; data[2][i][1] = lst[1]; data[2][i][2] = lst[2]; data[2][i][3] = lst[3]+lst[4]; data[2][i][4] = lst[5]; data[2][i][5] = lst[6]; data[2][i][6] = lst[7]; data[2][i][7] = lst[8]; data[2][i][8] = lst[9]; } } void flashingLoadText() { if (frameCount%10 < 5) { fill(0); } else { fill(100); } textFont(font_loading); text("Loading New Data...",width/2-50,height/2); if (frameCount%10 < 5) { fill(255); } else { fill(0); } text("Loading New Data...",width/2-53,height/2-3); } void keyPressed() { if (key == ' ') { println("manual update..."); mode = 1; counter = 0; runcounter = 0; } } void mousecoords(){ fill(0); rect(900,0,955,40); fill(255); text(mouseX,900,20); text(mouseY,900,40); } --------- Console Message is: 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] java.lang.ArrayIndexOutOfBoundsException: 1 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at Temporary_1237_5347.numData(Temporary_1237_5347.java:176) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at Temporary_1237_5347.draw(Temporary_1237_5347.java:59) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PApplet.handleDisplay(PApplet.java:1465) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PGraphics.requestDisplay(PGraphics.java:690) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PApplet.run(PApplet.java:1562) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at java.lang.Thread.run(Thread.java:552) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] java.lang.ArrayIndexOutOfBoundsException: 1 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at Temporary_1237_5347.numData(Temporary_1237_5347.java:176) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at Temporary_1237_5347.draw(Temporary_1237_5347.java:59) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PApplet.handleDisplay(PApplet.java:1465) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PGraphics.requestDisplay(PGraphics.java:690) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at processing.core.PApplet.run(PApplet.java:1562) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at java.lang.Thread.run(Thread.java:552) 17/10/09 12:39:59 PM [0x0-0x326326].org.processing.app[40332] at java.lang.Thread.run(Thread.java:552) Thanks for looking at it for me;)))