test_class.declarator: fixture = DocumentStoreFixture.RDB_H2
test_class.modifier: private
test_class.original_string: private DocumentStoreFixture fixture = DocumentStoreFixture.RDB_H2;
test_class.type: DocumentStoreFixture
test_class.var_name: fixture
test_class.declarator: store
test_class.modifier: private
test_class.original_string: private DocumentStore store;
test_class.type: DocumentStore
test_class.var_name: store
test_class.declarator: ser
test_class.modifier: private
test_class.original_string: private RDBDocumentSerializer ser;
test_class.type: RDBDocumentSerializer
test_class.var_name: ser
test_class.file: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentSerializerTest.java
test_class.identifier: RDBDocumentSerializerTest
test_case.body: @Test
      public void testSimpleStringNonAscii() {
          RDBRow row = new RDBRow("_foo", 1L, false, 1l, 2l, 3l, 0L, 0L, 0L, "{\"x\":\"\u20ac\uD834\uDD1E\"}", null);
          NodeDocument doc = this.ser.fromRow(Collection.NODES, row);
          assertEquals("_foo", doc.getId());
          assertEquals("\u20ac\uD834\uDD1E", doc.get("x"));
      }
test_case.class_method_signature: RDBDocumentSerializerTest.testSimpleStringNonAscii()
test_case.full_signature: @Test public void testSimpleStringNonAscii()
test_case.identifier: testSimpleStringNonAscii
test_case.invocations: fromRow assertEquals getId assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSimpleStringNonAscii()
focal_class.declarator: store
focal_class.modifier: private final
focal_class.original_string: private final DocumentStore store;
focal_class.type: DocumentStore
focal_class.var_name: store
focal_class.declarator: MODIFIED = NodeDocument.MODIFIED_IN_SECS
focal_class.modifier: private static final
focal_class.original_string: private static final String MODIFIED = NodeDocument.MODIFIED_IN_SECS;
focal_class.type: String
focal_class.var_name: MODIFIED
focal_class.declarator: MODCOUNT = NodeDocument.MOD_COUNT
focal_class.modifier: private static final
focal_class.original_string: private static final String MODCOUNT = NodeDocument.MOD_COUNT;
focal_class.type: String
focal_class.var_name: MODCOUNT
focal_class.declarator: CMODCOUNT = "_collisionsModCount"
focal_class.modifier: private static final
focal_class.original_string: private static final String CMODCOUNT = "_collisionsModCount";
focal_class.type: String
focal_class.var_name: CMODCOUNT
focal_class.declarator: SDTYPE = NodeDocument.SD_TYPE
focal_class.modifier: private static final
focal_class.original_string: private static final String SDTYPE = NodeDocument.SD_TYPE;
focal_class.type: String
focal_class.var_name: SDTYPE
focal_class.declarator: SDMAXREVTIME = NodeDocument.SD_MAX_REV_TIME_IN_SECS
focal_class.modifier: private static final
focal_class.original_string: private static final String SDMAXREVTIME = NodeDocument.SD_MAX_REV_TIME_IN_SECS;
focal_class.type: String
focal_class.var_name: SDMAXREVTIME
focal_class.declarator: ID = "_id"
focal_class.modifier: private static final
focal_class.original_string: private static final String ID = "_id";
focal_class.type: String
focal_class.var_name: ID
focal_class.declarator: HASBINARY = NodeDocument.HAS_BINARY_FLAG
focal_class.modifier: private static final
focal_class.original_string: private static final String HASBINARY = NodeDocument.HAS_BINARY_FLAG;
focal_class.type: String
focal_class.var_name: HASBINARY
focal_class.declarator: DELETEDONCE = NodeDocument.DELETED_ONCE
focal_class.modifier: private static final
focal_class.original_string: private static final String DELETEDONCE = NodeDocument.DELETED_ONCE;
focal_class.type: String
focal_class.var_name: DELETEDONCE
focal_class.declarator: comparator = StableRevisionComparator.REVERSE
focal_class.modifier: private final
focal_class.original_string: private final Comparator<Revision> comparator = StableRevisionComparator.REVERSE;
focal_class.type: Comparator<Revision>
focal_class.var_name: comparator
focal_class.declarator: LOG = LoggerFactory.getLogger(RDBDocumentSerializer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(RDBDocumentSerializer.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: JSON = new RDBJSONSupport(true)
focal_class.modifier: private static final
focal_class.original_string: private static final RDBJSONSupport JSON = new RDBJSONSupport(true);
focal_class.type: RDBJSONSupport
focal_class.var_name: JSON
focal_class.declarator: GZIPSIG = { 31, -117 }
focal_class.modifier: private static
focal_class.original_string: private static byte[] GZIPSIG = { 31, -117 };
focal_class.type: byte[]
focal_class.var_name: GZIPSIG
focal_class.file: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentSerializer.java
focal_class.identifier: RDBDocumentSerializer
focal_class.class_method_signature: RDBDocumentSerializer.RDBDocumentSerializer(DocumentStore store)
focal_class.full_signature: public  RDBDocumentSerializer(DocumentStore store)
focal_class.identifier: RDBDocumentSerializer
focal_class.modifiers: public
focal_class.parameters: (DocumentStore store)
focal_class.signature:  RDBDocumentSerializer(DocumentStore store)
focal_class.class_method_signature: RDBDocumentSerializer.asString(@NotNull Document doc, Set<String> columnProperties)
focal_class.full_signature: public String asString(@NotNull Document doc, Set<String> columnProperties)
focal_class.identifier: asString
focal_class.modifiers: public
focal_class.parameters: (@NotNull Document doc, Set<String> columnProperties)
focal_class.return: String
focal_class.signature: String asString(@NotNull Document doc, Set<String> columnProperties)
focal_class.class_method_signature: RDBDocumentSerializer.asString(UpdateOp update, Set<String> columnProperties)
focal_class.full_signature: public String asString(UpdateOp update, Set<String> columnProperties)
focal_class.identifier: asString
focal_class.modifiers: public
focal_class.parameters: (UpdateOp update, Set<String> columnProperties)
focal_class.return: String
focal_class.signature: String asString(UpdateOp update, Set<String> columnProperties)
focal_class.class_method_signature: RDBDocumentSerializer.fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_class.full_signature: @NotNull public T fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_class.identifier: fromRow
focal_class.modifiers: @NotNull public
focal_class.parameters: (@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_class.return: T
focal_class.signature: T fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_class.class_method_signature: RDBDocumentSerializer.applyUpdate(T doc, List updateString, List<Object> op)
focal_class.full_signature: private void applyUpdate(T doc, List updateString, List<Object> op)
focal_class.identifier: applyUpdate
focal_class.modifiers: private
focal_class.parameters: (T doc, List updateString, List<Object> op)
focal_class.return: void
focal_class.signature: void applyUpdate(T doc, List updateString, List<Object> op)
focal_class.class_method_signature: RDBDocumentSerializer.readDocumentFromJson(@NotNull JsopTokenizer json, @NotNull T doc)
focal_class.full_signature: private static void readDocumentFromJson(@NotNull JsopTokenizer json, @NotNull T doc)
focal_class.identifier: readDocumentFromJson
focal_class.modifiers: private static
focal_class.parameters: (@NotNull JsopTokenizer json, @NotNull T doc)
focal_class.return: void
focal_class.signature: void readDocumentFromJson(@NotNull JsopTokenizer json, @NotNull T doc)
focal_class.class_method_signature: RDBDocumentSerializer.checkSdType(Document doc)
focal_class.full_signature: private static void checkSdType(Document doc)
focal_class.identifier: checkSdType
focal_class.modifiers: private static
focal_class.parameters: (Document doc)
focal_class.return: void
focal_class.signature: void checkSdType(Document doc)
focal_class.class_method_signature: RDBDocumentSerializer.fromBlobData(byte[] bdata)
focal_class.full_signature: private static String fromBlobData(byte[] bdata)
focal_class.identifier: fromBlobData
focal_class.modifiers: private static
focal_class.parameters: (byte[] bdata)
focal_class.return: String
focal_class.signature: String fromBlobData(byte[] bdata)
focal_method.body: @NotNull
      public <T extends Document> T fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row) throws DocumentStoreException {
  
          final String charData = row.getData();
          checkNotNull(charData, "RDBRow.getData() is null for collection " + collection + ", id: " + row.getId());
  
          T doc = collection.newDocument(store);
          doc.put(ID, row.getId());
          if (row.getModified() != RDBRow.LONG_UNSET) {
              doc.put(MODIFIED, row.getModified());
          }
          if (row.getModcount() != RDBRow.LONG_UNSET) {
              doc.put(MODCOUNT, row.getModcount());
          }
          if (RDBDocumentStore.USECMODCOUNT && row.getCollisionsModcount() != RDBRow.LONG_UNSET) {
              doc.put(CMODCOUNT, row.getCollisionsModcount());
          }
          if (row.hasBinaryProperties() != null) {
              doc.put(HASBINARY, row.hasBinaryProperties().longValue());
          }
          if (row.deletedOnce() != null) {
              doc.put(DELETEDONCE, row.deletedOnce().booleanValue());
          }
          if (row.getSchemaVersion() >= 2) {
              if (row.getSdType() != RDBRow.LONG_UNSET) {
                  doc.put(SDTYPE, row.getSdType());
              }
              if (row.getSdMaxRevTime() != RDBRow.LONG_UNSET) {
                  doc.put(SDMAXREVTIME, row.getSdMaxRevTime());
              }
          }
  
          byte[] bdata = row.getBdata();
          boolean blobInUse = false;
          JsopTokenizer json;
  
          // case #1: BDATA (blob) contains base data, DATA (string) contains
          // update operations
          try {
              if (bdata != null && bdata.length != 0) {
                  String s = fromBlobData(bdata);
                  json = new JsopTokenizer(s);
                  json.read('{');
                  readDocumentFromJson(json, doc);
                  json.read(JsopReader.END);
                  blobInUse = true;
              }
          } catch (Exception ex) {
              throw asDocumentStoreException(ex, "parsing blob data as JSON");
          }
  
          json = new JsopTokenizer(charData);
  
          // start processing the VARCHAR data
          try {
              int next = json.read();
  
              if (next == '{') {
                  if (blobInUse) {
                      throw new DocumentStoreException("expected literal \"blob\" but found: " + row.getData());
                  }
                  readDocumentFromJson(json, doc);
              } else if (next == JsopReader.STRING) {
                  if (!blobInUse) {
                      throw new DocumentStoreException("did not expect \"blob\" here: " + row.getData());
                  }
                  if (!"blob".equals(json.getToken())) {
                      throw new DocumentStoreException("expected string literal \"blob\"");
                  }
              } else {
                  throw new DocumentStoreException("unexpected token " + next + " in " + row.getData());
              }
  
              next = json.read();
              if (next == ',') {
                  do {
                      Object ob = JSON.parse(json);
                      if (!(ob instanceof List)) {
                          throw new DocumentStoreException("expected array but got: " + ob);
                      }
                      List<List<Object>> update = (List<List<Object>>) ob;
                      for (List<Object> op : update) {
                          applyUpdate(doc, update, op);
                      }
  
                  } while (json.matches(','));
              }
              json.read(JsopReader.END);
  
              // OAK-7855: check and fix _sdType
              checkSdType(doc);
  
              return doc;
          } catch (Exception ex) {
              String message = String.format("Error processing persisted data for document '%s'", row.getId());
              if (charData.length() > 0) {
                  int last = charData.charAt(charData.length() - 1);
                  if (last != '}' && last != '"' && last != ']') {
                      message += " (DATA column might be truncated)";
                  }
              }
  
              LOG.error(message, ex);
              throw asDocumentStoreException(ex, message);
          }
      }
focal_method.class_method_signature: RDBDocumentSerializer.fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_method.full_signature: @NotNull public T fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_method.identifier: fromRow
focal_method.invocations: getData checkNotNull getId newDocument put getId getModified put getModified getModcount put getModcount getCollisionsModcount put getCollisionsModcount hasBinaryProperties put longValue hasBinaryProperties deletedOnce put booleanValue deletedOnce getSchemaVersion getSdType put getSdType getSdMaxRevTime put getSdMaxRevTime getBdata fromBlobData read readDocumentFromJson read asDocumentStoreException read getData readDocumentFromJson getData equals getToken getData read parse applyUpdate matches read checkSdType format getId length charAt length error asDocumentStoreException
focal_method.modifiers: @NotNull public
focal_method.parameters: (@NotNull Collection<T> collection, @NotNull RDBRow row)
focal_method.return: T
focal_method.signature: T fromRow(@NotNull Collection<T> collection, @NotNull RDBRow row)