Go Down

Topic: Tools->Copy For Forum  Bug? (Read 2035 times) previous topic - next topic

AlphaBeta

Often when I try to use the Copy For Forum menu item, I get this:

Quote
java.lang.ArrayIndexOutOfBoundsException: 37
     at processing.app.tools.DiscourseFormat.formatCode(DiscourseFormat.java:204)
     at processing.app.tools.DiscourseFormat.show(DiscourseFormat.java:117)
     at processing.app.Editor$16$1.run(Editor.java:755)
     at java.awt.event.InvocationEvent.dispatch(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)


When I restart my IDE everything is fine.

My system is:
Windows XP
Java 1.6.0_07
Arduino 0014
RXTX-2.1-7

eried

My website: http://ried.cl

AlphaBeta

Totally independent of file :(

Seems random.

eried

#3
Mar 15, 2009, 07:24 pm Last Edit: Mar 15, 2009, 07:25 pm by eried Reason: 1
By you error, it fail on:

Code: [Select]
char c = segmentArray[segmentOffset + offset];

in the function:

Code: [Select]
public String formatCode(int line) {

function dedicated to format each line of code for forum from:

Code: [Select]
   // Line by line
   for (int i = 0; i < parent.getLineCount(); i++) {
     cf.append(formatCode(i)); // <- called from here
   }


so the problem is with one of your lines, maybe you could test some codes and paste here any faulty one.
My website: http://ried.cl

AlphaBeta

Every time I restart arduino IDE the code that once caused an error, does not. This makes me suspect the error is in the IDE not in my code. :)

eried

#5
Mar 15, 2009, 08:46 pm Last Edit: Mar 15, 2009, 08:47 pm by eried Reason: 1
You're right :O is the IDE

Code: [Select]
     for (;;) {
       byte id = tokens.id;
       if (id == Token.END) {
         char c = segmentArray[segmentOffset + offset];
         if (segmentOffset + offset < limit) {
           cf.append(c);
         } else {
           cf.append('\n');
         }
         return cf.toString();
       }


Fixed code:

Code: [Select]
     for (;;) {
       byte id = tokens.id;
       if (id == Token.END) {
         
         if (segmentOffset + offset < limit) {
               // BUGBUG: this has been modified :)
           cf.append(segmentArray[segmentOffset + offset]);
         } else {
           cf.append('\n');
         }
         return cf.toString();
       }


Try with my fixed version (it is not the 0015, just a patched 0014)
http://servicios.ried.cl/arduino/temp/pde_arduino-0015_fixed_2009-03-15.rar

extract that file to your arduino/lib/ path
My website: http://ried.cl

mellis


eried

Code: [Select]
char c = segmentArray[segmentOffset + offset];
if (segmentOffset + offset < limit) { ...


The comprobation must be after the char asignation:

Code: [Select]
if (segmentOffset + offset < limit) {
char c = segmentArray[segmentOffset + offset];


Small, but important detail.
My website: http://ried.cl

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy