Skip to content
Open
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 @@ -297,7 +297,7 @@
System.out.println(type + " deployed successfully.");
}

private static Properties installJars(final File m2Root, final boolean forceOverwrite) {

Check failure on line 300 in component-tools/src/main/java/org/talend/sdk/component/tools/exec/CarMain.java

View check run for this annotation

sonar-eks / Component Runtime Sonarqube Results

component-tools/src/main/java/org/talend/sdk/component/tools/exec/CarMain.java#L300

Refactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.
String mainGav = null;
final Properties properties = new Properties();
try (final JarInputStream jar =
Expand All @@ -310,7 +310,7 @@
if (entry.getName().startsWith("MAVEN-INF/repository/")) {
final String path = entry.getName().substring("MAVEN-INF/repository/".length());
final File output = new File(m2Root, path);
if (!output.getCanonicalPath().startsWith(m2Root.getCanonicalPath())) {
if (!output.getCanonicalPath().startsWith(m2Root.getCanonicalPath() + File.separator)) {
throw new IOException("The output file is not contained in the destination directory");
}
if (!output.exists() || forceOverwrite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static void unzip(final InputStream read, final File destination, final
path = path.replaceFirst("^[^/]+/", "");
}
final File file = new File(destination, path);
if (!file.getCanonicalPath().startsWith(destination.getCanonicalPath())) {
if (!file.getCanonicalPath().startsWith(destination.getCanonicalPath() + File.separator)) {
throw new IOException("The output file is not contained in the destination directory");
}

Expand Down
Loading