]> source.dussan.org Git - jgit.git/commitdiff
Clarify description of ServiceNotAuthorizedException 77/49277/1
authorJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:13:16 +0000 (16:13 -0700)
committerJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:54:07 +0000 (16:54 -0700)
This exception's detail message states

Service not permitted

and according to the Javadoc it indicates that the current user does not
have access to the service.  In practice, though, callers handle this
exception by presenting a '401 Unauthorized' response to the client,
meaning that the user is unauthenticated and should authenticate.

Clarify the documentation and detail message to match the practice.

The exception message is not used anywhere except logs.  No
client-visible effect intended.

Change-Id: I2c6be9cb74af932f0dcb121a381a64f2ad876766
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotAuthorizedException.java

index db9a684585e16600316f2e5f0c3f62c499c76898..dbe5973a79c6280516aa75df6d777fd5fc47f926 100644 (file)
@@ -531,7 +531,6 @@ selectingCommits=Selecting commits
 sequenceTooLargeForDiffAlgorithm=Sequence too large for difference algorithm.
 serviceNotEnabledNoName=Service not enabled
 serviceNotPermitted={0} not permitted
-serviceNotPermittedNoName=Service not permitted
 shallowCommitsAlreadyInitialized=Shallow commits have already been initialized
 shortCompressedStreamAt=Short compressed stream at {0}
 shortReadOfBlock=Short read of block.
@@ -602,6 +601,7 @@ unableToCheckConnectivity=Unable to check connectivity.
 unableToCreateNewObject=Unable to create new object: {0}
 unableToStore=Unable to store {0}.
 unableToWrite=Unable to write {0}
+unauthorized=Unauthorized
 unencodeableFile=Unencodable file: {0}
 unexpectedCompareResult=Unexpected metadata comparison result: {0}
 unexpectedEndOfConfigFile=Unexpected end of config file
index 9f6efef570eb65c80f2f8fae95163a144735fb68..494114f70531cc0697b93659db05e51ae660a7ed 100644 (file)
@@ -590,7 +590,6 @@ public class JGitText extends TranslationBundle {
        /***/ public String sequenceTooLargeForDiffAlgorithm;
        /***/ public String serviceNotEnabledNoName;
        /***/ public String serviceNotPermitted;
-       /***/ public String serviceNotPermittedNoName;
        /***/ public String shallowCommitsAlreadyInitialized;
        /***/ public String shortCompressedStreamAt;
        /***/ public String shortReadOfBlock;
@@ -661,6 +660,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String unableToCreateNewObject;
        /***/ public String unableToStore;
        /***/ public String unableToWrite;
+       /***/ public String unauthorized;
        /***/ public String unencodeableFile;
        /***/ public String unexpectedCompareResult;
        /***/ public String unexpectedEndOfConfigFile;
index a2c6edc8288306b93ac037232ff62fa671569525..3c16556b4196319d532999d3921b2ad99e5a165e 100644 (file)
@@ -45,12 +45,17 @@ package org.eclipse.jgit.transport.resolver;
 
 import org.eclipse.jgit.internal.JGitText;
 
-/** Indicates the request service is not authorized for current user. */
+/**
+ * Indicates that the requested service requires authentication that
+ * the current user has not provided.
+ * <p>
+ * This corresponds to response code
+ * {@link javax.servlet.http.HttpServletResponse#SC_UNAUTHORIZED}.
+ */
 public class ServiceNotAuthorizedException extends Exception {
        private static final long serialVersionUID = 1L;
 
-       /** Indicates the request service is not available. */
        public ServiceNotAuthorizedException() {
-               super(JGitText.get().serviceNotPermittedNoName);
+               super(JGitText.get().unauthorized);
        }
 }