All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.codemodder.remediation.javadeserialization.JavaDeserializationRemediator Maven / Gradle / Ivy

package io.codemodder.remediation.javadeserialization;

import com.github.javaparser.ast.CompilationUnit;
import io.codemodder.CodemodFileScanningResult;
import io.codemodder.codetf.DetectorRule;
import io.codemodder.remediation.*;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;

/**
 * Fixes issues of related to object deserialization
 *
 * @param 
 */
public final class JavaDeserializationRemediator implements Remediator {

  private final SearcherStrategyRemediator searchStrategyRemediator;

  public JavaDeserializationRemediator() {
    this.searchStrategyRemediator =
        new SearcherStrategyRemediator.Builder()
            .withSearcherStrategyPair(
                new FixCandidateSearcher.Builder()
                    .withMatcher(JavaDeserializationFixStrategy::match)
                    .build(),
                new JavaDeserializationFixStrategy())
            .build();
  }

  @Override
  public CodemodFileScanningResult remediateAll(
      CompilationUnit cu,
      String path,
      DetectorRule detectorRule,
      Collection findingsForPath,
      Function findingIdExtractor,
      Function findingStartLineExtractor,
      Function> findingEndLineExtractor,
      Function> findingColumnExtractor) {
    return searchStrategyRemediator.remediateAll(
        cu,
        path,
        detectorRule,
        findingsForPath,
        findingIdExtractor,
        findingStartLineExtractor,
        findingEndLineExtractor,
        findingColumnExtractor);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy