Skip to content

Commit b05dd88

Browse files
committed
Adjust and use the embedded JXpath
1 parent 048f7ab commit b05dd88

File tree

5 files changed

+4
-36
lines changed

5 files changed

+4
-36
lines changed

bundles/org.eclipse.e4.emf.xpath/META-INF/MANIFEST.MF

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,5 @@ Require-Bundle: org.eclipse.emf.ecore;bundle-version="2.35.0",
99
Export-Package: org.eclipse.e4.emf.internal.xpath;x-internal:=true,
1010
org.eclipse.e4.emf.internal.xpath.helper;x-friends:="org.eclipse.e4.emf.xpath.test,org.eclipse.e4.ui.model.workbench,org.eclipse.e4.ui.workbench",
1111
org.eclipse.e4.emf.xpath
12-
Import-Package: org.apache.commons.jxpath;version="[1.3.0,2.0.0)",
13-
org.apache.commons.jxpath.ri;version="[1.3.0,2.0.0)",
14-
org.apache.commons.jxpath.ri.compiler;version="[1.3.0,2.0.0)",
15-
org.apache.commons.jxpath.ri.model;version="[1.3.0,2.0.0)",
16-
org.apache.commons.jxpath.util;version="[1.3.0,2.0.0)"
1712
Bundle-Vendor: %Bundle-Vendor
1813
Automatic-Module-Name: org.eclipse.e4.emf.xpath

bundles/org.eclipse.e4.emf.xpath/src/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,6 @@ public class JXPathContextReferenceImpl extends JXPathContext {
8888
nodeFactories.add(domFactory);
8989
}
9090

91-
// JDOM factory is only registered if JDOM is on the classpath
92-
final Object jdomFactory = allocateConditionally(
93-
"org.apache.commons.jxpath.ri.model.jdom.JDOMPointerFactory",
94-
"org.jdom.Document");
95-
if (jdomFactory != null) {
96-
nodeFactories.add(jdomFactory);
97-
}
98-
99-
// DynaBean factory is only registered if BeanUtils are on the classpath
100-
final Object dynaBeanFactory =
101-
allocateConditionally(
102-
"org.apache.commons.jxpath.ri.model.dynabeans."
103-
+ "DynaBeanPointerFactory",
104-
"org.apache.commons.beanutils.DynaBean");
105-
if (dynaBeanFactory != null) {
106-
nodeFactories.add(dynaBeanFactory);
107-
}
108-
10991
nodeFactories.add(new ContainerPointerFactory());
11092
createNodeFactoryArray();
11193
}
@@ -119,8 +101,8 @@ private static synchronized void createNodeFactoryArray() {
119101
(NodePointerFactory[]) nodeFactories.
120102
toArray(new NodePointerFactory[nodeFactories.size()]);
121103
Arrays.sort(nodeFactoryArray, (a, b) -> {
122-
final int orderA = ((NodePointerFactory) a).getOrder();
123-
final int orderB = ((NodePointerFactory) b).getOrder();
104+
final int orderA = a.getOrder();
105+
final int orderB = b.getOrder();
124106
return orderA - orderB;
125107
});
126108
}

bundles/org.eclipse.e4.emf.xpath/src/org/apache/commons/jxpath/util/BasicTypeConverter.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import java.util.Set;
3030
import java.util.SortedSet;
3131

32-
import org.apache.commons.beanutils.ConvertUtils;
33-
import org.apache.commons.beanutils.Converter;
3432
import org.apache.commons.jxpath.JXPathInvalidAccessException;
3533
import org.apache.commons.jxpath.JXPathTypeConversionException;
3634
import org.apache.commons.jxpath.NodeSet;
@@ -141,7 +139,7 @@ public boolean canConvert(final Object object, final Class toType) {
141139
if (object instanceof Pointer) {
142140
return canConvert(((Pointer) object).getValue(), useType);
143141
}
144-
return ConvertUtils.lookup(useType) != null;
142+
return false;
145143
}
146144

147145
/**
@@ -268,11 +266,6 @@ public Object convert(final Object object, final Class toType) {
268266
}
269267
}
270268

271-
final Converter converter = ConvertUtils.lookup(useType);
272-
if (converter != null) {
273-
return converter.convert(useType, object);
274-
}
275-
276269
throw new JXPathTypeConversionException("Cannot convert "
277270
+ object.getClass() + " to " + useType);
278271
}

tests/org.eclipse.e4.emf.xpath.test/META-INF/MANIFEST.MF

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Export-Package: org.eclipse.e4.emf.xpath.test.model.xpathtest,
1212
Require-Bundle: org.eclipse.e4.ui.model.workbench,
1313
org.eclipse.e4.emf.xpath,
1414
org.junit,
15-
org.apache.commons.jxpath,
1615
org.eclipse.emf.ecore.xmi,
1716
org.eclipse.core.runtime,
1817
org.eclipse.emf.ecore,

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Iterator;
2424
import java.util.List;
2525

26-
import org.apache.commons.jxpath.JXPathNotFoundException;
2726
import org.eclipse.e4.emf.xpath.EcoreXPathContextFactory;
2827
import org.eclipse.e4.emf.xpath.XPathContext;
2928
import org.eclipse.e4.emf.xpath.XPathContextFactory;
@@ -83,7 +82,7 @@ public void testSimpleQuery() {
8382
assertNotNull(application);
8483
assertSame(RootImpl.class, application.getClass());
8584

86-
assertThrows(JXPathNotFoundException.class, () -> xpathContext.getValue(".[@id='nixda']"));
85+
assertThrows(RuntimeException.class, () -> xpathContext.getValue(".[@id='nixda']"));
8786

8887
application = xpathContext.getValue(".[@id='root']");
8988
assertNotNull(application);

0 commit comments

Comments
 (0)