Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/pom.xml b/pom.xml
- index 20bfbfe..a700b9f 100644
- --- a/pom.xml
- +++ b/pom.xml
- @@ -3,7 +3,7 @@
- <modelVersion>4.0.0</modelVersion>
- <groupId>ru.andreymarkelov.atlas.plugins</groupId>
- <artifactId>requestedfields</artifactId>
- - <version>1.1.8</version>
- + <version>1.1.8.3</version>
- <packaging>atlassian-plugin</packaging>
- <organization>
- @@ -15,12 +15,30 @@
- <description>Feed select list options using HTTP via JSON or XML</description>
- <dependencies>
- + <dependency>
- + <groupId>net.sf.saxon</groupId>
- + <artifactId>Saxon-HE</artifactId>
- + <version>9.4</version>
- + <exclusions>
- + <exclusion>
- + <artifactId>xml-apis</artifactId>
- + <groupId>xml-apis</groupId>
- + </exclusion>
- + <!-- exclusion>
- + <artifactId>xerces</artifactId>
- + <groupId>xercesImpl</groupId>
- + </exclusion>
- + <exclusion>
- + <artifactId>xalan</artifactId>
- + <groupId>xalan</groupId>
- + </exclusion-->
- + </exclusions>
- + </dependency>
- <dependency>
- - <groupId>net.sf.saxon</groupId>
- - <artifactId>Saxon-HE</artifactId>
- - <version>9.4</version>
- + <groupId>dom4j</groupId>
- + <artifactId>dom4j</artifactId>
- + <version>1.6.1</version>
- </dependency>
- -
- <dependency>
- <groupId>com.atlassian.jira</groupId>
- <artifactId>jira-api</artifactId>
- @@ -113,7 +131,7 @@
- </build>
- <properties>
- - <jira.version>5.2.8</jira.version>
- + <jira.version>5.2.4</jira.version>
- <!-- <jira.version>6.2-OD-01</jira.version> -->
- <amps.version>4.1.6</amps.version>
- <useFastdevCli>false</useFastdevCli>
- diff --git a/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/UniversalNamespaceCache.java b/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/UniversalNamespaceCache.java
- index a267ad7..5b379df 100644
- --- a/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/UniversalNamespaceCache.java
- +++ b/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/UniversalNamespaceCache.java
- @@ -2,7 +2,7 @@ package ru.andreymarkelov.atlas.plugins.requestedfiedls;
- //This is from http://www.ibm.com/developerworks/java/library/x-nmspccontext/
- // written by Holger Kraus
- -// reworked for saxon interfaces by Ărpád Magosányi
- +// reworked for saxon interfaces by Arpad Magosanyi
- import java.util.HashMap;
- import java.util.Iterator;
- @@ -35,11 +35,6 @@ public class UniversalNamespaceCache implements NamespaceContext {
- public UniversalNamespaceCache(XdmNode source, boolean toplevelOnly) {
- examineNode(source, toplevelOnly);
- - System.out.println("The list of the cached namespaces:");
- - for (String key : prefix2Uri.keySet()) {
- - System.out
- - .println("prefix " + key + ": uri " + prefix2Uri.get(key));
- - }
- }
- /**
- @@ -52,10 +47,8 @@ public class UniversalNamespaceCache implements NamespaceContext {
- */
- private void examineNode(XdmNode source, boolean attributesOnly) {
- XdmSequenceIterator attributes = source.axisIterator(Axis.NAMESPACE);
- - System.out.printf("source=%s\nkind=%s\nattrs=%s\n",source.getUnderlyingNode(), source.getNodeKind(), attributes.hasNext());
- while (attributes.hasNext()) {
- NamespaceNode attribute = (NamespaceNode) ((XdmNode) attributes.next()).getUnderlyingNode();
- - System.out.printf("att=%s\n", attribute);
- storeAttribute(attribute);
- }
- @@ -63,7 +56,6 @@ public class UniversalNamespaceCache implements NamespaceContext {
- XdmSequenceIterator chields = source.axisIterator(Axis.CHILD);
- while (chields.hasNext()) {
- XdmNode chield = (XdmNode) chields.next();
- - System.out.printf("chield:%s\n", chield);
- if(chield.getNodeKind() == XdmNodeKind.ELEMENT)
- examineNode((XdmNode) chield, false);
- }
- @@ -79,8 +71,6 @@ public class UniversalNamespaceCache implements NamespaceContext {
- */
- private void storeAttribute(NamespaceNode attribute) {
- // examine the attributes in namespace xmlns
- - System.out.printf("prefix=%s\n",attribute.getLocalPart());
- - System.out.printf("uri=%s\n",attribute.getStringValue());
- putInCache(attribute.getLocalPart(),attribute.getStringValue());
- }
- diff --git a/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunner.java b/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunner.java
- index 095d158..c889e64 100644
- --- a/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunner.java
- +++ b/src/main/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunner.java
- @@ -1,28 +1,25 @@
- package ru.andreymarkelov.atlas.plugins.requestedfiedls;
- +import java.io.InputStream;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- -import javax.xml.parsers.DocumentBuilderFactory;
- -import javax.xml.transform.stream.StreamSource;
- +import javax.xml.transform.sax.SAXSource;
- -import net.sf.saxon.om.NodeInfo;
- -import net.sf.saxon.s9api.Axis;
- +import net.sf.saxon.s9api.DocumentBuilder;
- import net.sf.saxon.s9api.Processor;
- import net.sf.saxon.s9api.XPathCompiler;
- import net.sf.saxon.s9api.XPathExecutable;
- import net.sf.saxon.s9api.XPathSelector;
- import net.sf.saxon.s9api.XdmItem;
- import net.sf.saxon.s9api.XdmNode;
- -import net.sf.saxon.tree.tiny.TinyElementImpl;
- import org.apache.commons.io.IOUtils;
- import org.apache.commons.lang.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- -import org.w3c.dom.Document;
- -import org.w3c.dom.Node;
- +import org.xml.sax.InputSource;
- public class XmlHttpRunner {
- private static final Logger log = LoggerFactory.getLogger(XmlHttpRunner.class);
- @@ -50,11 +47,12 @@ public class XmlHttpRunner {
- try {
- String xml = httpService.call(data.getReqData());
- List<String> vals = new ArrayList<String>();
- - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- - factory.setNamespaceAware(true);
- Processor proc = new Processor(false);
- - net.sf.saxon.s9api.DocumentBuilder s9builder = proc.newDocumentBuilder();
- - XdmNode source = proc.newDocumentBuilder().build(new StreamSource(IOUtils.toInputStream(xml)));
- + DocumentBuilder docbuilder = proc.newDocumentBuilder();
- + InputStream inputStream = IOUtils.toInputStream(xml);
- + InputSource inputSource = new InputSource(inputStream);
- + SAXSource streamSource = new SAXSource(inputSource);
- + XdmNode source = docbuilder.build(streamSource);
- XPathCompiler compiler = proc.newXPathCompiler();
- @@ -69,7 +67,6 @@ public class XmlHttpRunner {
- selector.setContextItem(source);
- selector.evaluate();
- for (XdmItem item : selector) {
- - System.out.printf("item=%s\n", item);
- String nodeText = item.getStringValue();
- if (!StringUtils.isEmpty(nodeText)) {
- vals.add(nodeText);
- diff --git a/src/test/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunnerTest.java b/src/test/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunnerTest.java
- index 95854ef..1ff8450 100644
- --- a/src/test/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunnerTest.java
- +++ b/src/test/java/ru/andreymarkelov/atlas/plugins/requestedfiedls/XmlHttpRunnerTest.java
- @@ -110,7 +110,7 @@ public class XmlHttpRunnerTest {
- Object defValue = "Default Value";
- XmlHttpRunner runner = new XmlHttpRunner(data, defValue, mockSender);
- HttpRunnerData returned = runner.getData();
- - System.out.printf("returned: %s\n", returned);
- + //System.out.printf("returned: %s\n", returned);
- assertEquals(expected, returned.getVals());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement