poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1780453 - in /poi/trunk/src: java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/record/aggregates/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/hssf/util/ java/org/apache/poi/util/ ooxml/java/org/apache/poi/xdgf/util/ ooxml/java...
Date Thu, 26 Jan 2017 19:58:46 GMT
Author: centic
Date: Thu Jan 26 19:58:46 2017
New Revision: 1780453

URL: http://svn.apache.org/viewvc?rev=1780453&view=rev
Log:
IntelliJ warnings, Javadoc, Formatting
Changes for the RecordFormatException deprecation

Modified:
    poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
    poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
    poi/trunk/src/java/org/apache/poi/util/HexRead.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java

Modified: poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/VariantSupport.java Thu Jan 26 19:58:46 2017
@@ -56,7 +56,7 @@ public class VariantSupport extends Vari
 
     
     private static final POILogger logger = POILogFactory.getLogger(VariantSupport.class);
-    private static boolean logUnsupportedTypes = false;
+    private static boolean logUnsupportedTypes;
 
     /**
      * Keeps a list of the variant types an "unsupported" message has already
@@ -196,7 +196,7 @@ public class VariantSupport extends Vari
                 return uniString.toJavaString();
 
             // if(l1 < 0) {
-            /**
+            /*
              * YK: reading the ClipboardData packet (VT_CF) is not quite
              * correct. The size of the data is determined by the first four
              * bytes of the packet while the current implementation calculates

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java Thu Jan
26 19:58:46 2017
@@ -222,7 +222,7 @@ public final class PageSettingsBlock ext
 
     private void checkNotPresent(Record rec) {
         if (rec != null) {
-            throw new RecordFormatException("Duplicate PageSettingsBlock record (sid=0x"
+            throw new org.apache.poi.util.RecordFormatException("Duplicate PageSettingsBlock
record (sid=0x"
                     + Integer.toHexString(rec.getSid()) + ")");
         }
     }
@@ -614,7 +614,7 @@ public final class PageSettingsBlock ext
             throw new IllegalStateException("This page settings block already has a header/footer
record");
         }
         if (rec.getSid() != HeaderFooterRecord.sid) {
-            throw new RecordFormatException("Unexpected header-footer record sid: 0x" + Integer.toHexString(rec.getSid()));
+            throw new org.apache.poi.util.RecordFormatException("Unexpected header-footer
record sid: 0x" + Integer.toHexString(rec.getSid()));
         }
         _headerFooter = rec;
     }
@@ -647,7 +647,7 @@ public final class PageSettingsBlock ext
      *
      * @param rs the RecordStream to read from
      * 
-     * @throws  RecordFormatException if any PSB record encountered has the same type (sid)
as
+     * @throws  org.apache.poi.util.RecordFormatException if any PSB record encountered has
the same type (sid) as
      * a record that is already part of this PageSettingsBlock
      */
     public void addLateRecords(RecordStream rs) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Thu Jan 26 19:58:46
2017
@@ -66,8 +66,7 @@ public final class HSSFCellStyle impleme
      *  unless you're comparing which one is which)
      */
     @Override
