]> source.dussan.org Git - poi.git/commitdiff
FindBugs - DLS_DEAD_LOCAL_STORE
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 15 Aug 2015 11:57:57 +0000 (11:57 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 15 Aug 2015 11:57:57 +0000 (11:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696038 13f79535-47bb-0310-9956-ffa450edef68

34 files changed:
src/java/org/apache/poi/ddf/EscherComplexProperty.java
src/java/org/apache/poi/ddf/EscherDump.java
src/java/org/apache/poi/hssf/model/LineShape.java
src/java/org/apache/poi/hssf/model/PolygonShape.java
src/java/org/apache/poi/hssf/model/TextboxShape.java
src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
src/java/org/apache/poi/hssf/usermodel/HSSFName.java
src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionInfoBuilder.java
src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java
src/java/org/apache/poi/sl/draw/DrawTextParagraph.java
src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
src/java/org/apache/poi/ss/formula/functions/Address.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/facets/Office2010SignatureFacet.java
src/ooxml/java/org/apache/poi/util/MethodUtils.java [deleted file]
src/ooxml/java/org/apache/poi/util/XmlSort.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
src/scratchpad/src/org/apache/poi/hdf/model/HDFDocument.java
src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java
src/scratchpad/src/org/apache/poi/hmef/CompressedRTF.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java
src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java

index 8cdd46f5a0b05fdc7e9dfada83084e74d533300f..2fddc9d6b600d4d2bc31c0fbccf6a4b0a119def2 100644 (file)
@@ -135,7 +135,6 @@ public class EscherComplexProperty extends EscherProperty {
     }
 
     public String toXml(String tab){
-        String dataStr = HexDump.toHex( _complexData, 32);
         StringBuilder builder = new StringBuilder();
         builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId()))
                 .append("\" name=\"").append(getName()).append("\" blipId=\"")
index 17ac2db36c0affe3b2d8c58f066d95a17c95793c..5621806e65428bd6add2ec89406a1bdefa3159cf 100644 (file)
@@ -73,14 +73,12 @@ public final class EscherDump {
         short options;      // 4 bits for the version and 12 bits for the instance
         short recordId;
         int recordBytesRemaining;       // including enclosing records
-        StringBuffer stringBuf = new StringBuffer();
         short nDumpSize;
         String recordName;
 
         boolean atEOF = false;
 
         while (!atEOF && (remainingBytes > 0)) {
-            stringBuf = new StringBuffer();
             options = LittleEndian.readShort( in );
             recordId = LittleEndian.readShort( in );
             recordBytesRemaining = LittleEndian.readInt( in );
@@ -194,6 +192,7 @@ public final class EscherDump {
                         recordName = "UNKNOWN ID";
             }
 
+            StringBuilder stringBuf = new StringBuilder();
             stringBuf.append( "  " );
             stringBuf.append( HexDump.toHex( recordId ) );
             stringBuf.append( "  " ).append( recordName ).append( " [" );
@@ -203,6 +202,7 @@ public final class EscherDump {
             stringBuf.append( "]  instance: " );
             stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) );
             out.println( stringBuf.toString() );
+            stringBuf.setLength(0);
 
 
             if ( recordId == (short) 0xF007 && 36 <= remainingBytes && 36 <= recordBytesRemaining )
@@ -213,7 +213,7 @@ public final class EscherDump {
                 //                short n16;
                 //                int n32;
 
-                stringBuf = new StringBuffer( "    btWin32: " );
+                stringBuf = stringBuf.append( "    btWin32: " );
                 n8 = (byte) in.read();
                 stringBuf.append( HexDump.toHex( n8 ) );
                 stringBuf.append( getBlipType( n8 ) );
index f2c542a3243383965e1c70e25b0eb6f8f2da50ca..d9f6e6371d4d05ff8d23db2b25171267b11f2dfb 100644 (file)
@@ -55,7 +55,6 @@ public class LineShape
         EscherContainerRecord spContainer = new EscherContainerRecord();
         EscherSpRecord sp = new EscherSpRecord();
         EscherOptRecord opt = new EscherOptRecord();
-        EscherRecord anchor = new EscherClientAnchorRecord();
         EscherClientDataRecord clientData = new EscherClientDataRecord();
 
         spContainer.setRecordId( EscherContainerRecord.SP_CONTAINER );
@@ -74,7 +73,7 @@ public class LineShape
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
         if (userAnchor.isVerticallyFlipped())
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
-        anchor = createAnchor(userAnchor);
+        EscherRecord anchor = createAnchor(userAnchor);
         clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
         clientData.setOptions( (short) 0x0000 );
 
index 1543e2df80b85fc9d01b4897131437f4473cb4c8..2d7b724a341d9b4767d384fecc895bec559b53b8 100644 (file)
@@ -130,8 +130,6 @@ public class PolygonShape
      */
     private ObjRecord createObjRecord( HSSFShape hssfShape, int shapeId )
     {
-        HSSFShape shape = hssfShape;
-
         ObjRecord obj = new ObjRecord();
         CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
         c.setObjectType( OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING );
index 44da1ed3dae9fdad3837d9894f7cc2535bdc3e9a..d4379fd3af69460293fe7725edde8c41a963da77 100644 (file)
@@ -84,7 +84,6 @@ public class TextboxShape
         EscherContainerRecord spContainer = new EscherContainerRecord();
         EscherSpRecord sp = new EscherSpRecord();
         EscherOptRecord opt = new EscherOptRecord();
-        EscherRecord anchor = new EscherClientAnchorRecord();
         EscherClientDataRecord clientData = new EscherClientDataRecord();
         escherTextbox = new EscherTextboxRecord();
 
@@ -113,7 +112,7 @@ public class TextboxShape
         //            sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
         //        if (userAnchor.isVerticallyFlipped())
         //            sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
-        anchor = createAnchor( userAnchor );
+        EscherRecord anchor = createAnchor( userAnchor );
         clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
         clientData.setOptions( (short) 0x0000 );
         escherTextbox.setRecordId( EscherTextboxRecord.RECORD_ID );
index b82d7fbb02bba07adbfcac8959843f594166426a..618a86b06225c02f4c0814e2567b3de746d24a7e 100644 (file)
@@ -507,7 +507,7 @@ public final class HyperlinkRecord extends StandardRecord {
 
                     //From the spec: An optional unsigned integer that MUST be 3 if present
                     // but some files has 4
-                    int usKeyValue = in.readUShort();
+                    /*int usKeyValue = */ in.readUShort();
 
                     _address = StringUtil.readUnicodeLE(in, charDataSize/2);
                 } else {
index 79545327bab7cca88518add6fe360e508884c465..f27675f714752747745dbec0814930199644de72 100644 (file)
@@ -72,21 +72,12 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
 
     private HSSFFontFormatting getFontFormatting(boolean create) {
         FontFormatting fontFormatting = cfRuleRecord.getFontFormatting();
-        if ( fontFormatting != null)
-        {
-            cfRuleRecord.setFontFormatting(fontFormatting);
-            return new HSSFFontFormatting(cfRuleRecord, workbook);
-        }
-        else if( create )
-        {
+        if (fontFormatting == null) {
+            if (!create) return null;
             fontFormatting = new FontFormatting();
             cfRuleRecord.setFontFormatting(fontFormatting);
-            return new HSSFFontFormatting(cfRuleRecord, workbook);
-        }
-        else
-        {
-            return null;
         }
+        return new HSSFFontFormatting(cfRuleRecord, workbook);
     }
 
     /**
@@ -106,22 +97,14 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
 
     private HSSFBorderFormatting getBorderFormatting(boolean create) {
         BorderFormatting borderFormatting = cfRuleRecord.getBorderFormatting();
-        if ( borderFormatting != null)
-        {
-            cfRuleRecord.setBorderFormatting(borderFormatting);
-            return new HSSFBorderFormatting(cfRuleRecord, workbook);
-        }
-        else if( create )
-        {
+        if (borderFormatting == null) {
+            if (!create) return null;
             borderFormatting = new BorderFormatting();
             cfRuleRecord.setBorderFormatting(borderFormatting);
-            return new HSSFBorderFormatting(cfRuleRecord, workbook);
-        }
-        else
-        {
-            return null;
         }
+        return new HSSFBorderFormatting(cfRuleRecord, workbook);
     }
+
     /**
      * @return - border formatting object  if defined,  <code>null</code> otherwise
      */
@@ -137,24 +120,14 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
         return getBorderFormatting(true);
     }
 
-    private HSSFPatternFormatting getPatternFormatting(boolean create)
-    {
+    private HSSFPatternFormatting getPatternFormatting(boolean create) {
         PatternFormatting patternFormatting = cfRuleRecord.getPatternFormatting();
-        if ( patternFormatting != null)
-        {
-            cfRuleRecord.setPatternFormatting(patternFormatting);
-            return new HSSFPatternFormatting(cfRuleRecord, workbook);
-        }
-        else if( create )
-        {
+        if (patternFormatting == null) {
+            if (!create) return null;
             patternFormatting = new PatternFormatting();
             cfRuleRecord.setPatternFormatting(patternFormatting);
-            return new HSSFPatternFormatting(cfRuleRecord, workbook);
-        }
-        else
-        {
-            return null;
         }
+        return new HSSFPatternFormatting(cfRuleRecord, workbook);
     }
 
     /**
@@ -176,21 +149,17 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
     
     private HSSFDataBarFormatting getDataBarFormatting(boolean create) {
         CFRule12Record cfRule12Record = getCFRule12Record(create);
+        if (cfRule12Record == null) return null;
+        
         DataBarFormatting databarFormatting = cfRule12Record.getDataBarFormatting();
-        if (databarFormatting != null)
-        {
-            return new HSSFDataBarFormatting(cfRule12Record, sheet);
-        }
-        else if( create )
-        {
-            databarFormatting = cfRule12Record.createDataBarFormatting();
-            return new HSSFDataBarFormatting(cfRule12Record, sheet);
-        }
-        else
-        {
-            return null;
+        if (databarFormatting == null) {
+            if (!create) return null;
+            cfRule12Record.createDataBarFormatting();
         }
+        
+        return new HSSFDataBarFormatting(cfRule12Record, sheet);
     }
+    
     /**
      * @return databar / data-bar formatting object if defined, <code>null</code> otherwise
      */
@@ -207,21 +176,16 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
     
     private HSSFIconMultiStateFormatting getMultiStateFormatting(boolean create) {
         CFRule12Record cfRule12Record = getCFRule12Record(create);
+        if (cfRule12Record == null) return null;
+        
         IconMultiStateFormatting iconFormatting = cfRule12Record.getMultiStateFormatting();
-        if (iconFormatting != null)
-        {
-            return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
-        }
-        else if( create )
-        {
-            iconFormatting = cfRule12Record.createMultiStateFormatting();
-            return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
-        }
-        else
-        {
-            return null;
+        if (iconFormatting == null) {
+            if (!create) return null;
+            cfRule12Record.createMultiStateFormatting();
         }
+        return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
     }
+    
     /**
      * @return icon / multi-state formatting object if defined, <code>null</code> otherwise
      */
@@ -238,21 +202,17 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
     
     private HSSFColorScaleFormatting getColorScaleFormatting(boolean create) {
         CFRule12Record cfRule12Record = getCFRule12Record(create);
+        if (cfRule12Record == null) return null;
+        
         ColorGradientFormatting colorFormatting = cfRule12Record.getColorGradientFormatting();
-        if (colorFormatting != null)
-        {
-            return new HSSFColorScaleFormatting(cfRule12Record, sheet);
-        }
-        else if( create )
-        {
-            colorFormatting = cfRule12Record.createColorGradientFormatting();
-            return new HSSFColorScaleFormatting(cfRule12Record, sheet);
-        }
-        else
-        {
-            return null;
+        if (colorFormatting == null) {
+            if (!create) return null;
+            cfRule12Record.createColorGradientFormatting();
         }
+
+        return new HSSFColorScaleFormatting(cfRule12Record, sheet);
     }
+    
     /**
      * @return color scale / gradient formatting object if defined, <code>null</code> otherwise
      */
index f8c8af479e5a9e067bf2cd8f6585c441ca9d8815..dc20afd1fa218ef29910e6f2b4d5cfb9c5694133 100644 (file)
@@ -148,7 +148,6 @@ public final class HSSFName implements Name {
         
         // Update our comment, if there is one
         if(_commentRec != null) {
-           String oldName = _commentRec.getNameText();
            _commentRec.setNameText(nameName);
            _book.getWorkbook().updateNameCommentRecordCache(_commentRec);
         }
index 268a680d60e13a01d86accbfc0b4a0dd0ead0f03..7d4ec2fb3ebb5d471f5d68c80c4c708698258568 100644 (file)
@@ -36,7 +36,6 @@ import org.apache.poi.hssf.record.DrawingRecord;
 import org.apache.poi.hssf.record.EscherAggregate;
 import org.apache.poi.hssf.record.ExtendedFormatRecord;
 import org.apache.poi.hssf.record.NameRecord;
-import org.apache.poi.hssf.record.NoteRecord;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RowRecord;
 import org.apache.poi.hssf.record.SCLRecord;
@@ -1448,11 +1447,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
             return;
         }
 
-        NoteRecord[] noteRecs;
         if (moveComments) {
-            noteRecs = _sheet.getNoteRecords();
-        } else {
-            noteRecs = NoteRecord.EMPTY_ARRAY;
+            _sheet.getNoteRecords();
         }
 
         shiftMerged(startRow, endRow, n, true);
index f6477fb9b577ac6f35f0329127097159242f1949..a35eb16d7ca105d28d0592f3757e0fab00be9e7b 100644 (file)
@@ -95,8 +95,7 @@ public class DataSpaceMapUtils {
         }\r
         \r
         public DataSpaceMap(LittleEndianInput is) {\r
-            @SuppressWarnings("unused")\r
-            int length = is.readInt();\r
+            /*int length = */ is.readInt();\r
             int entryCount = is.readInt();\r
             entries = new DataSpaceMapEntry[entryCount];\r
             for (int i=0; i<entryCount; i++) {\r
@@ -125,8 +124,7 @@ public class DataSpaceMapUtils {
         }\r
         \r
         public DataSpaceMapEntry(LittleEndianInput is) {\r
-            @SuppressWarnings("unused")\r
-            int length = is.readInt();\r
+            /*int length = */ is.readInt();\r
             int referenceComponentCount = is.readInt();\r
             referenceComponentType = new int[referenceComponentCount];\r
             referenceComponent = new String[referenceComponentCount];\r
@@ -158,8 +156,7 @@ public class DataSpaceMapUtils {
         }\r
         \r
         public DataSpaceDefinition(LittleEndianInput is) {\r
-            @SuppressWarnings("unused")\r
-            int headerLength = is.readInt();\r
+            /* int headerLength = */ is.readInt();\r
             int transformReferenceCount = is.readInt();\r
             transformer = new String[transformReferenceCount];\r
             for (int i=0; i<transformReferenceCount; i++) {\r
@@ -230,8 +227,7 @@ public class DataSpaceMapUtils {
         }\r
         \r
         public TransformInfoHeader(LittleEndianInput is) {\r
-            @SuppressWarnings("unused")\r
-            int length = is.readInt();\r
+            /* int length = */ is.readInt();\r
             transformType = is.readInt();\r
             transformerId = readUnicodeLPP4(is);\r
             transformerName = readUnicodeLPP4(is);\r
index 1e470d7263845657f15a880b615628d8518e7043..e3f84143955efe80b942df20205e7b1e098f278c 100644 (file)
@@ -197,7 +197,6 @@ public class CryptoAPIDecryptor extends Decryptor {
      * \r
      * @see <a href="http://msdn.microsoft.com/en-us/library/dd943321(v=office.12).aspx">2.3.5.4 RC4 CryptoAPI Encrypted Summary Stream</a>\r
      */\r
-    @SuppressWarnings("unused")\r
     public InputStream getDataStream(DirectoryNode dir)\r
     throws IOException, GeneralSecurityException {\r
         NPOIFSFileSystem fsOut = new NPOIFSFileSystem();\r
@@ -209,7 +208,7 @@ public class CryptoAPIDecryptor extends Decryptor {
         SeekableByteArrayInputStream sbis = new SeekableByteArrayInputStream(bos.toByteArray());\r
         LittleEndianInputStream leis = new LittleEndianInputStream(sbis);\r
         int streamDescriptorArrayOffset = (int) leis.readUInt();\r
-        int streamDescriptorArraySize = (int) leis.readUInt();\r
+        /* int streamDescriptorArraySize = (int) */ leis.readUInt();\r
         sbis.skip(streamDescriptorArrayOffset - 8);\r
         sbis.setBlock(0);\r
         int encryptedStreamDescriptorCount = (int) leis.readUInt();\r
@@ -222,7 +221,7 @@ public class CryptoAPIDecryptor extends Decryptor {
             entry.block = leis.readUShort();\r
             int nameSize = leis.readUByte();\r
             entry.flags = leis.readUByte();\r
-            boolean isStream = StreamDescriptorEntry.flagStream.isSet(entry.flags);\r
+            // boolean isStream = StreamDescriptorEntry.flagStream.isSet(entry.flags);\r
             entry.reserved2 = leis.readInt();\r
             entry.streamName = StringUtil.readUnicodeLE(leis, nameSize);\r
             leis.readShort();\r
index 2a8a872642a7c6addee8850e900a1c5dd2b2430c..36df528766be950651c9e81a8874e182462267d1 100644 (file)
@@ -35,11 +35,10 @@ public class CryptoAPIEncryptionInfoBuilder implements EncryptionInfoBuilder {
     /**\r
      * initialize the builder from a stream\r
      */\r
-    @SuppressWarnings("unused")\r
     public void initialize(EncryptionInfo info, LittleEndianInput dis)\r
     throws IOException {\r
         this.info = info;\r
-        int hSize = dis.readInt();\r
+        /* int hSize = */ dis.readInt();\r
         header = new CryptoAPIEncryptionHeader(dis);\r
         verifier = new CryptoAPIEncryptionVerifier(dis, header);\r
         decryptor = new CryptoAPIDecryptor(this);\r
index 43dc5695110fd3db4c9d155930ddedf2b6fc9e4b..d55c8e0d6f4aeae542029324971e5f4b4f1d1072 100644 (file)
@@ -40,8 +40,7 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
     public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {\r
         this.info = info;\r
         \r
-        @SuppressWarnings("unused")\r
-        int hSize = dis.readInt();\r
+        /* int hSize = */ dis.readInt();\r
         header = new StandardEncryptionHeader(dis);\r
         verifier = new StandardEncryptionVerifier(dis, header);\r
 \r
index 1a40372be04a1c5934b28d669b1ad52201ac0014..1bdd1e829f67393a3f81fe4feb7c88723d710fa9 100644 (file)
@@ -101,10 +101,10 @@ public class DrawTextParagraph<T extends TextRun> implements Drawable {
             indent -= leftMargin;\r
         }\r
         \r
-        Double rightMargin = paragraph.getRightMargin();\r
-        if (rightMargin == null) {\r
-            rightMargin = 0d;\r
-        }\r
+//        Double rightMargin = paragraph.getRightMargin();\r
+//        if (rightMargin == null) {\r
+//            rightMargin = 0d;\r
+//        }\r
 \r
         //The vertical line spacing\r
         Double spacing = paragraph.getLineSpacing();\r
index c3a9361e4ed9523f34dd882b29cc1d7f7301883b..ad2553fbe7d675e41f9289c02b9b26205c389cf6 100644 (file)
@@ -63,7 +63,7 @@ public class PresetGeometries extends LinkedHashMap<String, CustomGeometry> {
         XMLEventReader staxReader = staxFactory.createXMLEventReader(is);
         XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
         // ignore StartElement:
-        XMLEvent evDoc = staxFiltRd.nextEvent();
+        /* XMLEvent evDoc = */ staxFiltRd.nextEvent();
         // JAXB:
         JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
         Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
index 379135f14846774e95da0833edee817f84712ef0..e0680dff662f324880b78b5d51664011860e2871 100644 (file)
@@ -69,14 +69,14 @@ public class Address implements Function {
                     throw new EvaluationException(ErrorEval.VALUE_INVALID);\r
             }\r
 \r
-            boolean a1;\r
-            if(args.length > 3){\r
-                ValueEval ve = OperandResolver.getSingleValue(args[3], srcRowIndex, srcColumnIndex);\r
-                // TODO R1C1 style is not yet supported\r
-                a1 = ve == MissingArgEval.instance ? true : OperandResolver.coerceValueToBoolean(ve, false);\r
-            } else {\r
-                a1 = true;\r
-            }\r
+//            boolean a1;\r
+//            if(args.length > 3){\r
+//                ValueEval ve = OperandResolver.getSingleValue(args[3], srcRowIndex, srcColumnIndex);\r
+//                // TODO R1C1 style is not yet supported\r
+//                a1 = ve == MissingArgEval.instance ? true : OperandResolver.coerceValueToBoolean(ve, false);\r
+//            } else {\r
+//                a1 = true;\r
+//            }\r
 \r
             String sheetName;\r
             if(args.length == 5){\r
index 2cdfe0f671e0151cf4799f35c374ebb289d595d3..3ea2e27afb6a58647e5bc2581d252403da401c11 100644 (file)
@@ -68,7 +68,7 @@ public class Office2010SignatureFacet extends SignatureFacet {
         }\r
         UnsignedSignaturePropertiesType unsignedSigProps = unsignedProps.getUnsignedSignatureProperties();\r
         if (unsignedSigProps == null) {\r
-            unsignedSigProps = unsignedProps.addNewUnsignedSignatureProperties();\r
+            /* unsignedSigProps = */ unsignedProps.addNewUnsignedSignatureProperties();\r
         }\r
         \r
         Node n = document.importNode(qualProps.getDomNode().getFirstChild(), true);\r
diff --git a/src/ooxml/java/org/apache/poi/util/MethodUtils.java b/src/ooxml/java/org/apache/poi/util/MethodUtils.java
deleted file mode 100644 (file)
index c006c85..0000000
+++ /dev/null
@@ -1,1334 +0,0 @@
-/* ====================================================================\r
-   Licensed to the Apache Software Foundation (ASF) under one or more\r
-   contributor license agreements.  See the NOTICE file distributed with\r
-   this work for additional information regarding copyright ownership.\r
-   The ASF licenses this file to You under the Apache License, Version 2.0\r
-   (the "License"); you may not use this file except in compliance with\r
-   the License.  You may obtain a copy of the License at\r
-\r
-       http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-   Unless required by applicable law or agreed to in writing, software\r
-   distributed under the License is distributed on an "AS IS" BASIS,\r
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-   See the License for the specific language governing permissions and\r
-   limitations under the License.\r
-==================================================================== */\r
-\r
-package org.apache.poi.util;\r
-\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.lang.reflect.Modifier;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
-\r
-/**\r
- * <p> Utility reflection methods focussed on methods in general rather than properties in particular. </p>\r
- *\r
- * <h3>Known Limitations</h3>\r
- * <h4>Accessing Public Methods In A Default Access Superclass</h4>\r
- * <p>There is an issue when invoking public methods contained in a default access superclass.\r
- * Reflection locates these methods fine and correctly assigns them as public.\r
- * However, an <code>IllegalAccessException</code> is thrown if the method is invoked.</p>\r
- *\r
- * <p><code>MethodUtils</code> contains a workaround for this situation. \r
- * It will attempt to call <code>setAccessible</code> on this method.\r
- * If this call succeeds, then the method can be invoked as normal.\r
- * This call will only succeed when the application has sufficient security privilages. \r
- * If this call fails then a warning will be logged and the method may fail.</p>\r
- *\r
- * @author Craig R. McClanahan\r
- * @author Ralph Schaer\r
- * @author Chris Audley\r
- * @author Rey Fran&#231;ois\r
- * @author Gregor Ra&#253;man\r
- * @author Jan Sorensen\r
- * @author Robert Burrell Donkin\r
- */\r
-\r
-public class MethodUtils {\r
-\r
-    // --------------------------------------------------------- Private Methods\r
-    \r
-    /** \r
-     * Only log warning about accessibility work around once.\r
-     * <p>\r
-     * Note that this is broken when this class is deployed via a shared\r
-     * classloader in a container, as the warning message will be emitted\r
-     * only once, not once per webapp. However making the warning appear\r
-     * once per webapp means having a map keyed by context classloader\r
-     * which introduces nasty memory-leak problems. As this warning is\r
-     * really optional we can ignore this problem; only one of the webapps\r
-     * will get the warning in its logs but that should be good enough.\r
-     */\r
-    private static boolean loggedAccessibleWarning = false;\r
-    \r
-    /** \r
-     * Indicates whether methods should be cached for improved performance.\r
-     * <p>\r
-     * Note that when this class is deployed via a shared classloader in\r
-     * a container, this will affect all webapps. However making this\r
-     * configurable per webapp would mean having a map keyed by context classloader\r
-     * which may introduce memory-leak problems.\r
-     */\r
-    private static boolean CACHE_METHODS = true;\r
-\r
-    /** An empty class array */\r
-    private static final Class[] EMPTY_CLASS_PARAMETERS = new Class[0];\r
-    /** An empty object array */\r
-    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];\r
-\r
-    // --------------------------------------------------------- Public Methods\r
-\r
-    /**\r
-     * <p>Invoke a named method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than <code>invokeExactMethod()</code>.\r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeMethod(Object object,String methodName,Object [] args)}.\r
-     * </p>\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param arg use this argument\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object arg)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-\r
-        Object[] args = {arg};\r
-        return invokeMethod(object, methodName, args);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a named method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than {@link #invokeExactMethod(Object object,String methodName,Object [] args)}. \r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)}.\r
-     * </p>\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object[] args)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-        int arguments = args.length;\r
-        Class[] parameterTypes = new Class[arguments];\r
-        for (int i = 0; i < arguments; i++) {\r
-            parameterTypes[i] = args[i].getClass();\r
-        }\r
-        return invokeMethod(object, methodName, args, parameterTypes);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a named method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than {@link \r
-     * #invokeExactMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)}. \r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @param parameterTypes match these parameters - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object[] args,\r
-            Class[] parameterTypes)\r
-                throws\r
-                    NoSuchMethodException,\r
-                    IllegalAccessException,\r
-                    InvocationTargetException {\r
-                    \r
-        if (parameterTypes == null) {\r
-            parameterTypes = EMPTY_CLASS_PARAMETERS;\r
-        }        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-\r
-        Method method = getMatchingAccessibleMethod(\r
-                object.getClass(),\r
-                methodName,\r
-                parameterTypes);\r
-        if (method == null) {\r
-            throw new NoSuchMethodException("No such accessible method: " +\r
-                    methodName + "() on object: " + object.getClass().getName());\r
-        }\r
-        return method.invoke(object, args);\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a method whose parameter type matches exactly the object\r
-     * type.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeExactMethod(Object object,String methodName,Object [] args)}.\r
-     * </p>\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param arg use this argument\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object arg)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-\r
-        Object[] args = {arg};\r
-        return invokeExactMethod(object, methodName, args);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a method whose parameter types match exactly the object\r
-     * types.</p>\r
-     *\r
-     * <p> This uses reflection to invoke the method obtained from a call to\r
-     * <code>getAccessibleMethod()</code>.</p>\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object[] args)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-        int arguments = args.length;\r
-        Class[] parameterTypes = new Class[arguments];\r
-        for (int i = 0; i < arguments; i++) {\r
-            parameterTypes[i] = args[i].getClass();\r
-        }\r
-        return invokeExactMethod(object, methodName, args, parameterTypes);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a method whose parameter types match exactly the parameter\r
-     * types given.</p>\r
-     *\r
-     * <p>This uses reflection to invoke the method obtained from a call to\r
-     * <code>getAccessibleMethod()</code>.</p>\r
-     *\r
-     * @param object invoke method on this object\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @param parameterTypes match these parameters - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactMethod(\r
-            Object object,\r
-            String methodName,\r
-            Object[] args,\r
-            Class[] parameterTypes)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-                \r
-        if (parameterTypes == null) {\r
-            parameterTypes = EMPTY_CLASS_PARAMETERS;\r
-        }\r
-\r
-        Method method = getAccessibleMethod(\r
-                object.getClass(),\r
-                methodName,\r
-                parameterTypes);\r
-        if (method == null) {\r
-            throw new NoSuchMethodException("No such accessible method: " +\r
-                    methodName + "() on object: " + object.getClass().getName());\r
-        }\r
-        return method.invoke(object, args);\r
-\r
-    }\r
-\r
-    /**\r
-     * <p>Invoke a static method whose parameter types match exactly the parameter\r
-     * types given.</p>\r
-     *\r
-     * <p>This uses reflection to invoke the method obtained from a call to\r
-     * {@link #getAccessibleMethod(Class, String, Class[])}.</p>\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @param parameterTypes match these parameters - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object[] args,\r
-            Class[] parameterTypes)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-                \r
-        if (parameterTypes == null) {\r
-            parameterTypes = EMPTY_CLASS_PARAMETERS;\r
-        }\r
-\r
-        Method method = getAccessibleMethod(\r
-                objectClass,\r
-                methodName,\r
-                parameterTypes);\r
-        if (method == null) {\r
-            throw new NoSuchMethodException("No such accessible method: " +\r
-                    methodName + "() on class: " + objectClass.getName());\r
-        }\r
-        return method.invoke(null, args);\r
-\r
-    }\r
-\r
-    /**\r
-     * <p>Invoke a named static method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than {@link #invokeExactMethod(Object, String, Object[], Class[])}. \r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeStaticMethod(Class objectClass,String methodName,Object [] args)}.\r
-     * </p>\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param arg use this argument\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object arg)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-\r
-        Object[] args = {arg};\r
-        return invokeStaticMethod (objectClass, methodName, args);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a named static method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than {@link #invokeExactMethod(Object object,String methodName,Object [] args)}. \r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeStaticMethod(Class objectClass,String methodName,Object [] args,Class[] parameterTypes)}.\r
-     * </p>\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object[] args)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-        int arguments = args.length;\r
-        Class[] parameterTypes = new Class[arguments];\r
-        for (int i = 0; i < arguments; i++) {\r
-            parameterTypes[i] = args[i].getClass();\r
-        }\r
-        return invokeStaticMethod (objectClass, methodName, args, parameterTypes);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a named static method whose parameter type matches the object type.</p>\r
-     *\r
-     * <p>The behaviour of this method is less deterministic \r
-     * than {@link \r
-     * #invokeExactStaticMethod(Class objectClass,String methodName,Object [] args,Class[] parameterTypes)}. \r
-     * It loops through all methods with names that match\r
-     * and then executes the first it finds with compatable parameters.</p>\r
-     *\r
-     * <p>This method supports calls to methods taking primitive parameters \r
-     * via passing in wrapping classes. So, for example, a <code>Boolean</code> class\r
-     * would match a <code>boolean</code> primitive.</p>\r
-     *\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @param parameterTypes match these parameters - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object[] args,\r
-            Class[] parameterTypes)\r
-                throws\r
-                    NoSuchMethodException,\r
-                    IllegalAccessException,\r
-                    InvocationTargetException {\r
-                    \r
-        if (parameterTypes == null) {\r
-            parameterTypes = EMPTY_CLASS_PARAMETERS;\r
-        }        \r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-\r
-        Method method = getMatchingAccessibleMethod(\r
-                objectClass,\r
-                methodName,\r
-                parameterTypes);\r
-        if (method == null) {\r
-            throw new NoSuchMethodException("No such accessible method: " +\r
-                    methodName + "() on class: " + objectClass.getName());\r
-        }\r
-        return method.invoke(null, args);\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a static method whose parameter type matches exactly the object\r
-     * type.</p>\r
-     *\r
-     * <p> This is a convenient wrapper for\r
-     * {@link #invokeExactStaticMethod(Class objectClass,String methodName,Object [] args)}.\r
-     * </p>\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param arg use this argument\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object arg)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-\r
-        Object[] args = {arg};\r
-        return invokeExactStaticMethod (objectClass, methodName, args);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Invoke a static method whose parameter types match exactly the object\r
-     * types.</p>\r
-     *\r
-     * <p> This uses reflection to invoke the method obtained from a call to\r
-     * {@link #getAccessibleMethod(Class, String, Class[])}.</p>\r
-     *\r
-     * @param objectClass invoke static method on this class\r
-     * @param methodName get method with this name\r
-     * @param args use these arguments - treat null as empty array\r
-     * @return The value returned by the invoked method\r
-     *\r
-     * @throws NoSuchMethodException if there is no such accessible method\r
-     * @throws InvocationTargetException wraps an exception thrown by the\r
-     *  method invoked\r
-     * @throws IllegalAccessException if the requested method is not accessible\r
-     *  via reflection\r
-     */\r
-    public static Object invokeExactStaticMethod(\r
-            Class objectClass,\r
-            String methodName,\r
-            Object[] args)\r
-            throws\r
-            NoSuchMethodException,\r
-            IllegalAccessException,\r
-            InvocationTargetException {\r
-        if (args == null) {\r
-            args = EMPTY_OBJECT_ARRAY;\r
-        }  \r
-        int arguments = args.length;\r
-        Class[] parameterTypes = new Class[arguments];\r
-        for (int i = 0; i < arguments; i++) {\r
-            parameterTypes[i] = args[i].getClass();\r
-        }\r
-        return invokeExactStaticMethod(objectClass, methodName, args, parameterTypes);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) with given name and a single parameter.  If no such method\r
-     * can be found, return <code>null</code>.\r
-     * Basically, a convenience wrapper that constructs a <code>Class</code>\r
-     * array for you.</p>\r
-     *\r
-     * @param clazz get method from this class\r
-     * @param methodName get method with this name\r
-     * @param parameterType taking this type of parameter\r
-     * @return The accessible method\r
-     */\r
-    public static Method getAccessibleMethod(\r
-            Class clazz,\r
-            String methodName,\r
-            Class parameterType) {\r
-\r
-        Class[] parameterTypes = {parameterType};\r
-        return getAccessibleMethod(clazz, methodName, parameterTypes);\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) with given name and parameters.  If no such method\r
-     * can be found, return <code>null</code>.\r
-     * This is just a convenient wrapper for\r
-     * {@link #getAccessibleMethod(Method method)}.</p>\r
-     *\r
-     * @param clazz get method from this class\r
-     * @param methodName get method with this name\r
-     * @param parameterTypes with these parameters types\r
-     * @return The accessible method\r
-     */\r
-    public static Method getAccessibleMethod(\r
-            Class clazz,\r
-            String methodName,\r
-            Class[] parameterTypes) {\r
-\r
-        try {\r
-            MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, true);\r
-            Method method =  getAccessibleMethod\r
-                    (clazz, clazz.getMethod(methodName, parameterTypes));\r
-            return method;\r
-        } catch (NoSuchMethodException e) {\r
-            return (null);\r
-        }\r
-\r
-    }\r
-\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) that implements the specified Method.  If no such method\r
-     * can be found, return <code>null</code>.</p>\r
-     *\r
-     * @param method The method that we wish to call\r
-     * @return The accessible method\r
-     */\r
-    public static Method getAccessibleMethod(Method method) {\r
-\r
-        // Make sure we have a method to check\r
-        if (method == null) {\r
-            return (null);\r
-        }\r
-\r
-        return getAccessibleMethod(method.getDeclaringClass(), method);\r
-\r
-    }\r
-\r
-\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) that implements the specified Method.  If no such method\r
-     * can be found, return <code>null</code>.</p>\r
-     *\r
-     * @param clazz The class of the object\r
-     * @param method The method that we wish to call\r
-     * @return The accessible method\r
-     */\r
-    public static Method getAccessibleMethod(Class clazz, Method method) {\r
-\r
-        // Make sure we have a method to check\r
-        if (method == null) {\r
-            return (null);\r
-        }\r
-\r
-        // If the requested method is not public we cannot call it\r
-        if (!Modifier.isPublic(method.getModifiers())) {\r
-            return (null);\r
-        }\r
-\r
-        boolean sameClass = true;\r
-        if (clazz == null) {\r
-            clazz = method.getDeclaringClass();\r
-        } else {\r
-            sameClass = clazz.equals(method.getDeclaringClass());\r
-            if (!method.getDeclaringClass().isAssignableFrom(clazz)) {\r
-                throw new IllegalArgumentException(clazz.getName() +\r
-                        " is not assignable from " + method.getDeclaringClass().getName());\r
-            }\r
-        }\r
-\r
-        // If the class is public, we are done\r
-        if (Modifier.isPublic(clazz.getModifiers())) {\r
-            if (!sameClass && !Modifier.isPublic(method.getDeclaringClass().getModifiers())) {\r
-                setMethodAccessible(method); // Default access superclass workaround\r
-            }\r
-            return (method);\r
-        }\r
-\r
-        String methodName      = method.getName();\r
-        Class[] parameterTypes = method.getParameterTypes();\r
-\r
-        // Check the implemented interfaces and subinterfaces\r
-        method =\r
-                getAccessibleMethodFromInterfaceNest(clazz,\r
-                        methodName,\r
-                        parameterTypes);\r
-\r
-        // Check the superclass chain\r
-        if (method == null) {\r
-            method = getAccessibleMethodFromSuperclass(clazz,\r
-                        methodName,\r
-                        parameterTypes);\r
-        }\r
-\r
-        return (method);\r
-\r
-    }\r
-\r
-\r
-    // -------------------------------------------------------- Private Methods\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) by scanning through the superclasses. If no such method\r
-     * can be found, return <code>null</code>.</p>\r
-     *\r
-     * @param clazz Class to be checked\r
-     * @param methodName Method name of the method we wish to call\r
-     * @param parameterTypes The parameter type signatures\r
-     */\r
-    private static Method getAccessibleMethodFromSuperclass\r
-            (Class clazz, String methodName, Class[] parameterTypes) {\r
-\r
-        Class parentClazz = clazz.getSuperclass();\r
-        while (parentClazz != null) {\r
-            if (Modifier.isPublic(parentClazz.getModifiers())) {\r
-                try {\r
-                    return parentClazz.getMethod(methodName, parameterTypes);\r
-                } catch (NoSuchMethodException e) {\r
-                    return null;\r
-                }\r
-            }\r
-            parentClazz = parentClazz.getSuperclass();\r
-        }\r
-        return null;\r
-    }\r
-\r
-    /**\r
-     * <p>Return an accessible method (that is, one that can be invoked via\r
-     * reflection) that implements the specified method, by scanning through\r
-     * all implemented interfaces and subinterfaces.  If no such method\r
-     * can be found, return <code>null</code>.</p>\r
-     *\r
-     * <p> There isn't any good reason why this method must be private.\r
-     * It is because there doesn't seem any reason why other classes should\r
-     * call this rather than the higher level methods.</p>\r
-     *\r
-     * @param clazz Parent class for the interfaces to be checked\r
-     * @param methodName Method name of the method we wish to call\r
-     * @param parameterTypes The parameter type signatures\r
-     */\r
-    private static Method getAccessibleMethodFromInterfaceNest\r
-            (Class clazz, String methodName, Class[] parameterTypes) {\r
-\r
-        Method method = null;\r
-\r
-        // Search up the superclass chain\r
-        for (; clazz != null; clazz = clazz.getSuperclass()) {\r
-\r
-            // Check the implemented interfaces of the parent class\r
-            Class[] interfaces = clazz.getInterfaces();\r
-            for (int i = 0; i < interfaces.length; i++) {\r
-\r
-                // Is this interface public?\r
-                if (!Modifier.isPublic(interfaces[i].getModifiers())) {\r
-                    continue;\r
-                }\r
-\r
-                // Does the method exist on this interface?\r
-                try {\r
-                    method = interfaces[i].getDeclaredMethod(methodName,\r
-                            parameterTypes);\r
-                } catch (NoSuchMethodException e) {\r
-                    /* Swallow, if no method is found after the loop then this\r
-                     * method returns null.\r
-                     */\r
-                }\r
-                if (method != null) {\r
-                    return method;\r
-                }\r
-\r
-                // Recursively check our parent interfaces\r
-                method =\r
-                        getAccessibleMethodFromInterfaceNest(interfaces[i],\r
-                                methodName,\r
-                                parameterTypes);\r
-                if (method != null) {\r
-                    return method;\r
-                }\r
-\r
-            }\r
-\r
-        }\r
-\r
-        // If we found a method return it\r
-        if (method != null) {\r
-            return (method);\r
-        }\r
-\r
-        // We did not find anything\r
-        return (null);\r
-\r
-    }\r
-\r
-    /**\r
-     * <p>Find an accessible method that matches the given name and has compatible parameters.\r
-     * Compatible parameters mean that every method parameter is assignable from \r
-     * the given parameters.\r
-     * In other words, it finds a method with the given name \r
-     * that will take the parameters given.<p>\r
-     *\r
-     * <p>This method is slightly undeterminstic since it loops \r
-     * through methods names and return the first matching method.</p>\r
-     * \r
-     * <p>This method is used by \r
-     * {@link \r
-     * #invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)}.\r
-     *\r
-     * <p>This method can match primitive parameter by passing in wrapper classes.\r
-     * For example, a <code>Boolean</code> will match a primitive <code>boolean</code>\r
-     * parameter.\r
-     *\r
-     * @param clazz find method in this class\r
-     * @param methodName find method with this name\r
-     * @param parameterTypes find method with compatible parameters \r
-     * @return The accessible method\r
-     */\r
-    public static Method getMatchingAccessibleMethod(\r
-                                                Class clazz,\r
-                                                String methodName,\r
-                                                Class[] parameterTypes) {\r
-        // trace logging\r
-        Log log = LogFactory.getLog(MethodUtils.class);\r
-        if (log.isTraceEnabled()) {\r
-            log.trace("Matching name=" + methodName + " on " + clazz);\r
-        }\r
-        MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, false);\r
-        \r
-        // see if we can find the method directly\r
-        // most of the time this works and it's much faster\r
-        try {\r
-            Method method = clazz.getMethod(methodName, parameterTypes);\r
-            if (log.isTraceEnabled()) {\r
-                log.trace("Found straight match: " + method);\r
-                log.trace("isPublic:" + Modifier.isPublic(method.getModifiers()));\r
-            }\r
-            \r
-            setMethodAccessible(method); // Default access superclass workaround\r
-\r
-            return method;\r
-            \r
-        } catch (NoSuchMethodException e) { /* SWALLOW */ }\r
-        \r
-        // search through all methods \r
-        int paramSize = parameterTypes.length;\r
-        Method bestMatch = null;\r
-        Method[] methods = clazz.getMethods();\r
-        float bestMatchCost = Float.MAX_VALUE;\r
-        float myCost = Float.MAX_VALUE;\r
-        for (int i = 0, size = methods.length; i < size ; i++) {\r
-            if (methods[i].getName().equals(methodName)) {\r
-                // log some trace information\r
-                if (log.isTraceEnabled()) {\r
-                    log.trace("Found matching name:");\r
-                    log.trace(methods[i]);\r
-                }                \r
-                \r
-                // compare parameters\r
-                Class[] methodsParams = methods[i].getParameterTypes();\r
-                int methodParamSize = methodsParams.length;\r
-                if (methodParamSize == paramSize) {          \r
-                    boolean match = true;\r
-                    for (int n = 0 ; n < methodParamSize; n++) {\r
-                        if (log.isTraceEnabled()) {\r
-                            log.trace("Param=" + parameterTypes[n].getName());\r
-                            log.trace("Method=" + methodsParams[n].getName());\r
-                        }\r
-                        if (!isAssignmentCompatible(methodsParams[n], parameterTypes[n])) {\r
-                            if (log.isTraceEnabled()) {\r
-                                log.trace(methodsParams[n] + " is not assignable from " \r
-                                            + parameterTypes[n]);\r
-                            }    \r
-                            match = false;\r
-                            break;\r
-                        }\r
-                    }\r
-                    \r
-                    if (match) {\r
-                        // get accessible version of method\r
-                        Method method = getAccessibleMethod(clazz, methods[i]);\r
-                        if (method != null) {\r
-                            if (log.isTraceEnabled()) {\r
-                                log.trace(method + " accessible version of " \r
-                                            + methods[i]);\r
-                            }\r
-                            setMethodAccessible(method); // Default access superclass workaround\r
-                            myCost = getTotalTransformationCost(parameterTypes,method.getParameterTypes());\r
-                            if ( myCost < bestMatchCost ) {\r
-                               bestMatch = method;\r
-                               bestMatchCost = myCost;\r
-                            }\r
-                        }\r
-                        \r
-                        log.trace("Couldn't find accessible method.");\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if ( bestMatch == null ){\r
-            // didn't find a match\r
-               log.trace("No match found.");\r
-        }\r
-        \r
-        return bestMatch;                                        \r
-    }\r
-\r
-    public static <T> Constructor<T> getMatchingAccessibleConstructor(\r
-                                                Class<T> clazz,\r
-                                                Class[] parameterTypes) {\r
-        // trace logging\r
-        Log log = LogFactory.getLog(MethodUtils.class);\r
-        MethodDescriptor md = new MethodDescriptor(clazz, "dummy", parameterTypes, false);\r
-        \r
-        // see if we can find the method directly\r
-        // most of the time this works and it's much faster\r
-        try {\r
-            Constructor<T> constructor = clazz.getConstructor(parameterTypes);\r
-            if (log.isTraceEnabled()) {\r
-                log.trace("Found straight match: " + constructor);\r
-                log.trace("isPublic:" + Modifier.isPublic(constructor.getModifiers()));\r
-            }\r
-            \r
-            setMethodAccessible(constructor); // Default access superclass workaround\r
-\r
-            return constructor;\r
-            \r
-        } catch (NoSuchMethodException e) { /* SWALLOW */ }\r
-        \r
-        // search through all methods \r
-        int paramSize = parameterTypes.length;\r
-        Constructor<T> bestMatch = null;\r
-        Constructor<?>[] constructors = clazz.getConstructors();\r
-        float bestMatchCost = Float.MAX_VALUE;\r
-        float myCost = Float.MAX_VALUE;\r
-        for (int i = 0, size = constructors.length; i < size ; i++) {\r
-            // compare parameters\r
-            Class[] methodsParams = constructors[i].getParameterTypes();\r
-            int methodParamSize = methodsParams.length;\r
-            if (methodParamSize == paramSize) {          \r
-                boolean match = true;\r
-                for (int n = 0 ; n < methodParamSize; n++) {\r
-                    if (log.isTraceEnabled()) {\r
-                        log.trace("Param=" + parameterTypes[n].getName());\r
-                        log.trace("Method=" + methodsParams[n].getName());\r
-                    }\r
-                    if (!isAssignmentCompatible(methodsParams[n], parameterTypes[n])) {\r
-                        if (log.isTraceEnabled()) {\r
-                            log.trace(methodsParams[n] + " is not assignable from " \r
-                                        + parameterTypes[n]);\r
-                        }    \r
-                        match = false;\r
-                        break;\r
-                    }\r
-                }\r
-                \r
-                if (match) {\r
-                    // get accessible version of method\r
-                    Constructor<T> cons = (Constructor<T>)constructors[i];\r
-                    myCost = getTotalTransformationCost(parameterTypes,cons.getParameterTypes());\r
-                    if ( myCost < bestMatchCost ) {\r
-                       bestMatch = cons;\r
-                       bestMatchCost = myCost;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if ( bestMatch == null ){\r
-            // didn't find a match\r
-               log.trace("No match found.");\r
-        }\r
-        \r
-        return bestMatch;                                        \r
-    }\r
-\r
-    /**\r
-     * Try to make the method accessible\r
-     * @param method The source arguments\r
-     */\r
-    private static void setMethodAccessible(Object method) {\r
-        try {\r
-            //\r
-            // XXX Default access superclass workaround\r
-            //\r
-            // When a public class has a default access superclass\r
-            // with public methods, these methods are accessible.\r
-            // Calling them from compiled code works fine.\r
-            //\r
-            // Unfortunately, using reflection to invoke these methods\r
-            // seems to (wrongly) to prevent access even when the method\r
-            // modifer is public.\r
-            //\r
-            // The following workaround solves the problem but will only\r
-            // work from sufficiently privilages code. \r
-            //\r
-            // Better workarounds would be greatfully accepted.\r
-            //\r
-            if (method instanceof Method) {\r
-                ((Method)method).setAccessible(true);\r
-            } else if (method instanceof Constructor) {\r
-                ((Constructor)method).setAccessible(true);\r
-            } else {\r
-                throw new RuntimeException("invalid parameter");\r
-            }\r
-            \r
-        } catch (SecurityException se) {\r
-            // log but continue just in case the method.invoke works anyway\r
-            Log log = LogFactory.getLog(MethodUtils.class);\r
-            if (!loggedAccessibleWarning) {\r
-                boolean vulnerableJVM = false;\r
-                try {\r
-                    String specVersion = System.getProperty("java.specification.version");\r
-                    if (specVersion.charAt(0) == '1' && \r
-                            (specVersion.charAt(2) == '0' ||\r
-                             specVersion.charAt(2) == '1' ||\r
-                             specVersion.charAt(2) == '2' ||\r
-                             specVersion.charAt(2) == '3')) {\r
-                             \r
-                        vulnerableJVM = true;\r
-                    }\r
-                } catch (SecurityException e) {\r
-                    // don't know - so display warning\r
-                    vulnerableJVM = true;\r
-                }\r
-                if (vulnerableJVM) {\r
-                    log.warn(\r
-                        "Current Security Manager restricts use of workarounds for reflection bugs "\r
-                        + " in pre-1.4 JVMs.");\r
-                }\r
-                loggedAccessibleWarning = true;\r
-            }\r
-            log.debug("Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.", se);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Returns the sum of the object transformation cost for each class in the source\r
-     * argument list.\r
-     * @param srcArgs The source arguments\r
-     * @param destArgs The destination arguments\r
-     * @return The total transformation cost\r
-     */\r
-    private static float getTotalTransformationCost(Class[] srcArgs, Class[] destArgs) {\r
-\r
-        float totalCost = 0.0f;\r
-        for (int i = 0; i < srcArgs.length; i++) {\r
-            Class srcClass, destClass;\r
-            srcClass = srcArgs[i];\r
-            destClass = destArgs[i];\r
-            totalCost += getObjectTransformationCost(srcClass, destClass);\r
-        }\r
-\r
-        return totalCost;\r
-    }\r
-    \r
-    /**\r
-     * Gets the number of steps required needed to turn the source class into the \r
-     * destination class. This represents the number of steps in the object hierarchy \r
-     * graph.\r
-     * @param srcClass The source class\r
-     * @param destClass The destination class\r
-     * @return The cost of transforming an object\r
-     */\r
-    private static float getObjectTransformationCost(Class srcClass, Class destClass) {\r
-        float cost = 0.0f;\r
-        while (destClass != null && !destClass.equals(srcClass)) {\r
-            if (destClass.isInterface() && isAssignmentCompatible(destClass,srcClass)) {\r
-                // slight penalty for interface match. \r
-                // we still want an exact match to override an interface match, but  \r
-                // an interface match should override anything where we have to get a \r
-                // superclass.\r
-                cost += 0.25f;\r
-                break;\r
-            }\r
-            cost++;\r
-            destClass = destClass.getSuperclass();\r
-        }\r
-\r
-        /*\r
-         * If the destination class is null, we've travelled all the way up to \r
-         * an Object match. We'll penalize this by adding 1.5 to the cost.\r
-         */\r
-        if (destClass == null) {\r
-            cost += 1.5f;\r
-        }\r
-\r
-        return cost;\r
-    }\r
-    \r
-    \r
-    /**\r
-     * <p>Determine whether a type can be used as a parameter in a method invocation.\r
-     * This method handles primitive conversions correctly.</p>\r
-     *\r
-     * <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>,\r
-     * a <code>Long</code> to a <code>long</code>,\r
-     * a <code>Float</code> to a <code>float</code>,\r
-     * a <code>Integer</code> to a <code>int</code>,\r
-     * and a <code>Double</code> to a <code>double</code>.\r
-     * Now logic widening matches are allowed.\r
-     * For example, a <code>Long</code> will not match a <code>int</code>.\r
-     *\r
-     * @param parameterType the type of parameter accepted by the method\r
-     * @param parameterization the type of parameter being tested \r
-     *\r
-     * @return true if the assignement is compatible.\r
-     */\r
-    public static final boolean isAssignmentCompatible(Class parameterType, Class parameterization) {\r
-        // try plain assignment\r
-        if (parameterType.isAssignableFrom(parameterization)) {\r
-            return true;\r
-        }\r
-        \r
-        if (parameterType.isPrimitive()) {\r
-            // this method does *not* do widening - you must specify exactly\r
-            // is this the right behaviour?\r
-            Class parameterWrapperClazz = getPrimitiveWrapper(parameterType);\r
-            if (parameterWrapperClazz != null) {\r
-                return parameterWrapperClazz.equals(parameterization);\r
-            }\r
-        }\r
-        \r
-        return false;\r
-    }\r
-    \r
-    /**\r
-     * Gets the wrapper object class for the given primitive type class.\r
-     * For example, passing <code>boolean.class</code> returns <code>Boolean.class</code>\r
-     * @param primitiveType the primitive type class for which a match is to be found\r
-     * @return the wrapper type associated with the given primitive \r
-     * or null if no match is found\r
-     */\r
-    public static Class getPrimitiveWrapper(Class primitiveType) {\r
-        // does anyone know a better strategy than comparing names?\r
-        if (boolean.class.equals(primitiveType)) {\r
-            return Boolean.class;\r
-        } else if (float.class.equals(primitiveType)) {\r
-            return Float.class;\r
-        } else if (long.class.equals(primitiveType)) {\r
-            return Long.class;\r
-        } else if (int.class.equals(primitiveType)) {\r
-            return Integer.class;\r
-        } else if (short.class.equals(primitiveType)) {\r
-            return Short.class;\r
-        } else if (byte.class.equals(primitiveType)) {\r
-            return Byte.class;\r
-        } else if (double.class.equals(primitiveType)) {\r
-            return Double.class;\r
-        } else if (char.class.equals(primitiveType)) {\r
-            return Character.class;\r
-        } else {\r
-            \r
-            return null;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Gets the class for the primitive type corresponding to the primitive wrapper class given.\r
-     * For example, an instance of <code>Boolean.class</code> returns a <code>boolean.class</code>. \r
-     * @param wrapperType the \r
-     * @return the primitive type class corresponding to the given wrapper class,\r
-     * null if no match is found\r
-     */\r
-    public static Class getPrimitiveType(Class wrapperType) {\r
-        // does anyone know a better strategy than comparing names?\r
-        if (Boolean.class.equals(wrapperType)) {\r
-            return boolean.class;\r
-        } else if (Float.class.equals(wrapperType)) {\r
-            return float.class;\r
-        } else if (Long.class.equals(wrapperType)) {\r
-            return long.class;\r
-        } else if (Integer.class.equals(wrapperType)) {\r
-            return int.class;\r
-        } else if (Short.class.equals(wrapperType)) {\r
-            return short.class;\r
-        } else if (Byte.class.equals(wrapperType)) {\r
-            return byte.class;\r
-        } else if (Double.class.equals(wrapperType)) {\r
-            return double.class;\r
-        } else if (Character.class.equals(wrapperType)) {\r
-            return char.class;\r
-        } else {\r
-            Log log = LogFactory.getLog(MethodUtils.class);\r
-            if (log.isDebugEnabled()) {\r
-                log.debug("Not a known primitive wrapper class: " + wrapperType);\r
-            }\r
-            return null;\r
-        }\r
-    }\r
-    \r
-    /**\r
-     * Find a non primitive representation for given primitive class.\r
-     *\r
-     * @param clazz the class to find a representation for, not null\r
-     * @return the original class if it not a primitive. Otherwise the wrapper class. Not null\r
-     */\r
-    public static Class toNonPrimitiveClass(Class clazz) {\r
-        if (clazz.isPrimitive()) {\r
-            Class primitiveClazz = MethodUtils.getPrimitiveWrapper(clazz);\r
-            // the above method returns \r
-            if (primitiveClazz != null) {\r
-                return primitiveClazz;\r
-            } else {\r
-                return clazz;\r
-            }\r
-        } else {\r
-            return clazz;\r
-        }\r
-    }\r
-    \r
-\r
-    /**\r
-     * Represents the key to looking up a Method by reflection.\r
-     */\r
-    private static class MethodDescriptor {\r
-        private Class cls;\r
-        private String methodName;\r
-        private Class[] paramTypes;\r
-        private boolean exact;\r
-        private int hashCode;\r
-\r
-        /**\r
-         * The sole constructor.\r
-         *\r
-         * @param cls  the class to reflect, must not be null\r
-         * @param methodName  the method name to obtain\r
-         * @param paramTypes the array of classes representing the paramater types\r
-         * @param exact whether the match has to be exact.\r
-         */\r
-        public MethodDescriptor(Class cls, String methodName, Class[] paramTypes, boolean exact) {\r
-            if (cls == null) {\r
-                throw new IllegalArgumentException("Class cannot be null");\r
-            }\r
-            if (methodName == null) {\r
-                throw new IllegalArgumentException("Method Name cannot be null");\r
-            }\r
-            if (paramTypes == null) {\r
-                paramTypes = EMPTY_CLASS_PARAMETERS;\r
-            }\r
-\r
-            this.cls = cls;\r
-            this.methodName = methodName;\r
-            this.paramTypes = paramTypes;\r
-            this.exact= exact;\r
-\r
-            this.hashCode = methodName.length();\r
-        }\r
-        /**\r
-         * Checks for equality.\r
-         * @param obj object to be tested for equality\r
-         * @return true, if the object describes the same Method.\r
-         */\r
-        public boolean equals(Object obj) {\r
-            if (!(obj instanceof MethodDescriptor)) {\r
-                return false;\r
-            }\r
-            MethodDescriptor md = (MethodDescriptor)obj;\r
-\r
-            return (\r
-                exact == md.exact &&\r
-                methodName.equals(md.methodName) &&\r
-                cls.equals(md.cls) &&\r
-                java.util.Arrays.equals(paramTypes, md.paramTypes)\r
-            );\r
-        }\r
-        /**\r
-         * Returns the string length of method name. I.e. if the\r
-         * hashcodes are different, the objects are different. If the\r
-         * hashcodes are the same, need to use the equals method to\r
-         * determine equality.\r
-         * @return the string length of method name.\r
-         */\r
-        public int hashCode() {\r
-            return hashCode;\r
-        }\r
-    }\r
-}\r
index 7a831b75f6203bb425abbaa31f4e2634cea17130..1a88b0930054b998c39bf5775e6842e34e0af2d3 100644 (file)
@@ -187,7 +187,7 @@ public final class XmlSort
      * The constructor accepts an argument indicating whether the comparison order is the same as\r
      * the lexicographic order of the strings or the reverse.\r
      */\r
-    public static final class QNameComparator implements Comparator\r
+    public static final class QNameComparator implements Comparator<XmlCursor>\r
     {\r
         public static final int ASCENDING = 1;\r
         public static final int DESCENDING = 2;\r
@@ -202,10 +202,7 @@ public final class XmlSort
                     "comparison orders");\r
         }\r
 \r
-        public int compare(Object o, Object o1)\r
-        {\r
-            XmlCursor cursor1 = (XmlCursor) o;\r
-            XmlCursor cursor2 = (XmlCursor) o1;\r
+        public int compare(XmlCursor cursor1, XmlCursor cursor2) {\r
             QName qname1 = cursor1.getName();\r
             QName qname2 = cursor2.getName();\r
             int qnameComparisonRes = qname1.getNamespaceURI().compareTo(qname2.getNamespaceURI());\r
index b894cd080df28c39bc29beeb77ce32cbbc4aeed9..e5362c4d23d6461461d066aa4ead33db1588985e 100644 (file)
@@ -21,7 +21,6 @@ package org.apache.poi.xslf.usermodel;
 \r
 import org.apache.poi.sl.usermodel.ConnectorShape;\r
 import org.apache.poi.util.Beta;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;\r
 import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;\r
 import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;\r
 import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;\r
@@ -44,7 +43,6 @@ public class XSLFConnectorShape extends XSLFSimpleShape implements ConnectorShap
     /**\r
      * @param shapeId 1-based shapeId\r
      */\r
-    @SuppressWarnings("unused")\r
     static CTConnector prototype(int shapeId) {\r
         CTConnector ct = CTConnector.Factory.newInstance();\r
         CTConnectorNonVisual nvSpPr = ct.addNewNvCxnSpPr();\r
@@ -57,7 +55,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape implements ConnectorShap
         CTPresetGeometry2D prst = spPr.addNewPrstGeom();\r
         prst.setPrst(STShapeType.LINE);\r
         prst.addNewAvLst();\r
-        CTLineProperties ln = spPr.addNewLn();\r
+        /* CTLineProperties ln = */ spPr.addNewLn();\r
         return ct;\r
     }\r
 \r
index 26327389187fd2be48525914ce36eca863b0d939..f26f3eb50b7c67f33cc4116684eb40c2b7a09c9b 100644 (file)
@@ -23,7 +23,12 @@ import javax.xml.namespace.QName;
 
 import org.apache.poi.util.Internal;
 import org.apache.xmlbeans.XmlCursor;
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
 import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrame;
 import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrameNonVisual;
 import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
@@ -79,7 +84,7 @@ public final class XSSFGraphicFrame extends XSSFShape {
                        offPoint.setX(0);
                        offPoint.setY(0);
 
-                       CTGraphicalObject graphic = graphicFrame.addNewGraphic();
+                       /* CTGraphicalObject graphic = */ graphicFrame.addNewGraphic();
 
                        prototype = graphicFrame;
                }
index 09d6d6b047ea83d237d6d149761b1cfc4e28680a..1efe14447af031b3a1f1a3bc66ec8398f435a01e 100644 (file)
@@ -94,7 +94,6 @@ public final class NewOleFile extends RandomAccessFile
         int counter = 0;
         for(int x = 0; x < _num_bbd_blocks; x++)
         {
-            byte[] bigBlock = new byte[512];
             int offset = (_bbd_list[x] + 1) * 512;
             seek(offset);
             for(int y = 0; y < 128; y++)
@@ -107,17 +106,12 @@ public final class NewOleFile extends RandomAccessFile
         initializePropertySets(rootChain);
 
     }
-    @SuppressWarnings("unused")
-    public static void main(String args[])
-    {
-      try
-      {
-          NewOleFile file = new NewOleFile(args[0], "r");
-      }
-      catch(Exception e)
-      {
-      }
+
+    public static void main(String args[]) throws Exception {
+        NewOleFile nof = new NewOleFile(args[0], "r");
+        nof.close();
     }
+    
     protected int[] readChain(int[] blockChain, int startBlock) {
 
         int[] tempChain = new int[blockChain.length];
index ff5330032172e97f03da004178ebd9934697ce45..2c0c11c61c5c9ab5004ef03f6dfed9d1ff508cab 100644 (file)
@@ -784,7 +784,6 @@ public final class WordDocument {
 
     return context.getFontMetrics(font);
   }*/
-  @SuppressWarnings("unused")
   private String createRegion(boolean before, HeaderFooter header, SEP sep, String name)
   {
     if(header.isEmpty())
@@ -820,8 +819,8 @@ public final class WordDocument {
       sep._dyaBottom = Math.max(extent*20, sep._dyaBottom);
     }
 
-    int marginLeft = sep._dxaLeft/20;
-    int marginRight = sep._dxaRight/20;
+    //int marginLeft = sep._dxaLeft/20;
+    //int marginRight = sep._dxaRight/20;
 
     return "<fo:region-" + where + " display-align=\"" + align + "\" extent=\""
              + extent + "pt\" "+region+"/>";
index 3a09d7614630030d73d86ce9f075ad3f6502eeec..1f7765c23496b1bf6b29816020b8c48d68b59aec 100644 (file)
@@ -33,11 +33,11 @@ public final class HDFDocument
   public HDFDocument(InputStream in, HDFParsingListener listener) throws IOException
   {
     EventBridge eb = new EventBridge(listener);
-    HDFObjectFactory factory = new HDFObjectFactory(in, eb);
+    /* HDFObjectFactory factory = */ new HDFObjectFactory(in, eb);
   }
   public HDFDocument(InputStream in) throws IOException
   {
     _model = new HDFObjectModel();
-    HDFObjectFactory factory = new HDFObjectFactory(in, _model);
+    /* HDFObjectFactory factory = */ new HDFObjectFactory(in, _model);
   }
 }
index ce9dcb39760a77406120d65c81bf44e0caf47b22..4ff9f60d5785c0a8999b7c532c7dd88615740401 100644 (file)
@@ -68,19 +68,10 @@ public final class HDFObjectFactory {
     byte[] _tableBuffer;
 
 
-    @SuppressWarnings("unused")
-    public static void main(String args[])
-    {
-      try
-      {
-        HDFObjectFactory f = new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
-        int k = 0;
-      }
-      catch(Exception t)
-      {
-        t.printStackTrace();
-      }
+    public static void main(String args[]) throws Exception {
+        new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
     }
+    
     /** Creates a new instance of HDFObjectFactory
      *
      * @param istream The InputStream that is the Word document
@@ -133,19 +124,23 @@ public final class HDFObjectFactory {
         List<FileInformationBlock> results = new ArrayList<FileInformationBlock>(1);
 
         //do Ole stuff
-        POIFSFileSystem filesystem = new POIFSFileSystem(istream);
-
-        DocumentEntry headerProps =
-            (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
-
-        byte[] mainDocument = new byte[headerProps.getSize()];
-        filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
-
-        FileInformationBlock fib = new FileInformationBlock(mainDocument);
-
-
-        results.add(fib);
-        return results;
+        POIFSFileSystem filesystem = null;
+        try {
+            filesystem = new POIFSFileSystem(istream);
+            DocumentEntry headerProps =
+                (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
+    
+            byte[] mainDocument = new byte[headerProps.getSize()];
+            filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
+    
+            FileInformationBlock fib = new FileInformationBlock(mainDocument);
+    
+    
+            results.add(fib);
+            return results;
+        } finally {
+            if (filesystem != null) filesystem.close();
+        }
     }
 
 
@@ -477,7 +472,7 @@ public final class HDFObjectFactory {
     {
 
       int ccpText = _fib.getCcpText();
-      int ccpFtn = _fib.getCcpFtn();
+      // int ccpFtn = _fib.getCcpFtn();
 
       //sections
       int fcMin = _fib.getFcMin();
index 9ddb2da82fc3b052b70a64fc67bd230e16a8fbdc..c4a935d252d821307270d195666fc1b40299790d 100644 (file)
@@ -329,15 +329,14 @@ public final class StyleSheet implements HDFType {
                newCHP.setIco((byte)0);
                break;
           case 0x33:
-               try
-               {
-                   newCHP = (CharacterProperties)oldCHP.clone();
-               }
-               catch(CloneNotSupportedException e)
-               {
-                   //do nothing
-               }
-               return;
+               // ... this code has no effect ...
+               //  try {
+               //      newCHP = (CharacterProperties)oldCHP.clone();
+               //  }
+               //  catch(CloneNotSupportedException e) {
+               //      //do nothing
+               //  }
+              break;
           case 0x34:
                break;
           case 0x35:
index 2d8ad8e839aa989ab06afbb0cbe8377b41d60686..ad38755a0facdddf5ccfe00a7e8bfaab9ea94ba0 100644 (file)
@@ -73,8 +73,7 @@ public final class CompressedRTF extends LZWDecompresser {
       compressedSize = LittleEndian.readInt(src);
       decompressedSize = LittleEndian.readInt(src);
       int compressionType = LittleEndian.readInt(src);
-      @SuppressWarnings("unused")
-      int dataCRC = LittleEndian.readInt(src);
+      /* int dataCRC = */ LittleEndian.readInt(src);
       
       // TODO - Handle CRC checking on the output side
       
index c1deea84416f7e2a1541647d596fa7d823b157f0..4af64ecb4cf99955f3987ba804e5bda6c4b7eecf 100644 (file)
@@ -301,11 +301,8 @@ public final class HSLFSlideShow implements SlideShow {
                // Slides or Notes, and possibly even other odd stuff....
                // About the only thing you can say is that the master details are in
                // the first SLWT.
-               SlideAtomsSet[] masterSets = new SlideAtomsSet[0];
                if (masterSLWT != null) {
-                       masterSets = masterSLWT.getSlideAtomsSets();
-
-                       for (SlideAtomsSet sas : masterSets) {
+                       for (SlideAtomsSet sas : masterSLWT.getSlideAtomsSets()) {
                                Record r = getCoreRecordForSAS(sas);
                                int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
                                if (r instanceof org.apache.poi.hslf.record.Slide) {
@@ -327,27 +324,27 @@ public final class HSLFSlideShow implements SlideShow {
                // Start by finding the notes records to go with the entries in
                // notesSLWT
                org.apache.poi.hslf.record.Notes[] notesRecords;
-               SlideAtomsSet[] notesSets = new SlideAtomsSet[0];
                Map<Integer,Integer> slideIdToNotes = new HashMap<Integer,Integer>();
                if (notesSLWT == null) {
                        // None
                        notesRecords = new org.apache.poi.hslf.record.Notes[0];
                } else {
                        // Match up the records and the SlideAtomSets
-                       notesSets = notesSLWT.getSlideAtomsSets();
                        List<org.apache.poi.hslf.record.Notes> notesRecordsL = 
                           new ArrayList<org.apache.poi.hslf.record.Notes>();
-                       for (int i = 0; i < notesSets.length; i++) {
+                       int idx = -1;
+                       for (SlideAtomsSet notesSet : notesSLWT.getSlideAtomsSets()) {
+                           idx++;
                                // Get the right core record
-                               Record r = getCoreRecordForSAS(notesSets[i]);
+                               Record r = getCoreRecordForSAS(notesSet);
+                SlidePersistAtom spa = notesSet.getSlidePersistAtom();
 
+                               String loggerLoc = "A Notes SlideAtomSet at "+idx+" said its record was at refID "+spa.getRefID();
+                                       
                                // Ensure it really is a notes record
                                if (r == null || r instanceof org.apache.poi.hslf.record.Notes) {
                                    if (r == null) {
-                           logger.log(POILogger.WARN, "A Notes SlideAtomSet at " + i
-                                   + " said its record was at refID "
-                                   + notesSets[i].getSlidePersistAtom().getRefID()
-                                   + ", but that record didn't exist - record ignored.");
+                           logger.log(POILogger.WARN, loggerLoc+", but that record didn't exist - record ignored.");
                                    }
                                    // we need to add also null-records, otherwise the index references to other existing
                                    // don't work anymore
@@ -355,14 +352,10 @@ public final class HSLFSlideShow implements SlideShow {
                                        notesRecordsL.add(notesRecord);
 
                                        // Record the match between slide id and these notes
-                                       SlidePersistAtom spa = notesSets[i].getSlidePersistAtom();
                                        int slideId = spa.getSlideIdentifier();
-                                       slideIdToNotes.put(slideId, i);
+                                       slideIdToNotes.put(slideId, idx);
                                } else {
-                                       logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i
-                                                       + " said its record was at refID "
-                                                       + notesSets[i].getSlidePersistAtom().getRefID()
-                                                       + ", but that was actually a " + r);
+                                       logger.log(POILogger.ERROR, loggerLoc+", but that was actually a " + r);
                                }
                        }
                        notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
index 30397bfab82e33d11b1741504d7b352d51ad1f78..99aa8c645fd932dcb656575204f4ebf3d43f17ae 100644 (file)
@@ -221,7 +221,7 @@ public class HSLFSlideShowEncrypted {
                 cipher.doFinal(pictstream, offset, 8, pictstream, offset);
                 recInst = fieldRecInst.getValue(LittleEndian.getUShort(pictstream, offset));
                 recType = LittleEndian.getUShort(pictstream, offset+2);
-                rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
+                // rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
                 offset += 8;
             }
 
@@ -299,7 +299,7 @@ public class HSLFSlideShowEncrypted {
                 // update header data
                 recInst = fieldRecInst.getValue(LittleEndian.getUShort(pictstream, offset));
                 recType = LittleEndian.getUShort(pictstream, offset+2);
-                rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
+                // rlen = (int) LittleEndian.getUInt(pictstream, offset+4);
                 cipher.doFinal(pictstream, offset, 8, pictstream, offset);
                 offset += 8;
             }
index 529d73316395ad38d553645355f4bfd885ed5ef5..961c234102f4e60eff376b9f0bab93198fb1d3ce 100644 (file)
@@ -752,10 +752,10 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFTextRun> {
 \r
         RecordContainer _txtbox = headerAtom.getParentRecord();\r
         Record[] cr = _txtbox.getChildRecords();\r
-        int headerIdx = -1, textIdx = -1, styleIdx = -1;\r
+        int /* headerIdx = -1, */ textIdx = -1, styleIdx = -1;\r
         for (int i = 0; i < cr.length; i++) {\r
             Record r = cr[i];\r
-            if (r == headerAtom) headerIdx = i;\r
+            if (r == headerAtom) ; // headerIdx = i;\r
             else if (r == oldRecord || r == newRecord) textIdx = i;\r
             else if (r == styleAtom) styleIdx = i;\r
         }\r
@@ -763,7 +763,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFTextRun> {
         if (textIdx == -1) {\r
             // the old record was never registered, ignore it\r
             _txtbox.addChildAfter(newRecord, headerAtom);\r
-            textIdx = headerIdx + 1;\r
+            // textIdx = headerIdx + 1;\r
         } else {\r
             // swap not appropriated records - noop if unchanged\r
             cr[textIdx] = newRecord;\r
index 8669878ff89f3de70e9c4d0b4859de04ad9ab4b2..076c15f2b01dae585a8b8fb73e200b4099571835 100644 (file)
@@ -112,7 +112,7 @@ public abstract class PropertiesChunk extends Chunk {
            return null;
        }
        if (val instanceof ChunkBasedPropertyValue) {
-           ChunkBasedPropertyValue cval = (ChunkBasedPropertyValue)val;
+           // ChunkBasedPropertyValue cval = (ChunkBasedPropertyValue)val;
            // TODO Lookup
            return Collections.emptyList();
        } else {
index 8aef34b2143989b4a550e7a96362623a2d6f05cb..19f7b841857c1299bb899642997a757e832eac5f 100644 (file)
@@ -347,7 +347,7 @@ public final class HWPFDocument extends HWPFDocumentCore
     _ft = new FontTable(_tableStream, _fib.getFcSttbfffn(), _fib.getLcbSttbfffn());
 
         int listOffset = _fib.getFcPlfLst();
-        int lfoOffset = _fib.getFcPlfLfo();
+        // int lfoOffset = _fib.getFcPlfLfo();
         if ( listOffset != 0 && _fib.getLcbPlfLst() != 0 )
         {
             _lt = new ListTables( _tableStream, listOffset, _fib.getFcPlfLfo(),
index a070c4a991d8aca1e536e74a6390ba16469973b0..25b8a8700eb226623f6f6e33cb5cca734a64f17d 100644 (file)
@@ -40,8 +40,8 @@ public final class StyleDescription implements HDFType
     
   private final static int PARAGRAPH_STYLE = 1;
   private final static int CHARACTER_STYLE = 2;
-  private final static int TABLE_STYLE = 3;
-  private final static int NUMBERING_STYLE = 4;
+  // private final static int TABLE_STYLE = 3;
+  // private final static int NUMBERING_STYLE = 4;
 
   private int _baseLength;
   private StdfBase _stdfBase;
@@ -86,7 +86,7 @@ public final class StyleDescription implements HDFType
         if ( readStdfPost2000 )
         {
             _stdfPost2000 = new StdfPost2000( std, offset );
-            offset += StdfPost2000.getSize();
+            // offset += StdfPost2000.getSize();
         }
 
       //first byte(s) of variable length section of std is the length of the
index ba213b7a4e477181db205ed6718700699ca89498..f8ec76b674e6bae1bafe7409b010fbb30b9bcb50 100644 (file)
@@ -42,10 +42,10 @@ import org.apache.poi.util.LittleEndian;
 public final class StyleSheet implements HDFType {
 
   public static final int NIL_STYLE = 4095;
-  private static final int PAP_TYPE = 1;
-  private static final int CHP_TYPE = 2;
-  private static final int SEP_TYPE = 4;
-  private static final int TAP_TYPE = 5;
+//  private static final int PAP_TYPE = 1;
+//  private static final int CHP_TYPE = 2;
+//  private static final int SEP_TYPE = 4;
+//  private static final int TAP_TYPE = 5;
 
     @Deprecated
     private final static ParagraphProperties NIL_PAP = new ParagraphProperties();
@@ -144,7 +144,7 @@ public final class StyleSheet implements HDFType {
 
     _stshif.setCstd( _styleDescriptions.length );
     _stshif.serialize( buf, offset );
-    offset += Stshif.getSize();
+    // offset += Stshif.getSize();
 
     out.write(buf);
 
@@ -156,7 +156,7 @@ public final class StyleSheet implements HDFType {
           byte[] std = _styleDescriptions[x].toByteArray();
 
           // adjust the size so it is always on a word boundary
-          LittleEndian.putShort(sizeHolder, (short)((std.length) + (std.length % 2)));
+          LittleEndian.putShort(sizeHolder, 0, (short)((std.length) + (std.length % 2)));
           out.write(sizeHolder);
           out.write(std);