Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/206#discussion_r147563773
  
    --- Diff: 
extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
 ---
    @@ -49,38 +49,45 @@ public PrivateKey parseValue(String value) throws 
GuacamoleServerException {
             if (value == null || value.isEmpty())
                 return null;
     
    +        FileInputStream keyStreamIn = null;
    +
             try {
    +            try {
    --- End diff --
    
    Rather than nest `try` blocks and initialize with `null`, you could always 
just move the handling for `FileNotFoundException` up:
    
        FileInputStream keyStreamIn;
        try {
            keyStreamIn = new FileInputStream(value);
        }
        catch (FileNotFoundException e) {
            throw new GuacamoleServerException("Could not find the specified 
key file.", e);
        }
    
    Since `keyStreamIn` would then be guaranteed to be non-null, complexity of 
the rest would be reduced, and all you would need is a simple `close()` within 
a `finally` at the end, like you had before.


---

Reply via email to