List of usage examples for java.lang NoSuchMethodException printStackTrace
public void printStackTrace()
From source file:com.jroossien.boxx.util.entity.EntityParser.java
public EntityParser(EEntity eentity) { if (eentity == null || eentity.bukkit() == null) { return;/*from ww w . j a v a 2 s. c o m*/ } this.entities = new EntityStack(eentity); if (entities.getAmount() < 1) { return; } List<String> entitySections = new ArrayList<>(); for (EEntity entity : entities.getEntities()) { List<String> sections = new ArrayList<>(); sections.add(EntityTypes.getName(entity.getType())); for (EntityTag tag : EntityTag.getTags(entity.getType())) { if (tag.hasCallback()) { String result = tag.getCallback().onGet(entity); if (result == null || result.isEmpty()) { continue; } if (!result.toLowerCase().contains(tag.getTag().toLowerCase() + ":")) { result = Str.escapeWords(Str.escapeQuotes(result)); } else { result = Str.escapeQuotes(result); } sections.add(tag.getTag().toLowerCase() + ":" + result); } else { if (tag.getMethod() == null || tag.getMethod().isEmpty() || tag.getMethod().equalsIgnoreCase("null")) { continue; } try { Object result = MethodUtils.invokeMethod(entity, tag.getMethod(), new Class[0]); if (result == null) { continue; } SingleOption option = (SingleOption) tag.getOption().clone(); if (!option.parse(result)) { Boxx.get().warn("Failed to parse entity data! [tag=" + tag.getTag() + " value=" + result.toString() + " error='" + option.getError() + "']"); continue; } if (option.getValue().equals(option.getDefault())) { continue; } String val = option.serialize(); if (option instanceof DoubleO) { val = ((DoubleO) option).serialize(2); } val = Str.escapeWords(Str.escapeQuotes(val)); sections.add(tag.getTag().toLowerCase() + ":" + val); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } entitySections.add(Str.implode(sections, " ")); } LocationO location = new LocationO(); location.parse(entities.getBottom().getLocation()); this.string = Str.implode(entitySections, " > ") + " loc:" + location.serialize(2); }
From source file:iha_au.ppmonitor.Services.BleService.java
/** * Nr BleService bliver startet kaldes onCreate. Det er her alle attributter bliver instantieret. */// w w w.java 2 s .co m @Override public void onCreate() { // BluetoothManager bruges til at manage og tilg BlueToothAdapter. bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); // BlueToothAdapter reprsentere enhedens lokale bluetoothadapter. Det er denne klasse, som bruges til at kalde Bluetooth tasks. mBluetoothAdapter = bluetoothManager.getAdapter(); // Gennem denne klasse kan der scannes for Low Energy Bluetooth apparater. bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner(); hasBle = getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); //Metode til afkodning af UUIDS, da disse en collection af bytes. afkodes de til string, for nemmere sammenligning. try { getUuidsMethod = mBluetoothAdapter.getClass().getDeclaredMethod("getUuids", null); } catch (NoSuchMethodException e) { e.printStackTrace(); } Log.v("DEBUG", "bleservce is started"); super.onCreate(); }
From source file:com.teotigraphix.caustk.sound.SoundSource.java
@SuppressWarnings("unchecked") @Override/*from w w w . j av a2 s. c om*/ public <T extends Tone> T createTone(int index, String name, Class<? extends Tone> toneClass) throws CausticException { T tone = null; try { Constructor<? extends Tone> constructor = toneClass.getConstructor(ICaustkController.class); tone = (T) constructor.newInstance(getController()); initializeTone(tone, name, tone.getToneType(), index); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } SoundSourceUtils.setup(toneClass.cast(tone)); RackMessage.CREATE.send(getController(), tone.getToneType().getValue(), tone.getName(), tone.getIndex()); toneAdd(index, tone); return tone; }
From source file:org.durka.hallmonitor.CoreService.java
@Override public void onCreate() { Log.d(LOG_TAG + ".oC", "Core service creating"); localCoreService = this; mStateManager = ((CoreApp) getApplicationContext()).getStateManager(); Log.d(LOG_TAG + ".oC", "Register special actions"); mStateManager.registerCoreService(this); mStateManager.registerCoreReceiver(); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); HandlerThread thread = new HandlerThread("ServiceStartArguments", Process.THREAD_PRIORITY_BACKGROUND); thread.start();/*from w ww. ja va2s .c om*/ // Get the HandlerThread's Looper and use it for our Handler mTouchCoverLooper = thread.getLooper(); mTouchCoverHandler = new TouchCoverHandler(mTouchCoverLooper); lastTouchCoverRequest = mStateManager.getCoverClosed(); try { startActivityAsUser = ((ContextWrapper) this).getClass().getMethod("startActivityAsUser", Intent.class, UserHandle.class); Log.d(LOG_TAG, "startActivityAsUser registred"); } catch (NoSuchMethodException e) { e.printStackTrace(); } launchDefaultActivity = new Intent(localCoreService, DefaultActivity.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); mUserHandle = android.os.Process.myUserHandle(); }
From source file:uk.org.catnip.eddie.parser.BaseSAXParser.java
/** * Look for a method to deal with the end of the current element * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) *//*from w ww. java 2s .co m*/ public void endElement(final String uri, final String localName, final String qName) throws SAXException { State state = new State(uri, localName, qName); State prev = getCurrentState(); if (log.isTraceEnabled()) { log.trace("end_element: " + state); } if (in_content > 0 && "escaped".equals(prev.getMode()) && prev.content) { prev.setMode("xml"); } if (in_content > 0 && "xml".equals(prev.getMode()) && prev.content) { String data = pop(localName); handle_data(prev, data + Sanitize.clean_html_end(state.getElement()), false); return; } try { this.getClass().getMethod("endElement_" + state.getElement(), (Class[]) null).invoke(this, (Object[]) null); } catch (NoSuchMethodException e) { log.trace("unhandled element " + state.getElement()); pop(state.getElement()); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.sip.pwc.sipphone.ui.outgoingcall.OutgoingAccountsAdapter.java
@SuppressWarnings("deprecation") private void setRowViewAlpha(View v, float alpha) { if (Compatibility.isCompatible(11)) { // In honeycomb or upper case, use the new setAlpha method if (setAlphaMethod == null) { try { setAlphaMethod = View.class.getDeclaredMethod("setAlpha", float.class); } catch (NoSuchMethodException e) { // Ignore not found set alpha class. }/*from www.j a va 2 s.c o m*/ } if (setAlphaMethod != null) { //UtilityWrapper.safelyInvokeMethod(setAlphaMethod, v, alpha); //change tqc try { setAlphaMethod.invoke(v, alpha); } catch (Exception e) { e.printStackTrace(); } } } else { // Try to set alpha on each component TextView tv; tv = (TextView) v.findViewById(R.id.AccTextView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); tv = (TextView) v.findViewById(R.id.AccTextStatusView); tv.setTextColor(tv.getTextColors().withAlpha((int) (255 * alpha))); ImageView img = (ImageView) v.findViewById(R.id.wizard_icon); img.setAlpha((int) (255 * alpha)); } }
From source file:com.appeaser.sublimepickerlibrary.datepicker.DayPickerViewPager.java
private void initializePopulateMethod() { try {/*from www . j av a 2 s .c o m*/ mPopulateMethod = ViewPager.class.getDeclaredMethod("populate", (Class[]) null); mPopulateMethod.setAccessible(true); } catch (NoSuchMethodException nsme) { nsme.printStackTrace(); } mAlreadyTriedAccessingMethod = true; }
From source file:com.opengsn.controller.client.ControllerClient.java
/** * Use the commandline args to invoke the proper service client and * operation using Reflection/* ww w . j a v a 2s . c om*/ * * @param args */ private void process(String[] args) { Class<?> c = this.getClass(); try { // Class<?> c = // Class.forName("com.greenstarnetwork.controller.client.ControllerWrapper"); // Use reflection to call the service and operation that was given // from the command line Object obj = c.newInstance(); @SuppressWarnings("rawtypes") Class[] argTypes = new Class[] { String[].class }; Method m = c.getDeclaredMethod(args[0], argTypes); String[] methodArgs = Arrays.copyOfRange(args, 1, args.length); System.out.println("invoking Operation: " + c.getName() + "." + m.getName()); m.invoke(obj, (Object) methodArgs); } catch (NoSuchMethodException e) { System.out.println("Invalid Operation: " + args[1]); System.out.println("Operations for the " + c.getName() + ": "); Method[] allMethods = c.getDeclaredMethods(); for (Method m : allMethods) { System.out.println(" " + m.getName()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.Microsoft.Telemetry.IntermediateHistoryStore.java
@Override protected void serviceInit(Configuration conf) throws Exception { try {/* www. ja va 2 s . c om*/ //Method m = originalStorage.getClass().getDeclaredMethod("serviceInit", Configuration.class); Method m = originalStorage.getClass().getMethod("serviceInit", Configuration.class); m.setAccessible(true); m.invoke(originalStorage, (Object) conf); } catch (NoSuchMethodException noSuchMethodException) { LOG.error(PATTERN_LOG_ERROR + "no Such Method Exception :", noSuchMethodException); noSuchMethodException.printStackTrace(); } catch (SecurityException securityException) { LOG.error(PATTERN_LOG_ERROR + "Security Exception :", securityException); securityException.printStackTrace(); } catch (IllegalAccessException illegalAccessException) { LOG.error(PATTERN_LOG_ERROR + "Illegal Access Exception :", illegalAccessException); illegalAccessException.printStackTrace(); } catch (IllegalArgumentException illegalArgumentException) { LOG.error(PATTERN_LOG_ERROR + "Illegal Argument Exception :", illegalArgumentException); illegalArgumentException.printStackTrace(); } catch (InvocationTargetException invocationTargetException) { Throwable cause = invocationTargetException.getCause(); LOG.error(PATTERN_LOG_ERROR + "Invocation Target Exception failed because of:" + cause.getMessage(), invocationTargetException); invocationTargetException.printStackTrace(); } }
From source file:com.github.akinaru.rfdroid.bluetooth.BluetoothCustomManager.java
/** * Scan new Bluetooth device/*w ww . j a v a 2 s .c om*/ */ @SuppressLint("NewApi") public boolean scanLeDevice(int scanIntervalMillis, int scanWindowMillis) { if (!scanning) { broadcastUpdate(BluetoothEvents.BT_EVENT_SCAN_START); scanning = true; try { Method scanLeWithParameters = mBluetoothAdapter.getClass().getMethod("startLeScan", UUID[].class, int.class, int.class, Class.forName("android.bluetooth.BluetoothAdapter$LeScanCallback")); return (Boolean) scanLeWithParameters.invoke(mBluetoothAdapter, null, scanIntervalMillis, scanWindowMillis, scanCallback); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return false; } return false; }