@SuppressWarnings("unchecked")
    @Override
    public Object read(Gson gson, Type type, InputStream stream) throws IOException {
      @Nullable JsonReader reader = null;
      try {
        reader = new JsonParserReader(JSON_FACTORY.createParser(stream));
        options.setReaderOptions(reader);
        return gson.getAdapter((TypeToken<Object>) TypeToken.get(type)).read(reader);
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        throw new IOException(ex);
      } finally {
        if (reader != null) {
          try {
            // note that stream is not closed here as per JSON_FACTORY configuration
            reader.close();
          } catch (IOException ex) {
            // ignore io exception of reader close as not important
          }
        }
      }
    }
Forces creation of more strict in string reading if in !lenient mode
gson/src/org/immutables/gson/stream/GsonMessageBodyProvider.java