Lines 199-204
Link Here
|
199 |
props.put("installerState", buf); // NOI18N |
199 |
props.put("installerState", buf); // NOI18N |
200 |
} |
200 |
} |
201 |
Module m = mgr.create(jarFile, history, reloadable, autoload, eager); |
201 |
Module m = mgr.create(jarFile, history, reloadable, autoload, eager); |
|
|
202 |
|
203 |
List l = (List)props.get ("extra-cp"); // NOI18N |
204 |
if (l != null) { |
205 |
m.assignExtraClassPath ((String[])l.toArray (new String[0])); |
206 |
} |
207 |
|
202 |
read.add(m); |
208 |
read.add(m); |
203 |
DiskStatus status = new DiskStatus(); |
209 |
DiskStatus status = new DiskStatus(); |
204 |
status.module = m; |
210 |
status.module = m; |
Lines 573-578
Link Here
|
573 |
private String modName; |
579 |
private String modName; |
574 |
private String paramName; |
580 |
private String paramName; |
575 |
private StringBuffer data = new StringBuffer(); |
581 |
private StringBuffer data = new StringBuffer(); |
|
|
582 |
private List extraClassPath; |
576 |
|
583 |
|
577 |
public void startElement(String uri, |
584 |
public void startElement(String uri, |
578 |
String localname, |
585 |
String localname, |
Lines 592-597
Link Here
|
592 |
paramName = paramName.intern(); |
599 |
paramName = paramName.intern(); |
593 |
data.setLength(0); |
600 |
data.setLength(0); |
594 |
} |
601 |
} |
|
|
602 |
else if ("extra-cp".equals (qname)) { // NOI18N |
603 |
if (extraClassPath != null) { |
604 |
throw new SAXException("extra-cp can be there just once"); // NOI18N |
605 |
} |
606 |
extraClassPath = new ArrayList (); |
607 |
m.put ("extra-cp", extraClassPath); // NOI18N |
608 |
} |
609 |
else if ("path".equals (qname)) { // NOI18N |
610 |
if (! (extraClassPath instanceof ArrayList)) { |
611 |
throw new SAXException ("path can be just inside extra-cp"); // NOI18N |
612 |
} |
613 |
String location = attrs.getValue ("location"); // NOI18N |
614 |
if (location == null) { |
615 |
throw new SAXException ("attribute location must be present when specifying path"); // NOI18N |
616 |
} |
617 |
extraClassPath.add (location); |
618 |
} |
595 |
} |
619 |
} |
596 |
|
620 |
|
597 |
public void characters(char[] ch, int start, int len) { |
621 |
public void characters(char[] ch, int start, int len) { |
Lines 623-628
Link Here
|
623 |
else if ("module".equals(qname)) { // NOI18N |
647 |
else if ("module".equals(qname)) { // NOI18N |
624 |
modName = null; |
648 |
modName = null; |
625 |
} |
649 |
} |
|
|
650 |
else if ("extra-cp".equals (qname)) { // NOI18N |
651 |
extraClassPath = java.util.Collections.unmodifiableList (extraClassPath); |
652 |
} |
626 |
} |
653 |
} |
627 |
}; |
654 |
}; |
628 |
|
655 |
|
Lines 698-703
Link Here
|
698 |
// private static final byte[] MODULE_XML_DIV1 = ">\n <param name=\"".getBytes(); // NOI18N |
725 |
// private static final byte[] MODULE_XML_DIV1 = ">\n <param name=\"".getBytes(); // NOI18N |
699 |
private static final byte[] MODULE_XML_INTRO_END = ">\n".getBytes(); // NOI18N |
726 |
private static final byte[] MODULE_XML_INTRO_END = ">\n".getBytes(); // NOI18N |
700 |
private static final byte[] MODULE_XML_DIV2 = " <param name=\"".getBytes(); // NOI18N |
727 |
private static final byte[] MODULE_XML_DIV2 = " <param name=\"".getBytes(); // NOI18N |
|
|
728 |
private static final byte[] MODULE_EXTRA_CP = " <extra-cp>\n".getBytes(); // NOI18N |
729 |
private static final byte[] MODULE_SPACES = " ".getBytes(); // NOI18N |
730 |
private static final byte[] MODULE_PATH = " <path location=\"".getBytes(); // NOI18N |
731 |
private static final byte[] MODULE_PATH_END = "/>\n".getBytes(); // NOI18N |
732 |
private static final byte[] MODULE_EXTRA_CP_END = "/extra-cp>\n".getBytes(); // NOI18N |
701 |
private static final byte[] MODULE_XML_DIV3 = "/param>\n".getBytes(); // NOI18N |
733 |
private static final byte[] MODULE_XML_DIV3 = "/param>\n".getBytes(); // NOI18N |
702 |
private static final byte[] MODULE_XML_END = "/module>\n".getBytes(); // NOI18N |
734 |
private static final byte[] MODULE_XML_END = "/module>\n".getBytes(); // NOI18N |
703 |
/** Just like {@link #readStatus(InputSource,XMLReader} but avoids using an XML parser. |
735 |
/** Just like {@link #readStatus(InputSource,XMLReader} but avoids using an XML parser. |
Lines 721-726
Link Here
|
721 |
Util.err.log("Could not read stuff after cnb"); |
753 |
Util.err.log("Could not read stuff after cnb"); |
722 |
return null; |
754 |
return null; |
723 |
} |
755 |
} |
|
|
756 |
|
757 |
ArrayList extraClassPath = new ArrayList (); |
758 |
|
724 |
// Now we have <param>s some number of times, finally </module>. |
759 |
// Now we have <param>s some number of times, finally </module>. |
725 |
PARSE: |
760 |
PARSE: |
726 |
while (true) { |
761 |
while (true) { |
Lines 729-734
Link Here
|
729 |
case ' ': |
764 |
case ' ': |
730 |
// <param> |
765 |
// <param> |
731 |
if (!expect(is, MODULE_XML_DIV2)) { |
766 |
if (!expect(is, MODULE_XML_DIV2)) { |
|
|
767 |
if (expect (is, MODULE_EXTRA_CP)) { |
768 |
// do extra cp loading, if possible |
769 |
for (;;) { |
770 |
if (!expect (is, MODULE_SPACES)) { |
771 |
return null; |
772 |
} |
773 |
int x = is.read (); |
774 |
if (x == ' ') { |
775 |
// path element |
776 |
if (!expect (is, MODULE_PATH)) { |
777 |
Util.err.log("No path"); |
778 |
return null; |
779 |
} |
780 |
String k = readTo(is, '"'); |
781 |
if (k == null) { |
782 |
Util.err.log("Could not read path"); |
783 |
return null; |
784 |
} |
785 |
extraClassPath.add (k.intern ()); |
786 |
if (!expect (is, MODULE_PATH_END)) { |
787 |
Util.err.log("Could not read path end"); |
788 |
return null; |
789 |
} |
790 |
} else if (x == '<') { |
791 |
// </extra-cp> |
792 |
if (!expect (is, MODULE_EXTRA_CP_END)) { |
793 |
return null; |
794 |
} else { |
795 |
break; |
796 |
} |
797 |
} else { |
798 |
return null; |
799 |
} |
800 |
} |
801 |
continue; |
802 |
} |
732 |
Util.err.log("Could not read up to param"); |
803 |
Util.err.log("Could not read up to param"); |
733 |
return null; |
804 |
return null; |
734 |
} |
805 |
} |
Lines 775-780
Link Here
|
775 |
return null; |
846 |
return null; |
776 |
} |
847 |
} |
777 |
} |
848 |
} |
|
|
849 |
|
850 |
if (!extraClassPath.isEmpty ()) { |
851 |
m.put ("extra-cp", extraClassPath); // NOI18N |
852 |
} |
778 |
sanityCheckStatus(m); |
853 |
sanityCheckStatus(m); |
779 |
return m; |
854 |
return m; |
780 |
} |
855 |
} |
Lines 786-791
Link Here
|
786 |
private boolean expect(InputStream is, byte[] stuff) throws IOException { |
861 |
private boolean expect(InputStream is, byte[] stuff) throws IOException { |
787 |
int len = stuff.length; |
862 |
int len = stuff.length; |
788 |
boolean inNewline = false; |
863 |
boolean inNewline = false; |
|
|
864 |
// mark the possition so we can reset on failure |
865 |
is.mark (stuff.length); |
789 |
for (int i = 0; i < len; ) { |
866 |
for (int i = 0; i < len; ) { |
790 |
int c = is.read(); |
867 |
int c = is.read(); |
791 |
if (c == 10 || c == 13) { |
868 |
if (c == 10 || c == 13) { |
Lines 800-805
Link Here
|
800 |
inNewline = false; |
877 |
inNewline = false; |
801 |
} |
878 |
} |
802 |
if (c != stuff[i++]) { |
879 |
if (c != stuff[i++]) { |
|
|
880 |
is.reset (); |
803 |
return false; |
881 |
return false; |
804 |
} |
882 |
} |
805 |
} |
883 |
} |
Lines 874-879
Link Here
|
874 |
w.write("<module name=\""); // NOI18N |
952 |
w.write("<module name=\""); // NOI18N |
875 |
w.write(XMLUtil.toAttributeValue(codeName)); // NOI18N |
953 |
w.write(XMLUtil.toAttributeValue(codeName)); // NOI18N |
876 |
w.write("\">\n"); // NOI18N |
954 |
w.write("\">\n"); // NOI18N |
|
|
955 |
|
956 |
File[] extraClassPath = null; |
877 |
|
957 |
|
878 |
// Use TreeMap to sort the keys by name; since the module status files might |
958 |
// Use TreeMap to sort the keys by name; since the module status files might |
879 |
// be version-controlled we want to avoid gratuitous format changes. |
959 |
// be version-controlled we want to avoid gratuitous format changes. |
Lines 887-892
Link Here
|
887 |
} |
967 |
} |
888 |
|
968 |
|
889 |
Object val = entry.getValue(); |
969 |
Object val = entry.getValue(); |
|
|
970 |
|
971 |
if (name.equals ("extra-cp")) { // NOI18N |
972 |
extraClassPath = (File[])val; |
973 |
continue; |
974 |
} |
890 |
|
975 |
|
891 |
w.write(" <param name=\""); // NOI18N |
976 |
w.write(" <param name=\""); // NOI18N |
892 |
w.write(XMLUtil.toAttributeValue(name)); // NOI18N |
977 |
w.write(XMLUtil.toAttributeValue(name)); // NOI18N |
Lines 895-900
Link Here
|
895 |
w.write("</param>\n"); // NOI18N |
980 |
w.write("</param>\n"); // NOI18N |
896 |
} |
981 |
} |
897 |
|
982 |
|
|
|
983 |
if (extraClassPath != null) { |
984 |
w.write (" <extra-cp>\n"); |
985 |
for (int i = 0; i < extraClassPath.length; i++) { |
986 |
w.write (" <path location=\""); |
987 |
w.write (extraClassPath[i].toString ()); |
988 |
w.write ("\"/>\n"); |
989 |
} |
990 |
w.write (" </extra-cp>\n"); |
991 |
} |
992 |
|
898 |
w.write("</module>\n"); // NOI18N |
993 |
w.write("</module>\n"); // NOI18N |
899 |
w.flush(); |
994 |
w.flush(); |
900 |
} |
995 |
} |
Lines 1184-1189
Link Here
|
1184 |
p.put("installer", m.getCodeNameBase().replace('.', '-') + ".ser"); // NOI18N |
1279 |
p.put("installer", m.getCodeNameBase().replace('.', '-') + ".ser"); // NOI18N |
1185 |
p.put("installerState", hist.getInstallerState()); // NOI18N |
1280 |
p.put("installerState", hist.getInstallerState()); // NOI18N |
1186 |
} |
1281 |
} |
|
|
1282 |
p.put("extra-cp", m.getExtraClassPath ()); // NOI18N |
1187 |
return p; |
1283 |
return p; |
1188 |
} |
1284 |
} |
1189 |
|
1285 |
|