You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2018/12/17 10:36:22 UTC

svn commit: r1849074 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java

Author: kiwiwings
Date: Mon Dec 17 10:36:22 2018
New Revision: 1849074

URL: http://svn.apache.org/viewvc?rev=1849074&view=rev
Log:
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

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1849074&r1=1849073&r2=1849074&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Mon Dec 17 10:36:22 2018
@@ -265,23 +265,24 @@ public class XSLFPictureShape extends XS
 
     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;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org