|
Author |
Topic: problem with splitStrings (Read 688 times) |
|
un_chien_andalou25
|
problem with splitStrings
« on: Dec 7th, 2004, 11:11pm » |
|
i am attempting to use the splitStrings method to break up a string coming from another program (CarnivoreXP) through the telnet port. i then am attempting to use parts of the array as variables. basically, i need to use the data coming in from carnivore as variables in if/then statements, but there is too much data, so i am attempting to break it down to something more managable. however, i keep getting an out of bounds error on the array and i cannot figure out why here is the pertinent code: Socket socket; BufferedReader packetreader; CarnivoreListener CL; String packet; String packet_datestamp; String packet_fromIP; String packet_fromPort; String packet_toIP; String packet_toPort; void setup(){ size(800, 200); textFont(loadFont("GillSans.vlw.gz"), 24); Sonia.start(this, 44100); mySample = new Sample("sine.aif"); } { CL = new CarnivoreListener(); CL.startListening(); } void loop(){ background(50,50,50); fill(130,130,130); text("data from Carnivore", 10, 30); packet = CL.getPacket(); fill(200,200,200); text(packet, 10, 50); String list[] = splitStrings(packet); The error message is as follows: Error while running applet. java.lang.ArrayIndexOutOfBoundsException: -1 at BApplet.splitStrings(BApplet.java:1885) at BApplet.splitStrings(BApplet.java:1876) at client.loop(client.java:72) at BApplet.nextFrame(BApplet.java:434) at BApplet.run(BApplet.java:369) at java.lang.Thread.run(Thread.java:536)
|
|
|
|
fjen
|
Re: problem with splitStrings
« Reply #1 on: Dec 8th, 2004, 12:05am » |
|
i think this might be a bug (in versions .68, maybe .69) ... should not give an exception if string is empty. make sure your string is not empy: Code: String list[]; if ( !packet.equals("") ) { list = splitStrings(packet); } |
| problem gone? /F
|
« Last Edit: Dec 8th, 2004, 12:15am by fjen » |
|
|
|
|
fry
|
Re: problem with splitStrings
« Reply #2 on: Dec 8th, 2004, 12:43am » |
|
yeah, this is a bug in 68 that was fixed in 69.
|
|
|
|
artkast
|
Re: problem with splitStrings
« Reply #3 on: Dec 8th, 2004, 4:00pm » |
|
I am trying to use the default carnivore script for processing 69 alpha and it is still giving me the splitStrings error.
|
|
|
|
fjen
|
Re: problem with splitStrings
« Reply #4 on: Dec 8th, 2004, 10:27pm » |
|
the question is not which version of the script you use, but which software-version ... if you're on .68 -> have you tried my workaround (above)?
|
|
|
|
artkast
|
Re: problem with splitStrings
« Reply #5 on: Dec 9th, 2004, 2:50am » |
|
Sorry I was not using the default carnivore code but the code that was posted a while back with splitStrings and it did not work. By the way I am using .69. If you have this working could you post some code for me to test.
|
|
|
|
un_chien_andalou25
|
Re: problem with splitStrings
« Reply #6 on: Dec 11th, 2004, 8:53pm » |
|
i have not been able to get this to work - the splitStrings method in verson 69 now returns the error message: no method named "splitStrings" was found in type "client". does anyone know if this is another bug, or is the problem in my scripting?
|
|
|
|
fry
|
Re: problem with splitStrings
« Reply #7 on: Dec 11th, 2004, 9:15pm » |
|
splitStrings was renamed split() in revision 69, sorry for the confusion (this sort of info can be found in revisions.txt or elsewhere on the board).
|
|
|
|
|