poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1751007 - in /poi/trunk/src: java/org/apache/poi/poifs/filesystem/ java/org/apache/poi/poifs/nio/ java/org/apache/poi/poifs/storage/ java/org/apache/poi/ss/formula/ java/org/apache/poi/ss/usermodel/charts/ java/org/apache/poi/ss/util/ java...
Date Fri, 01 Jul 2016 21:10:40 GMT
Author: kiwiwings
Date: Fri Jul  1 21:10:40 2016
New Revision: 1751007

URL: http://svn.apache.org/viewvc?rev=1751007&view=rev
Log:
sonar fixes

Modified:
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
    poi/trunk/src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java
    poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java
    poi/trunk/src/java/org/apache/poi/ss/util/SSCellRange.java
    poi/trunk/src/java/org/apache/poi/ss/util/SheetBuilder.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java
    poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java
    poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java Fri Jul  1 21:10:40
2016
@@ -393,6 +393,6 @@ public class Ole10Native {
     }
 
     public void setDataBuffer(byte dataBuffer[]) {
-        this.dataBuffer = dataBuffer;
+        this.dataBuffer = dataBuffer.clone();
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java Fri Jul  1
21:10:40 2016
@@ -28,7 +28,7 @@ public class ByteArrayBackedDataSource e
    private byte[] buffer;
    private long size;
    
-   public ByteArrayBackedDataSource(byte[] data, int size) {
+   public ByteArrayBackedDataSource(byte[] data, int size) { // NOSONAR
       this.buffer = data;
       this.size = size;
    }

Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java Fri Jul  1 21:10:40
2016
@@ -47,7 +47,7 @@ public final class DataInputBlock {
 	private int _readIndex;
 	private int _maxIndex;
 
-	DataInputBlock(byte[] data, int startOffset) {
+	DataInputBlock(byte[] data, int startOffset) { // NOSONAR
 		_buf = data;
 		_readIndex = startOffset;
 		_maxIndex = _buf.length;

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java Fri Jul  1 21:10:40
2016
@@ -36,7 +36,7 @@ final class SheetRangeEvaluator implemen
         }
         _firstSheetIndex = firstSheetIndex;
         _lastSheetIndex = lastSheetIndex;
-        _sheetEvaluators = sheetEvaluators;
+        _sheetEvaluators = sheetEvaluators.clone();
 	}
     public SheetRangeEvaluator(int onlySheetIndex, SheetRefEvaluator sheetEvaluator) {
         this(onlySheetIndex, onlySheetIndex, new SheetRefEvaluator[] {sheetEvaluator});

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java Fri Jul  1 21:10:40
2016
@@ -77,7 +77,7 @@ public class DataSources {
         private final T[] elements;
 
         public ArrayDataSource(T[] elements) {
-            this.elements = elements;
+            this.elements = elements.clone();
         }
 
         public int getPointCount() {

Modified: poi/trunk/src/java/org/apache/poi/ss/util/SSCellRange.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SSCellRange.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SSCellRange.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SSCellRange.java Fri Jul  1 21:10:40 2016
@@ -45,7 +45,7 @@ public final class SSCellRange<K extends
 		_firstColumn = firstColumn;
 		_height = height;
 		_width = width;
-		_flattenedArray = flattenedArray;
+		_flattenedArray = flattenedArray.clone();
 	}
 
 	public static <B extends Cell> SSCellRange<B> create(int firstRow, int firstColumn,
int height, int width, List<B> flattenedList, Class<B> cellClass) {

Modified: poi/trunk/src/java/org/apache/poi/ss/util/SheetBuilder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SheetBuilder.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SheetBuilder.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SheetBuilder.java Fri Jul  1 21:10:40 2016
@@ -40,7 +40,7 @@ public class SheetBuilder {
 
     public SheetBuilder(Workbook workbook, Object[][] cells) {
         this.workbook = workbook;
-        this.cells = cells;
+        this.cells = cells.clone();
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java Fri Jul 
1 21:10:40 2016
@@ -27,7 +27,7 @@ public final class LittleEndianByteArray
 	private final int _endIndex;
 	private int _readIndex;
 
-	public LittleEndianByteArrayInputStream(byte[] buf, int startOffset, int maxReadLen) {
+	public LittleEndianByteArrayInputStream(byte[] buf, int startOffset, int maxReadLen) { //
NOSONAR
 		_buf = buf;
 		_readIndex = startOffset;
 		_endIndex = startOffset + maxReadLen;

Modified: poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java Fri Jul
 1 21:10:40 2016
@@ -29,7 +29,7 @@ public final class LittleEndianByteArray
 	private final int _endIndex;
 	private int _writeIndex;
 
-	public LittleEndianByteArrayOutputStream(byte[] buf, int startOffset, int maxWriteLen) {
+	public LittleEndianByteArrayOutputStream(byte[] buf, int startOffset, int maxWriteLen) {
// NOSONAR
 		if (startOffset < 0 || startOffset > buf.length) {
 			throw new IllegalArgumentException("Specified startOffset (" + startOffset 
 					+ ") is out of allowable range (0.." + buf.length + ")");

Modified: poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java Fri Jul
 1 21:10:40 2016
@@ -90,18 +90,18 @@ public class AgileEncryptor extends Encr
         int keySize = builder.getHeader().getKeySize()/8;
         int hashSize = builder.getHeader().getHashAlgorithmEx().hashSize;
         
-        byte[] verifierSalt = new byte[blockSize]
-             , verifier = new byte[blockSize]
-             , keySalt = new byte[blockSize]
-             , keySpec = new byte[keySize]
-             , integritySalt = new byte[hashSize];
-        r.nextBytes(verifierSalt); // blocksize
-        r.nextBytes(verifier); // blocksize
-        r.nextBytes(keySalt); // blocksize
-        r.nextBytes(keySpec); // keysize
-        r.nextBytes(integritySalt); // hashsize
+        byte[] newVerifierSalt = new byte[blockSize]
+             , newVerifier = new byte[blockSize]
+             , newKeySalt = new byte[blockSize]
+             , newKeySpec = new byte[keySize]
+             , newIntegritySalt = new byte[hashSize];
+        r.nextBytes(newVerifierSalt); // blocksize
+        r.nextBytes(newVerifier); // blocksize
+        r.nextBytes(newKeySalt); // blocksize
+        r.nextBytes(newKeySpec); // keysize
+        r.nextBytes(newIntegritySalt); // hashsize
         
-        confirmPassword(password, keySpec, keySalt, verifierSalt, verifier, integritySalt);
+        confirmPassword(password, newKeySpec, newKeySalt, newVerifierSalt, newVerifier, newIntegritySalt);
     }
 	
 	public void confirmPassword(String password, byte keySpec[], byte keySalt[], byte verifier[],
byte verifierSalt[], byte integritySalt[]) {
@@ -192,12 +192,12 @@ public class AgileEncryptor extends Encr
          *    0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, and 0x33.
          * 7.  Assign the encryptedHmacValue attribute to the base64-encoded form of the
result of step 6. 
          */
-        this.integritySalt = integritySalt;
+        this.integritySalt = integritySalt.clone();
 
         try {
             byte vec[] = CryptoFunctions.generateIv(hashAlgo, header.getKeySalt(), kIntegrityKeyBlock,
header.getBlockSize());
             Cipher cipher = getCipher(secretKey, ver.getCipherAlgorithm(), ver.getChainingMode(),
vec, Cipher.ENCRYPT_MODE);
-            byte filledSalt[] = getBlock0(integritySalt, getNextBlockSize(integritySalt.length,
blockSize));
+            byte filledSalt[] = getBlock0(this.integritySalt, getNextBlockSize(this.integritySalt.length,
blockSize));
             byte encryptedHmacKey[] = cipher.doFinal(filledSalt);
             header.setEncryptedHmacKey(encryptedHmacKey);
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java Fri Jul
 1 21:10:40 2016
@@ -196,7 +196,7 @@ public final class SlideListWithText ext
 		/** Create one to hold the Records for one Slide's text */
 		public SlideAtomsSet(SlidePersistAtom s, Record[] r) {
 			slidePersistAtom = s;
-			slideRecords = r;
+			slideRecords = r.clone();
 		}
 	}
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java Fri Jul  1 21:10:40
2016
@@ -107,9 +107,7 @@ public final class Picture
      * Builds a Picture object for a Picture stored in the
      *  DataStream
      */
-    public Picture( int dataBlockStartOfsset, byte[] _dataStream,
-            boolean fillBytes )
-    {
+    public Picture( int dataBlockStartOfsset, byte[] _dataStream, boolean fillBytes ) { //
NOSONAR
         _picfAndOfficeArtData = new PICFAndOfficeArtData( _dataStream,
                 dataBlockStartOfsset );
         _picf = _picfAndOfficeArtData.getPicf();
@@ -584,10 +582,10 @@ public final class Picture
      */
     public void writeImageContent( OutputStream out ) throws IOException
     {
-        byte[] content = getContent();
-        if ( content != null && content.length > 0 )
+        byte[] c = getContent();
+        if ( c != null && c.length > 0 )
         {
-            out.write( content, 0, content.length );
+            out.write( c, 0, c.length );
         }
     }
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java?rev=1751007&r1=1751006&r2=1751007&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java Fri Jul  1
21:10:40 2016
@@ -78,7 +78,7 @@ public enum PictureType
     {
         this._mime = mime;
         this._extension = extension;
-        this._signatures = signatures;
+        this._signatures = signatures.clone();
     }
 
     public String getExtension()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message