Skip to content

Commit

Permalink
Merge pull request #222 from quintesse/fix_mwtele-232
Browse files Browse the repository at this point in the history
fix: skip the agent jar while generating the report
  • Loading branch information
jponge authored Jun 10, 2024
2 parents ae21fd8 + 10a889d commit d8bfba1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/src/main/java/com/redhat/insights/jars/JarAnalyzer.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* Copyright (C) Red Hat 2023 */
/* Copyright (C) Red Hat 2023-2024 */
package com.redhat.insights.jars;

import com.redhat.insights.logging.InsightsLogger;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.*;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
Expand Down Expand Up @@ -253,6 +254,11 @@ private boolean isModularJdkJar(URL url) {
* @return True if the jar file should be added, else false.
*/
private boolean shouldAttemptAdd(final String jarFile) {
return !ignoreJars.contains(jarFile);
String agentJarFile =
Paths.get(JarAnalyzer.class.getProtectionDomain().getCodeSource().getLocation().getFile())
.getFileName()
.toString();

return !ignoreJars.contains(jarFile) && !jarFile.equals(agentJarFile);
}
}

0 comments on commit d8bfba1

Please sign in to comment.