Example usage for org.apache.commons.collections Predicate Predicate

List of usage examples for org.apache.commons.collections Predicate Predicate

Introduction

In this page you can find the example usage for org.apache.commons.collections Predicate Predicate.

Prototype

Predicate

Source Link

Usage

From source file:org.andromda.cartridges.database.metafacades.ColumnLogicImpl.java

/**
 * Gets the association end that has the foreign identifier
 * flag set (if there is one)./*from   w ww  .j a va  2s  . c  o m*/
 * 
 * @return the foreign identifier association end or null if
 * on can't be found.
 */
private EntityAssociationEnd getForeignIdentifierEnd() {

    EntityAssociationEnd end = (EntityAssociationEnd) CollectionUtils.find(this.getOwner().getAssociationEnds(),
            new Predicate() {

                public boolean evaluate(Object object) {

                    AssociationEndFacade end = (AssociationEndFacade) object;
                    boolean valid = false;

                    if ((end != null) && EntityAssociationEnd.class.isAssignableFrom(end.getClass())) {

                        valid = ((EntityAssociationEnd) end).isForeignIdentifier();

                    }

                    return valid;

                }

            });

    return end;

}

From source file:org.andromda.cartridges.database.metafacades.TableLogicImpl.java

/**
 * @see org.andromda.cartridges.database.metafacades.Table#getIdentifierForeignKeyColumns()
 *//*from ww  w .jav  a  2 s  .c om*/
@Override
protected Collection handleGetIdentifierForeignKeyColumns() {

    Collection columns = null;
    final EntityAssociationEnd end = (EntityAssociationEnd) CollectionUtils.find(this.getAssociationEnds(),
            new Predicate() {

                @Override
                public boolean evaluate(final Object object) {

                    boolean valid = false;

                    if (EntityAssociationEnd.class.isAssignableFrom(object.getClass())) {

                        valid = ((EntityAssociationEnd) object).isForeignIdentifier();

                    }

                    return valid;

                }

            });

    if ((end != null) && EntityAssociationEnd.class.isAssignableFrom(end.getClass())) {

        columns = ((Table) end.getType()).getIdentifiers();

    }

    return columns;

}

From source file:org.andromda.cartridges.gui.metafacades.GuiActionLogicImpl.java

/**
 * @return hiddenParameters//from w w w. j  a v  a 2 s. c  o  m
 * @see org.andromda.cartridges.gui.metafacades.GuiAction#getHiddenParameters()
 */
@Override
protected List<GuiParameter> handleGetHiddenParameters() {

    final List<FrontEndParameter> hiddenParameters = new ArrayList<FrontEndParameter>(this.getParameters());

    CollectionUtils.filter(hiddenParameters, new Predicate() {

        @Override
        public boolean evaluate(final Object object) {

            boolean valid = false;

            if (object instanceof GuiParameter) {

                final GuiParameter parameter = (GuiParameter) object;

                valid = parameter.isInputHidden();

                if (!valid) {

                    for (final Iterator<GuiAttribute> iterator = parameter.getAttributes().iterator(); iterator
                            .hasNext();) {

                        final GuiAttribute attribute = iterator.next();

                        valid = attribute.isInputHidden();

                        if (valid) {

                            break;

                        }

                    }

                }

            }

            return valid;

        }

    });

    // TODO
    final List<GuiParameter> parameters = new ArrayList<GuiParameter>();

    for (final Iterator<FrontEndParameter> iterator = hiddenParameters.iterator(); iterator.hasNext();) {

        final Object actionForward = iterator.next();

        if (actionForward instanceof GuiParameter) {

            parameters.add((GuiParameter) actionForward);

        }

    }

    return parameters;

    // return hiddenParameters;
}

From source file:org.andromda.cartridges.gui.metafacades.GuiActionLogicImpl.java

@Override
protected java.util.List<GuiParameter> handleGetHiddenActionParameters() {

    final List<GuiParameter> hiddenActionParameters = new ArrayList<GuiParameter>(
            this.getActionParametersToDeletes());

    CollectionUtils.filter(hiddenActionParameters, new Predicate() {

        @Override/*from   ww  w  . j av a2 s  .c  om*/
        public boolean evaluate(final Object object) {

            return GuiGlobals.INPUT_HIDDEN.equals(((GuiParameter) object).getWidgetType());

        }

    });

    return hiddenActionParameters;

}

