This is an automated email from the ASF dual-hosted git repository.
sandeepk318 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 0347dc4503 AMBARI-26596: Fixing fd leak during kerberizing (#4124)
0347dc4503 is described below
commit 0347dc4503c09b0593d9cb12815e2f9784b6a86a
Author: Halim Kim <[email protected]>
AuthorDate: Mon Jul 27 16:43:55 2026 +0900
AMBARI-26596: Fixing fd leak during kerberizing (#4124)
---
.../java/org/apache/ambari/server/api/services/AmbariMetaInfo.java | 4 ++--
.../server/state/kerberos/AbstractKerberosDescriptorFactory.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index d15d02ab69..13d59d3262 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -944,8 +944,8 @@ public class AmbariMetaInfo {
Gson gson = new Gson();
- try {
- map = gson.fromJson(new FileReader(svc.getMetricsFile()), type);
+ try (FileReader reader = new FileReader(svc.getMetricsFile())) {
+ map = gson.fromJson(reader, type);
svc.setMetrics(processMetricDefinition(map));
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorFactory.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorFactory.java
index c61b1a4dbc..3e7b76a5e9 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorFactory.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorFactory.java
@@ -51,8 +51,8 @@ abstract class AbstractKerberosDescriptorFactory {
} else if (!file.isFile() || !file.canRead()) {
throw new IOException(String.format("%s is not a readable file",
file.getAbsolutePath()));
} else {
- try {
- return new Gson().fromJson(new FileReader(file),
+ try (FileReader reader = new FileReader(file)) {
+ return new Gson().fromJson(reader,
new TypeToken<Map<String, Object>>() {
}.getType());
} catch (JsonSyntaxException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]