alb3rtobr opened a new pull request #6631:
URL: https://github.com/apache/geode/pull/6631


   **AS A** geode user
   **I WANT TO** have more information when an IO exception occurs
   **SO THAT** I can understand and fix the root cause of the problem
   
   `GemFireIOException` is used to encapsulate a given `IOException` that 
happen in the Geode code.
   For creating a `GemFireIOException` when a `IOException` is catched, this 
constructor is used:
   
   ```
   public GemFireIOException(String message, Throwable cause)  {
       super(message, cause);
   }
   ```
   
   The problem is that the `IOException` message is not part of the 
`GemFireIOException` message. So when a `GemFireIOException` is logged, the 
root cause of the problem is not shown.
   
   For example, the following message log message:
   
   ```
   "Cache initialization for GemFireCache[id = 1081136680; isClosing = false; 
isShutDownAll = false; created = Fri Jun 19 11:42:29 UTC 2020; server = false; 
copyOnRead = false; lockLease = 120; lockTimeout = 60] failed because: 
org.apache.geode.GemFireIOException: While starting cache server CacheServer on 
port=40404 client subscription config policy=none client subscription config 
capacity=1 client subscription config overflow directory=."
   ```
   
   It was logged at `GemFireCacheImpl`:
   
   ```
   logger.error("Cache initialization for " + toString() + " failed because:", 
throwable);
   ```
   
   And the `GemFireIOException` was created in `CacheCreation` in this way:
   
   ```
   } catch (IOException ex) {
        throw new GemFireIOException(format("While starting cache server %s", 
impl), ex);
   }
   ```
   
   This PR adds the wrapped exception message to the `GemFireIOException` 
exception message, so when the exception is catched and logged, the root cause 
will be known at first sight.


-- 
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:
[email protected]


Reply via email to