Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Tianscar committed May 18, 2023
1 parent 7dc99d9 commit 6fab06c
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ repositories {
```groovy
dependencies {
...
implementation 'com.tianscar.javasound:javasound-resloader:0.1.1'
implementation 'com.tianscar.javasound:javasound-resloader:0.1.2'
}
```

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ ext {
libraryGroupName = 'com.tianscar.javasound'
libraryVendorName = 'Tianscar'

libraryVersionCode = 2
libraryVersionName = '0.1.1'
libraryVersionCode = 3
libraryVersionName = '0.1.2'

librarySourceCompatibility = JavaVersion.VERSION_1_8
libraryTargetCompatibility = JavaVersion.VERSION_1_8
Original file line number Diff line number Diff line change
@@ -18,9 +18,10 @@ public class JDKMidiResourceReader implements MidiResourceReader {

@Override
public MidiFileFormat getMidiFileFormat(ClassLoader resourceLoader, String name) throws InvalidMidiDataException, IOException {
InputStream stream = resourceLoader.getResourceAsStream(name);
if (stream == null) throw new IOException("could not load resource \"" + name + "\" with ClassLoader \"" + resourceLoader + "\"");
else return MidiSystem.getMidiFileFormat(stream);
try (InputStream stream = resourceLoader.getResourceAsStream(name)) {
if (stream == null) throw new IOException("could not load resource \"" + name + "\" with ClassLoader \"" + resourceLoader + "\"");
else return MidiSystem.getMidiFileFormat(stream);
}
}

@Override
Original file line number Diff line number Diff line change
@@ -18,9 +18,10 @@ public class JDKAudioResourceReader implements AudioResourceReader {

@Override
public AudioFileFormat getAudioFileFormat(ClassLoader resourceLoader, String name) throws UnsupportedAudioFileException, IOException {
InputStream stream = resourceLoader.getResourceAsStream(name);
if (stream == null) throw new IOException("could not load resource \"" + name + "\" with ClassLoader \"" + resourceLoader + "\"");
else return AudioSystem.getAudioFileFormat(stream);
try (InputStream stream = resourceLoader.getResourceAsStream(name)) {
if (stream == null) throw new IOException("could not load resource \"" + name + "\" with ClassLoader \"" + resourceLoader + "\"");
else return AudioSystem.getAudioFileFormat(stream);
}
}

@Override

0 comments on commit 6fab06c

Please sign in to comment.