private String writeInvalidItemIndex(InvalidItemIndex ex, int type, IndentingWriter writer) throws IOException { writer.write("#"); writer.write(ex.getMessage()); writer.write("\n"); return String.format("%s@%d", ReferenceType.toString(type), ex.getInvalidIndex()); }
} catch (InvalidItemIndex ex) { writer.write("#"); writer.write(ex.getMessage()); writer.write("\n"); commentOutInstruction = true; ex.getInvalidIndex()); } catch (ReferenceType.InvalidReferenceTypeException ex) { writer.write("#invalid reference type: ");
} catch (InvalidItemIndex ex) { writer.write("#"); writer.write(ex.getMessage()); writer.write("\n"); commentOutInstruction = true; ex.getInvalidIndex()); } catch (ReferenceType.InvalidReferenceTypeException ex) { writer.write("#invalid reference type: ");
public int getClassDefItemOffset(int classIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return classStartOffset + classIndex*ClassDefItem.ITEM_SIZE; } if (classIndex < 0 || classIndex >= classCount) { throw new InvalidItemIndex(classIndex, "Class index out of bounds: %d", classIndex); } return classStartOffset + classIndex*ClassDefItem.ITEM_SIZE; }
public int getFieldIdItemOffset(int fieldIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return fieldStartOffset + fieldIndex*FieldIdItem.ITEM_SIZE; } if (fieldIndex < 0 || fieldIndex >= fieldCount) { throw new InvalidItemIndex(fieldIndex, "Field index out of bounds: %d", fieldIndex); } return fieldStartOffset + fieldIndex*FieldIdItem.ITEM_SIZE; }
public int getTypeIdItemOffset(int typeIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return typeStartOffset + typeIndex*TypeIdItem.ITEM_SIZE; } if (typeIndex < 0 || typeIndex >= typeCount) { throw new InvalidItemIndex(typeIndex, "Type index out of bounds: %d", typeIndex); } return typeStartOffset + typeIndex*TypeIdItem.ITEM_SIZE; }
public int getMethodHandleItemOffset(int methodHandleIndex) { MapItem mapItem = getMapItemForSection(ItemType.METHOD_HANDLE_ITEM); if (mapItem == null || methodHandleIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(methodHandleIndex , "Method handle index out of bounds: %d", methodHandleIndex); } return mapItem.getOffset() + methodHandleIndex * MethodHandleItem.ITEM_SIZE; }
public int getProtoIdItemOffset(int protoIndex) { if (protoIndex < 0 || protoIndex >= protoCount) { throw new InvalidItemIndex(protoIndex, "Proto index out of bounds: %d", protoIndex); } return protoStartOffset + protoIndex*ProtoIdItem.ITEM_SIZE; }
public int getFieldIdItemOffset(int fieldIndex) { if (fieldIndex < 0 || fieldIndex >= fieldCount) { throw new InvalidItemIndex(fieldIndex, "Field index out of bounds: %d", fieldIndex); } return fieldStartOffset + fieldIndex*FieldIdItem.ITEM_SIZE; }
public int getTypeIdItemOffset(int typeIndex) { if (typeIndex < 0 || typeIndex >= typeCount) { throw new InvalidItemIndex(typeIndex, "Type index out of bounds: %d", typeIndex); } return typeStartOffset + typeIndex*TypeIdItem.ITEM_SIZE; }
public int getMethodIdItemOffset(int methodIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return methodStartOffset + methodIndex*MethodIdItem.ITEM_SIZE; } if (methodIndex < 0 || methodIndex >= methodCount) { throw new InvalidItemIndex(methodIndex, "Method index out of bounds: %d", methodIndex); } return methodStartOffset + methodIndex*MethodIdItem.ITEM_SIZE; }
public int getCallSiteIdItemOffset(int callSiteIndex) { MapItem mapItem = getMapItemForSection(ItemType.CALL_SITE_ID_ITEM); if (mapItem == null || callSiteIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(callSiteIndex, "Call site index out of bounds: %d", callSiteIndex); } return mapItem.getOffset() + callSiteIndex * CallSiteIdItem.ITEM_SIZE; }
public int getMethodIdItemOffset(int methodIndex) { if (methodIndex < 0 || methodIndex >= methodCount) { throw new InvalidItemIndex(methodIndex, "Method index out of bounds: %d", methodIndex); } return methodStartOffset + methodIndex*MethodIdItem.ITEM_SIZE; }
public int getStringIdItemOffset(int stringIndex) { if (stringIndex < 0 || stringIndex >= stringCount) { throw new InvalidItemIndex(stringIndex, "String index out of bounds: %d", stringIndex); } return stringStartOffset + stringIndex*StringIdItem.ITEM_SIZE; }
public int getStringIdItemOffset(int stringIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return stringStartOffset + stringIndex*StringIdItem.ITEM_SIZE; } if (stringIndex < 0 || stringIndex >= stringCount) { throw new InvalidItemIndex(stringIndex, "String index out of bounds: %d", stringIndex); } return stringStartOffset + stringIndex*StringIdItem.ITEM_SIZE; }
private String writeInvalidItemIndex(InvalidItemIndex ex, int type, IndentingWriter writer) throws IOException { writer.write("#"); writer.write(ex.getMessage()); writer.write("\n"); return String.format("%s@%d", ReferenceType.toString(type), ex.getInvalidIndex()); }
public int getClassDefItemOffset(int classIndex) { if (classIndex < 0 || classIndex >= classCount) { throw new InvalidItemIndex(classIndex, "Class index out of bounds: %d", classIndex); } return classStartOffset + classIndex*ClassDefItem.ITEM_SIZE; }
public int getProtoIdItemOffset(int protoIndex) { if(this.type == DexFileDataType.MEMORYTYPE){ return protoStartOffset + protoIndex*ProtoIdItem.ITEM_SIZE; } if (protoIndex < 0 || protoIndex >= protoCount) { throw new InvalidItemIndex(protoIndex, "Proto index out of bounds: %d", protoIndex); } return protoStartOffset + protoIndex*ProtoIdItem.ITEM_SIZE; }
public int getMethodHandleItemOffset(int methodHandleIndex) { MapItem mapItem = getMapItemForSection(ItemType.METHOD_HANDLE_ITEM); if (mapItem == null || methodHandleIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(methodHandleIndex , "Method handle index out of bounds: %d", methodHandleIndex); } return mapItem.getOffset() + methodHandleIndex * MethodHandleItem.ITEM_SIZE; }