kevinrr888 commented on code in PR #5947:
URL: https://github.com/apache/accumulo/pull/5947#discussion_r2414843257
##########
server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java:
##########
@@ -433,10 +436,14 @@ columnFamily, new Text(StoredTabletFile
// Bad Json - test path value missing
// {"path":"","startRow":"","endRow":""}
m = new Mutation(new Text("0;foo"));
- m.put(columnFamily,
- new Text(StoredTabletFile.of(new
Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"))
- .getMetadata().replaceFirst("\"path\":\".*\",\"startRow",
"\"path\":\"\",\"startRow")),
- value);
+ String metadata = StoredTabletFile
+ .of(new
Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadata();
+ JsonObject json = gson.fromJson(metadata, JsonObject.class);
+ json.addProperty("path", "");
+ String fixedMetadata = json.toString();
+
+ m.put(columnFamily, new Text(fixedMetadata), value);
+
Review Comment:
```suggestion
m.put(columnFamily,
new Text(StoredTabletFile.of(new
Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"))
.getMetadata().replaceFirst("\"path\":\".*\"", "\"path\":\"\"")),
value);
```
The above solves the issue with minimal changes. `,\"startRow` is present in
both the regex and the replacement, so it can be removed and avoids any JSON
key orders
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]