mbien commented on code in PR #8859:
URL: https://github.com/apache/netbeans/pull/8859#discussion_r2378255431


##########
ide/dlight.nativeexecution.nb/src/org/netbeans/modules/nativeexecution/ui/SSHKeyFileFilter.java:
##########
@@ -63,28 +60,28 @@ public boolean accept(File file) {
             return false;
         }
 
-        FileInputStream fis = null;
-        byte[] buffer = new byte[30];
-
         // fast sanity check
-        try {
-            fis = new FileInputStream(file);
-            fis.read(buffer, 0, 30);
 
-            Matcher m = p.matcher(new String(buffer, 0, 30, cs));
-            if (!m.matches()) {
+        // header contains the name of the tool so we don't know how long it is
+        // read until new line but with a limit and avoid buffering the key
+        int limit = 40;
+
+        try (InputStream is = new 
BufferedInputStream(Files.newInputStream(file.toPath()), limit)) {
+
+            StringBuilder head = new StringBuilder(limit);
+            int c;

Review Comment:
   I am ok with short variable names in cases like this here when the usage is 
only 1-5 lines away from the declaration. But I get what you are saying, I 
would have used a proper name if the scope of the variable would be wider.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to