use of com.sun.enterprise.admin.servermgmt.stringsubs.StringSubstitutionException in project Payara by payara.
the class RadixTreeSubstitutionAlgo method substitute.
@Override
public void substitute(Substitutable substitutable) throws StringSubstitutionException {
Reader reader = substitutable.getReader();
Writer writer = substitutable.getWriter();
RadixTreeSubstitution sub = new RadixTreeSubstitution(_tree);
String output = null;
char[] cbuffer = new char[8192];
int count = 0;
try {
while ((count = reader.read(cbuffer)) > 0) {
for (int i = 0; i < count; i++) {
output = sub.substitute(cbuffer[i]);
if (output != null) {
writer.write(output);
}
}
}
output = sub.substitute(null);
if (output != null) {
writer.write(output);
}
writer.flush();
} catch (IOException e) {
throw new StringSubstitutionException(_strings.get("errorInStringSubstitution", substitutable.getName()), e);
}
}
use of com.sun.enterprise.admin.servermgmt.stringsubs.StringSubstitutionException in project Payara by payara.
the class TestStringSubstitutionParser method testParser.
/**
* Test string subs XML parsing.
*/
@Test
public void testParser() {
StringsubsDefinition def = null;
try {
def = StringSubstitutionParser.parse(_configStream);
} catch (StringSubstitutionException e) {
Assert.fail("Failed to parse xml : " + _stringSubsPath, e);
}
Assert.assertNotNull(def);
Assert.assertNotNull(def.getComponent());
Assert.assertNotNull(def.getVersion());
Assert.assertFalse(def.getChangePair().isEmpty());
}
Aggregations