Skip to content

Commit da158cf

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #276
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928989 13f79535-47bb-0310-9956-ffa450edef68
1 parent 92e9de6 commit da158cf

File tree

1 file changed

+3
-2
lines changed
  • pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form

1 file changed

+3
-2
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,12 @@ public void setValue(String value) throws IOException
177177
*/
178178
public void setValue(int index) throws IOException
179179
{
180-
if (getExportValues().isEmpty() || index < 0 || index >= getExportValues().size())
180+
List<String> exportValues = getExportValues();
181+
if (exportValues.isEmpty() || index < 0 || index >= exportValues.size())
181182
{
182183
throw new IllegalArgumentException("index '" + index
183184
+ "' is not a valid index for the field " + getFullyQualifiedName()
184-
+ ", valid indices are from 0 to " + (getExportValues().size() - 1));
185+
+ ", valid indices are from 0 to " + (exportValues.size() - 1));
185186
}
186187

187188
updateByValue(String.valueOf(index));

0 commit comments

Comments
 (0)