| 643 | } |
| 644 | |
| 645 | @SuppressWarnings("rawtypes") |
| 646 | public static Class resolveClassName(String name) throws IOException{ |
| 647 | Map<String,Class<?>> cache = getClassCache(); |
| 648 | |
| 649 | Class c = cache.get(name); |
| 650 | if (c != null) { |
| 651 | return c; |
| 652 | } |
| 653 | |
| 654 | for(String prefix: getPackageImportList()) { |
| 655 | try { |
| 656 | c = Class.forName(prefix+name,true, PigContext.classloader); |
| 657 | cache.put(name, c); |
| 658 | |
| 659 | return c; |
| 660 | } |
| 661 | catch (ClassNotFoundException e) { |
| 662 | // do nothing |
| 663 | } |
| 664 | catch (UnsupportedClassVersionError e) { |
| 665 | int errCode = 1069; |
| 666 | String msg = "Problem resolving class version numbers for class " + name; |
| 667 | throw new ExecException(msg, errCode, PigException.INPUT, e) ; |
| 668 | } |
| 669 | |
| 670 | } |
| 671 | |
| 672 | // create ClassNotFoundException exception and attach to IOException |
| 673 | // so that we don't need to buble interface changes throughout the code |
| 674 | int errCode = 1070; |
| 675 | String msg = "Could not resolve " + name + " using imports: " + packageImportList.get(); |
| 676 | throw new ExecException(msg, errCode, PigException.INPUT); |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * A common Pig pattern for initializing objects via system properties is to support passing |