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 List<RemoteSectionDTO> findByModelId(long modelId) {
    Model model = genericDAO.loadById(Model.class, modelId);
    List<RemoteSectionDTO> remoteSectionDTOs = new ArrayList<RemoteSectionDTO>();
    for (RemoteSection remoteSection : model.getRemoteSections()) {
        RemoteSectionDTO remoteSectionDTO = new RemoteSectionDTO();
        try {//from  w w  w  .  ja v  a2s  .c  o  m
            BeanUtils.copyProperties(remoteSectionDTO, remoteSection);
        } catch (IllegalAccessException e) {
            // TODO handle exception
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO handle exception
            e.printStackTrace();
        }
        remoteSectionDTOs.add(remoteSectionDTO);
    }
    return remoteSectionDTOs;
}

From source file:org.squale.welcom.taglib.multilingue.MultilingueFieldTag.java

/**
 * @param locale la locale//w w w. j av  a2  s.  co  m
 * @throws JspException exception pouvant etre levee
 */
private void createFieldTag(final String locale) throws JspException {
    final FieldTag textTag = new FieldTag();
    try {
        BeanUtils.copyProperties(textTag, this);

    } catch (final IllegalAccessException e) {
        e.printStackTrace();
    } catch (final InvocationTargetException e) {
        e.printStackTrace();
    }
    // Change le nom de la properti pour que l'appel soit correct
    textTag.setProperty(getPropertyLocale(locale));

    // Supprime les TD et la clef
    textTag.setKey("");
    textTag.setWriteTD(false);

    textTag.doStartTag();
    textTag.doEndTag();

}

From source file:net.navasoft.madcoin.backend.services.WorkRequestQueryFilter.java

/**
 * Choose filter.//from   w w  w. java  2  s  . c  o m
 * 
 * @param entryVO
 *            the entry vo
 * @return the generic filter
 * @since 27/07/2014, 06:48:16 PM
 */
