Run of fresh-snapshots for jline2

Merge these changes:

git pull https://janitor.debian.net/git/jline2 fresh-snapshots/main
git pull https://janitor.debian.net/git/jline2 fresh-snapshots/pristine-tar
git pull https://janitor.debian.net/git/jline2 fresh-snapshots/upstream

Summary

Merged new upstream version: 2.14.6+git20190308.1.12b98d9 (was: 2.14.6).

Diff

Branch: main

Diff is too long (more than 200 lines). Download the raw diff.

Branch: pristine-tar

diff --git a/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.delta b/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.delta
new file mode 100644
index 0000000..a26fb22
Binary files /dev/null and b/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.delta differ
diff --git a/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.id b/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.id
new file mode 100644
index 0000000..30bae5d
--- /dev/null
+++ b/jline2_2.14.6+git20190308.1.12b98d9.orig.tar.gz.id
@@ -0,0 +1 @@
+e61b75d924c7aa5c3a42b12e95aede4c9e6f78a4

Branch: upstream

Tag: upstream/2.14.6+git20190308.1.12b98d9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 909b200..4fdd92a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@
 * #277: Allow setting max history-size. `FileHistory` allows delayed
   init (to allow setMaxSize to take effect) and `ConsoleReader`
   exposes ability to read inputrc settings.
+* #272: Handle `SecurityException` during initialisation if access to
+  the config file is denied.
 
 ## [JLine 2.14.3][2_14_3]
 * (unrecorded)
diff --git a/pom.xml b/pom.xml
index 7f4454a..b418410 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <groupId>jline</groupId>
     <artifactId>jline</artifactId>
     <name>JLine</name>
-    <version>2.14.6</version>
+    <version>2.14.7-SNAPSHOT</version>
 
     <licenses>
         <license>
diff --git a/src/main/java/jline/internal/Configuration.java b/src/main/java/jline/internal/Configuration.java
index 5e7b13c..7905c5a 100644
--- a/src/main/java/jline/internal/Configuration.java
+++ b/src/main/java/jline/internal/Configuration.java
@@ -45,17 +45,22 @@ public class Configuration
     private static volatile Properties properties;
 
     private static Properties initProperties() {
-        URL url = determineUrl();
         Properties props = new Properties();
         try {
-            loadProperties(url, props);
-        }
-        catch (FileNotFoundException e) {
-            // debug here and no stack trace, as this can happen normally if default jline.rc file is missing
-            Log.debug("Unable to read configuration: ", e.toString());
-        }
-        catch (IOException e) {
-            Log.warn("Unable to read configuration from: ", url, e);
+            URL url = determineUrl();
+            try {
+                loadProperties(url, props);
+            }
+            catch (FileNotFoundException e) {
+                // debug here and no stack trace, as this can happen normally if default jline.rc file is missing
+                Log.debug("Unable to read configuration: ", e.toString());
+            }
+            catch (IOException e) {
+                Log.warn("Unable to read configuration from: ", url, e);
+            }
+        } catch (SecurityException e) {
+            // Omitting stack trace as it's a fairly normal condition, but I think you'd still want to know about it.
+            Log.info("Security policy denied reading configuration file");
         }
         return props;
     }
@@ -83,6 +88,12 @@ public class Configuration
         }
     }
 
+    /**
+     * Determines the URL to read the configuration from.
+     *
+     * @return the URL.
+     * @throws SecurityException if no override is provided, and access to the user's default config file is denied.
+     */
     private static URL determineUrl() {
         // See if user has customized the configuration location via sysprop
         String tmp = System.getProperty(JLINE_CONFIGURATION);
diff --git a/src/main/java/jline/internal/InputStreamReader.java b/src/main/java/jline/internal/InputStreamReader.java
index dd856de..cf62e16 100644
--- a/src/main/java/jline/internal/InputStreamReader.java
+++ b/src/main/java/jline/internal/InputStreamReader.java
@@ -13,6 +13,7 @@ import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
@@ -68,7 +69,7 @@ public class InputStreamReader extends Reader {
         decoder = Charset.defaultCharset().newDecoder().onMalformedInput(
                 CodingErrorAction.REPLACE).onUnmappableCharacter(
                 CodingErrorAction.REPLACE);
-        bytes.limit(0);
+        ((Buffer) bytes).limit(0);
     }
 
     /**
@@ -101,7 +102,7 @@ public class InputStreamReader extends Reader {
             throw (UnsupportedEncodingException)
                     new UnsupportedEncodingException(enc).initCause(e);
         }
-        bytes.limit(0);
+        ((Buffer) bytes).limit(0);
     }
 
     /**
@@ -118,7 +119,7 @@ public class InputStreamReader extends Reader {
         dec.averageCharsPerByte();
         this.in = in;
         decoder = dec;
-        bytes.limit(0);
+        ((Buffer) bytes).limit(0);
     }
 
     /**
@@ -136,7 +137,7 @@ public class InputStreamReader extends Reader {
         decoder = charset.newDecoder().onMalformedInput(
                 CodingErrorAction.REPLACE).onUnmappableCharacter(
                 CodingErrorAction.REPLACE);
-        bytes.limit(0);
+        ((Buffer) bytes).limit(0);
     }
 
     /**
@@ -262,7 +263,7 @@ public class InputStreamReader extends Reader {
                     } else if (was_red == 0) {
                         break;
                     }
-                    bytes.limit(bytes.limit() + was_red);
+                    ((Buffer) bytes).limit(bytes.limit() + was_red);
                     needInput = false;
                 }
 
@@ -273,8 +274,8 @@ public class InputStreamReader extends Reader {
                     // compact the buffer if no space left
                     if (bytes.limit() == bytes.capacity()) {
                         bytes.compact();
-                        bytes.limit(bytes.position());
-                        bytes.position(0);
+                        ((Buffer) bytes).limit(bytes.position());
+                        ((Buffer) bytes).position(0);
                     }
                     needInput = true;
                 } else {
diff --git a/src/main/java/jline/internal/Urls.java b/src/main/java/jline/internal/Urls.java
index 3303ed7..df180df 100644
--- a/src/main/java/jline/internal/Urls.java
+++ b/src/main/java/jline/internal/Urls.java
@@ -21,6 +21,16 @@ import java.net.URL;
  */
 public class Urls
 {
+    /**
+     * <p>Creates a URL from a string.</p>
+     *
+     * <p>If the string represents a valid URL in a supported protocol, that URL is returned.
+     *    Otherwise, the string is treated as a file path converted to a URL.</p>
+     *
+     * @param file the file path.
+     * @return the URL.
+     * @throws SecurityException if the file path cannot be accessed.
+     */
     public static URL create(final String input) {
         if (input == null) {
             return null;
@@ -33,6 +43,13 @@ public class Urls
         }
     }
 
+    /**
+     * Creates a URL for a file path.
+     *
+     * @param file the file path.
+     * @return the URL.
+     * @throws SecurityException if the file path cannot be accessed.
+     */
     public static URL create(final File file) {
         try {
             return file != null ? file.toURI().toURL() : null;

Publish Blockers

  • ☑ run was successful
  • ☑ package has not been removed from the archive
  • ☑ command has not changed
  • ☒ not yet reviewed, but review needed
  • ☑ 0 publish attempts so far.not currently attempting to back off
  • ☒ merge proposals for the package maintainer are currently being rate-limited (open: 1253, max open: 300)
  • ☑ change set defb2448-95fc-486e-837f-e60b031c8a05 is ready

Resulting package

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots libjline2-java

Lintian Result

Full worker log Full build log