helge17 / tuxguitar

Improve TuxGuitar and provide builds
Other
303 stars 29 forks source link

Exception while trying to read a GP7 / GP8 file #406

Closed ycollet closed 2 weeks ago

ycollet commented 3 weeks ago

I am using tuxguitar 1.6.3 on Fedora 39. I am trying to open this file: https://tabs.ultimate-guitar.com/tab/king-diamond/moonlight-guitar-pro-4406540

With Tuxguitar 1.6.2, it opens without problem but I've got an exception with Tuxguitar 1.6.3.

org.herac.tuxguitar.action.TGActionException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.app.action.impl.file.TGReadURLAction.processAction(TGReadURLAction.java:53)
        at org.herac.tuxguitar.editor.action.TGActionBase.execute(TGActionBase.java:24)
        at org.herac.tuxguitar.action.TGActionManager.execute(TGActionManager.java:67)
        at org.herac.tuxguitar.app.action.impl.file.TGOpenFileAction$1$1.run(TGOpenFileAction.java:40)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: org.herac.tuxguitar.action.TGActionException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.editor.action.file.TGReadSongAction.processAction(TGReadSongAction.java:48)
        at org.herac.tuxguitar.editor.action.TGActionBase.execute(TGActionBase.java:24)
        at org.herac.tuxguitar.action.TGActionManager.execute(TGActionManager.java:67)
        at org.herac.tuxguitar.app.action.impl.file.TGReadURLAction.processAction(TGReadURLAction.java:50)
        ... 4 more
Caused by: org.herac.tuxguitar.io.base.TGFileFormatException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.io.gpx.v7.GPXInputStream.read(GPXInputStream.java:28)
        at org.herac.tuxguitar.io.base.TGSongReaderHelper.read(TGSongReaderHelper.java:28)
        at org.herac.tuxguitar.io.base.TGFileFormatManager.read(TGFileFormatManager.java:49)
        at org.herac.tuxguitar.editor.action.file.TGReadSongAction.processAction(TGReadSongAction.java:40)
        ... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.io.gpx.v7.GPXFileSystem.getFileContentsAsStream(GPXFileSystem.java:39)
        at org.herac.tuxguitar.io.gpx.v7.GPXInputStream.read(GPXInputStream.java:23)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.input.NullInputStream
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 12 more
Exception in thread "Thread-15" org.herac.tuxguitar.action.TGActionException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.app.action.impl.file.TGReadURLAction.processAction(TGReadURLAction.java:53)
        at org.herac.tuxguitar.editor.action.TGActionBase.execute(TGActionBase.java:24)
        at org.herac.tuxguitar.action.TGActionManager.execute(TGActionManager.java:67)
        at org.herac.tuxguitar.app.action.impl.file.TGOpenFileAction$1$1.run(TGOpenFileAction.java:40)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: org.herac.tuxguitar.action.TGActionException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.editor.action.file.TGReadSongAction.processAction(TGReadSongAction.java:48)
        at org.herac.tuxguitar.editor.action.TGActionBase.execute(TGActionBase.java:24)
        at org.herac.tuxguitar.action.TGActionManager.execute(TGActionManager.java:67)
        at org.herac.tuxguitar.app.action.impl.file.TGReadURLAction.processAction(TGReadURLAction.java:50)
        ... 4 more
Caused by: org.herac.tuxguitar.io.base.TGFileFormatException: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.io.gpx.v7.GPXInputStream.read(GPXInputStream.java:28)
        at org.herac.tuxguitar.io.base.TGSongReaderHelper.read(TGSongReaderHelper.java:28)
        at org.herac.tuxguitar.io.base.TGFileFormatManager.read(TGFileFormatManager.java:49)
        at org.herac.tuxguitar.editor.action.file.TGReadSongAction.processAction(TGReadSongAction.java:40)
        ... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/input/NullInputStream
        at org.herac.tuxguitar.io.gpx.v7.GPXFileSystem.getFileContentsAsStream(GPXFileSystem.java:39)
        at org.herac.tuxguitar.io.gpx.v7.GPXInputStream.read(GPXInputStream.java:23)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.input.NullInputStream
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 12 more
ycollet commented 3 weeks ago

Tuxguitar uses swt-4.21. If I am correct, tixguitar 1.6.2 with set to use 4.27 in the fedora package. To be checked. But, for sure, tuxguitar-1.6.3 is using swt-4.21

guiv42 commented 3 weeks ago

