changed to bouncer pattern - to match also the rest of the code

see https://softwareengineering.stackexchange.com/questions/18454/should-i-return-from-a-function-early-or-use-an-if-statement

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849074 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2018-12-17 10:36:22 +00:00
parent bb7ffebe0f
commit 3452ea963d

View File

@ -265,23 +265,24 @@ public class XSLFPictureShape extends XSLFSimpleShape
public XSLFPictureData getSvgImage() {
CTBlip blip = getBlip();
if (blip != null) {
CTOfficeArtExtensionList extLst = blip.getExtLst();
if (extLst == null) {
return null;
}
if (blip == null) {
return null;
}
CTOfficeArtExtensionList extLst = blip.getExtLst();
if (extLst == null) {
return null;
}
int size = extLst.sizeOfExtArray();
for (int i = 0; i < size; i++) {
XmlCursor cur = extLst.getExtArray(i).newCursor();
try {
if (cur.toChild(SVG_NS, "svgBlip")) {
String svgRelId = cur.getAttributeText(new QName(CORE_PROPERTIES_ECMA376_NS, "embed"));
return (svgRelId != null) ? (XSLFPictureData) getSheet().getRelationById(svgRelId) : null;
}
} finally {
cur.dispose();
int size = extLst.sizeOfExtArray();
for (int i = 0; i < size; i++) {
XmlCursor cur = extLst.getExtArray(i).newCursor();
try {
if (cur.toChild(SVG_NS, "svgBlip")) {
String svgRelId = cur.getAttributeText(new QName(CORE_PROPERTIES_ECMA376_NS, "embed"));
return (svgRelId != null) ? (XSLFPictureData) getSheet().getRelationById(svgRelId) : null;
}
} finally {
cur.dispose();
}
}
return null;