dkpro / dkpro-uby

Framework for creating and accessing UBY resources – sense-linked lexical resources in standard UBY-LMF format
https://dkpro.github.io/dkpro-uby
Other
22 stars 3 forks source link

Java 8 issue with XMLToDBTransformer.transform #150

Closed silvanaha closed 8 years ago

silvanaha commented 8 years ago

Something to consider when moving UBY to Java 8: With Java 8, transformation of LMF to DB fails for some LMF-xmls (e.g., FrameNet) due to errors when reading the LMF-xml

Errors are localized around here: XMLBTransformer.java line 100: SAXRreader.read(xmlFile) stacktrace.txt

chmeyer commented 8 years ago

We had this error in the past. As the message says, there is a ConcurrentModificationException, which means that a collection (e.g., a List) is changed while it is iterated. Last time, the issue was the use of a sort method within a toString() method. Could you please take a look at the recent changes in the model classes if you can find any list-chaning operation that shouldn't be there (such as sorting while string-formatting)? I'm skeptical that the issue is related to Java8.

silvanaha commented 8 years ago

You're right, of course. There aren't recent changes, but Collections.sort() in toString() can still be found in

I am currently testing conversion of small resources with the adapted classes.

chmeyer commented 8 years ago

All of them must be removed, otherwise toString() cannot be called by iterators. Collections.sort is harmful as it changes the member variable beyond the scope of toString(), which is very counter-intuitive. A better solution is to sort during the resource conversion. I have done this for a couple of converters with the goal of assuring a certain order that remains across versions. Could you do the change?

Related commit: https://github.com/dkpro/dkpro-uby/commit/fb1019cdf3db26fbbbf71ad100ec21d174de3a4c