/** * Returns the image descriptor for the given modifiers. * * @param data * The {@link ExceptionSensorData} data object where to check for the exception event * type. * @return The image descriptor. */ public static ImageDescriptor getImageDescriptor(ExceptionSensorData data) { if (null != data) { ExceptionEvent event = data.getExceptionEvent(); if (ExceptionEvent.CREATED.equals(event)) { return OVERLAY_ERROR; } else if (ExceptionEvent.HANDLED.equals(event)) { return OVERLAY_PRIORITY; } else if (ExceptionEvent.PASSED.equals(event)) { return OVERLAY_UP; } else if (ExceptionEvent.RETHROWN.equals(event)) { return OVERLAY_ERROR; } else if (ExceptionEvent.UNREGISTERED_PASSED.equals(event)) { return OVERLAY_UP; } } return ImageDescriptor.getMissingImageDescriptor(); }
/** * {@inheritDoc} */ @Override public long getObjectSize(IObjectSizes objectSizes) { return getObjectSize(objectSizes, true); }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((cause == null) ? 0 : cause.hashCode()); result = (prime * result) + ((child == null) ? 0 : child.hashCode()); result = (prime * result) + ((exceptionEvent == null) ? 0 : exceptionEvent.hashCode()); result = (prime * result) + ((stackTrace == null) ? 0 : stackTrace.hashCode()); result = (prime * result) + (int) (throwableIdentityHashCode ^ (throwableIdentityHashCode >>> 32)); result = (prime * result) + ((throwableType == null) ? 0 : throwableType.hashCode()); return result; }
return new StyledString(TextFormatter.getMethodWithParameters(methodIdent)); case EVENT_TYPE: styledString = new StyledString(data.getExceptionEvent().toString()); return styledString; case ERROR_MESSAGE:
/** * Utility method to convert an ordinal value into the respective enumeration. Used e.g. for * hibernate. * * @param i * the ordinal value. * @return the exception event */ public static ExceptionEvent fromOrd(int i) { if ((i < 0) || (i >= ExceptionEvent.values().length)) { throw new IndexOutOfBoundsException("Invalid ordinal"); } return ExceptionEvent.values()[i]; }
/** * {@inheritDoc} */ @Override public long getObjectSize(IObjectSizes objectSizes, boolean doAlign) { long size = objectSizes.getSizeOfObjectHeader(); size += objectSizes.getPrimitiveTypesSize(1, 0, 1, 0, 0, 0); size += objectSizes.getSizeOf(name()); if (doAlign) { return objectSizes.alignTo8Bytes(size); } else { return size; } }
/** * {@inheritDoc} */ @Override public DetailsTable generate(DefaultData defaultData, RepositoryDefinition repositoryDefinition, Composite parent, FormToolkit toolkit) { ExceptionSensorData exceptionSensorData = (ExceptionSensorData) defaultData; DetailsTable table = new DetailsTable(parent, toolkit, "Exception Info", 1); table.addContentRow("Type:", null, new DetailsCellContent[] { new DetailsCellContent(exceptionSensorData.getThrowableType()) }); if (null != exceptionSensorData.getExceptionEvent()) { table.addContentRow("Event:", null, new DetailsCellContent[] { new DetailsCellContent(exceptionSensorData.getExceptionEvent().toString()) }); } if (null != exceptionSensorData.getErrorMessage()) { table.addContentRow("Error Message:", null, new DetailsCellContent[] { new DetailsCellContent(exceptionSensorData.getErrorMessage()) }); } if (null != exceptionSensorData.getCause()) { table.addContentRow("Cause:", null, new DetailsCellContent[] { new DetailsCellContent(exceptionSensorData.getCause()) }); } if (null != exceptionSensorData.getStackTrace()) { table.addContentRow("Stack Trace:", null, new DetailsCellContent[] { new DetailsCellContent(exceptionSensorData.getStackTrace()) }); } return table; }
return false; } else if (!exceptionEvent.equals(other.exceptionEvent)) { return false;
@Override public boolean matches(Object object) { if (!ExceptionSensorData.class.isInstance(object)) { return false; } ExceptionSensorData otherExceptionSensorData = (ExceptionSensorData) object; if ((null != exceptionSensorData.getCause()) && !exceptionSensorData.getCause().equals(otherExceptionSensorData.getCause())) { return false; } if ((null != exceptionSensorData.getErrorMessage()) && !exceptionSensorData.getErrorMessage().equals(otherExceptionSensorData.getErrorMessage())) { return false; } if (!exceptionSensorData.getExceptionEvent().equals(otherExceptionSensorData.getExceptionEvent())) { return false; } if ((null != exceptionSensorData.getThrowableType()) && !exceptionSensorData.getThrowableType().equals(otherExceptionSensorData.getThrowableType())) { return false; } if (exceptionSensorData.getThrowableIdentityHashCode() != otherExceptionSensorData.getThrowableIdentityHashCode()) { return false; } return true; }
if (!rawMode && (data instanceof AggregatedExceptionSensorData)) { return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getCreated())); } else if (ExceptionEvent.CREATED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); } else { if (!rawMode && (data instanceof AggregatedExceptionSensorData)) { return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getPassed())); } else if (ExceptionEvent.PASSED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); } else { if (!rawMode && (data instanceof AggregatedExceptionSensorData)) { return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getHandled())); } else if (ExceptionEvent.HANDLED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); } else {