aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-25 03:33:24 (EST)
committerWinston Prakash2011-12-01 20:47:36 (EST)
commit131628bf145b0b6133549a4b5ea3f53a8c6a2a6e (patch)
tree0a3602d75d464a52ea6ede2bdd553877adad2731
parentc4ac8b8fdc924f46d6bf1b1f345bb954dac03f2a (diff)
downloadorg.eclipse.hudson.core-131628bf145b0b6133549a4b5ea3f53a8c6a2a6e.zip
org.eclipse.hudson.core-131628bf145b0b6133549a4b5ea3f53a8c6a2a6e.tar.gz
org.eclipse.hudson.core-131628bf145b0b6133549a4b5ea3f53a8c6a2a6e.tar.bz2
Resolve HUDSON-8176 (Matrix Projects variables do not Escaped properly the / character in the URL)
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/matrix/Combination.java38
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixProject.java1
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixRun.java2
3 files changed, 34 insertions, 7 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/Combination.java b/hudson-core/src/main/java/hudson/matrix/Combination.java
index 61ad1f3..962381d 100644
--- a/hudson-core/src/main/java/hudson/matrix/Combination.java
+++ b/hudson-core/src/main/java/hudson/matrix/Combination.java
@@ -176,13 +176,39 @@ public final class Combination extends TreeMap<String,String> implements Compara
* The separator between axis name and value.
*/
public String toString(char sep1, char sep2) {
- StringBuilder buf = new StringBuilder();
- for (Map.Entry<String,String> e : entrySet()) {
- if(buf.length()>0) buf.append(sep1);
- buf.append(e.getKey()).append(sep2).append(e.getValue());
+ return toString(sep1, sep2, false);
+ }
+
+ /**
+ * Converts to the ID string representation:
+ * <tt>axisName=value,axisName=value,...</tt>
+ *
+ * @param sep1 The separator between multiple axes.
+ * @param sep2 The separator between axis name and value.
+ * @param encodeValue true to encode value {@link Util#rawEncode(String)}
+ * @return string representation.
+ */
+ public String toString(char sep1, char sep2, boolean encodeValue) {
+ StringBuilder builder = new StringBuilder();
+ if (encodeValue) {
+ for (Map.Entry<String, String> e : entrySet()) {
+ if (builder.length() > 0) {
+ builder.append(sep1);
+ }
+ builder.append(e.getKey()).append(sep2).append(Util.rawEncode(e.getValue()));
+ }
+ } else {
+ for (Map.Entry<String, String> e : entrySet()) {
+ if (builder.length() > 0) {
+ builder.append(sep1);
+ }
+ builder.append(e.getKey()).append(sep2).append(e.getValue());
+ }
}
- if(buf.length()==0) buf.append("default"); // special case to avoid 0-length name.
- return buf.toString();
+ if (builder.length() == 0) {
+ builder.append("default"); // special case to avoid 0-length name.
+ }
+ return builder.toString();
}
@Override
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
index 47ff46f..7f3431c 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
@@ -396,6 +396,7 @@ public class MatrixProject extends BaseBuildableProject<MatrixProject, MatrixBui
return child.isDirectory() && !child.getName().startsWith("axis-");
}
});
+ //TODO seems oldDir is always null and old matrix configuration is not cleared.
if (oldDirs != null) {
// rename the old directory to the new one
for (File dir : oldDirs) {
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixRun.java b/hudson-core/src/main/java/hudson/matrix/MatrixRun.java
index e8e4dd2..42ef5b0 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixRun.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixRun.java
@@ -147,7 +147,7 @@ public class MatrixRun extends Build<MatrixConfiguration,MatrixRun> {
if(useShortWorkspaceName) {
subtree = getParent().getDigestName();
} else {
- subtree = getParent().getCombination().toString('/','/');
+ subtree = getParent().getCombination().toString('/','/', true);
}
String customWorkspace = getParent().getParent().getCustomWorkspace();