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:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.SingleNucleotideVariantExperimentModel.java

@NotifyChange({ "currentHFilter" })
@Command/*from  ww  w. j ava2s .  c o  m*/
public void editHardFilter(@BindingParam("hardfilter") HardFilter hardfilter) {
    this.editHardFilter = true;
    this.currentHFilter = hardfilter;
    this.currentTmpHFilter = new HardFilter();
    try {
        BeanUtils.copyProperties(this.currentTmpHFilter, this.currentHFilter);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:eu.comvantage.dataintegration.QueryDistributionServiceImpl.java

private void handleSPARQLrequest(String query, int limit, int offset, String format, String[] roles,
        HttpServletResponse response) throws IOException {
    //locale variables
    String outstream = "";
    boolean debugModeEnabled = SystemParameterManager.debugModeEnabled();
    boolean acModeEnabled = SystemParameterManager.useAccessControlFeatures();
    boolean bypassRoleMatched = false;

    //Very if one of the received roles matches the ac bypass role
    String acBypassRole = SystemParameterManager.getACBypassRole();
    for (int i = 0; i < roles.length; i++) {
        if (acBypassRole.equalsIgnoreCase(roles[i]))
            bypassRoleMatched = true;//from  w w w  . j  a  v a 2 s .co  m
    }

    //TODO:Remove debug mode output
    if (debugModeEnabled) {
        outstream += "<h1>!!! ATTENTION !!! DEBUG MODE ENABLED !!! </h1>(remove param 'debug_mode = true' from domain configuration)</br></br>";
        outstream += "Query: " + StringEscapeUtils.escapeHtml(query) + "</br>";
        outstream += "Access control mode enabled: " + acModeEnabled + "</br>";
        outstream += "Received roles (" + roles.length + "):</br>";
        for (int i = 0; i < roles.length; i++) {
            outstream += "Role " + String.valueOf(i + 1) + ": " + roles[i] + "</br>";
        }
        if (bypassRoleMatched)
            outstream += "</br>Bypass role (" + acBypassRole + ") matched!</br>";
        else
            outstream += "</br>Bypass role (" + acBypassRole + ") NOT matched!</br>";
    }

    //Rewrite query for access authorization
    SparqlRewriter rewriter;
    String rewrittenSparqlQuery = "";
    try {
        rewriter = SparqlRewriterFactory.getSparqlRewriter();

        if (acModeEnabled && roles.length > 0 && !bypassRoleMatched) {
            //TODO:Remove debug mode output
            if (debugModeEnabled)
                outstream += "QueryDistributionService: Rewriting SPARQL request performed!</br>";
            rewrittenSparqlQuery = rewriter.rewrite(query, roles);

            //TODO:Remove debug mode output
            if (debugModeEnabled)
                outstream += "QueryDistributionService: Rewritten query = "
                        + StringEscapeUtils.escapeHtml(rewrittenSparqlQuery) + "</br></br>";
        } else {
            //TODO:Remove debug mode output
            if (debugModeEnabled)
                outstream += "QueryDistributionService: Rewriting SPARQL request skipped!</br></br>";
            rewrittenSparqlQuery = query;
        }
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    //Create a distributed request for all (relevant|connected) data sources
    DistributedRequestFactory drfactory = new DistributedRequestFactory();
    DistributedRequest disRequest = drfactory.createSPARQLRequestForAllSources(rewrittenSparqlQuery);

    if (disRequest.getRequestList().size() == 0) {
        response.setStatus(500);
        print("QueryDistributionServiceImpl.handleSPARQLrequest: No data sources are registered", response);
        return;
    }

    //Execute the query
    QueryResultSet results = new QueryResultSet();
    DistributedRequestExecutionManager dreManager = new DistributedRequestExecutionManager();
    results = dreManager.handleSPARQLRequest(disRequest, limit, offset);

    //create data transfer object
    Map<String, Object> dto = new HashMap<String, Object>();
    Map<String, Object> head = new HashMap<String, Object>();
    head.put("vars", results.getVariables());
    dto.put("head", head);
    dto.put("results", results);

    //Handle query result for different format options
    if (format.equals("application/json")) {
        // format JSON
        Gson gson = new Gson();
        outstream += gson.toJson(dto);
        response.setStatus(200);
    } else if (format.equals("application/xml")) {
        // format XML
        outstream += "Content type application/xml not supported, please use 'application/json' instead";
        response.setStatus(500);
    } else if (format.equals("text/plain")) {
        // format plain text
        outstream += "Content type text/plain not supported, please use 'application/json' instead";
        response.setStatus(500);
    } else {
        // unknown format used
        outstream += "The selected content type '" + format
                + "' is unknown, please use 'application/json' instead";
        response.setStatus(500);
    }

    //Print result to servlet output stream
    print(outstream, response);
}

From source file:com.mysql.stresstool.RunnableQueryDelete.java

@Override
public void setClassConfiguration(Map mConfig) {
    classConfig = mConfig;/*from w  w w.  ja v  a2  s  . co m*/

    for (int i = 0; i < CLASS_PARAMETERS.size(); i++) {
        try {
            String methodName = (String) CLASS_PARAMETERS.get(i);
            methodName = methodName.substring(0, 1).toUpperCase()
                    + methodName.substring(1, methodName.length());
            methodName = "set" + methodName;

            String valueM = (String) classConfig.get(CLASS_PARAMETERS.get(i));
            //            System.out.println(methodName + " = " + valueM);

            if (valueM != null) {
                if (valueM.equals("true") || valueM.equals("false")) {
                    MethodUtils.invokeMethod(this, methodName, Boolean.parseBoolean(valueM));
                } else if (Utils.isNumeric(valueM)) {

                    MethodUtils.invokeMethod(this, methodName, Integer.parseInt(valueM));
                } else if (Utils.isDouble(valueM)) {

                    MethodUtils.invokeMethod(this, methodName, Double.parseDouble(valueM));
                }

                else
                    //               PropertyUtils.setProperty(this,methodName,valueM);
                    //                     MethodUtils.setCacheMethods(false);
                    MethodUtils.invokeMethod(this, methodName, valueM);
            }

        } 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();
        }

    }

}

From source file:corner.orm.tapestry.component.gain.GainPoint.java

/**
 * ???entity//  w ww  . j av a 2  s  . co m
 */
private <T> void neatenPersistentEntity() {

    this.setSaveOrUpdateEntitys(new ArrayList<T>());

    this.setDeleteEntitys(new ArrayList<T>());

    this.setEntitys(new ArrayList<Object>());

    String foregroundList[] = this.getPage().getRequestCycle().getParameters(this.getPagePersistentId());

    String id = null;

    for (Object entity : this.getSource()) { // ?entity
        try {
            id = (String) PropertyUtils.getProperty(entity, this.getPersistentId());
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        this.getDeleteEntitys().add(entity); // 

        if (foregroundList != null && foregroundList.length > 0) {//null?
            for (String s : foregroundList) {
                if (id.equals(s)) {
                    this.getDeleteEntitys().remove(this.getDeleteEntitys().size() - 1); // ??
                    this.getEntitys().add(entity);
                }
            }
        }
    }
}

From source file:corner.orm.tapestry.component.gain.GainPoint.java

/**
 * json/*from ww w  .ja v a  2  s .c om*/
 * @param elements
 */
private JSONObject getJSONElementValues() {

    JSONObject json = new JSONObject();

    JSONArray elementValues = null;

    String tpn = null;

    for (String propertyName : this.getEntityPropertys()) { //????

        elementValues = new JSONArray();

        for (Object entity : this.getSource()) {
            try {
                tpn = propertyName;
                if (getPagePersistentId().equals(propertyName)) {
                    tpn = getPersistentId();
                }
                elementValues.put(PropertyUtils.getProperty(entity, tpn));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
        }

        json.put(propertyName, elementValues);
    }

    return json;
}

From source file:corner.orm.tapestry.component.gain.GainPoint.java

/**
 * /*from  w ww . ja va2  s  .c o m*/
 */
private void delNullEntity() {
    String prop = this.getShowPropertys().replace(this.getPagePersistentId(), getPersistentId());
    String entityPropertys[] = prop.split(",");
    int count = 0;
    Object obj = null;

    List nulllist = new ArrayList();

    for (Object bean : getSaveOrUpdateEntitys()) {
        count = 0;
        for (String name : entityPropertys) {
            try {
                obj = PropertyUtils.getProperty(bean, name);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }

            if (obj == null || obj.toString() == "") {
                count++;
            }

            if (count == entityPropertys.length) {
                nulllist.add(bean);
            }
        }
    }

    for (Object bean : nulllist) {
        getSaveOrUpdateEntitys().remove(bean);
    }
}

From source file:org.kuali.kra.budget.calculator.QueryList.java

/** calculates the sum of the field in this QueryList.
 * @param fieldName field of bean whose sum has to be calculated.
 * @param arg argument for the getter method of field if it takes any argumnt,
 * else can be null.//w w  w. j  av a2s.  c o m
 * @param value value for the argument, else can be null.
 * @return returns sum.
 */
public double sum(String fieldName, Class arg, Object value) {
    if (size() == 0) {
        return 0;
    }

    Object current;
    Field field = null;
    Method method = null;
    Class dataClass = get(0).getClass();
    double sum = 0;

    try {
        field = dataClass.getDeclaredField(fieldName);

        Class fieldClass = field.getType();
        if (!(fieldClass.equals(Integer.class) || fieldClass.equals(Long.class)
                || fieldClass.equals(Double.class) || fieldClass.equals(Float.class)
                || fieldClass.equals(BigDecimal.class) || fieldClass.equals(BigInteger.class)
                || fieldClass.equals(BudgetDecimal.class) || fieldClass.equals(KualiDecimal.class)
                || fieldClass.equals(int.class) || fieldClass.equals(long.class)
                || fieldClass.equals(float.class) || fieldClass.equals(double.class))) {
            throw new UnsupportedOperationException("Data Type not numeric");
        }

        if (!field.isAccessible()) {
            throw new NoSuchFieldException();
        }
    } catch (NoSuchFieldException noSuchFieldException) {
        try {
            String methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1);
            if (arg != null) {
                Class args[] = { arg };
                method = dataClass.getMethod(methodName, args);
            } else {
                method = dataClass.getMethod(methodName, null);
            }
        } catch (NoSuchMethodException noSuchMethodException) {
            noSuchMethodException.printStackTrace();
        }
    }

    for (int index = 0; index < size(); index++) {
        current = get(index);

        try {
            if (field != null && field.isAccessible()) {
                sum = sum + Double.parseDouble(((Comparable) field.get(current)).toString());
            } else {
                Comparable dataValue;
                if (value != null) {
                    Object values[] = { value };
                    dataValue = (Comparable) method.invoke(current, values);
                } else {
                    dataValue = (Comparable) method.invoke(current, null);
                }
                if (dataValue != null) {
                    sum += Double.parseDouble(dataValue.toString());
                }

            }
        } catch (IllegalAccessException illegalAccessException) {
            illegalAccessException.printStackTrace();
        } catch (InvocationTargetException invocationTargetException) {
            invocationTargetException.printStackTrace();
        }
    }
    return sum;
}

From source file:org.springframework.data.jpa.repository.support.SimpleJpaRepository.java

@Transactional
public <S extends T> S save(S entity) {

    if (entityInformation.isNew(entity)) {
        em.persist(entity);// w  ww  .  j a v  a 2 s .  c  o m
        return entity;
    } else {
        T oldEntity = this.findOne((ID) (entityInformation.getId(entity)));
        if (oldEntity != null) {
            PropertyDescriptor[] pds = org.springframework.beans.BeanUtils
                    .getPropertyDescriptors(getDomainClass());
            List<String> ignore = new ArrayList<String>();
            for (PropertyDescriptor pd : pds) {
                try {
                    String v = BeanUtils.getProperty(entity, pd.getName());
                    if (v == null)
                        ignore.add(pd.getName());
                } 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();
                }
            }
            org.springframework.beans.BeanUtils.copyProperties(entity, oldEntity,
                    ignore.toArray(new String[] {}));
            entity = (S) oldEntity;
        }
        return em.merge(entity);
    }
}

From source file:au.org.theark.lims.web.component.biospecimen.batchcreate.form.AutoGenBatchCreateBiospecimenForm.java

/**
 * // w  ww .  j ava2  s .co  m
 * @return the listEditor of BatchBiospecimen(s)
 */
public AbstractListEditor<BatchBiospecimenVO> buildListEditor() {
    listEditor = new AbstractListEditor<BatchBiospecimenVO>("batchBiospecimenList",
            new PropertyModel(this, "batchBiospecimenList")) {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("serial")
        @Override
        protected void onPopulateItem(final ListItem<BatchBiospecimenVO> item) {
            item.setOutputMarkupId(true);
            item.getModelObject().getBiospecimen()
                    .setLinkSubjectStudy(cpModel.getObject().getLinkSubjectStudy());
            item.getModelObject().getBiospecimen()
                    .setStudy(cpModel.getObject().getLinkSubjectStudy().getStudy());

            numberToCreateTxtFld = new TextField<Number>("numberToCreate",
                    new PropertyModel(item.getModelObject(), "numberToCreate"));

            initBioCollectionDdc(item);
            initSampleTypeDdc(item);

            sampleDateTxtFld = new DateTextField("biospecimen.sampleDate",
                    new PropertyModel(item.getModelObject(), "biospecimen.sampleDate"),
                    au.org.theark.core.Constants.DD_MM_YYYY);
            ArkDatePicker sampleDatePicker = new ArkDatePicker();
            sampleDatePicker.bind(sampleDateTxtFld);
            sampleDateTxtFld.add(sampleDatePicker);

            quantityTxtFld = new TextField<Double>("biospecimen.quantity",
                    new PropertyModel(item.getModelObject(), "biospecimen.quantity")) {
                private static final long serialVersionUID = 1L;

                @Override
                public <C> IConverter<C> getConverter(Class<C> type) {
                    DoubleConverter doubleConverter = new DoubleConverter();
                    NumberFormat numberFormat = NumberFormat.getInstance();
                    numberFormat.setMinimumFractionDigits(1);
                    doubleConverter.setNumberFormat(getLocale(), numberFormat);
                    return (IConverter<C>) doubleConverter;
                }
            };
            initUnitDdc(item);
            initTreatmentTypeDdc(item);
            concentrationTxtFld = new TextField<Number>("biospecimen.concentration",
                    new PropertyModel(item.getModelObject(), "biospecimen.concentration"));

            // Added onchange events to ensure model updated when any change made
            item.add(numberToCreateTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(bioCollectionDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(sampleTypeDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(sampleDateTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(quantityTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(unitDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(treatmentTypeDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));
            item.add(concentrationTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            }));

            // Copy button allows entire row details to be copied
            item.add(new AjaxEditorButton(Constants.COPY) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.add(feedbackPanel);
                }

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    BatchBiospecimenVO batchBiospecimenVo = new BatchBiospecimenVO();
                    try {
                        batchBiospecimenVo.setNumberToCreate(item.getModelObject().getNumberToCreate());
                        PropertyUtils.copyProperties(batchBiospecimenVo.getBiospecimen(),
                                item.getModelObject().getBiospecimen());
                        listEditor.addItem(batchBiospecimenVo);
                        target.add(form);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }.setDefaultFormProcessing(false));

            item.add(new AjaxEditorButton(Constants.DELETE) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.add(feedbackPanel);
                }

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    listEditor.removeItem(item);
                    target.add(form);
                }
            }.setDefaultFormProcessing(false).setVisible(item.getIndex() > 0));

            item.add(new AttributeModifier(Constants.CLASS, new AbstractReadOnlyModel() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    return (item.getIndex() % 2 == 1) ? Constants.EVEN : Constants.ODD;
                }
            }));
        }

    };
    return listEditor;
}

