|
26 | 26 | import org.apache.cloudstack.framework.config.ConfigKey; |
27 | 27 | import org.apache.commons.codec.binary.Base64; |
28 | 28 | import org.apache.commons.lang3.StringUtils; |
29 | | -import org.apache.log4j.Logger; |
30 | 29 |
|
31 | 30 | import com.cloud.exception.InvalidParameterValueException; |
32 | 31 | import com.cloud.utils.component.ManagerBase; |
33 | 32 | import com.cloud.utils.exception.CloudRuntimeException; |
34 | 33 |
|
35 | 34 | public class UserDataManagerImpl extends ManagerBase implements UserDataManager { |
36 | | - private static final Logger s_logger = Logger.getLogger(UserDataManagerImpl.class); |
37 | 35 | private static final int MAX_USER_DATA_LENGTH_BYTES = 2048; |
38 | 36 | private static final int MAX_HTTP_GET_LENGTH = 2 * MAX_USER_DATA_LENGTH_BYTES; // 4KB |
39 | 37 | private static final int NUM_OF_2K_BLOCKS = 512; |
@@ -89,9 +87,9 @@ public String concatenateUserData(String userdata1, String userdata2, String use |
89 | 87 |
|
90 | 88 | @Override |
91 | 89 | public String validateUserData(String userData, BaseCmd.HTTPMethod httpmethod) { |
92 | | - s_logger.trace(String.format("Validating base64 encoded user data: [%s].", userData)); |
| 90 | + logger.trace(String.format("Validating base64 encoded user data: [%s].", userData)); |
93 | 91 | if (StringUtils.isBlank(userData)) { |
94 | | - s_logger.debug("Null/empty base64 encoded user data set"); |
| 92 | + logger.debug("Null/empty base64 encoded user data set"); |
95 | 93 | return null; |
96 | 94 | } |
97 | 95 |
|
@@ -126,17 +124,17 @@ private byte[] validateAndDecodeByHTTPMethod(String userData, int maxHTTPLength, |
126 | 124 | throw new InvalidParameterValueException("User data is too short."); |
127 | 125 | } |
128 | 126 |
|
129 | | - s_logger.trace(String.format("Decoded user data: [%s].", decodedUserData)); |
| 127 | + logger.trace(String.format("Decoded user data: [%s].", decodedUserData)); |
130 | 128 | int userDataLength = userData.length(); |
131 | 129 | int decodedUserDataLength = decodedUserData.length; |
132 | | - s_logger.info(String.format("Configured base64 encoded user data size: %d bytes, actual user data size: %d bytes", userDataLength, decodedUserDataLength)); |
| 130 | + logger.info(String.format("Configured base64 encoded user data size: %d bytes, actual user data size: %d bytes", userDataLength, decodedUserDataLength)); |
133 | 131 |
|
134 | 132 | if (userDataLength > maxHTTPLength) { |
135 | | - s_logger.warn(String.format("Base64 encoded user data (size: %d bytes) too long for http %s request (accepted size: %d bytes)", userDataLength, httpMethod.toString(), maxHTTPLength)); |
| 133 | + logger.warn(String.format("Base64 encoded user data (size: %d bytes) too long for http %s request (accepted size: %d bytes)", userDataLength, httpMethod.toString(), maxHTTPLength)); |
136 | 134 | throw new InvalidParameterValueException(String.format("User data is too long for http %s request", httpMethod.toString())); |
137 | 135 | } |
138 | 136 | if (userDataLength > VM_USERDATA_MAX_LENGTH.value()) { |
139 | | - s_logger.warn(String.format("Base64 encoded user data (size: %d bytes) has exceeded configurable max length of %d bytes", userDataLength, VM_USERDATA_MAX_LENGTH.value())); |
| 137 | + logger.warn(String.format("Base64 encoded user data (size: %d bytes) has exceeded configurable max length of %d bytes", userDataLength, VM_USERDATA_MAX_LENGTH.value())); |
140 | 138 | throw new InvalidParameterValueException("User data has exceeded configurable max length: " + VM_USERDATA_MAX_LENGTH.value()); |
141 | 139 | } |
142 | 140 |
|
|
0 commit comments