Java 类java.lang.Error 实例源码

项目:Enigma    文件:SourceIndexBehaviorVisitor.java   
@Override
public Void visitMemberReferenceExpression(MemberReferenceExpression node, SourceIndex index) {
    MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
    if (ref != null) {
        // make sure this is actually a field
        if (ref.getErasedSignature().indexOf('(') >= 0) {
            throw new Error("Expected a field here! got " + ref);
        }

        ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName());
        FieldEntry fieldEntry = new FieldEntry(classEntry, ref.getName(), new Type(ref.getErasedSignature()));
        index.addReference(node.getMemberNameToken(), fieldEntry, this.behaviorEntry);
    }

    return recurse(node, index);
}
项目:vespa    文件:MessageBusAsyncSession.java   
/**
 * A convenience method for assigning the internal trace level and route string to a message before sending it
 * through the internal mbus session object.
 *
 * @param msg The message to send.
 * @return The document api result object.
 */
public Result send(Message msg) {
    try {
        long reqId = requestId.incrementAndGet();
        msg.setContext(reqId);
        msg.getTrace().setLevel(traceLevel);
        if (route != null) {
            return toResult(reqId, session.send(msg, route, true));
        } else {
            return toResult(reqId, session.send(msg));
        }
    } catch (Exception e) {
        return new Result(Result.ResultType.FATAL_ERROR, new Error(e.getMessage(), e));
    }
}
项目:vespa    文件:MessageBusAsyncSession.java   
private static Result toResult(long reqId, com.yahoo.messagebus.Result mbusResult) {
    if (mbusResult.isAccepted()) {
        return new Result(reqId);
    }
    return new Result(
            messageBusErrorToResultType(mbusResult.getError().getCode()),
            new Error(mbusResult.getError().getMessage() + " (" + mbusResult.getError().getCode() + ")"));
}
项目:opensmpp    文件:TLVOctets.java   
protected void setValueData(ByteBuffer buffer) throws TLVException {
    checkLength(buffer);
    if (buffer != null) {
        try {
            value = buffer.removeBuffer(buffer.length());
        } catch (NotEnoughDataInByteBufferException e) {
            throw new Error(
                "Removing buf.length() data from ByteBuffer buf "
                    + "reported too little data in buf, which shouldn't happen.");
        }
    } else {
        value = null;
    }
    markValueSet();
}
项目:opensmpp    文件:TLVOctets.java   
public void setValue(ByteBuffer p_value) {
    if (p_value != null) {
        try {
            value = p_value.removeBuffer(p_value.length());
        } catch (NotEnoughDataInByteBufferException e) {
            throw new Error(
                "Removing buf.length() data from ByteBuffer buf "
                    + "reported too little data in buf, which shouldn't happen.");
        }
    } else {
        value = null;
    }
    markValueSet();
}