Skip to content

Commit 282aff2

Browse files
committed
Added catalog manager
1 parent d10ba2e commit 282aff2

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

lib/xmljava.jar

678 Bytes
Binary file not shown.

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sonar.projectKey=XMLJava
33
# this is the name displayed in the SonarQube UI
44
sonar.projectName=XMLJava
5-
sonar.projectVersion=1.0.0
5+
sonar.projectVersion=2.0.0
66

77
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
88
# Since SonarQube 4.2, this property is optional if sonar.modules is set.

src/com/maxprograms/xml/Catalog.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class Catalog implements EntityResolver2 {
4949
private String base = "";
5050
private String documentParent = "";
5151

52-
public Catalog(String catalogFile)
52+
protected Catalog(String catalogFile)
5353
throws SAXException, IOException, ParserConfigurationException, URISyntaxException {
5454
File file = new File(catalogFile);
5555
if (!file.isAbsolute()) {
@@ -301,7 +301,6 @@ public InputSource getExternalSubset(String name, String baseURI) throws SAXExce
301301
return null;
302302
}
303303

304-
@SuppressWarnings("resource")
305304
@Override
306305
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId)
307306
throws SAXException, IOException {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2022 - 2024 Maxprograms.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 1.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/org/documents/epl-v10.html
8+
*
9+
* Contributors:
10+
* Maxprograms - initial API and implementation
11+
*******************************************************************************/
12+
13+
package com.maxprograms.xml;
14+
15+
import java.io.IOException;
16+
import java.net.URISyntaxException;
17+
import java.util.Hashtable;
18+
import java.util.Map;
19+
20+
import javax.xml.parsers.ParserConfigurationException;
21+
22+
import org.xml.sax.SAXException;
23+
24+
public class CatalogBuilder {
25+
26+
private static Map<String,Catalog> map = new Hashtable<>();
27+
28+
private CatalogBuilder() {
29+
// Do not instantiate
30+
}
31+
32+
public static Catalog getCatalog(String file) throws SAXException, IOException, ParserConfigurationException, URISyntaxException{
33+
if (!map.containsKey(file)) {
34+
map.put(file, new Catalog(file));
35+
}
36+
return map.get(file);
37+
}
38+
}

src/com/maxprograms/xml/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
public class Constants {
1616

17-
public static final String VERSION = "1.8.0";
18-
public static final String BUILD = "20240322_0813";
17+
public static final String VERSION = "2.0.0";
18+
public static final String BUILD = "20241215_0607";
1919

2020
private Constants() {
2121
// private for security

0 commit comments

Comments
 (0)