throw new AssertionError(e.getLocalizedMessage());
"Illegal argument trying to set field " + e.getLocalizedMessage()); } catch (InvocationTargetException e) { Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());
"Illegal argument trying to set field " + e.getLocalizedMessage()); } catch (InvocationTargetException e) { Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());
throw new BlenderFileException(e.getLocalizedMessage(), e); } catch (InvocationTargetException e) { throw new BlenderFileException(e.getLocalizedMessage(), e);
public static void addPropertyChangeListener(Object bean, PropertyChangeListener listener) throws NoSuchMethodException, IllegalAccessException{ try{ getAddPropertyChangeListenerMethod(bean.getClass()).invoke(bean, new Object[]{listener}); } catch(InvocationTargetException ex){ // no checked exception should have been thrown throw new InvocationTargetRuntimeException(ex.getCause(), ex.getLocalizedMessage()); } }
public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) throws NoSuchMethodException, IllegalAccessException{ try{ getRemovePropertyChangeListenerByPropertyNameMethod(bean.getClass()).invoke(bean, new Object[]{propertyName, listener}); } catch(InvocationTargetException ex){ // no checked exception should have been thrown throw new InvocationTargetRuntimeException(ex.getCause(), ex.getLocalizedMessage()); } }
public static void removePropertyChangeListener(Object bean, PropertyChangeListener listener) throws NoSuchMethodException, IllegalAccessException{ try{ getRemovePropertyChangeListenerMethod(bean.getClass()).invoke(bean, new Object[]{listener}); } catch(InvocationTargetException ex){ // no checked exception should have been thrown throw new InvocationTargetRuntimeException(ex.getCause(), ex.getLocalizedMessage()); } }
public static void addPropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) throws NoSuchMethodException, IllegalAccessException{ try{ getAddPropertyChangeListenerByPropertyNameMethod(bean.getClass()).invoke(bean, new Object[]{propertyName, listener}); } catch(InvocationTargetException ex){ // no checked exception should have been thrown throw new InvocationTargetRuntimeException(ex.getCause(), ex.getLocalizedMessage()); } }
@Override public boolean parseData(String data, Class cls, AbstractManifestClass readedClass, String methodName) { boolean value = data.equals("true"); try { this.invokeManifestMethod(cls, boolean.class, readedClass, value, methodName); return true; } catch (NoSuchMethodException | IllegalAccessException e) { System.err.println(e.getLocalizedMessage()); } catch (InvocationTargetException e) { System.err.println(e.getLocalizedMessage()); } return false; } }, STRING {
public void setPropertyValue(String fieldName, Object newValue) { PropertyHolder pp=properties.get(fieldName); if(pp==null)throw new NullPointerException("Can not find property '"+fieldName+"' in bean "+ obj.getClass().getName()); Method m=pp.getWriteMethod(); if(m==null)throw new NullPointerException("Can not find set method '"+fieldName+"' in bean "+ obj.getClass().getName()); try { m.invoke(obj, new Object[]{newValue}); } catch (IllegalArgumentException e) { StringBuilder sb=new StringBuilder("IllegalArgumentException:").append(e.getLocalizedMessage()).append('\n'); sb.append(obj.getClass().getName()).append('\t').append(fieldName).append('\t').append(newValue.getClass().getName()); throw new IllegalArgumentException(sb.toString()); } catch (IllegalAccessException e) { StringBuilder sb=new StringBuilder("IllegalAccessException:").append(e.getLocalizedMessage()).append('\n'); sb.append(obj.getClass().getName()).append('\t').append(fieldName).append('\t').append(newValue); throw new IllegalArgumentException(sb.toString()); } catch (InvocationTargetException e) { StringBuilder sb=new StringBuilder("InvocationTargetException:").append(e.getLocalizedMessage()).append('\n'); sb.append(obj.getClass().getName()).append('\t').append(fieldName).append('\t').append(newValue); throw new IllegalArgumentException(sb.toString()); } }
@Override public boolean parseData(String data, Class cls, AbstractManifestClass readedClass, String methodName) { try { int i = Integer.parseInt(data); this.invokeManifestMethod(cls, int.class, readedClass, i, methodName); return true; } catch (NoSuchMethodException e) { System.err.println(e.getLocalizedMessage()); } catch (IllegalAccessException e) { System.err.println(e.getLocalizedMessage()); } catch (InvocationTargetException e) { System.err.println(e.getLocalizedMessage()); } return false; } }, ENUM {
@Override public boolean parseData(String data, Class cls, AbstractManifestClass readedClass, String methodName) { try { this.invokeManifestMethod(cls, Enum.class, readedClass, data, methodName); return true; } catch (NoSuchMethodException e) { System.err.println(e.getLocalizedMessage()); } catch (IllegalAccessException e) { System.err.println(e.getLocalizedMessage()); } catch (InvocationTargetException e) { System.err.println(e.getLocalizedMessage()); } return false; } };
/** * Creates a <code>Box</code> object with the provided <code>type</code> * based on the provided data object based on reflection. */ public static JP2KBox createBox(int type, byte[] data) { Class<? extends JP2KBox> boxClass = boxClasses.get(new Integer(type)); try { //super box elements have default contructors if(data==null) return boxClass.newInstance(); // gets the constructor with <code>byte[]</code> parameter final Constructor<? extends JP2KBox> cons = boxClass.getConstructor(Array.newInstance( byte.class, 0).getClass()); if (cons != null) { return cons.newInstance(new Object[] { data }); } } catch (NoSuchMethodException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (InvocationTargetException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (IllegalAccessException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (InstantiationException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } throw new IllegalArgumentException("The provided type or data are not valid"); }
/** * Creates a <code>Box</code> object with the provided <code>type</code> * based on the provided Node object based on reflection. * * @todo handle Exception */ public static JP2KBox createBox(int type, Node node) throws IIOInvalidTreeException { Class<? extends JP2KBox> boxClass =boxClasses.get(new Integer(type)); try { // gets the constructor with <code>Node</code> parameter Constructor<? extends JP2KBox> cons = boxClass.getConstructor(new Class[] { Node.class }); if (cons != null) { return cons.newInstance(new Object[] { node }); } } catch (NoSuchMethodException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (InvocationTargetException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (IllegalAccessException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } catch (InstantiationException e) { LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } throw new IllegalArgumentException("The provided type or Node are not valid"); }
/** * create a solver from its String name. the solvername Xxxx must map one of * the newXxxx methods. * * @param solvername * the name of the solver * @return an ISolver built using newSolvername. <code>null</code> if the * solvername doesn't map one of the method of the factory. */ @SuppressWarnings("unchecked") public T createSolverByName(String solvername) { try { Class<?>[] paramtypes = {}; Method m = this.getClass() .getMethod("new" + solvername, paramtypes); //$NON-NLS-1$ return (T) m.invoke(null, (Object[]) null); } catch (SecurityException e) { System.err.println(e.getLocalizedMessage()); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } catch (NoSuchMethodException e) { System.err.println(e.getLocalizedMessage()); } catch (IllegalAccessException e) { System.err.println(e.getLocalizedMessage()); } catch (InvocationTargetException e) { System.err.println(e.getLocalizedMessage()); } return null; }
protected IStatus run(IProgressMonitor monitor) { List<File> files = new ArrayList<File>(); ProjectUtil.findProjectFiles(files, repository.getWorkTree(), true, monitor); if (files.isEmpty()) return Status.OK_STATUS; Set<ProjectRecord> records = new LinkedHashSet<ProjectRecord>(); for (File file : files) records.add(new ProjectRecord(file)); try { ProjectUtils.createProjects(records, repository, sets, monitor); } catch (InvocationTargetException e) { Activator.logError(e.getLocalizedMessage(), e); } catch (InterruptedException e) { Activator.logError(e.getLocalizedMessage(), e); } return Status.OK_STATUS; } };
public static LayerGroupInfo localizeLayerGroup(final LayerGroupInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException { if (info==null || catalog==null) throw new NullArgumentException("Arguments may never be null"); final LayerGroupInfo localObject=catalog.getLayerGroupByName(info.prefixedName()); if (localObject !=null){ return localObject; } try { info.getLayers().addAll(localizeLayers(info.getLayers(), catalog)); } catch (IllegalAccessException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } catch (InvocationTargetException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } // localize layers info.getStyles().addAll(localizeStyles(new HashSet<StyleInfo>(info.getStyles()), catalog)); // attach to the catalog final CatalogBuilder builder = new CatalogBuilder(catalog); builder.attach(info); return info; }
public static LayerGroupInfo localizeLayerGroup(final LayerGroupInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException { if (info==null || catalog==null) throw new NullArgumentException("Arguments may never be null"); final LayerGroupInfo localObject=catalog.getLayerGroupByName(info.getName()); if (localObject !=null){ return localObject; } try { info.getLayers().addAll(localizeLayers(info.getLayers(), catalog)); } catch (IllegalAccessException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } catch (InvocationTargetException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } // localize layers info.getStyles().addAll(localizeStyles(new HashSet<StyleInfo>(info.getStyles()), catalog)); // attach to the catalog final CatalogBuilder builder = new CatalogBuilder(catalog); builder.attach(info); return info; }
/** * Refresh the sort order and categories of the receiver. */ void refreshContents(IWorkbenchSiteProgressService service) { try { service.busyCursorWhile(monitor -> { SortingJob job = new SortingJob(CachedMarkerBuilder.this); job.run(monitor); }); } catch (InvocationTargetException e) { StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e)); } catch (InterruptedException e) { StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e)); } }
StatusManager.getManager().handle( StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e), StatusManager.LOG); } catch (InterruptedException e) { StatusManager.getManager().handle(