# HG changeset patch # User Ed Swartz # Date 1259786008 21600 # Node ID f8c3b14b4f6ba945c3b96445229a9f5bca297d95 # Parent b428e782ad22134fb9deef9952ce9fca21a3e296 Ensure uid3 is lowercase in templates. Also fix some bugs related to validating UID3. If the user enters a non-0x prefixed string, this is not always detected, and a UID3 range check warning indicates a different string was parsed (dropping the first two chars as if 0x was there). diff -r b428e782ad22 -r f8c3b14b4f6b core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java --- a/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java Wed Dec 02 13:49:43 2009 -0600 +++ b/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java Wed Dec 02 14:33:28 2009 -0600 @@ -117,9 +117,10 @@ values.put(type.getId(), value); if (type instanceof UidFieldType) { + values.put(type.getId(), value.toLowerCase()); // least hacky way to support this without creating a language out of templates values.put(type.getId() + UIDComposite.WITHOUT_0X_PREFIX, - UIDComposite.getWithout0x(value)); + UIDComposite.getWithout0x(value).toLowerCase()); } } @@ -284,7 +285,10 @@ @Override public String getValue() { - return UIDComposite.makeCanonicalHexString(super.getValue().trim()); + String value = super.getValue().trim(); + if (!UIDComposite.isValidHexString(value)) + return value; + return UIDComposite.makeCanonicalHexString(value); } @Override diff -r b428e782ad22 -r f8c3b14b4f6b core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/UIDComposite.java --- a/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/UIDComposite.java Wed Dec 02 13:49:43 2009 -0600 +++ b/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/UIDComposite.java Wed Dec 02 14:33:28 2009 -0600 @@ -163,7 +163,9 @@ } public static String getWithout0x(String with0x) { - Check.checkContract(with0x.startsWith(HEX_PREFIX)); + // may not be valid... + if (!with0x.startsWith(HEX_PREFIX)) + return with0x; return with0x.substring(HEX_PREFIX.length()); }