smengcl commented on code in PR #10710:
URL: https://github.com/apache/ozone/pull/10710#discussion_r3557299069
##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/FSOperations.java:
##########
@@ -1793,9 +1784,9 @@ public FSCreateSnapshot(String path, String snapshotName)
{
@Override
public String execute(FileSystem fs) throws IOException {
Path snapshotPath = fs.createSnapshot(path, snapshotName);
- JSONObject json = toJSON(HttpFSConstants.HOME_DIR_JSON,
+ Map<String, Object> json = toJSON(HttpFSConstants.HOME_DIR_JSON,
snapshotPath.toString());
- return json.toJSONString().replaceAll("\\\\", "");
+ return JsonUtil.toJsonString(json).replaceAll("\\\\", "");
Review Comment:
Fixed in 7afc6c54. Removed the backslash strip entirely: Jackson does not
escape forward slashes, so it was a no-op for normal paths and could corrupt
values Jackson legitimately escapes.
##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/FSOperations.java:
##########
@@ -1793,9 +1784,9 @@ public FSCreateSnapshot(String path, String snapshotName)
{
@Override
public String execute(FileSystem fs) throws IOException {
Path snapshotPath = fs.createSnapshot(path, snapshotName);
- JSONObject json = toJSON(HttpFSConstants.HOME_DIR_JSON,
+ Map<String, Object> json = toJSON(HttpFSConstants.HOME_DIR_JSON,
snapshotPath.toString());
- return json.toJSONString().replaceAll("\\\\", "");
+ return JsonUtil.toJsonString(json).replaceAll("\\\\", "");
Review Comment:
Fixed in 7afc6c54. The replaceAll was removed; toJsonString output is now
returned as-is.
##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/service/instrumentation/InstrumentationService.java:
##########
@@ -295,7 +281,7 @@ public void addCron(String group, String name,
Instrumentation.Cron cron) {
timer.addCron((Cron) cron);
}
- static class VariableHolder<E> implements JSONAware, JSONStreamAware {
+ static class VariableHolder<E> {
// Supressed, because it is only used in this class or in test files,
// but the tests will be removed later.
Review Comment:
Fixed in 7afc6c54. Reworded the comment to state the actual reason for the
visibility suppression and corrected the misspelling.
##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/service/instrumentation/InstrumentationService.java:
##########
@@ -295,7 +281,7 @@ public void addCron(String group, String name,
Instrumentation.Cron cron) {
timer.addCron((Cron) cron);
}
- static class VariableHolder<E> implements JSONAware, JSONStreamAware {
+ static class VariableHolder<E> {
// Supressed, because it is only used in this class or in test files,
// but the tests will be removed later.
Review Comment:
Fixed in 7afc6c54. Comment updated and misspelling corrected.
##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/FSOperations.java:
##########
@@ -374,17 +373,16 @@ private static Map<String, Object>
quotaUsageToMap(QuotaUsage quotaUsage) {
*
* @return the JSON representation of the key-value pair.
*/
- @SuppressWarnings("unchecked")
- private static JSONObject toJSON(String name, Object value) {
- JSONObject json = new JSONObject();
+ private static Map<String, Object> toJSON(String name, Object value) {
Review Comment:
Fixed in 3214d75321c. Updated the Javadoc to describe Jackson serialization
instead of the removed JsonAware type.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]