Fix ReCaptha NPE

Improve error handling when permission are removed.
This commit is contained in:
Paulo Gustavo Veiga
2012-09-06 23:52:53 -03:00
parent 743164ade4
commit 337a67a8f6
12 changed files with 84 additions and 24 deletions

View File

@@ -18,11 +18,21 @@
package com.wisemapping.exceptions;
import org.jetbrains.annotations.NotNull;
public class AccessDeniedSecurityException
extends Exception
extends ClientException
{
public AccessDeniedSecurityException(String msg)
public static final String MSG_KEY = "ACCESS_HAS_BEEN_REVOKED";
public AccessDeniedSecurityException(@NotNull String msg)
{
super(msg);
}
@NotNull
@Override
protected String getMsgBundleKey() {
return MSG_KEY;
}
}

View File

@@ -0,0 +1,20 @@
package com.wisemapping.exceptions;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.MessageSource;
import java.util.Locale;
abstract public class ClientException extends WiseMappingException {
public ClientException(@NotNull String message) {
super(message);
}
protected abstract
@NotNull
String getMsgBundleKey();
public String getMessage(@NotNull final MessageSource messageSource, final @NotNull Locale locale) {
return messageSource.getMessage(this.getMsgBundleKey(), null, locale);
}
}