Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2c7b8bd

Browse filesBrowse files
committed
report error stream even for 404
1 parent e9417f5 commit 2c7b8bd
Copy full SHA for 2c7b8bd

File tree

Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed

‎src/main/java/org/kohsuke/github/Requester.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/Requester.java
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public Requester with(String key, Integer value) {
107107
public Requester with(String key, boolean value) {
108108
return _with(key, value);
109109
}
110+
public Requester with(String key, Boolean value) {
111+
return _with(key, value);
112+
}
113+
110114

111115
public Requester with(String key, String value) {
112116
return _with(key, value);
@@ -251,7 +255,7 @@ public InputStream read(String tailApiUrl) throws IOException {
251255
buildRequest(uc);
252256

253257
try {
254-
return wrapStream(uc,uc.getInputStream());
258+
return wrapStream(uc, uc.getInputStream());
255259
} catch (IOException e) {
256260
handleApiError(e,uc);
257261
}
@@ -448,14 +452,15 @@ private InputStream wrapStream(HttpURLConnection uc, InputStream in) throws IOEx
448452
root.rateLimitHandler.onError(e,uc);
449453
}
450454

451-
if (e instanceof FileNotFoundException)
452-
throw e; // pass through 404 Not Found to allow the caller to handle it intelligently
453-
454455
InputStream es = wrapStream(uc, uc.getErrorStream());
455456
try {
456-
if (es!=null)
457-
throw (IOException)new IOException(IOUtils.toString(es,"UTF-8")).initCause(e);
458-
else
457+
if (es!=null) {
458+
if (e instanceof FileNotFoundException) {
459+
// pass through 404 Not Found to allow the caller to handle it intelligently
460+
throw (IOException) new FileNotFoundException(IOUtils.toString(es, "UTF-8")).initCause(e);
461+
} else
462+
throw (IOException) new IOException(IOUtils.toString(es, "UTF-8")).initCause(e);
463+
} else
459464
throw e;
460465
} finally {
461466
IOUtils.closeQuietly(es);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.