Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit b4fb868

Browse files
Added new CloudTimeoutException
1 parent 387a45b commit b4fb868

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.cryptomator.cloudaccess.api.exceptions;
2+
3+
public class CloudTimeoutException extends CloudProviderException {
4+
5+
public CloudTimeoutException(Throwable cause) {
6+
super(cause);
7+
}
8+
9+
}

src/main/java/org/cryptomator/cloudaccess/webdav/WebDavClient.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.cryptomator.cloudaccess.api.Quota;
1313
import org.cryptomator.cloudaccess.api.exceptions.AlreadyExistsException;
1414
import org.cryptomator.cloudaccess.api.exceptions.CloudProviderException;
15+
import org.cryptomator.cloudaccess.api.exceptions.CloudTimeoutException;
1516
import org.cryptomator.cloudaccess.api.exceptions.InsufficientStorageException;
1617
import org.cryptomator.cloudaccess.api.exceptions.NotFoundException;
1718
import org.cryptomator.cloudaccess.api.exceptions.ParentFolderDoesNotExistException;
@@ -23,6 +24,7 @@
2324
import java.io.ByteArrayInputStream;
2425
import java.io.IOException;
2526
import java.io.InputStream;
27+
import java.io.InterruptedIOException;
2628
import java.net.HttpURLConnection;
2729
import java.net.MalformedURLException;
2830
import java.net.URL;
@@ -53,6 +55,8 @@ CloudItemMetadata itemMetadata(final CloudPath path) throws CloudProviderExcepti
5355
checkPropfindExecutionSucceeded(response.code());
5456

5557
return processGet(getEntriesFromResponse(response), path);
58+
} catch (InterruptedIOException e) {
59+
throw new CloudTimeoutException(e);
5660
} catch (IOException | SAXException e) {
5761
throw new CloudProviderException(e);
5862
}
@@ -80,6 +84,8 @@ Quota quota(final CloudPath folder) throws CloudProviderException {
8084
try (final var responseBody = response.body()) {
8185
return new PropfindResponseParser().parseQuta(responseBody.byteStream());
8286
}
87+
} catch (InterruptedIOException e) {
88+
throw new CloudTimeoutException(e);
8389
} catch (IOException | SAXException e) {
8490
throw new CloudProviderException(e);
8591
}
@@ -93,6 +99,8 @@ CloudItemList list(final CloudPath folder) throws CloudProviderException {
9399
final var nodes = getEntriesFromResponse(response);
94100

95101
return processDirList(nodes, folder);
102+
} catch (InterruptedIOException e) {
103+
throw new CloudTimeoutException(e);
96104
} catch (IOException | SAXException e) {
97105
throw new CloudProviderException(e);
98106
}
@@ -202,6 +210,8 @@ CloudPath move(final CloudPath from, final CloudPath to, boolean replace) throws
202210
throw new CloudProviderException("Response code isn't between 200 and 300: " + response.code());
203211
}
204212
}
213+
} catch (InterruptedIOException e) {
214+
throw new CloudTimeoutException(e);
205215
} catch (IOException e) {
206216
throw new CloudProviderException(e);
207217
}
@@ -247,6 +257,8 @@ private InputStream read(final Request.Builder getRequest, final ProgressListene
247257
throw new CloudProviderException("Response code isn't between 200 and 300: " + response.code());
248258
}
249259
}
260+
} catch (InterruptedIOException e) {
261+
throw new CloudTimeoutException(e);
250262
} catch (IOException e) {
251263
throw new CloudProviderException(e);
252264
} finally {
@@ -286,6 +298,8 @@ void write(final CloudPath file, final boolean replace, final InputStream data,
286298
throw new CloudProviderException("Response code isn't between 200 and 300: " + response.code());
287299
}
288300
}
301+
} catch (InterruptedIOException e) {
302+
throw new CloudTimeoutException(e);
289303
} catch (IOException e) {
290304
throw new CloudProviderException(e);
291305
}
@@ -324,6 +338,8 @@ CloudPath createFolder(final CloudPath path) throws CloudProviderException {
324338
throw new CloudProviderException("Response code isn't between 200 and 300: " + response.code());
325339
}
326340
}
341+
} catch (InterruptedIOException e) {
342+
throw new CloudTimeoutException(e);
327343
} catch (IOException e) {
328344
throw new CloudProviderException(e);
329345
}
@@ -348,6 +364,8 @@ void delete(final CloudPath path) throws CloudProviderException {
348364
throw new CloudProviderException("Response code isn't between 200 and 300: " + response.code());
349365
}
350366
}
367+
} catch (InterruptedIOException e) {
368+
throw new CloudTimeoutException(e);
351369
} catch (IOException e) {
352370
throw new CloudProviderException(e);
353371
}

0 commit comments

Comments
 (0)