From source file:net.cloudpath.xpressconnect.screens.GetCredentials.java

public WifiConfigurationProxy getExistingConfig(int paramInt) {
    List localList = ((WifiManager) getSystemService("wifi")).getConfiguredNetworks();
    for (int i = 0; i < localList.size(); i++)
        if (((WifiConfiguration) localList.get(i)).networkId == paramInt)
            try {
                WifiConfigurationProxy localWifiConfigurationProxy = new WifiConfigurationProxy(
                        (WifiConfiguration) localList.get(i), this.mLogger);
                return localWifiConfigurationProxy;
            } catch (IllegalArgumentException localIllegalArgumentException) {
                Util.log(this.mLogger, "IllegalArgumentException in getExistingConfig()!");
                localIllegalArgumentException.printStackTrace();
                return null;
            } catch (NoSuchFieldException localNoSuchFieldException) {
                Util.log(this.mLogger, "NoSuchFieldException in getExistingConfig()!");
                localNoSuchFieldException.printStackTrace();
                return null;
            } catch (ClassNotFoundException localClassNotFoundException) {
                Util.log(this.mLogger, "ClassNotFoundException in getExistingConfig()!");
                localClassNotFoundException.printStackTrace();
                return null;
            } catch (IllegalAccessException localIllegalAccessException) {
                Util.log(this.mLogger, "IllegalAccessException in getExistingConfig()!");
                localIllegalAccessException.printStackTrace();
                return null;
            }/*w  w w . j a v a 2s  . co  m*/
    return null;
}