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:dhbw.ka.mwi.businesshorizon2.ui.process.period.input.AbstractInputPresenter.java

@Override
public boolean isValid() {
    if (period != null) {

        try {//w ww.j  a  v  a 2s.com
            ArrayList<String> wrongFields = new ArrayList<String>();
            boolean anyFalse = false;
            wrongFields.add(period.getYear() + "");
            for (PropertyDescriptor pdr : Introspector.getBeanInfo(period.getClass(), Object.class)
                    .getPropertyDescriptors()) {
                if (Arrays.asList(shownProperties)
                        .contains(pdr.getDisplayName().substring(0, pdr.getDisplayName().length() - 3))) {
                    if (!(boolean) pdr.getReadMethod().invoke(period)) {
                        wrongFields.add(pdr.getDisplayName().substring(0, pdr.getDisplayName().length() - 3));
                        anyFalse = true;
                    }
                }
            }
            if (anyFalse) {
                eventBus.fireEvent(new WrongFieldsEvent(wrongFields));
                return false;
            }
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IntrospectionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return true;
    } else
        return false;
}

From source file:gov.nih.nci.rembrandt.web.struts2.action.EditGEAction.java

public String execute() {

    //          HttpSession session = request.getSession();
    //         if (form == null) {
    //                
    //             form = new GeneExpressionForm();
    //                  if ("request".equals(mapping.getScope()))
    //                      request.setAttribute(mapping.getAttribute(), form);
    //                  else
    //                      session.setAttribute(mapping.getAttribute(), form);
    //         }/*w ww.  j av a2 s.  c o  m*/
    this.form = new GeneExpressionForm();
    this.form.reset(this.servletRequest);

    String sessionId = this.servletRequest.getSession().getId();
    SessionQueryBag queryBag = presentationTierCache.getSessionQueryBag(sessionId);
    //String queryKey = (String) this.servletRequest.getAttribute("queryKey");
    if (queryBag != null) {
        //get the Form from the sessionQB
        GeneExpressionForm origCdForm = (GeneExpressionForm) queryBag.getFormBeanMap().get(this.queryKey);
        try {
            //try this, else call each setter
            form.setUpGeneAndCloneList(this.servletRequest);
            PropertyUtils.copyProperties(form, origCdForm);
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
    /*
     * resets the dropdowns that the saved form will need in order to render the page
     * and save the value.
     */
    //               GroupRetriever groupRetriever = new GroupRetriever();
    //               cdForm.setSavedSampleList(groupRetriever.getClinicalGroupsCollectionNoPath(request.getSession()));
    String editForward = "";
    //if(this.servletRequest.getAttribute("copy")!=null && ((String) this.servletRequest.getAttribute("copy")).equals("true"))
    if (this.copy.equalsIgnoreCase("true"))
        form.setQueryName(form.getQueryName() + "_copy");

    if (form.getChromosomes() == null || form.getChromosomes().isEmpty()) {
        //if (form.getChromosomeNumber().equals("-1")){
        //set the chromsomes list in the form 
        logger.debug("Setup the chromosome values for the form");
        form.setChromosomes(ChromosomeHelper.getInstance().getChromosomes());
    }

    editForward = "goEditGE";

    //saveToken(request);
    //this.form = cdForm;
    return editForward;
}

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

private void setNewValue(Object oldObj, Method method, Object newValue) {
    try {/*from   w w  w .  ja va 2  s.co m*/
        method.invoke(oldObj, newValue);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:net.echinopsii.ariane.community.plugin.rabbitmq.directory.RabbitmqDirectoryBootstrap.java

private void unplugPortalFacesMBeanRegistry() {
    try {//from  www. j  ava2  s.com
        portalPluginFacesMBeanRegistry.unregisterPluginFacesMBeanConfig(
                RabbitmqDirectoryBootstrap.class.getResource(FACES_CONFIG_FILE_PATH));
    } catch (IllegalAccessException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    } catch (ClassNotFoundException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    } catch (InstantiationException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
}

From source file:com.heyzap.cordova.ads.CDVHeyzapAbstractPlugin.java

@Override
public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext)
        throws JSONException {

    try {//from w w w. j  a v  a  2s  . co m
        final Method actionMethod = this.getClass().getMethod(action, JSONArray.class, CallbackContext.class);

        if (actionMethod != null) {
            cordova.getThreadPool().execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        actionMethod.invoke(CDVHeyzapAbstractPlugin.this, args, callbackContext);

                    } catch (IllegalAccessException e) {
                        String msg = "Unable to Invoke action: " + action + ". Illegal Access Exception.";
                        Log.e(TAG, msg);
                        e.printStackTrace();

                        callbackContext.error(msg);

                    } catch (InvocationTargetException e) {
                        String msg = "Unable to Invoke action: " + action;
                        Log.e(TAG, msg);
                        e.printStackTrace();

                        callbackContext.error(msg);

                    } catch (Exception e) {
                        String msg = "Could not run Heyzap Ads Method - SDK Error: " + e.getMessage();
                        Log.e(TAG, msg);
                        e.printStackTrace();

                        callbackContext.error(msg);
                    }
                }
            });

            return true;
        }

    } catch (NoSuchMethodException e) {
        Log.e(TAG, "Action: " + action + " was not found.");
    }

    return false;
}

From source file:com.wcs.base.util.StringUtils.java

public static String toString(Object obj) {
    if (obj == null)
        return null;
    Class objClass = obj.getClass();
    if (objClass.getName().startsWith("java.lang"))
        return obj.toString();

    Method[] methods = null;// w w w. ja  v a  2s. c  om
    Field[] fields = objClass.getDeclaredFields();
    StringBuffer result = new StringBuffer();
    if (isSubClassOf(objClass, "Collection")) {
        result.append(processIterator(((Collection) obj).iterator(), objClass));
    } else if (isSubClassOf(objClass, "Map")) {
        result.append(processMap((Map) obj, objClass));
    } else if (isSubClassOf(objClass, "Iterator")) {
        result.append(processIterator((Iterator) obj, objClass));
    } else if (isSubClassOf(objClass, "Enumeration")) {
        result.append(processEnumeration((Enumeration) obj, objClass));
    } else {
        if (!(objClass.getName().startsWith("java")) && fields.length > 0) {
            result.append(obj.getClass().getName()).append(":[");
            for (int i = 0; i < fields.length; i++) {
                result.append(fields[i].getName()).append(":");
                if (fields[i].isAccessible()) {
                    try {
                        result.append(toString(fields[i].get(obj)));
                    } catch (IllegalAccessException iae) {
                        iae.printStackTrace();
                    }
                } else {
                    if (methods == null) {
                        methods = objClass.getMethods();
                    }
                    for (int j = 0; j < methods.length; j++) {
                        if (methods[j].getName().equalsIgnoreCase("get" + fields[i].getName())) {
                            try {
                                result.append(toString(methods[j].invoke(obj, (Object[]) null)));
                            } catch (IllegalAccessException iae) {
                                iae.printStackTrace();
                            } catch (InvocationTargetException ite) {
                                ite.printStackTrace();
                            }
                        }
                    }
                }
                result.append("; ");
            }
            result.append(']');
        } else {
            result.append(obj);
            return result.toString();
        }
    }
    return result.toString();
}

From source file:org.squale.welcom.struts.action.WRequestProcessor.java

/**
 * effectue un populate en conction des dates
 * //from  w  w w .j av  a 2s. c  om
 * @param form : fomulaire
 * @param request : request
 * @parem element : Nom du champs
 */
private void processPopulateDate(final HttpServletRequest request, final ActionForm form,
        final String element) {
    if (element.endsWith("WDate") && !element.equals("WDate")) {

        final String field = element.substring(0, element.lastIndexOf("WDate"));

        String formattedDate = TagUtils.getDateHeureFromDateTag(request, field);

        final HashMap formatMaps = (HashMap) request.getSession().getAttribute(DATE_FORMAT_KEY);

        try {
            final Class propertyType = PropertyUtils.getPropertyType(form, field);
            if (propertyType != null) {
                boolean isTypeDate = propertyType.equals(Date.class);
                Object emptyValue = null;
                if (!isTypeDate) {
                    emptyValue = "";
                }

                if ((formatMaps != null) && (formatMaps.get(field + "WDate") != null)) {
                    String pattern = (String) formatMaps.get(field + "WDate");

                    if (formatMaps.get(field + "WHour") != null) {
                        pattern = pattern + " " + formatMaps.get(field + "WHour");
                    }

                    if (GenericValidator.isBlankOrNull(formattedDate)) {
                        BeanUtils.setProperty(form, field, emptyValue);
                    } else {
                        Locale locale = (Locale) request.getSession().getAttribute(Globals.LOCALE_KEY);
                        SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale);
                        dateFormat.setLenient(false);

                        try {
                            Date newDate = dateFormat.parse(formattedDate);

                            if (dateFormat.format(newDate).equals(formattedDate)) {
                                try {
                                    if (isTypeDate) {
                                        LayoutUtils.setProperty(form, field, newDate);
                                    } else {
                                        LayoutUtils.setProperty(form, field, String.valueOf(newDate.getTime()));
                                    }
                                } catch (SecurityException e1) {
                                    e1.printStackTrace();
                                }
                            } else {
                                BeanUtils.setProperty(form, field, emptyValue);
                            }
                        } catch (ParseException e) {
                            e.printStackTrace();
                            LayoutUtils.setProperty(form, field, emptyValue);
                        }
                    }
                } else {
                    if (formattedDate == null) {
                        formattedDate = "";
                    }
                    BeanUtils.setProperty(form, field, formattedDate);
                }

            }

        } catch (final JspException e1) {
            e1.printStackTrace();
        } catch (final IllegalAccessException e3) {
            e3.printStackTrace();
        } catch (final InvocationTargetException e3) {
            e3.printStackTrace();
        } catch (final NoSuchMethodException e3) {
            e3.printStackTrace();
        }

    }
}

