@@ -81,23 +81,6 @@ public enum CommandType {
8181 BOOLEAN , DATE , FLOAT , INTEGER , SHORT , LIST , LONG , OBJECT , MAP , STRING , TZDATE , UUID
8282 }
8383
84- // FIXME: Extract these out into a separate file
85- // Client error codes
86- public static final int MALFORMED_PARAMETER_ERROR = 430 ;
87- public static final int PARAM_ERROR = 431 ;
88- public static final int UNSUPPORTED_ACTION_ERROR = 432 ;
89- public static final int PAGE_LIMIT_EXCEED = 433 ;
90- public static final int API_LIMIT_EXCEED = 429 ;
91-
92- // Server error codes
93- public static final int INTERNAL_ERROR = 530 ;
94- public static final int ACCOUNT_ERROR = 531 ;
95- public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532 ;
96- public static final int INSUFFICIENT_CAPACITY_ERROR = 533 ;
97- public static final int RESOURCE_UNAVAILABLE_ERROR = 534 ;
98- public static final int RESOURCE_ALLOCATION_ERROR = 534 ;
99- public static final int RESOURCE_IN_USE_ERROR = 536 ;
100- public static final int NETWORK_RULE_CONFLICT_ERROR = 537 ;
10184
10285 public static final DateFormat INPUT_FORMAT = new SimpleDateFormat ("yyyy-MM-dd" );
10386 public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" );
@@ -231,7 +214,7 @@ public Map<String, Object> unpackParams(Map<String, String> params) {
231214 int arrayStartIndex = key .indexOf ('[' );
232215 int arrayStartLastIndex = key .lastIndexOf ('[' );
233216 if (arrayStartIndex != arrayStartLastIndex ) {
234- throw new ServerApiException (MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
217+ throw new ServerApiException (ApiErrorCode . MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
235218 + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup" );
236219 }
237220
@@ -240,15 +223,15 @@ public Map<String, Object> unpackParams(Map<String, String> params) {
240223 int arrayEndLastIndex = key .lastIndexOf (']' );
241224 if ((arrayEndIndex < arrayStartIndex ) || (arrayEndIndex != arrayEndLastIndex )) {
242225 // malformed parameter
243- throw new ServerApiException (MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
226+ throw new ServerApiException (ApiErrorCode . MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
244227 + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup" );
245228 }
246229
247230 // Now that we have an array object, check for a field name in the case of a complex object
248231 int fieldIndex = key .indexOf ('.' );
249232 String fieldName = null ;
250233 if (fieldIndex < arrayEndIndex ) {
251- throw new ServerApiException (MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
234+ throw new ServerApiException (ApiErrorCode . MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
252235 + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup" );
253236 } else {
254237 fieldName = key .substring (fieldIndex + 1 );
@@ -273,7 +256,7 @@ public Map<String, Object> unpackParams(Map<String, String> params) {
273256 }
274257
275258 if (!parsedIndex ) {
276- throw new ServerApiException (MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
259+ throw new ServerApiException (ApiErrorCode . MALFORMED_PARAMETER_ERROR , "Unable to decode parameter " + key
277260 + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup" );
278261 }
279262
0 commit comments