diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/src/main/java/com/yahoo/application/Application.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/application/src/main/java/com/yahoo/application/Application.java b/application/src/main/java/com/yahoo/application/Application.java index 88140873b7b..64ced48edd3 100644 --- a/application/src/main/java/com/yahoo/application/Application.java +++ b/application/src/main/java/com/yahoo/application/Application.java @@ -20,6 +20,7 @@ import com.yahoo.search.rendering.Renderer; import com.yahoo.text.StringUtilities; import com.yahoo.text.Utf8; import com.yahoo.vespa.model.VespaModel; +import com.yahoo.yolean.Exceptions; import org.xml.sax.SAXException; import java.io.File; @@ -315,8 +316,9 @@ public final class Application implements AutoCloseable { break; } catch (Error e) { // the container thinks this is really serious, in this case is it not in the cause is a BindException // catch bind error and reset container - if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof BindException) { - exception = (Exception) e.getCause().getCause(); + Optional<BindException> bindException = Exceptions.findCause(e, BindException.class); + if (bindException.isPresent()) { + exception = bindException.get(); com.yahoo.container.Container.resetInstance(); // this is needed to be able to recreate the container from config again } else { throw new Exception(e.getCause()); |