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:au.com.pnspvtltd.mcd.service.impl.DealerServiceImpl.java

@Override
@Transactional// w ww  . java  2  s  .  c o m
public DealerVO updateDealer(DealerVO dealerVO) {
    Dealer dealerToUpdate = dealerRepository.findOne(dealerVO.getDealerId());

    if (dealerToUpdate == null) {
        LOGGER.debug("Dealer with id {} does not exist", dealerVO.getDealerId());
        return null;
    }

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

    Dealer dealer = dealerRepository.save(dealerToUpdate);
    return domainModelUtil.fromDealer(dealer, true);

}

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

/**
 * /*from   w  ww  .  j  a  v a  2 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());

            biospecimenUidTxtFld = new TextField<String>("biospecimen.biospecimenUid",
                    new PropertyModel(item.getModelObject(), "biospecimen.biospecimenUid"));

            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(biospecimenUidTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    // Check BiospecimenUID is unique
                    String biospecimenUid = (getComponent().getDefaultModelObject().toString() != null
                            ? getComponent().getDefaultModelObject().toString()
                            : new String());
                    Biospecimen biospecimen = iLimsService.getBiospecimenByUid(biospecimenUid,
                            item.getModelObject().getBiospecimen().getStudy());
                    if (biospecimen != null && biospecimen.getId() != null) {
                        ManualBatchCreateBiospecimenForm.this
                                .error("Biospecimen UID must be unique. Please try again.");
                        target.focusComponent(getComponent());
                    }
                    target.add(feedbackPanel);
                }
            }));

            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 {
                        PropertyUtils.copyProperties(batchBiospecimenVo.getBiospecimen(),
                                item.getModelObject().getBiospecimen());
                        batchBiospecimenVo.getBiospecimen().setBiospecimenUid(new String());
                        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:org.hfoss.posit.android.sync.Communicator.java

/**
 * //from  w ww  . j  ava2  s .c o m
 * Retrieve finds from the server using a Communicator.
 * 
 * @param serverGuids
 * @return
 */
