Examples of ExceptionWithContext


Examples of org.jf.util.ExceptionWithContext

                break;
            case ValueType.TYPE:
                writer.writeType(((TypeEncodedValue)encodedValue).getValue());
                break;
            default:
                throw new ExceptionWithContext("Unrecognized value type: %d", encodedValue.getValueType());
        }
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

    }

    @Override public int getItemIndex(@Nonnull CharSequence key) {
        Integer index = internedItems.get(key.toString());
        if (index == null) {
            throw new ExceptionWithContext("Item not found.: %s", key.toString());
        }
        return index;
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

            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());
        }
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

    protected boolean vtableFullyResolved = true;
    protected boolean interfacesFullyResolved = true;

    public ClassProto(@Nonnull ClassPath classPath, @Nonnull String type) {
        if (type.charAt(0) != 'L') {
            throw new ExceptionWithContext("Cannot construct ClassProto for non reference type: %s", type);
        }
        this.classPath = classPath;
        this.type = type;
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

    @Nonnull @Override public String getType() { return type; }
    @Override public boolean isInterface() { return false; }
    @Override public boolean implementsInterface(@Nonnull String iface) { return false; }
    @Nullable @Override public String getSuperclass() { return null; }
    @Nonnull @Override public TypeProto getCommonSuperclass(@Nonnull TypeProto other) {
        throw new ExceptionWithContext("Cannot call getCommonSuperclass on PrimitiveProto");
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

        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);
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

                break;
            case ValueType.TYPE:
                writer.writeType(((BuilderTypeEncodedValue)encodedValue).typeReference);
                break;
            default:
                throw new ExceptionWithContext("Unrecognized value type: %d", encodedValue.getValueType());
        }
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

        // if it's a dalvik-cache entry, grab the name of the jar/apk
        if (entryName.endsWith("@classes.dex")) {
            Matcher m = dalvikCacheOdexPattern.matcher(entryName);

            if (!m.find()) {
                throw new ExceptionWithContext(String.format("Cannot parse dependency value %s", bootClassPathEntry));
            }

            entryName = m.group(1);
        }

        int extIndex = entryName.lastIndexOf(".");

        String baseEntryName;
        if (extIndex == -1) {
            baseEntryName = entryName;
        } else {
            baseEntryName = entryName.substring(0, extIndex);
        }

        for (String classPathDir: classPathDirs) {
            for (String ext: new String[]{"", ".odex", ".jar", ".apk", ".zip"}) {
                File file = new File(classPathDir, baseEntryName + ext);

                if (file.exists() && file.isFile()) {
                    if (!file.canRead()) {
                        System.err.println(String.format(
                                "warning: cannot open %s for reading. Will continue looking.", file.getPath()));
                    } else {
                        try {
                            return DexFileFactory.loadDexFile(file, api);
                        } catch (DexFileFactory.NoClassesDexException ex) {
                            // ignore and continue
                        } catch (Exception ex) {
                            throw ExceptionWithContext.withContext(ex,
                                    "Error while reading boot class path entry \"%s\"", bootClassPathEntry);
                        }
                    }
                }
            }
        }
        throw new ExceptionWithContext("Cannot locate boot class path file %s", bootClassPathEntry);
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

            return ImmutableFieldReference.of((FieldReference)reference);
        }
        if (reference instanceof MethodReference) {
            return ImmutableMethodReference.of((MethodReference)reference);
        }
        throw new ExceptionWithContext("Invalid reference type");
    }
View Full Code Here

Examples of org.jf.util.ExceptionWithContext

            case ReferenceType.FIELD:
                return ImmutableFieldReference.of((FieldReference)reference);
            case ReferenceType.METHOD:
                return ImmutableMethodReference.of((MethodReference)reference);
        }
        throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.