Pages: [1]   Go Down
Author Topic: on autoformat: String index out of range: 1023  (Read 655 times)
0 Members and 1 Guest are viewing this topic.
Altrove
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With a project (1 file only+1library) when i try to autoformat the code i get....
Code:
java.lang.StringIndexOutOfBoundsException: String index out of range: 1023
      at java.lang.String.charAt(String.java:558)
      at processing.app.tools.AutoFormat.getchr(AutoFormat.java:313)
      at processing.app.tools.AutoFormat.show(AutoFormat.java:499)
      at processing.app.Editor$15.actionPerformed(Editor.java:728)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:282)
      at javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:969)
      at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1571)
      at javax.swing.JComponent.processKeyBinding(JComponent.java:2772)
      at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:656)
      at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:664)
      at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:664)
      at javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:640)
      at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:255)
      at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:242)
      at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2849)
      at javax.swing.JComponent.processKeyBindings(JComponent.java:2841)
      at javax.swing.JComponent.processKeyEvent(JComponent.java:2735)
      at processing.app.syntax.JEditTextArea.processKeyEvent(JEditTextArea.java:1637)
      at java.awt.Component.processEvent(Component.java:5278)
      at java.awt.Container.processEvent(Container.java:1966)
      at java.awt.Component.dispatchEventImpl(Component.java:3968)
      at java.awt.Container.dispatchEventImpl(Container.java:2024)
      at java.awt.Component.dispatchEvent(Component.java:3803)
      at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1826)
      at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:677)
      at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:934)
      at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:806)
      at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:641)
      at java.awt.Component.dispatchEventImpl(Component.java:3841)
      at java.awt.Container.dispatchEventImpl(Container.java:2024)
      at java.awt.Window.dispatchEventImpl(Window.java:1778)
      at java.awt.Component.dispatchEvent(Component.java:3803)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

my source code is this:
http://docs.google.com/Doc?id=dgwcpkhh_1389qq36g8

if i remove the blue part, the autoformat works.
the blue part is:
Code:
int temposterzo=800; //tempo per girare di 90° tutto il robot
int compensazione=255;
char* latocomp="D"; //motore da compensare D o S o N nessuno
Logged


Altrove
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OS: Xandros on eee900 (installed like this http://www.arduino.cc/playground/Linux/Xandros)
Arduino: 0011 alpha
set on board: Diecimila
Logged


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

Maybe it's confused by the degree sign?  You might try deleting that.
Logged

Altrove
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

at the moment i can't try, but it's not about that line.
if i delete only 1 or 2 of those lines, it still gives that error. i have to delete all the 3 lines!

i've done other projects with the degree sign.. in a thermometer project that sign is used many many times!
Logged


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

Hmm, okay.

Can you reduce the sketch to a small one that has the same problem?  That would make it easier to debug.
Logged

Altrove
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

later i'll try that, too.

update #1: the same code, on arduino 0011 alpha, on WIN XP, doesn't have this problem, it auto-formats correctly.
so this seems only a linux problem?
Logged


Altrove
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

update #2: on linux, removing the "°" degree symbol fixes the problem.
maybe when i tried to remove lines line by line i forgot the first one.

so... a degree sign on linux only will break autoformat.

maybe the thermometer project i compiled was under win
Logged


Pages: [1]   Go Up
Jump to: