StringIndexOutOfBoundsException

for the past few weeks, I’ve been getting this strange error that
I haven’t seen before:

“java.lang.StringIndexOutOfBoundsException: String index out of range: -2”

it happens at startup, and only when connecting to the server as a client
(not when running in developer).

here’s the entire trace from the java web start console:

	at java.lang.StringBuffer.charAt(StringBuffer.java:283)
	at com.servoy.j2db.dataprocessing.r.a(Unknown Source)
	at com.servoy.j2db.dataprocessing.r.a(Unknown Source)
	at com.servoy.j2db.dataprocessing.r.if(Unknown Source)
	at com.servoy.j2db.dataprocessing.ag.getSharedFoundSet(Unknown Source)
	at com.servoy.j2db.dataprocessing.ag.do(Unknown Source)
	at com.servoy.j2db.dataprocessing.ag.if(Unknown Source)
	at com.servoy.j2db.FormPanel.byte(Unknown Source)
	at com.servoy.j2db.FormPanel.cK(Unknown Source)
	at com.servoy.j2db.FormManager.if(Unknown Source)
	at com.servoy.j2db.scripting.CreationalPrototype.get(Unknown Source)
	at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:726)
	at org.mozilla.javascript.gen.c1.call(SolutionStartup:15)
	at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
	at com.servoy.j2db.FormManager.do(Unknown Source)
	at com.servoy.j2db.FormManager$3.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:189)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:478)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

I’ve searched the forum, but haven’t found any reference to this error.

Thanks in advance for any input on this.
rm.

I can’t tell you where it happens (probably somewhere in your startup stuff) but you try to do something with a string that is empty.
In most cases that would be performing a regex of some sort so a replace or substring or something like that…

hi Marcel;

I’m actually not running any code at all during startup (I was,
but I removed it).

No first form selected, no onload or onshow or onrecordselect on that form? No relationship where you do something like the mentioned?

I found a clue:

for some unknown reason, the sequence type on the primary
key field (for the first table that get’s displayed on solution startup)
had been changed from db sequence to servoy sequence!

that’s really strange, since I never use the servoy sequencing
mode; I always let mysql do auto_increment on my primary keys.

once I changed this back to db sequence, everything was ok.

anybody have any ideas on how this could have changed?
no one else works on this project other than me. :?
hmmm…

anyway, thanks to everyone for their responses.

rm.

Hi Robert,

Did you happen to imported the solution in this repository for the first time?
In my experience Servoy will revert to Servoy sequences unless you explicitly tell it not to.
(with the “Override sequence types to the sequence types contained in the import version.” option in the admin pages)
This is only when you import it for the first time.

Hope this helps.

ROCLASI:
Did you happen to imported the solution in this repository for the first time?

Robert:

I believe that’s what happened; I receintly moved the repository
on my development system into mysql, which required me to
export then import all my servoy solutions.

Thanks for the input!

rm.

Servoy Developer
Version R2 2.2.3-build 335
Java version 1.5.0_05-48 (Mac OS X)

I have just had this same error in developer !

I had developed something on my local machine using a remote external MySQL db

I had kept the table pk sequences as Servoy Sequencing until dev had neared completion and data had been imported.

Then I asked for the MySQL tables primary keys to be changed to auto increment and once done modified my dataproviders to be db identity.

All was well but for a single table which is used for no other purpose than to base forms on which hold a menu bar and such !

I checked and the table’s pk is showing as db identity

There is only the primary key in that table and no other fields !!

Does anyone know if this would this have an effect ?

I will try to add another column to the table and see if it persists !

Cheers
Harry

those are the same circumstances as my situation.

I’m not sure what’s causing this, but changing the seq
back to db made everything ok.

Hi Robert,

Having only the pk column in the table with it set to db identity caused the issue - this is after changing it from servoy sequence to db identity.

Adding a new varchar column to the table cured it !

Why, I have no idea.

As soon as the new column was in there it seemed to reference the pk data correctly and now works without issue or error !

Cheers
Harry

oh, ok, I must have had my signals crossed (it’s Friday!)

sure is a strange error though. makes me real
glad this forum exists!

good luck
rm.

Sounds as though the fundamental reasons were the same [changing the type of the pk] !

Just that the resolutions differed !

Have a good and bug-free weekend, Robert :)

Cheers
Harry