Class ReplaceDefaultHttpClientCodemod

java.lang.Object
io.codemodder.javaparser.JavaParserChanger
io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.ObjectCreationExpr>
io.codemodder.codemods.ReplaceDefaultHttpClientCodemod
All Implemented Interfaces:
io.codemodder.CodeChanger

@Codemod(id="pixee:java/replace-apache-defaulthttpclient", reviewGuidance=MERGE_AFTER_CURSORY_REVIEW) public final class ReplaceDefaultHttpClientCodemod extends io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.ObjectCreationExpr>
This codemod replaces instances of org.apache.http.impl.client.DefaultHttpClient with HttpClientBuilder.create().useSystemProperties().build().
  • Field Summary

    Fields inherited from class io.codemodder.SarifPluginJavaParserChanger

    sarif

    Fields inherited from class io.codemodder.javaparser.JavaParserChanger

    reporter
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReplaceDefaultHttpClientCodemod(io.codemodder.RuleSarif sarif)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    onResultFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr, com.contrastsecurity.sarif.Result result)
     

    Methods inherited from class io.codemodder.SarifPluginJavaParserChanger

    shouldRun, visit

    Methods inherited from class io.codemodder.javaparser.JavaParserChanger

    dependenciesRequired, getDescription, getIndividualChangeDescription, getReferences, getSummary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReplaceDefaultHttpClientCodemod

      @Inject public ReplaceDefaultHttpClientCodemod(@SemgrepScan(yaml="rules:\n - id: replace-apache-defaulthttpclient\n patterns:\n - pattern: new org.apache.http.impl.client.DefaultHttpClient()\n") io.codemodder.RuleSarif sarif)
  • Method Details

    • onResultFound

      public boolean onResultFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr, com.contrastsecurity.sarif.Result result)
      Specified by:
      onResultFound in class io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.ObjectCreationExpr>