Eclipse warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-12-30 20:31:13 +00:00
parent 581aba1597
commit a40f3668d6
6 changed files with 21 additions and 10 deletions

View File

@ -278,7 +278,6 @@ public class AgileDecryptor extends Decryptor {
}
}
@SuppressWarnings("resource")
public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException {
DocumentInputStream dis = dir.createDocumentInputStream(DEFAULT_POIFS_ENTRY);
_length = dis.readLong();

View File

@ -131,10 +131,14 @@ public final class TestPOIDocumentMain {
doc.write(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
((HSSFWorkbook)doc).close();
doc = new HSSFWorkbook(bais);
assertNotNull(doc.getSummaryInformation());
assertNotNull(doc.getDocumentSummaryInformation());
((HSSFWorkbook)doc).close();
}
@Test
@ -148,6 +152,9 @@ public final class TestPOIDocumentMain {
// Write out and back in again, no change
ByteArrayOutputStream baos = new ByteArrayOutputStream();
doc.write(baos);
((HSSFWorkbook)doc).close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
doc = new HSSFWorkbook(bais);
@ -162,6 +169,9 @@ public final class TestPOIDocumentMain {
// Save and re-load
baos = new ByteArrayOutputStream();
doc.write(baos);
((HSSFWorkbook)doc).close();
bais = new ByteArrayInputStream(baos.toByteArray());
doc = new HSSFWorkbook(bais);
@ -177,5 +187,7 @@ public final class TestPOIDocumentMain {
assertNotNull(doc.getDocumentSummaryInformation());
assertEquals("POI Testing", doc.getSummaryInformation().getAuthor());
assertEquals("ASF", doc.getDocumentSummaryInformation().getCompany());
((HSSFWorkbook)doc).close();
}
}

View File

@ -206,7 +206,7 @@ public class NumberRenderingSpreadsheetGenerator {
}
private static void writeLong(byte[] bb, int i, long val) {
String oldVal = interpretLong(bb, i);
/*String oldVal =*/ interpretLong(bb, i);
bb[i+7] = (byte) (val >> 56);
bb[i+6] = (byte) (val >> 48);
bb[i+5] = (byte) (val >> 40);

View File

@ -17,18 +17,17 @@ limitations under the License.
package org.apache.poi.ss.util;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertNotEquals;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
//TODO: replace junit3 with junit4 code
import junit.framework.TestCase; //junit3
import static org.junit.Assert.assertNotEquals; //junit4
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
import org.apache.poi.util.LittleEndianOutputStream;
//TODO: replace junit3 with junit4 code
import junit.framework.TestCase; //junit3
public final class TestCellRangeAddress extends TestCase {
byte[] data = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x04,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, };

View File

@ -19,7 +19,6 @@ package org.apache.poi.util;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -29,7 +28,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
import org.junit.Test;

View File

@ -21,6 +21,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@ -32,7 +33,7 @@ import junit.framework.TestCase;
*/
public final class TestLittleEndianStreams extends TestCase {
public void testRead() {
public void testRead() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LittleEndianOutput leo = new LittleEndianOutputStream(baos);
leo.writeInt(12345678);
@ -42,6 +43,7 @@ public final class TestLittleEndianStreams extends TestCase {
leo.writeByte(200);
leo.writeLong(1234567890123456789L);
leo.writeDouble(123.456);
((LittleEndianOutputStream)leo).close();
LittleEndianInput lei = new LittleEndianInputStream(new ByteArrayInputStream(baos.toByteArray()));
@ -52,6 +54,7 @@ public final class TestLittleEndianStreams extends TestCase {
assertEquals(200, lei.readUByte());
assertEquals(1234567890123456789L, lei.readLong());
assertEquals(123.456, lei.readDouble(), 0.0);
((LittleEndianInputStream)lei).close();
}
/**