mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'bugfix/CID-1114601'
This commit is contained in:
commit
e327716b89
@ -24,4 +24,8 @@ public class InternalErrorException extends ManagementServerException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InternalErrorException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,4 +30,8 @@ public class ManagementServerException extends CloudException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ManagementServerException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -79,13 +79,25 @@ public class VhdProcessor extends AdapterBase implements Processor {
|
||||
byte[] creatorApp = new byte[4];
|
||||
try {
|
||||
strm = new FileInputStream(vhdFile);
|
||||
strm.skip(info.size - vhdFooterSize + vhdFooterCreatorAppOffset);
|
||||
strm.read(creatorApp);
|
||||
strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
|
||||
strm.read(currentSize);
|
||||
} catch (Exception e) {
|
||||
long skipped = strm.skip(info.size - vhdFooterSize + vhdFooterCreatorAppOffset);
|
||||
if (skipped == -1) {
|
||||
throw new InternalErrorException("Unexpected end-of-file");
|
||||
}
|
||||
long read = strm.read(creatorApp);
|
||||
if (read == -1) {
|
||||
throw new InternalErrorException("Unexpected end-of-file");
|
||||
}
|
||||
skipped = strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
|
||||
if (skipped == -1) {
|
||||
throw new InternalErrorException("Unexpected end-of-file");
|
||||
}
|
||||
read = strm.read(currentSize);
|
||||
if (read == -1) {
|
||||
throw new InternalErrorException("Unexpected end-of-file");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.warn("Unable to read vhd file " + vhdPath, e);
|
||||
throw new InternalErrorException("Unable to read vhd file " + vhdPath + ": " + e);
|
||||
throw new InternalErrorException("Unable to read vhd file " + vhdPath + ": " + e, e);
|
||||
} finally {
|
||||
if (strm != null) {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user