Example usage for java.lang IllegalAccessException getMessage

List of usage examples for java.lang IllegalAccessException getMessage

Introduction

In this page you can find the example usage for java.lang IllegalAccessException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.xirp.plugin.SecurePluginView.java

/**
 * Prints a log message that the access to the given method was
 * not allowed from the given class/*w  ww  .  j av  a  2  s. c  o m*/
 * 
 * @param methodName
 *            the name of the method
 * @param callerClassName
 *            the name of the class which tried to call this
 *            method
 */
private void accessNotAllowed(String methodName, String callerClassName) {
    try {
        throw new IllegalAccessException(I18n.getString("SecurePluginView.exception.noPermission2", //$NON-NLS-1$
                callerClassName, methodName, getName()));
    } catch (IllegalAccessException e) {
        logClass.error("Error: " + e.getMessage() + Constants.LINE_SEPARATOR, e); //$NON-NLS-1$
    }
}

From source file:org.fao.fenix.web.modules.metadataeditor.server.MetadataServiceImpl.java

private Map<FieldMetadataVo, String> createResourceSpecificFields(Resource rsrc, FieldMetadataVo fmvos[])
        throws FenixException {
    try {/*  w  w w.  jav a  2s  .c  om*/
        Map<FieldMetadataVo, String> map = new HashMap<FieldMetadataVo, String>();
        for (FieldMetadataVo vo : fmvos) {
            if (!vo.isBaseField)
                map.put(vo, BeanUtils.getProperty(rsrc, vo.getName()));
        }
        return map;
    } catch (IllegalAccessException e) {
        throw new FenixException(e.getMessage());
    } catch (InvocationTargetException e) {
        throw new FenixException(e.getMessage());
    } catch (NoSuchMethodException e) {
        throw new FenixException(e.getMessage());
    }
}

From source file:com.concursive.connect.indexer.LuceneIndexer.java

protected boolean indexAddItem(IndexWriter writer, Object item, boolean modified) throws Exception {
    if (writer == null) {
        throw new NullPointerException("Writer is null");
    }/*from   ww  w  .ja  va2s  .com*/
    if (item == null) {
        throw new NullPointerException("Item is null");
    }

    if (modified) {
        // Delete the previous item from the index
        indexDeleteItem(writer, item, "getSearchTerm");
    }
    try {
        Indexer objectIndexer = (Indexer) getObjectIndexer(item.getClass().getName() + "Indexer");
        if (objectIndexer == null) {
            return false;
        }
        // Add the item to the index
        Object o = null;
        try {
            // now we are ready for the next to last step..to call upon the method in the
            // class instance we have.
            Method method = objectIndexer.getClass().getMethod("add",
                    new Class[] { writer.getClass(), Object.class, boolean.class });
            o = method.invoke(objectIndexer, new Object[] { writer, item, new Boolean(modified) });
        } catch (NoSuchMethodException nm) {
            LOG.error("No Such Method Exception for method add. MESAGE = " + nm.getMessage(), nm);
        } catch (IllegalAccessException ia) {
            LOG.error("Illegal Access Exception. MESSAGE = " + ia.getMessage(), ia);
        } catch (Exception e) {
            LOG.error("Exception. MESSAGE = " + e.getMessage(), e);
        }
    } catch (Exception io) {
        io.printStackTrace(System.out);
        throw new IOException("Writer: " + io.getMessage());
    }
    return true;
}

From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATMethodsAndStandards.java

