Skip to content

Commit dc7089a

Browse files
committed
Fix InvalidIDFindView
1 parent 360efd6 commit dc7089a

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

src/uniandes/tsdl/mutapk/MutAPK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static void runMutAPK(String[] args) throws Exception {
7676
apkName = apkPath.substring(apkPath.lastIndexOf("/"));
7777
}
7878
// Decode the APK
79-
APKToolWrapper.openAPK(apkPath, extraPath);
79+
//APKToolWrapper.openAPK(apkPath, extraPath);
8080

8181
//Read selected operators
8282
OperatorBundle operatorBundle = new OperatorBundle(operatorsDir);

src/uniandes/tsdl/mutapk/helper/ASTHelper.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ public static CommonTree getFirstUncleNamedOfType(int type, String name, CommonT
6969
}
7070
return null;
7171
}
72+
73+
public static CommonTree getFirstBackUncleNamedOfType(int type, String name, CommonTree t) {
74+
CommonTree parent = (CommonTree) t.getParent();
75+
List<CommonTree> uncles = (List<CommonTree>)((CommonTree)parent.getParent()).getChildren();
76+
for (int i = parent.getChildIndex(); i > -1; i--) {
77+
CommonTree tempUncle = (CommonTree) uncles.get(i);
78+
if(tempUncle.getType()==type && tempUncle.getChild(0).toStringTree().equals(name)) {
79+
return tempUncle;
80+
}
81+
}
82+
return null;
83+
}
7284

7385
public static CommonTree getFirstBrotherNamedOfType(int type, String name, CommonTree t) {
7486
CommonTree parent = (CommonTree) t.getParent();

src/uniandes/tsdl/mutapk/operators/gui/android/InvalidIDFindView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import org.antlr.runtime.tree.CommonTree;
88

9+
import uniandes.tsdl.antlr.smaliParser;
10+
import uniandes.tsdl.mutapk.helper.ASTHelper;
911
import uniandes.tsdl.mutapk.helper.FileHelper;
1012
import uniandes.tsdl.mutapk.helper.Helper;
1113
import uniandes.tsdl.mutapk.helper.HexadecimalGenerator;
@@ -20,7 +22,7 @@ public boolean performMutation(MutationLocation location, BufferedWriter writer,
2022

2123
ASTMutationLocation mLocation = (ASTMutationLocation) location;
2224
CommonTree parent = (CommonTree) mLocation.getTree().getParent();
23-
CommonTree uncle = (CommonTree)parent.getParent().getChild(parent.getChildIndex()-1);
25+
CommonTree uncle = ASTHelper.getFirstBackUncleNamedOfType(smaliParser.I_STATEMENT_FORMAT31i, "const", mLocation.getTree());
2426
String constVarName = uncle.getChild(1).getText();
2527

2628
List<String> newLines = new ArrayList<String>();

test/MutAPK-0.0.1.jar

1.42 KB
Binary file not shown.

test/operators.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
# 30 = BuggyGUIListener
2+
15 = BluetoothAdapterAlwaysEnabled
3+
31 = InvalidIDFindView

0 commit comments

Comments
 (0)