646 }
647 }
648
649 private void checkDup(String keyword) throws IOException {
650 if (parsedKeywords.contains(keyword)) {
651 throw excLine(keyword + " must only be specified once");
652 }
653 }
654
655 //
656 // individual entry parsing methods
657 //
658
659 private String parseLibrary(String keyword) throws IOException {
660 checkDup(keyword);
661 parseEquals();
662 String lib = parseLine();
663 lib = expand(lib);
664 int i = lib.indexOf("/$ISA/");
665 if (i != -1) {
666 // replace "/$ISA/" with "/sparcv9/" on 64-bit Solaris SPARC
667 // and with "/amd64/" on Solaris AMD64.
668 // On all other platforms, just turn it into a "/"
669 String prefix = lib.substring(0, i);
670 String suffix = lib.substring(i + 5);
671 if (osName.equals("SunOS") && osArch.equals("sparcv9")) {
672 lib = prefix + "/sparcv9" + suffix;
673 } else if (osName.equals("SunOS") && osArch.equals("amd64")) {
674 lib = prefix + "/amd64" + suffix;
675 } else {
676 lib = prefix + suffix;
677 }
678 }
679 debug(keyword + ": " + lib);
680
681 // Check to see if full path is specified to prevent the DLL
682 // preloading attack
683 if (!(new File(lib)).isAbsolute()) {
684 throw new ConfigurationException(
685 "Absolute path required for library value: " + lib);
686 }
687 return lib;
688 }
689
690 private void parseDescription(String keyword) throws IOException {
691 checkDup(keyword);
692 parseEquals();
693 description = parseLine();
694 debug("description: " + description);
695 }
696
697 private void parseSlotID(String keyword) throws IOException {
|
646 }
647 }
648
649 private void checkDup(String keyword) throws IOException {
650 if (parsedKeywords.contains(keyword)) {
651 throw excLine(keyword + " must only be specified once");
652 }
653 }
654
655 //
656 // individual entry parsing methods
657 //
658
659 private String parseLibrary(String keyword) throws IOException {
660 checkDup(keyword);
661 parseEquals();
662 String lib = parseLine();
663 lib = expand(lib);
664 int i = lib.indexOf("/$ISA/");
665 if (i != -1) {
666 // replace "/$ISA/" with "/"
667 String prefix = lib.substring(0, i);
668 String suffix = lib.substring(i + 5);
669 lib = prefix + suffix;
670 }
671 debug(keyword + ": " + lib);
672
673 // Check to see if full path is specified to prevent the DLL
674 // preloading attack
675 if (!(new File(lib)).isAbsolute()) {
676 throw new ConfigurationException(
677 "Absolute path required for library value: " + lib);
678 }
679 return lib;
680 }
681
682 private void parseDescription(String keyword) throws IOException {
683 checkDup(keyword);
684 parseEquals();
685 description = parseLine();
686 debug("description: " + description);
687 }
688
689 private void parseSlotID(String keyword) throws IOException {
|