mirror of https://github.com/apache/jclouds.git
Make NovaErrorHandler logging of sensitive information configurable
This commit is contained in:
parent
f7b83f4563
commit
8b17dfea87
|
@ -26,8 +26,10 @@ import java.util.Set;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.date.DateCodecFactory;
|
||||
import org.jclouds.fallbacks.HeaderToRetryAfterException;
|
||||
import org.jclouds.http.HttpCommand;
|
||||
|
@ -52,6 +54,10 @@ import com.google.common.collect.ImmutableSet;
|
|||
@Singleton
|
||||
public class NovaErrorHandler implements HttpErrorHandler {
|
||||
|
||||
@com.google.inject.Inject(optional = true)
|
||||
@Named(Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO)
|
||||
private boolean logSensitiveInformation = false;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
protected final HeaderToRetryAfterException retryAfterParser;
|
||||
|
@ -76,7 +82,7 @@ public class NovaErrorHandler implements HttpErrorHandler {
|
|||
String content = data != null ? emptyToNull(new String(data)) : null;
|
||||
|
||||
Exception exception = content != null ? new HttpResponseException(command, response, content)
|
||||
: new HttpResponseException(command, response);
|
||||
: new HttpResponseException(command, response, logSensitiveInformation);
|
||||
String requestLine = command.getCurrentRequest().getRequestLine();
|
||||
String message = content != null ? content : String.format("%s -> %s", requestLine, response.getStatusLine());
|
||||
switch (response.getStatusCode()) {
|
||||
|
|
Loading…
Reference in New Issue