263
264 template <> void DCmdArgument<StringArrayArgument*>::init_value(TRAPS) {
265 _value = new StringArrayArgument();
266 _allow_multiple = true;
267 if (has_default()) {
268 fatal("StringArrayArgument cannot have default value");
269 }
270 }
271
272 template <> void DCmdArgument<StringArrayArgument*>::destroy_value() {
273 if (_value != NULL) {
274 delete _value;
275 set_value(NULL);
276 }
277 }
278
279 template <> void DCmdArgument<MemorySizeArgument>::parse_value(const char* str,
280 size_t len, TRAPS) {
281 if (str == NULL) {
282 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
283 "Integer parsing error nanotime value: syntax error");
284 }
285
286 if (*str == '-') {
287 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
288 "Parsing error memory size value: negative values not allowed");
289 }
290 int res = sscanf(str, UINT64_FORMAT "%c", &_value._val, &_value._multiplier);
291 if (res == 2) {
292 switch (_value._multiplier) {
293 case 'k': case 'K':
294 _value._size = _value._val * 1024;
295 break;
296 case 'm': case 'M':
297 _value._size = _value._val * 1024 * 1024;
298 break;
299 case 'g': case 'G':
300 _value._size = _value._val * 1024 * 1024 * 1024;
301 break;
302 default:
303 _value._size = _value._val;
|
263
264 template <> void DCmdArgument<StringArrayArgument*>::init_value(TRAPS) {
265 _value = new StringArrayArgument();
266 _allow_multiple = true;
267 if (has_default()) {
268 fatal("StringArrayArgument cannot have default value");
269 }
270 }
271
272 template <> void DCmdArgument<StringArrayArgument*>::destroy_value() {
273 if (_value != NULL) {
274 delete _value;
275 set_value(NULL);
276 }
277 }
278
279 template <> void DCmdArgument<MemorySizeArgument>::parse_value(const char* str,
280 size_t len, TRAPS) {
281 if (str == NULL) {
282 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
283 "Parsing error memory size value: syntax error, value is null\n");
284 }
285
286 if (*str == '-') {
287 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
288 "Parsing error memory size value: negative values not allowed");
289 }
290 int res = sscanf(str, UINT64_FORMAT "%c", &_value._val, &_value._multiplier);
291 if (res == 2) {
292 switch (_value._multiplier) {
293 case 'k': case 'K':
294 _value._size = _value._val * 1024;
295 break;
296 case 'm': case 'M':
297 _value._size = _value._val * 1024 * 1024;
298 break;
299 case 'g': case 'G':
300 _value._size = _value._val * 1024 * 1024 * 1024;
301 break;
302 default:
303 _value._size = _value._val;
|