Sonar fixes - array is stored directly

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1744003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-05-16 09:57:19 +00:00
parent 84be4acea9
commit 2e5f0132c5
4 changed files with 10 additions and 9 deletions

View File

@ -117,7 +117,7 @@ public final class CollaboratingWorkbooksEnvironment {
unhookOldEnvironments(evaluators); unhookOldEnvironments(evaluators);
hookNewEnvironment(evaluators, this); hookNewEnvironment(evaluators, this);
_unhooked = false; _unhooked = false;
_evaluators = evaluators; _evaluators = evaluators.clone();
_evaluatorsByName = evaluatorsByName; _evaluatorsByName = evaluatorsByName;
} }

View File

@ -42,7 +42,7 @@ public class Formula {
private final int _encodedTokenLen; private final int _encodedTokenLen;
private Formula(byte[] byteEncoding, int encodedTokenLen) { private Formula(byte[] byteEncoding, int encodedTokenLen) {
_byteEncoding = byteEncoding; _byteEncoding = byteEncoding.clone();
_encodedTokenLen = encodedTokenLen; _encodedTokenLen = encodedTokenLen;
// if (false) { // set to true to eagerly check Ptg decoding // if (false) { // set to true to eagerly check Ptg decoding
// LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding); // LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);

View File

@ -27,8 +27,6 @@ import org.apache.poi.ss.formula.FormulaUsedBlankCellSet.BookSheetKey;
/** /**
* Stores the cached result of a formula evaluation, along with the set of sensitive input cells * Stores the cached result of a formula evaluation, along with the set of sensitive input cells
*
* @author Josh Micich
*/ */
final class FormulaCellCacheEntry extends CellCacheEntry { final class FormulaCellCacheEntry extends CellCacheEntry {
@ -57,8 +55,13 @@ final class FormulaCellCacheEntry extends CellCacheEntry {
public void setSensitiveInputCells(CellCacheEntry[] sensitiveInputCells) { public void setSensitiveInputCells(CellCacheEntry[] sensitiveInputCells) {
// need to tell all cells that were previously used, but no longer are, // need to tell all cells that were previously used, but no longer are,
// that they are not consumed by this cell any more // that they are not consumed by this cell any more
changeConsumingCells(sensitiveInputCells == null ? CellCacheEntry.EMPTY_ARRAY : sensitiveInputCells); if (sensitiveInputCells == null) {
_sensitiveInputCells = sensitiveInputCells; _sensitiveInputCells = null;
changeConsumingCells(CellCacheEntry.EMPTY_ARRAY);
} else {
_sensitiveInputCells = sensitiveInputCells.clone();
changeConsumingCells(_sensitiveInputCells);
}
} }
public void clearFormulaEntry() { public void clearFormulaEntry() {

View File

@ -28,8 +28,6 @@ import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
* Represents a syntactic element from a formula by encapsulating the corresponding <tt>Ptg</tt> * Represents a syntactic element from a formula by encapsulating the corresponding <tt>Ptg</tt>
* token. Each <tt>ParseNode</tt> may have child <tt>ParseNode</tt>s in the case when the wrapped * token. Each <tt>ParseNode</tt> may have child <tt>ParseNode</tt>s in the case when the wrapped
* <tt>Ptg</tt> is non-atomic. * <tt>Ptg</tt> is non-atomic.
*
* @author Josh Micich
*/ */
final class ParseNode { final class ParseNode {
@ -44,7 +42,7 @@ final class ParseNode {
throw new IllegalArgumentException("token must not be null"); throw new IllegalArgumentException("token must not be null");
} }
_token = token; _token = token;
_children = children; _children = children.clone();
_isIf = isIf(token); _isIf = isIf(token);
int tokenCount = 1; int tokenCount = 1;
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {