diff --git a/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/MethodUseAnalyzer.java b/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/MethodUseAnalyzer.java index c9be90f..374c47a 100644 --- a/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/MethodUseAnalyzer.java +++ b/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/MethodUseAnalyzer.java @@ -138,6 +138,9 @@ public Path analyze(Path sourceDirectory, Path outputDirectory, String outputFil } else { throw e; } + } catch (IndexOutOfBoundsException | ClassFormatError | NegativeArraySizeException e) { + //IDETECT-4924 Handle malformed classes properly + brokenFiles.put(classFile, "Malformed class structure: " + Strings.nullToEmpty(e.getMessage())); } } diff --git a/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/bytecode/ClassMethodReferenceVisitor.java b/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/bytecode/ClassMethodReferenceVisitor.java index 9454158..4a4bc6a 100644 --- a/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/bytecode/ClassMethodReferenceVisitor.java +++ b/method-analyzer-core/src/main/java/com/blackduck/method/analyzer/core/bytecode/ClassMethodReferenceVisitor.java @@ -221,12 +221,12 @@ private Type getReturnType(String descriptor) { try { return Type.getType(descriptor); - } catch (StringIndexOutOfBoundsException e2) { + } catch (StringIndexOutOfBoundsException | IllegalArgumentException e2) { // IDETECT-3909 This can occur for malformed signatures which are just the type, not the method, for // an unknown reason logger.warn("Malformed method descriptor, skipping reference processing: {}:{} ({})", currentClassName, currentMethodName, descriptor); - return Type.getType(descriptor); + return Type.getType(Object.class); } } }