Example usage for java.lang IllegalAccessException printStackTrace

List of usage examples for java.lang IllegalAccessException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.openremote.beehive.api.service.impl.RemoteSectionServiceImpl.java

public RemoteSectionDTO loadSectionById(long sectionId) {
    RemoteSectionDTO remoteSectionDTO = new RemoteSectionDTO();
    try {//from  ww w.j av  a 2  s  . com
        BeanUtils.copyProperties(remoteSectionDTO, loadById(sectionId));
    } catch (IllegalAccessException e) {
        // TODO handle exception
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        // TODO handle exception
        e.printStackTrace();
    }
    return remoteSectionDTO;
}

From source file:org.openremote.beehive.api.service.impl.RemoteSectionServiceImpl.java

public ModelDTO loadModelById(long sectionId) {
    Model model = loadById(sectionId).getModel();
    ModelDTO modelDTO = new ModelDTO();
    try {//from   w  ww.j  a v a  2 s  . co  m
        BeanUtils.copyProperties(modelDTO, model);
    } catch (IllegalAccessException e) {
        // TODO handle exception
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        // TODO handle exception
        e.printStackTrace();
    }
    return modelDTO;
}

From source file:com.caseybrooks.scripturememory.activities.DetailActivity.java

private void setTheme() {
    try {//  w  ww.  ja  va2 s .  c  o  m
        setTheme(R.style.class.getDeclaredField(MetaSettings.getAppTheme(context)).getInt(null));
    } catch (NoSuchFieldException nsfe) {
        nsfe.printStackTrace();
    } catch (IllegalAccessException iae) {
        iae.printStackTrace();
    }
}

From source file:de.weltraumschaf.maconha.server.errorhandling.ErrorMessage.java

public ErrorMessage(final AppException ex) {
    this();//from   w  w  w . ja v a  2  s. c  om

    try {
        BeanUtils.copyProperties(this, ex);
    } catch (final IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (final InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler.java

private static Hashtable<String, Object> fieldsToHT(Field[] fields, Object obj) {
    Hashtable<String, Object> hashtable = new Hashtable<>();
    for (Field field : fields) {
        field.setAccessible(true);//from   w  w  w .  j  a v  a 2 s  .  c  o m
        try {
            Object retrievedObject = field.get(obj);
            if (retrievedObject != null) {
                logger.debug("scanning " + field.getName());
                hashtable.put(field.getName(), field.get(obj));
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    return hashtable;
}

From source file:org.malaguna.cmdit.service.reflection.HibernateProxyUtils.java

private void deepLoadDomainObject(AbstractObject<?> object, Object guideObj) {
    PropertyDescriptor[] properties = PropertyUtils.getPropertyDescriptors(unproxy(object));

    for (PropertyDescriptor property : properties) {
        String pName = property.getName();

        if (PropertyUtils.isWriteable(object, pName) && PropertyUtils.isReadable(object, pName)) {

            try {
                Object propGuideObject = property.getReadMethod().invoke(guideObj);

                if (null != propGuideObject) {
                    Object unproxied = deepLoad(property.getReadMethod().invoke(object), propGuideObject);
                    property.getWriteMethod().invoke(object, unproxied);
                }// w ww  . j ava 2 s .com
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:org.oncoblocks.centromere.web.controller.ModelResourceAssembler.java

/**
 * Inspects the target {@link Model} class for {@link ForeignKey} annotations, and creates links
 *   based upon the inferred relationship and field names.
 * //ww  w .j  a v a2 s .  c  o  m
 * @param t
 * @return
 */
private List<Link> addForeignKeyLinks(T t) {
    List<Link> links = new ArrayList<>();
    for (Field field : model.getDeclaredFields()) {
        ForeignKey fk = field.getAnnotation(ForeignKey.class);
        if (fk == null)
            continue;
        if (fk.model() == null)
            throw new RuntimeException(String.format(
                    "ForeignKey annotation for " + "class %s does not contain any class reference!",
                    model.getName()));
        Class<?> fkCLass = fk.model();
        String relName = fk.rel().equals("") ? field.getName() : fk.rel();
        String fieldName = fk.field().equals("") ? field.getName() : fk.field();
        if (!Model.class.isAssignableFrom(fkCLass))
            continue;
        Link link = null;
        try {
            field.setAccessible(true);
            if (fk.relationship().equals(ForeignKey.Relationship.MANY_TO_ONE)
                    && (!field.getType().isArray() && !Collection.class.isAssignableFrom(field.getType()))) {
                link = entityLinks.linkToSingleResource(fkCLass, field.get(t)).withRel(relName);
            } else if (fk.relationship().equals(ForeignKey.Relationship.ONE_TO_MANY)
                    && (field.getType().isArray() || Collection.class.isAssignableFrom(field.getType()))) {
                Map<String, Object> map = new HashMap<>();
                map.put(fieldName, field.get(t));
                link = entityLinks.linkToCollectionResource(fkCLass).expand(map).withRel(relName);
            } else if (fk.relationship().equals(ForeignKey.Relationship.MANY_TO_MANY)
                    && (field.getType().isArray() || Collection.class.isAssignableFrom(field.getType()))) {
                Map<String, Object> map = new HashMap<>();
                map.put(fieldName, field.get(t));
                link = entityLinks.linkToCollectionResource(fkCLass).expand(map).withRel(relName);
            } else {
                throw new RuntimeException(
                        String.format("Unable to determine correct link format for " + "field %s of class %s",
                                field.getName(), model.getName()));
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        if (link != null)
            links.add(link);
    }
    return links;
}

From source file:eu.stratosphere.api.common.operators.util.UserCodeObjectWrapper.java

public UserCodeObjectWrapper(T userCodeObject) {
    Preconditions.checkArgument(userCodeObject instanceof Serializable,
            "User code object is not serializable: " + userCodeObject.getClass());
    this.userCodeObject = userCodeObject;
    // Remove unserializable objects from the user code object as well as from outer objects
    Object current = userCodeObject;
    try {//ww  w.  j  ava  2 s .  com
        while (null != current) {
            Object newCurrent = null;
            for (Field f : current.getClass().getDeclaredFields()) {
                f.setAccessible(true);

                if (f.getName().contains("$outer")) {
                    newCurrent = f.get(current);

                }

                if (!Modifier.isStatic(f.getModifiers()) && f.get(current) != null
                        && !(f.get(current) instanceof Serializable)) {
                    throw new RuntimeException("User code object " + userCodeObject
                            + " contains non-serializable field " + f.getName() + " = " + f.get(current));
                }
            }
            current = newCurrent;
        }
    } catch (IllegalAccessException e) {
        // this cannot occur since we call setAccessible(true)
        e.printStackTrace();
    }

}

From source file:com.square.client.gwt.server.servlet.ExporterRechercheServlet.java

@SuppressWarnings("unchecked")
private RemotePagingCriteriasDto<? extends IsSerializable> recupererCriteres(Map<String, String> map,
        Object criteres) {/*from  w  w  w.  j a  v a  2s .  c  o  m*/
    try {
        resetConverter();
        BeanUtils.populate(criteres, map);
        final RemotePagingCriteriasDto<? extends IsSerializable> criterias = new RemotePagingCriteriasDto(
                criteres, 0, Integer.MAX_VALUE);
        BeanUtils.populate(criterias, map);
        return criterias;
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        throw new TechnicalException("Une erreur est survenue lors de la rcupration des criteres");
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        throw new TechnicalException("Une erreur est survenue lors de la rcupration des criteres");
    }
}

From source file:org.openremote.beehive.api.service.impl.RemoteSectionServiceImpl.java

public RemoteSectionDTO loadFisrtRemoteSectionByModelId(long modelId) {
    Model model = genericDAO.loadById(Model.class, modelId);
    RemoteSectionDTO remoteSectionDTO = new RemoteSectionDTO();
    if (model.getRemoteSections().size() > 0) {
        try {/*ww  w.  j  av  a 2s  . c o m*/
            BeanUtils.copyProperties(remoteSectionDTO, model.getRemoteSections().get(0));
        } catch (IllegalAccessException e) {
            // TODO handle exception
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO handle exception
            e.printStackTrace();
        }
        return remoteSectionDTO;
    }
    throw new IllegalStateException("A Model should have one RemoteSection at least.");
}