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
This commit is contained in:
Dominik Stadler 2017-01-26 19:58:46 +00:00
parent b7b4a73204
commit 560a33620a
15 changed files with 47 additions and 47 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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);
}

View File

@ -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)
*/

View File

@ -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.

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -1003,7 +1003,6 @@ public abstract class AbstractWordConverter
processEndnoteAutonumbered( doc, noteIndex, block,
noteTextRange );
return;
}
}
}

View File

@ -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

View File

@ -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 );
}

View File

@ -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() );

View File

@ -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()
{

View File

@ -82,8 +82,7 @@ public class TestWordToHtmlConverter
new DOMSource( wordToHtmlConverter.getDocument() ),
new StreamResult( stringWriter ));
String result = stringWriter.toString();
return result;
return stringWriter.toString();
}
@Test

View File

@ -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");
}