]> source.dussan.org Git - poi.git/commitdiff
Remove unnecessary local variables
authorDominik Stadler <centic@apache.org>
Sat, 16 Sep 2017 08:28:38 +0000 (08:28 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 16 Sep 2017 08:28:38 +0000 (08:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808518 13f79535-47bb-0310-9956-ffa450edef68

118 files changed:
src/examples/src/org/apache/poi/hssf/view/SViewer.java
src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
src/examples/src/org/apache/poi/ss/examples/formula/CalculateMortgage.java
src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
src/excelant/testcases/org/apache/poi/ss/examples/formula/CalculateMortgageFunction.java
src/java/org/apache/poi/ddf/EscherColorRef.java
src/java/org/apache/poi/hpsf/PropertySet.java
src/java/org/apache/poi/hpsf/Section.java
src/java/org/apache/poi/hpsf/Thumbnail.java
src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java
src/java/org/apache/poi/hssf/dev/BiffViewer.java
src/java/org/apache/poi/hssf/model/InternalWorkbook.java
src/java/org/apache/poi/hssf/record/CFHeaderBase.java
src/java/org/apache/poi/hssf/record/EndSubRecord.java
src/java/org/apache/poi/hssf/record/EscherAggregate.java
src/java/org/apache/poi/hssf/record/FormatRecord.java
src/java/org/apache/poi/hssf/record/MergeCellsRecord.java
src/java/org/apache/poi/hssf/record/NameCommentRecord.java
src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java
src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
src/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java
src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java
src/java/org/apache/poi/hssf/record/chart/BeginRecord.java
src/java/org/apache/poi/hssf/record/chart/EndRecord.java
src/java/org/apache/poi/hssf/record/chart/PlotAreaRecord.java
src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
src/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java
src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java
src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java
src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
src/java/org/apache/poi/poifs/filesystem/POIFSDocumentPath.java
src/java/org/apache/poi/poifs/storage/SmallBlockTableReader.java
src/java/org/apache/poi/sl/draw/DrawPaint.java
src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java
src/java/org/apache/poi/ss/format/CellNumberFormatter.java
src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
src/java/org/apache/poi/ss/formula/functions/DStarRunner.java
src/java/org/apache/poi/ss/formula/functions/Finance.java
src/java/org/apache/poi/ss/formula/functions/Index.java
src/java/org/apache/poi/ss/formula/functions/NumericFunction.java
src/java/org/apache/poi/ss/formula/ptg/AttrPtg.java
src/java/org/apache/poi/ss/formula/ptg/NameXPtg.java
src/java/org/apache/poi/ss/usermodel/CellCopyPolicy.java
src/java/org/apache/poi/ss/util/CellRangeAddressBase.java
src/java/org/apache/poi/ss/util/CellReference.java
src/java/org/apache/poi/ss/util/ExpandedDouble.java
src/java/org/apache/poi/ss/util/ImageUtils.java
src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/FileHelper.java
src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPivotTable.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java
src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFSingleXmlCell.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
src/ooxml/testcases/org/apache/poi/poifs/crypt/PkiTestUtils.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java
src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java
src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java
src/scratchpad/src/org/apache/poi/hslf/record/Record.java
src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java
src/scratchpad/src/org/apache/poi/hssf/converter/AbstractExcelUtils.java
src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java
src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java
src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java
src/scratchpad/src/org/apache/poi/hwpf/converter/HtmlDocumentFacade.java
src/scratchpad/src/org/apache/poi/hwpf/dev/RecordUtil.java
src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java
src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
src/scratchpad/src/org/apache/poi/hwpf/model/PlexOfField.java
src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java
src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java
src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/FieldsImpl.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/OfficeDrawingsImpl.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java
src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
src/testcases/org/apache/poi/hssf/model/TestSheet.java
src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculatorFromSpreadsheet.java
src/testcases/org/apache/poi/ss/formula/eval/TestFormulaBugs.java
src/testcases/org/apache/poi/ss/formula/eval/TestMinusZeroResult.java
src/testcases/org/apache/poi/ss/formula/function/TestReadMissingBuiltInFuncs.java
src/testcases/org/apache/poi/ss/formula/functions/TestBin2Dec.java
src/testcases/org/apache/poi/ss/formula/functions/TestDec2Bin.java
src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java
src/testcases/org/apache/poi/ss/formula/functions/TestHex2Dec.java
src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java

index 1d3fefdff37b699103211e1244dfc4cf0e63fe65..3d83c6aace04e1a0f0d1d78133db9dfad5f0a12a 100644 (file)
@@ -139,8 +139,7 @@ public String[][] getParameterInfo() {
       System.out.println(field);
       field = uc.getHeaderField(i);
   }
-    BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
-    return is;
+      return new BufferedInputStream(uc.getInputStream());
   }
 
 
index 3516b88e8d1631543899692d9fe8883fdd555727..c187a1b415aa8eaf91d95dd2d2d8d4473017d28c 100644 (file)
@@ -40,8 +40,7 @@ public final class Word2Forrest
   @SuppressWarnings("unused")
   public Word2Forrest(HWPFDocument doc, OutputStream stream) throws IOException
   {
-    OutputStreamWriter out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
-    _out = out;
+      _out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
     _doc = doc;
 
     init ();
index 3d6b4423a179310bc7ed09a3fb06bb77568d7dae..678776c060ab456525df9fc43d0030a1a993a3d5 100644 (file)
@@ -75,11 +75,8 @@ public class CalculateMortgage implements FreeRefFunction {
     public double calculateMortgagePayment( double p, double r, double y ) {
         double i = r / 12 ;
         double n = y * 12 ;
-        
-        double principalAndInterest = 
-             p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1))  ;
-        
-        return principalAndInterest ;
+
+        return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
     }
     /**
      * Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
index fa98628eeef3cfb2c2160dc215e239539e83d0da..2a745dd0ec1d7a61e3b319e0d11e243f5477e205 100644 (file)
@@ -154,9 +154,8 @@ public class ExcelAntWorkbookUtil extends Typedef {
         }
 
         UDFFinder udff1 = new DefaultUDFFinder(names, functions);
-        UDFFinder udff = new AggregatingUDFFinder(udff1);
 
-        return udff;
+        return new AggregatingUDFFinder(udff1);
 
     }
 
index f1c526bf9d5f4b7be88ed5bcdd4cee91cd7b1b20..2e2e62bf8173438da7c742226b682d94365c15d1 100644 (file)
@@ -77,11 +77,8 @@ public class CalculateMortgageFunction implements FreeRefFunction {
     public double calculateMortgagePayment( double p, double r, double y ) {
         double i = r / 12 ;
         double n = y * 12 ;
-        
-        double principalAndInterest = 
-             p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1))  ;
-        
-        return principalAndInterest ;
+
+        return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
     }
     /**
      * Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
index 949a905c9834a8d184e23e6592862489b5e56265..0603329b18fa29a22365f8487bc8ab6747beaf63 100644 (file)
@@ -218,12 +218,11 @@ public class EscherColorRef {
     }
 
     public int[] getRGB() {
-        int rgb[] = {
+        return new int[]{
             FLAG_RED.getValue(colorRef),
             FLAG_GREEN.getValue(colorRef),
             FLAG_BLUE.getValue(colorRef)
         };
-        return rgb;
     }
     
     /**
index 0f5fbdbf6c7d352659022b2d21696ab3ac76da9c..b21d1a036c418b1313bfc8122df068cf208c8921 100644 (file)
@@ -391,8 +391,7 @@ public class PropertySet {
          */
         try {
             final byte[] buffer = IOUtils.peekFirstNBytes(stream, BUFFER_SIZE);
-            final boolean isPropertySetStream = isPropertySetStream(buffer, 0, buffer.length);
-            return isPropertySetStream;
+            return isPropertySetStream(buffer, 0, buffer.length);
         } catch (EmptyFileException e) {
             return false;
         }
index 8ffa541e4d00c84d8dfd5fc1cabd95e9edd487e2..0669ff34ca1ac8672c87e01f194fad7ace7e9e61 100644 (file)
@@ -955,8 +955,7 @@ public class Section {
         for (int i = 0; i < pa.length; i++) {
             hashCode += pa[i].hashCode();
         }
-        final int returnHashCode = (int) (hashCode & 0x0ffffffffL);
-        return returnHashCode;
+        return (int) (hashCode & 0x0ffffffffL);
     }
 
 
index 87bd68228f34580bb2f0b8d5d3103ff8a2b8b9e7..f6e52c019213b0ee07cce604c661de7556fec29d 100644 (file)
@@ -198,9 +198,8 @@ public final class Thumbnail {
      */
     public long getClipboardFormatTag()
     {
-        long clipboardFormatTag = LittleEndian.getInt(getThumbnail(),
+        return (long) LittleEndian.getInt(getThumbnail(),
                                                        OFFSET_CFTAG);
-        return clipboardFormatTag;
     }
 
 
index c3efc21d3db40799a7eff34feeddc888e22f8620..da85c8a7171e0c61fcc96b3aef6ff5c97ab96a47 100644 (file)
@@ -143,12 +143,9 @@ public class HPSFPropertiesExtractor extends POIOLE2TextExtractor {
 
     public static void main(String[] args) throws IOException {
         for (String file : args) {
-            HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
-                    new NPOIFSFileSystem(new File(file)));
-            try {
+            try (HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
+                    new NPOIFSFileSystem(new File(file)))) {
                 System.out.println(ext.getText());
-            } finally {
-                ext.close();
             }
         }
     }
index 09b57dedb88c938e39f58180928dedc657049c84..9f0aa1323daf4d335aa359822a28258c62bf1c4b 100644 (file)
@@ -422,8 +422,7 @@ public final class BiffViewer {
             } else {
                 boolean dumpInterpretedRecords = cmdArgs.shouldDumpRecordInterpretations();
                 boolean dumpHex = cmdArgs.shouldDumpBiffHex();
-                boolean zeroAlignHexDump = dumpInterpretedRecords;  // TODO - fix non-zeroAlign
-                runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, zeroAlignHexDump,
+                runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, dumpInterpretedRecords,
                         cmdArgs.suppressHeader());
             }
         } finally {
index 44c5fb009dc3da67f8aaaa2f01df2e70c41cd8b5..5b9e7c57aec036ab4972819cdb784f37ffcf4320 100644 (file)
@@ -491,10 +491,8 @@ public final class InternalWorkbook {
             "There are only " + numfonts
             + " font records, you asked for " + idx);
         }
-        FontRecord retval =
-        ( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
 
-        return retval;
+        return ( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
     }
 
     /**
@@ -867,10 +865,8 @@ public final class InternalWorkbook {
         int xfptr = records.getXfpos() - (numxfs - 1);
 
         xfptr += index;
-        ExtendedFormatRecord retval =
-        ( ExtendedFormatRecord ) records.get(xfptr);
 
-        return retval;
+        return ( ExtendedFormatRecord ) records.get(xfptr);
     }
 
     /**
index 8ef254c710fc356f66bb277d7772c2460a4e9f5b..015917e25e51ba8a1ed287e18b1fbdbfdee8ec3e 100644 (file)
@@ -36,8 +36,7 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
     protected CFHeaderBase() {
     }
     protected CFHeaderBase(CellRangeAddress[] regions, int nRules) {
-        CellRangeAddress[] unmergedRanges = regions;
-        CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(unmergedRanges);
+        CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(regions);
         setCellRanges(mergeCellRanges);
         field_1_numcf = nRules;
     }
index 2143c36b8aac6a12407e41739bc81a06fdd2292b..c9e487d59205909782ff07f818648c74c9950074 100644 (file)
@@ -77,8 +77,7 @@ public final class EndSubRecord extends SubRecord implements Cloneable {
 
     @Override
     public EndSubRecord clone() {
-        EndSubRecord rec = new EndSubRecord();
-    
-        return rec;
+
+        return new EndSubRecord();
     }
 }
index 7fdf83f55af125e146625184c49c2860505600de..10381fb5fdb04e7709960e330accaaec6acb7d2f 100644 (file)
@@ -522,8 +522,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
         }
 
         for (NoteRecord noteRecord : tailRec.values()) {
-            Record rec = noteRecord;
-            pos += rec.serialize(pos, data);
+            pos += noteRecord.serialize(pos, data);
         }
         int bytesWritten = pos - offset;
         if (bytesWritten != getRecordSize())
index 575f709fb1b5c790ebca7ccd1fe7b0ca695a2367..f16b55d02b6396e13d2642b7984ce178723db2d9 100644 (file)
@@ -128,8 +128,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
             throw new IllegalArgumentException("Bad requested string length (" + requestedLength + ")");
         }
         char[] buf = null;
-        boolean isCompressedEncoding = pIsCompressedEncoding;
-        int availableChars = isCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
+        int availableChars = pIsCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
         //everything worked out.  Great!
         int remaining = ris.remaining();
         if (requestedLength == availableChars) {
@@ -142,7 +141,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
         }
         for (int i = 0; i < buf.length; i++) {
             char ch;
-            if (isCompressedEncoding) {
+            if (pIsCompressedEncoding) {
                 ch = (char) ris.readUByte();
             } else {
                 ch = (char) ris.readShort();
index f9ebfd34aaa15f62b87c02ce6440445efa81d11d..d1e5121154b3ea28be68002c7042c73cf5fa22a5 100644 (file)
@@ -82,8 +82,7 @@ public final class MergeCellsRecord extends StandardRecord implements Cloneable
 
     @Override
     public void serialize(LittleEndianOutput out) {
-        int nItems = _numberOfRegions;
-        out.writeShort(nItems);
+        out.writeShort(_numberOfRegions);
         for (int i = 0; i < _numberOfRegions; i++) {
                        _regions[_startIndex + i].serialize(out);
                }
index 0a3323f88650d3007b5f0497a438d0277d011418..63705cc7f8e4f040ed1dff6a62c66bc42f847923 100644 (file)
@@ -84,22 +84,21 @@ public final class NameCommentRecord extends StandardRecord {
    * @param ris the RecordInputstream to read the record from
    */
   public NameCommentRecord(final RecordInputStream ris) {
-    final LittleEndianInput in = ris;
-    field_1_record_type = in.readShort();
-    field_2_frt_cell_ref_flag = in.readShort();
-    field_3_reserved = in.readLong();
-    final int field_4_name_length = in.readShort();
-    final int field_5_comment_length = in.readShort();
-
-    if (in.readByte() == 0) {
-        field_6_name_text = StringUtil.readCompressedUnicode(in, field_4_name_length);
+      field_1_record_type = ris.readShort();
+    field_2_frt_cell_ref_flag = ris.readShort();
+    field_3_reserved = ris.readLong();
+    final int field_4_name_length = ris.readShort();
+    final int field_5_comment_length = ris.readShort();
+
+    if (ris.readByte() == 0) {
+        field_6_name_text = StringUtil.readCompressedUnicode(ris, field_4_name_length);
     } else {
-        field_6_name_text = StringUtil.readUnicodeLE(in, field_4_name_length);
+        field_6_name_text = StringUtil.readUnicodeLE(ris, field_4_name_length);
     }
-    if (in.readByte() == 0) {
-        field_7_comment_text = StringUtil.readCompressedUnicode(in, field_5_comment_length);
+    if (ris.readByte() == 0) {
+        field_7_comment_text = StringUtil.readCompressedUnicode(ris, field_5_comment_length);
     } else {
-        field_7_comment_text = StringUtil.readUnicodeLE(in, field_5_comment_length);
+        field_7_comment_text = StringUtil.readUnicodeLE(ris, field_5_comment_length);
     }    
   }
 
index 2bd79d642776619db29498209053fc3a82be2154..3a3a4e33b467b670858a0a07b4173a8233807940 100644 (file)
@@ -103,13 +103,12 @@ public final class RecordFactoryInputStream {
                }
 
                public RecordInputStream createDecryptingStream(InputStream original) {
-                       FilePassRecord fpr = _filePassRec;
-                       String userPassword = Biff8EncryptionKey.getCurrentUserPassword();
+            String userPassword = Biff8EncryptionKey.getCurrentUserPassword();
                        if (userPassword == null) {
                            userPassword = Decryptor.DEFAULT_PASSWORD;
                        }
 
-                       EncryptionInfo info = fpr.getEncryptionInfo();
+                       EncryptionInfo info = _filePassRec.getEncryptionInfo();
             try {
                 if (!info.getDecryptor().verifyPassword(userPassword)) {
                     throw new EncryptedDocumentException(
index 4e9a2991864d1d0e57d2ae5b250a2c23dcd2de53..8dc14adb60e3aef40c3f77cfae928ca6e235789b 100644 (file)
@@ -363,12 +363,11 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements
                        attemptMergeColInfoRecords(k);
                } else {
                        //split to 3 records
-                       ColumnInfoRecord ciStart = ci;
-                       ColumnInfoRecord ciMid = copyColInfo(ci);
+            ColumnInfoRecord ciMid = copyColInfo(ci);
                        ColumnInfoRecord ciEnd = copyColInfo(ci);
                        int lastcolumn = ci.getLastColumn();
 
-                       ciStart.setLastColumn(targetColumnIx - 1);
+                       ci.setLastColumn(targetColumnIx - 1);
 
                        ciMid.setFirstColumn(targetColumnIx);
                        ciMid.setLastColumn(targetColumnIx);
index e7859a087a08f916ac63960f66361b225073e929..f85b3375a36a3e6461792528aa0212c434881790 100644 (file)
@@ -46,13 +46,12 @@ public final class MergedCellsTable extends RecordAggregate {
         * @param rs
         */
        public void read(RecordStream rs) {
-               List<CellRangeAddress> temp = _mergedRegions;
-               while (rs.peekNextClass() == MergeCellsRecord.class) {
+        while (rs.peekNextClass() == MergeCellsRecord.class) {
                        MergeCellsRecord mcr = (MergeCellsRecord) rs.getNext();
                        int nRegions = mcr.getNumAreas();
                        for (int i = 0; i < nRegions; i++) {
                                CellRangeAddress cra = mcr.getAreaAt(i);
-                               temp.add(cra);
+                               _mergedRegions.add(cra);
                        }
                }
        }
@@ -67,10 +66,9 @@ public final class MergedCellsTable extends RecordAggregate {
                int nMergedCellsRecords = nRegions / MAX_MERGED_REGIONS;
                int nLeftoverMergedRegions = nRegions % MAX_MERGED_REGIONS;
 
-               int result = nMergedCellsRecords
-                               * (4 + CellRangeAddressList.getEncodedSize(MAX_MERGED_REGIONS)) + 4
-                               + CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions);
-               return result;
+        return nMergedCellsRecords
+                * (4 + CellRangeAddressList.getEncodedSize(MAX_MERGED_REGIONS)) + 4
+                + CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions);
        }
 
        public void visitContainedRecords(RecordVisitor rv) {
index ed5b7ecb3acc1500e7ac097a8140c406d7bcf1ed..ff12e1df8c3bb4141132f9f072e5f9ae8da0fe80 100644 (file)
@@ -172,8 +172,7 @@ public final class SharedValueManager {
                 _groupsCache.put(getKeyForCache(group._firstCell),group);
             }
         }
-        SharedFormulaGroup sfg = _groupsCache.get(getKeyForCache(cellRef));
-        return sfg;
+        return _groupsCache.get(getKeyForCache(cellRef));
     }
 
     private Integer getKeyForCache(final CellReference cellRef) {
index 88a7efcf28be47c6f995544278aa6d29ff289029..10e4bd4f88833b2f1a332eefc58df733c76bc809 100644 (file)
@@ -66,8 +66,7 @@ public final class BeginRecord extends StandardRecord implements Cloneable {
     
     @Override
     public BeginRecord clone() {
-       BeginRecord br = new BeginRecord();
-       // No data so nothing to copy
-       return br;
+        // No data so nothing to copy
+       return new BeginRecord();
     }
 }
index 23d09d16385838a0209343f3b82fb54b49e82729..238c5ae11a63fc153f8e1c8c73d3070539817ec8 100644 (file)
@@ -67,8 +67,7 @@ public final class EndRecord extends StandardRecord implements Cloneable {
     
     @Override
     public EndRecord clone() {
-       EndRecord er = new EndRecord();
-       // No data so nothing to copy
-       return er;
+        // No data so nothing to copy
+       return new EndRecord();
     }
 }
index 775354cd134a9d864c984bc7afc0bd86e01e4d93..e33e479ca55a5a6362d62b38ab44ab65da18c8e9 100644 (file)
@@ -64,8 +64,6 @@ public final class PlotAreaRecord extends StandardRecord {
     }
 
     public Object clone() {
-        PlotAreaRecord rec = new PlotAreaRecord();
-    
-        return rec;
+        return new PlotAreaRecord();
     }
 }
index 7b10c1ed8a43997972f23ec07dfd523d05259224..5fce4c17de74ffcde79932de4a20165d3191eaeb 100644 (file)
@@ -151,9 +151,8 @@ public class EscherGraphics extends Graphics
     @Override
     public Graphics create()
     {
-        EscherGraphics g = new EscherGraphics(escherGroup, workbook,
+        return new EscherGraphics(escherGroup, workbook,
                 foreground, font, verticalPointsPerPixel );
-        return g;
     }
 
     @Override
index 949168aac109d6e31ae2dc12793d19bb8469d90a..af3eb3463a51c33a43cb0ae5e0cfda6bc213161e 100644 (file)
@@ -127,8 +127,7 @@ public final class EscherGraphics2d extends Graphics2D {
 
     public Graphics create()
     {
-        EscherGraphics2d g2d = new EscherGraphics2d(_escherGraphics);
-        return g2d;
+        return new EscherGraphics2d(_escherGraphics);
     }
 
     public void dispose()
index 6e029b2385a94d1784d94fd9a5f1a465c7f6cc20..b164aec6853c22605f133e02ed6bd7b3cc8ff863 100644 (file)
@@ -108,8 +108,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>,
     private UnicodeString cloneStringIfRequired() {
       if (_book == null)
         return _string;
-      UnicodeString s = (UnicodeString)_string.clone();
-      return s;
+        return (UnicodeString)_string.clone();
     }
 
     private void addToSSTIfRequired() {
index 5f09b69bea261628403ea49bbce52a3bd74c374c..e305376904ddc0799d736086c1ececf1302ec63e 100644 (file)
@@ -570,7 +570,6 @@ public class CryptoFunctions {
         /*
          *  SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
          */
-        short intermediate3 = (short)(intermediate1 | intermediate2);
-        return intermediate3;
+        return (short)(intermediate1 | intermediate2);
     }
 }
index 8be9ab3faa5d962b2a513350239cf003fe418b59..4e1964b28ce1778e604eddee997fa4ace596e541 100644 (file)
@@ -125,8 +125,7 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
 
         hash = new byte[5];
         System.arraycopy(hashAlg.digest(), 0, hash, 0, 5);
-        SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
-        return skey;
+        return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
     }
 
     @Override
index 743fedb38f2a494058d1783379195d1b6a4dde1b..6b40516ef307b2fe6925285ed5433ff6b10292c3 100644 (file)
@@ -82,8 +82,7 @@ public class BinaryRC4Encryptor extends Encryptor implements Cloneable {
     @Override
     public OutputStream getDataStream(DirectoryNode dir)
     throws IOException, GeneralSecurityException {
-        OutputStream countStream = new BinaryRC4CipherOutputStream(dir);
-        return countStream;
+        return new BinaryRC4CipherOutputStream(dir);
     }
 
     @Override
index f1b5e235ac7eac0457779c1a5fb727f6c245dfc1..d383ae4eab5a22829563a774aa47ba72e0b877e7 100644 (file)
@@ -134,8 +134,7 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
         MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
         hashAlg.update(ver.getSalt());
         byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
-        SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
-        return skey;
+        return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
     }
 
     @Override
index d06f9a3738e494a68bf4a793f0fad1641296ef7a..682d77190b2695ef8cfd2fd7b5ad597d7e3a75a6 100644 (file)
@@ -98,8 +98,7 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
         
         byte[] key = Arrays.copyOf(x3, keySize);
 
-        SecretKey skey = new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
-        return skey;
+        return new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
     }
 
     protected static byte[] fillAndXor(byte hash[], byte fillByte) {
index 2c35ac51eb6b6853a07458de03033bc1568f3217..7c74d47871bd22ba062cd290a4caa3c14943af56 100644 (file)
@@ -256,9 +256,8 @@ public class POIFSDocumentPath
         }
         String[] parentComponents = new String[ length ];
         System.arraycopy(components, 0, parentComponents, 0, length);
-        POIFSDocumentPath parent = new POIFSDocumentPath(parentComponents);
-        
-        return parent;
+
+        return new POIFSDocumentPath(parentComponents);
     }
     
     /**
index 2f9528318d7d1a51e64da3c0fea7516e2f53ef85..605b749af6b4c2d78a1438ea81cae15c5836b5ed 100644 (file)
@@ -38,10 +38,9 @@ public final class SmallBlockTableReader {
                 blockList.fetchBlocks(root.getStartBlock(), -1);
         
        // Turn that into a list
-        BlockList list =new SmallDocumentBlockList(
-                SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
 
-        return list;
+        return new SmallDocumentBlockList(
+                SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
     }
     private static BlockAllocationTableReader prepareReader(
             final POIFSBigBlockSize bigBlockSize,
index 890638f2342fc38f30fd84e535d911679b6e313c..a242149afe3a63a7935567e50a93e503fc147d60 100644 (file)
@@ -256,9 +256,8 @@ public class DrawPaint {
             LOG.log(POILogger.ERROR, "Can't load image data");
             return null;
         }
-        Paint paint = new java.awt.TexturePaint(image, textAnchor);
 
-        return paint;
+        return new java.awt.TexturePaint(image, textAnchor);
     }
 
     /**
index 1006134d5f62263f0fbdf17388e30d64a68e2b62..0abd5d62a5c29012f14c991e397740016e8672a5 100644 (file)
@@ -174,8 +174,7 @@ public enum AutoNumberingScheme {
     public String format(int value) {
         String index = formatIndex(value);
         String cased = formatCase(index);
-        String seperated = formatSeperator(cased);
-        return seperated;
+        return formatSeperator(cased);
     }
 
     private String formatSeperator(String cased) {
index acd98388217aae55ca32a9208832ac25a77114b6..764456a369d249062258bd89814370d0862c6024 100644 (file)
@@ -245,13 +245,12 @@ public class CellNumberFormatter extends CellFormatter {
         } else {
             StringBuffer fmtBuf = new StringBuffer();
             boolean first = true;
-            List<Special> specialList = integerSpecials;
             if (integerSpecials.size() == 1) {
                 // If we don't do this, we get ".6e5" instead of "6e4"
                 fmtBuf.append("0");
                 first = false;
             } else
-                for (Special s : specialList) {
+                for (Special s : integerSpecials) {
                     if (isDigitFmt(s)) {
                         fmtBuf.append(first ? '#' : '0');
                         first = false;
index 43160f3e92ffa2830430c77843509ce5996dde2d..cc24a8b1fb5f3eee421eb013c32ff48eeb727c04 100644 (file)
@@ -132,13 +132,12 @@ public abstract class BaseFormulaEvaluator implements FormulaEvaluator, Workbook
         if (cell == null) {
             return null;
         }
-        Cell result = cell;
         if (cell.getCellTypeEnum() == CellType.FORMULA) {
             CellValue cv = evaluateFormulaCellValue(cell);
             setCellValue(cell, cv);
             setCellType(cell, cv); // cell will no longer be a formula cell
         }
-        return result;
+        return cell;
     }
 
     protected abstract CellValue evaluateFormulaCellValue(Cell cell);
index 8bfe0932c3300cfe29500fb95d1124f6aa3b3e8f..6c39634117a9a4651723960dad1f0195db6a667c 100644 (file)
@@ -421,13 +421,12 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
             return getMeaningfulValues(region, false, new ValueFunction() {
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
-                    List<ValueAndFormat> values = allValues;
                     final ConditionFilterData conf = rule.getFilterConfiguration();
                     
                     if (! conf.getBottom()) {
-                        Collections.sort(values, Collections.reverseOrder());
+                        Collections.sort(allValues, Collections.reverseOrder());
                     } else {
-                        Collections.sort(values);
+                        Collections.sort(allValues);
                     }
                     
                     int limit = (int) conf.getRank();
@@ -447,15 +446,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
             return getMeaningfulValues(region, true, new ValueFunction() {
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
-                    List<ValueAndFormat> values = allValues;
-                    Collections.sort(values);
+                    Collections.sort(allValues);
                     
                     final Set<ValueAndFormat> unique = new HashSet<>();
                     
-                    for (int i=0; i < values.size(); i++) {
-                        final ValueAndFormat v = values.get(i);
+                    for (int i = 0; i < allValues.size(); i++) {
+                        final ValueAndFormat v = allValues.get(i);
                         // skip this if the current value matches the next one, or is the last one and matches the previous one
-                        if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
+                        if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
                             // current value matches next value, skip both
                             i++;
                             continue;
@@ -472,15 +470,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
             return getMeaningfulValues(region, true, new ValueFunction() {
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
-                    List<ValueAndFormat> values = allValues;
-                    Collections.sort(values);
+                    Collections.sort(allValues);
                     
                     final Set<ValueAndFormat> dup = new HashSet<>();
                     
-                    for (int i=0; i < values.size(); i++) {
-                        final ValueAndFormat v = values.get(i);
+                    for (int i = 0; i < allValues.size(); i++) {
+                        final ValueAndFormat v = allValues.get(i);
                         // skip this if the current value matches the next one, or is the last one and matches the previous one
-                        if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
+                        if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
                             // current value matches next value, add one
                             dup.add(v);
                             i++;
@@ -499,19 +496,18 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
             List<ValueAndFormat> values = new ArrayList<>(getMeaningfulValues(region, false, new ValueFunction() {
                 @Override
                 public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
-                    List<ValueAndFormat> values = allValues;
                     double total = 0;
-                    ValueEval[] pop = new ValueEval[values.size()];
-                    for (int i = 0; i < values.size(); i++) {
-                        ValueAndFormat v = values.get(i);
+                    ValueEval[] pop = new ValueEval[allValues.size()];
+                    for (int i = 0; i < allValues.size(); i++) {
+                        ValueAndFormat v = allValues.get(i);
                         total += v.value.doubleValue();
                         pop[i] = new NumberEval(v.value.doubleValue());
                     }
 
                     final Set<ValueAndFormat> avgSet = new LinkedHashSet<>(1);
-                    avgSet.add(new ValueAndFormat(new Double(values.size() == 0 ? 0 : total / values.size()), null));
+                    avgSet.add(new ValueAndFormat(new Double(allValues.size() == 0 ? 0 : total / allValues.size()), null));
 
-                    final double stdDev = values.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
+                    final double stdDev = allValues.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
                     avgSet.add(new ValueAndFormat(new Double(stdDev), null));
                     return avgSet;
                 }
index ed42c297ace251547385c1e1885968f82f620ffb..b1fe124d56e08409cb415f4fdd2750e95d37e35a 100644 (file)
@@ -125,8 +125,7 @@ public final class WorkbookEvaluator {
     }
 
     /* package */ EvaluationName getName(String name, int sheetIndex) {
-        EvaluationName evalName = _workbook.getName(name, sheetIndex);
-        return evalName;
+        return _workbook.getName(name, sheetIndex);
     }
 
     private static boolean isDebugLogEnabled() {
index 8418c4f7407900347da22d13dd440294277b6417..f2cc9c2aa0aebec2a0205c0d002764409c9f0180 100644 (file)
@@ -342,8 +342,7 @@ public final class DStarRunner implements Function3Arg {
         // Construct double from condition.
         double conditionValue = 0.0;
         try {
-            int intValue = Integer.parseInt(condition);
-            conditionValue = intValue;
+            conditionValue = Integer.parseInt(condition);
         } catch (NumberFormatException e) { // It's not an int.
             try {
                 conditionValue = Double.parseDouble(condition);
index 367438bfc2b9515979e1318e5e5a797a61249e4b..a1b0604ff0616c6ee51a0b560ff39a30a7565265 100644 (file)
@@ -40,8 +40,7 @@ public class Finance {
      */
        // http://arachnoid.com/lutusp/finance.html
        static public double pmt(double r, int nper, double pv, double fv, int type) {
-           double pmt = -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
-           return pmt;
+        return -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
        }
 
 
@@ -153,8 +152,7 @@ public class Finance {
      */
        //http://en.wikipedia.org/wiki/Future_value
        static public double fv(double r, int nper, double pmt, double pv, int type) {
-           double fv = -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
-           return fv;
+        return -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
        }
        
        /**
index 1b6af36d73185bdf8ab98c51593c1193156c18ab..2b667026ea996d4b0de216998b7a837377c2bc21 100644 (file)
@@ -93,18 +93,17 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg {
        }
 
        private static TwoDEval convertFirstArg(ValueEval arg0) {
-               ValueEval firstArg = arg0;
-               if (firstArg instanceof RefEval) {
+        if (arg0 instanceof RefEval) {
                        // convert to area ref for simpler code in getValueFromArea()
-                       return ((RefEval)firstArg).offset(0, 0, 0, 0);
+                       return ((RefEval) arg0).offset(0, 0, 0, 0);
                }
-               if((firstArg instanceof TwoDEval)) {
-                       return (TwoDEval) firstArg;
+               if((arg0 instanceof TwoDEval)) {
+                       return (TwoDEval) arg0;
                }
                // else the other variation of this function takes an array as the first argument
                // it seems like interface 'ArrayEval' does not even exist yet
                throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
-                               + firstArg.getClass().getName() + ")");
+                               + arg0.getClass().getName() + ")");
 
        }
 
index 72be101ca75d6566d2e374b7a14fd2955c8bfe40..184ccdaa4eba33b9e0196f94c54b7337255d63b1 100644 (file)
@@ -365,11 +365,10 @@ public abstract class NumericFunction implements Function {
                                double d0 = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
                                double d1 = NumericFunction.singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex);
                                double logE = Math.log(d0);
-                               double base = d1;
-                               if (Double.compare(base, Math.E) == 0) {
+                if (Double.compare(d1, Math.E) == 0) {
                                        result = logE;
                                } else {
-                                       result = logE / Math.log(base);
+                                       result = logE / Math.log(d1);
                                }
                                NumericFunction.checkValue(result);
                        } catch (EvaluationException e) {
index 96da2944517e7abf84c405ea278c4868c8680061..c145dfad361e1c11bce8fe220149b9c7d70a423b 100644 (file)
@@ -78,8 +78,7 @@ public final class AttrPtg extends ControlPtg {
         _options = in.readByte();
         _data    = in.readShort();
         if (isOptimizedChoose()) {
-            int nCases = _data;
-            int[] jumpTable = new int[nCases];
+            int[] jumpTable = new int[(int) _data];
             for (int i = 0; i < jumpTable.length; i++) {
                 jumpTable[i] = in.readUShort();
             }
index de88d1b8c21896d3f9794fd455efa368683a2d60..4684ef40b7056c12d3c81ec6ffae9be29b157648 100644 (file)
@@ -79,9 +79,8 @@ public final class NameXPtg extends OperandPtg implements WorkbookDependentFormu
        }
        
        public String toString(){
-          String retValue = "NameXPtg:[sheetRefIndex:" + _sheetRefIndex + 
-             " , nameNumber:" + _nameNumber + "]" ;
-          return retValue;
+        return "NameXPtg:[sheetRefIndex:" + _sheetRefIndex +
+           " , nameNumber:" + _nameNumber + "]";
        }
        
        public byte getDefaultOperandClass() {
index 8a0377b9a8ba72bec1affe8be3cb12ab135238f0..8aea65ad23f0ffc89d7ed49c0fb661fd6cf5deaa 100644 (file)
@@ -153,7 +153,7 @@ public class CellCopyPolicy {
     }
     
     public Builder createBuilder() {
-        final Builder builder = new Builder()
+        return new Builder()
                 .cellValue(copyCellValue)
                 .cellStyle(copyCellStyle)
                 .cellFormula(copyCellFormula)
@@ -162,7 +162,6 @@ public class CellCopyPolicy {
                 .rowHeight(copyRowHeight)
                 .condenseRows(condenseRows)
                 .mergedRegions(copyMergedRegions);
-        return builder;
     }
 
 /*
index bd9500073e021f309f142d3823a9033e713ac71b..194c793345d33de184fc1424d171d8f4fcc2fc55 100644 (file)
@@ -299,10 +299,9 @@ public abstract class CellRangeAddressBase {
        
        @Override
        public int hashCode() {
-               int code = (getMinColumn() +
-               (getMaxColumn() << 8) +
-               (getMinRow() << 16) +
-               (getMaxRow() << 24));
-               return code;
+        return (getMinColumn() +
+        (getMaxColumn() << 8) +
+        (getMinRow() << 16) +
+        (getMaxRow() << 24));
        }
 }
index e2f4b3584c135c2ffb0738c78424c50b82909d94..b6be13936d1d6c7f096cb3a43154f9e8816e60ec 100644 (file)
@@ -397,8 +397,7 @@ public class CellReference {
         String col = matcher.group(1);
         String row = matcher.group(2);
 
-        CellRefParts cellRefParts = new CellRefParts(sheetName, row, col);
-        return cellRefParts;
+        return new CellRefParts(sheetName, row, col);
     }
 
     private static String parseSheetName(String reference, int indexOfSheetNameDelimiter) {
index b647adf21717e5d16e8bcbfa5f6ffe1a0df0cae3..24ef95cacc8ab98aa00562012c146a328445490f 100644 (file)
@@ -62,8 +62,7 @@ final class ExpandedDouble {
                        _significand = frac.shiftLeft(expAdj);
                        _binaryExponent = (biasedExp & 0x07FF) - 1023 - expAdj;
                } else {
-                       BigInteger frac = getFrac(rawBits);
-                       _significand = frac;
+            _significand = getFrac(rawBits);
                        _binaryExponent = (biasedExp & 0x07FF) - 1023;
                }
        }
index be83ce838e72dd58069a283d49aef19d6a248b7e..af54e26df34ccdc72015a8a46f2a55ce69ee5f7d 100644 (file)
@@ -210,12 +210,10 @@ public class ImageUtils {
         anchor.setRow2(row2);
         anchor.setDy2(dy2);
 
-        Dimension dim = new Dimension(
+        return new Dimension(
             (int)Math.round(scaledWidth*EMU_PER_PIXEL),
             (int)Math.round(scaledHeight*EMU_PER_PIXEL)
         );
-        
-        return dim;
     }
 
     /**
index f44bf736731887a68057a2afe6e63994dd0f0030..03b053132f37129608631214dbd8de91e117aebd 100644 (file)
@@ -209,8 +209,7 @@ public final class PackagingURIHelper {
        public static URI getPath(URI uri) {
                if (uri != null) {
                        String path = uri.getPath();
-                       int len = path.length();
-                       int num2 = len;
+            int num2 = path.length();
                        while (--num2 >= 0) {
                                char ch1 = path.charAt(num2);
                                if (ch1 == PackagingURIHelper.FORWARD_SLASH_CHAR) {
index bf7402ea0ed67fec7373245bbf83a6f6cea886b5..0af90a23801cc49fedfef07ba246857df2c8224c 100644 (file)
@@ -41,8 +41,7 @@ public final class FileHelper {
        public static File getDirectory(File f) {
                if (f != null) {
                        String path = f.getPath();
-                       int len = path.length();
-                       int num2 = len;
+            int num2 = path.length();
                        while (--num2 >= 0) {
                                char ch1 = path.charAt(num2);
                                if (ch1 == File.separatorChar) {
index 99eb22001233131a3afba452c375bc34ad94627f..407831a6635102079da4c43a991892158a82bacd 100644 (file)
@@ -220,8 +220,7 @@ public class AgileEncryptor extends Encryptor implements Cloneable {
     public OutputStream getDataStream(DirectoryNode dir)
             throws IOException, GeneralSecurityException {
         // TODO: initialize headers
-        AgileCipherOutputStream countStream = new AgileCipherOutputStream(dir);
-       return countStream;
+        return new AgileCipherOutputStream(dir);
     }
 
     /**
index 955dc74453215e1cd7cda772cbdc60835b37dffc..f150d1046d1925e94ae164fc061cea0c4cc1f1c3 100644 (file)
@@ -357,8 +357,7 @@ public class SignatureInfo implements SignatureConfigurable {
             digestInfoValueBuf.write(signatureConfig.getHashMagic());
             digestInfoValueBuf.write(digest);
             byte[] digestInfoValue = digestInfoValueBuf.toByteArray();
-            byte[] signatureValue = cipher.doFinal(digestInfoValue);
-            return signatureValue;
+            return cipher.doFinal(digestInfoValue);
         } catch (Exception e) {
             throw new EncryptedDocumentException(e);
         }
index 658047a637fa7dbb3085f4dd8da07d7b5b2d9508..3c96e37795af22217238dfefa0817b7de37a4249 100644 (file)
@@ -78,8 +78,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
         try {
             try {
                 NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
-                CTNotesMaster slide =  doc.getNotesMaster();
-                return slide;
+                return doc.getNotesMaster();
             } finally {
                 is.close();
             }            
index 6ab7711a84cf3dba76a58dbf3e34ef89419729ed..619b10f216e27312e0ba677d2e23a41ac5974fb4 100644 (file)
@@ -90,8 +90,7 @@ public class XSLFShadow extends XSLFShape implements Shadow<XSLFShape,XSLFTextPa
     public Color getFillColor() {
         SolidPaint ps = getFillStyle();
         if (ps == null) return null;
-        Color col = DrawPaint.applyColorTransform(ps.getSolidColor());
-        return col;
+        return DrawPaint.applyColorTransform(ps.getSolidColor());
     }
 
     @Override
index 86aa0b7c882cca3e7e8a44d8f324e8d35c49155b..b6787a9eaaad147fc9d2805b1f6b3f00156b9bb7 100644 (file)
@@ -485,8 +485,7 @@ public abstract class XSLFTextShape extends XSLFSimpleShape
 
     @Override
     public Insets2D getInsets() {
-        Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
-        return insets;
+        return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
     }
 
     @Override
index 5dffccec1ecdc8560ee9d95672479735adf74a3d..a98a556274b129dee6d3b91447443b70e36b3ad4 100644 (file)
@@ -223,8 +223,7 @@ public class XSSFComment implements Comment {
         for (String s : position.split(",")) {
             pos[i++] = Integer.parseInt(s.trim());
         }
-        XSSFClientAnchor ca = new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
-        return ca;
+        return new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
     }
 
     /**
index 2bfef58175e4ee1a3a340c0e1426c79c6fb07950..6fcbc32ec8b26b633d0bee132baeb72bb46b325c 100644 (file)
@@ -122,8 +122,7 @@ public class XSSFFont implements Font {
      */
     public int getCharSet() {
         CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
-        int val = charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
-        return val;
+        return charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
     }
 
 
@@ -214,8 +213,7 @@ public class XSSFFont implements Font {
     private double getFontHeightRaw() {
         CTFontSize size = _ctFont.sizeOfSzArray() == 0 ? null : _ctFont.getSzArray(0);
         if (size != null) {
-            double fontHeight = size.getVal();
-            return fontHeight;
+            return size.getVal();
         }
         return DEFAULT_FONT_SIZE;
     }
index acc7afe5f0d45eb5564b2e5b915c76c57dc8ecd6..9b02e5749f4196c1e3ab8c923177b06721b4711b 100644 (file)
@@ -225,8 +225,7 @@ public class XSSFPivotTable extends POIXMLDocumentPart {
 
     protected AreaReference getPivotArea() {
         final Workbook wb = getDataSheet().getWorkbook();
-        AreaReference pivotArea = getPivotCacheDefinition().getPivotArea(wb);
-        return pivotArea;
+        return getPivotCacheDefinition().getPivotArea(wb);
     }
     
     /**
index 5df01abda27e6003e489fd1906c09750bbc97059..e59fd706b56b1e0a82ea5f3b2df41ae591382474 100644 (file)
@@ -612,8 +612,7 @@ public class XSSFTextParagraph implements Iterable<XSSFTextRun>{
         };
         fetchParagraphProperty(fetcher);
 
-        double spcBef = fetcher.getValue() == null ? 0 : fetcher.getValue();
-        return spcBef;
+        return fetcher.getValue() == null ? 0 : fetcher.getValue();
     }
 
     /**
index b91b20b34e83ad47b09bbaf164c81fb3f009fbd4..0435f69bb5a6a422a32570e1b34f14e49db477b6 100644 (file)
@@ -74,8 +74,7 @@ public class XSSFSingleXmlCell {
        public String getXpath(){
                CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
                CTXmlPr xmlPr = xmlCellPr.getXmlPr();
-               String xpath = xmlPr.getXpath();
-               return xpath;
+        return xmlPr.getXpath();
        }
        
        public long getMapId(){
index 97c7c76f19f3f9019d847fc9d0d1f978f3369b38..904fb3845dda4ffb3ac88fd3f7e187b85e71b0f6 100644 (file)
@@ -1431,8 +1431,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
     public XWPFPictureData getPictureDataByID(String blipID) {
         POIXMLDocumentPart relatedPart = getRelationById(blipID);
         if (relatedPart instanceof XWPFPictureData) {
-            XWPFPictureData xwpfPicData = (XWPFPictureData) relatedPart;
-            return xwpfPicData;
+            return (XWPFPictureData) relatedPart;
         }
         return null;
     }
index cb1d089125b80f73e2698d69a65f705ac482f91a..dfcbe56c541fa161aa3515c9b443f3242430d090 100644 (file)
@@ -1378,9 +1378,8 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
      * a new instance.
      */
     private CTPPr getCTPPr() {
-        CTPPr pr = paragraph.getPPr() == null ? paragraph.addNewPPr()
+        return paragraph.getPPr() == null ? paragraph.addNewPPr()
                 : paragraph.getPPr();
-        return pr;
     }
 
 
index 2b6ab98380b3265b2d61bd88add87fbece334e7f..381c6c202dc257dc886bb5a70f1d138976e1c583 100644 (file)
@@ -106,8 +106,7 @@ public class PkiTestUtils {
         SecureRandom random = new SecureRandom();
         keyPairGenerator.initialize(new RSAKeyGenParameterSpec(1024,
                 RSAKeyGenParameterSpec.F4), random);
-        KeyPair keyPair = keyPairGenerator.generateKeyPair();
-        return keyPair;
+        return keyPairGenerator.generateKeyPair();
     }
 
     static X509Certificate generateCertificate(PublicKey subjectPublicKey,
@@ -218,8 +217,7 @@ public class PkiTestUtils {
         documentBuilderFactory.setNamespaceAware(true);
         DocumentBuilder documentBuilder = documentBuilderFactory
                 .newDocumentBuilder();
-        Document document = documentBuilder.parse(inputSource);
-        return document;
+        return documentBuilder.parse(inputSource);
     }
 
     static String toString(Node dom) throws TransformerException {
@@ -310,8 +308,7 @@ public class PkiTestUtils {
 
         
         OCSPRespBuilder ocspRespBuilder = new OCSPRespBuilder();
-        OCSPResp ocspResp = ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
 
-        return ocspResp;
+        return ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
     }
 }
index ae234bda289d5f7e644628ac8547e60b682ccd3e..56339c1e32c5335e92902763295907d211a5d3f0 100644 (file)
@@ -341,8 +341,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
         DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
 
         DataValidationConstraint constraint = dataValidationHelper.createCustomConstraint("true");
-        final XSSFDataValidation validation = (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
-        return validation;
+        return (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
     }
     
     @Test
index 4eff222a24244dce459eb1fc3701dda8bb6239bb..dee55ab9476a9eb8df3409fdc5a3a619b5775ad6 100644 (file)
@@ -722,8 +722,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
 
         // Now check the low level stuff, and check that's all
         //  been set correctly
-        XSSFSheet xs = sheet;
-        CTWorksheet cts = xs.getCTWorksheet();
+        CTWorksheet cts = sheet.getCTWorksheet();
 
         assertEquals(1, cts.sizeOfColsArray());
         CTCols cols = cts.getColsArray(0);
index b492f4bda53db8c5fc3de6b37e6888207cb465c1..a2c8b55ac20c077f6a26550066d0c0cbf8e73b69 100644 (file)
@@ -166,8 +166,6 @@ public final class SlideIdListing {
                long type = LittleEndian.getUShort(fileContents, pos+2);
                long rlen = LittleEndian.getUInt(fileContents, pos+4);
 
-               Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
-
-               return r;
+        return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
        }
 }
index 5f83d5688d64cc6531d33e5c1568ca644c5e3f2c..af779ede76926a305e3823be5a973a304529c349 100644 (file)
@@ -124,8 +124,6 @@ public final class UserEditAndPersistListing {
                long type = LittleEndian.getUShort(fileContents, pos+2);
                long rlen = LittleEndian.getUInt(fileContents, pos+4);
 
-               Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
-
-               return r;
+        return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
        }
 }
index 5b3ca0ac12c57aca895c2bc9b66f4d7ba7143668..4d0a0e90cf88f283f7427848999e3ecdefab22eb 100644 (file)
@@ -144,8 +144,7 @@ public final class QuickButCruddyTextExtractor {
 
                // Start walking the file, looking for the records
                while(walkPos != -1) {
-                       int newPos = findTextRecords(walkPos,textV);
-                       walkPos = newPos;
+            walkPos = findTextRecords(walkPos,textV);
                }
 
                // Return what we find
index c720a555ce57940cf88ef9bfb2b264e6b5afe5fb..02f3c28b66765cb33b1a6cd5c6c47370275c5cf9 100644 (file)
@@ -182,8 +182,7 @@ public final class ColorSchemeAtom extends RecordAtom {
                byte[] with_zero = new byte[4];
                System.arraycopy(rgb,0,with_zero,0,3);
                with_zero[3] = 0;
-               int ret = LittleEndian.getInt(with_zero,0);
-               return ret;
+        return LittleEndian.getInt(with_zero,0);
        }
 
 
index 038ec27f05373910f84b42eac23439023dc821f4..97f2eb7d87130c5a0b24a884dadee8f341bb289e 100644 (file)
@@ -137,8 +137,7 @@ public abstract class Record
                }
 
                // Turn the vector into an array, and return
-               Record[] cRecords = children.toArray( new Record[children.size()] );
-               return cRecords;
+        return children.toArray( new Record[children.size()] );
        }
 
        /**
index 9b40a9893ca1c80d8ee8aeef2086b51d677c51ca..7a9ffbeb80c80bb500b1d7a0c97af634305669d1 100644 (file)
@@ -192,8 +192,7 @@ public final class TextRulerAtom extends RecordAtom {
             0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
             0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
         };
-        TextRulerAtom ruler = new TextRulerAtom(data, 0, data.length);
-        return ruler;
+        return new TextRulerAtom(data, 0, data.length);
     }
 
     public void setParagraphIndent(short tetxOffset, short bulletOffset){
index 7efe2539dae2c17e35754f6e3df461cd3c56bc0d..27f5cbaf5b42b031ff27a3d55575dff7b9f5db8c 100644 (file)
@@ -221,14 +221,13 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
             x2 = clientAnchor.getDx1();
             y2 = clientAnchor.getRow1();
         }
-        Rectangle2D anchor= new Rectangle2D.Double(
+
+        return new Rectangle2D.Double(
             (x1 == -1 ? -1 : Units.masterToPoints(x1)),
             (y1 == -1 ? -1 : Units.masterToPoints(y1)),
             (x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
             (y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
         );
-
-        return anchor;
     }
 
     /**
index 460b46875ef1e07590f1944af1ae7a398ce1813a..a61bbaedc60307339f2256b4d86be387f8ab3a8a 100644 (file)
@@ -168,14 +168,13 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
         }
 
         // TODO: find out where this -1 value comes from at #57820 (link to ms docs?)
-        Rectangle2D anchor = new Rectangle2D.Double(
+
+        return new Rectangle2D.Double(
             (x1 == -1 ? -1 : Units.masterToPoints(x1)),
             (y1 == -1 ? -1 : Units.masterToPoints(y1)),
             (x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
             (y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
         );
-        
-        return anchor;
     }
 
     /**
index dd98a017bf04dcff60e62a3bb4a4f0671d6c1b00..6152920ade86931bf6980535a26585948f0295fc 100644 (file)
@@ -131,8 +131,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
     public double getLineWidth(){
         AbstractEscherOptRecord opt = getEscherOptRecord();
         EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
-        double width = (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
-        return width;
+        return (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
     }
 
     /**
index 884902655c7a3811776d9e809662446ae6a80fb9..e9df925d0abca98bf97ecc72015b29de5a0b3856 100644 (file)
@@ -402,8 +402,7 @@ implements HSLFShapeContainer, TableShape<HSLFShape,HSLFTextParagraph> {
         }
         
         // TODO: check for merged cols
-        double width = cells[0][col].getAnchor().getWidth();
-        return width;
+        return cells[0][col].getAnchor().getWidth();
     }
 
     @Override
index 60c1707ecf91e256e25b9ea0209ab86bcd74e2b5..695500eb01fd77ef522d9f5bbbed141fd32ac9c0 100644 (file)
@@ -1212,8 +1212,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
      * representation
      */
     protected static String toInternalString(String s) {
-        String ns = s.replaceAll("\\r?\\n", "\r");
-        return ns;
+        return s.replaceAll("\\r?\\n", "\r");
     }
 
     /**
index 8d6a5f0ef5f22f5ad0d24f2106f6d774a53d8940..c33272e05b592b5ae92e9447c5adac707aac49a0 100644 (file)
@@ -415,8 +415,7 @@ public final class HSLFTextRun implements TextRun {
             return null;
         }
                Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet());
-               SolidPaint ps = DrawPaint.createSolidPaint(color);
-               return ps;
+        return DrawPaint.createSolidPaint(color);
        }
 
        /**
index 6dc8c3b5572cfe5c9d43f29b07ea48262fb08a31..09a0f4560e98c4ab61eae9c6830dfcd8aa1fd8fc 100644 (file)
@@ -723,8 +723,7 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
 
     @Override
     public Insets2D getInsets() {
-        Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
-        return insets;
+        return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
     }
 
     @Override
index 08b47964560f88855432effa8af75297dace94c6..614b749358ccd6eb57da8a9c7eb4a9d1cb271d9e 100644 (file)
@@ -185,11 +185,10 @@ public class AbstractExcelUtils
     {
         CellRangeAddress[] mergedRangeRowInfo = rowNumber < mergedRanges.length ? mergedRanges[rowNumber]
                 : null;
-        CellRangeAddress cellRangeAddress = mergedRangeRowInfo != null
+
+        return mergedRangeRowInfo != null
                 && columnNumber < mergedRangeRowInfo.length ? mergedRangeRowInfo[columnNumber]
                 : null;
-
-        return cellRangeAddress;
     }
 
     static boolean isEmpty( String str )
index a7fe782578ad00a464a26780fba4d505899586c4..cb831a39a938d73f7b25d43ca370c6bfcdf0a245 100644 (file)
@@ -154,8 +154,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
                 XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
                         .newDocument() );
         excelToHtmlConverter.processWorkbook( workbook );
-        Document doc = excelToHtmlConverter.getDocument();
-        return doc;
+        return excelToHtmlConverter.getDocument();
     }
 
     private String cssClassContainerCell;
index 3e20e9e18bfb380b668388f3e2ec72daac019a10..f91781dc644fdff18305bd3483b4def5b3f2a161 100644 (file)
@@ -597,8 +597,7 @@ public final class HSSFChart {
 
        private PlotAreaRecord createPlotAreaRecord()
        {
-               PlotAreaRecord r = new PlotAreaRecord(  );
-               return r;
+        return new PlotAreaRecord(  );
        }
 
        private AxisLineFormatRecord createAxisLineFormatRecord( short format )
index 1369841acf7bb0c7803b1ec8c7f4f6482e5bad55..6b372a3760e6f5787458d6b978b9e5d93f45010b 100644 (file)
@@ -667,7 +667,6 @@ public final class HWPFDocument extends HWPFDocumentCore {
 
         // get fcMin and fcMac because we will be writing the actual text with the
         // complex table.
-        int fcMin = mainOffset;
 
         /*
          * clx (encoding of the sprm lists for a complex file and piece table
@@ -736,7 +735,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
 
         // write out the CHPBinTable.
         _fib.setFcPlcfbteChpx(tableOffset);
-        _cbt.writeTo(wordDocumentStream, tableStream, fcMin, _cft.getTextPieceTable());
+        _cbt.writeTo(wordDocumentStream, tableStream, mainOffset, _cft.getTextPieceTable());
         _fib.setLcbPlcfbteChpx(tableStream.size() - tableOffset);
         tableOffset = tableStream.size();
 
@@ -892,7 +891,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
         tableOffset = tableStream.size();
 
         // set some variables in the FileInformationBlock.
-        _fib.getFibBase().setFcMin(fcMin);
+        _fib.getFibBase().setFcMin(mainOffset);
         _fib.getFibBase().setFcMac(fcMac);
         _fib.setCbMac(wordDocumentStream.size());
 
index e265ada37b66ff529f83e0d2aca995f0301824f4..0a29f0b7dc08148861ca652d1a2f92f8101132e2 100644 (file)
@@ -194,8 +194,7 @@ public abstract class AbstractWordConverter
         original.bold = characterRun.isBold();
         original.italic = characterRun.isItalic();
         original.fontName = characterRun.getFontName();
-        Triplet updated = getFontReplacer().update( original );
-        return updated;
+        return getFontReplacer().update( original );
     }
 
     public abstract Document getDocument();
index 792458165cff13362c55a0f9c05d1961c58cd147..721c72f7e06f6112f7b8dd76a453e1bdec47caa5 100644 (file)
@@ -111,8 +111,7 @@ public class HtmlDocumentFacade
                 stringBuilder.append( "}\n" );
             }
         }
-        final String stylesheetText = stringBuilder.toString();
-        return stylesheetText;
+        return stringBuilder.toString();
     }
 
     public Element createBlock()
@@ -179,8 +178,7 @@ public class HtmlDocumentFacade
 
     public Element createSelect()
     {
-        Element result = document.createElement( "select" );
-        return result;
+        return document.createElement( "select" );
     }
 
     public Element createTable()
index a170256ac289989dc3f17fcb28686f09b662da42..a1b03bb0d5b30c38cb1d66bbc2faac4033e007b2 100644 (file)
@@ -118,8 +118,7 @@ public class RecordUtil
 
         for ( int x = 0; x < parentSize; x++ )
         {
-            int temp = mask;
-            numBits += ( temp >> x ) & 0x1;
+            numBits += ( mask >> x ) & 0x1;
         }
 
         if ( numBits == 1 )
index b5aff30977cff952fe735d9688490e25bc1ee0c1..7faba49700a5241ebc3b9bffd5a2760608ad8304 100644 (file)
@@ -226,8 +226,7 @@ public class CHPBinTable
             final int boundary = objBoundary.intValue();
 
             final int startInclusive = lastTextRunStart;
-            final int endExclusive = boundary;
-            lastTextRunStart = endExclusive;
+            lastTextRunStart = boundary;
 
             int startPosition = binarySearch( oldChpxSortedByStartPos, boundary );
             startPosition = Math.abs( startPosition );
@@ -246,7 +245,7 @@ public class CHPBinTable
                     break;
 
                 int left = Math.max( startInclusive, chpx.getStart() );
-                int right = Math.min( endExclusive, chpx.getEnd() );
+                int right = Math.min(boundary, chpx.getEnd() );
 
                 if ( left < right )
                 {
@@ -258,10 +257,10 @@ public class CHPBinTable
             {
                 logger.log( POILogger.WARN, "Text piece [",
                         Integer.valueOf( startInclusive ), "; ",
-                        Integer.valueOf( endExclusive ),
+                        Integer.valueOf(boundary),
                         ") has no CHPX. Creating new one." );
                 // create it manually
-                CHPX chpx = new CHPX( startInclusive, endExclusive,
+                CHPX chpx = new CHPX( startInclusive, boundary,
                         new SprmBuffer( 0 ) );
                 newChpxs.add( chpx );
                 continue;
@@ -272,7 +271,7 @@ public class CHPBinTable
                 // can we reuse existing?
                 CHPX existing = chpxs.get( 0 );
                 if ( existing.getStart() == startInclusive
-                        && existing.getEnd() == endExclusive )
+                        && existing.getEnd() == boundary)
                 {
                     newChpxs.add( existing );
                     continue;
@@ -286,7 +285,7 @@ public class CHPBinTable
             {
                 sprmBuffer.append( chpx.getGrpprl(), 0 );
             }
-            CHPX newChpx = new CHPX( startInclusive, endExclusive, sprmBuffer );
+            CHPX newChpx = new CHPX( startInclusive, boundary, sprmBuffer );
             newChpxs.add( newChpx );
 
             continue;
index c7d4a30fd5a1be3227f21ba07903711185baaace..62cce2e7afd2518ba2d8220adf627fe61d50756e 100644 (file)
@@ -72,9 +72,8 @@ public final class CHPX extends BytePropertyNode<CHPX>
         }
 
         CharacterProperties baseStyle = ss.getCharacterStyle( istd );
-        CharacterProperties props = CharacterSprmUncompressor.uncompressCHP(
+        return CharacterSprmUncompressor.uncompressCHP(
                 ss, baseStyle, getGrpprl(), 0 );
-        return props;
     }
 
   public String toString() {
index 4b8b4b83bfd892e9399e1386a144b5b4a6020f0a..00f35d6f1e1772181a0286fb1c11d8db52bd4e14 100644 (file)
@@ -151,8 +151,7 @@ public final class ListTables
         return null;
     }
     if(level < lst.numLevels()) {
-       ListLevel lvl = lst.getLevels()[level];
-       return lvl;
+        return lst.getLevels()[level];
     }
     if (log.check(POILogger.WARN)) {
         log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
index 5edf5866b34abaf9f990b2371411acf95048af1a..2be611a49ca7e37271711d394443c6a77b91eda7 100644 (file)
@@ -361,8 +361,6 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
     {
       int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13));
 
-      ParagraphHeight phe = new ParagraphHeight(_fkp, pheOffset);
-
-      return phe;
+        return new ParagraphHeight(_fkp, pheOffset);
     }
 }
index c58cbac27cb3607e8348df212a6956d9b62a19b3..06f79e8fe6d2ccf5cf6afeb7c7bc3925db08b7ca 100644 (file)
@@ -151,8 +151,7 @@ public final class PAPX extends BytePropertyNode<PAPX> {
             
         short istd = getIstd();
         ParagraphProperties baseStyle = ss.getParagraphStyle(istd);
-        ParagraphProperties props = ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
-        return props;
+        return ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
     }
 
     @Override
index 70e9fb1ce1e1bf4607c81932fb49ec426536f536..15793b7a4e5e82db598fa2e824fa08194566db99 100644 (file)
@@ -64,8 +64,7 @@ public class PlexOfField
     }
 
     public String toString() {
-        String str = String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
+        return String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
             , getFcStart(), getFcEnd(), fld.getBoundaryType(), fld.getFlt());
-        return str;
     }
 }
index 8a484ab1802cf94f1c69155c6a3da77fcb31a81c..b8f5acef9ac255b4589983c42422c0910822dee8 100644 (file)
@@ -89,14 +89,13 @@ public class SectionTable
         // Some files seem to lie about their unicode status, which
         //    is very very pesky. Try to work around these, but this
         //    is getting on for black magic...
-        int mainEndsAt = mainLength;
         boolean matchAt = false;
         boolean matchHalf = false;
         for (int i=0; i<_sections.size(); i++) {
             SEPX s = _sections.get(i);
-            if (s.getEnd() == mainEndsAt) {
+            if (s.getEnd() == mainLength) {
                 matchAt = true;
-            } else if(s.getEnd() == mainEndsAt || s.getEnd() == mainEndsAt-1) {
+            } else if(s.getEnd() == mainLength || s.getEnd() == mainLength -1) {
                 matchHalf = true;
             }
         }
index d4415c46b754fc438dc204ee0150c120d852a99b..be419f5f71e69bc24f0f4b5c7e5545c4df17cf55 100644 (file)
@@ -107,11 +107,10 @@ public final class StyleDescription implements HDFType
       _name = StringUtil.getFromUnicodeLE(std, nameStart, (nameLength*multiplier)/2);
 
       //length then null terminator.
-      int grupxStart = ((nameLength + 1) * multiplier) + nameStart;
 
       // the spec only refers to two possible upxs but it mentions
       // that more may be added in the future
-      int varOffset = grupxStart;
+      int varOffset = ((nameLength + 1) * multiplier) + nameStart;
       int countOfUPX = _stdfBase.getCupx();
       _upxs = new UPX[countOfUPX];
       for(int x = 0; x < countOfUPX; x++)
index b186197dac02e4ca1309f6e935bb728029058369..c4a13e4361f94995cd3ca98d48982aa987403e26 100644 (file)
@@ -73,12 +73,11 @@ public class TextPiece extends PropertyNode<TextPiece> {
      * Create the StringBuilder from the text and unicode flag
      */
     private static StringBuilder buildInitSB(byte[] text, PieceDescriptor pd) {
-        byte[] textBuffer = text;
         if (StringUtil.BIG5.equals(pd.getCharset())) {
             return new StringBuilder(CodePageUtil.cp950ToString(text, 0, text.length));
         }
 
-        String str = new String(textBuffer, 0, textBuffer.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
+        String str = new String(text, 0, text.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
         return new StringBuilder(str);
     }
 
index 5c2dc47490140261decdfc2a96c56ec70cfef14e..a657163e94f2aa88aef68ec791beb83746d4490e 100644 (file)
@@ -657,8 +657,7 @@ public final class CharacterRun extends Range
                         getPicOffset() );
                 FFData ffData = new FFData( data.getBinData(), 0 );
 
-                String[] values = ffData.getDropList();
-                return values;
+                return ffData.getDropList();
             }
         }
         return null;
index b812b66670cda8520b3179a8358b73a09cae548f..cd8572eca9811d0848040b96fc0c64b9cac3ceea 100644 (file)
@@ -54,15 +54,14 @@ public final class DateAndTime
   
   public Calendar getDate() {
      // TODO Discover if the timezone is stored somewhere else or not
-     Calendar cal = LocaleUtil.getLocaleCalendar(
-           _years.getValue(_info2)+1900, 
-           _months.getValue(_info2)-1, 
-           _dom.getValue(_info), 
-           _hours.getValue(_info), 
-           _minutes.getValue(_info),
-           0
-     );
-     return cal;
+      return LocaleUtil.getLocaleCalendar(
+            _years.getValue(_info2)+1900,
+            _months.getValue(_info2)-1,
+            _dom.getValue(_info),
+            _hours.getValue(_info),
+            _minutes.getValue(_info),
+            0
+      );
   }
 
   public void serialize(byte[] buf, int offset)
index d0c98a7fa8290b2ec35eb4a145be365b49e43643..b4c972d87f9d6afc8ad2a45dfd75914d1209f236 100644 (file)
@@ -187,11 +187,10 @@ public class FieldsImpl implements Fields
             {
             case FieldDescriptor.FIELD_SEPARATOR_MARK:
             {
-                PlexOfField separatorPlexOfField = nextPlexOfField;
 
                 int endNodePositionInList = binarySearch( plexOfFields,
                         nextNodePositionInList, endOffsetExclusive,
-                        separatorPlexOfField.getFcEnd() );
+                        nextPlexOfField.getFcEnd() );
                 if ( endNodePositionInList < 0 )
                 {
                     /*
@@ -212,17 +211,17 @@ public class FieldsImpl implements Fields
                 }
 
                 FieldImpl field = new FieldImpl( startPlexOfField,
-                        separatorPlexOfField, endPlexOfField );
+                        nextPlexOfField, endPlexOfField );
                 result.add( field );
 
                 // adding included fields
-                if ( startPlexOfField.getFcStart() + 1 < separatorPlexOfField
+                if ( startPlexOfField.getFcStart() + 1 < nextPlexOfField
                         .getFcStart() - 1 )
                 {
                     parseFieldStructureImpl( plexOfFields, next + 1,
                             nextNodePositionInList, result );
                 }
-                if ( separatorPlexOfField.getFcStart() + 1 < endPlexOfField
+                if ( nextPlexOfField.getFcStart() + 1 < endPlexOfField
                         .getFcStart() - 1 )
                 {
                     parseFieldStructureImpl( plexOfFields,
index dff4e56a66e13f2e13fbbf152753c358f9984c4a..2f100bb6589f00ef2a9b9d54e3f77acc343140c3 100644 (file)
@@ -136,8 +136,7 @@ public final class HWPFList
                     + " is more than number of level for list ("
                     + _listData.numLevels() + ")" );
         }
-        ListLevel lvl = _listData.getLevels()[level];
-        return lvl;
+        return _listData.getLevels()[level];
     }
 
     /**
index 46b88c16a9d3896dcfd7489e55cc3eb796ea1aa0..d1a6e284db2c5d880c03c92dec3081b8f861994d 100644 (file)
@@ -237,9 +237,8 @@ public class OfficeDrawingsImpl implements OfficeDrawings
                         .lookup( propertyId );
                 if ( escherProperty == null )
                     return defaultValue;
-                int value = escherProperty.getPropertyValue();
 
-                return value;
+                return escherProperty.getPropertyValue();
             }
 
             public VerticalPositioning getVerticalPositioning()
index 9da19fd3b917113a317a8ab5a92a454d5711dac3..5ad0873ba020efe02afd293a270e3de2eda01bc6 100644 (file)
@@ -565,9 +565,8 @@ public class Paragraph extends Range implements Cloneable {
         {
             throw new IllegalStateException( "Paragraph not in list" );
         }
-        HWPFList hwpfList = new HWPFList( getDocument().getStyleSheet(),
+        return new HWPFList( getDocument().getStyleSheet(),
                 getDocument().getListTables(), getIlfo() );
-        return hwpfList;
     }
 
     public boolean isInList()
index 7dd60b0b8c911be3b3ad6eb9e96088db705ec574..cd8ced23c988ba87a01e1035ec3fc1b3169237de 100644 (file)
@@ -57,8 +57,7 @@ public class TestWordToFoConverter
                 new DOMSource( wordToFoConverter.getDocument() ),
                 new StreamResult( stringWriter ) );
 
-        String result = stringWriter.toString();
-        return result;
+        return stringWriter.toString();
     }
 
     @Test
index e8e2db0823c2470dce9e5e6360ed35ae73145f61..7ebb8a401c6e268872a10a2d1b8dfabb87e07e10 100644 (file)
@@ -541,8 +541,7 @@ public final class TestSheet {
                MyIndexRecordListener myIndexListener = new MyIndexRecordListener();
                sheet.visitContainedRecords(myIndexListener, 0);
                IndexRecord indexRecord = myIndexListener.getIndexRecord();
-               int dbCellRecordPos = indexRecord.getDbcellAt(0);
-               return dbCellRecordPos;
+        return indexRecord.getDbcellAt(0);
        }
 
        private static final class MyIndexRecordListener implements RecordVisitor {
index b4e696fe30119e00578888cf7ff90a9d030f1d99..305bc5f026c00017c2707e55fe165c60552fd3f4 100644 (file)
@@ -74,9 +74,7 @@ public final class TestColumnInfoRecordsAggregate {
                public static ColumnInfoRecord[] getRecords(ColumnInfoRecordsAggregate agg) {
                        CIRCollector circ = new CIRCollector();
                        agg.visitContainedRecords(circ);
-                       ColumnInfoRecord[] result =
-                   circ._list.toArray(new ColumnInfoRecord[circ._list.size()]);
-                       return result;
+            return circ._list.toArray(new ColumnInfoRecord[circ._list.size()]);
                }
        }
 
index fea681e7494bcf6af31d748646e3b18142adad6f..cf1d1ba34eb2390e34d6408a9cf2df0ccdff763a 100644 (file)
@@ -160,9 +160,8 @@ public final class TestOLE2Embeding {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        wb.write(bos);
        wb.close();
-       POIFSFileSystem poifs = new POIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
-        
-        return poifs;
+
+        return new POIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
     }
     
     static byte[] getSampleTXT() {
index 1686790255ff9d04f9e8092acfbfb8ed1fcdffeb..d9c869e566570ed72a7e9bbaa51b7cfa7c7cf8cd 100644 (file)
@@ -154,8 +154,7 @@ public class BaseTestSlideShowFactory {
         } catch (final IOException e) {
             throw new RuntimeException(e);
         }
-        final byte[] bytes = baos.toByteArray();
-        return bytes;
+        return baos.toByteArray();
     }
 
     /**
index f683e5dbf7b4fcffbcb732a765c5798b9a8753cb..be7a6e83036eede16c2fd3956e4d83c58e2a46e0 100644 (file)
@@ -110,7 +110,6 @@ public final class TestYearFracCalculatorFromSpreadsheet {
        private static double getDoubleCell(HSSFRow row, int colIx) {
                HSSFCell cell = row.getCell(colIx);
                assertNotNull("No cell found at column " + colIx, cell);
-               double dVal = cell.getNumericCellValue();
-               return dVal;
+        return cell.getNumericCellValue();
        }
 }
index a5d991bf70b0f3b6079f1270a10a5d400c5f4fb3..9481064952afe0a73d75cbb09ee1f5f1d77b8900 100644 (file)
@@ -239,9 +239,8 @@ public final class TestFormulaBugs {
                cell.setCellFormula(formula);
                
                FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
-               CellValue value = evaluator.evaluate(cell);
-               
-               return value;
+
+        return evaluator.evaluate(cell);
        }
 
        private void checkFormulaValue(Workbook wb, Cell cell, String formula, double expectedValue) {
index 55ac409b20af025b8967702ad70552595789d12b..8e7af0312d41027893a416c00657cff17edbaa37 100644 (file)
@@ -97,8 +97,7 @@ public final class TestMinusZeroResult extends TestCase {
                for (int i = 0; i < evalArgs.length; i++) {
                        evalArgs[i] = new NumberEval(dArgs[i]);
                }
-               ValueEval r = instance.evaluate(evalArgs, -1, (short)-1);
-               return r;
+        return instance.evaluate(evalArgs, -1, (short)-1);
        }
 
        /**
index 609327cd4ddc8b8c76c30777e0bbff0224cea127..2073d45ff1e16d1542fa759bbf5557df9755d6b7 100644 (file)
@@ -159,10 +159,9 @@ public final class TestReadMissingBuiltInFuncs {
        }
 
        private String getCellFormula(int rowIx) {
-               String result = _sheet.getRow(rowIx).getCell(0).getCellFormula();
-//             if (false) {
+        //             if (false) {
 //                     System.err.println(result);
 //             }
-               return result;
+               return _sheet.getRow(rowIx).getCell(0).getCellFormula();
        }
 }
index 0ea6943c0bc0c0b6aecf9261963a2c1e21eb9f9c..12934cff7016e07e705f99fdcd0211b2948826fa 100644 (file)
@@ -97,9 +97,8 @@ public final class TestBin2Dec extends TestCase {
                 return true;
             }
         }, null);
-        OperationEvaluationContext ctx = new OperationEvaluationContext(workbookEvaluator, 
+        return new OperationEvaluationContext(workbookEvaluator,
                 workbook, 0, 0, 0, null);
-        return ctx;
     }
 
     public void testRefs() {
index 724029d99da64c6d71cab839e529ba0aa61d4fa4..df0dda6bffa8277b861070c8eff79ea084e4d300 100644 (file)
@@ -117,9 +117,8 @@ public final class TestDec2Bin extends TestCase {
                 return true;
             }
         }, null);
-        OperationEvaluationContext ctx = new OperationEvaluationContext(workbookEvaluator, 
+        return new OperationEvaluationContext(workbookEvaluator,
                 workbook, 0, 0, 0, null);
-        return ctx;
     }
 
     public void testRefs() {
index ece511035b1bc88066c70e49f243f65bf80fc74a..84b5c5fa619d943e90c8f1f13e0e7a71c2e1fd1d 100644 (file)
@@ -142,9 +142,8 @@ public final class TestDec2Hex extends TestCase {
                 return true;
             }
         }, null);
-        OperationEvaluationContext ctx = new OperationEvaluationContext(workbookEvaluator, 
+        return new OperationEvaluationContext(workbookEvaluator,
                 workbook, 0, 0, 0, null);
-        return ctx;
     }
 
     public void testRefs() {
index b1bcb2f85796b8b4f6ed4cbda865eb7e0270fe15..238703c5294febd2e6cb477ff7029e2378f58f02 100644 (file)
@@ -95,9 +95,8 @@ public final class TestHex2Dec extends TestCase {
                 return true;
             }
         }, null);
-        OperationEvaluationContext ctx = new OperationEvaluationContext(workbookEvaluator, 
+        return new OperationEvaluationContext(workbookEvaluator,
                 workbook, 0, 0, 0, null);
-        return ctx;
     }
 
     public void testRefs() {
index 559dd8c72c248a08351354960fd4e842771ea408..4c7dadc4c63b322025ca05dead28555422774221 100644 (file)
@@ -137,7 +137,6 @@ public final class TestAreaPtg extends TestCase {
                                aptg.setLastColumn((short)(aptg.getLastColumn()+letUsShiftColumn1By1Column));
                        }
                }
-               String newFormula = HSSFFormulaParser.toFormulaString(wb, ptgs);
-               return newFormula;
+        return HSSFFormulaParser.toFormulaString(wb, ptgs);
        }
 }