fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fluo] ctubbsii commented on a change in pull request #1077: Updated commons config from ver 1 to 2
Date Mon, 12 Aug 2019 22:11:49 GMT
ctubbsii commented on a change in pull request #1077: Updated commons config from ver 1 to
2
URL: https://github.com/apache/fluo/pull/1077#discussion_r313145270
 
 

 ##########
 File path: modules/api/src/main/java/org/apache/fluo/api/config/SimpleConfiguration.java
 ##########
 @@ -335,4 +334,35 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
     ByteArrayInputStream bais = new ByteArrayInputStream(data);
     load(bais);
   }
+
+  private String stream2String(InputStream in) {
+    try {
+      ByteArrayOutputStream result = new ByteArrayOutputStream();
+      byte[] buffer = new byte[4096];
+      int length;
+      while ((length = in.read(buffer)) != -1) {
+        result.write(buffer, 0, length);
+      }
+
+      return result.toString(StandardCharsets.UTF_8.name());
+    } catch (IOException e) {
+      throw new UncheckedIOException(e);
+    }
+  }
+
+  /*
+   * Commons config 1 was used previously to implement this class. Commons config 1 required
+   * escaping interpolation. This escaping is no longer required with commmons config 2.
If
+   * interpolation is escaped, then this API behaves differently. This function suppresses
escaped
+   * interpolation in order to maintain behavior for reading.
+   */
+  private Reader cleanUp(InputStream in) {
+    return new StringReader(stream2String(in).replace("\\${", "${"));
+  }
+
+  private PropertiesConfiguration newPropertiesConfiguration() {
+    // TODO confirm defaults are ok... tried to use a builder and it blew up at runtime because
of
+    // missing bean lib
+    return new PropertiesConfiguration();
 
 Review comment:
   Is the idea to get rid of this method if the defaults are okay? And, if they aren't okay,
to change them here first?
   
   As for the missing lib, it might be useful to add the bean lib to the class path. It is
already added to Accumulo in https://github.com/apache/accumulo/commit/d7a407a3d6367b96fbc513f5b94b3c0511a68bf0

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message