@GET
@Produces(MediaType.APPLICATION_JSON)/*from  w  w  w  . j  a v a  2  s. com*/
@Path("/{code}/json/{datasource}/{domainCode}/{lang}")
public Response getJSON(@PathParam("code") final String code, @PathParam("datasource") final String datasource,
        @PathParam("domainCode") final String domainCode, @PathParam("lang") final String lang) {

    // Initiate the stream
    StreamingOutput stream = new StreamingOutput() {

        @Override
        public void write(OutputStream os) throws IOException, WebApplicationException {

            // Initiate utilities
            Writer writer = new BufferedWriter(new OutputStreamWriter(os));
            Gson g = new Gson();
            List<String> headers = new ArrayList<String>();

            // compute result
            DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase());
            SQLBean sql = null;

            // get SQL script
            if (code.equalsIgnoreCase("classifications")) {
                sql = SQLBeansRepository.getClassifications(domainCode, lang);
                headers.add("Item Code");
                headers.add("Item Name");
                headers.add("Definition");
            } else if (code.equalsIgnoreCase("abbreviations")) {
                sql = SQLBeansRepository.getAbbreviations(domainCode, lang);
                headers.add("Acronym");
                headers.add("Definition");
            } else if (code.equalsIgnoreCase("glossary")) {
                sql = SQLBeansRepository.getGlossary(domainCode, lang);
                headers.add("Title");
                headers.add("Definition");
                headers.add("Sources");
            } else if (code.equalsIgnoreCase("methodology_list")) {
                sql = SQLBeansRepository.getMethodologyList(domainCode, lang);
                headers.add("Code");
                headers.add("Methodology");
            } else if (code.equalsIgnoreCase("methodology")) {
                sql = SQLBeansRepository.getMethodology(domainCode, lang);
                headers.add("Note");
                headers.add("Coverage");
                headers.add("References");
                headers.add("Collection");
                headers.add("Estimation");
            } else if (code.equalsIgnoreCase("units")) {
                sql = SQLBeansRepository.getUnits(domainCode, lang);
                headers.add("Abbreviation");
                headers.add("Title");
            }

            // Query the DB
            JDBCIterable it = new JDBCIterable();

            try {

                // Query DB
                it.query(db, Bean2SQL.convert(sql).toString());

            } catch (IllegalAccessException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (InstantiationException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (SQLException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (ClassNotFoundException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (Exception e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            }

            // write the result of the query
            writer.write("[");
            while (it.hasNext()) {
                writer.write(g.toJson(it.next()));
                if (it.hasNext())
                    writer.write(",");
            }
            writer.write("]");

            // Convert and write the output on the stream
            writer.flush();

        }

    };

    /* Stream result */
    return Response.status(200).entity(stream).build();

}

From source file:com.android.build.gradle.internal.pipeline.InjectTransformManager.java

/**
 * ??Transform?Transform?/*from w ww.ja va  2s  . co  m*/
 *
 * @param transformClazz
 * @param injectTransform
 * @param scope
 * @param <T>
 * @return
 */
public <T extends InjectTransform> TransformTask addInjectTransformBeforeTransform(
        Class<? extends Transform> transformClazz, T injectTransform, @NonNull VariantScope scope) {
    TaskCollection<DefaultAndroidTask> androidTasks = project.getTasks().withType(DefaultAndroidTask.class);
    SortedMap<String, DefaultAndroidTask> androidTaskSortedMap = androidTasks.getAsMap();
    TransformTask oprTransformTask = null; // ??
    for (String taskName : androidTaskSortedMap.keySet()) {
        DefaultAndroidTask androidTask = androidTaskSortedMap.get(taskName);
        if (variantName.equals(androidTask.getVariantName())) {
            if (androidTask instanceof TransformTask
                    && ((TransformTask) androidTask).getTransform().getClass().equals(transformClazz)) {
                oprTransformTask = (TransformTask) androidTask;
                break;
            }
        }
    }
    if (null == oprTransformTask) {
        throw new StopExecutionException(
                "TransformTask with transfrom type:" + transformClazz.getName() + " can not found!");
    }
    transforms.add(injectTransform);
    //2Transform??,?typetype
    checkTransformConfig(oprTransformTask.getTransform(), injectTransform);

    String taskName = scope.getTaskName(getTaskNamePrefix(injectTransform));

    try {
        IntermediateStream outputStream = getOutputStream(injectTransform, scope, taskName);

        // ?TransformTask
        TransformTaskParam transformTaskParam = getTransformParam(oprTransformTask);
        TransformTask.ConfigAction<T> configAction = new TransformTask.ConfigAction<T>(variantName, taskName,
                injectTransform, transformTaskParam.consumedInputStreams,
                transformTaskParam.referencedInputStreams, outputStream, ThreadRecorder.get(), null);

        TransformTask injectTransformTask = project.getTasks().create(configAction.getName(),
                configAction.getType());
        oprTransformTask.dependsOn(injectTransformTask);
        for (TransformStream transformStream : transformTaskParam.consumedInputStreams) {
            if (null != transformStream.getDependencies()) {
                injectTransformTask.dependsOn(transformStream.getDependencies());
            }
        }

        for (TransformStream transformStream : transformTaskParam.referencedInputStreams) {
            if (null != transformStream.getDependencies()) {
                injectTransformTask.dependsOn(transformStream.getDependencies());
            }
        }

        if (transformTaskList.size() > 0) {
            injectTransformTask.dependsOn(transformTaskList.get(transformTaskList.size() - 1));
        }
        transformTaskList.add(taskName);
        configAction.execute(injectTransformTask);

        //oprTransformTask
        if (injectTransform.updateNextTransformInput()) {
            Collection<TransformStream> newInputStream = Lists.newArrayList();
            newInputStream.add(outputStream);
            updateTransformTaskConfig(oprTransformTask, newInputStream,
                    transformTaskParam.referencedInputStreams, transformTaskParam.outputStream);
        }

        return injectTransformTask;
    } catch (IllegalAccessException e) {
        throw new StopExecutionException(e.getMessage());
    }
}

From source file:gov.nih.nci.cabig.ctms.acegi.acls.dao.impl.BasicAclLookupStrategy.java

private Acl constructAcl(AclObjectIdentityBean oidBean) {
    String[] identParts = oidBean.getIdentity().split(":");
    ObjectIdentity oid = new ObjectIdentityImpl(identParts[1], Long.valueOf(identParts[0]));

    // Contruct parent
    Acl parentAcl = null;/* w ww. ja  v  a2  s. c  o m*/

    // Set stub parent; ancestors handled later
    AclObjectIdentityBean parentOidBean = oidBean.getParent();
    if (parentOidBean != null) {
        parentAcl = constructAcl(parentOidBean);
    }

    boolean entriesInheriting = Boolean.valueOf(oidBean.getIsEntriesInheriting());

    // Contruct owner Sid
    Sid owner = null;
    AclSidBean ownerBean = oidBean.getAclSid();
    if (Boolean.valueOf(ownerBean.getIsPrincipal())) {
        owner = new PrincipalSid(ownerBean.getSid());
    } else {
        owner = new GrantedAuthoritySid(ownerBean.getSid());
    }

    // Construct the ACL
    Acl acl = new AclImpl(oid, oidBean.getId(), getAclAuthorizationStrategy(), getAuditLogger(), parentAcl,
            null, entriesInheriting, owner);

    Map orderedEntries = new TreeMap();
    Collection unorderedEntries = oidBean.getAclEntries();
    for (Iterator j = unorderedEntries.iterator(); j.hasNext();) {
        AclEntryBean aceBean = (AclEntryBean) j.next();
        Integer order = new Integer(aceBean.getAclOrder());
        List l = (List) orderedEntries.get(order);
        if (l == null) {
            l = new ArrayList();
            orderedEntries.put(order, l);
        }
        l.add(aceBean);
    }
    for (Iterator j = orderedEntries.values().iterator(); j.hasNext();) {

        List l = (List) j.next();
        for (Iterator k = l.iterator(); k.hasNext();) {

            AclEntryBean aceBean = (AclEntryBean) k.next();

            // Construct recipient Sid
            Sid recipient = null;
            AclSidBean recipientBean = aceBean.getSid();
            if (Boolean.valueOf(recipientBean.getIsPrincipal())) {
                recipient = new PrincipalSid(recipientBean.getSid());
            } else {
                recipient = new GrantedAuthoritySid(recipientBean.getSid());
            }

            Permission permission = BasePermission.buildFromMask(aceBean.getMask());
            boolean granting = Boolean.valueOf(aceBean.getIsGranting());
            boolean auditSuccess = Boolean.valueOf(aceBean.getIsAuditSuccess());
            boolean auditFailure = Boolean.valueOf(aceBean.getIsAuditFailure());

            AccessControlEntryImpl ace = new AccessControlEntryImpl(aceBean.getId(), acl, recipient, permission,
                    granting, auditSuccess, auditFailure);

            Field acesField = FieldUtils.getField(AclImpl.class, "aces");
            List aces;

            try {
                acesField.setAccessible(true);
                aces = (List) acesField.get(acl);
            } catch (IllegalAccessException ex) {
                throw new IllegalStateException(
                        "Could not obtain AclImpl.ace field: cause[" + ex.getMessage() + "]");
            }

            // Add the ACE if it doesn't already exist in the ACL.aces field
            if (!aces.contains(ace)) {
                aces.add(ace);
            }
        }
    }

    return acl;
}

From source file:net.mojodna.sprout.SproutAutoLoaderPlugIn.java

@SuppressWarnings("unchecked")
private void loadAction(final Class bean) {
    final Annotation[] annotations = bean.getAnnotations();

    for (int i = 0; i < annotations.length; i++) {
        final Annotation a = annotations[i];
        final Class type = a.annotationType();

        if (type.equals(SproutAction.class)) {
            final SproutAction form = (SproutAction) a;
            final String path = form.path();
            final Class<ActionConfig> mappingClass = form.mappingClass();
            final String scope = form.scope();
            final String name = form.name();
            final boolean validate = form.validate();
            final String input = form.input();
            final SproutProperty[] properties = form.properties();
            final SproutForward[] forwards = form.forwards();
            ActionConfig actionConfig = null;

            try {
                Constructor<ActionConfig> constructor = mappingClass.getDeclaredConstructor(new Class[] {});

                actionConfig = constructor.newInstance(new Object[] {});
            } catch (NoSuchMethodException nsme) {
                log.error("Failed to create a new instance of " + mappingClass.toString() + ", "
                        + nsme.getMessage());
            } catch (InstantiationException ie) {
                log.error("Failed to create a new instance of " + mappingClass.toString() + ", "
                        + ie.getMessage());
            } catch (IllegalAccessException iae) {
                log.error("Failed to create a new instance of " + mappingClass.toString() + ", "
                        + iae.getMessage());
            } catch (InvocationTargetException ite) {
                log.error("Failed to create a new instance of " + mappingClass.toString() + ", "
                        + ite.getMessage());
            }/*from w  w w  .  ja  v  a  2s  .  c  om*/

            if (actionConfig != null) {
                actionConfig.setPath(path);
                actionConfig.setType(bean.getName());
                actionConfig.setScope(scope);
                actionConfig.setValidate(validate);

                if (name.length() > 0) {
                    actionConfig.setName(name);
                }
                if (input.length() > 0) {
                    actionConfig.setInput(input);
                }

                if (properties != null && properties.length > 0) {
                    Map actionConfigBeanMap = new BeanMap(actionConfig);

                    for (int j = 0; j < properties.length; j++) {
                        actionConfigBeanMap.put(properties[j].property(), properties[j].value());
                    }
                }

                if (forwards != null && forwards.length > 0) {
                    for (int j = 0; j < forwards.length; j++) {
                        String fcModule = forwards[j].module();

                        actionConfig.addForwardConfig(makeForward(forwards[j].name(), forwards[j].path(),
                                forwards[j].redirect(), fcModule.length() == 0 ? null : fcModule));
                    }
                }
            }

            if (log.isDebugEnabled()) {
                log.debug("Action " + path + " -> " + bean.getName());
            }

            getModuleConfig().addActionConfig(actionConfig);
        }
    }
}

From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATMethodsAndStandards.java

@GET
@Path("/{code}/excel/{datasource}/{domainCode}/{lang}")
@Produces("application/msexcel")
public Response getExcel(@PathParam("code") final String code, @PathParam("datasource") final String datasource,
        @PathParam("domainCode") final String domainCode, @PathParam("lang") final String lang) {

    // Initiate the stream
    StreamingOutput stream = new StreamingOutput() {

        @Override/*from   ww w  .  ja va  2 s .  co  m*/
        public void write(OutputStream os) throws IOException, WebApplicationException {

            // initiate variable
            Writer writer = new BufferedWriter(new OutputStreamWriter(os));
            DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase());
            SQLBean sql = null;
            List<String> headers = new ArrayList<String>();

            // get SQL script
            if (code.equalsIgnoreCase("classifications")) {
                sql = SQLBeansRepository.getClassifications(domainCode, lang);
                headers.add("Item Code");
                headers.add("Item Name");
                headers.add("Definition");
            } else if (code.equalsIgnoreCase("abbreviations")) {
                sql = SQLBeansRepository.getAbbreviations(domainCode, lang);
                headers.add("Acronym");
                headers.add("Definition");
            } else if (code.equalsIgnoreCase("glossary")) {
                sql = SQLBeansRepository.getGlossary(domainCode, lang);
                headers.add("Title");
                headers.add("Definition");
                headers.add("Sources");
            } else if (code.equalsIgnoreCase("methodology_list")) {
                sql = SQLBeansRepository.getMethodologyList(domainCode, lang);
                headers.add("Code");
                headers.add("Methodology");
            } else if (code.equalsIgnoreCase("methodology")) {
                sql = SQLBeansRepository.getMethodology(domainCode, lang);
                headers.add("Note");
                headers.add("Coverage");
                headers.add("References");
                headers.add("Collection");
                headers.add("Estimation");
            } else if (code.equalsIgnoreCase("units")) {
                sql = SQLBeansRepository.getUnits(domainCode, lang);
                headers.add("Abbreviation");
                headers.add("Title");
            }

            JDBCIterable it = new JDBCIterable();

            try {

                // Query DB
                it.query(db, Bean2SQL.convert(sql).toString());

            } catch (IllegalAccessException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (InstantiationException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (SQLException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (ClassNotFoundException e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            } catch (Exception e) {
                WDSExceptionStreamWriter.streamException(os,
                        ("Method 'getDomains' thrown an error: " + e.getMessage()));
            }

            StringBuilder sb = new StringBuilder();
            sb.append("<table>");

            sb.append("<tr>");
            for (String s : headers)
                sb.append("<td>").append(s).append("</td>");
            sb.append("</tr>");

            while (it.hasNext()) {
                sb.append("<tr>");
                List<String> row = it.next();
                for (String s : row)
                    sb.append("<td>").append(s).append("</td>");
                sb.append("</tr>");
            }
            sb.append("</table>");

            writer.write(sb.toString());
            writer.flush();

        }

    };

    /* Stream result */
    //        return Response.status(200).entity(stream).build();

    // Wrap result
    Response.ResponseBuilder builder = Response.ok(stream);
    builder.header("Content-Disposition", "attachment; filename=" + UUID.randomUUID().toString() + ".xls");

    // Stream Excel
    return builder.build();

}

From source file:de.bund.bva.pliscommon.ueberwachung.common.jmx.ServiceStatistikMBean.java

/**
 * Durchsucht eine Klasse nach Fehlerobjekten, die nicht null sind, oder Fehlercollections, die nicht leer
 * sind. Fehlerobjekten sind mit {link FachlicherFehler} annotiert.
 *
 * Durchsucht Oberklassen & untergeordnete Objektstrukturen ebenfalls rekursiv.
 *
 * @param result/*from w  w w .ja  v a  2  s  .  c  o m*/
 *            Das Objekt
 * @param clazz
 *            Die Klasse des Objekts durchsucht werden soll (optional). Kann leergelassen werden beim
 *            Start, kann aber genutzt werden um auf Oberklassen eines Objekts zu prfen.
 * @param tiefe
 *            tiefe Gibt die aktuelle Tiefe des Aufrufs an. Muss erhht werden wenn man die
 *            Klassenstruktur nach unten durchluft.
 * @return <code>true</code> wenn Fehler gefunden, ansonsten <code>false</code>
 */
boolean pruefeObjektAufFehler(final Object result, Class<?> clazz, int tiefe) {
    boolean fehlerGefunden = false;
    Class<?> clazzToScan = clazz;
    // Wenn keine Klasse bergeben, selber ermitteln
    if (clazzToScan == null) {
        clazzToScan = result.getClass();
    }

    // Wenn max. Tiefe erreicht, nicht weiter prfen
    if (tiefe > MAXTIEFE) {
        LOGISY.trace("Max. Tiefe erreicht, prfe nicht weiter auf fachliche Fehler");
        return false;
    }

    Field[] fields = clazzToScan.getDeclaredFields();

    LOGISY.trace("{} Analysiere Objekt {} (Klasse {}) {} Felder gefunden.", StringUtils.repeat("-", tiefe),
            result.toString(), clazzToScan.getSimpleName(), fields.length);

    for (Field field : fields) {
        if (!ClassUtils.isPrimitiveOrWrapper(field.getType()) && !field.getType().isEnum()) {
            LOGISY.trace("{} {}.{}, Type {}", StringUtils.repeat("-", tiefe), clazzToScan.getSimpleName(),
                    field.getName(), field.getType().getSimpleName());
            field.setAccessible(true);
            try {
                // Prfe einzelne Klassenfelder (non-Collection) auf annotierten Typ und Vorhandensein
                if (!Collection.class.isAssignableFrom(field.getType())) {
                    if (field.get(result) != null) {
                        Object fieldObject = field.get(result);
                        if (fieldObject.getClass().isAnnotationPresent(FachlicherFehler.class)) {
                            // Fachliches Fehlerobjekt gefunden
                            return true;
                        }

                        // Wenn kein String, dann prfe rekursiv Objektstruktur
                        if (fieldObject.getClass() != String.class) {
                            fehlerGefunden = pruefeObjektAufFehler(fieldObject, null, tiefe + 1) ? true
                                    : fehlerGefunden;
                        }
                    }
                } else {
                    // Collection, prfen ob fachliche Fehlerliste
                    ParameterizedType type = (ParameterizedType) field.getGenericType();
                    Class<?> collectionTypeArgument = (Class<?>) type.getActualTypeArguments()[0];
                    if (collectionTypeArgument.isAnnotationPresent(FachlicherFehler.class)) {
                        // Ist Fehlerliste, prfen ob nicht leer
                        Collection<?> collection = (Collection<?>) field.get(result);
                        if (collection != null && !collection.isEmpty()) {
                            // Fachliche Fehler in Fehlerliste gefunden
                            return true;
                        }
                    }
                }
            } catch (IllegalAccessException e) {
                // Nichts tun, Feld wird ignoriert
                LOGISY.debug("Feldzugriffsfehler: {}", e.getMessage());
            }
        }
    }

    // Die Klassen-Hierachie rekursiv nach oben prfen
    if (clazzToScan.getSuperclass() != null && !clazzToScan.getSuperclass().equals(Object.class)) {
        LOGISY.trace("{}> Climb up class hierarchy! Source {}, Target {}", StringUtils.repeat("-", tiefe),
                clazzToScan.getSimpleName(), clazzToScan.getSuperclass());
        fehlerGefunden =
                // Aufruf mit gleicher Tiefe, da Vererbung nach oben durchlaufen wird
                pruefeObjektAufFehler(result, clazzToScan.getSuperclass(), tiefe) ? true : fehlerGefunden;
    }

    return fehlerGefunden;
}

From source file:org.unitils.database.DatabaseModule.java

/**
 * @return//from   w w w  .j a  va  2s.c  o  m
 */
protected void setFieldDataSource(String databaseName, DataSource dataSource, Object testObject,
        Set<Field> fields, Set<Method> methods) {
    if (fields.isEmpty() && methods.isEmpty()) {
        // Nothing to do. Jump out to make sure that we don't try to instantiate the DataSource
        return;
    }
    for (Field field : fields) {
        TestDataSource annotation = field.getAnnotation(TestDataSource.class);
        String tempDatabaseName = StringUtils.isEmpty(annotation.value())
                ? databaseConfigurations.getDatabaseConfiguration().getDatabaseName()
                : annotation.value();
        if (annotation != null && tempDatabaseName.equals(databaseName)) {
            ReflectionUtils.setFieldValue(testObject, field, dataSource);
        }
    }
    for (Method method : methods) {
        TestDataSource annotation = method.getAnnotation(TestDataSource.class);
        String tempDatabaseName = StringUtils.isEmpty(annotation.value())
                ? databaseConfigurations.getDatabaseConfiguration().getDatabaseName()
                : annotation.value();

        if (annotation != null && tempDatabaseName.equals(databaseName)) {
            try {
                method.invoke(testObject, dataSource);
            } catch (IllegalAccessException ex) {
                logger.error(ex.getMessage(), ex);
            } catch (IllegalArgumentException ex) {
                logger.error(ex.getMessage(), ex);
            } catch (InvocationTargetException ex) {
                logger.error(ex.getMessage(), ex);
            }
        }
    }
}