Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java (revision 602118) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java (working copy) @@ -377,7 +377,7 @@ case PropertyType.PATH: return PathValue.valueOf(resolver.getJCRPath((Path) val)); case PropertyType.NAME: - return NameValue.valueOf(resolver.getJCRName((Name) val)); + return NameValue.valueOf(resolver.getJCRName((Name) val), false); case PropertyType.STRING: return new StringValue((String) val); default: Index: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java =================================================================== --- jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java (revision 602118) +++ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java (working copy) @@ -51,11 +51,33 @@ * name. */ public static NameValue valueOf(String s) throws ValueFormatException { + return valueOf(s, true); + } + + /** + * Returns a new NameValue initialized to the value represented + * by the specified String. + *

+ * If checkFormat is true specified + * String must be a valid JCR name, otherwise the string is + * used as is. + * + * @param s the string to be parsed. + * @param checkFormat if the format should be checked. + * @return a newly constructed NameValue representing the the + * specified value. + * @throws javax.jcr.ValueFormatException If the format should be checked + * and the String is not + * a valid name. + */ + public static NameValue valueOf(String s, boolean checkFormat) throws ValueFormatException { if (s != null) { - try { - NameFormat.checkFormat(s); - } catch (IllegalNameException ine) { - throw new ValueFormatException(ine.getMessage()); + if (checkFormat) { + try { + NameFormat.checkFormat(s); + } catch (IllegalNameException ine) { + throw new ValueFormatException(ine.getMessage()); + } } return new NameValue(s); } else {