Lines 44-49
Link Here
|
44 |
|
44 |
|
45 |
package org.netbeans.modules.cnd.debugger.common2.values; |
45 |
package org.netbeans.modules.cnd.debugger.common2.values; |
46 |
|
46 |
|
|
|
47 |
import java.math.BigInteger; |
48 |
|
47 |
/** |
49 |
/** |
48 |
* thread and lwps are collectively known as "active entities" |
50 |
* thread and lwps are collectively known as "active entities" |
49 |
* so their Id's are AId's. |
51 |
* so their Id's are AId's. |
Lines 68-73
Link Here
|
68 |
return true; |
70 |
return true; |
69 |
} |
71 |
} |
70 |
|
72 |
|
|
|
73 |
private static boolean isLongDecimalNumber(String s) { |
74 |
try { |
75 |
// we don't like negative numbers either |
76 |
if (s.startsWith("-")) {// NOI18N |
77 |
return false; |
78 |
} |
79 |
BigInteger bi = new BigInteger(s); |
80 |
if (bi.bitLength() > 64) { |
81 |
// cannot be represented by java long |
82 |
return false; |
83 |
} |
84 |
} catch(NumberFormatException x) { |
85 |
return false; |
86 |
} |
87 |
|
88 |
return true; |
89 |
} |
90 |
|
71 |
/** |
91 |
/** |
72 |
* Validate & interpret 'text' per the additional flags. |
92 |
* Validate & interpret 'text' per the additional flags. |
73 |
* An invalid value will have 'errorMessage != null' |
93 |
* An invalid value will have 'errorMessage != null' |
Lines 117-127
Link Here
|
117 |
} else { |
137 |
} else { |
118 |
numberPart = text; |
138 |
numberPart = text; |
119 |
} |
139 |
} |
120 |
if (!isDecimalNumber(numberPart)) { |
140 |
if (!isLongDecimalNumber(numberPart)) { |
121 |
errorMessage = Catalog.get("MSG_AId_MalformedThread"); // NOI18N |
141 |
errorMessage = Catalog.get("MSG_AId_MalformedThread"); // NOI18N |
122 |
return; |
142 |
return; |
123 |
} |
143 |
} |
124 |
id = "t@" + Long.parseLong(numberPart); // NOI18N |
144 |
BigInteger big = new BigInteger(numberPart); |
|
|
145 |
long lid = big.longValue(); |
146 |
if (lid < 0) { |
147 |
BigInteger max = BigInteger.ONE.shiftLeft(64); |
148 |
BigInteger bi = BigInteger.valueOf(lid); |
149 |
id = "t@" + bi.add(max).toString(); // NOI18N |
150 |
} else { |
151 |
id = "t@" + Long.toString(lid); // NOI18N |
152 |
} |
125 |
} else { |
153 |
} else { |
126 |
// Java thread names are strings so can by _anything_ |
154 |
// Java thread names are strings so can by _anything_ |
127 |
id = text; |
155 |
id = text; |