Pages: [1]   Go Down
Author Topic: Tools->Copy For Forum  Bug?  (Read 1849 times)
0 Members and 1 Guest are viewing this topic.
Norway@Oslo
Offline Offline
Edison Member
*
Karma: 13
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

With some special pde file?
Logged

My website: http://ried.cl

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 13
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Totally independent of file smiley-sad

Seems random.
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

By you error, it fail on:

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

in the function:

Code:
public String formatCode(int line) {

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

Code:
   // 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.
« Last Edit: March 15, 2009, 01:25:22 pm by eried » Logged

My website: http://ried.cl

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 13
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You're right :O is the IDE

Code:
     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:
     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
« Last Edit: March 15, 2009, 02:47:31 pm by eried » Logged

My website: http://ried.cl

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What's the difference?
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

The comprobation must be after the char asignation:

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

Small, but important detail.
Logged

My website: http://ried.cl

Pages: [1]   Go Up
Jump to: