git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751007 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_15_BETA3
@@ -393,6 +393,6 @@ public class Ole10Native { | |||
} | |||
public void setDataBuffer(byte dataBuffer[]) { | |||
this.dataBuffer = dataBuffer; | |||
this.dataBuffer = dataBuffer.clone(); | |||
} | |||
} |
@@ -28,7 +28,7 @@ public class ByteArrayBackedDataSource extends DataSource { | |||
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; | |||
} |
@@ -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; |
@@ -36,7 +36,7 @@ final class SheetRangeEvaluator implements SheetRange { | |||
} | |||
_firstSheetIndex = firstSheetIndex; | |||
_lastSheetIndex = lastSheetIndex; | |||
_sheetEvaluators = sheetEvaluators; | |||
_sheetEvaluators = sheetEvaluators.clone(); | |||
} | |||
public SheetRangeEvaluator(int onlySheetIndex, SheetRefEvaluator sheetEvaluator) { | |||
this(onlySheetIndex, onlySheetIndex, new SheetRefEvaluator[] {sheetEvaluator}); |
@@ -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() { |
@@ -45,7 +45,7 @@ public final class SSCellRange<K extends Cell> implements CellRange<K> { | |||
_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) { |
@@ -40,7 +40,7 @@ public class SheetBuilder { | |||
public SheetBuilder(Workbook workbook, Object[][] cells) { | |||
this.workbook = workbook; | |||
this.cells = cells; | |||
this.cells = cells.clone(); | |||
} | |||
/** |
@@ -27,7 +27,7 @@ public final class LittleEndianByteArrayInputStream implements LittleEndianInput | |||
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; |
@@ -29,7 +29,7 @@ public final class LittleEndianByteArrayOutputStream implements LittleEndianOutp | |||
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 + ")"); |
@@ -90,18 +90,18 @@ public class AgileEncryptor extends Encryptor { | |||
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 Encryptor { | |||
* 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); | |||
@@ -196,7 +196,7 @@ public final class SlideListWithText extends RecordContainer { | |||
/** Create one to hold the Records for one Slide's text */ | |||
public SlideAtomsSet(SlidePersistAtom s, Record[] r) { | |||
slidePersistAtom = s; | |||
slideRecords = r; | |||
slideRecords = r.clone(); | |||
} | |||
} | |||
} |
@@ -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 ); | |||
} | |||
} | |||
@@ -78,7 +78,7 @@ public enum PictureType | |||
{ | |||
this._mime = mime; | |||
this._extension = extension; | |||
this._signatures = signatures; | |||
this._signatures = signatures.clone(); | |||
} | |||
public String getExtension() |