Skip to content

Commit 759e262

Browse files
committed
Revert "removed extra libraries for XML"
This reverts commit 75acda5.
1 parent 0181356 commit 759e262

File tree

5 files changed

+71
-6
lines changed

5 files changed

+71
-6
lines changed

jcp/pom.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@
155155
<artifactId>commons-codec</artifactId>
156156
<version>1.16.0</version>
157157
</dependency>
158+
<dependency>
159+
<groupId>xerces</groupId>
160+
<artifactId>xercesImpl</artifactId>
161+
<version>2.12.2</version>
162+
</dependency>
163+
<dependency>
164+
<groupId>xalan</groupId>
165+
<artifactId>xalan</artifactId>
166+
<version>2.7.2</version>
167+
<exclusions>
168+
<exclusion>
169+
<groupId>xml-apis</groupId>
170+
<artifactId>xml-apis</artifactId>
171+
</exclusion>
172+
</exclusions>
173+
</dependency>
174+
<dependency>
175+
<groupId>xml-apis</groupId>
176+
<artifactId>xml-apis</artifactId>
177+
<version>1.4.01</version>
178+
</dependency>
158179
<dependency>
159180
<groupId>org.projectlombok</groupId>
160181
<artifactId>lombok</artifactId>
@@ -341,6 +362,10 @@
341362
</goals>
342363
<configuration>
343364
<relocations>
365+
<relocation>
366+
<pattern>javax.xml</pattern>
367+
<shadedPattern>hidden.jcp.javax.xml</shadedPattern>
368+
</relocation>
344369
<relocation>
345370
<pattern>org.apache.commons</pattern>
346371
<shadedPattern>hidden.jcp.org.apache.commons</shadedPattern>
@@ -349,10 +374,46 @@
349374
<pattern>license</pattern>
350375
<shadedPattern>hidden.jcp.license</shadedPattern>
351376
</relocation>
377+
<relocation>
378+
<pattern>org.xml</pattern>
379+
<shadedPattern>hidden.jcp.org.xml</shadedPattern>
380+
</relocation>
381+
<relocation>
382+
<pattern>org.apache.xpath</pattern>
383+
<shadedPattern>hidden.jcp.org.apache.xpath</shadedPattern>
384+
</relocation>
385+
<relocation>
386+
<pattern>org.apache.xml</pattern>
387+
<shadedPattern>hidden.jcp.org.apache.xml</shadedPattern>
388+
</relocation>
389+
<relocation>
390+
<pattern>org.apache.wml</pattern>
391+
<shadedPattern>hidden.jcp.org.apache.wml</shadedPattern>
392+
</relocation>
393+
<relocation>
394+
<pattern>org.apache.regexp</pattern>
395+
<shadedPattern>hidden.jcp.org.apache.regexp</shadedPattern>
396+
</relocation>
352397
<relocation>
353398
<pattern>org.apache.html</pattern>
354399
<shadedPattern>hidden.jcp.org.apache.html</shadedPattern>
355400
</relocation>
401+
<relocation>
402+
<pattern>org.apache.bcel</pattern>
403+
<shadedPattern>hidden.jcp.org.apache.bcel</shadedPattern>
404+
</relocation>
405+
<relocation>
406+
<pattern>org.apache.xerces</pattern>
407+
<shadedPattern>hidden.jcp.org.apache.xerces</shadedPattern>
408+
</relocation>
409+
<relocation>
410+
<pattern>org.apache.xalan</pattern>
411+
<shadedPattern>hidden.jcp.org.apache.xalan</shadedPattern>
412+
</relocation>
413+
<relocation>
414+
<pattern>org.w3c</pattern>
415+
<shadedPattern>hidden.jcp.org.w3c</shadedPattern>
416+
</relocation>
356417
<relocation>
357418
<pattern>java_cup</pattern>
358419
<shadedPattern>hidden.jcp.java_cup</shadedPattern>
@@ -373,7 +434,10 @@
373434
<include>commons-codec:*</include>
374435
<include>commons-text:*</include>
375436
<include>org.apache.commons:*</include>
437+
<include>xerces:*</include>
438+
<include>xalan:*</include>
376439
<include>com.igormaznitsa:*</include>
440+
<include>xml-apis:*</include>
377441
</includes>
378442
</artifactSet>
379443
<filters>
@@ -387,7 +451,10 @@
387451
<exclude>META-INF/*.SF</exclude>
388452
<exclude>META-INF/*.DSA</exclude>
389453
<exclude>META-INF/*.RSA</exclude>
454+
<exclude>META-INF/services/javax.xml.*</exclude>
390455
<exclude>META-INF/services/org.apache.*</exclude>
456+
<exclude>META-INF/services/org.w3c.*</exclude>
457+
<exclude>META-INF/services/org.xml.*</exclude>
391458
</excludes>
392459
</filter>
393460
</filters>

jcp/src/main/java/com/igormaznitsa/jcp/expression/functions/xml/AbstractXMLFunction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.xml.xpath.XPathExpression;
2828
import javax.xml.xpath.XPathExpressionException;
2929
import javax.xml.xpath.XPathFactory;
30+
import org.apache.xpath.jaxp.XPathFactoryImpl;
3031
import org.w3c.dom.Document;
3132
import org.w3c.dom.Element;
3233
import org.w3c.dom.Node;
@@ -101,7 +102,7 @@ public static String getFirstLevelTextContent(final Node node) {
101102

102103
protected static XPathExpression prepareXPathExpression(final String path)
103104
throws XPathExpressionException {
104-
final XPathFactory factory = XPathFactory.newInstance();
105+
final XPathFactory factory = new XPathFactoryImpl();
105106
final XPath xpath = factory.newXPath();
106107
return xpath.compile(path);
107108
}

jcp/src/main/java/com/igormaznitsa/jcp/expression/functions/xml/FunctionXML_OPEN.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import com.igormaznitsa.jcp.expression.ValueType;
3030
import java.io.File;
3131
import java.io.IOException;
32-
import javax.xml.parsers.DocumentBuilderFactory;
3332
import javax.xml.parsers.ParserConfigurationException;
33+
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
3434
import org.w3c.dom.Document;
3535
import org.xml.sax.SAXException;
3636

@@ -85,7 +85,7 @@ public Value executeStr(final PreprocessorContext context, final Value filePath)
8585

8686

8787
private Document openFileAndParse(final PreprocessorContext context, final File file) {
88-
final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
88+
final DocumentBuilderFactoryImpl docBuilderFactory = new DocumentBuilderFactoryImpl();
8989
docBuilderFactory.setIgnoringComments(true);
9090
docBuilderFactory.setCoalescing(true);
9191
docBuilderFactory.setValidating(false);

jcp/src/test/java/com/igormaznitsa/jcp/expression/functions/AbstractFunctionTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232
import java.util.Arrays;
3333
import java.util.HashMap;
3434
import java.util.Map;
35-
import org.powermock.core.classloader.annotations.PowerMockIgnore;
3635

3736
import static java.util.Collections.singletonList;
3837
import static org.junit.Assert.*;
3938

40-
@PowerMockIgnore({"com.sun.*","com.oracle.*","javax.*","org.w3c.*", "org.xml.*", "java.*"})
4139
public abstract class AbstractFunctionTest extends AbstractSpyPreprocessorContextTest {
4240

4341
protected static Map<String, Value> var(final Map<String, Value> map, final String name, final Value val) {

jcp/src/test/java/com/igormaznitsa/jcp/expression/functions/xml/AbstractFunctionXMLTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.io.File;
3333
import org.junit.Before;
3434
import org.mockito.stubbing.Answer;
35-
import org.powermock.core.classloader.annotations.PowerMockIgnore;
3635

3736
public abstract class AbstractFunctionXMLTest extends AbstractFunctionTest {
3837

0 commit comments

Comments
 (0)