| 576 | |
| 577 | // Protected for unit testing |
| 578 | static String[] getPaths(String value) { |
| 579 | |
| 580 | List<String> result = new ArrayList<>(); |
| 581 | Matcher matcher = PATH_PATTERN.matcher(value); |
| 582 | |
| 583 | while (matcher.find()) { |
| 584 | String path = value.substring(matcher.start(), matcher.end()); |
| 585 | |
| 586 | path = path.trim(); |
| 587 | if (path.isEmpty()) { |
| 588 | continue; |
| 589 | } |
| 590 | |
| 591 | char first = path.charAt(0); |
| 592 | char last = path.charAt(path.length() - 1); |
| 593 | |
| 594 | if (first == '"' && last == '"' && path.length() > 1) { |
| 595 | path = path.substring(1, path.length() - 1); |
| 596 | path = path.trim(); |
| 597 | if (path.isEmpty()) { |
| 598 | continue; |
| 599 | } |
| 600 | } else if (path.contains("\"")) { |
| 601 | // Unbalanced quotes |
| 602 | // Too early to use standard i18n support. The class path hasn't |
| 603 | // been configured. |
| 604 | throw new IllegalArgumentException( |
| 605 | "The double quote [\"] character can only be used to quote paths. It must " + |
| 606 | "not appear in a path. This loader path is not valid: [" + value + "]"); |
| 607 | } else { |
| 608 | // Not quoted - NO-OP |
| 609 | } |
| 610 | |
| 611 | result.add(path); |
| 612 | } |
| 613 | |
| 614 | return result.toArray(new String[0]); |
| 615 | } |
| 616 | } |