Hi Geode devs,

We received a comment of a Geode user saying that he got an error during a 
cache initialization and he found the error message was not too descriptive for 
him.
The message was the following:

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

The message was logged by GemFireCacheImpl as:

logger.error("Cache initialization for " + toString() + " failed because:", 
throwable);

As you can see, the "throwable" object was a GemFireIOException, which was 
thrown by CacheCreation.


GemFireIOException wraps other exceptions (I have checked the code and they are 
mostly IOExceptions, but also MessageTooLargeException, FileNotFoundException, 
SerializationException or just Exception) and it could be the case that useful 
information about the cause of the exception is hidden, depending on how 
meaningful is the message used in the constructor:



public GemFireIOException(String message, Throwable cause)  {
    super(message, cause);
}


With this constructor, the "cause" message is not included in the 
GemFireIOException message. I was thinking about changing the constructor to 
something like:


public GemFireIOException(String message, Throwable cause) {
  super(message + ( (cause != null) ? " ( " + cause.getMessage() + " )" : ""), 
cause);
}

Whats your opinion about this?

Thanks in advance,

Alberto B.





Reply via email to