diff --git a/src/java/org/apache/poi/ss/formula/functions/Npv.java b/src/java/org/apache/poi/ss/formula/functions/Npv.java index 8ca7f8555c..4609094ffe 100644 --- a/src/java/org/apache/poi/ss/formula/functions/Npv.java +++ b/src/java/org/apache/poi/ss/formula/functions/Npv.java @@ -46,7 +46,8 @@ public final class Npv implements Function { try { double rate = NumericFunction.singleOperandEvaluate(args[0], srcRowIndex, srcColumnIndex); // convert tail arguments into an array of doubles - ValueEval[] vargs = Arrays.copyOfRange(args, 1 , args.length); + ValueEval[] vargs = new ValueEval[args.length-1]; + System.arraycopy(args, 1, vargs, 0, vargs.length); double[] values = AggregateFunction.ValueCollector.collectValues(vargs); double result = FinanceLib.npv(rate, values); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java index e769663415..0b925fc954 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java @@ -160,8 +160,8 @@ public final class TestXSSFRichTextString extends TestCase { TreeMap formats = str.getFormatMap(st); assertEquals(1, formats.size()); - assertEquals(26, (int)formats.firstEntry().getKey()); - assertNull(formats.firstEntry().getValue()); + assertEquals(26, (int)formats.firstKey()); + assertNull(formats.get( formats.firstKey() )); CTRPrElt fmt1 = CTRPrElt.Factory.newInstance(); str.applyFont(formats, 0, 6, fmt1);