当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionWithContext类代码示例

本文整理汇总了Java中org.jf.util.ExceptionWithContext的典型用法代码示例。如果您正苦于以下问题:Java ExceptionWithContext类的具体用法?Java ExceptionWithContext怎么用?Java ExceptionWithContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionWithContext类属于org.jf.util包,在下文中一共展示了ExceptionWithContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: build

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
    int codeAddress = debugItem.getCodeAddress();
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return new BeginEpilogueMethodItem(codeAddress, -4);
        case DebugItemType.PROLOGUE_END:
            return new EndPrologueMethodItem(codeAddress, -4);
        case DebugItemType.SET_SOURCE_FILE:
            return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:22,代码来源:DebugMethodItem.java

示例2: of

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static ImmutableDebugItem of(DebugItem debugItem) {
    if (debugItem instanceof ImmutableDebugItem) {
        return (ImmutableDebugItem)debugItem;
    }
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return ImmutableStartLocal.of((StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return ImmutableEndLocal.of((EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return ImmutableRestartLocal.of((RestartLocal)debugItem);
        case DebugItemType.PROLOGUE_END:
            return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
        case DebugItemType.SET_SOURCE_FILE:
            return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return ImmutableLineNumber.of((LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:25,代码来源:ImmutableDebugItem.java

示例3: defaultValueForType

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static EncodedValue defaultValueForType(String type) {
    switch (type.charAt(0)) {
        case 'Z':
            return ImmutableBooleanEncodedValue.FALSE_VALUE;
        case 'B':
            return new ImmutableByteEncodedValue((byte)0);
        case 'S':
            return new ImmutableShortEncodedValue((short)0);
        case 'C':
            return new ImmutableCharEncodedValue((char)0);
        case 'I':
            return new ImmutableIntEncodedValue(0);
        case 'J':
            return new ImmutableLongEncodedValue(0);
        case 'F':
            return new ImmutableFloatEncodedValue(0);
        case 'D':
            return new ImmutableDoubleEncodedValue(0);
        case 'L':
        case '[':
            return ImmutableNullEncodedValue.INSTANCE;
        default:
            throw new ExceptionWithContext("Unrecognized type: %s", type);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:ImmutableEncodedValueFactory.java

示例4: of

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static ImmutableReference of(Reference reference) {
    if (reference instanceof StringReference) {
        return ImmutableStringReference.of((StringReference)reference);
    }
    if (reference instanceof TypeReference) {
        return ImmutableTypeReference.of((TypeReference)reference);
    }
    if (reference instanceof FieldReference) {
        return ImmutableFieldReference.of((FieldReference)reference);
    }
    if (reference instanceof MethodReference) {
        return ImmutableMethodReference.of((MethodReference)reference);
    }
    throw new ExceptionWithContext("Invalid reference type");
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:17,代码来源:ImmutableReferenceFactory.java

示例5: writeLineNumber

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public void writeLineNumber(int codeAddress, int lineNumber) throws IOException {
    int lineDelta = lineNumber - currentLine;
    int addressDelta = codeAddress - currentAddress;

    if (addressDelta < 0) {
        throw new ExceptionWithContext("debug info items must have non-decreasing code addresses");
    }
    if (lineDelta < -4 || lineDelta > 10) {
        writeAdvanceLine(lineNumber);
        lineDelta = 0;
    } // no else is intentional here. we might need to advance the PC as well as the line
    if ((lineDelta < 2 && addressDelta > 16) || (lineDelta > 1 && addressDelta > 15)) {
        writeAdvancePC(codeAddress);
        addressDelta = 0;
    }

    // we need to emit the special opcode even if both lineDelta and addressDelta are 0, otherwise a positions
    // entry isn't generated
    writeSpecialOpcode(lineDelta, addressDelta);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:21,代码来源:DebugWriter.java

示例6: defaultValueForType

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static BuilderEncodedValue defaultValueForType(String type) {
    switch (type.charAt(0)) {
        case 'Z':
            return BuilderBooleanEncodedValue.FALSE_VALUE;
        case 'B':
            return new BuilderByteEncodedValue((byte)0);
        case 'S':
            return new BuilderShortEncodedValue((short)0);
        case 'C':
            return new BuilderCharEncodedValue((char)0);
        case 'I':
            return new BuilderIntEncodedValue(0);
        case 'J':
            return new BuilderLongEncodedValue(0);
        case 'F':
            return new BuilderFloatEncodedValue(0);
        case 'D':
            return new BuilderDoubleEncodedValue(0);
        case 'L':
        case '[':
            return BuilderNullEncodedValue.INSTANCE;
        default:
            throw new ExceptionWithContext("Unrecognized type: %s", type);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:BuilderEncodedValues.java

示例7: ArrayProto

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public ArrayProto(@Nonnull ClassPath classPath, @Nonnull String type) {
    this.classPath = classPath;
    int i=0;
    while (type.charAt(i) == '[') {
        i++;
        if (i == type.length()) {
            throw new ExceptionWithContext("Invalid array type: %s", type);
        }
    }

    if (i == 0) {
        throw new ExceptionWithContext("Invalid array type: %s", type);
    }

    dimensions = i;
    elementType = type.substring(i);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:18,代码来源:ArrayProto.java

示例8: getWideRegisterType

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static RegisterType getWideRegisterType(@Nonnull CharSequence type, boolean firstRegister) {
    switch (type.charAt(0)) {
        case 'J':
            if (firstRegister) {
                return getRegisterType(LONG_LO, null);
            } else {
                return getRegisterType(LONG_HI, null);
            }
        case 'D':
            if (firstRegister) {
                return getRegisterType(DOUBLE_LO, null);
            } else {
                return getRegisterType(DOUBLE_HI, null);
            }
        default:
            throw new ExceptionWithContext("Cannot use this method for narrow register type: %s", type);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:20,代码来源:RegisterType.java

示例9: getRegisterType

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static RegisterType getRegisterType(@Nonnull ClassPath classPath, @Nonnull CharSequence type) {
    switch (type.charAt(0)) {
        case 'Z':
            return BOOLEAN_TYPE;
        case 'B':
            return BYTE_TYPE;
        case 'S':
            return SHORT_TYPE;
        case 'C':
            return CHAR_TYPE;
        case 'I':
            return INTEGER_TYPE;
        case 'F':
            return FLOAT_TYPE;
        case 'J':
            return LONG_LO_TYPE;
        case 'D':
            return DOUBLE_LO_TYPE;
        case 'L':
        case '[':
            return getRegisterType(REFERENCE, classPath.getClass(type));
        default:
            throw new ExceptionWithContext("Invalid type: " + type);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:RegisterType.java

示例10: skipUleb128

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public void skipUleb128() {
    int end = offset;
    byte currentByteValue;
    byte[] buf = dexBuf.buf;

    currentByteValue = buf[end++];
    if (currentByteValue < 0) { // if the MSB is set
        currentByteValue = buf[end++];
        if (currentByteValue < 0) { // if the MSB is set
            currentByteValue = buf[end++];
            if (currentByteValue < 0) { // if the MSB is set
                currentByteValue = buf[end++];
                if (currentByteValue < 0) { // if the MSB is set
                    currentByteValue = buf[end++];
                    if (currentByteValue < 0) {
                        throw new ExceptionWithContext(
                                "Invalid uleb128 integer encountered at offset 0x%x", offset);
                    }
                }
            }
        }
    }

    offset = end;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:26,代码来源:BaseDexReader.java

示例11: verifyMagicAndByteOrder

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
private static void verifyMagicAndByteOrder(@Nonnull byte[] buf, int offset) {
    if (!HeaderItem.verifyMagic(buf, offset)) {
        StringBuilder sb = new StringBuilder("Invalid magic value:");
        for (int i=0; i<8; i++) {
            sb.append(String.format(" %02x", buf[i]));
        }
        throw new NotADexFile(sb.toString());
    }

    int endian = HeaderItem.getEndian(buf, offset);
    if (endian == HeaderItem.BIG_ENDIAN_TAG) {
        throw new ExceptionWithContext("Big endian dex files are not currently supported");
    }

    if (endian != HeaderItem.LITTLE_ENDIAN_TAG) {
        throw new ExceptionWithContext("Invalid endian tag: 0x%x", endian);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:DexBackedDexFile.java

示例12: of

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static ImmutableDebugItem of(DebugItem debugItem) {
    if (debugItem instanceof ImmutableDebugItem) {
        return (ImmutableDebugItem)debugItem;
    }
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return ImmutableStartLocal.of((StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return ImmutableEndLocal.of((EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return ImmutableRestartLocal.of((RestartLocal)debugItem);
        case DebugItemType.PROLOGUE_END:
            return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
        case DebugItemType.SET_SOURCE_FILE:
            return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return ImmutableLineNumber.of((LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:ImmutableDebugItem.java

示例13: of

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static ImmutableReference of(Reference reference) {
    if (reference instanceof StringReference) {
        return ImmutableStringReference.of((StringReference)reference);
    }
    if (reference instanceof TypeReference) {
        return ImmutableTypeReference.of((TypeReference)reference);
    }
    if (reference instanceof FieldReference) {
        return ImmutableFieldReference.of((FieldReference)reference);
    }
    if (reference instanceof MethodReference) {
        return ImmutableMethodReference.of((MethodReference)reference);
    }
    if (reference instanceof MethodProtoReference) {
        return ImmutableMethodProtoReference.of((MethodProtoReference) reference);
    }
    throw new ExceptionWithContext("Invalid reference type");
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:ImmutableReferenceFactory.java

示例14: getReferenceIndex

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
private int getReferenceIndex(int referenceType, Reference reference) {
    switch (referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey) reference);
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey) reference);
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef) reference);
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef) reference);
        case ReferenceType.METHOD_PROTO:
            return protoSection.getItemIndex((ProtoRefKey) reference);
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",  referenceType);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:InstructionWriter.java

示例15: defaultValueForType

import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static BuilderEncodedValue defaultValueForType(String type) {
    switch (type.charAt(0)) {
        case 'Z':
            return BuilderBooleanEncodedValue.FALSE_VALUE;
        case 'B':
            return new BuilderByteEncodedValue((byte)0);
        case 'S':
            return new BuilderShortEncodedValue((short)0);
        case 'C':
            return new BuilderCharEncodedValue((char)0);
        case 'I':
            return new BuilderIntEncodedValue(0);
        case 'J':
            return new BuilderLongEncodedValue(0);
        case 'F':
            return new BuilderFloatEncodedValue(0);
        case 'D':
            return new BuilderDoubleEncodedValue(0);
        case 'L':
        case '[':
            return BuilderNullEncodedValue.INSTANCE;
        default:
            throw new ExceptionWithContext("Unrecognized type: %s", type);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:26,代码来源:BuilderEncodedValues.java


注:本文中的org.jf.util.ExceptionWithContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。