Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NegativeArraySizeException on saving #8265

Closed
2 tasks done
KLemke-85 opened this issue Nov 22, 2021 · 21 comments · Fixed by #8270
Closed
2 tasks done

NegativeArraySizeException on saving #8265

KLemke-85 opened this issue Nov 22, 2021 · 21 comments · Fixed by #8270

Comments

@KLemke-85
Copy link

JabRef version

5.3 (latest release)

Operating system

Windows

Details on version and operating system

No response

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. System fails to save updated entries (annotation and correcting commata etc.). Closing the program after that a big amount of data (400 of over 900 entries) was deleted, even though the user had not worked on those entires, and the subcategories vanished completely. The same issue occured before and after the updated version. Data could be restored due to externally made backups.
  2. User is saving entries frequently. But even though older entries got deleted.
  3. No particular occurances or steps before the error is reported.
  4. The attempt to export the existing data after that occurance failed as well. Only a small amount was exported for example in rtf. Each try provided different data sets, but never all existing entries.

Appendix

...

Log File
2 screenshots of the error notification.

JabRef 2021_11_18

![JabRef 2021_11_19](https://user-images.githubusercontent.com/72263522/142839360-885288ee-3242-4212-b91c-3b5396230fe5.JPG)
@ThiloteE
Copy link
Member

ThiloteE commented Nov 22, 2021

Uff, this sounds bad, but as a fellow user (not programmer) of Jabref who is trying to help in debugging this, i do have some follow up questions, to make everything a little bit more clear:

  • "fails to save updated entries (annotation and correcting commata etc.)"?
    In particular, were there or were there not any changes to annotations and commas in the entries (manually or automated?) prior to closing Jabref? The above sentence seems to contradict your later statement of no particular steps being conducted before the error, so clarification would be VERY helpful for debugging. What exactly did you do to annotations and or commas?
  • With "updated version" you mean the latest development version? Could you please post the detailed Jabref version you are using? You can find it under Help>About Jabref. This also would answer if this is Windows 10 or Windows 7.
  • When you open your library-file with a text editor (e.g. right-click>open with>editor) can you still see the entries that have vanished from Jabref? Are the entries gone from the file completely or are they just not depicted within Jabref? If they are only gone in Jabref, but still exist in the library file, what is the difference between old file and new file?
  • Is the data of sensitive nature? If not, could you upload both the file PRIOR to saving and the file(s) that were created AFTER the saving here on github for the community to be able to debug it?
  • Are you using manual save or the autosave function? (find it under: options>preferences>file>autosave. If you use autosave, try to deactivate it please.

In general, next time you encounter this or any problems, a full copy of the debuglog would be more adviced than a screenshot. you can capture it on windows machines by clicking into the error message, then press ctrl+A (which selects all text) and then press ctrl+c (copy) and then you can paste it on github or wherever you see fit.

@KLemke-85
Copy link
Author

Thank you @ThiloteE for your quick response.
Since I'm not the actual user of our Jabref library and just kind of the "tech support", I'm working with what I get :) which means, I'm kind of the medium here, without having any advanced level of programming or whatsoever. I will try to answer your questions as truthfully as possible.

Concerning your remarks on the contradictions above: when I inquired about certain steps prior to closing Jabref I only got the clarification, that there were no new entries or subcategories added, but corrections as mentioned above. When I open the program on my computer and with the backup from a couple of weeks ago, nothing happens out of the ordinary. Also exporting the files works perfectly fine. Which hasn't been the case on the other device. Makes no sense to me.

That is the Jabref version we've updated to on friday
JabRef 5.3--2021-07-05--50c96a2
Windows 10 10.0 amd64
Java 16.0.1
JavaFX 16+8

"When you open your library-file with a text editor (e.g. right-click>open with>editor) can you still see the entries that have vanished from Jabref? Are the entries gone from the file completely or are they just not depicted within Jabref? If they are only gone in Jabref, but still exist in the library file, what is the difference between old file and new file?"

  • I can't tell, since my colleague already reinstated the former data set with his backup. The difference before reinstating was that we lost over 400 entries and all subcategories had vanished. Unfortunately I'm not able to replay the whole situation. But already advised my colleague to copy the debuglog the next time, instead of taking a screen shot.
  • Therefore I'm not able to provide the different states of the file.
  • I've just noticed (when checking the issue list) that there have been bug reports of similar nature a couple of weeks ago, that pointed out a situation, where subcategories were added and such, and after that the system crashed/data was lost. I don't know if there is any correlation or actual similarity.
  • There was only used "manual save". And I've just checked it to be sure, the settings for autosave are deactived.

Until recently we didn't have any major complications. So it's quite a setback, if we/my colleague have/has to fear of actually losing work of almost a year. Since it is not published yet it's kind of sensitive data :/

@Siedlerchr Siedlerchr changed the title Uncaught exception occured NegativeArraySizeException on saving Nov 22, 2021
@ThiloteE
Copy link
Member

Thanks for the immediate response as well.

  • ok, so what then was the older Jabref version you upgraded from? :D

What you report is very serious, but i am very pessimistic this can be solved without knowing what exactly changed in the files and/or any steps that allow us to reproduce this issue. I fear there is just not enough data to investigate this, but If you updated from a very old version of Jabref to the newer 5.3 version, maybe what was encountered is a known problem. For that we would need to know the exact version of your old Jabref.

The only other thing i can think of is for the experts to stare at the jabref code real long and hard and start to think how such an error could come into being, but that is like trying find a needle in a haystack....

@Siedlerchr
Copy link
Member

Siedlerchr commented Nov 22, 2021

Thank you very much for your report. The exception looks similar to #8231 A quick look in the code seems to show that it has to do with writing the formatted field names.
I guess that somehow the field.length is wrong/or negative (probaby).
Indentation (the second parameter) is the length of the longest field name in the library - or zero)