From source file:org.andromda.cartridges.gui.metafacades.GuiManageableEntityLogicImpl.java

/**
 * @return allRoles//  www .j  ava 2 s. co m
 * @see org.andromda.cartridges.gui.metafacades.GuiManageableEntity#getRoles()
 */
@Override
protected Collection<Role> handleGetRoles() {

    // copied form the Service <<Metafacade>>
    final Collection roles = new ArrayList(this.getTargetDependencies());

    CollectionUtils.filter(roles, new Predicate() {

        @Override
        public boolean evaluate(final Object object) {

            final DependencyFacade dependency = (DependencyFacade) object;

            return (dependency != null) && (dependency.getSourceElement() instanceof Role);

        }

    });
    CollectionUtils.transform(roles, new Transformer() {

        @Override
        public Object transform(final Object object) {

            return ((DependencyFacade) object).getSourceElement();

        }

    });

    final Collection allRoles = new LinkedHashSet(roles);

    // add all roles which are generalizations of this one
    CollectionUtils.forAllDo(roles, new Closure() {

        @Override
        public void execute(final Object object) {

            allRoles.addAll(((Role) object).getAllSpecializations());

        }

    });

    return allRoles;

}

From source file:org.andromda.cartridges.gui.metafacades.GuiParameterLogic.java

/**
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiParameter::table on collection or array</p>
 * <p><b>Error:</b> A parameter can only be rendered in tabular format when it is a collection or an array.</p>
 * <p><b>OCL:</b> context GuiParameter inv: table implies multiple</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiParameter::table actions must all have one parameter</p>
 * <p><b>Error:</b> All actions targetting this table and operating on all visible rows at the same time can only have a single parameter, this parameter denotes the value that will be sent when the row has been selected.</p>
 * <p><b>OCL:</b> context GuiParameter inv: tableGlobalActions->notEmpty() implies tableGlobalActions->forAll(actionParameters->size() = 1)</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiParameter::all global table action must have the same parameter</p>
 * <p><b>Error:</b> All actions targetting this table and operating on the entire rowset must have the same event parameter declaration, this means both name and type must match for all parameters in these actions.</p>
 * <p><b>OCL:</b> context GuiParameter inv: tableGlobalActions->notEmpty() implies allGlobalTableActionsHaveSameParameter</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiManageableEntityAssociationEnd::SAFE NAME - TO BE REMOVED LATER</p>
 * <p><b>Error:</b> The names you give to fields cannot start with a lowercase character directly followed by a character in uppercase. This is due to a bug in the Jakarta commons library which is used by Gui. The behavior of that library is inconsistent with the reflection API provided by the JDK. Please rename this field or you'll get exceptions when running your web application.</p>
 * <p><b>OCL:</b> context GuiAttribute inv: safeNamePresent</p>
 * @param validationMessages Collection<ModelValidationMessage>
 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
 *//* w ww  . jav  a2s.c o m*/
