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

[1.20.1] Backport some fixes from main #102

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.Optional;

Expand All @@ -25,7 +26,7 @@ protected Optional<InputStream> loadResourceFromModFile(final IModFile modFile,
try {
return Optional.of(Files.newInputStream(modFile.findResource(path.toString())));
}
catch (final FileNotFoundException e) {
catch (final FileNotFoundException | NoSuchFileException e) {
LOGGER.debug("Failed to load resource {} from {}, it does not contain dependency information.", path, modFile.getFileName());
embeddedt marked this conversation as resolved.
Show resolved Hide resolved
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ public ModFileScanData scan() {
}

private void fileVisitor(final Path path, final ModFileScanData result) {
LOGGER.debug(LogMarkers.SCAN,"Scanning {} path {}", fileToScan, path);
try (InputStream in = Files.newInputStream(path)){
ModClassVisitor mcv = new ModClassVisitor();
ClassReader cr = new ClassReader(in);
cr.accept(mcv, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);
mcv.buildData(result.getClasses(), result.getAnnotations());
} catch (IOException | IllegalArgumentException e) {
// mark path bad
LOGGER.error(LogMarkers.SCAN,"Exception scanning {} path {}", fileToScan, path, e);
}
}
}
Loading