Package javax.jcr

Examples of javax.jcr.InvalidSerializedDataException


            if (e != null && e instanceof RepositoryException) {
                throw (RepositoryException) e;
            } else {
                String msg = "failed to parse XML stream";
                log.debug(msg);
                throw new InvalidSerializedDataException(msg, se);
            }
        } catch (ParserConfigurationException e) {
            throw new RepositoryException("SAX parser configuration error", e);
        }
    }
View Full Code Here


            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
            } else if (exception instanceof IOException) {
                throw (IOException) exception;
            } else {
                throw new InvalidSerializedDataException("XML parse error", e);
            }
        } finally {
            // JCR-2903
            if (in != null) {
                try {
View Full Code Here

            } else if (exception instanceof IOException) {
                throw (IOException) exception;
            } else if (exception instanceof CommitFailedException) {
                throw ((CommitFailedException) exception).asRepositoryException();
            } else {
                throw new InvalidSerializedDataException("XML parse error", e);
            }
        } finally {
            // JCR-2903
            if (in != null) {
                try {
View Full Code Here

            if (e != null && e instanceof RepositoryException) {
                throw (RepositoryException) e;
            } else {
                String msg = "failed to parse XML stream";
                log.debug(msg);
                throw new InvalidSerializedDataException(msg, se);
            }
        } catch (ParserConfigurationException e) {
            throw new RepositoryException("SAX parser configuration error", e);
        }
    }
View Full Code Here

            // sv:node element

            // node name (value of sv:name attribute)
            String svName = getAttribute(atts, NamespaceConstants.NAMESPACE_SV, "name");
            if (svName == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:name attribute of element sv:node"));
            }

            if (!stack.isEmpty()) {
                // process current node first
                ImportState current = stack.peek();
                // need to start current node
                if (!current.started) {
                    processNode(current, true, false);
                    current.started = true;
                }
            }

            // push new ImportState instance onto the stack
            ImportState state = new ImportState();
            try {
                state.nodeName = new NameInfo(svName).getRepoQualifiedName();
            } catch (RepositoryException e) {
                throw new SAXException(new InvalidSerializedDataException("illegal node name: " + svName, e));
            }
            stack.push(state);
        } else if (namespaceURI.equals(NamespaceConstants.NAMESPACE_SV) && "property".equals(localName)) {
            // sv:property element

            // reset temp fields
            currentPropValues.clear();

            // property name (value of sv:name attribute)
            String svName = getAttribute(atts, NamespaceConstants.NAMESPACE_SV, "name");
            if (svName == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:name attribute of element sv:property"));
            }
            try {
                currentPropName = new NameInfo(svName);
            } catch (RepositoryException e) {
                throw new SAXException(new InvalidSerializedDataException("illegal property name: " + svName, e));
            }
            // property type (sv:type attribute)
            String type = getAttribute(atts, NamespaceConstants.NAMESPACE_SV, "type");
            if (type == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:type attribute of element sv:property"));
            }
            try {
                currentPropType = PropertyType.valueFromName(type);
            } catch (IllegalArgumentException e) {
                throw new SAXException(new InvalidSerializedDataException(
                        "Unknown property type: " + type, e));
            }
            // 'multi-value' hint (sv:multiple attribute)
            String multiple = getAttribute(atts, NamespaceConstants.NAMESPACE_SV, "multiple");
            if (multiple != null) {
                currentPropMultipleStatus = PropInfo.MultipleStatus.MULTIPLE;
            } else {
                currentPropMultipleStatus = PropInfo.MultipleStatus.UNKNOWN;
            }
        } else if (namespaceURI.equals(NamespaceConstants.NAMESPACE_SV) && "value".equals(localName)) {
            // sv:value element
            currentPropValue = new BufferedStringValue(valueFactory, currentNamePathMapper());
            String xsiType = atts.getValue("xsi:type");
            currentPropValue.setBase64("xs:base64Binary".equals(xsiType));
        } else {
            throw new SAXException(new InvalidSerializedDataException(
                    "Unexpected element in system view xml document: {" + namespaceURI + '}' + localName));
        }
    }
