1 11 package org.eclipse.jdi.internal.spy; 12 13 14 import java.io.DataInputStream ; 15 import java.io.DataOutputStream ; 16 import java.io.IOException ; 17 import java.lang.reflect.Field ; 18 import java.lang.reflect.Modifier ; 19 import java.util.HashMap ; 20 import java.util.Map ; 21 22 27 public class JdwpReplyPacket extends JdwpPacket { 28 29 public static final short NONE = 0; 30 public static final short INVALID_THREAD = 10; 31 public static final short INVALID_THREAD_GROUP = 11; 32 public static final short INVALID_PRIORITY = 12; 33 public static final short THREAD_NOT_SUSPENDED = 13; 34 public static final short THREAD_SUSPENDED = 14; 35 public static final short INVALID_OBJECT = 20; 36 public static final short INVALID_CLASS = 21; 37 public static final short CLASS_NOT_PREPARED = 22; 38 public static final short INVALID_METHODID = 23; 39 public static final short INVALID_LOCATION = 24; 40 public static final short INVALID_FIELDID = 25; 41 public static final short INVALID_FRAMEID = 30; 42 public static final short NO_MORE_FRAMES = 31; 43 public static final short OPAQUE_FRAME = 32; 44 public static final short NOT_CURRENT_FRAME = 33; 45 public static final short TYPE_MISMATCH = 34; 46 public static final short INVALID_SLOT = 35; 47 public static final short DUPLICATE = 40; 48 public static final short NOT_FOUND = 41; 49 public static final short INVALID_MONITOR = 50; 50 public static final short NOT_MONITOR_OWNER = 51; 51 public static final short INTERRUPT = 52; 52 public static final short INVALID_CLASS_FORMAT = 60; 53 public static final short CIRCULAR_CLASS_DEFINITION = 61; 54 public static final short FAILS_VERIFICATION = 62; 55 public static final short ADD_METHOD_NOT_IMPLEMENTED = 63; 56 public static final short SCHEMA_CHANGE_NOT_IMPLEMENTED = 64; 57 public static final short INVALID_TYPESTATE = 65; 58 public static final short HIERARCHY_CHANGE_NOT_IMPLEMENTED = 66; 59 public static final short DELETE_METHOD_NOT_IMPLEMENTED = 67; 60 public static final short UNSUPPORTED_VERSION = 68; 61 public static final short NAMES_DONT_MATCH = 69; 62 public static final short CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 70; 63 public static final short METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 71; 64 public static final short NOT_IMPLEMENTED = 99; 65 public static final short NULL_POINTER = 100; 66 public static final short ABSENT_INFORMATION = 101; 67 public static final short INVALID_EVENT_TYPE = 102; 68 public static final short ILLEGAL_ARGUMENT = 103; 69 public static final short OUT_OF_MEMORY = 110; 70 public static final short ACCESS_DENIED = 111; 71 public static final short VM_DEAD = 112; 72 public static final short INTERNAL = 113; 73 public static final short UNATTACHED_THREAD = 115; 74 public static final short INVALID_TAG = 500; 75 public static final short ALREADY_INVOKING = 502; 76 public static final short INVALID_INDEX = 503; 77 public static final short INVALID_LENGTH = 504; 78 public static final short INVALID_STRING = 506; 79 public static final short INVALID_CLASS_LOADER = 507; 80 public static final short INVALID_ARRAY = 508; 81 public static final short TRANSPORT_LOAD = 509; 82 public static final short TRANSPORT_INIT = 510; 83 public static final short NATIVE_METHOD = 511; 84 public static final short INVALID_COUNT = 512; 85 public static final short HCR_OPERATION_REFUSED = 900; 87 88 private static HashMap fErrorMap = null; 89 90 91 private short fErrorCode; 92 95 public JdwpReplyPacket() { 96 setFlags(FLAG_REPLY_PACKET); 97 } 98 99 102 public short errorCode() { 103 return fErrorCode; 104 } 105 106 109 public void setErrorCode(short newValue) { 110 fErrorCode = newValue; 111 } 112 113 116 protected void readSpecificHeaderFields(DataInputStream dataInStream) throws IOException { 117 fErrorCode = dataInStream.readShort(); 118 } 119 120 123 protected void writeSpecificHeaderFields(DataOutputStream dataOutStream) throws IOException { 124 dataOutStream.writeShort(fErrorCode); 125 } 126 127 130 public static void getConstantMaps() { 131 if (fErrorMap != null) { 132 return; 133 } 134 135 Field [] fields = JdwpReplyPacket.class.getDeclaredFields(); 136 fErrorMap = new HashMap (fields.length); 137 for (int i = 0; i < fields.length; i++) { 138 Field field = fields[i]; 139 if ((field.getModifiers() & Modifier.PUBLIC) == 0 || (field.getModifiers() & Modifier.STATIC) == 0 || (field.getModifiers() & Modifier.FINAL) == 0) 140 continue; 141 142 try { 143 Integer intValue = new Integer (field.getInt(null)); 144 fErrorMap.put(intValue, field.getName()); 145 } catch (IllegalAccessException e) { 146 } catch (IllegalArgumentException e) { 148 } 152 } 153 } 154 155 158 public static Map errorMap() { 159 getConstantMaps(); 160 return fErrorMap; 161 } 162 } 163 | Popular Tags |