RANGER-5519: introduce ranger-common-utils module#879
Merged
mneethiraj merged 4 commits intoapache:masterfrom Mar 20, 2026
Merged
RANGER-5519: introduce ranger-common-utils module#879mneethiraj merged 4 commits intoapache:masterfrom
mneethiraj merged 4 commits intoapache:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new shared Maven module (ranger-common-utils) to host low-dependency utility classes reused across Ranger modules, replacing module-local duplicates and reducing transitive dependency drag from ranger-plugins-common.
Changes:
- Added new
common-utilsMaven module that buildsorg.apache.ranger:ranger-common-utilsand moved/shared several utility classes into it. - Updated multiple modules and distro assembly descriptors to depend on/include
ranger-common-utils. - Removed Jersey-specific
JsonUtilsV2.readResponse()helpers and updated call sites to parse response entities directly.
Reviewed changes
Copilot reviewed 39 out of 50 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| security-admin/pom.xml | Adds dependency on ranger-common-utils. |
| pom.xml | Adds common-utils module to reactor build profiles. |
| kms/src/main/java/org/apache/ranger/plugin/util/XMLUtils.java | Removed duplicate XML utils (now provided via ranger-common-utils). |
| kms/src/main/java/org/apache/ranger/plugin/util/JsonUtilsV2.java | Removed duplicate JSON utils (now provided via ranger-common-utils). |
| kms/src/main/java/org/apache/ranger/plugin/util/AutoClosableLock.java | Removed duplicate lock helper (now provided via ranger-common-utils). |
| kms/pom.xml | Adds dependency on ranger-common-utils. |
| intg/src/main/java/org/apache/ranger/RangerClient.java | Replaces removed JsonUtilsV2.readResponse() usage with jsonToObj(response.getEntity(String.class), ...). |
| embeddedwebserver/src/main/java/org/apache/ranger/plugin/util/XMLUtils.java | Removed duplicate XML utils (now provided via ranger-common-utils). |
| embeddedwebserver/pom.xml | Adds dependency on ranger-common-utils. |
| distro/src/main/assembly/usersync.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/tagsync.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/storm-agent.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/sample-client.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/ranger-tools.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-yarn.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-trino.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-sqoop.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-solr.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-presto.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-ozone.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-kylin.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-kms.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-kafka.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-elasticsearch.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/plugin-atlas.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/knox-agent.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/kms.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/hive-agent.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/hdfs-agent.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/hbase-agent.xml | Includes ranger-common-utils in distro packaging. |
| distro/src/main/assembly/admin-web.xml | Swaps embeddedwebserver/lib includes to add ranger-common-utils. |
| common-utils/src/test/java/org/apache/ranger/plugin/util/RangerCacheTest.java | Adds multi-threaded tests for RangerCache. |
| common-utils/src/test/java/org/apache/ranger/plugin/util/JavaScriptEditsTest.java | Adds tests for JavaScriptEdits.replaceDoubleBrackets(). |
| common-utils/src/main/java/org/apache/ranger/plugin/util/XMLUtils.java | New shared XML utility implementation. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/URLEncoderUtil.java | New shared URL-encoding helper. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.java | New shared timed-execution helper. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/RangerReadWriteLock.java | New shared read/write lock wrapper. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/RangerPerfTracerFactory.java | New shared perf tracer factory. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/RangerPerfTracer.java | New shared perf tracing implementation. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/RangerPerfCollectorTracer.java | New shared perf tracer that records aggregated stats. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/RangerCache.java | New shared cache implementation (and minor refactors to use moved lock helper). |
| common-utils/src/main/java/org/apache/ranger/plugin/util/PerfDataRecorder.java | Removes non-JDK/guava usage and returns unmodifiable snapshots. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/JsonUtilsV2.java | New shared JSON utility without Jersey ClientResponse helpers. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/JavaScriptEdits.java | New shared expression rewriter for [[...]] tokens. |
| common-utils/src/main/java/org/apache/ranger/plugin/util/AutoClosableLock.java | New shared lock helper for try-with-resources usage. |
| common-utils/pom.xml | Defines the new ranger-common-utils artifact and its (intended minimal) dependencies. |
| audit-server/server/pom.xml | Adds dependency on ranger-common-utils. |
| agents-common/src/main/java/org/apache/ranger/plugin/contextenricher/RangerUserStoreRefresher.java | Replaces removed JsonUtilsV2.readResponse() usage with jsonToObj(...). |
| agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java | Replaces removed JsonUtilsV2.readResponse() usage with jsonToObj(...). |
| agents-common/pom.xml | Adds dependency on ranger-common-utils. |
Comments suppressed due to low confidence (1)
common-utils/src/main/java/org/apache/ranger/plugin/util/PerfDataRecorder.java:101
exposeStatistics()copiesinstance.perfStatistics(aCollections.synchronizedMap) without synchronizing on the map (or usinginstance.lock). Iteration duringnew HashMap<>(...)can throwConcurrentModificationExceptionor produce inconsistent snapshots under concurrentrecordStatistic()calls. Consider takinginstance.lock.getReadLock()here and/or synchronizing oninstance.perfStatisticswhile copying.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Introduced module
ranger-common-utils, to house classes that are shared across multiple modules. This module has much fewer dependencies compared toranger-plugins-common, which eliminates unnecessary transient dependencies to be dragged in modules trying to reuse classes.Classes that were duplicated in earlier commit, RANGER-5517, were removed with this changed.
How was this patch tested?