You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2018/10/26 09:32:44 UTC

svn commit: r1844879 - in /poi/trunk/src: examples/src/org/apache/poi/hssf/usermodel/examples/ examples/src/org/apache/poi/ss/examples/ examples/src/org/apache/poi/xssf/usermodel/examples/ java/org/apache/poi/ss/format/ java/org/apache/poi/ss/formula/p...

Author: centic
Date: Fri Oct 26 09:32:43 2018
New Revision: 1844879

URL: http://svn.apache.org/viewvc?rev=1844879&view=rev
Log:
Typos and IDE warnings

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
    poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/format/CellTextFormatter.java
    poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java
    poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java Fri Oct 26 09:32:43 2018
@@ -142,13 +142,13 @@ import org.apache.poi.ss.usermodel.Clien
 public class AddDimensionedImage {
 
     // Four constants that determine how - and indeed whether - the rows
-    // and columns an image may overlie should be expanded to accomodate that
+    // and columns an image may overlie should be expanded to accommodate that
     // image.
     // Passing EXPAND_ROW will result in the height of a row being increased
-    // to accomodate the image if it is not already larger. The image will
+    // to accommodate the image if it is not already larger. The image will
     // be layed across one or more columns.
     // Passing EXPAND_COLUMN will result in the width of the column being
-    // increased to accomodate the image if it is not already larger. The image
+    // increased to accommodate the image if it is not already larger. The image
     // will be layed across one or many rows.
     // Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
     // bing increased along with the width of the column to accomdate the
@@ -266,7 +266,7 @@ public class AddDimensionedImage {
         }
 
         // Call methods to calculate how the image and sheet should be
-        // manipulated to accomodate the image; columns and then rows.
+        // manipulated to accommodate the image; columns and then rows.
         colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
                 reqImageWidthMM, resizeBehaviour);
         rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
@@ -312,7 +312,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheets columns should be re-sized to accomodate
+     * Determines whether the sheets columns should be re-sized to accommodate
      * the image, adjusts the columns width if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * an HSSFClientAnchor that will fix the image on the sheet and establish
@@ -348,7 +348,7 @@ public class AddDimensionedImage {
         colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
                 (short)sheet.getColumnWidth(colNumber));
 
-        // Check that the column's width will accomodate the image at the
+        // Check that the column's width will accommodate the image at the
         // required dimension. If the width of the column is LESS than the
         // required width of the image, decide how the application should
         // respond - resize the column or overlay the image across one or more
@@ -396,7 +396,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheet's row should be re-sized to accomodate
+     * Determines whether the sheet's row should be re-sized to accommodate
      * the image, adjusts the rows height if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * an HSSFClientAnchor that will fix the image on the sheet and establish
