diff options
author | James Moger <james.moger@gitblit.com> | 2011-10-26 17:12:50 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-10-26 17:12:50 -0400 |
commit | 8b76369fb44bfd863b27bcede453d676905f52e5 (patch) | |
tree | cf9c57774855af728b845e4108a0c5f5acbb64ad /src/com/gitblit/utils/JsonUtils.java | |
parent | 284a7bd54e9cddb0eabcd77148ee64639010d2ee (diff) | |
download | gitblit-8b76369fb44bfd863b27bcede453d676905f52e5.tar.gz gitblit-8b76369fb44bfd863b27bcede453d676905f52e5.zip |
Properly catch Not Allowed (405) and Unknown Request (501) errors
Diffstat (limited to 'src/com/gitblit/utils/JsonUtils.java')
-rw-r--r-- | src/com/gitblit/utils/JsonUtils.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java index 0c78df95..5b53bf46 100644 --- a/src/com/gitblit/utils/JsonUtils.java +++ b/src/com/gitblit/utils/JsonUtils.java @@ -46,6 +46,7 @@ import javax.net.ssl.X509TrustManager; import org.eclipse.jgit.util.Base64;
import com.gitblit.GitBlitException.ForbiddenException;
+import com.gitblit.GitBlitException.NotAllowedException;
import com.gitblit.GitBlitException.UnauthorizedException;
import com.gitblit.GitBlitException.UnknownRequestException;
import com.gitblit.models.RepositoryModel;
@@ -158,7 +159,7 @@ public class JsonUtils { }
return gson().fromJson(json, type);
}
-
+
/**
* Reads a gson object from the specified url.
*
@@ -216,6 +217,12 @@ public class JsonUtils { } else if (e.getMessage().indexOf("403") > -1) {
// requested url is forbidden by the requesting user
throw new ForbiddenException(url);
+ } else if (e.getMessage().indexOf("405") > -1) {
+ // requested url is not allowed by the server
+ throw new NotAllowedException(url);
+ } else if (e.getMessage().indexOf("501") > -1) {
+ // requested url is not recognized by the server
+ throw new UnknownRequestException(url);
}
throw e;
}
@@ -278,6 +285,9 @@ public class JsonUtils { } else if (e.getMessage().indexOf("403") > -1) {
// requested url is forbidden by the requesting user
throw new ForbiddenException(url);
+ } else if (e.getMessage().indexOf("405") > -1) {
+ // requested url is not allowed by the server
+ throw new NotAllowedException(url);
} else if (e.getMessage().indexOf("501") > -1) {
// requested url is not recognized by the server
throw new UnknownRequestException(url);
|