protected static void printDocument(HttpResponse response, Document<?> d, String stage) { logger.debug("Printing document with ID " + d.getID() + " to stage " + stage); response.setStatusCode(HttpStatus.SC_OK); setStringEntity(response, d.toJson()); }
@Override public DatabaseDocument<MemoryType> convert(Document<?> document) { MemoryDocument md = new MemoryDocument(); try { md.fromJson(document.toJson()); } catch (JsonException e) { e.printStackTrace(); } return md; }
@Override public DatabaseDocument<MongoType> convert(Document<?> document) throws ConversionException { try { if (contains(document, "\u0000")) { throw new ConversionException( "A document cannot contain the NUL character. See https://jira.mongodb.org/browse/SERVER-7691"); } return new MongoDocument(document.toJson()); } catch (JsonException e) { throw new ConversionException( "JSON Exception caught while converting", e); } }