Skip to content
Snippets Groups Projects
Commit 18c9a1ce authored by brinn's avatar brinn
Browse files

change: improve error message

SVN: 1522
parent c554e4d0
No related branches found
No related tags found
No related merge requests found
...@@ -126,11 +126,25 @@ public abstract class AbstractParserObjectFactory<E> implements IParserObjectFac ...@@ -126,11 +126,25 @@ public abstract class AbstractParserObjectFactory<E> implements IParserObjectFac
propertyNames.removeAll(propertyDescriptors.keySet()); propertyNames.removeAll(propertyDescriptors.keySet());
if (propertyNames.size() > 0) if (propertyNames.size() > 0)
{ {
throw UserFailureException.fromTemplate("Following properties '%s' are not part of '%s'.", propertyNames, throw UserFailureException.fromTemplate("The following header columns are not part of '%s': %s",
clazz.getSimpleName()); clazz.getSimpleName(), format(propertyNames));
} }
} }
private final String format(Set<String> set)
{
final StringBuilder builder = new StringBuilder();
for (String s : set)
{
builder.append("'");
builder.append(s);
builder.append("', ");
}
// Remove trailing ", "
builder.setLength(builder.length() - 2);
return builder.toString();
}
/** /**
* Analyzes given <code>Class</code> and returns a <code>Map</code> containing the mandatory <code>Field</code>s * Analyzes given <code>Class</code> and returns a <code>Map</code> containing the mandatory <code>Field</code>s
* keyed by {@link Field#getName()}. * keyed by {@link Field#getName()}.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment