diff --git a/pom.xml b/pom.xml
index 4f5754e4..88915519 100644
--- a/pom.xml
+++ b/pom.xml
@@ -493,7 +493,7 @@
junit
junit
- 3.8.2
+ 4.12
jdom
diff --git a/src/org/openid4java/message/ax/FetchResponse.java b/src/org/openid4java/message/ax/FetchResponse.java
index 91ed98de..670b5278 100644
--- a/src/org/openid4java/message/ax/FetchResponse.java
+++ b/src/org/openid4java/message/ax/FetchResponse.java
@@ -117,7 +117,7 @@ else if (value instanceof List)
// only send up the the maximum requested number
int max = req.getCount(alias);
if (max == 0)
- max = ((List)values).size();
+ max = ((List)value).size();
int count;
for (count = 0; count < max && values.hasNext(); count++)
{
diff --git a/test/src/org/openid4java/message/ax/FetchResponseTest.java b/test/src/org/openid4java/message/ax/FetchResponseTest.java
new file mode 100644
index 00000000..f7c7c2bf
--- /dev/null
+++ b/test/src/org/openid4java/message/ax/FetchResponseTest.java
@@ -0,0 +1,32 @@
+package org.openid4java.message.ax;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openid4java.message.MessageException;
+import org.openid4java.message.Parameter;
+import org.openid4java.message.ParameterList;
+
+public class FetchResponseTest
+{
+ @Test
+ public void unlimitedCountWorksForLists() throws MessageException
+ {
+ ParameterList params = new ParameterList();
+ params.set(new Parameter("required", "key"));
+ params.set(new Parameter("count.key", "unlimited"));
+
+ FetchRequest req = new FetchRequest(params);
+
+ Map> userData = Collections.singletonMap("key", Collections.singletonList("value"));
+
+ FetchResponse response = FetchResponse.createFetchResponse(req, userData);
+
+ assertEquals(Collections.singletonList("value"),
+ response.getAttributeValues("key"));
+ }
+}