Java 类com.sun.jdi.InternalException 实例源码

项目:incubator-netbeans    文件:JPDAClassTypeImpl.java   
@Override
public boolean isInstanceOf(String className) {
    List<ReferenceType> classTypes;
    try {
        classTypes = VirtualMachineWrapper.classesByName(MirrorWrapper.virtualMachine(classType), className);
    } catch (InternalExceptionWrapper | VMDisconnectedExceptionWrapper ex) {
        return false;
    }
    for (ReferenceType rt : classTypes) {
        try {
            if (EvaluatorVisitor.instanceOf(classType, rt)) {
                return true;
            }
        } catch (VMDisconnectedException vmdex) {
            return false;
        } catch (InternalException iex) {
            // procceed
        }
    }
    return false;
}
项目:openjdk-jdk10    文件:PacketStream.java   
void writeLocation(Location location) {
    ReferenceTypeImpl refType = (ReferenceTypeImpl)location.declaringType();
    byte tag;
    if (refType instanceof ClassType) {
        tag = JDWP.TypeTag.CLASS;
    } else if (refType instanceof InterfaceType) {
        // It's possible to have executable code in an interface
        tag = JDWP.TypeTag.INTERFACE;
    } else {
        throw new InternalException("Invalid Location");
    }
    writeByte(tag);
    writeClassRef(refType.ref());
    writeMethodRef(((MethodImpl)location.method()).ref());
    writeLong(location.codeIndex());
}
项目:openjdk-jdk10    文件:EventSetImpl.java   
public void resume() {
    switch (suspendPolicy()) {
        case EventRequest.SUSPEND_ALL:
            vm.resume();
            break;
        case EventRequest.SUSPEND_EVENT_THREAD:
            ThreadReference thread = eventThread();
            if (thread == null) {
                throw new InternalException("Inconsistent suspend policy");
            }
            thread.resume();
            break;
        case EventRequest.SUSPEND_NONE:
            // Do nothing
            break;
        default:
            throw new InternalException("Invalid suspend policy");
    }
}
项目:openjdk-jdk10    文件:PrimitiveValueImpl.java   
ValueImpl convertForAssignmentTo(ValueContainer destination)
    throws InvalidTypeException
{
    /*
     * TO DO: Centralize JNI signature knowledge
     */
    if (destination.signature().length() > 1) {
        throw new InvalidTypeException("Can't assign primitive value to object");
    }

    if ((destination.signature().charAt(0) == 'Z') &&
        (type().signature().charAt(0) != 'Z')) {
        throw new InvalidTypeException("Can't assign non-boolean value to a boolean");
    }

    if ((destination.signature().charAt(0) != 'Z') &&
        (type().signature().charAt(0) == 'Z')) {
        throw new InvalidTypeException("Can't assign boolean value to an non-boolean");
    }

    if ("void".equals(destination.typeName())) {
        throw new InvalidTypeException("Can't assign primitive value to a void");
    }

    try {
        PrimitiveTypeImpl primitiveType = (PrimitiveTypeImpl)destination.type();
        return (ValueImpl)(primitiveType.convert(this));
    } catch (ClassNotLoadedException e) {
        throw new InternalException("Signature and type inconsistent for: " +
                                    destination.typeName());
    }
}
项目:openjdk-jdk10    文件:VirtualMachineImpl.java   
synchronized void removeObjectMirror(ObjectReferenceImpl object) {
    // Handle any queue elements that are not strongly reachable
    processQueue();

    SoftObjectReference ref = objectsByID.remove(object.ref());
    if (ref != null) {
        batchForDispose(ref);
    } else {
        /*
         * If there's a live ObjectReference about, it better be part
         * of the cache.
         */
        throw new InternalException("ObjectReference " + object.ref() +
                                    " not found in object cache");
    }
}
项目:OLD-OpenJDK8    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:tools-idea    文件:DebugProcessEvents.java   
public String getEventText(Pair<Breakpoint, Event> descriptor) {
  String text = "";
  final Event event = descriptor.getSecond();
  final Breakpoint breakpoint = descriptor.getFirst();
  if (event instanceof LocatableEvent) {
    if (breakpoint instanceof LineBreakpoint && !((LineBreakpoint)breakpoint).isVisible()) {
      text = DebuggerBundle.message("status.stopped.at.cursor");
    }
    else {
      try {
        text = breakpoint != null? breakpoint.getEventMessage(((LocatableEvent)event)) : DebuggerBundle.message("status.generic.breakpoint.reached");
      }
      catch (InternalException e) {
        text = DebuggerBundle.message("status.generic.breakpoint.reached");
      }
    }
  }
  else if (event instanceof VMStartEvent) {
    text = DebuggerBundle.message("status.process.started");
  }
  else if (event instanceof VMDeathEvent) {
    text = DebuggerBundle.message("status.process.terminated");
  }
  else if (event instanceof VMDisconnectEvent) {
    final RemoteConnection connection = getConnection();
    final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
    final String transportName = DebuggerBundle.getTransportName(connection);
    text = DebuggerBundle.message("status.disconnected", addressDisplayName, transportName);
  }
  return text;
}
项目:OpenJSharp    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:MaxSim    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:jdk8u-jdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:openjdk-jdk10    文件:MonitorInfoImpl.java   
public boolean threadResumable(ThreadAction action) {
    synchronized (vm.state()) {
        if (isValid) {
            isValid = false;
            return false;   /* remove this stack frame as a listener */
        } else {
            throw new InternalException(
                              "Invalid stack frame thread listener");
        }
    }
}
项目:openjdk-jdk10    文件:LocalVariableImpl.java   
public boolean isArgument() {
    try {
        MethodImpl method = (MethodImpl)scopeStart.method();
        return (slot < method.argSlotCount());
    } catch (AbsentInformationException e) {
        // If this variable object exists, there shouldn't be absent info
        throw new InternalException();
    }
}
项目:openjdk-jdk10    文件:PacketStream.java   
void waitForReply() throws JDWPException {
    if (!isCommitted) {
        throw new InternalException("waitForReply without send");
    }

    vm.waitForTargetReply(pkt);

    if (pkt.errorCode != Packet.ReplyNoError) {
        throw new JDWPException(pkt.errorCode);
    }
}
项目:openjdk-jdk10    文件:PacketStream.java   
void writeString(String string) {
    try {
        byte[] stringBytes = string.getBytes("UTF8");
        writeInt(stringBytes.length);
        writeByteArray(stringBytes);
    } catch (java.io.UnsupportedEncodingException e) {
        throw new InternalException("Cannot convert string to UTF8 bytes");
    }
}
项目:openjdk-jdk10    文件:JDWPException.java   
RuntimeException toJDIException() {
    switch (errorCode) {
        case JDWP.Error.INVALID_OBJECT:
            return new ObjectCollectedException();
        case JDWP.Error.INVALID_MODULE:
            return new InvalidModuleException();
        case JDWP.Error.VM_DEAD:
            return new VMDisconnectedException();
        case JDWP.Error.OUT_OF_MEMORY:
            return new VMOutOfMemoryException();
        case JDWP.Error.CLASS_NOT_PREPARED:
            return new ClassNotPreparedException();
        case JDWP.Error.INVALID_FRAMEID:
        case JDWP.Error.NOT_CURRENT_FRAME:
            return new InvalidStackFrameException();
        case JDWP.Error.NOT_IMPLEMENTED:
            return new UnsupportedOperationException();
        case JDWP.Error.INVALID_INDEX:
        case JDWP.Error.INVALID_LENGTH:
            return new IndexOutOfBoundsException();
        case JDWP.Error.TYPE_MISMATCH:
            return new InconsistentDebugInfoException();
        case JDWP.Error.INVALID_THREAD:
            return new IllegalThreadStateException();
        default:
            return new InternalException("Unexpected JDWP Error: " + errorCode, errorCode);
    }
}
项目:openjdk-jdk10    文件:EventSetImpl.java   
/**
 * Constructor for special events like VM disconnected
 */
