FIX bug with spaces in organisation modules or revisions IVY-157

git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Xavier Hanin 2006-01-27 07:53:09 +00:00
parent 570057bdb5
commit 535c0c3433
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,5 @@
- FIX: bug when an organisation or module or revision contains a space (IVY-157)
- slight modification of xsd in attempt to fix IVY-156
- IMPROVE: add regexp management in the install ant task (IVY-154)
version 1.3-RC1 - 2006-01-25

View File

@ -11,6 +11,7 @@ package fr.jayasoft.ivy;
*
*/
public class ModuleId {
static final String ENCODE_SEPARATOR = ":#@#:";
private String _organisation;
private String _name;
private int _hash;
@ -52,12 +53,12 @@ public class ModuleId {
}
public String encodeToString() {
return getOrganisation() + " "+getName();
return getOrganisation() + ENCODE_SEPARATOR + getName();
}
public static ModuleId decode(String encoded) {
String[] parts = encoded.split(" ");
String[] parts = encoded.split(ENCODE_SEPARATOR);
if (parts.length != 2) {
throw new IllegalArgumentException("badly encoded module revision id: '"+encoded+"'");
throw new IllegalArgumentException("badly encoded module id: '"+encoded+"'");
}
return new ModuleId(parts[0], parts[1]);
}

View File

@ -11,6 +11,8 @@ package fr.jayasoft.ivy;
*
*/
public class ModuleRevisionId {
private static final String ENCODE_SEPARATOR = ModuleId.ENCODE_SEPARATOR;
public static ModuleRevisionId newInstance(String organisation, String name, String revision) {
return new ModuleRevisionId(new ModuleId(organisation, name), revision);
}
@ -95,10 +97,10 @@ public class ModuleRevisionId {
return !revision.startsWith("latest.") && !revision.endsWith("+");
}
public String encodeToString() {
return getOrganisation() + " "+getName()+ " "+getRevision();
return getOrganisation() + ENCODE_SEPARATOR+getName()+ ENCODE_SEPARATOR+getRevision();
}
public static ModuleRevisionId decode(String encoded) {
String[] parts = encoded.split(" ");
String[] parts = encoded.split(ENCODE_SEPARATOR);
if (parts.length != 3) {
throw new IllegalArgumentException("badly encoded module revision id: '"+encoded+"'");
}