donphelix commented on code in PR #8859:
URL: https://github.com/apache/netbeans/pull/8859#discussion_r2377889412
##########
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:
Instead of single-letter variables like c (character) and n (index),
consider using currentChar or charIndex for improved readability, especially in
longer functions. This makes the code's intent clearer without needing to trace
variable definitions.
```suggestion
int currentChar;
```
--
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