diff --git a/all_instances_found.json b/all_instances_found.json deleted file mode 100644 index 895738a68..000000000 --- a/all_instances_found.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "instances": [ - { - "revision": "patch1-Chart-13-Nopol2017", - "repairability": [ - { - "tool-name": "Nopol", - "pattern-name": "Nopol:if_condition_ins_deep", - "instance_detail": [ - { - "pattern_action": "MOV", - "pattern_entity": { - "entity_type": "*", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": { - "entity_type": "*", - "entity_new value": "*", - "entity_role": "Then", - "entity_parent": { - "entity_type": "If", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": "null" - } - } - }, - "concrete_change": { - "operator": "MOV", - "src_type": "If", - "dst_type": "If", - "src": "if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n}", - "dst": "if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n}", - "src_parent_type": "Block", - "dst_parent_type": "Block", - "src_parent": "{\n double[] w \u003d new double[5];\n double[] h \u003d new double[5];\n w[0] \u003d constraint.getWidth();\n if ((this.topBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c1 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, constraint.getHeight()), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.topBlock.arrange(g2, c1);\n h[0] \u003d size.height;\n }\n w[1] \u003d w[0];\n if ((this.bottomBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c2 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, ((constraint.getHeight()) - (h[0]))), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.bottomBlock.arrange(g2, c2);\n h[1] \u003d size.height;\n }\n h[2] \u003d ((constraint.getHeight()) - (h[1])) - (h[0]);\n if ((this.leftBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c3 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, constraint.getWidth()), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.leftBlock.arrange(g2, c3);\n w[2] \u003d size.width;\n }\n h[3] \u003d h[2];\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n h[4] \u003d h[2];\n w[4] \u003d ((constraint.getWidth()) - (w[3])) - (w[2]);\n org.jfree.chart.block.RectangleConstraint c5 \u003d new org.jfree.chart.block.RectangleConstraint(w[4], h[4]);\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.arrange(g2, c5);\n }\n if ((this.topBlock) !\u003d null) {\n this.topBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, 0.0, w[0], h[0]));\n }\n if ((this.bottomBlock) !\u003d null) {\n this.bottomBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, ((h[0]) + (h[2])), w[1], h[1]));\n }\n if ((this.leftBlock) !\u003d null) {\n this.leftBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, h[0], w[2], h[2]));\n }\n if ((this.rightBlock) !\u003d null) {\n this.rightBlock.setBounds(new java.awt.geom.Rectangle2D.Double(((w[2]) + (w[4])), h[0], w[3], h[3]));\n }\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.setBounds(new java.awt.geom.Rectangle2D.Double(w[2], h[0], w[4], h[4]));\n }\n return new org.jfree.chart.util.Size2D(constraint.getWidth(), constraint.getHeight());\n}", - "dst_parent": "{\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n}" - }, - "line": 453, - "file": "/Users/macbook/Documents/coming/Spoon/coming/patch1-Chart-13-Nopol2017" - }, - { - "pattern_action": "INS", - "pattern_entity": { - "entity_type": "If", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": "null" - }, - "concrete_change": { - "operator": "INS", - "src_type": "If", - "dst_type": "null", - "src": "if (null !\u003d null) {\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n}", - "dst": "null", - "src_parent_type": "Block", - "dst_parent_type": "null", - "src_parent": "{\n double[] w \u003d new double[5];\n double[] h \u003d new double[5];\n w[0] \u003d constraint.getWidth();\n if ((this.topBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c1 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, constraint.getHeight()), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.topBlock.arrange(g2, c1);\n h[0] \u003d size.height;\n }\n w[1] \u003d w[0];\n if ((this.bottomBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c2 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, ((constraint.getHeight()) - (h[0]))), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.bottomBlock.arrange(g2, c2);\n h[1] \u003d size.height;\n }\n h[2] \u003d ((constraint.getHeight()) - (h[1])) - (h[0]);\n if ((this.leftBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c3 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, constraint.getWidth()), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.leftBlock.arrange(g2, c3);\n w[2] \u003d size.width;\n }\n h[3] \u003d h[2];\n if (null !\u003d null) {\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n }\n h[4] \u003d h[2];\n w[4] \u003d ((constraint.getWidth()) - (w[3])) - (w[2]);\n org.jfree.chart.block.RectangleConstraint c5 \u003d new org.jfree.chart.block.RectangleConstraint(w[4], h[4]);\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.arrange(g2, c5);\n }\n if ((this.topBlock) !\u003d null) {\n this.topBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, 0.0, w[0], h[0]));\n }\n if ((this.bottomBlock) !\u003d null) {\n this.bottomBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, ((h[0]) + (h[2])), w[1], h[1]));\n }\n if ((this.leftBlock) !\u003d null) {\n this.leftBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, h[0], w[2], h[2]));\n }\n if ((this.rightBlock) !\u003d null) {\n this.rightBlock.setBounds(new java.awt.geom.Rectangle2D.Double(((w[2]) + (w[4])), h[0], w[3], h[3]));\n }\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.setBounds(new java.awt.geom.Rectangle2D.Double(w[2], h[0], w[4], h[4]));\n }\n return new org.jfree.chart.util.Size2D(constraint.getWidth(), constraint.getHeight());\n}", - "dst_parent": "null" - }, - "line": 453, - "file": "/Users/macbook/Documents/coming/Spoon/coming/patch1-Chart-13-Nopol2017" - } - ] - }, - { - "tool-name": "JKali", - "pattern-name": "JKali:add_rtrn", - "instance_detail": [ - { - "pattern_action": "INS", - "pattern_entity": { - "entity_type": "*", - "entity_new value": "*", - "entity_role": "Statement", - "entity_parent": "null" - }, - "concrete_change": { - "operator": "INS", - "src_type": "If", - "dst_type": "null", - "src": "if (null !\u003d null) {\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n}", - "dst": "null", - "src_parent_type": "Block", - "dst_parent_type": "null", - "src_parent": "{\n double[] w \u003d new double[5];\n double[] h \u003d new double[5];\n w[0] \u003d constraint.getWidth();\n if ((this.topBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c1 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, constraint.getHeight()), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.topBlock.arrange(g2, c1);\n h[0] \u003d size.height;\n }\n w[1] \u003d w[0];\n if ((this.bottomBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c2 \u003d new org.jfree.chart.block.RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new org.jfree.data.Range(0.0, ((constraint.getHeight()) - (h[0]))), LengthConstraintType.RANGE);\n org.jfree.chart.util.Size2D size \u003d this.bottomBlock.arrange(g2, c2);\n h[1] \u003d size.height;\n }\n h[2] \u003d ((constraint.getHeight()) - (h[1])) - (h[0]);\n if ((this.leftBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c3 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, constraint.getWidth()), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.leftBlock.arrange(g2, c3);\n w[2] \u003d size.width;\n }\n h[3] \u003d h[2];\n if (null !\u003d null) {\n if ((this.rightBlock) !\u003d null) {\n org.jfree.chart.block.RectangleConstraint c4 \u003d new org.jfree.chart.block.RectangleConstraint(0.0, new org.jfree.data.Range(0.0, ((constraint.getWidth()) - (w[2]))), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED);\n org.jfree.chart.util.Size2D size \u003d this.rightBlock.arrange(g2, c4);\n w[3] \u003d size.width;\n }\n }\n h[4] \u003d h[2];\n w[4] \u003d ((constraint.getWidth()) - (w[3])) - (w[2]);\n org.jfree.chart.block.RectangleConstraint c5 \u003d new org.jfree.chart.block.RectangleConstraint(w[4], h[4]);\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.arrange(g2, c5);\n }\n if ((this.topBlock) !\u003d null) {\n this.topBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, 0.0, w[0], h[0]));\n }\n if ((this.bottomBlock) !\u003d null) {\n this.bottomBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, ((h[0]) + (h[2])), w[1], h[1]));\n }\n if ((this.leftBlock) !\u003d null) {\n this.leftBlock.setBounds(new java.awt.geom.Rectangle2D.Double(0.0, h[0], w[2], h[2]));\n }\n if ((this.rightBlock) !\u003d null) {\n this.rightBlock.setBounds(new java.awt.geom.Rectangle2D.Double(((w[2]) + (w[4])), h[0], w[3], h[3]));\n }\n if ((this.centerBlock) !\u003d null) {\n this.centerBlock.setBounds(new java.awt.geom.Rectangle2D.Double(w[2], h[0], w[4], h[4]));\n }\n return new org.jfree.chart.util.Size2D(constraint.getWidth(), constraint.getHeight());\n}", - "dst_parent": "null" - }, - "line": 453, - "file": "/Users/macbook/Documents/coming/Spoon/coming/patch1-Chart-13-Nopol2017" - } - ] - } - ] - }, - { - "revision": "patch1-Chart-26-jMutRepair", - "repairability": [ - { - "tool-name": "JMutRepair", - "pattern-name": "JMutRepair:unary", - "instance_detail": [ - { - "pattern_action": "ANY", - "pattern_entity": { - "entity_type": "UnaryOperator", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": "null" - }, - "concrete_change": { - "operator": "INS", - "src_type": "UnaryOperator", - "dst_type": "null", - "src": "(!b1)", - "dst": "null", - "src_parent_type": "BinaryOperator", - "dst_parent_type": "null", - "src_parent": "(!b1) || b2", - "dst_parent": "null" - }, - "line": 2538, - "file": "/Users/macbook/Documents/coming/Spoon/coming/patch1-Chart-26-jMutRepair" - } - ] - }, - { - "tool-name": "Nopol", - "pattern-name": "Nopol:if_condition_upd_deep", - "instance_detail": [ - { - "pattern_action": "ANY", - "pattern_entity": { - "entity_type": "*", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": { - "entity_type": "*", - "entity_new value": "*", - "entity_role": "condition", - "entity_parent": { - "entity_type": "If", - "entity_new value": "*", - "entity_role": "*", - "entity_parent": "null" - } - } - }, - "concrete_change": { - "operator": "INS", - "src_type": "UnaryOperator", - "dst_type": "null", - "src": "(!b1)", - "dst": "null", - "src_parent_type": "BinaryOperator", - "dst_parent_type": "null", - "src_parent": "(!b1) || b2", - "dst_parent": "null" - }, - "line": 2538, - "file": "/Users/macbook/Documents/coming/Spoon/coming/patch1-Chart-26-jMutRepair" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/java/fr/inria/coming/core/engine/RevisionNavigationExperiment.java b/src/main/java/fr/inria/coming/core/engine/RevisionNavigationExperiment.java index c2dbf8d6d..6fec60ef2 100644 --- a/src/main/java/fr/inria/coming/core/engine/RevisionNavigationExperiment.java +++ b/src/main/java/fr/inria/coming/core/engine/RevisionNavigationExperiment.java @@ -7,6 +7,7 @@ import fr.inria.coming.changeminer.entity.FinalResult; import fr.inria.coming.changeminer.entity.IRevision; import fr.inria.coming.core.engine.callback.IntermediateResultProcessorCallback; +import fr.inria.coming.core.engine.filespair.FileDiff; import fr.inria.coming.core.entities.AnalysisResult; import fr.inria.coming.core.entities.RevisionDataset; import fr.inria.coming.core.entities.RevisionResult; @@ -14,6 +15,7 @@ import fr.inria.coming.core.entities.interfaces.IOutput; import fr.inria.coming.core.entities.interfaces.RevisionOrder; import fr.inria.coming.main.ComingProperties; +import org.apache.log4j.Logger; /** * @@ -21,6 +23,7 @@ * */ public abstract class RevisionNavigationExperiment { + Logger log = Logger.getLogger(FileDiff.class.getName()); protected RevisionOrder navigationStrategy = null; protected List analyzers = new ArrayList<>(); @@ -103,7 +106,8 @@ public FinalResult analyze() { R oneRevision = iterator.next(); - System.out.println("\n***********\nAnalyzing " + i + "/" + size); + log.info("\n***********\nAnalyzing " + i + "/" + size); +// System.out.println("\n***********\nAnalyzing " + i + "/" + size); if (!accept(oneRevision)) { continue; } diff --git a/src/main/java/fr/inria/coming/core/engine/files/FileDiff.java b/src/main/java/fr/inria/coming/core/engine/files/FileDiff.java index 3e072cf3f..6305323f6 100644 --- a/src/main/java/fr/inria/coming/core/engine/files/FileDiff.java +++ b/src/main/java/fr/inria/coming/core/engine/files/FileDiff.java @@ -29,7 +29,8 @@ public FileDiff(File diffFolder) { @Override public List getChildren() { if (this.diffFolder == null) { - System.out.println("Diff folder == null"); + log.info("Diff folder == null"); +// System.out.println("Diff folder == null"); return null; } List pairs = new ArrayList<>(); @@ -69,7 +70,8 @@ public List getChildren() { ; } } catch (Exception e) { - System.err.println("Error analyzing " + diffFolder); + log.error("Error analyzing " + diffFolder); +// System.err.println("Error analyzing " + diffFolder); e.printStackTrace(); } diff --git a/src/main/java/fr/inria/coming/core/engine/filespair/FileDiff.java b/src/main/java/fr/inria/coming/core/engine/filespair/FileDiff.java index 0724b3f8c..8dd14a2f6 100644 --- a/src/main/java/fr/inria/coming/core/engine/filespair/FileDiff.java +++ b/src/main/java/fr/inria/coming/core/engine/filespair/FileDiff.java @@ -30,7 +30,8 @@ public FileDiff(File left, File right) { public List getChildren() { if (left == null || right == null) { - System.out.println("files is null"); + log.info("files is null"); +// System.out.println("files is null"); return null; } diff --git a/src/main/java/fr/inria/coming/core/entities/DiffResult.java b/src/main/java/fr/inria/coming/core/entities/DiffResult.java index c4025c4ef..2c62d1583 100644 --- a/src/main/java/fr/inria/coming/core/entities/DiffResult.java +++ b/src/main/java/fr/inria/coming/core/entities/DiffResult.java @@ -1,5 +1,8 @@ package fr.inria.coming.core.entities; +import fr.inria.coming.changeminer.analyzer.commitAnalyzer.FineGrainDifftAnalyzer; +import org.apache.log4j.Logger; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -13,6 +16,8 @@ */ public class DiffResult extends AnalysisResult { + static Logger log = Logger.getLogger(FineGrainDifftAnalyzer.class.getName()); + /** * Filename */ @@ -50,7 +55,9 @@ public String toString() { try { r += "\n" + idiff.toString(); } catch (Exception e) { - System.err.println("Error when printing diff result: " + e.getMessage()); + +// System.err.println("Error when printing diff result: " + e.getMessage()); + log.error("Error when printing diff result: " + e.getMessage()); e.printStackTrace(); } diff --git a/src/main/java/fr/inria/coming/main/ComingMain.java b/src/main/java/fr/inria/coming/main/ComingMain.java index fb2a6a5d7..ee57f910d 100644 --- a/src/main/java/fr/inria/coming/main/ComingMain.java +++ b/src/main/java/fr/inria/coming/main/ComingMain.java @@ -55,7 +55,7 @@ */ public class ComingMain { - Logger log = Logger.getLogger(FineGrainDifftAnalyzer.class.getName()); + static Logger logm = Logger.getLogger(FineGrainDifftAnalyzer.class.getName()); static Options options = new Options(); @@ -123,8 +123,10 @@ public static void main(String[] args) { try { cmain.run(args); } catch (Exception e) { - System.err.println("Error initializing Coming with args" + Arrays.toString(args)); - System.err.println(e); + logm.error("Error initializing Coming with args\" + Arrays.toString(args)"); +// System.err.println("Error initializing Coming with args" + Arrays.toString(args)); + logm.error(e); +// System.err.println(e); e.printStackTrace(); } } @@ -157,7 +159,8 @@ public boolean createEngine(String[] args) throws ParseException { try { cmd = parser.parse(options, args); } catch (UnrecognizedOptionException e) { - System.out.println("Error: " + e.getMessage()); + logm.error("Error: " + e.getMessage()); +// System.out.println("Error: " + e.getMessage()); help(); return false; } @@ -413,7 +416,7 @@ private List loadPattern() { ChangePatternSpecification patternParsed = patternParser.parse(fl); patternsFound.add(patternParsed); } else { - log.error("The pattern file given as input does not exist " + fl.getAbsolutePath()); + logm.error("The pattern file given as input does not exist " + fl.getAbsolutePath()); } } } else { @@ -470,7 +473,8 @@ private static void help() { HelpFormatter formater = new HelpFormatter(); formater.printHelp("Main", options); - System.out.println("More options and default values at 'configuration.properties' file"); + logm.info("More options and default values at 'configuration.properties' file"); +// System.out.println("More options and default values at 'configuration.properties' file"); System.exit(0); diff --git a/src/main/java/fr/inria/coming/repairability/JSONRepairabilityOutput.java b/src/main/java/fr/inria/coming/repairability/JSONRepairabilityOutput.java index 3bea3a6ed..3c212907c 100644 --- a/src/main/java/fr/inria/coming/repairability/JSONRepairabilityOutput.java +++ b/src/main/java/fr/inria/coming/repairability/JSONRepairabilityOutput.java @@ -2,6 +2,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import fr.inria.coming.changeminer.analyzer.commitAnalyzer.FineGrainDifftAnalyzer; import fr.inria.coming.changeminer.analyzer.instancedetector.ChangePatternInstance; import fr.inria.coming.changeminer.analyzer.instancedetector.PatternInstanceAnalyzer; import fr.inria.coming.changeminer.analyzer.instancedetector.PatternInstancesFromDiff; @@ -10,11 +11,13 @@ import fr.inria.coming.core.entities.RevisionResult; import fr.inria.coming.core.entities.output.JSonPatternInstanceOutput; import gumtree.spoon.diff.operations.Operation; +import org.apache.log4j.Logger; import java.io.File; public class JSONRepairabilityOutput extends JSonPatternInstanceOutput { + Logger log = Logger.getLogger(FineGrainDifftAnalyzer.class.getName()); public void getInstancesOfRevision(RevisionResult revisionResult, JsonArray instances) { @@ -33,8 +36,10 @@ public void getInstancesOfRevision(RevisionResult revisionResult, JsonArray inst instance.addProperty("revision", revisionIdentifier.toString()); - System.out.println("\n--------\ncommit with instance:\n " + revisionIdentifier); - System.out.println(pi.getInstances()); + log.info("\n--------\ncommit with instance:\n " + revisionIdentifier); +// System.out.println("\n--------\ncommit with instance:\n " + revisionIdentifier); + log.info(pi.getInstances()); +// System.out.println(pi.getInstances()); JsonArray repair_tools = new JsonArray(); for (ChangePatternInstance instancePattern : pi.getInstances()) { diff --git a/src/main/java/fr/inria/coming/repairability/repairtools/NPEfix.java b/src/main/java/fr/inria/coming/repairability/repairtools/NPEfix.java index c59f7a138..95580a6aa 100644 --- a/src/main/java/fr/inria/coming/repairability/repairtools/NPEfix.java +++ b/src/main/java/fr/inria/coming/repairability/repairtools/NPEfix.java @@ -28,9 +28,16 @@ public class NPEfix extends AbstractRepairTool { private static final String[] patternFileNames = { - "replacement.xml", + "replacement3.xml", "replacement2.xml", - "replacement3.xml" + "replacement.xml", + "replacement4.xml", + "replacement5.xml", + "replacement6.xml", + "replacement7.xml", + "replacement8.xml", + "replacement9.xml", + "replacement11.xml" }; /** diff --git a/src/main/resources/repairability/NPEfix/replacement.xml b/src/main/resources/repairability/NPEfix/replacement.xml index aaff21c56..2a4c39760 100644 --- a/src/main/resources/repairability/NPEfix/replacement.xml +++ b/src/main/resources/repairability/NPEfix/replacement.xml @@ -1,6 +1,7 @@ - - + + + diff --git a/src/main/resources/repairability/NPEfix/replacement11.xml b/src/main/resources/repairability/NPEfix/replacement11.xml new file mode 100644 index 000000000..807f179f3 --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement11.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement2.xml b/src/main/resources/repairability/NPEfix/replacement2.xml index 0e30a1ab8..814de57fe 100644 --- a/src/main/resources/repairability/NPEfix/replacement2.xml +++ b/src/main/resources/repairability/NPEfix/replacement2.xml @@ -1,6 +1,7 @@ - - + + + diff --git a/src/main/resources/repairability/NPEfix/replacement3.xml b/src/main/resources/repairability/NPEfix/replacement3.xml index ccd71c902..132e325f7 100644 --- a/src/main/resources/repairability/NPEfix/replacement3.xml +++ b/src/main/resources/repairability/NPEfix/replacement3.xml @@ -1,4 +1,4 @@ - + diff --git a/src/main/resources/repairability/NPEfix/replacement4.xml b/src/main/resources/repairability/NPEfix/replacement4.xml new file mode 100644 index 000000000..376e3582e --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement4.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement5.xml b/src/main/resources/repairability/NPEfix/replacement5.xml new file mode 100644 index 000000000..ae3e5854d --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement5.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement6.xml b/src/main/resources/repairability/NPEfix/replacement6.xml new file mode 100644 index 000000000..9fe3ec5f0 --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement6.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement7.xml b/src/main/resources/repairability/NPEfix/replacement7.xml new file mode 100644 index 000000000..559052067 --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement7.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement8.xml b/src/main/resources/repairability/NPEfix/replacement8.xml new file mode 100644 index 000000000..a1c8716b5 --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement8.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/main/resources/repairability/NPEfix/replacement9.xml b/src/main/resources/repairability/NPEfix/replacement9.xml new file mode 100644 index 000000000..d0cf6b5e7 --- /dev/null +++ b/src/main/resources/repairability/NPEfix/replacement9.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/main/resources/repairability_test_files/NPEfix/NPEfix12/twelve/NPEfix12_twelve_t.java b/src/main/resources/repairability_test_files/NPEfix/NPEfix12/twelve/NPEfix12_twelve_t.java index d1f0291a0..e5e9b65bf 100644 --- a/src/main/resources/repairability_test_files/NPEfix/NPEfix12/twelve/NPEfix12_twelve_t.java +++ b/src/main/resources/repairability_test_files/NPEfix/NPEfix12/twelve/NPEfix12_twelve_t.java @@ -1,4 +1,4 @@ -/* + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/src/test/java/fr/inria/coming/spoon/repairability/RepairabilityTest.java b/src/test/java/fr/inria/coming/spoon/repairability/RepairabilityTest.java index 8485d69ac..b98eba19a 100644 --- a/src/test/java/fr/inria/coming/spoon/repairability/RepairabilityTest.java +++ b/src/test/java/fr/inria/coming/spoon/repairability/RepairabilityTest.java @@ -28,7 +28,7 @@ public void testRepairabilityInterface() throws Exception { public void testRepairabilityAll() throws Exception { FinalResult result = TestUtills.runRepairability("ALL", "/repairability_test_files/mixed/"); - TestUtills.numberOfInstances(result, 2, 5); + TestUtills.numberOfInstances(result, 2, 3); } @Test diff --git a/src/test/java/fr/inria/coming/spoon/repairability/repairtools/NPEfixTest.java b/src/test/java/fr/inria/coming/spoon/repairability/repairtools/NPEfixTest.java index a331a7033..80646d1f8 100644 --- a/src/test/java/fr/inria/coming/spoon/repairability/repairtools/NPEfixTest.java +++ b/src/test/java/fr/inria/coming/spoon/repairability/repairtools/NPEfixTest.java @@ -10,7 +10,7 @@ public class NPEfixTest { @Test public void NPEfixTest() throws Exception { FinalResult result = TestUtills.runRepairability("NPEfix", "/repairability_test_files/NPEfix/"); - TestUtills.numberOfInstances(result, 18, 18); + TestUtills.numberOfInstances(result, 18, 16); } // @Test