mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-23 06:05:46 +00:00
bean browser: handle array of non-Object element type properly.
(just avoiding throwing exception - further change would be necessary for better rendering.)
This commit is contained in:
@@ -22,6 +22,7 @@ package org.archive.crawler.restlet;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -249,13 +250,15 @@ public abstract class JobRelatedResource extends BaseResource {
|
||||
|
||||
Collection<Object> propValues = new LinkedList<Object>();
|
||||
if(object.getClass().isArray()) {
|
||||
Object[] array = (Object[])object;
|
||||
for(int i = 0; i < array.length; i++) {
|
||||
// TODO: may want a special handling for an array of
|
||||
// primitive types?
|
||||
int len = Array.getLength(object);
|
||||
for (int i = 0; i < len; i++) {
|
||||
if(beanPath!=null) {
|
||||
beanPathPrefix = beanPath+"[";
|
||||
}
|
||||
// TODO: protect against overlong content?
|
||||
propValues.add(makePresentableMapFor(i + "", array[i],
|
||||
propValues.add(makePresentableMapFor(i + "", Array.get(object, i),
|
||||
alreadyWritten, beanPathPrefix));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user