@@ -436,7 +436,7 @@ public class AddDimensionedImage {
         // Get the row's height in millimetres
         double rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
 
-        // Check that the row's height will accomodate the image at the required
+        // Check that the row's height will accommodate the image at the required
         // dimensions. If the height of the row is LESS than the required height
         // of the image, decide how the application should respond - resize the
         // row or overlay the image across a series of rows.

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java Fri Oct 26 09:32:43 2018
@@ -202,13 +202,13 @@ import org.apache.poi.util.IOUtils;
 public class AddDimensionedImage {
 
     // Four constants that determine how - and indeed whether - the rows
-    // and columns an image may overlie should be expanded to accomodate that
+    // and columns an image may overlie should be expanded to accommodate that
     // image.
     // Passing EXPAND_ROW will result in the height of a row being increased
-    // to accomodate the image if it is not already larger. The image will
+    // to accommodate the image if it is not already larger. The image will
     // be layed across one or more columns.
     // Passing EXPAND_COLUMN will result in the width of the column being
-    // increased to accomodate the image if it is not already larger. The image
+    // increased to accommodate the image if it is not already larger. The image
     // will be layed across one or many rows.
     // Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
     // bing increased along with the width of the column to accomdate the
@@ -348,7 +348,7 @@ public class AddDimensionedImage {
         }
 
         // Call methods to calculate how the image and sheet should be
-        // manipulated to accomodate the image; columns and then rows.
+        // manipulated to accommodate the image; columns and then rows.
         colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
                 reqImageWidthMM, resizeBehaviour);
         rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
@@ -440,7 +440,7 @@ public class AddDimensionedImage {
         colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
                 (short)sheet.getColumnWidth(colNumber));
 
-        // Check that the column's width will accomodate the image at the
+        // Check that the column's width will accommodate the image at the
         // required dimension. If the width of the column is LESS than the
         // required width of the image, decide how the application should
         // respond - resize the column or overlay the image across one or more
@@ -500,7 +500,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheets row should be re-sized to accomodate
+     * Determines whether the sheets row should be re-sized to accommodate
      * the image, adjusts the rows height if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * a ClientAnchor that will fix the image on the sheet and establish
@@ -542,7 +542,7 @@ public class AddDimensionedImage {
         // Get the row's height in millimetres
         rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
 
-        // Check that the row's height will accomodate the image at the required
+        // Check that the row's height will accommodate the image at the required
         // dimensions. If the height of the row is LESS than the required height
         // of the image, decide how the application should respond - resize the
         // row or overlay the image across a series of rows.

Modified: poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java Fri Oct 26 09:32:43 2018
@@ -44,8 +44,8 @@ public class NewLinesInCells {
             cs.setWrapText(true);
             cell.setCellStyle(cs);
 
-            //increase row height to accomodate two lines of text
-            row.setHeightInPoints((2 * sheet.getDefaultRowHeightInPoints()));
+            //increase row height to accommodate two lines of text
+            row.setHeightInPoints(2 * sheet.getDefaultRowHeightInPoints());
 
             //adjust column width to fit the content
             sheet.autoSizeColumn(2);
@@ -55,5 +55,4 @@ public class NewLinesInCells {
             }
         }
     }
-
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java Fri Oct 26 09:32:43 2018
@@ -50,6 +50,7 @@ public class CellDateFormatter extends C
         private int hStart = -1;
         private int hLen;
 
+        @Override
         public String handlePart(Matcher m, String part, CellFormatType type,
                 StringBuffer desc) {
 

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellTextFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellTextFormatter.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellTextFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellTextFormatter.java Fri Oct 26 09:32:43 2018
@@ -16,10 +16,7 @@
 ==================================================================== */
 package org.apache.poi.ss.format;
 
-import org.apache.poi.ss.format.CellFormatPart.PartHandler;
-
 import java.util.Locale;
-import java.util.regex.Matcher;
 
 /**
  * This class implements printing out text.
@@ -38,15 +35,12 @@ public class CellTextFormatter extends C
         final int[] numPlaces = new int[1];
 
         desc = CellFormatPart.parseFormat(format, CellFormatType.TEXT,
-                new PartHandler() {
-                    public String handlePart(Matcher m, String part,
-                            CellFormatType type, StringBuffer desc) {
-                        if (part.equals("@")) {
-                            numPlaces[0]++;
-                            return "\u0000";
-                        }
-                        return null;
+                (m, part, type, desc) -> {
+                    if (part.equals("@")) {
+                        numPlaces[0]++;
+                        return "\u0000";
                     }
+                    return null;
                 }).toString();
 
         // Remember the "@" positions in last-to-first order (to make insertion easier)
@@ -66,8 +60,8 @@ public class CellTextFormatter extends C
             text = text.toUpperCase(Locale.ROOT);
         }
         toAppendTo.append(desc);
-        for (int i = 0; i < textPos.length; i++) {
-            int pos = start + textPos[i];
+        for (int textPo : textPos) {
+            int pos = start + textPo;
             toAppendTo.replace(pos, pos + 1, text);
         }
     }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java Fri Oct 26 09:32:43 2018
@@ -43,7 +43,7 @@ public abstract class RefPtgBase extends
 
     /**
      * YK: subclasses of RefPtgBase are used by the FormulaParser and FormulaEvaluator accross HSSF and XSSF.
-     * The bit mask should accomodate the maximum number of avaiable columns, i.e. 0x3FFF.
+     * The bit mask should accommodate the maximum number of avaiable columns, i.e. 0x3FFF.
      *
      * @see org.apache.poi.ss.SpreadsheetVersion
      */

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java Fri Oct 26 09:32:43 2018
@@ -420,7 +420,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named short value form the given map.
+     * Utility method that returns the named short value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -436,7 +436,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named int value form the given map.
+     * Utility method that returns the named int value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -452,7 +452,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named BorderStyle value form the given map.
+     * Utility method that returns the named BorderStyle value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -483,7 +483,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named FillPatternType value form the given map.
+     * Utility method that returns the named FillPatternType value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -515,7 +515,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named HorizontalAlignment value form the given map.
+     * Utility method that returns the named HorizontalAlignment value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -547,7 +547,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named VerticalAlignment value form the given map.
+     * Utility method that returns the named VerticalAlignment value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -579,7 +579,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named boolean value form the given map.
+     * Utility method that returns the named boolean value from the given map.
      *
      * @param properties map of properties (String -> Object)
      * @param name property name
@@ -594,7 +594,7 @@ public final class CellUtil {
         }
         return false;
     }
-    
+
     /**
      * Utility method that puts the given value to the given map.
      *

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1844879&r1=1844878&r2=1844879&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Fri Oct 26 09:32:43 2018
@@ -2993,13 +2993,21 @@ public final class TestXSSFBugs extends
         cell.setCellStyle(style);
 
         // Everything is fine at this point, cell is red
+        XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
+        assertNull(actual);
+        actual = cell.getCellStyle().getFillForegroundColorColor();
+        assertNotNull(actual);
+        assertEquals(color.getARGBHex(), actual.getARGBHex());
 
         Map<String, Object> properties = new HashMap<>();
         properties.put(CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
         CellUtil.setCellStyleProperties(cell, properties);
 
         // Now the cell is all black
-        XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
+        actual = cell.getCellStyle().getFillBackgroundColorColor();
+        assertNotNull(actual);
+        assertNull(actual.getARGBHex());
+        actual = cell.getCellStyle().getFillForegroundColorColor();
         assertNotNull(actual);
         assertEquals(color.getARGBHex(), actual.getARGBHex());
 



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