View Full Code Here

                String s = null;
                try {
                    s = val.retrieve();
                    state.nodeTypeName = new NameInfo(s).getRepoQualifiedName();
                } catch (IOException e) {
                    throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, e));
                } catch (RepositoryException e) {
                    throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, e));
                }
            } else if (currentPropName != null
                    && currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
                    && currentPropName.getLocalName().equals("mixinTypes")) {
                if (state.mixinNames == null) {
                    state.mixinNames = new ArrayList<String>(currentPropValues.size());
                }
                for (BufferedStringValue val : currentPropValues) {
                    String s = null;
                    try {
                        s = val.retrieve();
                        state.mixinNames.add(new NameInfo(s).getRepoQualifiedName());
                    } catch (IOException ioe) {
                        throw new SAXException("error while retrieving value", ioe);
                    } catch (RepositoryException e) {
                        throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, e));
                    }
                }
            } else if (currentPropName != null
                    && currentPropName.getNamespaceUri().equals(NamespaceRegistry.NAMESPACE_JCR)
                    && currentPropName.getLocalName().equals("uuid")) {
                BufferedStringValue val = currentPropValues.get(0);
                try {
                    state.uuid = val.retrieve();
                } catch (IOException ioe) {
                    throw new SAXException("error while retrieving value", ioe);
                }
            } else {
                if (currentPropMultipleStatus == PropInfo.MultipleStatus.UNKNOWN
                        && currentPropValues.size() != 1) {
                    currentPropMultipleStatus = PropInfo.MultipleStatus.MULTIPLE;
                }
                PropInfo prop = new PropInfo(
                        currentPropName == null ? null : currentPropName.getRepoQualifiedName(),
                        currentPropType,
                        currentPropValues.toArray(new TextValue[currentPropValues.size()]),
                        currentPropMultipleStatus);
                state.props.add(prop);
            }
            // reset temp fields
            currentPropValues.clear();
        } else if (namespaceURI.equals(NamespaceConstants.NAMESPACE_SV) && "value".equals(localName)) {
            // sv:value element
            currentPropValues.add(currentPropValue);
            // reset temp fields
            currentPropValue = null;
        } else {
            throw new SAXException(new InvalidSerializedDataException("invalid element in system view xml document: " + localName));
        }
    }
View Full Code Here

            if (exception instanceof RepositoryException) {
                throw (RepositoryException) exception;
            } else if (exception instanceof IOException) {
                throw (IOException) exception;
            } else {
                throw new InvalidSerializedDataException("XML parse error", e);
            }
        } finally {
            // JCR-2903
            if (in != null) {
                try {
View Full Code Here

    public void startElement(String namespaceURI, String localName,
                             String qName, Attributes atts)
            throws SAXException {
        // check namespace
        if (!QName.NS_SV_URI.equals(namespaceURI)) {
            throw new SAXException(new InvalidSerializedDataException("invalid namespace for element in system view xml document: "
                    + namespaceURI));
        }
        // check element name
        if (SysViewSAXEventGenerator.NODE_ELEMENT.equals(localName)) {
            // sv:node element

            // node name (value of sv:name attribute)
            String name = atts.getValue(SysViewSAXEventGenerator.PREFIXED_NAME_ATTRIBUTE);
            if (name == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:name attribute of element sv:node"));
            }

            if (!stack.isEmpty()) {
                // process current node first
                ImportState current = (ImportState) stack.peek();
                // need to start current node
                if (!current.started) {
                    processNode(current, true, false);
                    current.started = true;
                }
            }

            // push new ImportState instance onto the stack
            ImportState state = new ImportState();
            try {
                state.nodeName = NameFormat.parse(name, nsContext);
            } catch (IllegalNameException ine) {
                throw new SAXException(new InvalidSerializedDataException("illegal node name: " + name, ine));
            } catch (UnknownPrefixException upe) {
                throw new SAXException(new InvalidSerializedDataException("illegal node name: " + name, upe));
            }
            stack.push(state);
        } else if (SysViewSAXEventGenerator.PROPERTY_ELEMENT.equals(localName)) {
            // sv:property element

            // reset temp fields
            currentPropValues.clear();

            // property name (value of sv:name attribute)
            String name = atts.getValue(SysViewSAXEventGenerator.PREFIXED_NAME_ATTRIBUTE);
            if (name == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:name attribute of element sv:property"));
            }
            try {
                currentPropName = NameFormat.parse(name, nsContext);
            } catch (IllegalNameException ine) {
                throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, ine));
            } catch (UnknownPrefixException upe) {
                throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, upe));
            }
            // property type (sv:type attribute)
            String type = atts.getValue(SysViewSAXEventGenerator.PREFIXED_TYPE_ATTRIBUTE);
            if (type == null) {
                throw new SAXException(new InvalidSerializedDataException(
                        "missing mandatory sv:type attribute of element sv:property"));
            }
            currentPropType = PropertyType.valueFromName(type);
        } else if (SysViewSAXEventGenerator.VALUE_ELEMENT.equals(localName)) {
            // sv:value element

            // reset temp fields
            currentPropValue = new BufferedStringValue(nsContext);
        } else {
            throw new SAXException(new InvalidSerializedDataException("unexpected element found in system view xml document: "
                    + localName));
        }
    }
