Skip to content

Commit

Permalink
Merge pull request wildfly#17301 from soul2zimate/WFLY-18653-main
Browse files Browse the repository at this point in the history
[WFLY-18653] i18n of exception messages in ApplicationClientParsingDeploymentProcessor
  • Loading branch information
bstansberry authored Oct 25, 2023
2 parents a05545f + 81e04b1 commit f4db62c
Showing 1 changed file with 6 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,12 @@ private ApplicationClientMetaData parseAppClient(DeploymentUnit deploymentUnit,
descriptor = deploymentRoot.getRoot().getChild(APP_XML);
}
if (descriptor.exists()) {
InputStream is = null;
try {
is = descriptor.openStream();
ApplicationClientMetaData data = new ApplicationClientMetaDataParser().parse(getXMLStreamReader(is), propertyReplacer);
return data;
try (InputStream is = descriptor.openStream()) {
return new ApplicationClientMetaDataParser().parse(getXMLStreamReader(is), propertyReplacer);
} catch (XMLStreamException e) {
throw AppClientLogger.ROOT_LOGGER.failedToParseXml(e, descriptor, e.getLocation().getLineNumber(), e.getLocation().getColumnNumber());
} catch (IOException e) {
throw new DeploymentUnitProcessingException("Failed to parse " + descriptor, e);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
throw AppClientLogger.ROOT_LOGGER.failedToParseXml(e, descriptor);
}
} else {
return null;
Expand All @@ -115,24 +104,13 @@ private JBossClientMetaData parseJBossClient(DeploymentUnit deploymentUnit, fina
final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
final VirtualFile appXml = deploymentRoot.getChild(JBOSS_CLIENT_XML);
if (appXml.exists()) {
InputStream is = null;
try {
is = appXml.openStream();
JBossClientMetaData data = new JBossClientMetaDataParser().parse(getXMLStreamReader(is), propertyReplacer);
return data;
try (InputStream is = appXml.openStream()) {
return new JBossClientMetaDataParser().parse(getXMLStreamReader(is), propertyReplacer);
} catch (XMLStreamException e) {
throw AppClientLogger.ROOT_LOGGER.failedToParseXml(e, appXml, e.getLocation().getLineNumber(), e.getLocation().getColumnNumber());

} catch (IOException e) {
throw AppClientLogger.ROOT_LOGGER.failedToParseXml(e, appXml);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
} else {
//we may already have this info from jboss-all.xml
Expand All @@ -143,7 +121,6 @@ private JBossClientMetaData parseJBossClient(DeploymentUnit deploymentUnit, fina
private XMLStreamReader getXMLStreamReader(InputStream is) throws XMLStreamException {
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setXMLResolver(NoopXMLResolver.create());
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
return xmlReader;
return inputFactory.createXMLStreamReader(is);
}
}

0 comments on commit f4db62c

Please sign in to comment.