Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONException


                    x.back();
                    break;
                case '}':
                    return;
                default:
                    throw new JSONException("Expected a ',' or '}'");
                }
            }
        }
View Full Code Here


            }
            back();

            String s = sb.toString().trim();
            if (s.length() == 0) {
                throw new JSONException("Missing value.");
            }
            Object res = null;
            if (s.equalsIgnoreCase("true")) {
                res = Boolean.TRUE;
            } else if (s.equalsIgnoreCase("false")) {
View Full Code Here

                    x.back();
                    break;
                case '}':
                    return;
                default:
                    throw new JSONException("Expected a ',' or '}'");
                }
            }
        }
View Full Code Here

      type = "customFieldOption";
    }
    @SuppressWarnings("unchecked")
    final JsonObjectParser<Object> jsonParser = registeredAllowedValueParsers.get(type);
    if (jsonParser == null) {
      throw new JSONException("Cannot find parser for field witch schema: " + fieldSchema);
    } else {
      return jsonParser;
    }
  }
View Full Code Here

      return ((JSONObject) summaryObject).getString(VALUE_ATTR);
    }
    if (summaryObject instanceof String) { // JIRA 5.0 way
      return (String) summaryObject;
    }
    throw new JSONException("Cannot parse [" + attributeName + "] from available fields");
  }
View Full Code Here

        // we should use fieldParser here (some new version as the old one probably won't work)
        // enable IssueJsonParserTest#testParseIssueWithUserPickerCustomFieldFilledOut after fixing this
        final Object value = json.opt(key);
        res.add(new IssueField(key, namesMap.get(key), typesMap.get("key"), value != JSONObject.NULL ? value : null));
      } catch (final Exception e) {
        throw new JSONException("Error while parsing [" + key + "] field: " + e.getMessage()) {
          @Override
          public Throwable getCause() {
            return e;
          }
        };
View Full Code Here

    final Iterator iterator = jsonObject.keys();
    while (iterator.hasNext()) {
      final Object o = iterator.next();
      if (!(o instanceof String)) {
        throw new JSONException(
            "Cannot parse URIs: key is expected to be valid String. Got " + (o == null ? "null" : o.getClass())
                + " instead.");
      }
      final String key = (String) o;
      uris.put(key, JsonParseUtil.parseURI(jsonObject.getString(key)));
View Full Code Here

  private <T> T convert(Object o, Class<T> clazz) throws JSONException {
    try {
      return clazz.cast(o);
    } catch (ClassCastException e) {
      throw new JSONException("Expected [" + clazz.getSimpleName() + "], but found [" + o.getClass().getSimpleName() + "]");
    }
  }
View Full Code Here

  @Override
  public String parse(Object o) throws JSONException {
    try {
      return (String) o;
    } catch (ClassCastException e) {
      throw new JSONException(
          "Expected [" + String.class.getSimpleName() + "], but found [" + o.getClass().getSimpleName() + "]");
    }
  }
View Full Code Here

    final Iterator iterator = jsonObject.keys();
    while (iterator.hasNext()) {
      final Object o = iterator.next();
      if (!(o instanceof String)) {
        throw new JSONException(
            "Cannot parse URIs: key is expected to be valid String. Got " + (o == null ? "null" : o.getClass())
                + " instead.");
      }
      final String key = (String) o;
      uris.put(key, JsonParseUtil.parseURI(jsonObject.getString(key)));
View Full Code Here

TOP

Related Classes of org.codehaus.jettison.json.JSONException

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.