void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
@Override public Object decode(Response response, Type type) throws IOException { if (response.status() == 404) return Util.emptyValueOf(type); if (response.body() == null) return null; Reader reader = response.body().asReader(); try { return gson.fromJson(reader, type); } catch (JsonIOException e) { if (e.getCause() != null && e.getCause() instanceof IOException) { throw IOException.class.cast(e.getCause()); } throw e; } finally { ensureClosed(reader); } } }
void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
void merge(Reader json, Message.Builder builder) throws IOException { try { JsonReader reader = new JsonReader(json); reader.setLenient(false); merge(jsonParser.parse(reader), builder); } catch (InvalidProtocolBufferException e) { throw e; } catch (JsonIOException e) { // Unwrap IOException. if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new InvalidProtocolBufferException(e.getMessage()); } } catch (Exception e) { // We convert all exceptions from JSON parsing to our own exceptions. throw new InvalidProtocolBufferException(e.getMessage()); } }
Throwable t = e.getCause(); if (t instanceof EOFException) {