< prev index next >
src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
Print this page
*** 86,95 ****
--- 86,96 ----
SAXParser parser;
/**
* Construct a Catalog with specified URI.
*
+ * @param f the features object
* @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
*/
public CatalogImpl(CatalogFeatures f, URI... uris) throws CatalogException {
*** 98,107 ****
--- 99,109 ----
/**
* Construct a Catalog with specified URI.
*
* @param parent The parent catalog
+ * @param f the features object
* @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
*/
public CatalogImpl(CatalogImpl parent, CatalogFeatures f, URI... uris) throws CatalogException {
*** 135,145 ****
int start = 0;
URI uri = null;
for (String temp : catalogFile) {
uri = URI.create(temp);
start++;
! if (verifyCatalogFile(uri)) {
systemId = temp;
try {
baseURI = new URL(systemId);
} catch (MalformedURLException e) {
CatalogMessages.reportRunTimeError(CatalogMessages.ERR_INVALID_PATH,
--- 137,147 ----
int start = 0;
URI uri = null;
for (String temp : catalogFile) {
uri = URI.create(temp);
start++;
! if (verifyCatalogFile(null, uri)) {
systemId = temp;
try {
baseURI = new URL(systemId);
} catch (MalformedURLException e) {
CatalogMessages.reportRunTimeError(CatalogMessages.ERR_INVALID_PATH,
*** 167,182 ****
void load() {
if (systemId != null) {
parse(systemId);
}
//save this catalog before loading the next
loadedCatalogs.put(systemId, this);
//Load delegate and alternative catalogs if defer is false.
if (!isDeferred()) {
! loadDelegateCatalogs();
loadNextCatalogs();
}
}
private void init(CatalogFeatures f) {
--- 169,186 ----
void load() {
if (systemId != null) {
parse(systemId);
}
+ setCatalog(this);
+
//save this catalog before loading the next
loadedCatalogs.put(systemId, this);
//Load delegate and alternative catalogs if defer is false.
if (!isDeferred()) {
! loadDelegateCatalogs(this);
loadNextCatalogs();
}
}
private void init(CatalogFeatures f) {
*** 363,380 ****
Catalog c = null;
//Check those specified in nextCatalogs
if (nextCatalogs != null) {
while (c == null && nextCatalogIndex < nextCatalogs.size()) {
! c = getCatalog(nextCatalogs.get(nextCatalogIndex++).getCatalogURI());
}
}
//Check the input list
if (c == null && inputFiles != null) {
while (c == null && inputFilesIndex < inputFiles.size()) {
! c = getCatalog(URI.create(inputFiles.get(inputFilesIndex++)));
}
}
return c;
}
--- 367,386 ----
Catalog c = null;
//Check those specified in nextCatalogs
if (nextCatalogs != null) {
while (c == null && nextCatalogIndex < nextCatalogs.size()) {
! c = getCatalog(catalog,
! nextCatalogs.get(nextCatalogIndex++).getCatalogURI());
}
}
//Check the input list
if (c == null && inputFiles != null) {
while (c == null && inputFilesIndex < inputFiles.size()) {
! c = getCatalog(null,
! URI.create(inputFiles.get(inputFilesIndex++)));
}
}
return c;
}
*** 406,441 ****
*/
void loadNextCatalogs() {
//loads catalogs specified in nextCatalogs
if (nextCatalogs != null) {
nextCatalogs.stream().forEach((next) -> {
! getCatalog(next.getCatalogURI());
});
}
//loads catalogs from the input list
if (inputFiles != null) {
inputFiles.stream().forEach((uri) -> {
! getCatalog(URI.create(uri));
});
}
}
/**
* Returns a Catalog object by the specified path.
*
! * @param path the path to a catalog
* @return a Catalog object
*/
! Catalog getCatalog(URI uri) {
if (uri == null) {
return null;
}
CatalogImpl c = null;
! if (verifyCatalogFile(uri)) {
c = getLoadedCatalog(uri.toASCIIString());
if (c == null) {
c = new CatalogImpl(this, features, uri);
c.load();
}
--- 412,449 ----
*/
void loadNextCatalogs() {
//loads catalogs specified in nextCatalogs
if (nextCatalogs != null) {
nextCatalogs.stream().forEach((next) -> {
! getCatalog(this, next.getCatalogURI());
});
}
//loads catalogs from the input list
if (inputFiles != null) {
inputFiles.stream().forEach((uri) -> {
! getCatalog(null, URI.create(uri));
});
}
}
/**
* Returns a Catalog object by the specified path.
*
! * @param parent the parent catalog for the alternative catalogs to be loaded.
! * It will be null if the ones to be loaded are from the input list.
! * @param uri the path to a catalog
* @return a Catalog object
*/
! Catalog getCatalog(CatalogImpl parent, URI uri) {
if (uri == null) {
return null;
}
CatalogImpl c = null;
! if (verifyCatalogFile(parent, uri)) {
c = getLoadedCatalog(uri.toASCIIString());
if (c == null) {
c = new CatalogImpl(this, features, uri);
c.load();
}
*** 457,464 ****
* Returns a count of all loaded catalogs, including delegate catalogs.
*
* @return a count of all loaded catalogs
*/
int loadedCatalogCount() {
! return loadedCatalogs.size() + delegateCatalogs.size();
}
}
--- 465,472 ----
* Returns a count of all loaded catalogs, including delegate catalogs.
*
* @return a count of all loaded catalogs
*/
int loadedCatalogCount() {
! return loadedCatalogs.size();
}
}
< prev index next >