MobileSheets Forums

Full Version: StringIndexOutOfBoundsException
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

when syncing to a cloud drive i often get java.lang.StringIndexOutOfBoundsException: String index out of range: -1.

No other clues. Currently the song listed in the log directly before the error message is the song I added recently with the Windows 10 edition. Syncing to the drive with another Windows 10 edition works without problems and the new song is added as it should be. Why does Android fail?

Any chance you'd be willing to upload a backup of your Windows 10 library for me so that I can try to locate the cause of this problem? If so, please send a link to and I'll investigate this right away. If that's not possible, then I'll need to know how to set up a song on Windows so that this problem occurs when synchronizing to Android, as I haven't seen this issue with any of the libraries I've used so far.

Thanks. You should have received an access link.
I did, I'll work on this today as soon as I have some time - thanks!

Any news on this? Do you still need access for analysis or may I override everything to try to fix things somehow?
The error is caused by the following invalid file path being used for the song Landlocked Blues: C:\Users\joern\AppData\Local\Packages\41730Zubersoft.MobileSheets_ys1c8ct2g6ypr\LocalState\Del Amitri - Driving with the brakes on\Del Amitri - Driving with the brakes on.pdf

I'm guessing when you synchronized your library to the cloud folder, that file was missing in your library. As a result, the database in the cloud folder left that path in place, as it couldn't do anything with a missing file. This then breaks the Android side which is expecting a valid Google Drive path (which looks something like 1oGReFQwKlCYKRz-SUlfCaEtzWSwydZQD/Smashing Pumpkins - 1979.pdf). I'm going to have to add code to handle this situation when a user synchronizes a library with missing files to a cloud folder.

If you'd like an early build that fixes this issue, send an email to and I'll set you up with that.

How can it be the file was missing? It was the file i recently added to the W10 App and is available on W10 still. In addition it successfully synced to my other W10 computer and is available there still.

And how can it be that the song Landlocked Blues is connected to the Del Amitri song? If I open the song Landlocked Blues in the W10 app there is only one file attached which is called "Bright Eyes - Landlocked Blues.pdf". So where's that mixing of the two songs coming from?
I can't answer how the Landlocked Blues song ended up with the Del Amitri PDF file, but that's definitely what is in the database stored in the cloud folder. If you want to send me a library backup file (Settings->Backup and Restore->Backup Library) of your Windows 10 library, I can try synchronizing to my own cloud folder and try to see if I can reproduce that, otherwise I won't know how your library ended up in that state, as I don't know what actions you might have taken, or what the database looks like on your Windows 10 device. The sync finished without issue for me after I added code to handle the failure of that one song. All the others seemed fine.

Today I took another look at this and fear your fix maybe only cures the symptoms not the root cause. The situation is like this:

PC1 (WIN10): Added the Del Amitri file to the database. Synced to the cloud. Both songs are correct. Del Amitri song contains Del Amitri PDF. Bright Eyes song contains Bright Eyes PDF. When I connect with the companion app from PC2 to this PC1 everything is fine as well. Bright Eyes contains Bright Eyes PDF.

09:21:13  - Sende PC-Dateien für Song: Landlocked Blues
09:21:13  - 91187  Bytes der Datei: C:\Users\xxxxxx\AppData\Local\Packages\41730Zubersoft.MobileSheets_ys1c8ct2g6ypr\LocalState\Bright Eyes - Landlocked Blues\Bright Eyes - Landlocked Blues.pdf erfolgreich gesendet

PC2 (WIN10): Synced with the cloud drive. Sync ran without errors. But both songs here somehow contain the Del Amitri PDF. Connecting with companion from PC1 to PC2 shows the same:

09:25:53  - Sende PC-Dateien für Song: Landlocked Blues
09:25:54  - 106775  Bytes der Datei: C:\Users\joern\AppData\Local\Packages\41730Zubersoft.MobileSheets_ys1c8ct2g6ypr\LocalState\Del Amitri - Driving with the brakes on\Del Amitri - Driving with the brakes on.pdf erfolgreich gesendet

Android device: Synced with the cloud drive. Sync failed because of, as you have found out, invalid path.

So while your fix might have adressed different fault tolerance between W10 and Android the problem of the wrong assigned file is alreay in the cloud sync and must have occured while syncing PC1 to the cloud.

I resynced PC1 to the cloud drive today and after that PC2 and Android both synced ok and now on all three devices both songs are correct.

As a conclusion i think there must be some error situations while syncing to cloud drives that remain unnoticed to the user as the sync is reported successful but leaves the synced data in an inconsistent state that garbles the contents of the songs.