Remove unnecessary casts and toString() calls

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808512 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-09-16 08:23:30 +00:00
parent 0ce7fff0be
commit 8ca329e08b
8 changed files with 10 additions and 10 deletions

View File

@ -455,7 +455,7 @@ public class Property {
} else if (type == Variant.VT_EMPTY || type == Variant.VT_NULL || value == null) {
b.append("null");
} else {
b.append(value.toString());
b.append(value);
String decoded = decodeValueFromID();
if (decoded != null) {

View File

@ -107,7 +107,7 @@ public class SectionIDMap {
if (m == null) {
return UNDEFINED;
}
final String s = (String) m.get(pid);
final String s = m.get(pid);
if (s == null) {
return UNDEFINED;
}

View File

@ -4450,7 +4450,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
for (RelationPart part : getRelationParts()) {
if (part.getDocumentPart() instanceof XSSFTable) {
// call table delete
removeTable((XSSFTable) part.getDocumentPart());
removeTable(part.getDocumentPart());
continue;
}
removeRelation(part.getDocumentPart(), true);

View File

@ -1049,7 +1049,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
public String toString() {
String phonetic = getPhonetic();
if (phonetic.length() > 0) {
return text() +" ("+phonetic.toString()+")";
return text() +" ("+ phonetic +")";
} else {
return text();
}

View File

@ -168,8 +168,8 @@ public class TestHxxFEncryption {
EncryptionInfo ei = doc.getEncryptionInfo();
assertNotNull(ei);
assertTrue(ei.getHeader() instanceof CryptoAPIEncryptionHeader);
assertEquals(0x28, ((CryptoAPIEncryptionHeader)ei.getHeader()).getKeySize());
((CryptoAPIEncryptionHeader)ei.getHeader()).setKeySize(0x78);
assertEquals(0x28, ei.getHeader().getKeySize());
ei.getHeader().setKeySize(0x78);
bos.reset();
doc.write(bos);
doc.close();
@ -180,7 +180,7 @@ public class TestHxxFEncryption {
ei = doc.getEncryptionInfo();
assertNotNull(ei);
assertTrue(ei.getHeader() instanceof CryptoAPIEncryptionHeader);
assertEquals(0x78, ((CryptoAPIEncryptionHeader)ei.getHeader()).getKeySize());
assertEquals(0x78, ei.getHeader().getKeySize());
doc.close();
te4.close();
}

View File

@ -335,7 +335,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
XSSFWorkbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
XSSFCellStyle hlinkStyle = (XSSFCellStyle) wb.createCellStyle();
XSSFCellStyle hlinkStyle = wb.createCellStyle();
Font hlinkFont = wb.createFont();
Sheet sheet = wb.createSheet("test");

View File

@ -89,7 +89,7 @@ public class HwmfPicture {
}
consumedSize += wr.init(leis, recordSize, recordFunction);
int remainingSize = (int)(recordSize - consumedSize);
int remainingSize = recordSize - consumedSize;
if (remainingSize < 0) {
throw new RecordFormatException("read too many bytes. record size: "+recordSize + "; comsumed size: "+consumedSize);
} else if(remainingSize > 0) {

View File

@ -531,7 +531,7 @@ public class TestWriteWellKnown {
/* Removing the custom property must return the remove property and
* reduce the size to 0. */
cp = (CustomProperty) cps.remove(KEY);
cp = cps.remove(KEY);
assertEquals(KEY, cp.getName());
assertEquals(VALUE_2, cp.getValue());
assertEquals(0, cps.size());