@Override
public GenericFilter<WorkRequestQueryVO> chooseFilter(WorkRequestQueryVO entryVO) {
    GenericFilter<WorkRequestQueryVO> selector = null;
    Method[] accessors = WorkRequestQueryVO.class.getMethods();
    try {
        accessors = (Method[]) ArrayUtils.removeElement(accessors,
                WorkRequestQueryVO.class.getMethod("getClass", ArrayUtils.EMPTY_CLASS_ARRAY));
    } catch (NoSuchMethodException e1) {
        e1.printStackTrace();
    } catch (SecurityException e1) {
        e1.printStackTrace();
    }
    try {
        if (entryVO != null) {
            for (Method beanGetters : accessors) {
                if (beanGetters.getName().startsWith("get")) {
                    Object fieldValue;
                    fieldValue = beanGetters.invoke(entryVO, ArrayUtils.EMPTY_OBJECT_ARRAY);
                    if (fieldValue != null) {
                        String fieldToFilter = beanGetters.getName().replace("get", "");
                        EFilters guessedFilters = null;
                        if (ArrayUtils.contains(mandatory, fieldToFilter)) {
                            guessedFilters = EFilters.valueOf(fieldToFilter.toUpperCase() + "_FILTER");
                        } else {
                            if (guessedFilters == null) {
                                guessedFilters = optionalCorrelation.get(fieldToFilter);
                            }
                        }
                        selector = (GenericFilter<WorkRequestQueryVO>) Class
                                .forName(guessedFilters.getImplementingClass()).getConstructor(EFilters.class)
                                .newInstance(guessedFilters);
                    }
                }
            }
            if (selector == null) {
                selector = WorkRequestNoFilter.class.newInstance();
            } else {
                selector.setScope(entryVO);
            }
            return selector;
        } else {
            selector = WorkRequestNoFilter.class.newInstance();
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return selector;
}

From source file:net.firejack.platform.generate.VelocityGenerator.java

public void compose(String name, iPad generate, File file) {
    try {/*from ww  w.  j av  a 2 s .  c  o  m*/
        Map describe = PropertyUtils.describe(generate);
        compose(name, describe, file, false);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}

From source file:net.firejack.platform.generate.VelocityGenerator.java

public String compose(String name, Object model) {
    try {/*  w  w w .  j a va 2  s.c  o  m*/
        Map describe = PropertyUtils.describe(model);
        return compose(name, describe);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:edu.elka.peakadvisor.model.CassandraDao.java

public List<Pair<Double, Integer>> getPricesWithTimestampRange(String name, int timestampStart,
        int timestampEnd) {

    CassandraOperations template = this.cassandraTemplate;
    Select selectStatement = QueryBuilder.select() //znowu nie dziala bez cydzyslowow, trzeba wszystko wybierac
            .from("Latest").allowFiltering();

    selectStatement.where(QueryBuilder.gte("timestamp", timestampStart));
    selectStatement.where(QueryBuilder.lte("timestamp", timestampEnd));
    List<Latest> queryResult = template.select(selectStatement, Latest.class);

    queryResult.sort(new Comparator<Latest>() {
        @Override/*from w w  w  .  j av a 2s. com*/
        public int compare(Latest o1, Latest o2) {
            if (o1.getTimestamp() > o2.getTimestamp())
                return 1;
            else if (o1.getTimestamp() < o2.getTimestamp())
                return -1;
            else
                return 0;
        }
    });

    List<Pair<Number, Integer>> list = new ArrayList<>();
    queryResult.stream().map((l) -> {

        try {
            return new Pair(
                    ((l.getRates().getClass().getMethod("get" + name.toUpperCase()).invoke(l.getRates()))),
                    l.getTimestamp());
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        return null;
    }).forEach(p -> list.add(p));

    List<Pair<Double, Integer>> result2 = new ArrayList<>();

    //        for(Pair p:list){
    //            result2.add(new Pair<Double, Integer>((Double) p.getKey(),(Integer) p.getValue()));
    //        }

    list.stream().map((r) ->

    new Pair(((Double) r.getKey()).doubleValue(), ((Integer) r.getValue()).intValue()))

            .forEach(p -> result2.add(p));

    return result2;
}

From source file:net.firejack.platform.generate.VelocityGenerator.java

/**
 * @param name/*from  www  .  j  av a2s . c  om*/
 * @param generate
 * @param model
 * @param file
 * @param prepare
 */
public void compose(String name, Base generate, Map model, File file, boolean prepare) {
    try {
        Map describe = PropertyUtils.describe(generate);

        if (model != null) {
            describe.putAll(model);
        }

        compose(name, describe, file, prepare);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}

From source file:com.ls.http.base.handler.MultipartRequestHandler.java

private void formMultipartEntityObject(Object source) {
    Class<?> currentClass = source.getClass();
    while (!Object.class.equals(currentClass)) {
        Field[] fields = currentClass.getDeclaredFields();
        for (int counter = 0; counter < fields.length; counter++) {
            Field field = fields[counter];
            Expose expose = field.getAnnotation(Expose.class);
            if (expose != null && !expose.deserialize() || Modifier.isTransient(field.getModifiers())) {
                continue;// We don't have to copy ignored fields.
            }//from w w w  . j a va2 s.c  om
            field.setAccessible(true);
            Object value;

            String name;
            SerializedName serializableName = field.getAnnotation(SerializedName.class);
            if (serializableName != null) {
                name = serializableName.value();
            } else {
                name = field.getName();
            }
            try {
                value = field.get(source);
                addEntity(name, value);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        currentClass = currentClass.getSuperclass();
    }
    httpentity = entity.build();
}

From source file:com.base2.kagura.core.report.connectors.ReportConnector.java

/**
 * Runs the report./*from   w  w w  .  j a  v  a  2  s .  c o  m*/
 * @param extra middleware provided values, such as date/time, system configuration, logged in user, permissions
 *              and what ever else is of value to the user.
 */
public void run(Map<String, Object> extra) {
    if (getParameterConfig() != null) {
        Boolean parametersRequired = false;
        List<String> requiredParameters = new ArrayList<String>();
        for (ParamConfig paramConfig : getParameterConfig()) {
            if (BooleanUtils.isTrue(paramConfig.getRequired())) {
                try {
                    if (StringUtils
                            .isBlank(ObjectUtils.toString(PropertyUtils.getProperty(paramConfig, "value")))) {
                        parametersRequired = true;
                        requiredParameters.add(paramConfig.getName());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
        if (parametersRequired) {
            errors.add("Some required parameters weren't filled in: "
                    + StringUtils.join(requiredParameters, ", ") + ".");
            return;
        }
    }
    runReport(extra);
}

From source file:org.apache.tomcat.util.IntrospectionUtils.java

/**
 * Find a method with the right name If found, call the method ( if param is
 * int or boolean we'll convert value to the right type before) - that means
 * you can have setDebug(1).//w w w .ja v  a 2  s . c om
 */
public static void setProperty(Object o, String name, String value) {
    if (dbg > 1)
        d("setProperty(" + o.getClass() + " " + name + "=" + value + ")");

    String setter = "set" + capitalize(name);

    try {
        Method methods[] = findMethods(o.getClass());
        Method setPropertyMethod = null;

        // First, the ideal case - a setFoo( String ) method
        for (int i = 0; i < methods.length; i++) {
            Class paramT[] = methods[i].getParameterTypes();
            if (setter.equals(methods[i].getName()) && paramT.length == 1
                    && "java.lang.String".equals(paramT[0].getName())) {

                methods[i].invoke(o, new Object[] { value });
                return;
            }
        }

        // Try a setFoo ( int ) or ( boolean )
        for (int i = 0; i < methods.length; i++) {
            boolean ok = true;
            if (setter.equals(methods[i].getName()) && methods[i].getParameterTypes().length == 1) {

                // match - find the type and invoke it
                Class paramType = methods[i].getParameterTypes()[0];
                Object params[] = new Object[1];

                // Try a setFoo ( int )
                if ("java.lang.Integer".equals(paramType.getName()) || "int".equals(paramType.getName())) {
                    try {
                        params[0] = new Integer(value);
                    } catch (NumberFormatException ex) {
                        ok = false;
                    }
                    // Try a setFoo ( long )
                } else if ("java.lang.Long".equals(paramType.getName()) || "long".equals(paramType.getName())) {
                    try {
                        params[0] = new Long(value);
                    } catch (NumberFormatException ex) {
                        ok = false;
                    }

                    // Try a setFoo ( boolean )
                } else if ("java.lang.Boolean".equals(paramType.getName())
                        || "boolean".equals(paramType.getName())) {
                    params[0] = new Boolean(value);

                    // Try a setFoo ( InetAddress )
                } else if ("java.net.InetAddress".equals(paramType.getName())) {
                    try {
                        params[0] = InetAddress.getByName(value);
                    } catch (UnknownHostException exc) {
                        d("Unable to resolve host name:" + value);
                        ok = false;
                    }

                    // Unknown type
                } else {
                    d("Unknown type " + paramType.getName());
                }

                if (ok) {
                    methods[i].invoke(o, params);
                    return;
                }
            }

            // save "setProperty" for later
            if ("setProperty".equals(methods[i].getName())) {
                setPropertyMethod = methods[i];
            }
        }

        // Ok, no setXXX found, try a setProperty("name", "value")
        if (setPropertyMethod != null) {
            Object params[] = new Object[2];
            params[0] = name;
            params[1] = value;
            setPropertyMethod.invoke(o, params);
        }

    } catch (IllegalArgumentException ex2) {
        log.warn("IAE " + o + " " + name + " " + value, ex2);
    } catch (SecurityException ex1) {
        if (dbg > 0)
            d("SecurityException for " + o.getClass() + " " + name + "=" + value + ")");
        if (dbg > 1)
            ex1.printStackTrace();
    } catch (IllegalAccessException iae) {
        if (dbg > 0)
            d("IllegalAccessException for " + o.getClass() + " " + name + "=" + value + ")");
        if (dbg > 1)
            iae.printStackTrace();
    } catch (InvocationTargetException ie) {
        if (dbg > 0)
            d("InvocationTargetException for " + o.getClass() + " " + name + "=" + value + ")");
        if (dbg > 1)
            ie.printStackTrace();
    }
}