Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

somewhat ugly fix to handle exceptions from the bean browser like java.l... #111

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

import org.apache.commons.lang.StringUtils;
import org.archive.crawler.framework.CrawlJob;
Expand All @@ -54,6 +55,9 @@
* @contributor nlevitt
*/
public abstract class JobRelatedResource extends BaseResource {
private final static Logger LOGGER =
Logger.getLogger(JobRelatedResource.class.getName());

protected CrawlJob cj;

protected IdentityHashMap<Object, String> beanToNameMap;
Expand Down Expand Up @@ -147,8 +151,12 @@ protected void addPresentableNestedNames(Collection<Object> namedBeans, Object o
}
}
if (obj instanceof Iterable<?>) {
for (Object next : (Iterable<?>) obj) {
addPresentableNestedNames(namedBeans, next, alreadyWritten);
try {
for (Object next : (Iterable<?>) obj) {
addPresentableNestedNames(namedBeans, next, alreadyWritten);
}
} catch (Exception e) {
LOGGER.warning("problem iterating over " + obj + " - " + e);
}
}
}
Expand Down Expand Up @@ -286,8 +294,12 @@ protected Map<String, Object> makePresentableMapFor(String field, Object object,
beanPathPrefix = beanPath + "[";
}
// TODO: protect against overlong content?
propValues.add(makePresentableMapFor(i + "", list.get(i),
alreadyWritten, beanPathPrefix));
try {
propValues.add(makePresentableMapFor(i + "", list.get(i),
alreadyWritten, beanPathPrefix));
} catch (Exception e) {
LOGGER.warning(list + ".get(" + i + ") -" + e);
}
}
} else if (object instanceof Iterable<?>) {
for (Object next : (Iterable<?>) object) {
Expand Down