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

More descriptive error messages for unsupported Jandex storage format versions #19876

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -21,6 +21,7 @@
import org.jboss.jandex.IndexReader;
import org.jboss.jandex.IndexView;
import org.jboss.jandex.Indexer;
import org.jboss.jandex.UnsupportedVersion;
import org.jboss.logging.Logger;

import io.quarkus.deployment.util.IoUtil;
Expand Down Expand Up @@ -61,7 +62,11 @@ public static Index indexJar(File file, Set<String> removed) throws IOException
file);
return indexJar(jarFile, removed);
} else {
return reader.read();
try {
return reader.read();
} catch (UnsupportedVersion e) {
throw new UnsupportedVersion("Can't read Jandex index from " + file + ": " + e.getMessage());
gastaldi marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jboss.jandex.IndexReader;
import org.jboss.jandex.IndexWriter;
import org.jboss.jandex.Indexer;
import org.jboss.jandex.UnsupportedVersion;

public final class TestClassIndexer {

Expand Down Expand Up @@ -60,6 +61,8 @@ public static Index readIndex(Class<?> testClass) {
if (path.toFile().exists()) {
try (FileInputStream fis = new FileInputStream(path.toFile())) {
return new IndexReader(fis).read();
} catch (UnsupportedVersion e) {
throw new UnsupportedVersion("Can't read Jandex index from " + path + ": " + e.getMessage());
} catch (IOException e) {
// be lenient since the error is recoverable
return indexTestClasses(testClass);
Expand Down