private String getFormattedFieldName(Field field, int intention) {
String fieldName = field.getName();
return fieldName.toLowerCase(Locale.ROOT) + StringUtil.repeatSpaces(intention - fieldName.length()) + " = ";

Do you use any Custom entry types or entry types with (non standard) fields?

PS: You can send bib files with sensitive data to vorstand[at]jabref.org or developers[at]jabref.org. They will be handled securely by the dev team only.

@KLemke-85
Copy link
Author

Thank you for pointing that out. Well, I'm currently not aware of such a customization. Therefore I only can assume that it has to do with the field length or indentation respectively. We obviously must have overlooked something.
I will send you the file via the suggested address.

@KLemke-85
Copy link
Author

And to answer your question @ThiloteE
I don't recall the version number, bit we only indroduced Jabref in the end of 2020, latest in the beginning of 2021. It cannot be that old then.

@koppor
Copy link
Member

koppor commented Nov 22, 2021

I should finish JabRef/blog.jabref.org#47 ^^

@koppor
Copy link
Member

koppor commented Nov 22, 2021

@KLemke-85 Could you please try the binary at @AlbertJBurton Could you please try the binary at https://builds.jabref.org/pull/8270/merge/? In case you see some wrong indent at some bib entry, it would be nice if you could that bibentry here for further investigation.

@KLemke-85
Copy link
Author

I'm very sorry, but I have no idea, what I'm supposed to do with that, literally. And I was trying to send our bib-file to your developer address, but the mail is bouncing back.

@Siedlerchr
Copy link
Member

@KLemke-85 There was a typo: try [email protected] (there was an "s" missing)

@KLemke-85
Copy link
Author

okeee... now I can see the s... Thx!

@Siedlerchr
Copy link
Member

Thanks for the file. If you open the file with a text editor ( Editor on Windows or any other plain text editor) and scroll down to the end, after the comment section, there are some errors. Delete that "Schlemmer1927" and the line below.

And also delete the character "q" from the line: @Comment{jabref-meta: grouping: q
Afterwards, the file should be working again. At least I could open it.

However, I noticed some weird things regarding the authors. Some authors have square Brackets in the name...

@KLemke-85
Copy link
Author

Ok. I will look into that :) thank you very much!!!
And the square brackets actually have a purpose; my colleague is using them to differentiate between given author names and names, were originally only initials are given and we have to provide the actual name. Do you think, that this also could cause complications? I was wondering about it for quite some time. But as mentioned above, we didn't have any issues until recently.
But maybe its the "Schlemmer1927" after all, a complaint, that I didn't know how to come by yet. :)

@KLemke-85
Copy link
Author

KLemke-85 commented Nov 23, 2021

I deleted the Schlemmer-Error (finally), but didn't have a "q" in the mentioned line. Shouldn't be a bother. I guess.
I assume, we will have to wait now and see how it turns out, when my colleague is working on the Bib again. But now I know where to look for a start, if there are any hickups.
Thank you very much!

@koppor
Copy link
Member

koppor commented Nov 23, 2021

With JabRef portable of v5.3, I get

grafik

Saving works. Strange.

@KLemke-85
Copy link
Author

Yes, that is correct. I already have dealt with that, thx to @Siedlerchr and managed to delete that warning/entry. We had this warning for a while, in the beginning with a different entry. But I didn't know how to treat it at the time. But there never was a problem with saving and such. Therefore we ignored it... we probably shouldn't have.

And from the little experience I have, while using the portable version an error like the one I opened the issue for didn't come up (yet).

@KLemke-85
Copy link
Author

Unfortunately there was a new warning, but now I can provide the complete bug report, which you may find below. Just from this morning. I also attached to screenshots, one shows a new warning.

java.lang.NegativeArraySizeException: -2
at java.base/java.lang.AbstractStringBuilder.(Unknown Source)
at java.base/java.lang.StringBuilder.(Unknown Source)
at [email protected]/org.jabref.model.strings.StringUtil.repeat(Unknown Source)
at [email protected]/org.jabref.model.strings.StringUtil.repeatSpaces(Unknown Source)
at [email protected]/org.jabref.logic.bibtex.BibEntryWriter.getFormattedFieldName(Unknown Source)
at [email protected]/org.jabref.logic.bibtex.BibEntryWriter.writeField(Unknown Source)
at [email protected]/org.jabref.logic.bibtex.BibEntryWriter.writeRequiredFieldsFirstRemainingFieldsSecond(Unknown Source)
at [email protected]/org.jabref.logic.bibtex.BibEntryWriter.write(Unknown Source)
at [email protected]/org.jabref.logic.exporter.BibtexDatabaseWriter.writeEntry(Unknown Source)
at [email protected]/org.jabref.logic.exporter.BibDatabaseWriter.savePartOfDatabase(Unknown Source)
at [email protected]/org.jabref.logic.exporter.BibDatabaseWriter.saveDatabase(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveAction.execute(Unknown Source)
at [email protected]/org.jabref.gui.actions.JabRefAction.lambda$new$3(Unknown Source)
at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source)
at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
at [email protected]/javafx.scene.Node.fireEvent(Unknown Source)
at [email protected]/javafx.scene.control.Button.fire(Unknown Source)
at [email protected]/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
at [email protected]/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
at [email protected]/javafx.scene.Scene$MouseHandler.process(Unknown Source)
at [email protected]/javafx.scene.Scene.processMouseEvent(Unknown Source)
at [email protected]/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
at [email protected]/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
at [email protected]/com.sun.glass.ui.View.notifyMouse(Unknown Source)
at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

JabRef 2021_11_24

JabRef 2021_11_24 a

@ThiloteE
Copy link
Member

I think 'Error in line 7007' means that the problem is in row 7007 of your library-file. No?

@Siedlerchr
Copy link
Member

Yes, that is the line where it failed, the root cause of the error could be in lines earlier. It has something to do with the braces. This is often the case where a closing curly brace "}" is missing and so JabRef thinks the entry's field continues in the following lines

@KLemke-85
Copy link
Author

I just checked the number of braces, all accounted for it seems :) but I've noticed, that the output of entries with the additional information of the month of publication are not representated with a curly brace, if I open the data via text editor. And I found a couple of square brackets that are not individually cupped by curly braces.

And, even though I've applied what you've sugggested yesterday @Siedlerchr the warning "schlemmer1927" turned up again today.
And I have to correct myself. Though we already had installed the portable version as well, I was not using it. The different warnings on my colleague's computer are still puzzeling. Even more so.
I also remember that I checked the use of square brackets in title entries, if using and additional set of curly braces, a couple of months ago. Still, I don't know if the warning really is related to that.

@Siedlerchr
Copy link
Member

@KLemke-85 Okay. Try. Close JabRef. copy the bib file (as backup). Then delete the *.bak and *.sav files and try again.
If you have a modified version which is not working you can send us the file again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants