Examples of JsonParsingException


Examples of javax.json.stream.JsonParsingException

        return is;
    }

    private void readPersonNames(Attributes attrs, int tag) {
        if (next() != Event.START_ARRAY) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected array of person name objects", location);
        }
        for (;;) {
            switch (next()) {
            case END_ARRAY:
                attrs.setString(tag, VR.PN,
                        stringValues.toArray(new String[stringValues.size()]));
                stringValues.clear();
                return;
            case VALUE_NULL:
                stringValues.add(null);
                break;
            case START_OBJECT:
                stringValues.add(readPersonName());
                break;
            default:
                throw new JsonParsingException("Unexpected " + event
                        + ", expected person name object", location);
            }
        }
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

                return retval;
            case KEY_NAME:
                try {
                    key = PersonName.Group.valueOf(getString());
                } catch (IllegalArgumentException e) {
                    throw new JsonParsingException("Unexpected \"" + e.getMessage()
                            + "\", expected \"Alphabetic\" or \"Ideographic\""
                            + " or \"Phonetic\"", location);
                }
                if (next() != Event.VALUE_STRING) {
                    throw new JsonParsingException("Unexpected " + event
                            + "\", expected person name value", location);
                }
                personNameGroups.put(key, parser.getString());
                break;
            default:
                 throw new JsonParsingException("Unexpected " + event
                         + ", expected \"Alphabetic\" or \"Ideographic\""
                         + " or \"Phonetic\"", location);
            }
        }
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        seq.trimToSize();
    }

    private byte[] readInlineBinary() {
        if (next() != Event.VALUE_STRING) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected bulk data URI", location);
        }
        char[] base64 = parser.getString().toCharArray();
        bout.reset();
        try {
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        return bout.toByteArray();
    }

    private BulkData readBulkData(boolean bigEndian) {
        if (next() != Event.VALUE_STRING) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected bulk data URI", location);
        }
        String uri = parser.getString();
        return new BulkData(null, uri, bigEndian);
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        return new BulkData(null, uri, bigEndian);
    }

    private void readDataFragment(Attributes attrs, int tag, VR vr) {
        if (next() != Event.START_ARRAY) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected array of data fragment objects", location);
        }
        Fragments frags = attrs.newFragments(tag, vr, 10);
        for (;;) {
            switch (next()) {
            case END_ARRAY:
                frags.trimToSize();
                return;
            case VALUE_NULL:
                frags.add(null);
                break;
            case START_OBJECT:
                frags.add(readDataFragment(attrs.bigEndian()));
                break;
            default:
                throw new JsonParsingException("Unexpected " + event
                        + ", expected data fragment object", location);
            }
        }
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        }
    }

    private Object readDataFragment(boolean bigEndian) {
        if (next() != Event.KEY_NAME) {
            throw new JsonParsingException("Unexpected " + event
                    + ", expected \"InlineBinary\""
                    + " or \"BulkDataURI\"", location);
        }
        String key = getString();
        Object value;
        if ("BulkDataURI".equals(key)) {
            value = readBulkData(bigEndian);
        } else if ("InlineBinary".equals(key)) {
            value = readInlineBinary();
        } else {
            throw new JsonParsingException("Unexpected \"" + key
                    + "\", expected \"InlineBinary\""
                    + " or \"BulkDataURI\"", location);
        }
        if (next() != Event.END_OBJECT) {
            throw new JsonParsingException("Unexpected " + event
                    + " expected end of data fragment object", location);
        }
        return value;
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        }
    }

    private JsonParsingException parsingException(JsonToken token, String expectedTokens) {
        JsonLocation location = getLastCharLocation();
        return new JsonParsingException(
                JsonMessages.PARSER_INVALID_TOKEN(token, location, expectedTokens), location);
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        @Override
        public boolean hasNext() {
            if (stack.isEmpty() && (currentEvent == Event.END_ARRAY || currentEvent == Event.END_OBJECT)) {
                JsonToken token = tokenizer.nextToken();
                if (token != JsonToken.EOF) {
                    throw new JsonParsingException(JsonMessages.PARSER_EXPECTED_EOF(token),
                            getLastCharLocation());
                }
                return false;
            }
            return true;
View Full Code Here

Examples of javax.json.stream.JsonParsingException

        bufferPool.recycle(buf);
    }

    private JsonParsingException unexpectedChar(int ch) {
        JsonLocation location = getLastCharLocation();
        return new JsonParsingException(
            JsonMessages.TOKENIZER_UNEXPECTED_CHAR(ch, location), location);
    }
View Full Code Here

Examples of javax.json.stream.JsonParsingException

            JsonMessages.TOKENIZER_UNEXPECTED_CHAR(ch, location), location);
    }

    private JsonParsingException expectedChar(int unexpected, char expected) {
        JsonLocation location = getLastCharLocation();
        return new JsonParsingException(
                JsonMessages.TOKENIZER_EXPECTED_CHAR(unexpected, location, expected), location);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.