@Override
public void validateInvariants(Collection<ModelValidationMessage> validationMessages) {
    this.getSuperFrontEndParameter().validateInvariants(validationMessages);
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer
                .ensure((Boolean
                        .valueOf(String.valueOf(
                                Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement, "table")))
                                        .booleanValue()))
                        .booleanValue()
                                ? Boolean
                                        .valueOf(String
                                                .valueOf(OCLIntrospector.invoke(contextElement, "multiple")))
                                        .booleanValue()
                                : true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiParameter::table on collection or array",
                    "A parameter can only be rendered in tabular format when it is a collection or an array."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiParameter::table on collection or array' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure((Boolean
                .valueOf(String.valueOf(
                        OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement, "tableGlobalActions"))))
                .booleanValue()
                        ? OCLCollections.forAll(OCLIntrospector.invoke(contextElement, "tableGlobalActions"),
                                new Predicate() {
                                    public boolean evaluate(Object object) {
                                        return Boolean.valueOf(String.valueOf(OCLExpressions.equal(
                                                OCLCollections.size(
                                                        OCLIntrospector.invoke(object, "actionParameters")),
                                                1))).booleanValue();
                                    }
                                })
                        : true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiParameter::table actions must all have one parameter",
                    "All actions targetting this table and operating on all visible rows at the same time can only have a single parameter, this parameter denotes the value that will be sent when the row has been selected."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiParameter::table actions must all have one parameter' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure((Boolean
                .valueOf(String.valueOf(
                        OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement, "tableGlobalActions"))))
                .booleanValue()
                        ? Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,
                                "allGlobalTableActionsHaveSameParameter"))).booleanValue()
                        : true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiParameter::all global table action must have the same parameter",
                    "All actions targetting this table and operating on the entire rowset must have the same event parameter declaration, this means both name and type must match for all parameters in these actions."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiParameter::all global table action must have the same parameter' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer
                .ensure(OCLIntrospector.invoke(contextElement, "safeNamePresent"));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiManageableEntityAssociationEnd::SAFE NAME - TO BE REMOVED LATER",
                    "The names you give to fields cannot start with a lowercase character directly followed by a character in uppercase. This is due to a bug in the Jakarta commons library which is used by Gui. The behavior of that library is inconsistent with the reflection API provided by the JDK. Please rename this field or you'll get exceptions when running your web application."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiManageableEntityAssociationEnd::SAFE NAME - TO BE REMOVED LATER' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
}

From source file:org.andromda.cartridges.gui.metafacades.GuiSessionObjectLogic.java

/**
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs a name</p>
 * <p><b>Error:</b> Each session object needs a good name, it will be used to look up the actual instance in the session scope.</p>
 * <p><b>OCL:</b> context GuiSessionObject inv: name->notEmpty()</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs public attributes</p>
 * <p><b>Error:</b> All attributes on a session object must have a public visibility.</p>
 * <p><b>OCL:</b> context GuiSessionObject
inv : attributes -> forAll(visibility = 'public')</p>
 * @param validationMessages Collection<ModelValidationMessage>
 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
 *//*w  w  w . ja  v  a2  s  .c  om*/
@Override
public void validateInvariants(Collection<ModelValidationMessage> validationMessages) {
    this.getSuperClassifierFacade().validateInvariants(validationMessages);
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer
                .ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement, "name")));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs a name",
                    "Each session object needs a good name, it will be used to look up the actual instance in the session scope."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs a name' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure(
                OCLCollections.forAll(OCLIntrospector.invoke(contextElement, "attributes"), new Predicate() {
                    public boolean evaluate(Object object) {
                        return Boolean
                                .valueOf(String.valueOf(OCLExpressions
                                        .equal(OCLIntrospector.invoke(object, "visibility"), "public")))
                                .booleanValue();
                    }
                }));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs public attributes",
                    "All attributes on a session object must have a public visibility."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::gui::metafacades::GuiSessionObject::session object needs public attributes' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
}

From source file:org.andromda.cartridges.gui.metafacades.GuiUseCaseLogicImpl.java

private static boolean isParent(final GuiUseCase useCase1, final GuiUseCase useCase2) {

    return CollectionUtils.exists(useCase2.getIncludes(), new Predicate() {

        @Override/* w  ww  .  ja v a  2 s .com*/
        public boolean evaluate(final Object object) {

            final IncludeFacade include = (IncludeFacade) object;

            return include.getAddition().equals(useCase1);

        }

    });

}

From source file:org.andromda.cartridges.gui.metafacades.GuiUseCaseLogicImpl.java

/**
 * @return navigationParents/*from  w  w  w.jav  a  2  s .c  o  m*/
 * @see org.andromda.cartridges.gui.metafacades.GuiUseCase#getNavigationParents()
 */
@Override
protected Collection<FrontEndUseCase> handleGetNavigationParents() {

    final GuiUseCase theUseCase = this;

    return CollectionUtils.select(this.getAllUseCases(), new Predicate() {

        @Override
        @SuppressWarnings("synthetic-access")
        public boolean evaluate(final Object o) {

            final GuiUseCase useCase = (GuiUseCase) o;

            if (theUseCase.equals(useCase)) {

                return false;

            }

            return GuiUseCaseLogicImpl.isParent(theUseCase, useCase);

        }

    });

}

From source file:org.andromda.cartridges.webservice.metafacades.WSDLTypeLogic.java

