Skip to content

Commit 6ccdb25

Browse files
committed
ConfiguratorFactory: removed JAXP message
1 parent a9fead9 commit 6ccdb25

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

src/org/jgroups/conf/ConfiguratorFactory.java

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
* @author Bela Ban
2424
*/
2525
public class ConfiguratorFactory {
26-
public static final String JAXP_MISSING_ERROR_MSG="the required XML parsing classes are not available; " +
27-
"make sure that JAXP compatible libraries are in the classpath.";
28-
2926

3027
protected ConfiguratorFactory() {
3128
}
@@ -38,7 +35,6 @@ protected ConfiguratorFactory() {
3835
* @throws Exception if problems occur during the configuration of the protocol stack.
3936
*/
4037
public static ProtocolStackConfigurator getStackConfigurator(File file) throws Exception {
41-
checkJAXPAvailability();
4238
InputStream input=getConfigStream(file);
4339
return XmlConfigurator.getInstance(input);
4440
}
@@ -47,7 +43,6 @@ public static ProtocolStackConfigurator getStackConfigurator(InputStream input)
4743
return XmlConfigurator.getInstance(input);
4844
}
4945

50-
5146
/**
5247
* Returns a protocol stack configurator based on the provided properties string.
5348
* @param properties a string representing a system resource containing a JGroups XML configuration, a URL pointing
@@ -66,14 +61,10 @@ public static ProtocolStackConfigurator getStackConfigurator(String properties)
6661
throw new IllegalStateException(String.format("configuration %s not found or invalid", properties));
6762
}
6863

69-
70-
7164
public static InputStream getConfigStream(File file) throws Exception {
7265
return new FileInputStream(Objects.requireNonNull(file));
7366
}
7467

75-
76-
7768
/**
7869
* Returns a JGroups XML configuration InputStream based on the provided properties string.
7970
*
@@ -109,7 +100,6 @@ public static InputStream getConfigStream(String properties) throws IOException
109100
return configStream;
110101
}
111102

112-
113103
public static InputStream getConfigStream(Object properties) throws IOException {
114104
InputStream input=null;
115105

@@ -148,9 +138,6 @@ public static InputStream getConfigStream(Object properties) throws IOException
148138
return new ByteArrayInputStream(((String)properties).getBytes());
149139
}
150140

151-
152-
153-
154141
/**
155142
* Returns an XmlConfigurator based on the provided properties string (if possible).
156143
*
@@ -163,34 +150,14 @@ public static InputStream getConfigStream(Object properties) throws IOException
163150
* JGroups XML configuration pointed to by the URL can not be parsed.
164151
*/
165152
static XmlConfigurator getXmlConfigurator(String properties) throws IOException {
166-
XmlConfigurator returnValue=null;
167153
try(InputStream configStream=getConfigStream(properties)) {
168154
if(configStream == null && properties.endsWith("xml"))
169155
throw new FileNotFoundException(String.format(Util.getMessage("FileNotFound"), properties));
170156

171-
if(configStream != null) {
172-
checkJAXPAvailability();
173-
returnValue=XmlConfigurator.getInstance(configStream);
174-
}
175-
}
176-
return returnValue;
177-
}
178-
179-
180-
181-
/**
182-
* Checks the availability of the JAXP classes on the classpath.
183-
* @throws NoClassDefFoundError if the required JAXP classes are not availabile on the classpath.
184-
*/
185-
static void checkJAXPAvailability() {
186-
try {
187-
XmlConfigurator.class.getName();
188-
}
189-
catch (NoClassDefFoundError error) {
190-
Error tmp=new NoClassDefFoundError(JAXP_MISSING_ERROR_MSG);
191-
tmp.initCause(error);
192-
throw tmp;
157+
if(configStream != null)
158+
return XmlConfigurator.getInstance(configStream);
193159
}
160+
return null;
194161
}
195162

196163
}

0 commit comments

Comments
 (0)