You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/11/15 03:56:31 UTC
[1/3] git commit: ACCUMULO-1891 sets errorcode to default if it is
null during message lookup.
Updated Branches:
refs/heads/1.6.0-SNAPSHOT 484053a2f -> 28bbb56f3
ACCUMULO-1891 sets errorcode to default if it is null during message lookup.
Signed-off-by: Christopher Tubbs <ct...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/268028f8
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/268028f8
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/268028f8
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 268028f8c17118208d45119ec26fc3e929a7f179
Parents: 1e96138
Author: Sean Busbey <bu...@clouderagovt.com>
Authored: Wed Nov 13 16:15:10 2013 -0600
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Thu Nov 14 21:48:34 2013 -0500
----------------------------------------------------------------------
.../apache/accumulo/core/client/AccumuloSecurityException.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/268028f8/src/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java b/src/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
index d1bb0cb..a8c3187 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
@@ -27,6 +27,9 @@ public class AccumuloSecurityException extends Exception {
private static final long serialVersionUID = 1L;
private static String getDefaultErrorMessage(SecurityErrorCode errorcode) {
+ if (null == errorcode) {
+ errorcode = SecurityErrorCode.DEFAULT_SECURITY_ERROR;
+ }
switch (errorcode) {
case BAD_CREDENTIALS:
return "Username or Password is Invalid";
[2/3] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Posted by ct...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Conflicts:
core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ac20fe06
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ac20fe06
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ac20fe06
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: ac20fe06cf7627bc7f25d455d4bff7b4fa057a34
Parents: 7551b55 268028f
Author: Christopher Tubbs <ct...@apache.org>
Authored: Thu Nov 14 21:51:29 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Thu Nov 14 21:51:29 2013 -0500
----------------------------------------------------------------------
.../org/apache/accumulo/core/client/AccumuloSecurityException.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ac20fe06/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
index 890db36,0000000..ea73640
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
@@@ -1,135 -1,0 +1,135 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client;
+
+import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
+
+/**
+ * An Accumulo Exception for security violations, authentication failures, authorization failures, etc.
+ *
+ */
+public class AccumuloSecurityException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ private static String getDefaultErrorMessage(final SecurityErrorCode errorcode) {
- switch (errorcode) {
++ switch (errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode) {
+ case BAD_CREDENTIALS:
+ return "Username or Password is Invalid";
+ case CONNECTION_ERROR:
+ return "Connection Error Occurred";
+ case PERMISSION_DENIED:
+ return "User does not have permission to perform this action";
+ case USER_DOESNT_EXIST:
+ return "The user does not exist";
+ case USER_EXISTS:
+ return "The user exists";
+ case GRANT_INVALID:
+ return "The GRANT permission cannot be granted or revoked";
+ case BAD_AUTHORIZATIONS:
+ return "The user does not have the specified authorizations assigned";
+ case UNSUPPORTED_OPERATION:
+ return "The configured security handler does not support this operation";
+ case INVALID_TOKEN:
+ return "The configured authenticator does not accept this type of token";
+ case AUTHENTICATOR_FAILED:
+ return "The configured authenticator failed for some reason";
+ case AUTHORIZOR_FAILED:
+ return "The configured authorizor failed for some reason";
+ case PERMISSIONHANDLER_FAILED:
+ return "The configured permission handler failed for some reason";
+ case TOKEN_EXPIRED:
+ return "The supplied token expired, please update and try again";
+ case INSUFFICIENT_PROPERTIES:
+ return "The login properties supplied are not sufficient for authentication. Please check the requested properties and try again";
+ case DEFAULT_SECURITY_ERROR:
+ default:
+ return "Unknown security exception";
+ }
+ }
+
+ private String user;
+ private SecurityErrorCode errorCode;
+
+ /**
+ * @return this exception as a thrift exception
+ */
+ public ThriftSecurityException asThriftException() {
+ return new ThriftSecurityException(user, errorCode);
+ }
+
+ /**
+ * @param user
+ * the relevant user for the security violation
+ * @param errorcode
+ * the specific reason for this exception
+ * @param cause
+ * the exception that caused this violation
+ */
+ public AccumuloSecurityException(final String user, final SecurityErrorCode errorcode, final Throwable cause) {
+ super(getDefaultErrorMessage(errorcode), cause);
+ this.user = user;
+ this.errorCode = errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode;
+ }
+
+ /**
+ * @param user
+ * the relevant user for the security violation
+ * @param errorcode
+ * the specific reason for this exception
+ */
+ public AccumuloSecurityException(final String user, final SecurityErrorCode errorcode) {
+ super(getDefaultErrorMessage(errorcode));
+ this.user = user;
+ this.errorCode = errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode;
+ }
+
+ /**
+ * @return the relevant user for the security violation
+ */
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String s) {
+ this.user = s;
+ }
+
+ /**
+ * @return the specific reason for this exception
+ * @since 1.5.0
+ */
+
+ public org.apache.accumulo.core.client.security.SecurityErrorCode getSecurityErrorCode() {
+ return org.apache.accumulo.core.client.security.SecurityErrorCode.valueOf(errorCode.name());
+ }
+
+ /**
+ * @return the specific reason for this exception
+ *
+ * @deprecated since 1.5.0; Use {@link #getSecurityErrorCode()} instead.
+ */
+ @Deprecated
+ public org.apache.accumulo.core.security.thrift.SecurityErrorCode getErrorCode() {
+ return org.apache.accumulo.core.security.thrift.SecurityErrorCode.valueOf(errorCode.name());
+ }
+
+ @Override
+ public String getMessage() {
+ return "Error " + errorCode + " for user " + user + " - " + super.getMessage();
+ }
+}
[3/3] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Posted by ct...@apache.org.
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/28bbb56f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/28bbb56f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/28bbb56f
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 28bbb56f32a49a2d2dd0a7730ec90b7455a0c9d0
Parents: 484053a ac20fe0
Author: Christopher Tubbs <ct...@apache.org>
Authored: Thu Nov 14 21:52:39 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Thu Nov 14 21:52:39 2013 -0500
----------------------------------------------------------------------
.../org/apache/accumulo/core/client/AccumuloSecurityException.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/28bbb56f/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
index f626f4d,ea73640..06b148d
--- a/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
@@@ -26,9 -25,9 +26,9 @@@ import org.apache.commons.lang.StringUt
*/
public class AccumuloSecurityException extends Exception {
private static final long serialVersionUID = 1L;
-
+
private static String getDefaultErrorMessage(final SecurityErrorCode errorcode) {
- switch (errorcode) {
+ switch (errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode) {
case BAD_CREDENTIALS:
return "Username or Password is Invalid";
case CONNECTION_ERROR: