[O] Optimize

This commit is contained in:
Azalea (on HyDEV-Daisy)
2022-06-07 10:27:49 -04:00
parent fd9831db46
commit 57df75093d
2 changed files with 9 additions and 10 deletions
@@ -36,19 +36,16 @@ public class GumTreeComparer {
log.info("Null GumTree of Revised File: " + revFile.getPath()); log.info("Null GumTree of Revised File: " + revFile.getPath());
throw new NullPointerException(revFile.getPath()); throw new NullPointerException(revFile.getPath());
} }
} }
if (oldTree != null && newTree != null) { if (oldTree == null || newTree == null) return null;
Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
m.match();
ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
ag.generate();
List<Action> actions = ag.getActions(); // change actions from bug to patch
return actions; Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
} m.match();
ActionGenerator ag = new ActionGenerator(oldTree, newTree, m.getMappings());
ag.generate();
List<Action> actions = ag.getActions(); // change actions from bug to patch
return null; return actions;
} }
public List<Action> compareCFilesWithGumTree(File prevFile, File revFile) { public List<Action> compareCFilesWithGumTree(File prevFile, File revFile) {
@@ -31,9 +31,11 @@ public class GumTreeCComparer {
newTree = new SrcmlCTreeGenerator(srcmlPath).generateFromFile(revFile).getRoot(); newTree = new SrcmlCTreeGenerator(srcmlPath).generateFromFile(revFile).getRoot();
} catch (Exception e) { } catch (Exception e) {
if (oldTree == null) { if (oldTree == null) {
e.printStackTrace();
log.info("Null GumTree of Previous File: " + prevFile.getPath()); log.info("Null GumTree of Previous File: " + prevFile.getPath());
throw new NullPointerException(prevFile.getPath()); throw new NullPointerException(prevFile.getPath());
} else if (newTree == null) { } else if (newTree == null) {
e.printStackTrace();
log.info("Null GumTree of Revised File: " + revFile.getPath()); log.info("Null GumTree of Revised File: " + revFile.getPath());
throw new NullPointerException(revFile.getPath()); throw new NullPointerException(revFile.getPath());
} }