From source file:ubic.gemma.core.loader.genome.gene.ncbi.NcbiGeneConverter.java

private void getChromosomeDetails(NCBIGene2Accession acc, Gene gene) {
    Chromosome chrom = gene.getPhysicalLocation().getChromosome();
    BioSequence chromSeq = BioSequence.Factory.newInstance();
    chromSeq.setName(acc.getGenomicNucleotideAccession());
    chromSeq.setType(SequenceType.WHOLE_CHROMOSOME);
    chromSeq.setTaxon(gene.getTaxon());/* ww w  .  j  ava2  s  . c om*/
    DatabaseEntry dbe = DatabaseEntry.Factory.newInstance();
    dbe.setExternalDatabase(NcbiGeneConverter.genBank);
    dbe.setAccession(acc.getGenomicNucleotideAccession());
    dbe.setAccessionVersion(acc.getGenomicNucleotideAccessionVersion());
    chromSeq.setSequenceDatabaseEntry(dbe);
    try {
        FieldUtils.writeField(chrom, "sequence", chromSeq, true);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

}

From source file:net.cit.tetrad.dao.management.impl.ManagementDaoImpl.java

/**
 * classnm? ? update?  set/*from   ww w  . ja v a  2s  . c  om*/
 */
@Override
public Update setUpdate(String dtoClassNm, CommonDto dto) {
    Update update = new Update();
    if (dtoClassNm.equals("device")) {
        Device ddto = new Device();
        try {
            BeanUtils.copyProperties(ddto, dto);
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        update.set(ddto);
    } else if (dtoClassNm.equals("critical")) {
        update.set("groupCode", dto.getGroupCode());
        update.set("deviceCode", dto.getDeviceCode());
        update.set("type", dto.getType());

        String unit = getUnit(dto.getType());
        update.set("unit", unit);
        if (unit.equals(UNIT_SECONDS)) {
            update.set("criticalvalue", dto.getCriticalvalue() * 1000000);
            update.set("warningvalue", dto.getWarningvalue() * 1000000);
            update.set("infovalue", dto.getInfovalue() * 1000000);
        } else {
            update.set("criticalvalue", dto.getCriticalvalue());
            update.set("warningvalue", dto.getWarningvalue());
            update.set("infovalue", dto.getInfovalue());
        }
    } else if (dtoClassNm.equals("user")) {
        String passwd = Utility.isNull(dto.getPasswd());
        if (!passwd.equals(""))
            update.set("passwd", makePasswd(dto.getPasswd()));
        update.set("uid", dto.getUid());
        update.set("username", dto.getUsername());
        update.set("email", dto.getEmail());
        update.set("mobile", dto.getMobile());
        update.set("authority", dto.getAuthority());
    } else if (dtoClassNm.equals("group")) {
        update.set("uid", dto.getUid());
        update.set("reg_date", DateUtil.getTime());
    }
    return update;
}

From source file:org.tynamo.descriptor.PropertyDescriptorTest.java

@Test
public void testCloneWidthExtensions2() throws Exception {
    String testExtension = "testExtension";
    DescriptorExtension descriptorExtension = new DescriptorExtension() {
        private final Logger logger = LoggerFactory.getLogger(DescriptorExtension.class);

        private String name;

        private Class propertyType;

        private Class beanType;

        private TynamoPropertyDescriptor propertyDescriptor = null;

        private boolean hidden = true;

        private boolean searchable = true;

        @Override//from   www.jav  a2s.com
        public Object clone() {
            return new Object();
        }

        public void copyFrom(Descriptor descriptor) {

            try {
                BeanUtils.copyProperties(this, (ObjectReferenceDescriptor) descriptor);
            } catch (IllegalAccessException e) {
                logger.error(e.getMessage());
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                logger.error(e.getMessage());
                e.printStackTrace();
            } catch (Exception e) {
                logger.error(e.toString());
                e.printStackTrace();
            }
        }

        /**
         * Interface Implementation
         */

        public String findAddExpression() {
            return getExpression("");
        }

        public String findRemoveExpression() {
            return getExpression("");
        }

        public String getExpression(String method) {
            return getName();
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Class getBeanType() {
            return beanType;
        }

        public void setBeanType(Class beanType) {
            this.beanType = beanType;
        }

        public Class getPropertyType() {
            return propertyType;
        }

        public void setPropertyType(Class propertyType) {
            this.propertyType = propertyType;
        }

        public boolean isSearchable() {
            return searchable;
        }

        public void setSearchable(boolean searchable) {
            this.searchable = searchable;
        }

        public boolean isHidden() {
            return hidden;
        }

        public void setHidden(boolean hidden) {
            this.hidden = hidden;
        }

        public TynamoPropertyDescriptor getPropertyDescriptor() {
            return propertyDescriptor;
        }

        public void setPropertyDescriptor(TynamoPropertyDescriptor propertyDescriptor) {
            this.propertyDescriptor = propertyDescriptor;
        }
    };

    TynamoPropertyDescriptorImpl descriptor1 = new TynamoPropertyDescriptorImpl(Foo.class, "foo", String.class);
    descriptor1.addExtension(testExtension, descriptorExtension);

    TynamoPropertyDescriptorImpl descriptor2 = (TynamoPropertyDescriptorImpl) descriptor1.clone();

    assertTrue(descriptor2.supportsExtension(testExtension));
    assertEquals(descriptorExtension, descriptor2.getExtension(testExtension));
}