Package javax.jcr

Examples of javax.jcr.ValueFormatException


                NodeImpl targetNode = (NodeImpl) target;
                if (targetNode.isNodeType(QName.MIX_REFERENCEABLE)) {
                    InternalValue value = InternalValue.create(new UUID(targetNode.getUUID()));
                    internalSetValue(new InternalValue[]{value}, reqType);
                } else {
                    throw new ValueFormatException("target node must be of node type mix:referenceable");
                }
            } else {
                String msg = "incompatible Node object: " + target;
                log.debug(msg);
                throw new RepositoryException(msg);
            }
        } else {
            throw new ValueFormatException("property must be of type REFERENCE");
        }
    }
View Full Code Here


                    valueType = values[i].getType();
                } else if (valueType != values[i].getType()) {
                    // inhomogeneous types
                    String msg = "inhomogeneous type of values";
                    log.debug(msg);
                    throw new ValueFormatException(msg);
                }
            }
        }

        int reqType = definition.getRequiredType();
View Full Code Here

        // check state of this instance
        sanityCheck();

        // check multi-value flag
        if (definition.isMultiple()) {
            throw new ValueFormatException(safeGetJCRPath() + " is multi-valued");
        }

        InternalValue[] values = ((PropertyState) state).getValues();
        if (values.length == 0) {
            // should never be the case, but being a little paranoid can't hurt...
View Full Code Here

        // check state of this instance
        sanityCheck();

        // check multi-value flag
        if (!definition.isMultiple()) {
            throw new ValueFormatException(safeGetJCRPath() + " is not multi-valued");
        }

        InternalValue[] values = ((PropertyState) state).getValues();
        long[] lengths = new long[values.length];
        for (int i = 0; i < values.length; i++) {
View Full Code Here

                                // ignore
                            }
                        }
                    }
                } catch (IOException ioe) {
                    throw new ValueFormatException(ioe.getMessage());
                }
            case PropertyType.BOOLEAN:
                return value.getBoolean() ? BOOLEAN_TRUE : BOOLEAN_FALSE;
            case PropertyType.DATE:
                return new InternalValue(value.getDate());
            case PropertyType.DOUBLE:
                return new InternalValue(value.getDouble());
            case PropertyType.LONG:
                return new InternalValue(value.getLong());
            case PropertyType.REFERENCE:
                return new InternalValue(new UUID(value.getString()));
            case PropertyType.NAME:
                try {
                    return new InternalValue(NameFormat.parse(value.getString(), nsResolver));
                } catch (IllegalNameException ine) {
                    throw new ValueFormatException(ine.getMessage());
                } catch (UnknownPrefixException upe) {
                    throw new ValueFormatException(upe.getMessage());
                }
            case PropertyType.PATH:
                try {
                    return new InternalValue(PathFormat.parse(value.getString(), nsResolver));
                } catch (MalformedPathException mpe) {
                    throw new ValueFormatException(mpe.getMessage());
                }
            case PropertyType.STRING:
                return new InternalValue(value.getString());

            default:
View Full Code Here

            return (Name) val;
        } else {
            try {
                return AbstractQValueFactory.NAME_FACTORY.create(getString());
            } catch (IllegalArgumentException e) {
                throw new ValueFormatException("not a valid Name value: " + getString(), e);
            }
        }
    }
View Full Code Here

            cal.setTimeInMillis(((BigDecimal) val).longValue());
            return cal;
        } else {
            Calendar cal = ISO8601.parse(getString());
            if (cal == null) {
                throw new ValueFormatException("not a date string: " + getString());
            } else {
                return cal;
            }
        }
    }
View Full Code Here

            return new BigDecimal(((Calendar) val).getTimeInMillis());
        } else {
            try {
                return new BigDecimal(getString());
            } catch (NumberFormatException e) {
                throw new ValueFormatException("not a valid decimal string: " + getString(), e);
            }
        }
    }
View Full Code Here

            return (URI) val;
        } else {
            try {
                return URI.create(getString());
            } catch (IllegalArgumentException e) {
                throw new ValueFormatException("not a valid uri: " + getString(), e);
            }
        }
    }
View Full Code Here

            return ((BigDecimal) val).doubleValue();
        } else {
            try {
                return Double.parseDouble(getString());
            } catch (NumberFormatException ex) {
                throw new ValueFormatException("not a double: " + getString(), ex);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.jcr.ValueFormatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.