Package org.apache.chemistry.opencmis.commons.impl.json.parser

Examples of org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser


     * Converts an error message or a HTTP status code into an Exception.
     */
    protected CmisBaseException convertStatusCode(int code, String message, String errorContent, Throwable t) {
        Object obj = null;
        try {
            JSONParser parser = new JSONParser();
            obj = parser.parse(errorContent);
        } catch (Exception pe) {
        }

        if (obj instanceof JSONObject) {
            JSONObject json = (JSONObject) obj;
View Full Code Here


        InputStreamReader reader = null;

        Object obj = null;
        try {
            reader = new InputStreamReader(stream, charset);
            JSONParser parser = new JSONParser();
            obj = parser.parse(reader, containerFactory);
        } catch (Exception e) {
            throw new CmisConnectionException("Parsing exception!", e);
        } finally {
            try {
                char[] buffer = new char[4096];
View Full Code Here

    public static TypeDefinition readFromJSON(InputStream stream) throws Exception {
        if (stream == null) {
            throw new IllegalArgumentException("Input stream must be set!");
        }

        JSONParser parser = new JSONParser();
        Object json = parser.parse(new InputStreamReader(stream, "UTF-8"));

        if (!(json instanceof Map)) {
            throw new CmisRuntimeException("Invalid stream! Not a type definition!");
        }
View Full Code Here

        if (typeStr == null) {
            throw new CmisInvalidArgumentException("Type definition missing!");
        }

        // convert type definition
        JSONParser parser = new JSONParser();
        Object typeJson = parser.parse(typeStr);
        if (!(typeJson instanceof Map)) {
            throw new CmisInvalidArgumentException("Invalid type definition!");
        }

        @SuppressWarnings("unchecked")
View Full Code Here

        if (typeStr == null) {
            throw new CmisInvalidArgumentException("Type definition missing!");
        }

        // convert type definition
        JSONParser parser = new JSONParser();
        Object typeJson = parser.parse(typeStr);
        if (!(typeJson instanceof Map)) {
            throw new CmisInvalidArgumentException("Invalid type definition!");
        }

        @SuppressWarnings("unchecked")
View Full Code Here

     * Converts an error message or a HTTP status code into an Exception.
     */
    protected CmisBaseException convertStatusCode(int code, String message, String errorContent, Throwable t) {
        Object obj = null;
        try {
            JSONParser parser = new JSONParser();
            obj = parser.parse(errorContent);
        } catch (Exception pe) {
        }

        if (obj instanceof JSONObject) {
            JSONObject json = (JSONObject) obj;
View Full Code Here

        InputStreamReader reader = null;

        Object obj = null;
        try {
            reader = new InputStreamReader(stream, charset);
            JSONParser parser = new JSONParser();
            obj = parser.parse(reader, containerFactory);
        } catch (Exception e) {
            throw new CmisConnectionException("Parsing exception!", e);
        } finally {
            try {
                char[] buffer = new char[4096];
View Full Code Here

    public static TypeDefinition readFromJSON(InputStream stream) throws IOException, JSONParseException {
        if (stream == null) {
            throw new IllegalArgumentException("Input stream must be set!");
        }

        JSONParser parser = new JSONParser();
        Object json = parser.parse(new InputStreamReader(stream, IOUtils.UTF8));

        if (!(json instanceof Map)) {
            throw new CmisRuntimeException("Invalid stream! Not a type definition!");
        }
View Full Code Here

     *         java.lang.Boolean, null
     *
     */
    public static Object parse(Reader in) {
        try {
            JSONParser parser = new JSONParser();
            return parser.parse(in);
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

     *
     * @throws IOException
     * @throws JSONParseException
     */
    public static Object parseWithException(Reader in) throws IOException, JSONParseException {
        JSONParser parser = new JSONParser();
        return parser.parse(in);
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser

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.