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

View File

@ -26,9 +26,7 @@ package org.apache.poi.poifs.property;
* @author Marc Johnson (mjohnson at apache dot org) * @author Marc Johnson (mjohnson at apache dot org)
*/ */
public interface Child public interface Child {
{
/** /**
* Get the next Child, if any * Get the next Child, if any
* *
@ -62,5 +60,4 @@ public interface Child
*/ */
public void setPreviousChild(final Child 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 * Trivial extension of Property for POIFSDocuments
*/ */
public class DocumentProperty extends Property {
public class DocumentProperty
extends Property
{
// the POIFSDocument this property is associated with // the POIFSDocument this property is associated with
private OPOIFSDocument _document; private OPOIFSDocument _document;
@ -56,7 +52,6 @@ public class DocumentProperty
* @param array byte data * @param array byte data
* @param offset offset into byte data * @param offset offset into byte data
*/ */
protected DocumentProperty(final int index, final byte [] array, protected DocumentProperty(final int index, final byte [] array,
final int offset) final int offset)
{ {
@ -69,7 +64,6 @@ public class DocumentProperty
* *
* @param doc the associated POIFSDocument * @param doc the associated POIFSDocument
*/ */
public void setDocument(OPOIFSDocument doc) public void setDocument(OPOIFSDocument doc)
{ {
_document = doc; _document = doc;
@ -80,7 +74,6 @@ public class DocumentProperty
* *
* @return the associated document * @return the associated document
*/ */
public OPOIFSDocument getDocument() public OPOIFSDocument getDocument()
{ {
return _document; return _document;
@ -93,7 +86,6 @@ public class DocumentProperty
* *
* @return true if this property should use small blocks * @return true if this property should use small blocks
*/ */
public boolean shouldUseSmallBlocks() public boolean shouldUseSmallBlocks()
{ {
return super.shouldUseSmallBlocks(); return super.shouldUseSmallBlocks();
@ -102,7 +94,6 @@ public class DocumentProperty
/** /**
* @return true if a directory type Property * @return true if a directory type Property
*/ */
public boolean isDirectory() public boolean isDirectory()
{ {
return false; return false;
@ -112,7 +103,6 @@ public class DocumentProperty
* Perform whatever activities need to be performed prior to * Perform whatever activities need to be performed prior to
* writing * writing
*/ */
protected void preWrite() protected void preWrite()
{ {
@ -128,5 +118,4 @@ public class DocumentProperty
} }
/* ********** END extension of Property ********** */ /* ********** END extension of Property ********** */
} // end public class DocumentProperty }

View File

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

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -16,7 +15,6 @@
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.poifs.property; package org.apache.poi.poifs.property;
import java.util.Iterator; import java.util.Iterator;
@ -28,7 +26,6 @@ import java.io.IOException;
* *
* @author Marc Johnson27591@hotmail.com * @author Marc Johnson27591@hotmail.com
*/ */
public interface Parent public interface Parent
extends Child extends Child
{ {
@ -71,8 +68,4 @@ public interface Parent
*/ */
public void setNextChild(final Child child); 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 Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -16,7 +15,6 @@
limitations under the License. limitations under the License.
==================================================================== */ ==================================================================== */
package org.apache.poi.poifs.property; package org.apache.poi.poifs.property;
import java.io.IOException; import java.io.IOException;
@ -522,11 +520,7 @@ public abstract class Property implements Child, POIFSViewable {
* *
* @return short description * @return short description
*/ */
public String getShortDescription() public String getShortDescription() {
{ return "Property: \"" + getName() + "\"";
StringBuffer buffer = new StringBuffer();
buffer.append("Property: \"").append(getName()).append("\"");
return buffer.toString();
} }
} }

View File

@ -31,5 +31,4 @@ public interface PropertyConstants
public static final byte DIRECTORY_TYPE = 1; public static final byte DIRECTORY_TYPE = 1;
public static final byte DOCUMENT_TYPE = 2; public static final byte DOCUMENT_TYPE = 2;
public static final byte ROOT_TYPE = 5; 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) * @author Marc Johnson (mjohnson at apache dot org)
*/ */
class PropertyFactory class PropertyFactory {
{
// no need for an accessible constructor // no need for an accessible constructor
private PropertyFactory() private PropertyFactory()
{ {
@ -60,8 +59,8 @@ class PropertyFactory
{ {
List<Property> properties = new ArrayList<Property>(); List<Property> properties = new ArrayList<Property>();
for (int j = 0; j < blocks.length; j++) { for (ListManagedBlock block : blocks) {
byte[] data = blocks[ j ].getData(); byte[] data = block.getData();
convertToProperties(data, properties); convertToProperties(data, properties);
} }
return properties; return properties;
@ -101,6 +100,4 @@ class PropertyFactory
offset += POIFSConstants.PROPERTY_SIZE; 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); _blocks = PropertyBlock.createPropertyBlockArray(_bigBigBlockSize, _properties);
// prepare each property for writing // prepare each property for writing
for (int k = 0; k < properties.length; k++) for (Property property : properties) {
{ property.preWrite();
properties[ k ].preWrite();
} }
} }
@ -117,9 +116,8 @@ public final class PropertyTable extends PropertyTableBase implements BlockWrita
{ {
if (_blocks != null) if (_blocks != null)
{ {
for (int j = 0; j < _blocks.length; j++) for (BlockWritable _block : _blocks) {
{ _block.writeBlocks(stream);
_blocks[ j ].writeBlocks(stream);
} }
} }
} }