You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2024/01/10 18:32:52 UTC
(ranger) 02/02: RANGER-4440: remove stale code that attempts to decompress x_security_zone.jsonData - #4
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 67d8c80aab5a47815f5c330c70cdb062808aa92c
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Tue Jan 9 16:00:39 2024 -0800
RANGER-4440: remove stale code that attempts to decompress x_security_zone.jsonData - #4
---
.../org/apache/ranger/biz/SecurityZoneDBStore.java | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneDBStore.java
index 8d22fb42b..a877597c5 100755
--- a/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneDBStore.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneDBStore.java
@@ -17,7 +17,6 @@
package org.apache.ranger.biz;
-import java.io.IOException;
import java.util.*;
import javax.annotation.PostConstruct;
@@ -26,7 +25,6 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.ranger.authorization.utils.StringUtil;
import org.apache.ranger.common.MessageEnums;
import org.apache.ranger.common.RESTErrorUtil;
import org.apache.ranger.common.RangerSearchUtil;
@@ -53,9 +51,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
@Component
public class SecurityZoneDBStore implements SecurityZoneStore {
private static final Logger LOG = LoggerFactory.getLogger(SecurityZoneDBStore.class);
@@ -125,21 +120,7 @@ public class SecurityZoneDBStore implements SecurityZoneStore {
@Override
public RangerSecurityZone updateSecurityZoneById(RangerSecurityZone securityZone) throws Exception {
- XXSecurityZone xxSecurityZone = daoMgr.getXXSecurityZoneDao().findByZoneId(securityZone.getId());
- if (xxSecurityZone == null) {
- throw restErrorUtil.createRESTException("security-zone with id: " + securityZone.getId() + " does not exist");
- }
-
- Gson gsonBuilder = new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").create();
- String json = xxSecurityZone.getJsonData();
-
- try {
- json = StringUtil.decompressString(json);
- } catch (IOException excp) {
- LOG.error("updateSecurityZoneById(): json decompression failed. Will treat as uncompressed json", excp);
- }
-
- RangerSecurityZone oldSecurityZone = gsonBuilder.fromJson(json, RangerSecurityZone.class);
+ RangerSecurityZone oldSecurityZone = securityZoneService.read(securityZone.getId());
daoMgr.getXXGlobalState().onGlobalStateChange(RANGER_GLOBAL_STATE_NAME);