Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinston Prakash2012-10-04 17:14:00 -0400
committerWinston Prakash2012-10-04 17:14:00 -0400
commit31528bcc73fedde663ea1db783561550f011beb4 (patch)
tree3bcfb4ac45fd5d72e4a722c3c548e9f1d0ec7593
parent6ab24f608301b7c566ae7bfe5e0ed94f5335040d (diff)
parent8f9ce8f8fcf6d21e28c09ee3a38d21b41a429903 (diff)
downloadorg.eclipse.hudson.core-31528bcc73fedde663ea1db783561550f011beb4.tar.gz
org.eclipse.hudson.core-31528bcc73fedde663ea1db783561550f011beb4.tar.xz
org.eclipse.hudson.core-31528bcc73fedde663ea1db783561550f011beb4.zip
Merge branch 'master' of ssh://git.eclipse.org:29418/hudson/org.eclipse.hudson.core
-rw-r--r--hudson-core/pom.xml11
-rw-r--r--hudson-core/src/main/java/hudson/model/Api.java8
-rw-r--r--hudson-core/src/main/java/hudson/tools/JDKInstaller.java10
-rw-r--r--hudson-test-framework/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java10
-rw-r--r--pom.xml2
5 files changed, 34 insertions, 7 deletions
diff --git a/hudson-core/pom.xml b/hudson-core/pom.xml
index e839198a..f4857790 100644
--- a/hudson-core/pom.xml
+++ b/hudson-core/pom.xml
@@ -440,9 +440,18 @@
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.hudsonci.xpath</groupId>
+ <artifactId>xpath-service</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
+ <groupId>org.hudsonci.xpath</groupId>
+ <artifactId>xpath-service</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-fmt</artifactId>
<version>${commons-jelly-tags-fmt.version}</version>
@@ -493,7 +502,7 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.hudsonci.stapler</groupId>
+ <groupId>org.jvnet.hudson</groupId>
<artifactId>commons-jelly-tags-define</artifactId>
<version>${commons-jelly-tags-define.version}</version>
<exclusions>
diff --git a/hudson-core/src/main/java/hudson/model/Api.java b/hudson-core/src/main/java/hudson/model/Api.java
index c10ae1b2..ec44ec1b 100644
--- a/hudson-core/src/main/java/hudson/model/Api.java
+++ b/hudson-core/src/main/java/hudson/model/Api.java
@@ -24,6 +24,7 @@ import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
+import org.hudsonci.xpath.XPath;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
@@ -37,6 +38,7 @@ import java.io.OutputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.List;
+import org.hudsonci.xpath.XPathException;
/**
* Used to expose remote access API for ".../api/"
@@ -100,7 +102,7 @@ public class Api extends AbstractModelObject {
// apply exclusions
if (excludes != null) {
for (String exclude : excludes) {
- List<org.dom4j.Node> list = (List<org.dom4j.Node>) dom.selectNodes(exclude);
+ List<org.dom4j.Node> list = (List<org.dom4j.Node>) new XPath(exclude).selectNodes(dom);
for (org.dom4j.Node n : list) {
Element parent = n.getParent();
if (parent != null) {
@@ -113,7 +115,7 @@ public class Api extends AbstractModelObject {
if (xpath == null) {
result = dom;
} else {
- List list = dom.selectNodes(xpath);
+ List list = new XPath(xpath).selectNodes(dom);
if (wrapper != null) {
Element root = DocumentFactory.getInstance().createElement(wrapper);
for (Object o : list) {
@@ -137,6 +139,8 @@ public class Api extends AbstractModelObject {
}
}
+ } catch (XPathException e) {
+ throw new IOException2(e);
} catch (DocumentException e) {
throw new IOException2(e);
}
diff --git a/hudson-core/src/main/java/hudson/tools/JDKInstaller.java b/hudson-core/src/main/java/hudson/tools/JDKInstaller.java
index 8cf6edc0..73a3096c 100644
--- a/hudson-core/src/main/java/hudson/tools/JDKInstaller.java
+++ b/hudson-core/src/main/java/hudson/tools/JDKInstaller.java
@@ -63,6 +63,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sf.json.JSONObject;
+import org.hudsonci.xpath.XPath;
+import org.hudsonci.xpath.XPathException;
/**
* Install JDKs from java.sun.com.
@@ -347,7 +349,7 @@ public class JDKInstaller extends ToolInstaller {
Document dom = domReader.read(tidy.parseDOM(con.getInputStream(), null));
form = null;
- for (Element e : (List<Element>) dom.selectNodes("//form")) {
+ for (Element e : (List<Element>) new XPath("//form").selectNodes(dom)) {
String action = e.attributeValue("action");
LOGGER.fine("Found form:" + action);
if (action.contains("ViewFilteredProducts")) {
@@ -355,6 +357,8 @@ public class JDKInstaller extends ToolInstaller {
break;
}
}
+ } catch (XPathException e) {
+ throw new IOException2("Failed to access (xpath) " + url, e);
} catch (IOException e) {
throw new IOException2("Failed to access " + url, e);
}
@@ -405,7 +409,7 @@ public class JDKInstaller extends ToolInstaller {
}
// the rest
- for (Element e : (List<Element>) form.selectNodes(".//input")) {
+ for (Element e : (List<Element>) new XPath(".//input").selectNodes(form)) {
os.print('&');
os.print(e.attributeValue("name"));
os.print('=');
@@ -417,6 +421,8 @@ public class JDKInstaller extends ToolInstaller {
}
}
return con;
+ } catch (XPathException e) {
+ throw new IOException2("Failed to access (xpath) " + url, e);
} catch (IOException e) {
throw new IOException2("Failed to access " + url, e);
} finally {
diff --git a/hudson-test-framework/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java b/hudson-test-framework/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java
index 438fc77d..e28d32b2 100644
--- a/hudson-test-framework/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java
+++ b/hudson-test-framework/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java
@@ -33,6 +33,10 @@ import java.util.Enumeration;
import java.util.concurrent.Callable;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.hudsonci.xpath.XPath;
+import org.hudsonci.xpath.XPathException;
/**
* Builds up a {@link TestSuite} for performing static syntax checks on Jelly
@@ -97,11 +101,15 @@ public class JellyTestSuiteBuilder {
*/
private void checkLabelFor(Document dom) {
if (isConfigJelly() || isGlobalJelly()) {
- if (!dom.selectNodes("//label[@for]").isEmpty()) {
+ try {
+ if (!new XPath("//label[@for]").selectNodes(dom).isEmpty()) {
throw new AssertionError("<label for=...> shouldn't be used because it doesn't work "
+ "when the configuration item is repeated. Use <label class=\"attach-previous\"> "
+ "to have your label attach to the previous DOM node instead.");
}
+ } catch (XPathException ex) {
+ throw new AssertionError("XPathException evaluating \"//label[@for]\"");
+ }
}
}
diff --git a/pom.xml b/pom.xml
index 7db8bfb1..46c581d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -218,7 +218,7 @@
<commons-jelly.version>1.1-hudson-20120704</commons-jelly.version>
<commons-jelly-tags-fmt.version>1.0</commons-jelly-tags-fmt.version>
<commons-jelly-tags-xml.version>1.1-hudson-20120704</commons-jelly-tags-xml.version>
- <commons-jelly-tags-define.version>1.0.1-hudson-20120704</commons-jelly-tags-define.version>
+ <commons-jelly-tags-define.version>1.0.1-hudson-20071021</commons-jelly-tags-define.version>
<commons-jexl.version>2.0.1</commons-jexl.version>
<commons-logging.version>1.1.1</commons-logging.version>
<commons-collections.version>3.2</commons-collections.version>

Back to the top