]> source.dussan.org Git - poi.git/commitdiff
sonar fixes
authorAndreas Beeker <kiwiwings@apache.org>
Tue, 22 May 2018 22:39:22 +0000 (22:39 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Tue, 22 May 2018 22:39:22 +0000 (22:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832067 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
src/java/org/apache/poi/sl/draw/DrawShape.java
src/java/org/apache/poi/ss/formula/FormulaParser.java

index b36c425f8c2ed26a99448b3ca9f76930a94395f1..f85fd0ab2a4fc7e238a7f888e0a59b6acc943abb 100644 (file)
@@ -365,12 +365,16 @@ public class AddDimensionedImage {
 
         anchor.setDx1(0);
         anchor.setDy1(0);
-        anchor.setDx2(colClientAnchorDetail.getInset());
-        anchor.setDy2(rowClientAnchorDetail.getInset());
-        anchor.setCol1(colClientAnchorDetail.getFromIndex());
-        anchor.setRow1(rowClientAnchorDetail.getFromIndex());
-        anchor.setCol2(colClientAnchorDetail.getToIndex());
-        anchor.setRow2(rowClientAnchorDetail.getToIndex());
+        if (colClientAnchorDetail != null) {
+            anchor.setDx2(colClientAnchorDetail.getInset());
+            anchor.setCol1(colClientAnchorDetail.getFromIndex());
+            anchor.setCol2(colClientAnchorDetail.getToIndex());
+        }
+        if (rowClientAnchorDetail != null) {
+            anchor.setDy2(rowClientAnchorDetail.getInset());
+            anchor.setRow1(rowClientAnchorDetail.getFromIndex());
+            anchor.setRow2(rowClientAnchorDetail.getToIndex());
+        }
 
         // For now, set the anchor type to do not move or resize the
         // image as the size of the row/column is adjusted. This could easily
index 807d2e59ba75772d91949b2199f865109a21621a..df5960b538cc107992c27cd18d44980ff5544180 100644 (file)
@@ -56,7 +56,7 @@ public class DrawShape implements Drawable {
      */
     @Override
     public void applyTransform(Graphics2D graphics) {
-        if (!(shape instanceof PlaceableShape)) {
+        if (!(shape instanceof PlaceableShape) || graphics == null) {
             return;
         }
 
index c8b9b4dc521ab0c82774d8d07f7ef3e1f4c90807..5eafdfcca82fda2217510253b7d12888446e07e7 100644 (file)
@@ -1711,10 +1711,11 @@ public final class FormulaParser {
 
     private int parseErrorLiteral() {
         Match('#');
-        String part1 = parseUnquotedIdentifier().toUpperCase(Locale.ROOT);
+        String part1 = parseUnquotedIdentifier();
         if (part1 == null) {
             throw expected("remainder of error constant literal");
         }
+        part1 = part1.toUpperCase(Locale.ROOT);
 
         switch(part1.charAt(0)) {
             case 'V': {