String[] errObjects = null;
if(argv == null) {
errorName = DEFAULT_ERR_NAME;
} else {
final int arglen = argv.size();
final Item firstItem = argv.getItem(0);
if(arglen == 1) {
QNameValue err = (QNameValue) firstItem;
errorName = err.getValue();
final String trace = (new Throwable()).getStackTrace()[1].toString();
desc = "fn:error is called at " + trace;
} else {
if(arglen == 3) {
final Item thirdItem = argv.getItem(2);
final List<String> errList = new LinkedList<String>();
final IFocus<Item> thirdItemItor = thirdItem.iterator();
for(Item err : thirdItemItor) {
errList.add(err.stringValue());
}
thirdItemItor.closeQuietly();
errObjects = errList.toArray(new String[errList.size()]);
}
if(firstItem.isEmpty()) {
errorName = DEFAULT_ERR_NAME;
} else {
QNameValue err = (QNameValue) firstItem;
errorName = err.getValue();
}
Item secondItem = argv.getItem(1);
assert (secondItem instanceof XString);
desc = secondItem.stringValue();
}
}
if(errObjects != null) {
final StackTraceElement[] st = (new Throwable()).getStackTrace();
errObjects = new String[st.length];