poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1717359 - in /poi/trunk/src: java/org/apache/poi/poifs/crypt/ ooxml/java/org/apache/poi/poifs/crypt/agile/ ooxml/java/org/apache/poi/poifs/crypt/dsig/ scratchpad/src/org/apache/poi/hslf/model/textproperties/ scratchpad/src/org/apache/poi/h...
Date Tue, 01 Dec 2015 00:23:22 GMT
Author: kiwiwings
Date: Tue Dec  1 00:23:21 2015
New Revision: 1717359

URL: http://svn.apache.org/viewvc?rev=1717359&view=rev
Log:
Sonar fixes, direct array parameter

Modified:
    poi/trunk/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionVerifier.java
    poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
    poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/DigestInfo.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java Tue Dec  1 00:23:21
2015
@@ -91,7 +91,7 @@ public class DataSpaceMapUtils {
         DataSpaceMapEntry entries[];
         
         public DataSpaceMap(DataSpaceMapEntry entries[]) {
-            this.entries = entries;
+            this.entries = entries.clone();
         }
         
         public DataSpaceMap(LittleEndianInput is) {
@@ -113,13 +113,13 @@ public class DataSpaceMapUtils {
     }
     
     public static class DataSpaceMapEntry implements EncryptionRecord {
-        int referenceComponentType[];
-        String referenceComponent[];
-        String dataSpaceName;
+        final int referenceComponentType[];
+        final String referenceComponent[];
+        final String dataSpaceName;
         
         public DataSpaceMapEntry(int referenceComponentType[], String referenceComponent[],
String dataSpaceName) {
-            this.referenceComponentType = referenceComponentType;
-            this.referenceComponent = referenceComponent;
+            this.referenceComponentType = referenceComponentType.clone();
+            this.referenceComponent = referenceComponent.clone();
             this.dataSpaceName = dataSpaceName;
         }
         
@@ -152,7 +152,7 @@ public class DataSpaceMapUtils {
         String transformer[];
         
         public DataSpaceDefinition(String transformer[]) {
-            this.transformer = transformer;
+            this.transformer = transformer.clone();
         }
         
         public DataSpaceDefinition(LittleEndianInput is) {

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java Tue Dec  1 00:23:21 2015
@@ -114,15 +114,15 @@ public abstract class Decryptor {
     }
 
     protected void setVerifier(byte[] verifier) {
-        this.verifier = verifier;
+        this.verifier = (verifier == null) ? null : verifier.clone();
     }
 
     protected void setIntegrityHmacKey(byte[] integrityHmacKey) {
-        this.integrityHmacKey = integrityHmacKey;
+        this.integrityHmacKey = (integrityHmacKey == null) ? null : integrityHmacKey.clone();
     }
 
     protected void setIntegrityHmacValue(byte[] integrityHmacValue) {
-        this.integrityHmacValue = integrityHmacValue;
+        this.integrityHmacValue = (integrityHmacValue == null) ? null : integrityHmacValue.clone();
     }
 
     protected int getBlockSizeInBytes() {

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java Tue Dec  1 00:23:21
2015
@@ -135,7 +135,7 @@ public abstract class EncryptionHeader {
     }
     
     protected void setKeySalt(byte salt[]) {
-        this.keySalt = salt;
+        this.keySalt = (salt == null) ? null : salt.clone();
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionVerifier.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionVerifier.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionVerifier.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionVerifier.java Tue Dec  1 00:23:21
2015
@@ -100,19 +100,19 @@ public abstract class EncryptionVerifier
     }
 
     protected void setSalt(byte[] salt) {
-        this.salt = salt;
+        this.salt = (salt == null) ? null : salt.clone();
     }
 
     protected void setEncryptedVerifier(byte[] encryptedVerifier) {
-        this.encryptedVerifier = encryptedVerifier;
+        this.encryptedVerifier = (encryptedVerifier == null) ? null : encryptedVerifier.clone();
     }
 
     protected void setEncryptedVerifierHash(byte[] encryptedVerifierHash) {
-        this.encryptedVerifierHash = encryptedVerifierHash;
+        this.encryptedVerifierHash = (encryptedVerifierHash == null) ? null : encryptedVerifierHash.clone();
     }
 
     protected void setEncryptedKey(byte[] encryptedKey) {
-        this.encryptedKey = encryptedKey;
+        this.encryptedKey = (encryptedKey == null) ? null : encryptedKey.clone();
     }
 
     protected void setSpinCount(int spinCount) {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java Tue
Dec  1 00:23:21 2015
@@ -111,7 +111,7 @@ public class AgileEncryptionHeader exten
     }
 
     protected void setEncryptedHmacKey(byte[] encryptedHmacKey) {
-        this.encryptedHmacKey = encryptedHmacKey;
+        this.encryptedHmacKey = (encryptedHmacKey == null) ? null : encryptedHmacKey.clone();
     }
 
     public byte[] getEncryptedHmacValue() {
@@ -119,6 +119,6 @@ public class AgileEncryptionHeader exten
     }
 
     protected void setEncryptedHmacValue(byte[] encryptedHmacValue) {
-        this.encryptedHmacValue = encryptedHmacValue;
+        this.encryptedHmacValue = (encryptedHmacValue == null) ? null : encryptedHmacValue.clone();
     }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/DigestInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/DigestInfo.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/DigestInfo.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/DigestInfo.java Tue Dec  1 00:23:21
2015
@@ -43,7 +43,7 @@ public class DigestInfo implements Seria
      * @param description
      */
     public DigestInfo(byte[] digestValue, HashAlgorithm hashAlgo, String description) {
-        this.digestValue = digestValue;
+        this.digestValue = digestValue.clone();
         this.hashAlgo = hashAlgo;
         this.description = description;
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/textproperties/TextPFException9.java
Tue Dec  1 00:23:21 2015
@@ -46,7 +46,7 @@ public class TextPFException9 {
 	private final Short autoNumberStartNumber;
 	private final static Short DEFAULT_START_NUMBER = 1;
 	private final int recordLength;
-	public TextPFException9(final byte[] source, final int startIndex) {
+	public TextPFException9(final byte[] source, final int startIndex) { // NOSONAR
 		//this.mask1 = source[startIndex];
 		//this.mask2 = source[startIndex + 1];
 		this.mask3 = source[startIndex + 2];

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java Tue Dec 
1 00:23:21 2015
@@ -247,7 +247,7 @@ public abstract class RecordContainer ex
      * @param records   the new child records
      */
     public void setChildRecord(Record[] records) {
-        this._children = records;
+        this._children = records.clone();
     }
 
 	/* ===============================================================

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=1717359&r1=1717358&r2=1717359&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 Tue Dec
 1 00:23:21 2015
@@ -153,12 +153,16 @@ public final class SlideListWithText ext
 	/**
 	 * Get access to the SlideAtomsSets of the children of this record
 	 */
-	public SlideAtomsSet[] getSlideAtomsSets() { return slideAtomsSets; }
+	public SlideAtomsSet[] getSlideAtomsSets() {
+	    return slideAtomsSets;
+    }
 
 	/**
 	* Get access to the SlideAtomsSets of the children of this record
 	*/
-	public void setSlideAtomsSets( SlideAtomsSet[] sas ) { slideAtomsSets = sas; }
+	public void setSlideAtomsSets( SlideAtomsSet[] sas ) {
+	    slideAtomsSets = sas.clone();
+    }
 
 	/**
 	 * Return the value we were given at creation

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java Tue Dec
 1 00:23:21 2015
@@ -17,10 +17,13 @@
 
 package org.apache.poi.hslf.record;
 
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianByteArrayInputStream;
 
@@ -136,7 +139,7 @@ public final class TextSpecInfoAtom exte
             try {
                 run.writeOut(bos);
             } catch (IOException e) {
-                throw new RuntimeException(e);
+                throw new HSLFException(e);
             }
         }
         _data = bos.toByteArray();

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoRun.java Tue Dec 
1 00:23:21 2015
@@ -305,7 +305,7 @@ public class TextSpecInfoRun {
      * @param smartTagsBytes the unparsed smart tags, null to unset
      */
     public void setSmartTagsBytes(byte[] smartTagsBytes) {
-        this.smartTagsBytes = smartTagsBytes;
+        this.smartTagsBytes = (smartTagsBytes == null) ? null : smartTagsBytes.clone();
         mask = smartTagFld.setBoolean(mask, smartTagsBytes != null);
     }
     

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java?rev=1717359&r1=1717358&r2=1717359&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFPictureData.java Tue Dec
 1 00:23:21 2015
@@ -84,7 +84,7 @@ public abstract class HSLFPictureData im
     }
 
     public void setRawData(byte[] data){
-        rawdata = data;
+        rawdata = (data == null) ? null : data.clone();
     }
 
     /**



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


Mime
View raw message