-    public short getIndex()
-    {
+    public short getIndex() {
         return _index;
     }
 
@@ -489,8 +488,7 @@ public final class HSSFCellStyle impleme
     @Deprecated
     @Removal(version="3.17")
     @Override
-    public void setBorderLeft(short border)
-    {
+    public void setBorderLeft(short border) {
         _format.setIndentNotParentBorder(true);
         _format.setBorderLeft(border);
     }

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/HSSFColor.java Thu Jan 26 19:58:46 2017
@@ -48,7 +48,7 @@ public class HSSFColor implements Color
 
     /**
      * Predefined HSSFColors with their given palette index (and an optional 2nd index)
-     * 
+     *
      * @since POI 3.16 beta 2
      */
     public enum HSSFColorPredefined {
@@ -140,7 +140,7 @@ public class HSSFColor implements Color
         public String getHexString() {
             return color.getHexString();
         }
-        
+
         /**
          * @return (a copy of) the HSSFColor assigned to the enum
          */
@@ -211,7 +211,7 @@ public class HSSFColor implements Color
      *
      * @return a Map containing all colors keyed by String gnumeric-like triplets
      */
-    public final static Map<String,HSSFColor> getTripletHash()
+    public static Map<String,HSSFColor> getTripletHash()
     {
         return createColorsByHexStringMap();
     }
@@ -231,7 +231,7 @@ public class HSSFColor implements Color
 
     /**
      * Maps the Enums to the HSSFColor subclasses, in cases of user code evaluating the classname
-     * 
+     *
      * @deprecated in 3.16 - remove mapping when subclasses are removed and access
      *  HSSFColorPredfined.values() directly (but exclude AUTOMATIC)
      */

Modified: poi/trunk/src/java/org/apache/poi/util/HexRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/HexRead.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/HexRead.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/HexRead.java Thu Jan 26 19:58:46 2017
@@ -28,7 +28,7 @@ import java.util.ArrayList;
 public class HexRead {
     /**
      * This method reads hex data from a filename and returns a byte array.
-     * The file may contain line comments that are preceeded with a # symbol.
+     * The file may contain line comments that are preceded with a # symbol.
      *
      * @param filename  The filename to read
      * @return The bytes read from the file.

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java Thu Jan 26 19:58:46 2017
@@ -21,10 +21,7 @@ import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
 
 import javax.imageio.ImageIO;
 
@@ -94,7 +91,7 @@ public class VsdxToPng {
 
         graphics.dispose();
 
-        FileOutputStream out = new FileOutputStream(outFile);
+        OutputStream out = new FileOutputStream(outFile);
         try {
             ImageIO.write(img, "png", out);
         } finally {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java Thu Jan 26 19:58:46
2017
@@ -107,7 +107,7 @@ public class SXSSFWorkbook implements Wo
     /**
      * whether temp files should be compressed.
      */
-    private boolean _compressTmpFiles = false;
+    private boolean _compressTmpFiles;
 
     /**
      * shared string table - a cache of strings in this workbook
@@ -817,6 +817,7 @@ public class SXSSFWorkbook implements Wo
     @Removal(version="3.17")
     public Font findFont(short boldWeight, short color, short fontHeight, String name, boolean
italic, boolean strikeout, short typeOffset, byte underline)
     {
+        //noinspection deprecation
         return _wb.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset,
underline);
     }
     
@@ -1027,8 +1028,8 @@ public class SXSSFWorkbook implements Wo
     @Override
     @Deprecated
     @Removal(version="3.18")
-    public Name getNameAt(int nameIndex)
-    {
+    public Name getNameAt(int nameIndex) {
+        //noinspection deprecation
         return _wb.getNameAt(nameIndex);
     }
 
@@ -1058,8 +1059,8 @@ public class SXSSFWorkbook implements Wo
     @Override
     @Deprecated
     @Removal(version="3.18")
-    public int getNameIndex(String name)
-    {
+    public int getNameIndex(String name) {
+        //noinspection deprecation
         return _wb.getNameIndex(name);
     }
 
@@ -1073,8 +1074,8 @@ public class SXSSFWorkbook implements Wo
     @Override
     @Deprecated
     @Removal(version="3.18")
-    public void removeName(int index)
-    {
+    public void removeName(int index) {
+        //noinspection deprecation
         _wb.removeName(index);
     }
 
@@ -1088,8 +1089,8 @@ public class SXSSFWorkbook implements Wo
     @Override
     @Deprecated
     @Removal(version="3.18")
-    public void removeName(String name)
-    {
+    public void removeName(String name) {
+        //noinspection deprecation
         _wb.removeName(name);
     }
 
@@ -1298,8 +1299,12 @@ public class SXSSFWorkbook implements Wo
      *  formulas such as "[MyOtherWorkbook]Sheet3!$A$5" to be added to the 
      *  file, for workbooks not already referenced.
      *
+     *  Note: this is not implemented and thus currently throws an Exception stating this.
+     *
      * @param name The name the workbook will be referenced as in formulas
      * @param workbook The open workbook to fetch the link required information from
+     *
+     * @throws RuntimeException stating that this method is not implemented yet.
      */
     @Override
     @NotImplemented

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Thu Jan 26 19:58:46
2017
@@ -2076,8 +2076,12 @@ public class XSSFWorkbook extends POIXML
      *  formulas such as "[MyOtherWorkbook.xlsx]Sheet3!$A$5" to be added to the 
      *  file, for workbooks not already linked / referenced.
      *
+     *  Note: this is not implemented and thus currently throws an Exception stating this.
+     *
      * @param name The name the workbook will be referenced as in formulas
      * @param workbook The open workbook to fetch the link required information from
+     *
+     * @throws RuntimeException stating that this method is not implemented yet.
      */
     @Override
     @NotImplemented

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
Thu Jan 26 19:58:46 2017
@@ -1003,7 +1003,6 @@ public abstract class AbstractWordConver
 
                 processEndnoteAutonumbered( doc, noteIndex, block,
                         noteTextRange );
-                return;
             }
         }
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java Thu
Jan 26 19:58:46 2017
@@ -158,7 +158,7 @@ public class WordToHtmlConverter extends
 
     private final HtmlDocumentFacade htmlDocumentFacade;
 
-    private Element notes = null;
+    private Element notes;
 
     /**
      * Creates new instance of {@link WordToHtmlConverter}. Can be used for

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java Thu Jan 26 19:58:46
2017
@@ -392,8 +392,7 @@ public final class HWPFLister
             for ( char c : text.toCharArray() )
             {
                 if ( c < 30 )
-                    stringBuilder
-                            .append( "\\0x" + Integer.toHexString( c ) );
+                    stringBuilder.append("\\0x").append(Integer.toHexString(c));
                 else
                     stringBuilder.append( c );
             }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java Thu Jan
26 19:58:46 2017
@@ -96,7 +96,7 @@ public final class WordExtractor extends
         }
 
         // Process the first argument as a file
-        FileInputStream fin = new FileInputStream( args[0] );
+        InputStream fin = new FileInputStream( args[0] );
         WordExtractor extractor = new WordExtractor( fin );
         try {
         	System.out.println( extractor.getText() );

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java Thu Jan 26 19:58:46
2017
@@ -42,15 +42,16 @@ import org.apache.poi.util.StringUtil;
 /**
  * Represents embedded picture extracted from Word Document
  */
-public final class Picture
-{
+public final class Picture {
+    private static final POILogger log = POILogFactory
+            .getLogger( Picture.class );
+
     public static final byte[] COMPRESSED1 = { (byte) 0xFE, 0x78, (byte) 0xDA };
 
     public static final byte[] COMPRESSED2 = { (byte) 0xFE, 0x78, (byte) 0x9C };
 
     public static final byte[] IHDR = new byte[] { 'I', 'H', 'D', 'R' };
-    private static final POILogger log = POILogFactory
-            .getLogger( Picture.class );
+
     @Deprecated
     private static final byte[] PNG = new byte[] { (byte) 0x89, 0x50, 0x4E,
             0x47, 0x0D, 0x0A, 0x1A, 0x0A };
@@ -401,10 +402,11 @@ public final class Picture
     }
 
     /**
-     * Returns picture's content as it stored in Word file, i.e. possibly in
+     * Returns picture's content as stored in the Word file, i.e. possibly in
      * compressed form.
      * 
-     * @return picture's content as it stored in Word file
+     * @return picture's content as it stored in Word file or an empty byte array
+     *      if it cannot be read.
      */
     public byte[] getRawContent()
     {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
Thu Jan 26 19:58:46 2017
@@ -82,8 +82,7 @@ public class TestWordToHtmlConverter
                 new DOMSource( wordToHtmlConverter.getDocument() ),
                 new StreamResult( stringWriter ));
 
-        String result = stringWriter.toString();
-        return result;
+        return stringWriter.toString();
     }
 
     @Test

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java?rev=1780453&r1=1780452&r2=1780453&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
Thu Jan 26 19:58:46 2017
@@ -203,7 +203,6 @@ public final class TestPageSettingsBlock
 	 * was added while fixing bug 47199.  All existing POI test samples comply with this requirement.
 	 */
 	public void testDuplicatePSBRecord_bug47199() {
-
 		// Hypothetical setup of PSB records which should cause POI to crash
 		Record[] recs = {
 				new HeaderRecord("&LSales Figures"),
@@ -214,10 +213,8 @@ public final class TestPageSettingsBlock
 		try {
 			new PageSettingsBlock(rs);
 			throw new AssertionFailedError("Identified bug 47199b - duplicate PSB records should not
be allowed");
-		} catch (RecordFormatException e) {
-			if (e.getMessage().equals("Duplicate PageSettingsBlock record (sid=0x14)")) {
-				// expected during successful test
-			} else {
+		} catch (org.apache.poi.util.RecordFormatException e) {
+			if (!e.getMessage().equals("Duplicate PageSettingsBlock record (sid=0x14)")) {
 				throw new AssertionFailedError("Expected RecordFormatException due to duplicate PSB record");
 			}
 		}
@@ -288,7 +285,7 @@ public final class TestPageSettingsBlock
 		PageSettingsBlock psb;
 		try {
 			psb = new PageSettingsBlock(rs);
-		} catch (RecordFormatException e) {
+		} catch (org.apache.poi.util.RecordFormatException e) {
 			if ("Duplicate PageSettingsBlock record (sid=0x4d)".equals(e.getMessage())) {
 				throw new AssertionFailedError("Identified bug 47415");
 			}



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


Mime
View raw message