diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-05-06 17:00:46 +0200 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2021-05-06 17:00:46 +0200 |
commit | ac76c12854f5d4a224958fced8bbc741de56300a (patch) | |
tree | 471bde7e32b9064cad260cec8552b2c0f9aee8fc /configserver | |
parent | a6b228efce2e141a607b621c97697159a64b3d86 (diff) |
Handle SocketTimeoutException better when downloading files
Improve/fix log message when there is a socket exception
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java index 2cb94b4bb9e..4152c92c289 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java @@ -1,10 +1,11 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.filedistribution; import com.yahoo.config.FileReference; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.net.SocketTimeoutException; import java.net.URL; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; @@ -44,6 +45,8 @@ public class ApplicationFileManager implements AddFileInterface { rbc = Channels.newChannel(website.openStream()); fos = new FileOutputStream(file.getAbsolutePath()); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + } catch (SocketTimeoutException e) { + throw new IllegalArgumentException("Failed connecting to or reading from " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Failed creating directory " + file.getParent(), e); } finally { |