Skip to content

Commit d5e914f

Browse files
authored
Merge pull request #49 from TheSoftwareDesignLab/develop
MO4 and MO17 compilation errors solved
2 parents 51078dc + b5d986a commit d5e914f

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

src/uniandes/tsdl/mutapk/MutAPK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static void runMutAPK(String[] args) throws Exception {
8282
Helper.getInstance();
8383
Helper.setPackageName(appName);
8484
// Decode the APK
85-
//APKToolWrapper.openAPK(apkPath, extraPath);
85+
APKToolWrapper.openAPK(apkPath, extraPath);
8686

8787
//Read selected operators
8888
OperatorBundle operatorBundle = new OperatorBundle(operatorsDir);

src/uniandes/tsdl/mutapk/operators/activity/InvalidKeyIntentPutExtra.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

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

10+
import uniandes.tsdl.antlr.smaliParser;
1011
import uniandes.tsdl.mutapk.helper.FileHelper;
1112
import uniandes.tsdl.mutapk.helper.Helper;
1213
import uniandes.tsdl.mutapk.helper.StringGenerator;
@@ -20,20 +21,29 @@ public boolean performMutation(MutationLocation location, BufferedWriter writer,
2021

2122
ASTMutationLocation mLocation = (ASTMutationLocation) location;
2223
CommonTree parent = (CommonTree) mLocation.getTree().getParent();
23-
// System.out.println(parent.toStringTree());
2424
List<CommonTree> hijos = (List<CommonTree>)parent.getChildren();
2525
String extraKeyVar = hijos.get(1).getChild(1).toString();
2626
CommonTree method = (CommonTree) parent.getParent();
2727
int putExtraPos = parent.getChildIndex();
28-
int extraKeyValPos = 0;
28+
int extraKeyValPos = -1;
2929
boolean finished = false;
3030
for (int i = putExtraPos; i >-1 && !finished; i--) {
3131
CommonTree temp = (CommonTree) method.getChild(i);
32-
if(temp.getType()==140 && temp.getChild(1).toString().equals(extraKeyVar)) {
32+
System.out.println(mutantIndex+" - "+temp.getType()+" - "+temp.toStringTree());
33+
if(temp.getType()==smaliParser.I_STATEMENT_FORMAT22x && temp.getChild(1).toString().equals(extraKeyVar)) {
34+
extraKeyVar=temp.getChild(2).toString();
35+
}
36+
if(temp.getType()==smaliParser.I_STATEMENT_FORMAT21c_STRING && temp.getChild(1).toString().equals(extraKeyVar)) {
3337
extraKeyValPos = temp.getLine();
3438
finished = true;
3539
}
3640
}
41+
42+
if (extraKeyValPos==-1) {
43+
extraKeyValPos=mLocation.getLine()-1;
44+
}
45+
46+
3747
String newKey = StringGenerator.generateRandomString();
3848

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

src/uniandes/tsdl/mutapk/operators/data/android/InvalidURI.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public boolean performMutation(MutationLocation location, BufferedWriter writer,
3232
for(int i=0; i < mLocation.getLine()-1; i++){
3333
newLines.add(lines.get(i));
3434
}
35-
String newVarName = varName.substring(0, 1)+(Integer.parseInt(varName.substring(1))+2);
35+
//String newVarName = varName.substring(0, 1)+(Integer.parseInt(varName.substring(1))+2);
3636
String newVarValue = StringGenerator.generateRandomString();
3737
// //Apply mutation
3838
newLines.add("");
39-
newLines.add(" const-string "+newVarName+", \""+newVarValue+"\"");
39+
newLines.add(" const-string "+varName+", \""+newVarValue+"\"");
4040
newLines.add("");
41-
newLines.add(lines.get(mLocation.getLine()-1).replaceAll(varName, newVarName));
41+
newLines.add(lines.get(mLocation.getLine()-1));
4242
newLines.add("");
4343

4444
for(int i=mLocation.getLine(); i < lines.size() ; i++){

test/MutAPK-0.0.1.jar

-135 Bytes
Binary file not shown.

test/operators.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 30 = BuggyGUIListener
22
# 15 = BluetoothAdapterAlwaysEnabled
33
# 31 = InvalidIDFindView
4-
2 = DifferentActivityIntentDefinition
4+
# 2 = DifferentActivityIntentDefinition
5+
4 = InvalidKeyIntentPutExtra

0 commit comments

Comments
 (0)