| OLD | NEW |
| 1 library java.core; | 1 library java.core; |
| 2 | 2 |
| 3 import "dart:math" as math; | 3 import "dart:math" as math; |
| 4 | 4 |
| 5 final Stopwatch nanoTimeStopwatch = new Stopwatch(); | 5 final Stopwatch nanoTimeStopwatch = new Stopwatch(); |
| 6 | 6 |
| 7 const int LONG_MAX_VALUE = 0x7fffffffffffffff; | 7 const int LONG_MAX_VALUE = 0x7fffffffffffffff; |
| 8 | 8 |
| 9 class JavaSystem { | 9 class JavaSystem { |
| 10 static int currentTimeMillis() { | 10 static int currentTimeMillis() { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 class NoSuchElementException extends JavaException { | 328 class NoSuchElementException extends JavaException { |
| 329 String toString() => "NoSuchElementException"; | 329 String toString() => "NoSuchElementException"; |
| 330 } | 330 } |
| 331 | 331 |
| 332 class NumberFormatException extends JavaException { | 332 class NumberFormatException extends JavaException { |
| 333 String toString() => "NumberFormatException"; | 333 String toString() => "NumberFormatException"; |
| 334 } | 334 } |
| 335 | 335 |
| 336 /// Parses given string to [Uri], throws [URISyntaxException] if invalid. | 336 /// Parses given string to [Uri], throws [URISyntaxException] if invalid. |
| 337 Uri parseUriWithException(String str) { | 337 Uri parseUriWithException(String str) { |
| 338 Uri uri = Uri.parse(str); | 338 Uri uri; |
| 339 try { |
| 340 uri = Uri.parse(str); |
| 341 } on FormatException catch (e) { |
| 342 throw new URISyntaxException(e.toString()); |
| 343 } |
| 339 if (uri.path.isEmpty) { | 344 if (uri.path.isEmpty) { |
| 340 throw new URISyntaxException(); | 345 throw new URISyntaxException('empty path'); |
| 341 } | 346 } |
| 342 return uri; | 347 return uri; |
| 343 } | 348 } |
| 344 | 349 |
| 345 class URISyntaxException implements Exception { | 350 class URISyntaxException implements Exception { |
| 346 String toString() => "URISyntaxException"; | 351 final String message; |
| 352 URISyntaxException(this.message); |
| 353 String toString() => "URISyntaxException: $message"; |
| 347 } | 354 } |
| 348 | 355 |
| 349 class MissingFormatArgumentException implements Exception { | 356 class MissingFormatArgumentException implements Exception { |
| 350 final String s; | 357 final String s; |
| 351 | 358 |
| 352 String toString() => "MissingFormatArgumentException: $s"; | 359 String toString() => "MissingFormatArgumentException: $s"; |
| 353 | 360 |
| 354 MissingFormatArgumentException(this.s); | 361 MissingFormatArgumentException(this.s); |
| 355 } | 362 } |
| 356 | 363 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?' | 546 * format('{0} are you {1}ing?', ['What', 'read']) = 'What are you reading?' |
| 540 */ | 547 */ |
| 541 String formatList(String pattern, List args) { | 548 String formatList(String pattern, List args) { |
| 542 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) { | 549 return pattern.replaceAllMapped(new RegExp(r'\{(\d+)\}'), (match) { |
| 543 String indexStr = match.group(1); | 550 String indexStr = match.group(1); |
| 544 int index = int.parse(indexStr); | 551 int index = int.parse(indexStr); |
| 545 var arg = args[index]; | 552 var arg = args[index]; |
| 546 return arg != null ? arg.toString() : null; | 553 return arg != null ? arg.toString() : null; |
| 547 }); | 554 }); |
| 548 } | 555 } |
| OLD | NEW |