I don't think it's linked to swt It looks very much like #283 : which version of commons-compress are you using on Fedora ? You can try to add an explicit dependency to commons-io

ycollet commented 3 weeks ago

I think this is the common-compress installed by the tuxguitar build process, not the one from fedora. There is no package java common-compress installed via the fedora repo. Only the one download by maven during the build. I will check tomorrow is a problem occured during the build of the tuxguitar rpm package.

guiv42 commented 3 weeks ago

I don't understand which rpm you are referring to...? Historically commons-compress had an explicit dependency to commons-io. Then it was removed. So, for example in the rpm build of TuxGuitar I explicitly added the dependency to commons-io

ycollet commented 3 weeks ago

This one: https://github.com/audinux/fedora-spec/tree/master/tuxguitar-mao

From the Audinux repository.

guiv42 commented 3 weeks ago

I think I understand : you need to add commons-io in your classpath in tuxguitar.sh

ycollet commented 3 weeks ago

OK, thanks for this advice. I will try that tomorrow and I will keep you informed.

ycollet commented 2 weeks ago

Looks like it works now. I will do a final test tomorrow and close the ticket if it works.

ycollet commented 2 weeks ago

Works fine in Fedora 40 but hangs on Fedora 39. Probably a problem on version:

Nom          : apache-commons-io
Époque       : 1
Version      : 2.11.0
Publication  : 4.fc39
Architecture : noarch
Taille       : 415 k
Source       : apache-commons-io-2.11.0-4.fc39.src.rpm
Dépôt        : @System
Depuis le dé : fedora
Résumé       : Utilities to assist with developing IO functionality
URL          : https://commons.apache.org/io
Licence      : ASL 2.0
Description  : Commons-IO contains utility classes, stream implementations,
             : file filters, and endian classes. It is a library of utilities
             : to assist with developing IO functionality.

Paquets disponibles
Nom          : apache-commons-io
Époque       : 1
Version      : 2.16.1
Publication  : 1.fc40
Architecture : noarch
Taille       : 478 k
Source       : apache-commons-io-2.16.1-1.fc40.src.rpm
Dépôt        : updates
Résumé       : Utilities to assist with developing IO functionality
URL          : https://commons.apache.org/io
Licence      : Apache-2.0
Description  : Commons-IO contains utility classes, stream implementations,
             : file filters, and endian classes. It is a library of utilities
             : to assist with developing IO functionality.
ycollet commented 2 weeks ago

Installed manually commons-io-2.16.1.jar in /usr/share/java/tuxguitar and fixed the classpath a it worlked.

guiv42 commented 2 weeks ago

The initial problem you have is TuxGuitar cannot find classes defined by commons-io (required by commons-compress): java.lang.NoClassDefFoundError: org/apache/commons/io/input/NullInputStream

So you need both commons-compress and commons-io to be present, compatible, and defined in classpath. The question is: which versions of commons-compress/commons-io are you trying to use? Those provided by the distro, or by TuxGuitar? Since commons-compress depends from commons-io, I would recommend to use the same strategy for both jars, that would reduce the risk of incompatibilities. So, either include a Requires statement in .spec file for both, or for none of them. If you cannot find a package for commons-compress in fedora repo, then I suggest using both jar files from TuxGuitar build. In this case, delete Requires statement for commons-io from .spec file, make sure both .jar files are copied by the .spec file into /usr/share/java/tuxguitar/, and classpath is updated consistently: CLASSPATH=$CLASSPATH:/usr/share/java/tuxguitar/commons-io.jar

Another point, completely independent : the place where translation/templates/tuning files are defined has changed with 1.6.3. I just read your .spec file, I think it needs to be updated. Just after this line I would add the following: cp -a common/resources/* %{buildroot}/%{_datadir}/%{name} See the openSuse rpm spec file updated for 1.6.3

ycollet commented 2 weeks ago

Thanks a lot for the link to the spec. I will try to merge this one into mine ...

guiv42 commented 2 weeks ago

You're welcome. Note that there is a commons-compress available in openSuse's repo, so I chose the strategy to use this one and not Tuxguitar's. I didn't add a Requires statement for commons-io, since it is indirectly required by commons-compress...

edit: there is a pending request to update openSuse repo with TG, there you can see the diff between spec files from 1.6.2 and 1.6.3

guiv42 commented 2 weeks ago

@ycollet : thanks for the Fedora package! What's the status of this issue, can it be closed now or do you still have some problems?

ycollet commented 2 weeks ago

OK on my side. I close the issue.