AssociationRef parsing error due to addition of 'id' in format

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20557 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-06-08 14:17:10 +00:00
parent bc7235472b
commit 6d89f9d970

View File

@@ -77,16 +77,21 @@ public class AssociationRef implements EntityRef, Serializable
} }
/** /**
* @param childAssocRefStr a string of the form <b>sourceNodeRef|targetNodeRef|assocTypeQName</b> * @param childAssocRefStr a string of the form <b>id|sourceNodeRef|targetNodeRef|assocTypeQName</b>.
*/ */
public AssociationRef(String assocRefStr) public AssociationRef(String assocRefStr)
{ {
StringTokenizer tokenizer = new StringTokenizer(assocRefStr, FILLER); StringTokenizer tokenizer = new StringTokenizer(assocRefStr, FILLER);
if (tokenizer.countTokens() != 3) if (tokenizer.countTokens() != 3 && tokenizer.countTokens() != 4)
{ {
throw new AlfrescoRuntimeException("Unable to parse association string: " + assocRefStr); throw new AlfrescoRuntimeException("Unable to parse association string: " + assocRefStr);
} }
String idStr = tokenizer.nextToken();
String idStr = "0";
if (tokenizer.countTokens() == 4)
{
idStr = tokenizer.nextToken();
}
String sourceNodeRefStr = tokenizer.nextToken(); String sourceNodeRefStr = tokenizer.nextToken();
String targetNodeRefStr = tokenizer.nextToken(); String targetNodeRefStr = tokenizer.nextToken();
String assocTypeQNameStr = tokenizer.nextToken(); String assocTypeQNameStr = tokenizer.nextToken();