From 14f4ee2717905f25d75586efe548b075ec964c05 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:59:34 +0000 Subject: [PATCH 1/2] (Sonar) Fixed finding: "Unused private methods should be removed" --- .../JavaDeserializationFixStrategy.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java b/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java index 74c27015e..1e5743fc0 100644 --- a/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java +++ b/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java @@ -98,19 +98,6 @@ public SuccessOrReason fix(final CompilationUnit cu, final Node node) { return SuccessOrReason.success(List.of(DependencyGAV.JAVA_SECURITY_TOOLKIT)); } - /** - * Build a {@link io.codemodder.CodemodChange} for this code change that fixes the given issues. - */ - private static @NotNull CodemodChange buildFixChange( - final DetectorRule detectorRule, - final Function getKey, - final Function getLine, - final List issues) { - return CodemodChange.from( - getLine.apply(issues.get(0)), - List.of(DependencyGAV.JAVA_SECURITY_TOOLKIT), - issues.stream().map(i -> new FixedFinding(getKey.apply(i), detectorRule)).toList()); - } private void fixObjectInputStreamCreation(final ObjectCreationExpr objCreation) { replace(objCreation) From bc7c92f3cde7f20991b81f336418e7393266e6f3 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" Date: Mon, 21 Oct 2024 12:01:38 +0000 Subject: [PATCH 2/2] :art: Apply formatting --- .../javadeserialization/JavaDeserializationFixStrategy.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java b/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java index 1e5743fc0..df651a6c8 100644 --- a/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java +++ b/framework/codemodder-base/src/main/java/io/codemodder/remediation/javadeserialization/JavaDeserializationFixStrategy.java @@ -9,19 +9,14 @@ import com.github.javaparser.ast.expr.MethodCallExpr; import com.github.javaparser.ast.expr.NameExpr; import com.github.javaparser.ast.expr.ObjectCreationExpr; -import io.codemodder.CodemodChange; import io.codemodder.DependencyGAV; import io.codemodder.Either; import io.codemodder.ast.ASTs; import io.codemodder.ast.LocalDeclaration; -import io.codemodder.codetf.DetectorRule; -import io.codemodder.codetf.FixedFinding; import io.codemodder.remediation.*; import io.github.pixee.security.ObjectInputFilters; import java.util.List; import java.util.Optional; -import java.util.function.Function; -import org.jetbrains.annotations.NotNull; public final class JavaDeserializationFixStrategy implements RemediationStrategy { @@ -98,7 +93,6 @@ public SuccessOrReason fix(final CompilationUnit cu, final Node node) { return SuccessOrReason.success(List.of(DependencyGAV.JAVA_SECURITY_TOOLKIT)); } - private void fixObjectInputStreamCreation(final ObjectCreationExpr objCreation) { replace(objCreation) .withStaticMethod(ObjectInputFilters.class.getName(), "createSafeObjectInputStream")