Fix some IntelliJ warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-06-18 05:59:11 +00:00
parent 0e57435abe
commit bac17be565
5 changed files with 14 additions and 10 deletions

View File

@ -23,6 +23,7 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput; import org.apache.poi.util.LittleEndianOutput;
/** /**
* See the spec at 2.5.198.76 PtgName
* *
* @author andy * @author andy
* @author Jason Height (jheight at chariot dot net dot au) * @author Jason Height (jheight at chariot dot net dot au)

View File

@ -49,7 +49,7 @@ public final class LittleEndianOutputStream extends FilterOutputStream implement
int b3 = (v >>> 24) & 0xFF; int b3 = (v >>> 24) & 0xFF;
int b2 = (v >>> 16) & 0xFF; int b2 = (v >>> 16) & 0xFF;
int b1 = (v >>> 8) & 0xFF; int b1 = (v >>> 8) & 0xFF;
int b0 = (v >>> 0) & 0xFF; int b0 = (v/* >>> 0*/) & 0xFF;
try { try {
out.write(b0); out.write(b0);
out.write(b1); out.write(b1);
@ -62,14 +62,14 @@ public final class LittleEndianOutputStream extends FilterOutputStream implement
@Override @Override
public void writeLong(long v) { public void writeLong(long v) {
writeInt((int)(v >> 0)); writeInt((int)(v/* >> 0*/));
writeInt((int)(v >> 32)); writeInt((int)(v >> 32));
} }
@Override @Override
public void writeShort(int v) { public void writeShort(int v) {
int b1 = (v >>> 8) & 0xFF; int b1 = (v >>> 8) & 0xFF;
int b0 = (v >>> 0) & 0xFF; int b0 = (v/* >>> 0*/) & 0xFF;
try { try {
out.write(b0); out.write(b0);
out.write(b1); out.write(b1);

View File

@ -120,6 +120,7 @@ public class SharedStringsTable extends POIXMLDocumentPart {
CTSst sst = _sstDoc.getSst(); CTSst sst = _sstDoc.getSst();
count = (int)sst.getCount(); count = (int)sst.getCount();
uniqueCount = (int)sst.getUniqueCount(); uniqueCount = (int)sst.getUniqueCount();
//noinspection deprecation
for (CTRst st : sst.getSiArray()) { for (CTRst st : sst.getSiArray()) {
stmap.put(getKey(st), cnt); stmap.put(getKey(st), cnt);
strings.add(st); strings.add(st);

View File

@ -217,7 +217,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
/** /**
* cached instance of XSSFCreationHelper for this workbook * cached instance of XSSFCreationHelper for this workbook
* @see {@link #getCreationHelper()} * @see #getCreationHelper()
*/ */
private XSSFCreationHelper _creationHelper; private XSSFCreationHelper _creationHelper;
@ -399,6 +399,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
// Load individual sheets. The order of sheets is defined by the order // Load individual sheets. The order of sheets is defined by the order
// of CTSheet elements in the workbook // of CTSheet elements in the workbook
sheets = new ArrayList<XSSFSheet>(shIdMap.size()); sheets = new ArrayList<XSSFSheet>(shIdMap.size());
//noinspection deprecation
for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) { for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) {
parseSheet(shIdMap, ctSheet); parseSheet(shIdMap, ctSheet);
} }
@ -594,7 +595,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
// copy sheet's relations // copy sheet's relations
List<RelationPart> rels = srcSheet.getRelationParts(); List<RelationPart> rels = srcSheet.getRelationParts();
// if the sheet being cloned has a drawing then rememebr it and re-create it too // if the sheet being cloned has a drawing then remember it and re-create it too
XSSFDrawing dg = null; XSSFDrawing dg = null;
for(RelationPart rp : rels) { for(RelationPart rp : rels) {
POIXMLDocumentPart r = rp.getDocumentPart(); POIXMLDocumentPart r = rp.getDocumentPart();
@ -638,7 +639,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
clonedSheet.setSelected(false); clonedSheet.setSelected(false);
// clone the sheet drawing alongs with its relationships // clone the sheet drawing along with its relationships
if (dg != null) { if (dg != null) {
if(ct.isSetDrawing()) { if(ct.isSetDrawing()) {
// unset the existing reference to the drawing, // unset the existing reference to the drawing,
@ -1709,6 +1710,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
newcts.set(cts); newcts.set(cts);
//notify sheets //notify sheets
//noinspection deprecation
CTSheet[] sheetArray = ct.getSheetArray(); CTSheet[] sheetArray = ct.getSheetArray();
for(int i=0; i < sheetArray.length; i++) { for(int i=0; i < sheetArray.length; i++) {
sheets.get(i).sheet = sheetArray[i]; sheets.get(i).sheet = sheetArray[i];
@ -1877,6 +1879,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
* @return true if the sheet contains the name, false otherwise. * @return true if the sheet contains the name, false otherwise.
*/ */
private boolean containsSheet(String name, int excludeSheetIdx) { private boolean containsSheet(String name, int excludeSheetIdx) {
//noinspection deprecation
CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray(); CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray();
if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) {
@ -2359,7 +2362,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
* Adds a vbaProject.bin file to the workbook. This will change the workbook * Adds a vbaProject.bin file to the workbook. This will change the workbook
* type if necessary. * type if necessary.
* *
* @throws IOException * @throws IOException If copying data from the stream fails.
*/ */
public void setVBAProject(InputStream vbaProjectStream) throws IOException { public void setVBAProject(InputStream vbaProjectStream) throws IOException {
if (!isMacroEnabled()) { if (!isMacroEnabled()) {
@ -2390,8 +2393,8 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
/** /**
* Adds a vbaProject.bin file taken from another, given workbook to this one. * Adds a vbaProject.bin file taken from another, given workbook to this one.
* @throws IOException * @throws IOException If copying the VBAProject stream fails.
* @throws InvalidFormatException * @throws InvalidFormatException If an error occurs while handling parts of the XSSF format
*/ */
public void setVBAProject(XSSFWorkbook macroWorkbook) throws IOException, InvalidFormatException { public void setVBAProject(XSSFWorkbook macroWorkbook) throws IOException, InvalidFormatException {
if (!macroWorkbook.isMacroEnabled()) { if (!macroWorkbook.isMacroEnabled()) {

View File

@ -26,7 +26,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.apache.poi.POIDataSamples; import org.apache.poi.POIDataSamples;