EventSetImpl(VirtualMachine aVm, byte eventCmd) {
    this(aVm, null);
    suspendPolicy = JDWP.SuspendPolicy.NONE;
    switch (eventCmd) {
        case JDWP.EventKind.VM_DISCONNECTED:
            addEvent(new VMDisconnectEventImpl());
            break;

        default:
            throw new InternalException("Bad singleton event code");
    }
}
项目:openjdk-jdk10    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:openjdk-jdk10    文件:StackFrameImpl.java   
public boolean threadResumable(ThreadAction action) {
    synchronized (vm.state()) {
        if (isValid) {
            isValid = false;
            return false;   /* remove this stack frame as a listener */
        } else {
            throw new InternalException(
                              "Invalid stack frame thread listener");
        }
    }
}
项目:openjdk9    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:openjdk9    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:jdk8u_jdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:intellij-ce-playground    文件:DebugProcessEvents.java   
public String getEventText(Pair<Breakpoint, Event> descriptor) {
  String text = "";
  final Event event = descriptor.getSecond();
  final Breakpoint breakpoint = descriptor.getFirst();
  if (event instanceof LocatableEvent) {
    if (breakpoint instanceof LineBreakpoint && !((LineBreakpoint)breakpoint).isVisible()) {
      text = DebuggerBundle.message("status.stopped.at.cursor");
    }
    else {
      try {
        text = breakpoint != null? breakpoint.getEventMessage(((LocatableEvent)event)) : DebuggerBundle.message("status.generic.breakpoint.reached");
      }
      catch (InternalException e) {
        text = DebuggerBundle.message("status.generic.breakpoint.reached");
      }
    }
  }
  else if (event instanceof VMStartEvent) {
    text = DebuggerBundle.message("status.process.started");
  }
  else if (event instanceof VMDeathEvent) {
    text = DebuggerBundle.message("status.process.terminated");
  }
  else if (event instanceof VMDisconnectEvent) {
    final RemoteConnection connection = getConnection();
    final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
    final String transportName = DebuggerBundle.getTransportName(connection);
    text = DebuggerBundle.message("status.disconnected", addressDisplayName, transportName);
  }
  return text;
}
项目:infobip-open-jdk-8    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:infobip-open-jdk-8    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:jdk8u-dev-jdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:jdk7-jdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:openjdk-source-code-learn    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:openjdk-source-code-learn    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:OLD-OpenJDK8    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:openjdk-jdk7u-jdk    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:openjdk-icedtea7    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw (InternalException) new InternalException().initCause(e);
    }
}
项目:openjdk-icedtea7    文件:ConnectorImpl.java   
public Object clone() {
    try {
        return super.clone();
    } catch (CloneNotSupportedException e) {
        // Object should always support clone
        throw new InternalException();
    }
}
项目:openjdk-jdk10    文件:ThreadReferenceImpl.java   
/**
 * Private version of frames() allows "-1" to specify all
 * remaining frames.
 */
