If we hit an unknown picture type, don't break completely - report an error but carry on without the picture
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@463202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ccc494626e
commit
353eafdd29
@ -271,10 +271,15 @@ public class HSLFSlideShow extends POIDocument
|
||||
byte[] imgdata = new byte[imgsize];
|
||||
System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length);
|
||||
|
||||
PictureData pict = PictureData.create(type - 0xF018);
|
||||
pict.setRawData(imgdata);
|
||||
pict.setOffset(offset);
|
||||
p.add(pict);
|
||||
try {
|
||||
PictureData pict = PictureData.create(type - 0xF018);
|
||||
pict.setRawData(imgdata);
|
||||
pict.setOffset(offset);
|
||||
p.add(pict);
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.err.println("Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
|
||||
}
|
||||
|
||||
pos += imgsize;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public abstract class PictureData {
|
||||
pict = new PNG();
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported picture type: " + type);
|
||||
throw new IllegalArgumentException("Unsupported picture type: " + type);
|
||||
}
|
||||
return pict;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user