View Full Code Here

                    s = val.retrieve();
                    state.nodeTypeName = NameFormat.parse(s, nsContext);
                } catch (IOException ioe) {
                    throw new SAXException("error while retrieving value", ioe);
                } catch (IllegalNameException ine) {
                    throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, ine));
                } catch (UnknownPrefixException upe) {
                    throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, upe));
                }
            } else if (currentPropName.equals(QName.JCR_MIXINTYPES)) {
                if (state.mixinNames == null) {
                    state.mixinNames = new ArrayList(currentPropValues.size());
                }
                for (int i = 0; i < currentPropValues.size(); i++) {
                    BufferedStringValue val =
                            (BufferedStringValue) currentPropValues.get(i);
                    String s = null;
                    try {
                        s = val.retrieve();
                        QName mixin = NameFormat.parse(s, nsContext);
                        state.mixinNames.add(mixin);
                    } catch (IOException ioe) {
                        throw new SAXException("error while retrieving value", ioe);
                    } catch (IllegalNameException ine) {
                        throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, ine));
                    } catch (UnknownPrefixException upe) {
                        throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, upe));
                    }
                }
            } else if (currentPropName.equals(QName.JCR_UUID)) {
                BufferedStringValue val = (BufferedStringValue) currentPropValues.get(0);
                try {
                    state.uuid = val.retrieve();
                } catch (IOException ioe) {
                    throw new SAXException("error while retrieving value", ioe);
                }
            } else {
                PropInfo prop = new PropInfo(
                        currentPropName, currentPropType,
                        (TextValue[]) currentPropValues.toArray(
                                new TextValue[currentPropValues.size()]));
                state.props.add(prop);
            }
            // reset temp fields
            currentPropValues.clear();
        } else if (SysViewSAXEventGenerator.VALUE_ELEMENT.equals(localName)) {
            // sv:value element
            currentPropValues.add(currentPropValue);
            // reset temp fields
            currentPropValue = null;
        } else {
            throw new SAXException(new InvalidSerializedDataException("invalid element in system view xml document: " + localName));
        }
    }
View Full Code Here

            if (e != null && e instanceof RepositoryException) {
                throw (RepositoryException) e;
            } else {
                String msg = "failed to parse XML stream";
                log.debug(msg);
                throw new InvalidSerializedDataException(msg, se);
            }
        } catch (ParserConfigurationException e) {
            throw new RepositoryException("SAX parser configuration error", e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.jcr.InvalidSerializedDataException

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.