Android JsonParseException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android JsonParseException class.

This code example shows how to use the following methods:
		String strVal = element.getAsString();
 
		try { 
			return deserialize(strVal);
		} catch (ParseException e) {
			throw new JsonParseException(e);
		} 
 
	} 
 
	/** 
	 * Serializes a Date to a JsonElement containing a ISO-8601 formatted date 
	 */ 
	@Override 
	public JsonElement serialize(Date date, Type type,
			JsonSerializationContext ctx) {
		JsonElement element = new JsonPrimitive(serialize(date));
		return element;
	} 
 
6
CodeRank
This code example shows how to use the following methods:getMessage
         * Create exception from {@link JsonParseException} 
         * 
         * @param cause 
         */ 
        public JsonException(JsonParseException cause) {
            super(cause.getMessage());
            initCause(cause);
        } 
    } 
 
 
    private final String apiKey;
    private final String username;
    private final String password;
 
    /** 
     * Create bootstrap service 
     * 
     * @param username 
     * @param password 
5
CodeRank
This code example shows how to use the following methods:printStackTrace
 
        try {			 
            JsonParser parser = new JsonParser();
            jsonElement = parser.parse(data);
        } catch (JsonParseException e) {
            e.printStackTrace();
            throw new JSONMatjiException(); 
        } 
        if (!isObject(jsonElement)){
            throw new JSONMatjiException(); 
        } 
 
        jsonObject = jsonElement.getAsJsonObject();
 
        return getMatjiData(jsonObject);
    } 
 
    protected ArrayList<MatjiData> getRawObjects(String data) throws MatjiException {
        JsonElement jsonElement = null;
 
4
CodeRank
This code example shows how to use the following methods:toString
import java.io.BufferedReader; 
 
public class CommitTransactionService extends IntentService
{ 
	private static final String EXTRA_TRANSACTION_JSON = "transaction_json";
	private static final String ENDPOINT_RESOURCE = "/transactions";
	private static final String TAG = "LedgerAndroid";
	private static final String DEFAULT_ENCODING = "UTF-8";
	private static final int NOTIFICATION_ERROR = 1;
 
	private String endpointUrl;
 
	@Override 
	public int onStartCommand(Intent intent, int flags, int startId)
	{ 
		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
 
		endpointUrl = prefs.getString("wsuri", "http://10.0.2.2:9292");
 
		return super.onStartCommand(intent, flags, startId);
4
CodeRank
This code example shows how to use the following methods:printStackTrace
			isSuccess = gson.fromJson(responseBody, boolean.class);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
			throw new NetworkException(e);
		} catch (JsonParseException e) {
			e.printStackTrace();
			throw new NetworkException(e);
		} catch (IOException e) {
			e.printStackTrace();
			throw new NetworkException(e);
		} 
		return isSuccess;
	} 
 
	public List<Comment> getComments(DilbertDate date) throws NetworkException {
		List<Comment> commentList = new ArrayList<Comment>();
		String commentsJSON;
 
		commentsJSON = readCommentsFromServer(date);
		commentList = deserializeCommentsJSON(commentsJSON);
4
CodeRank
This code example shows how to use the following methods:
            bbox.setMinx(array.get(0).getAsDouble());
            bbox.setMiny(array.get(1).getAsDouble());
            bbox.setMaxx(array.get(2).getAsDouble());
            bbox.setMaxy(array.get(3).getAsDouble());
        } else { 
            throw new JsonParseException("Bbox must be JSON array");
        } 
        return bbox;
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
            { 
                float var6 = par1JsonElement.getAsFloat();
 
                if (var6 < par4)
                { 
                    throw new JsonParseException("Invalid " + par2Str + ": expected float >= " + par4 + ", was " + var6);
                } 
                else if (var6 > par5)
                { 
                    throw new JsonParseException("Invalid " + par2Str + ": expected float <= " + par5 + ", was " + var6);
                } 
                else 
                { 
                    return var6;
                } 
            } 
            catch (NumberFormatException var7)
            { 
                throw new JsonParseException("Invalid " + par2Str + ": expected float, was " + par1JsonElement, var7);
            } 
4
CodeRank
This code example shows how to use the following methods:
  } 
 
  private String getTarget( JsonArray opArray ) {
    String target = opArray.get( 1 ).getAsString();
    if( target == null ) {
      throw new JsonParseException( "Target of operation must not be null " + opArray );
    } 
    return target;
  } 
} 
4
CodeRank
This code example shows how to use the following methods:
					&& jsonString.charAt(jsonString.length() - 1) == '"') {
				jsonString = jsonString.substring(1, jsonString.length() - 1);
			} 
			T constant = m_lowercaseToConstant.get(jsonString);
			if (constant == null) {
				throw new JsonParseException("Sorry, '" + json.toString()
						+ "' is not a valid " + classOfT);
			} 
			return constant;
		} 
 
		@Override 
		public String toString() {
			return EnumTypeAdapter.class.getSimpleName();
		} 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:
            } 
            // TODO check validity of bbox 
            center.setX(array.get(0).getAsDouble());
            center.setY(array.get(1).getAsDouble());
        } else { 
            throw new JsonParseException("Center must be JSON array");
        } 
        return center;
    } 
 
} 
4
CodeRank

Related Android JsonParseException Questions & Answers:

See Code Examples for Android JsonParseException Methods: