java.lang.reflect.InvocationTargetException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中java.lang.reflect.InvocationTargetException.getLocalizedMessage()方法的一些代码示例,展示了InvocationTargetException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InvocationTargetException.getLocalizedMessage()方法的具体详情如下:
包路径:java.lang.reflect.InvocationTargetException
类名称:InvocationTargetException
方法名:getLocalizedMessage

InvocationTargetException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: goldmansachs/gs-collections

throw new AssertionError(e.getLocalizedMessage());

代码示例来源:origin: apache/geode

"Illegal argument trying to set field " + e.getLocalizedMessage());
} catch (InvocationTargetException e) {
 Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());

代码示例来源:origin: apache/geode

"Illegal argument trying to set field " + e.getLocalizedMessage());
} catch (InvocationTargetException e) {
 Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

throw new BlenderFileException(e.getLocalizedMessage(), e);
} catch (InvocationTargetException e) {
  throw new BlenderFileException(e.getLocalizedMessage(), e);

代码示例来源:origin: org.softsmithy.lib/lib-core

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

代码示例来源:origin: org.softsmithy.lib/lib-core

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

代码示例来源:origin: org.softsmithy.lib/lib-core

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

代码示例来源:origin: org.softsmithy.lib/lib-core

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

代码示例来源:origin: droidefense/engine

@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 {

代码示例来源:origin: GeeQuery/ef-orm

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

代码示例来源:origin: droidefense/engine

@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 {

代码示例来源:origin: droidefense/engine

@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;
  }
};

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-kakadu

/**
 * 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");
}

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-kakadu

/**
 * 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");
}

代码示例来源:origin: org.ow2.sat4j/org.ow2.sat4j.core

/**
 * 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;
}

代码示例来源:origin: org.eclipse.egit/ui

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

代码示例来源:origin: org.geoserver/gs-jms-geoserver

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

代码示例来源:origin: org.geoserver/jms-geoserver

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

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * 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));
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

StatusManager.getManager().handle(
      StatusUtil.newStatus(IStatus.ERROR,
          e.getLocalizedMessage(), e), StatusManager.LOG);
} catch (InterruptedException e) {
  StatusManager.getManager().handle(

相关文章