Browse Source

sonar fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751007 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_15_BETA3
Andreas Beeker 8 years ago
parent
commit
86e265c734

+ 1
- 1
src/java/org/apache/poi/poifs/filesystem/Ole10Native.java View File

@@ -393,6 +393,6 @@ public class Ole10Native {
}
public void setDataBuffer(byte dataBuffer[]) {
this.dataBuffer = dataBuffer;
this.dataBuffer = dataBuffer.clone();
}
}

+ 1
- 1
src/java/org/apache/poi/poifs/nio/ByteArrayBackedDataSource.java View File

@@ -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;
}

+ 1
- 1
src/java/org/apache/poi/poifs/storage/DataInputBlock.java View File

@@ -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;

+ 1
- 1
src/java/org/apache/poi/ss/formula/SheetRangeEvaluator.java View File

@@ -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});

+ 1
- 1
src/java/org/apache/poi/ss/usermodel/charts/DataSources.java View File

@@ -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() {

+ 1
- 1
src/java/org/apache/poi/ss/util/SSCellRange.java View File

@@ -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) {

+ 1
- 1
src/java/org/apache/poi/ss/util/SheetBuilder.java View File

@@ -40,7 +40,7 @@ public class SheetBuilder {

public SheetBuilder(Workbook workbook, Object[][] cells) {
this.workbook = workbook;
this.cells = cells;
this.cells = cells.clone();
}

/**

+ 1
- 1
src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java View File

@@ -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;

+ 1
- 1
src/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java View File

@@ -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 + ")");

+ 13
- 13
src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptor.java View File

@@ -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);

+ 1
- 1
src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java View File

@@ -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();
}
}
}

+ 4
- 6
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java View File

@@ -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 );
}
}


+ 1
- 1
src/scratchpad/src/org/apache/poi/hwpf/usermodel/PictureType.java View File

@@ -78,7 +78,7 @@ public enum PictureType
{
this._mime = mime;
this._extension = extension;
this._signatures = signatures;
this._signatures = signatures.clone();
}

public String getExtension()

Loading…
Cancel
Save