synchronized private List<StackFrame> privateFrames(int start, int length)
                          throws IncompatibleThreadStateException  {

    // Lock must be held while creating stack frames so if that two threads
    // do this at the same time, one won't clobber the subset created by the other.
    LocalCache snapshot = localCache;
    try {
        if (snapshot.frames == null || !isSubrange(snapshot, start, length)) {
            JDWP.ThreadReference.Frames.Frame[] jdwpFrames
                = JDWP.ThreadReference.Frames.
                process(vm, this, start, length).frames;
            int count = jdwpFrames.length;
            snapshot.frames = new ArrayList<>(count);

            for (int i = 0; i<count; i++) {
                if (jdwpFrames[i].location == null) {
                    throw new InternalException("Invalid frame location");
                }
                StackFrame frame = new StackFrameImpl(vm, this,
                                                      jdwpFrames[i].frameID,
                                                      jdwpFrames[i].location);
                // Add to the frame list
                snapshot.frames.add(frame);
            }
            snapshot.framesStart = start;
            snapshot.framesLength = length;
            return Collections.unmodifiableList(snapshot.frames);
        } else {
            int fromIndex = start - snapshot.framesStart;
            int toIndex;
            if (length == -1) {
                toIndex = snapshot.frames.size() - fromIndex;
            } else {
                toIndex = fromIndex + length;
            }
            return Collections.unmodifiableList(snapshot.frames.subList(fromIndex, toIndex));
        }
    } catch (JDWPException exc) {
        switch (exc.errorCode()) {
        case JDWP.Error.THREAD_NOT_SUSPENDED:
        case JDWP.Error.INVALID_THREAD:   /* zombie */
            throw new IncompatibleThreadStateException();
        default:
            throw exc.toJDIException();
        }
    }
}
项目:openjdk-jdk10    文件:EventSetImpl.java   
synchronized void build() {
    if (pkt == null) {
        return;
    }
    PacketStream ps = new PacketStream(vm, pkt);
    JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
    suspendPolicy = compEvt.suspendPolicy;
    if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
        switch(suspendPolicy) {
            case JDWP.SuspendPolicy.ALL:
                vm.printTrace("EventSet: SUSPEND_ALL");
                break;

            case JDWP.SuspendPolicy.EVENT_THREAD:
                vm.printTrace("EventSet: SUSPEND_EVENT_THREAD");
                break;

            case JDWP.SuspendPolicy.NONE:
                vm.printTrace("EventSet: SUSPEND_NONE");
                break;
        }
    }

    ThreadReference fix6485605 = null;
    for (int i = 0; i < compEvt.events.length; i++) {
        EventImpl evt = createEvent(compEvt.events[i]);
        if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
            try {
                vm.printTrace("Event: " + evt);
            } catch (VMDisconnectedException ee) {
                // ignore - see bug 6502716
            }
        }

        switch (evt.destination()) {
            case UNKNOWN_EVENT:
                // Ignore disabled, deleted, unknown events, but
                // save the thread if there is one since we might
                // have to resume it.  Note that events for different
                // threads can't be in the same event set.
                if (evt instanceof ThreadedEventImpl &&
                    suspendPolicy == JDWP.SuspendPolicy.EVENT_THREAD) {
                    fix6485605 = ((ThreadedEventImpl)evt).thread();
                }
                continue;
            case CLIENT_EVENT:
                addEvent(evt);
                break;
            case INTERNAL_EVENT:
                if (internalEventSet == null) {
                    internalEventSet = new EventSetImpl(this.vm, null);
                }
                internalEventSet.addEvent(evt);
                break;
            default:
                throw new InternalException("Invalid event destination");
        }
    }
    pkt = null; // No longer needed - free it up

    // Avoid hangs described in 6296125, 6293795
    if (super.size() == 0) {
        // This set has no client events.  If we don't do
        // needed resumes, no one else is going to.
        if (suspendPolicy == JDWP.SuspendPolicy.ALL) {
            vm.resume();
        } else if (suspendPolicy == JDWP.SuspendPolicy.EVENT_THREAD) {
            // See bug 6485605.
            if (fix6485605 != null) {
                fix6485605.resume();
            } else {
                // apparently, there is nothing to resume.
            }
        }
        suspendPolicy = JDWP.SuspendPolicy.NONE;

    }

}
项目:openjdk-jdk10    文件:AbstractLauncher.java   
String[] tokenizeCommand(String command, char quote) {
    String quoteStr = String.valueOf(quote); // easier to deal with

    /*
     * Tokenize the command, respecting the given quote character.
     */
    StringTokenizer tokenizer = new StringTokenizer(command,
                                                    quote + " \t\r\n\f",
                                                    true);
    String quoted = null;
    String pending = null;
    List<String> tokenList = new ArrayList<>();
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        if (quoted != null) {
            if (token.equals(quoteStr)) {
                tokenList.add(quoted);
                quoted = null;
            } else {
                quoted += token;
            }
        } else if (pending != null) {
            if (token.equals(quoteStr)) {
                quoted = pending;
            } else if ((token.length() == 1) &&
                       Character.isWhitespace(token.charAt(0))) {
                tokenList.add(pending);
            } else {
                throw new InternalException("Unexpected token: " + token);
            }
            pending = null;
        } else {
            if (token.equals(quoteStr)) {
                quoted = "";
            } else if ((token.length() == 1) &&
                       Character.isWhitespace(token.charAt(0))) {
                // continue
            } else {
                pending = token;
            }
        }
    }

    /*
     * Add final token.
     */
    if (pending != null) {
        tokenList.add(pending);
    }

    /*
     * An unclosed quote at the end of the command. Do an
     * implicit end quote.
     */
    if (quoted != null) {
        tokenList.add(quoted);
    }

    String[] tokenArray = new String[tokenList.size()];
    for (int i = 0; i < tokenList.size(); i++) {
        tokenArray[i] = tokenList.get(i);
    }
    return tokenArray;
}
项目:openjdk-jdk10    文件:StackFrameImpl.java   
public List<Value> getArgumentValues() {
    validateStackFrame();
    MethodImpl mmm = (MethodImpl)location.method();
    List<String> argSigs = mmm.argumentSignatures();
    int count = argSigs.size();
    JDWP.StackFrame.GetValues.SlotInfo[] slots =
                       new JDWP.StackFrame.GetValues.SlotInfo[count];

    int slot;
    if (mmm.isStatic()) {
        slot = 0;
    } else {
        slot = 1;
    }
    for (int ii = 0; ii < count; ++ii) {
        char sigChar = argSigs.get(ii).charAt(0);
        slots[ii] = new JDWP.StackFrame.GetValues.SlotInfo(slot++,(byte)sigChar);
        if (sigChar == 'J' || sigChar == 'D') {
            slot++;
        }
    }

    PacketStream ps;

    /* protect against defunct frame id */
    synchronized (vm.state()) {
        validateStackFrame();
        ps = JDWP.StackFrame.GetValues.enqueueCommand(vm, thread, id, slots);
    }

    ValueImpl[] values;
    try {
        values = JDWP.StackFrame.GetValues.waitForReply(vm, ps).values;
    } catch (JDWPException exc) {
        switch (exc.errorCode()) {
            case JDWP.Error.INVALID_FRAMEID:
            case JDWP.Error.THREAD_NOT_SUSPENDED:
            case JDWP.Error.INVALID_THREAD:
                throw new InvalidStackFrameException();
            default:
                throw exc.toJDIException();
        }
    }

    if (count != values.length) {
        throw new InternalException(
                  "Wrong number of values returned from target VM");
    }
    return Arrays.asList((Value[])values);
}
项目:openjdk-jdk10    文件:VirtualMachineImpl.java   
private synchronized ReferenceTypeImpl addReferenceType(long id,
                                                        int tag,
                                                        String signature) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl type = null;
    switch(tag) {
        case JDWP.TypeTag.CLASS:
            type = new ClassTypeImpl(vm, id);
            break;
        case JDWP.TypeTag.INTERFACE:
            type = new InterfaceTypeImpl(vm, id);
            break;
        case JDWP.TypeTag.ARRAY:
            type = new ArrayTypeImpl(vm, id);
            break;
        default:
            throw new InternalException("Invalid reference type tag");
    }

    /*
     * If a signature was specified, make sure to set it ASAP, to
     * prevent any needless JDWP command to retrieve it. (for example,
     * typesBySignature.add needs the signature, to maintain proper
     * ordering.
     */
    if (signature != null) {
        type.setSignature(signature);
    }

    typesByID.put(id, type);
    typesBySignature.add(type);

    if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
       vm.printTrace("Caching new ReferenceType, sig=" + signature +
                     ", id=" + id);
    }

    return type;
}
项目:openjdk-jdk10    文件:NonConcreteMethodImpl.java   
int argSlotCount() throws AbsentInformationException {
    throw new InternalException("should not get here");
}