List of usage examples for java.util IllegalFormatConversionException printStackTrace
public void printStackTrace()
From source file:edu.ku.brc.af.ui.db.TextFieldWithQuery.java
/** * Process the results from the search//from w w w . j a v a 2s . c o m * @param customQuery the query * @param advanceFocus */ private void processResults(final CustomQueryIFace customQuery, int advanceFocus) { searchedForText = prevEnteredText; List<?> dataObjList = customQuery.getDataObjects(); if (dataObjList == null || dataObjList.size() == 0) { if (doAddAddItem) { showPopup(advanceFocus); } } else { Dimension dim = getSize(); if (fontMetrics == null) { Font font = getFont(); BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); fontMetrics = bi.getGraphics().getFontMetrics(font); } boolean isFirst = true; duplicatehash.clear(); for (Object obj : dataObjList) { Object[] array = (Object[]) obj; if (isFirst) { numColumns = array.length - 1; values = new Object[numColumns]; isFirst = false; } Integer id = (Integer) array[numColumns]; idList.addElement(id); if (duplicatehash.get(id) == null) { duplicatehash.put(id, array); if (numColumns == 1) { Object value = array[0].toString(); if (uiFieldFormatter != null) { value = uiFieldFormatter.formatToUI(value); } else if (StringUtils.isNotEmpty(format)) { Object oldVal = builder == null ? null : value; value = UIHelper.getFormattedValue(format, value); if (builder != null && value == null && oldVal != null) { //customized qbx format interfering with builder's selected field(s). value = oldVal; } } list.addElement(value != null ? value.toString() : "xxx"); } else { try { for (int i = 0; i < numColumns; i++) { Object val = array[i]; if (val instanceof Calendar) { val = scrDateFormat.format((Calendar) val); } else if (val instanceof Date) { val = scrDateFormat.format((Date) val); } if (val instanceof FormDataObjIFace) { val = ((FormDataObjIFace) val).getIdentityTitle(); } values[i] = val != null ? val : null; //$NON-NLS-1$ } String valStr = (String) UIHelper.getFormattedValue(format, values); if (returnCount <= popupDlgThreshold && fontMetrics.stringWidth(valStr) > dim.width) { int len = valStr.length() - 5; while (len > 25) { valStr = valStr.substring(0, len); if (fontMetrics.stringWidth(valStr) < dim.width) { valStr = valStr + "..."; break; } len -= 5; } } // Minor hack for Bug 5824 for names with no first name // In the future we may want to do a strip of spaces form the end first if (valStr.endsWith(", ")) { valStr = valStr.substring(0, valStr.length() - 2); } list.addElement(valStr); } catch (java.util.IllegalFormatConversionException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(TextFieldWithQuery.class, ex); ex.printStackTrace(); list.addElement(values[0] != null ? values[0].toString() : "(No Value)"); //$NON-NLS-1$ } } } } if (idList.size() > 0 && returnCount != null) { if (tabOutSearch && idList.size() == 1) { selectedId = idList.elementAt(0); setText(list.get(0)); notifyListenersOfChange(textField); } else if (returnCount > popupDlgThreshold) { showDialog(advanceFocus); } else { showPopup(advanceFocus); } } else { setText(""); //$NON-NLS-1$ } duplicatehash.clear(); } }