.getValue() missing after getAttribute(). Nevertheless this can still cause NullPointerException. See http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html#addAll(java.util.Collection)