aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2017-01-26 19:58:46 +0000
committerDominik Stadler <centic@apache.org>2017-01-26 19:58:46 +0000
commit2c8f25c8642d7f30499567da53dd279a7ef59423 (patch)
tree059e7aa51a36f5b9b64f174abaffe5329f07ce0d /src
parentabf8c414f89ca0725d04213271b40c7dfe9bb4ce (diff)
downloadpoi-2c8f25c8642d7f30499567da53dd279a7ef59423.tar.gz
poi-2c8f25c8642d7f30499567da53dd279a7ef59423.zip
IntelliJ warnings, Javadoc, Formatting
Changes for the RecordFormatException deprecation git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1780453 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/hpsf/VariantSupport.java4
-rw-r--r--src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java6
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java6
-rw-r--r--src/java/org/apache/poi/hssf/util/HSSFColor.java8
-rw-r--r--src/java/org/apache/poi/util/HexRead.java2
-rw-r--r--src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java7
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java23
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java1
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java3
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java14
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java3
-rw-r--r--src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java9
15 files changed, 47 insertions, 47 deletions
diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java
index 25c44dff92..1181437bcf 100644
--- a/src/java/org/apache/poi/hpsf/VariantSupport.java
+++ b/src/java/org/apache/poi/hpsf/VariantSupport.java
@@ -56,7 +56,7 @@ public class VariantSupport extends Variant {
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 Variant {
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
diff --git a/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java b/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
index b42f09b47f..e1d21cf97d 100644
--- a/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
+++ b/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
@@ -222,7 +222,7 @@ public final class PageSettingsBlock extends RecordAggregate {
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 extends RecordAggregate {
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 extends RecordAggregate {
*
* @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) {
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
index e6f5b91d56..2bbc18cd17 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
@@ -66,8 +66,7 @@ public final class HSSFCellStyle implements CellStyle {
* 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 implements CellStyle {
@Deprecated
@Removal(version="3.17")
@Override
- public void setBorderLeft(short border)
- {
+ public void setBorderLeft(short border) {
_format.setIndentNotParentBorder(true);
_format.setBorderLeft(border);
}
diff --git a/src/java/org/apache/poi/hssf/util/HSSFColor.java b/src/java/org/apache/poi/hssf/util/HSSFColor.java
index 129066fa1c..75e143c1c7 100644
--- a/src/java/org/apache/poi/hssf/util/HSSFColor.java
+++ b/src/java/org/apache/poi/hssf/util/HSSFColor.java
@@ -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)
*/
diff --git a/src/java/org/apache/poi/util/HexRead.java b/src/java/org/apache/poi/util/HexRead.java
index e191f5c7d9..97b3eca3e6 100644
--- a/src/java/org/apache/poi/util/HexRead.java
+++ b/src/java/org/apache/poi/util/HexRead.java
@@ -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.
diff --git a/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java b/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
index c5d2ba325c..7706ca19e3 100644
--- a/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
+++ b/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
@@ -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 {
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
index 026a45be7a..551bf405ba 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
@@ -107,7 +107,7 @@ public class SXSSFWorkbook implements Workbook {
/**
* 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 Workbook {
@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 Workbook {
@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 Workbook {
@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 Workbook {
@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 Workbook {
@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 Workbook {
* 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
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index e67ca1be4e..fecad97bc8 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -2076,8 +2076,12 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
* 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
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
index 02b2dbdaa3..e370e57506 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
@@ -1003,7 +1003,6 @@ public abstract class AbstractWordConverter
processEndnoteAutonumbered( doc, noteIndex, block,
noteTextRange );
- return;
}
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
index dcb40b6932..1a6d8b8f40 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
@@ -158,7 +158,7 @@ public class WordToHtmlConverter extends AbstractWordConverter
private final HtmlDocumentFacade htmlDocumentFacade;
- private Element notes = null;
+ private Element notes;
/**
* Creates new instance of {@link WordToHtmlConverter}. Can be used for
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java b/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
index e89efe7354..65ec6b9178 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
@@ -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 );
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java
index d5dc068924..a894f4ed91 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java
@@ -96,7 +96,7 @@ public final class WordExtractor extends POIOLE2TextExtractor
}
// 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() );
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
index ed06d35506..a7ed1adc4b 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
@@ -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()
{
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
index 1b18e5fd3a..b2f4082999 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
@@ -82,8 +82,7 @@ public class TestWordToHtmlConverter
new DOMSource( wordToHtmlConverter.getDocument() ),
new StreamResult( stringWriter ));
- String result = stringWriter.toString();
- return result;
+ return stringWriter.toString();
}
@Test
diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
index a63fd7b039..0f6caa7589 100644
--- a/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
+++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
@@ -203,7 +203,6 @@ public final class TestPageSettingsBlock extends TestCase {
* 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 extends TestCase {
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 extends TestCase {
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");
}