mirror of https://github.com/apache/cloudstack.git
volume upload: fixed the error message incase of wrong image format
This commit is contained in:
parent
d5bb2f16fc
commit
4f35d3611a
|
|
@ -385,9 +385,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
_resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.secondary_storage);
|
||||
}
|
||||
|
||||
ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
|
||||
if (imgfmt == null) {
|
||||
throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
|
||||
try {
|
||||
ImageFormat.valueOf(format.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.debug("ImageFormat IllegalArgumentException: " + e.getMessage());
|
||||
throw new IllegalArgumentException("Image format: " + format + " is incorrect. Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
|
||||
}
|
||||
|
||||
// Check that the the disk offering specified is valid
|
||||
|
|
|
|||
|
|
@ -198,9 +198,12 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
|
|||
featured = Boolean.FALSE;
|
||||
}
|
||||
|
||||
ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
|
||||
if (imgfmt == null) {
|
||||
throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
|
||||
ImageFormat imgfmt;
|
||||
try {
|
||||
imgfmt = ImageFormat.valueOf(format.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.debug("ImageFormat IllegalArgumentException: " + e.getMessage());
|
||||
throw new IllegalArgumentException("Image format: " + format + " is incorrect. Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
|
||||
}
|
||||
|
||||
// Check that the resource limit for templates/ISOs won't be exceeded
|
||||
|
|
|
|||
Loading…
Reference in New Issue