Lines 203-217
Link Here
|
203 |
} |
203 |
} |
204 |
|
204 |
|
205 |
boolean expectingPath = true; |
205 |
boolean expectingPath = true; |
|
|
206 |
boolean first = true; |
206 |
|
207 |
|
207 |
while (tok.hasMoreTokens()) { |
208 |
while (tok.hasMoreTokens()) { |
208 |
if (expectingPath) { |
209 |
if (expectingPath) { |
209 |
expectingPath = false; |
210 |
expectingPath = false; |
210 |
|
211 |
|
211 |
String nt = tok.nextToken(); |
212 |
String nt = tok.nextToken(); |
212 |
if (!Utilities.isJavaIdentifier(nt) && !"enum".equals (nt)) { // NOI18N |
213 |
if (!isJavaIdentifierOrNumber(nt, first)) { |
213 |
throw new IllegalArgumentException("Bad package component in " + base); // NOI18N |
214 |
throw new IllegalArgumentException("Bad package component in " + base); // NOI18N |
214 |
} |
215 |
} |
|
|
216 |
first = false; |
215 |
} else { |
217 |
} else { |
216 |
if (!".".equals(tok.nextToken())) { // NOI18N |
218 |
if (!".".equals(tok.nextToken())) { // NOI18N |
217 |
throw new NumberFormatException("Expected dot in code name: " + base); // NOI18N |
219 |
throw new NumberFormatException("Expected dot in code name: " + base); // NOI18N |
Lines 221-227
Link Here
|
221 |
} |
223 |
} |
222 |
} |
224 |
} |
223 |
} |
225 |
} |
|
|
226 |
|
227 |
private static boolean isJavaIdentifierOrNumber(String id, boolean requireLetter) { |
228 |
if (id == null) { |
229 |
return false; |
230 |
} |
224 |
|
231 |
|
|
|
232 |
if (id.equals("")) { |
233 |
return false; |
234 |
} |
235 |
if (requireLetter) { |
236 |
if (!(java.lang.Character.isJavaIdentifierStart(id.charAt(0)))) { |
237 |
return false; |
238 |
} |
239 |
} |
240 |
for (int i = 0; i < id.length(); i++) { |
241 |
if (!(java.lang.Character.isJavaIdentifierPart(id.charAt(i)))) { |
242 |
return false; |
243 |
} |
244 |
} |
245 |
return true; |
246 |
} |
247 |
|
225 |
/** Parse dependencies from tags. |
248 |
/** Parse dependencies from tags. |
226 |
* @param type like Dependency.type |
249 |
* @param type like Dependency.type |
227 |
* @param body actual text of tag body; if <code>null</code>, returns nothing |
250 |
* @param body actual text of tag body; if <code>null</code>, returns nothing |