Skip to content

Commit

Permalink
[CXF-4699] Fix non-dom level 3 issues in BusDefParser
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1423065 13f79535-47bb-0310-9956-ffa450edef68
dkulp committed Dec 17, 2012
1 parent 279c83b commit 58e2881
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -79,9 +79,13 @@ protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder
bean.addConstructorArgValue(bus);
} else if (!"cxf".equals(bus)) {
bean.getRawBeanDefinition().setBeanClass(SpringBus.class);
bean.getRawBeanDefinition().getPropertyValues().removePropertyValue("bus");
bean.setDestroyMethodName("shutdown");
element.setUserData("ID", bus, null);
try {
element.setUserData("ID", bus, null);
bean.getRawBeanDefinition().getPropertyValues().removePropertyValue("bus");
} catch (Throwable t) {
//likely not DOM level 3, ignore
}
} else {
addBusWiringAttribute(bean, BusWiringType.PROPERTY, bus, ctx);
bean.getRawBeanDefinition().setAttribute(WIRE_BUS_CREATE,
@@ -122,7 +126,12 @@ protected void mapElement(ParserContext ctx,
@Override
protected String resolveId(Element element, AbstractBeanDefinition definition,
ParserContext ctx) {
String bus = (String)element.getUserData("ID");
String bus = null;
try {
bus = (String)element.getUserData("ID");
} catch (Throwable t) {
//ignore
}
if (bus == null) {
bus = element.getAttribute("bus");
if (StringUtils.isEmpty(bus)) {
@@ -133,7 +142,11 @@ protected String resolveId(Element element, AbstractBeanDefinition definition,
} else {
bus = bus + ".config";
}
element.setUserData("ID", bus, null);
try {
element.setUserData("ID", bus, null);
} catch (Throwable t) {
//maybe no DOM level 3, ignore, but, may have issues with the counter
}
}
return bus;
}

0 comments on commit 58e2881

Please sign in to comment.