/**
 * <p><b>Constraint:</b> org::andromda::cartridges::webservice::metafacades::WSDLType::array type needs a non-array type</p>
 * <p><b>Error:</b> Each array type in your model requires a corresponding non-array type to be defined.</p>
 * <p><b>OCL:</b> context WSDLType 
inv: array->notEmpty() //ww w  . ja  v a 2 s  .c  om
implies nonArray->notEmpty()</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must all have public attributes</p>
 * <p><b>Error:</b> All attributes must have a public visibility.</p>
 * <p><b>OCL:</b> context WSDLType
inv : attributes -> forAll(visibility = 'public')</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must have public navigable association ends.</p>
 * <p><b>Error:</b> All navigable association ends must have a public visibility.</p>
 * <p><b>OCL:</b> context WSDLType
inv : associationEnds -> forAll(otherEnd.navigable implies otherEnd.visibility = 'public')</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be an exception</p>
 * <p><b>Error:</b> Each WSDLType which is a WebFault must also be an Exception.</p>
 * <p><b>OCL:</b> context WSDLType
inv : webFaultAnException=true</p>
 * <p><b>Constraint:</b> org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be thrown from a webservice operation</p>
 * <p><b>Error:</b> Each WSDLType which is a WebFault must be thrown by a webservice operation.</p>
 * <p><b>OCL:</b> context WSDLType
inv : webFaultThrown=true</p>
 * @param validationMessages Collection<ModelValidationMessage>
 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
 */
@Override
public void validateInvariants(Collection<ModelValidationMessage> validationMessages) {
    this.getSuperClassifierFacade().validateInvariants(validationMessages);
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure((Boolean
                .valueOf(String
                        .valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement, "array"))))
                .booleanValue() ? OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement, "nonArray"))
                        : true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::webservice::metafacades::WSDLType::array type needs a non-array type",
                    "Each array type in your model requires a corresponding non-array type to be defined."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::webservice::metafacades::WSDLType::array type needs a non-array type' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure(
                OCLCollections.forAll(OCLIntrospector.invoke(contextElement, "attributes"), new Predicate() {
                    public boolean evaluate(Object object) {
                        return Boolean
                                .valueOf(String.valueOf(OCLExpressions
                                        .equal(OCLIntrospector.invoke(object, "visibility"), "public")))
                                .booleanValue();
                    }
                }));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must all have public attributes",
                    "All attributes must have a public visibility."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must all have public attributes' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections
                .forAll(OCLIntrospector.invoke(contextElement, "associationEnds"), new Predicate() {
                    public boolean evaluate(Object object) {
                        return Boolean.valueOf(String.valueOf((Boolean
                                .valueOf(String.valueOf(OCLIntrospector.invoke(object, "otherEnd.navigable")))
                                .booleanValue()
                                        ? OCLExpressions.equal(
                                                OCLIntrospector.invoke(object, "otherEnd.visibility"), "public")
                                        : true)))
                                .booleanValue();
                    }
                }));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must have public navigable association ends.",
                    "All navigable association ends must have a public visibility."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl types must have public navigable association ends.' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer.ensure(
                OCLExpressions.equal(OCLIntrospector.invoke(contextElement, "webFaultAnException"), true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be an exception",
                    "Each WSDLType which is a WebFault must also be an Exception."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be an exception' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
    try {
        final Object contextElement = this.THIS();
        boolean constraintValid = OCLResultEnsurer
                .ensure(OCLExpressions.equal(OCLIntrospector.invoke(contextElement, "webFaultThrown"), true));
        if (!constraintValid) {
            validationMessages.add(new ModelValidationMessage((MetafacadeBase) contextElement,
                    "org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be thrown from a webservice operation",
                    "Each WSDLType which is a WebFault must be thrown by a webservice operation."));
        }
    } catch (Throwable th) {
        Throwable cause = th.getCause();
        int depth = 0; // Some throwables have infinite recursion
        while (cause != null && depth < 7) {
            th = cause;
            depth++;
        }
        logger.error(
                "Error validating constraint 'org::andromda::cartridges::webservice::metafacades::WSDLType::wsdl fault types must be thrown from a webservice operation' ON "
                        + this.THIS().toString() + ": " + th.getMessage(),
                th);
    }
}