public static boolean getFindsFromServer(Context context, String authKey, String serverGuids) {
    String guid;
    int rows = 0;
    StringTokenizer st = new StringTokenizer(serverGuids, ",");

    while (st.hasMoreElements()) {
        guid = st.nextElement().toString();
        ContentValues cv = getRemoteFindById(context, authKey, guid);

        if (cv == null) {
            return false; // Shouldn't be null--we know its ID
        } else {
            Log.i(TAG, cv.toString());
            try {

                // Find out what Find class POSIT is configured for
                Class<? extends Find> findClass = FindPluginManager.mFindPlugin.getmFindClass();

                Log.i(TAG, "Find class = " + findClass.getSimpleName());

                // Update the DB
                Find find = DbHelper.getDbManager(context).getFindByGuid(guid);
                if (find != null) {
                    Log.i(TAG, "Updating existing find: " + find.getId());
                    Find updatedFind = findClass.newInstance();
                    updatedFind.updateObject(cv);

                    //                  Find updatedFind = (OutsideInFind)find;
                    //                  ((OutsideInFind) updatedFind).updateObject(cv);
                    updatedFind.setId(find.getId());
                    rows = DbHelper.getDbManager(context).updateWithoutHistory(updatedFind);
                } else {
                    //   find = new OutsideInFind();
                    find = findClass.newInstance();
                    Log.i(TAG, "Inserting new find: " + find.getId());
                    find.updateObject(cv);
                    //                  ((OutsideInFind) find).updateObject(cv);
                    Log.i(TAG, "Adding a new find " + find);
                    rows = DbHelper.getDbManager(context).insertWithoutHistory(find);
                }
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    DbHelper.releaseDbManager();
    return rows > 0;
}

From source file:com.android.emailcommon.provider.EmailContent.java

static public <T extends EmailContent> T getContent(final Context context, final Cursor cursor,
        final Class<T> klass) {
    try {//w w w .ja  v  a 2  s .c  o m
        T content = klass.newInstance();
        content.mId = cursor.getLong(0);
        content.restore(context, cursor);
        return content;
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    }
    return null;
}

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

public int isConnectionFound() {
    List localList = ((WifiManager) getSystemService("wifi")).getConfiguredNetworks();
    if (localList == null) {
        Util.log(this.mLogger, "No networks in the network list.  (So the network isn't found.)");
        return -1;
    }/*from  www.  j av  a2  s .  c o  m*/
    if (this.mParser == null) {
        Util.log(this.mLogger, "Parser isn't bound in isConnectionFound()!");
        return -2;
    }
    if (this.mParser.selectedProfile == null) {
        Util.log(this.mLogger, "No profile is selected in isConnectionFound()!");
        return -2;
    }
    if (this.mFailure == null) {
        Util.log(this.mLogger, "Failure class is null in isConnectionFound()!");
        return -2;
    }
    Util.log(this.mLogger,
            "Your device currently has " + localList.size() + " wireless network(s) configured.");
    int i = 0;
    if (i < localList.size()) {
        WifiConfigurationProxy localWifiConfigurationProxy;
        SettingElement localSettingElement;
        try {
            localWifiConfigurationProxy = new WifiConfigurationProxy((WifiConfiguration) localList.get(i),
                    this.mLogger);
            localSettingElement = this.mParser.selectedProfile.getSetting(1, 40001);
            if (localSettingElement == null) {
                Util.log(this.mLogger, "Unable to locate the SSID element!");
                this.mFailure.setFailReason(FailureReason.useErrorIcon, getResources()
                        .getString(this.mParcelHelper.getIdentifier("xpc_no_ssid_defined", "string")), 6);
                return -2;
            }
        } catch (IllegalArgumentException localIllegalArgumentException) {
            Util.log(this.mLogger, "IllegalArgumentException in isConnectionFound()!");
            localIllegalArgumentException.printStackTrace();
            return -2;
        } catch (NoSuchFieldException localNoSuchFieldException) {
            Util.log(this.mLogger, "NoSuchFieldException in isConnectionFound()!");
            localNoSuchFieldException.printStackTrace();
            return -2;
        } catch (ClassNotFoundException localClassNotFoundException) {
            Util.log(this.mLogger, "ClassNotFoundException in isConnectionFound()!");
            localClassNotFoundException.printStackTrace();
            return -2;
        } catch (IllegalAccessException localIllegalAccessException) {
            Util.log(this.mLogger, "IllegalAccessException in isConnectionFound()!");
            localIllegalAccessException.printStackTrace();
            return -2;
        }
        String[] arrayOfString;
        if (localSettingElement.additionalValue != null) {
            arrayOfString = localSettingElement.additionalValue.split(":");
            if (arrayOfString.length != 3) {
                Util.log(this.mLogger, "The SSID element provided in the configuration file is invalid!");
                this.mFailure.setFailReason(FailureReason.useErrorIcon, getResources()
                        .getString(this.mParcelHelper.getIdentifier("xpc_ssid_element_invalid", "string")), 6);
                return -2;
            }
            if (this.mParser.savedConfigInfo != null)
                this.mParser.savedConfigInfo.ssid = arrayOfString[2];
            if (localWifiConfigurationProxy.getSsid() != null)
                break label429;
            Util.log(this.mLogger, "SSID was null parsing network string.");
        }
        label429: while (!localWifiConfigurationProxy.getSsid().equals("\"" + arrayOfString[2] + "\"")) {
            i++;
            break;
        }
        Util.log(this.mLogger, "Our SSID already exists.  It will be replaced.");
        return localWifiConfigurationProxy.getNetworkId();
    }
    return -1;
}

From source file:org.opennms.features.reporting.repository.remote.DefaultRemoteRepository.java

private List<BasicReportDefinition> mapSDOListToBasicReportList(List<RemoteReportSDO> remoteReportSDOList) {
    List<BasicReportDefinition> resultList = new ArrayList<BasicReportDefinition>();
    for (RemoteReportSDO report : remoteReportSDOList) {
        SimpleJasperReportDefinition result = new SimpleJasperReportDefinition();
        try {/*  ww  w .j av a  2  s .  c o m*/
            BeanUtils.copyProperties(result, report);
            result.setId(m_remoteRepositoryDefintion.getRepositoryId() + "_" + result.getId());
        } catch (IllegalAccessException e) {
            logger.debug(
                    "SDO to BasicReport mapping IllegalAssessException while copyProperties from '{}' to '{}' with exception.",
                    report, result);
            logger.error(
                    "SDO to BasicReport mapping IllegalAssessException while copyProperties '{}' RepositoryURI: '{}'",
                    e, m_remoteRepositoryDefintion.getURI());
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            logger.debug(
                    "SDO to BasicReport mapping InvocationTargetException while copyProperties from '{}' to '{}' with exception.",
                    report, result);
            logger.error(
                    "SDO to BasicReport mapping InvocationTargetException while copyProperties '{}' RepositoryURI: '{}'",
                    e, m_remoteRepositoryDefintion.getURI());
            e.printStackTrace();
        }

        logger.debug("SDO to BasicReport mapping got: '{}'", report.toString());
        resultList.add(result);
    }
    logger.debug("SDO to BasicReport mapping returns resultList: '{}'", resultList.toString());
    return resultList;
}

From source file:hd3gtv.mydmam.db.orm.CassandraOrm.java

public T pullObject(String rowkey, ColumnList<String> columnlist) {
    if (rowkey == null) {
        return null;
    }/*w  w w.ja v  a2s.c o m*/
    if (rowkey.equals("")) {
        return null;
    }
    if (columnlist.size() == 0) {
        return null;
    }

    T recevier = createOrmObject();
    recevier.key = rowkey;

    ArrayList<Field> fields = getOrmobjectUsableFields();
    Field field;
    Object o;
    for (int pos_df = 0; pos_df < fields.size(); pos_df++) {
        try {
            field = fields.get(pos_df);
            o = pullColumn(columnlist, field);
            if (o == null) {
                continue;
            }
            field.set(recevier, o);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvalidClassException e) {
            e.printStackTrace();
        }
    }
    return recevier;
}

From source file:com.facebook.litho.DebugComponent.java

/**
 * @return Key-value mapping of this components props.
 *//* w  ww  .ja  va 2s .c  om*/
public Map<String, Pair<Prop, Object>> getProps() {
    final InternalNode node = mNode.get();
    final Component component = node == null || node.getComponents().isEmpty() ? null
            : node.getComponents().get(mComponentIndex);
    if (component == null) {
        return Collections.EMPTY_MAP;
    }

    final Map<String, Pair<Prop, Object>> props = new ArrayMap<>();
    final ComponentLifecycle.StateContainer stateContainer = component.getStateContainer();

    for (Field field : component.getClass().getDeclaredFields()) {
        try {
            field.setAccessible(true);
            final Prop propAnnotation = field.getAnnotation(Prop.class);
            if (propAnnotation != null) {
                final Object value = field.get(component);
                if (value != stateContainer && !(value instanceof ComponentLifecycle)) {
                    props.put(field.getName(), new Pair<>(propAnnotation, value));
                }
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    return props;
}

From source file:com.facebook.litho.DebugComponent.java

/**
 * @return Key-value mapping of this components state.
 *//*from   w ww  .j a  v  a 2s.c om*/
public Map<String, Object> getState() {
    final InternalNode node = mNode.get();
    final Component component = node == null || node.getComponents().isEmpty() ? null
            : node.getComponents().get(mComponentIndex);
    if (component == null) {
        return Collections.EMPTY_MAP;
    }

    final ComponentLifecycle.StateContainer stateContainer = component.getStateContainer();
    if (stateContainer == null) {
        return Collections.EMPTY_MAP;
    }

    final Map<String, Object> state = new ArrayMap<>();

    for (Field field : stateContainer.getClass().getDeclaredFields()) {
        try {
            field.setAccessible(true);
            if (field.getAnnotation(State.class) != null) {
                final Object value = field.get(stateContainer);
                if (!(value instanceof ComponentLifecycle)) {
                    state.put(field.getName(), value);
                }
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    return state;
}

From source file:org.durka.hallmonitor.CoreStateManager.java

public void sendToCoreService(Intent mIntent) {
    if (startCoreServiceAsUser != null) {
        try {//from w  w w . j  a  v  a  2 s.  c o  m
            startCoreServiceAsUser.invoke(mCoreService, mIntent, android.os.Process.myUserHandle());
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    } else {
        Log.w(LOG_TAG, "No CoreService registred");
    }
}