List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * Retrieves values from the View fields and stores them in a Find instance. * This method is invoked from the Save menu item. It also marks the find * 'unsynced' so it will be updated to the server. * // ww w . ja v a 2 s . com * @return a new Find object with data from the view. */ protected Find retrieveContentFromView() { // Get the appropriate find class from the plug-in // manager and make an instance of it Class<Find> findClass = FindPluginManager.mFindPlugin.getmFindClass(); Find find = null; if (getAction().equals(Intent.ACTION_EDIT) || getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { find = mFind; } else { try { find = findClass.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } } // Set GUID // NOTE: Some derived finds may not have a GUID field. But the Guid must // be // set anyway because it used as the Find ID by the Posit server. if (mGuidRealTV != null) { find.setGuid(mGuidRealTV.getText().toString()); } else { find.setGuid(UUID.randomUUID().toString()); } // Set Time if (mTimeTV != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); String value = mTimeTV.getText().toString(); if (value.length() == 10) { dateFormat = new SimpleDateFormat("yyyy/MM/dd"); } try { find.setTime(dateFormat.parse(value)); } catch (ParseException e) { e.printStackTrace(); } } // Set Name if (mNameET != null) { find.setName(mNameET.getText().toString()); } // Set Description if (mDescriptionET != null) { find.setDescription(mDescriptionET.getText().toString()); } // Set Longitude and Latitude if (mLatitudeTV != null && mLongitudeTV != null) { if (mGeoTagEnabled && (!mLatitudeTV.getText().equals("Getting latitude...") && !mLongitudeTV.getText().equals("Getting longitude..."))) { find.setLatitude(Double.parseDouble(mLatitudeTV.getText().toString())); find.setLongitude(Double.parseDouble(mLongitudeTV.getText().toString())); } else { find.setLatitude(0); find.setLongitude(0); } } if (mAdhocTV != null) { find.setIs_adhoc(Integer.parseInt((String) mAdhocTV.getText())); } // Set Project ID SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int projectId = prefs.getInt(getString(R.string.projectPref), 0); find.setProject_id(projectId); // Mark the find unsynced // find.setSynced(Find.NOT_SYNCED); return find; }
From source file:us.mn.state.health.lims.reports.action.implementation.HaitiPatientReport.java
public void setRequestParameters(BaseActionForm dynaForm) { try {//from w w w.java 2 s . c o m PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage()); PropertyUtils.setProperty(dynaForm, "useAccessionDirect", Boolean.TRUE); PropertyUtils.setProperty(dynaForm, "useHighAccessionDirect", Boolean.TRUE); PropertyUtils.setProperty(dynaForm, "usePatientNumberDirect", Boolean.TRUE); PropertyUtils.setProperty(dynaForm, "exportOptions", getExportOptions()); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } }
From source file:de.kuschku.quasseldroid_ng.ui.theme.ThemeUtil.java
@UiThread public void initColors(@NonNull ContextThemeWrapper wrapper) { try {/*from w w w . ja va2 s . c o m*/ res.colors = null; AutoBinder.bind(res, wrapper); res.bind(wrapper); AutoBinder.bind(translations, wrapper); AutoBinder.bind(chanModes, wrapper); } catch (IllegalAccessException e) { e.printStackTrace(); } }
From source file:us.mn.state.health.lims.reports.action.implementation.PatientReport.java
public void setRequestParameters(BaseActionForm dynaForm) { try {// w ww . ja v a 2 s . com PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage()); PropertyUtils.setProperty(dynaForm, "useAccessionDirect", Boolean.TRUE); PropertyUtils.setProperty(dynaForm, "useHighAccessionDirect", Boolean.TRUE); PropertyUtils.setProperty(dynaForm, "usePatientNumberDirect", Boolean.TRUE); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } }
From source file:ubic.gemma.persistence.persister.GenomePersister.java
private Chromosome persistChromosome(Chromosome chromosome, Taxon t) { if (chromosome == null) return null; if (!this.isTransient(chromosome)) return chromosome; Taxon ct = t;//www.ja v a2s .co m if (ct == null) { ct = chromosome.getTaxon(); } // note that we can't use the native hashcode method because we need to ignore the ID. int key = chromosome.getName().hashCode(); if (ct.getNcbiId() != null) { key += ct.getNcbiId().hashCode(); } else if (ct.getCommonName() != null) { key += ct.getCommonName().hashCode(); } else if (ct.getScientificName() != null) { key += ct.getScientificName().hashCode(); } if (seenChromosomes.containsKey(key)) { return seenChromosomes.get(key); } Collection<Chromosome> chroms = chromosomeDao.find(chromosome.getName(), ct); if (chroms == null || chroms.isEmpty()) { // no point in doing this if it already exists. try { FieldUtils.writeField(chromosome, "taxon", this.persist(ct), true); if (chromosome.getSequence() != null) { // cascade should do? FieldUtils.writeField(chromosome, "sequence", this.persist(chromosome.getSequence()), true); } if (chromosome.getAssemblyDatabase() != null) { FieldUtils.writeField(chromosome, "assemblyDatabase", this.persist(chromosome.getAssemblyDatabase()), true); } } catch (IllegalAccessException e) { e.printStackTrace(); } chromosome = chromosomeDao.create(chromosome); } else if (chroms.size() == 1) { chromosome = chroms.iterator().next(); } else { throw new IllegalArgumentException("Non-unique chromosome name " + chromosome.getName() + " on " + ct); } seenChromosomes.put(key, chromosome); if (chromosome == null || chromosome.getId() == null) throw new IllegalStateException("Failed to get a persistent chromosome instance"); return chromosome; }
From source file:iristk.util.Record.java
public synchronized Object get(String field) { if (field == null) return null; //if (field.contains(".")) { // System.err.println("Warning: use of dots when accessing record fields is deprecated: " + field); // field = field.replace(".", ":"); //}/* w w w . j a va2s. c om*/ if (field.contains(":")) { int i = field.indexOf(":"); String subf = field.substring(0, i); String rest = field.substring(i + 1); Object sub = get(subf); return get(sub, rest); } else { RecordInfo info = getRecordInfo(); Method getMethod = info.getMethodFields.get(field); if (getMethod != null) { try { return getMethod.invoke(this); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } Field getField = info.classFields.get(field); if (getField != null) { try { return getField.get(this); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } } if (dynamicFields.containsKey(field)) return dynamicFields.get(field); try { int i = Integer.parseInt(field); if (i < dynamicFields.size()) { return dynamicFields.values().toArray()[i]; } } catch (NumberFormatException e) { } return null; } }
From source file:de.doncarnage.minecraft.common.commandhandler.manager.impl.DefaultCommandManager.java
@Override public boolean executeCommandForString(CommandSender sender, Command command, String label, String[] args) { try {/*www .j a v a 2s.c o m*/ String commandString = buildCommandString(command, args); Node<ExtractedCommandBean> cbNode = nodeTree.resolveContentNode(commandString); ExtractedCommandBean extractedCommandBean = cbNode.getContent(); if (extractedCommandBean == null) { sendHelpToPlayer(sender, cbNode, label); return true; } if (!hasPermissions(sender, extractedCommandBean.getPermissions())) { sender.sendMessage(NO_PERMISSION); return true; } Method executable = extractedCommandBean.getExecutable(); try { CommandContext context = createContext(extractedCommandBean, command, label, args); executable.invoke(extractedCommandBean.getInstance(), sender, context); return true; } catch (IllegalAccessException e) { sendMessageToPlayer(sender, ERROR_EXECUTING_COMMAND); return true; } catch (IllegalArgumentException e) { sendMessageToPlayer(sender, ERROR_EXECUTING_COMMAND); return true; } catch (InvocationTargetException e) { if (e.getTargetException().getClass().equals(ParameterParsingException.class)) { sender.sendMessage(PARAMETER_COULD_NOT_BE_INTERPRETED); sendHelpToPlayer(sender, cbNode, label); } else { sender.getServer().getLogger().warning( String.format("An error occurred while executing the command %s", commandString)); e.printStackTrace(); sendMessageToPlayer(sender, CHECK_SYNTAX); } return true; } } catch (NodeException e) { sendMessageToPlayer(sender, COMMAND_DOES_NOT_EXIST); return true; } }
From source file:iristk.util.Record.java
public synchronized void put(String field, Object value) { if (field != null) { //if (field.contains(".")) { // System.err.println("Warning: use of dots when accessing record fields is deprecated: " + field); // field = field.replace(".", ":"); //}/* w w w.ja v a2 s. c o m*/ if (field.contains(":")) { int i = field.indexOf(":"); String fn = field.substring(0, i); String rest = field.substring(i + 1); String[] subFields; if (fn.equals("*")) { subFields = dynamicFields.keySet().toArray(new String[0]); } else { subFields = new String[] { fn }; } for (String f : subFields) { Record subRec = getRecord(f); if (subRec != null) { subRec.put(rest, value); } else { Record record = new Record(); dynamicFields.put(f, record); record.put(rest, value); } } } else if (field.equals("*")) { for (String f : dynamicFields.keySet()) { dynamicFields.put(f, value); } } else { RecordInfo info = getRecordInfo(); Method setMethod = info.setMethodFields.get(field); if (setMethod != null) { try { setMethod.invoke(this, asType(value, setMethod.getParameterTypes()[0])); return; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } Field setField = info.classFields.get(field); if (setField != null) { try { if (setField.getType().equals(java.time.LocalDate.class)) { setField.set(this, new LocalDateStringConverter().fromString((String) value)); } else if (setField.getType().equals(java.time.LocalDateTime.class)) { setField.set(this, new LocalDateTimeStringConverter().fromString((String) value)); } else { setField.set(this, asType(value, setField.getType())); } return; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } } dynamicFields.put(field, value); } } }
From source file:com.nbplus.vbroadlauncher.fragment.LauncherFragment.java
/** * when click right panel shortcdddut button ... * @param view/*from ww w. j a va 2s . c o m*/ */ @Override public void onClick(View view) { ShortcutData data = (ShortcutData) view.getTag(); VBroadcastServer serverData = LauncherSettings.getInstance(getActivity()).getServerInformation(); Intent intent; if (!NetworkUtils.isConnected(getActivity())) { ((BaseActivity) getActivity()).showNetworkConnectionAlertDialog(); return; } // push notification badge . if (data.getPushType() != null) { TextView badgeView = (TextView) view.findViewById(R.id.launcher_menu_badge); if (badgeView != null) { badgeView.setVisibility(View.GONE); } } switch (data.getType()) { case Constants.SHORTCUT_TYPE_WEB_INTERFACE_SERVER: BaseServerApiAsyncTask task; if (StringUtils.isEmptyString(serverData.getApiServer())) { showIncorrectServerInformation(); break; } data.setDomain(serverData.getApiServer()); try { task = (BaseServerApiAsyncTask) data.getNativeClass().newInstance(); if (task != null) { showProgressDialog(); task.setBroadcastApiData(getActivity(), mHandler, data.getDomain() + data.getPath()); task.execute(); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } break; case Constants.SHORTCUT_TYPE_WEB_DOCUMENT_SERVER: if (StringUtils.isEmptyString(serverData.getDocServer())) { showIncorrectServerInformation(); break; } intent = new Intent(getActivity(), BroadcastWebViewActivity.class); data.setDomain(serverData.getDocServer()); intent.putExtra(Constants.EXTRA_NAME_SHORTCUT_DATA, data); startActivity(intent); break; case Constants.SHORTCUT_TYPE_NATIVE_INTERFACE: if (StringUtils.isEmptyString(serverData.getDocServer())) { showIncorrectServerInformation(); break; } switch (data.getNativeType()) { case 0: // activity intent = new Intent(getActivity(), data.getNativeClass()); data.setDomain(serverData.getDocServer()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(Constants.EXTRA_NAME_SHORTCUT_DATA, data); startActivity(intent); break; case 1: // fragment break; case 2: // dialog fragment FragmentManager fm = getActivity().getSupportFragmentManager(); //no paramater //Class noparams[] = {}; //String parameter Class[] param = new Class[1]; param[0] = ShortcutData.class; DialogFragment fragment = null; try { Object obj = data.getNativeClass().newInstance(); Method method = data.getNativeClass().getDeclaredMethod("newInstance", param); data.setDomain(serverData.getDocServer()); fragment = (DialogFragment) method.invoke(obj, data); } catch (Exception e) { e.printStackTrace(); } if (fragment != null) { fragment.show(fm, "fragment_dialog_radio"); } break; } break; default: Log.d(TAG, "Unknown shortcut type !!!"); } }
From source file:com.nbplus.vbroadlauncher.HomeLauncherActivity.java
public void handleMessage(Message msg) { if (msg == null) { return;/*ww w . j a v a 2 s . c om*/ } switch (msg.what) { case HANDLER_MESSAGE_LAUNCHER_ACTIVITY_RUNNING: Long runningTime = (Long) msg.obj; if (runningTime > this.mActivityRunningTime) { Log.d(TAG, "HANDLER_MESSAGE_LAUNCHER_ACTIVITY_RUNNING. new activity is create.. finish"); finish(); } break; case HANDLER_ERMERGENCY_CALL_DEVICE_ACTIVATED: { // BT device 2 ? broadcast ? sleep . // if (mLastDeviceEmergencyCallSent > 0) { // long currTimeMs = System.currentTimeMillis(); // if (currTimeMs - mLastDeviceEmergencyCallSent < 120 * 1000) { // Log.d(TAG, "Already emergency call sent = " + mLastDeviceEmergencyCallSent); // return; // } // } if (mIsSendingEmergencyCall) { Log.d(TAG, "Emergency call send task already running... "); return; } BaseServerApiAsyncTask task; VBroadcastServer serverData = LauncherSettings.getInstance(this).getServerInformation(); try { task = SendEmergencyCallTask.class.newInstance(); if (task != null) { showProgressDialog(); task.setBroadcastApiData(this, mHandler, serverData.getApiServer() + getString(R.string.shortcut_addr_call_emergency)); task.execute(); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } break; } case Constants.HANDLER_MESSAGE_SEND_EMERGENCY_CALL_COMPLETE_TASK: { mIsSendingEmergencyCall = false; mLastDeviceEmergencyCallSent = System.currentTimeMillis(); BaseApiResult result = (BaseApiResult) msg.obj; Toast toast; dismissProgressDialog(); if (result != null) { Log.d(TAG, ">> EMERGENCY CALL result code = " + result.getResultCode() + ", message = " + result.getResultMessage()); if (Constants.RESULT_OK.equals(result.getResultCode())) { toast = Toast.makeText(this, R.string.emergency_call_success_message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } else { toast = Toast.makeText(this, result.getResultMessage(), Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } } else { toast = Toast.makeText(this, R.string.emergency_call_fail_message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } break; } } }