aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2018-11-25 21:56:43 +0000
committerDominik Stadler <centic@apache.org>2018-11-25 21:56:43 +0000
commitd28720afd08d1998a7784f09e6cfd5ed9bec2dc9 (patch)
tree98e3741a997796f090353cb473a4602973c90d93 /src/java/org/apache/poi
parent061db56f2d5026b9c2e698ccf8773153b8942d68 (diff)
downloadpoi-d28720afd08d1998a7784f09e6cfd5ed9bec2dc9.tar.gz
poi-d28720afd08d1998a7784f09e6cfd5ed9bec2dc9.zip
Add test for FileMagic
JavaDoc warning fixes Remove some IDE warnings Reformat code of sample application git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1847437 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/hpsf/VariantSupport.java2
-rw-r--r--src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java7
-rw-r--r--src/java/org/apache/poi/hssf/model/InternalWorkbook.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/RecordInputStream.java16
-rw-r--r--src/java/org/apache/poi/hssf/record/SSTRecord.java8
-rw-r--r--src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java6
-rw-r--r--src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java12
-rw-r--r--src/java/org/apache/poi/util/RecordFormatException.java4
8 files changed, 34 insertions, 23 deletions
diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java
index e60679027d..0e8dc08c6e 100644
--- a/src/java/org/apache/poi/hpsf/VariantSupport.java
+++ b/src/java/org/apache/poi/hpsf/VariantSupport.java
@@ -36,7 +36,7 @@ import org.apache.poi.util.POILogger;
* Supports reading and writing of variant data.<p>
*
* <strong>FIXME (3):</strong> Reading and writing should be made more
- * uniform than it is now. The following items should be resolved:<p>
+ * uniform than it is now. The following items should be resolved:
*
* <ul>
*
diff --git a/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java b/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
index 130408e7b5..c01ded7fe8 100644
--- a/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
+++ b/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
@@ -33,8 +33,11 @@ import org.apache.poi.hpsf.SummaryInformation;
* The methods {@link #getSummaryInformationProperties} and {@link
* #getDocumentSummaryInformationProperties} return singleton {@link
* PropertyIDMap}s. An application that wants to extend these maps
- * should treat them as unmodifiable, copy them and modifiy the
+ * should treat them as unmodifiable, copy them and modify the
* copies.
+ *
+ * Trying to modify the map directly will cause exceptions
+ * {@link UnsupportedOperationException} to be thrown.
*/
public class PropertyIDMap implements Map<Long,String> {
@@ -490,11 +493,13 @@ public class PropertyIDMap implements Map<Long,String> {
@Override
public String put(Long key, String value) {
+ //noinspection ConstantConditions
return idMap.put(key, value);
}
@Override
public String remove(Object key) {
+ //noinspection ConstantConditions
return idMap.remove(key);
}
diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
index 46d8678229..4ff370125c 100644
--- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
+++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
@@ -2276,6 +2276,8 @@ public final class InternalWorkbook {
/**
* Only for internal calls - code based on this is not supported ...
+ *
+ * @return The list of records.
*/
@Internal
public WorkbookRecordList getWorkbookRecordList() {
diff --git a/src/java/org/apache/poi/hssf/record/RecordInputStream.java b/src/java/org/apache/poi/hssf/record/RecordInputStream.java
index 4f5f589032..8347655a81 100644
--- a/src/java/org/apache/poi/hssf/record/RecordInputStream.java
+++ b/src/java/org/apache/poi/hssf/record/RecordInputStream.java
@@ -33,8 +33,9 @@ import org.apache.poi.util.LittleEndianInputStream;
import org.apache.poi.util.RecordFormatException;
/**
- * Title: Record Input Stream<P>
- * Description: Wraps a stream and provides helper methods for the construction of records.<P>
+ * Title: Record Input Stream
+ *
+ * Description: Wraps a stream and provides helper methods for the construction of records.
*/
public final class RecordInputStream implements LittleEndianInput {
@@ -194,11 +195,11 @@ public final class RecordInputStream implements LittleEndianInput {
private int readNextSid() {
int nAvailable = _bhi.available();
if (nAvailable < EOFRecord.ENCODED_SIZE) {
- if (nAvailable > 0) {
+ /*if (nAvailable > 0) {
// some scrap left over?
// ex45582-22397.xls has one extra byte after the last record
// Excel reads that file OK
- }
+ }*/
return INVALID_SID_VALUE;
}
int result = _bhi.readRecordSID();
@@ -305,14 +306,13 @@ public final class RecordInputStream implements LittleEndianInput {
@Override
public double readDouble() {
long valueLongBits = readLong();
- double result = Double.longBitsToDouble(valueLongBits);
- if (Double.isNaN(result)) {
+ /*if (Double.isNaN(result)) {
// YK: Excel doesn't write NaN but instead converts the cell type into {@link CellType#ERROR}.
// HSSF prior to version 3.7 had a bug: it could write Double.NaN but could not read such a file back.
// This behavior was fixed in POI-3.7.
//throw new RuntimeException("Did not expect to read NaN"); // (Because Excel typically doesn't write NaN)
- }
- return result;
+ }*/
+ return Double.longBitsToDouble(valueLongBits);
}
public void readPlain(byte[] buf, int off, int len) {
diff --git a/src/java/org/apache/poi/hssf/record/SSTRecord.java b/src/java/org/apache/poi/hssf/record/SSTRecord.java
index 20d99319d6..1de2fe4fc2 100644
--- a/src/java/org/apache/poi/hssf/record/SSTRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SSTRecord.java
@@ -161,7 +161,7 @@ public final class SSTRecord extends ContinuableRecord {
* <P>
* The data consists of sets of string data. This string data is
* arranged as follows:
- * <P>
+ * </P><P>
* <pre>
* short string_length; // length of string data
* byte string_flag; // flag specifying special string
@@ -176,9 +176,9 @@ public final class SSTRecord extends ContinuableRecord {
* byte[] extension; // optional extension (length of array
* // is extend_length)
* </pre>
- * <P>
+ * </P><P>
* The string_flag is bit mapped as follows:
- * <P>
+ * </P><P>
* <TABLE summary="string_flag mapping">
* <TR>
* <TH>Bit number</TH>
@@ -232,7 +232,7 @@ public final class SSTRecord extends ContinuableRecord {
* associated data. The UnicodeString class can handle the byte[]
* vs short[] nature of the actual string data
*
- * @param in the RecordInputstream to read the record from
+ * @param in the RecordInputStream to read the record from
*/
public SSTRecord(RecordInputStream in) {
// this method is ALWAYS called after construction -- using
diff --git a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
index 770f740a09..328402db80 100644
--- a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
@@ -77,7 +77,7 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
public String toString()
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("[SHARED FORMULA (").append(HexDump.intToHex(sid)).append("]\n");
buffer.append(" .range = ").append(getRange()).append("\n");
@@ -99,6 +99,10 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
}
/**
+ * Convert formula into an array of {@link Ptg} tokens.
+ *
+ * @param formula The record to break into tokens, cannot be null
+ *
* @return the equivalent {@link Ptg} array that the formula would have, were it not shared.
*/
public Ptg[] getFormulaTokens(FormulaRecord formula) {
diff --git a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
index a5035303a3..51fe091808 100644
--- a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
+++ b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
@@ -42,6 +42,8 @@ public abstract class SharedValueRecordBase extends StandardRecord {
/**
* reads only the range (1 {@link CellRangeAddress8Bit}) from the stream
+ *
+ * @param in The interface for reading the record data.
*/
public SharedValueRecordBase(LittleEndianInput in) {
_range = new CellRangeAddress8Bit(in);
@@ -99,14 +101,12 @@ public abstract class SharedValueRecordBase extends StandardRecord {
&& r.getLastColumn() >= colIx;
}
/**
- * @return {@code true} if (rowIx, colIx) describes the first cell in this shared value
- * object's range
- *
* @param rowIx the row index
* @param colIx the column index
- *
- * @return {@code true} if its the first cell in this shared value object range
- *
+ *
+ * @return {@code true} if (rowIx, colIx) describes the first cell in this shared value
+ * object's range
+ *
* @see #getRange()
*/
public final boolean isFirstCell(int rowIx, int colIx) {
diff --git a/src/java/org/apache/poi/util/RecordFormatException.java b/src/java/org/apache/poi/util/RecordFormatException.java
index 2bc4ba3bcb..65bea581ee 100644
--- a/src/java/org/apache/poi/util/RecordFormatException.java
+++ b/src/java/org/apache/poi/util/RecordFormatException.java
@@ -45,8 +45,8 @@ public class RecordFormatException
* be thrown. If assertTrue is <code>false</code>, this will throw this
* exception with the message.
*
- * @param assertTrue
- * @param message
+ * @param assertTrue If false, the exception is thrown, if true, no action is performed
+ * @param message The message to include in the thrown exception
*/
public static void check(boolean assertTrue, String message) {
if (! assertTrue) {