From 1523a433e6c2e9d56201a52657985da87914ce53 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Mon, 12 Feb 2018 15:34:11 +0000 Subject: [PATCH] Fix some IntelliJ warnings in XDGF area git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1823988 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xdgf/usermodel/XDGFBaseContents.java | 3 +-- .../java/org/apache/poi/xdgf/usermodel/XDGFCell.java | 2 +- .../apache/poi/xdgf/usermodel/XDGFMasterContents.java | 4 +--- .../java/org/apache/poi/xdgf/usermodel/XDGFMasters.java | 4 +--- .../org/apache/poi/xdgf/usermodel/XDGFPageContents.java | 4 +--- .../java/org/apache/poi/xdgf/usermodel/XDGFPages.java | 4 +--- .../java/org/apache/poi/xdgf/usermodel/XDGFSheet.java | 4 ++-- .../org/apache/poi/xdgf/usermodel/XmlVisioDocument.java | 9 +++------ .../apache/poi/xdgf/usermodel/section/XDGFSection.java | 4 +--- .../poi/xdgf/usermodel/section/geometry/ArcTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/Ellipse.java | 5 +---- .../xdgf/usermodel/section/geometry/EllipticalArcTo.java | 5 +---- .../usermodel/section/geometry/GeometryRowFactory.java | 4 +--- .../xdgf/usermodel/section/geometry/InfiniteLine.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/LineTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/MoveTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/NURBSTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/PolyLineTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/RelCubBezTo.java | 5 +---- .../usermodel/section/geometry/RelEllipticalArcTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/RelLineTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/RelMoveTo.java | 5 +---- .../xdgf/usermodel/section/geometry/RelQuadBezTo.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/SplineKnot.java | 5 +---- .../poi/xdgf/usermodel/section/geometry/SplineStart.java | 5 +---- 25 files changed, 28 insertions(+), 89 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java index 37927d486d..f195089f88 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.poi.POIXMLException; import org.apache.poi.openxml4j.opc.PackagePart; -import org.apache.poi.openxml4j.opc.PackageRelationship; import org.apache.poi.util.Internal; import org.apache.poi.xdgf.exceptions.XDGFException; import org.apache.poi.xdgf.usermodel.shape.ShapeRenderer; @@ -112,7 +111,7 @@ public class XDGFBaseContents extends XDGFXMLDocumentPart { /** * Draws the contents of a page onto a Graphics2D object * - * @param graphics + * @param graphics The context to draw on. */ public void draw(Graphics2D graphics) { visitShapes(new ShapeRenderer(graphics)); diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java index f7f3291844..5b4ea2b52c 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java @@ -102,7 +102,7 @@ public class XDGFCell { } /** - * @param cell + * @param cell The type of the cell * @return A value converted to inches */ public static Double parseVLength(CellType cell) { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java index 8fd51324ad..192fd46bb2 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java @@ -47,9 +47,7 @@ public class XDGFMasterContents extends XDGFBaseContents { try { _pageContents = MasterContentsDocument.Factory.parse(getPackagePart().getInputStream()).getMasterContents(); - } catch (XmlException e) { - throw new POIXMLException(e); - } catch (IOException e) { + } catch (XmlException | IOException e) { throw new POIXMLException(e); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java index fdbd43d2aa..2e2c3de23d 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java @@ -62,9 +62,7 @@ public class XDGFMasters extends XDGFXMLDocumentPart { try { try { _mastersObject = MastersDocument.Factory.parse(getPackagePart().getInputStream()).getMasters(); - } catch (XmlException e) { - throw new POIXMLException(e); - } catch (IOException e) { + } catch (XmlException | IOException e) { throw new POIXMLException(e); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java index 3dfe3c9cc2..1edff81b79 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java @@ -46,9 +46,7 @@ public class XDGFPageContents extends XDGFBaseContents { try { try { _pageContents = PageContentsDocument.Factory.parse(getPackagePart().getInputStream()).getPageContents(); - } catch (XmlException e) { - throw new POIXMLException(e); - } catch (IOException e) { + } catch (XmlException | IOException e) { throw new POIXMLException(e); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java index 65d2f50cc3..9ac26de653 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java @@ -61,9 +61,7 @@ public class XDGFPages extends XDGFXMLDocumentPart { try { try { _pagesObject = PagesDocument.Factory.parse(getPackagePart().getInputStream()).getPages(); - } catch (XmlException e) { - throw new POIXMLException(e); - } catch (IOException e) { + } catch (XmlException | IOException e) { throw new POIXMLException(e); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFSheet.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFSheet.java index 1459cfd8b9..c04b1e55d2 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFSheet.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFSheet.java @@ -127,7 +127,7 @@ public abstract class XDGFSheet { } public Color getFontColor() { - Color fontColor = null; + Color fontColor; if (_character != null) { fontColor = _character.getFontColor(); @@ -143,7 +143,7 @@ public abstract class XDGFSheet { } public Double getFontSize() { - Double fontSize = null; + Double fontSize; if (_character != null) { fontSize = _character.getFontSize(); diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java index 071389200b..c3e211d8ff 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java @@ -26,7 +26,6 @@ import java.util.List; import org.apache.poi.POIXMLDocument; import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.POIXMLException; -import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; @@ -67,9 +66,7 @@ public class XmlVisioDocument extends POIXMLDocument { try { document = VisioDocumentDocument1.Factory.parse(getPackagePart().getInputStream()).getVisioDocument(); - } catch (XmlException e) { - throw new POIXMLException(e); - } catch (IOException e) { + } catch (XmlException | IOException e) { throw new POIXMLException(e); } @@ -84,7 +81,7 @@ public class XmlVisioDocument extends POIXMLDocument { } @Override - protected void onDocumentRead() throws IOException { + protected void onDocumentRead() { // by the time this gets called, all other document parts should // have been loaded, so it's safe to build the document structure @@ -112,7 +109,7 @@ public class XmlVisioDocument extends POIXMLDocument { * Not currently implemented */ @Override - public List getAllEmbedds() throws OpenXML4JException { + public List getAllEmbedds() { return new ArrayList<>(); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/XDGFSection.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/XDGFSection.java index d26fc888cf..add8f5aa4c 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/XDGFSection.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/XDGFSection.java @@ -55,9 +55,7 @@ public abstract class XDGFSection { _sectionTypes.put("Reviewer", GenericSection.class, SectionType.class, XDGFSheet.class); _sectionTypes.put("Annotation", GenericSection.class, SectionType.class, XDGFSheet.class); _sectionTypes.put("ActionTag", GenericSection.class, SectionType.class, XDGFSheet.class); - } catch (NoSuchMethodException e) { - throw new POIXMLException("Internal error"); - } catch (SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { throw new POIXMLException("Internal error"); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/ArcTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/ArcTo.java index be2a291c14..9b3908c5ce 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/ArcTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/ArcTo.java @@ -71,10 +71,7 @@ public class ArcTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/Ellipse.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/Ellipse.java index ba4d3ff67c..ab05c465c3 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/Ellipse.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/Ellipse.java @@ -82,10 +82,7 @@ public class Ellipse implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/EllipticalArcTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/EllipticalArcTo.java index 17db67c1fc..00f4076935 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/EllipticalArcTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/EllipticalArcTo.java @@ -94,10 +94,7 @@ public class EllipticalArcTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRowFactory.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRowFactory.java index aa9c336d56..f06280686b 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRowFactory.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRowFactory.java @@ -48,9 +48,7 @@ public class GeometryRowFactory { _rowTypes.put("RelQuadBezTo", RelQuadBezTo.class, RowType.class); _rowTypes.put("SplineKnot", SplineKnot.class, RowType.class); _rowTypes.put("SplineStart", SplineStart.class, RowType.class); - } catch (NoSuchMethodException e) { - throw new POIXMLException("Internal error", e); - } catch (SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { throw new POIXMLException("Internal error", e); } diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/InfiniteLine.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/InfiniteLine.java index 0fc79c231e..c70af455d6 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/InfiniteLine.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/InfiniteLine.java @@ -80,10 +80,7 @@ public class InfiniteLine implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/LineTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/LineTo.java index 9c24988b38..14fa036db5 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/LineTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/LineTo.java @@ -63,10 +63,7 @@ public class LineTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/MoveTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/MoveTo.java index 297b213e06..28e3d89996 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/MoveTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/MoveTo.java @@ -68,10 +68,7 @@ public class MoveTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/NURBSTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/NURBSTo.java index f945802651..832d6fac9a 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/NURBSTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/NURBSTo.java @@ -93,10 +93,7 @@ public class NURBSTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/PolyLineTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/PolyLineTo.java index 4b6d37ae5d..77e73d95a0 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/PolyLineTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/PolyLineTo.java @@ -67,10 +67,7 @@ public class PolyLineTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelCubBezTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelCubBezTo.java index 3988de313d..10c51bac56 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelCubBezTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelCubBezTo.java @@ -89,10 +89,7 @@ public class RelCubBezTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelEllipticalArcTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelEllipticalArcTo.java index d8fe5c69c3..bc4b659a21 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelEllipticalArcTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelEllipticalArcTo.java @@ -86,10 +86,7 @@ public class RelEllipticalArcTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelLineTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelLineTo.java index dc55211295..fb57e4c5e9 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelLineTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelLineTo.java @@ -62,10 +62,7 @@ public class RelLineTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelMoveTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelMoveTo.java index 0a2f9bf9d6..3e1652fc00 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelMoveTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelMoveTo.java @@ -58,10 +58,7 @@ public class RelMoveTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelQuadBezTo.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelQuadBezTo.java index ae07025484..50d3c7d354 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelQuadBezTo.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelQuadBezTo.java @@ -81,10 +81,7 @@ public class RelQuadBezTo implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineKnot.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineKnot.java index 640b10ea48..10765091cf 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineKnot.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineKnot.java @@ -70,10 +70,7 @@ public class SplineKnot implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineStart.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineStart.java index a427de6f1f..3aed3566da 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineStart.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineStart.java @@ -84,10 +84,7 @@ public class SplineStart implements GeometryRow { if (deleted != null) return deleted; - if (_master != null) - return _master.getDel(); - - return false; + return _master != null && _master.getDel(); } public Double getX() { -- 2.39.5