Fix some IDE warnings/javadoc/...

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-10-19 06:52:44 +00:00
parent eada340cbd
commit ec7607e398
9 changed files with 31 additions and 64 deletions

View File

@ -147,9 +147,9 @@ public class VBAMacroReader implements Closeable {
* For each macro module that is found, the module's name and code are
* added to <tt>modules<tt>.
*
* @param dir
* @param modules
* @throws IOException
* @param dir The directory of entries to look at
* @param modules The resulting map of modules
* @throws IOException If reading the VBA module fails
* @since 3.15-beta2
*/
protected void findMacros(DirectoryNode dir, ModuleMap modules) throws IOException {
@ -173,7 +173,7 @@ public class VBAMacroReader implements Closeable {
* @param length number of bytes to read from stream
* @param charset the character set encoding of the bytes in the stream
* @return a java String in the supplied character set
* @throws IOException
* @throws IOException If reading from the stream fails
*/
private static String readString(InputStream stream, int length, Charset charset) throws IOException {
byte[] buffer = new byte[length];
@ -191,7 +191,7 @@ public class VBAMacroReader implements Closeable {
* @param in the run-length encoded input stream to read from
* @param streamName the stream name of the module
* @param modules a map to store the modules
* @throws IOException
* @throws IOException If reading data from the stream or from modules fails
*/
private static void readModule(RLEDecompressingInputStream in, String streamName, ModuleMap modules) throws IOException {
int moduleOffset = in.readInt();
@ -240,7 +240,7 @@ public class VBAMacroReader implements Closeable {
/**
* Skips <tt>n</tt> bytes in an input stream, throwing IOException if the
* number of bytes skipped is different than requested.
* @throws IOException
* @throws IOException If skipping would exceed the available data or skipping did not work.
*/
private static void trySkip(InputStream in, long n) throws IOException {
long skippedBytes = in.skip(n);
@ -260,16 +260,23 @@ public class VBAMacroReader implements Closeable {
// Constants from MS-OVBA: https://msdn.microsoft.com/en-us/library/office/cc313094(v=office.12).aspx
private static final int EOF = -1;
private static final int VERSION_INDEPENDENT_TERMINATOR = 0x0010;
@SuppressWarnings("unused")
private static final int VERSION_DEPENDENT_TERMINATOR = 0x002B;
private static final int PROJECTVERSION = 0x0009;
private static final int PROJECTCODEPAGE = 0x0003;
private static final int STREAMNAME = 0x001A;
private static final int MODULEOFFSET = 0x0031;
@SuppressWarnings("unused")
private static final int MODULETYPE_PROCEDURAL = 0x0021;
@SuppressWarnings("unused")
private static final int MODULETYPE_DOCUMENT_CLASS_OR_DESIGNER = 0x0022;
@SuppressWarnings("unused")
private static final int PROJECTLCID = 0x0002;
@SuppressWarnings("unused")
private static final int MODULE_NAME = 0x0019;
@SuppressWarnings("unused")
private static final int MODULE_NAME_UNICODE = 0x0047;
@SuppressWarnings("unused")
private static final int MODULE_DOC_STRING = 0x001c;
private static final int STREAMNAME_RESERVED = 0x0032;
@ -291,7 +298,6 @@ public class VBAMacroReader implements Closeable {
// process DIR
RLEDecompressingInputStream in = new RLEDecompressingInputStream(dis);
String streamName = null;
String streamNameUnicode = null;
int recordId = 0;
try {
while (true) {
@ -317,7 +323,7 @@ public class VBAMacroReader implements Closeable {
Integer.toHexString(reserved));
}
int unicodeNameRecordLength = in.readInt();
streamNameUnicode = readUnicodeString(in, unicodeNameRecordLength);
readUnicodeString(in, unicodeNameRecordLength);
// do something with this at some point
break;
case MODULEOFFSET:

View File

@ -26,9 +26,7 @@ package org.apache.poi.poifs.property;
* @author Marc Johnson (mjohnson at apache dot org)
*/
public interface Child
{
public interface Child {
/**
* Get the next Child, if any
*
@ -62,5 +60,4 @@ public interface Child
*/
public void setPreviousChild(final Child child);
} // end public interface Child
}

View File

@ -24,11 +24,7 @@ import org.apache.poi.poifs.filesystem.OPOIFSDocument;
/**
* Trivial extension of Property for POIFSDocuments
*/
public class DocumentProperty
extends Property
{
public class DocumentProperty extends Property {
// the POIFSDocument this property is associated with
private OPOIFSDocument _document;
@ -56,7 +52,6 @@ public class DocumentProperty
* @param array byte data
* @param offset offset into byte data
*/
protected DocumentProperty(final int index, final byte [] array,
final int offset)
{
@ -69,7 +64,6 @@ public class DocumentProperty
*
* @param doc the associated POIFSDocument
*/
public void setDocument(OPOIFSDocument doc)
{
_document = doc;
@ -80,7 +74,6 @@ public class DocumentProperty
*
* @return the associated document
*/
public OPOIFSDocument getDocument()
{
return _document;
@ -93,7 +86,6 @@ public class DocumentProperty
*
* @return true if this property should use small blocks
*/
public boolean shouldUseSmallBlocks()
{
return super.shouldUseSmallBlocks();
@ -102,7 +94,6 @@ public class DocumentProperty
/**
* @return true if a directory type Property
*/
public boolean isDirectory()
{
return false;
@ -112,7 +103,6 @@ public class DocumentProperty
* Perform whatever activities need to be performed prior to
* writing
*/
protected void preWrite()
{
@ -128,5 +118,4 @@ public class DocumentProperty
}
/* ********** END extension of Property ********** */
} // end public class DocumentProperty
}

View File

@ -73,12 +73,6 @@ public final class NPropertyTable extends PropertyTableBase {
_bigBigBlockSize = headerBlock.getBigBlockSize();
}
/**
* Builds
* @param startAt
* @param filesystem
* @throws IOException
*/
private static List<Property> buildProperties(final Iterator<ByteBuffer> dataSource,
final POIFSBigBlockSize bigBlockSize) throws IOException
{

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -16,7 +15,6 @@
limitations under the License.
==================================================================== */
package org.apache.poi.poifs.property;
import java.util.Iterator;
@ -28,7 +26,6 @@ import java.io.IOException;
*
* @author Marc Johnson27591@hotmail.com
*/
public interface Parent
extends Child
{
@ -71,8 +68,4 @@ public interface Parent
*/
public void setNextChild(final Child child);
/** *** end methods from interface Child *** */
} // end public interface Parent
}

View File

@ -1,4 +1,3 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@ -16,7 +15,6 @@
limitations under the License.
==================================================================== */
package org.apache.poi.poifs.property;
import java.io.IOException;
@ -522,11 +520,7 @@ public abstract class Property implements Child, POIFSViewable {
*
* @return short description
*/
public String getShortDescription()
{
StringBuffer buffer = new StringBuffer();
buffer.append("Property: \"").append(getName()).append("\"");
return buffer.toString();
public String getShortDescription() {
return "Property: \"" + getName() + "\"";
}
}

View File

@ -31,5 +31,4 @@ public interface PropertyConstants
public static final byte DIRECTORY_TYPE = 1;
public static final byte DOCUMENT_TYPE = 2;
public static final byte ROOT_TYPE = 5;
} // end public interface PropertyConstants
}

View File

@ -38,8 +38,7 @@ import org.apache.poi.poifs.storage.ListManagedBlock;
* @author Marc Johnson (mjohnson at apache dot org)
*/
class PropertyFactory
{
class PropertyFactory {
// no need for an accessible constructor
private PropertyFactory()
{
@ -60,8 +59,8 @@ class PropertyFactory
{
List<Property> properties = new ArrayList<Property>();
for (int j = 0; j < blocks.length; j++) {
byte[] data = blocks[ j ].getData();
for (ListManagedBlock block : blocks) {
byte[] data = block.getData();
convertToProperties(data, properties);
}
return properties;
@ -101,6 +100,4 @@ class PropertyFactory
offset += POIFSConstants.PROPERTY_SIZE;
}
}
} // end package scope class PropertyFactory
}

View File

@ -86,9 +86,8 @@ public final class PropertyTable extends PropertyTableBase implements BlockWrita
_blocks = PropertyBlock.createPropertyBlockArray(_bigBigBlockSize, _properties);
// prepare each property for writing
for (int k = 0; k < properties.length; k++)
{
properties[ k ].preWrite();
for (Property property : properties) {
property.preWrite();
}
}
@ -117,9 +116,8 @@ public final class PropertyTable extends PropertyTableBase implements BlockWrita
{
if (_blocks != null)
{
for (int j = 0; j < _blocks.length; j++)
{
_blocks[ j ].writeBlocks(stream);
for (BlockWritable _block : _blocks) {
_block.writeBlocks(stream);
}
}
}