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

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

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

IllegalAccessException.getLocalizedMessage介绍

暂无

代码示例

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

throw new AssertionError(e.getLocalizedMessage());

代码示例来源:origin: jersey/jersey

LocalizationMessages.PROVIDER_COULD_NOT_BE_CREATED(nextName, service, ex.getLocalizedMessage()),
ex);

代码示例来源:origin: jersey/jersey

LocalizationMessages.PROVIDER_COULD_NOT_BE_CREATED(nextName, service, ex.getLocalizedMessage()),
ex);

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

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

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

@SuppressWarnings("rawtypes")
  protected Hashtable<Class<? extends Command>, CommandWrapper> processAnnotations(final Set<Class<? extends CommandWrapper>> wrappers) {
    final String errorMessage = "Error when adding Xen command to map ==> '{0}'. CommandWrapper class is ==> '{1}'";

    final Hashtable<Class<? extends Command>, CommandWrapper> commands = new Hashtable<Class<? extends Command>, CommandWrapper>();

    for (final Class<? extends CommandWrapper> wrapper : wrappers) {
      final ResourceWrapper annotation = wrapper.getAnnotation(ResourceWrapper.class);
      if (annotation == null) {
        // Just in case people add classes without the annotation in the package and we don't see it.
        continue;
      }
      try {
        commands.put(annotation.handles(), wrapper.newInstance());
      } catch (final InstantiationException e) {
        s_logger.warn(MessageFormat.format(errorMessage, e.getLocalizedMessage(), wrapper.toString()));
      } catch (final IllegalAccessException e) {
        s_logger.warn(MessageFormat.format(errorMessage, e.getLocalizedMessage(), wrapper.toString()));
      }
    }

    return commands;
  }
}

代码示例来源:origin: eneim/toro

@SuppressWarnings("WeakerAccess") //
public static Fragment createFragment(Class<? extends Fragment> fragmentClass)
  throws ToroDemoException {
 Fragment fragment;
 try {
  fragment = fragmentClass.newInstance();
 } catch (InstantiationException e) {
  e.printStackTrace();
  throw new ToroDemoException(e.getLocalizedMessage(), e);
 } catch (IllegalAccessException e) {
  e.printStackTrace();
  throw new ToroDemoException(e.getLocalizedMessage(), e);
 }
 return fragment;
}

代码示例来源:origin: geotools/geotools

/** {@inheritDoc} */
  public IdentifiedObject create(final String code) throws FactoryException {
    try {
      return (IdentifiedObject) method.invoke(factory, code);
    } catch (InvocationTargetException exception) {
      final Throwable cause = exception.getCause();
      if (cause instanceof FactoryException) {
        throw (FactoryException) cause;
      }
      if (cause instanceof RuntimeException) {
        throw (RuntimeException) cause;
      }
      if (cause instanceof Error) {
        throw (Error) cause;
      }
      throw new FactoryException(cause.getLocalizedMessage(), cause);
    } catch (IllegalAccessException exception) {
      throw new FactoryException(exception.getLocalizedMessage(), exception);
    }
  }
}

代码示例来源:origin: eneim/toro

public static void present(FragmentActivity activity, Class<? extends Fragment> fragmentClass)
  throws ToroDemoException {
 Fragment fragment;
 try {
  fragment = fragmentClass.newInstance();
 } catch (InstantiationException e) {
  e.printStackTrace();
  throw new ToroDemoException(e.getLocalizedMessage(), e);
 } catch (IllegalAccessException e) {
  e.printStackTrace();
  throw new ToroDemoException(e.getLocalizedMessage(), e);
 }
 if (fragment != null) {
  activity.getSupportFragmentManager().beginTransaction() //
    .replace(android.R.id.content, fragment).commit();
 } else {
  activity.finish();
 }
}

代码示例来源:origin: geotools/geotools

/**
 * Constructs the {@link PlanarImage} from the {@linkplain SerializableRenderedImage} after
 * deserialization.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  try {
    /*
     * Set the 'image' field using reflection, because this field is final.
     * This is a legal usage for deserialization according Field.set(...)
     * documentation in J2SE 1.5.
     */
    final Field field = GridCoverage2D.class.getDeclaredField("image");
    field.setAccessible(true);
    field.set(this, PlanarImage.wrapRenderedImage(serializedImage));
  } catch (NoSuchFieldException cause) {
    InvalidClassException e = new InvalidClassException(cause.getLocalizedMessage());
    e.initCause(cause);
    throw e;
  } catch (IllegalAccessException cause) {
    InvalidObjectException e = new InvalidObjectException(cause.getLocalizedMessage());
    e.initCause(cause);
    throw e;
  }
}

代码示例来源:origin: com.wuyushuo/vplus-data

public String documentId(T source) {
  return Optional.ofNullable(source).map( x -> {
    Field[] fields = source.getClass().getDeclaredFields();
    for (Field field : fields) {
      if (field.isAnnotationPresent(EsId.class)) {
        field.setAccessible(true);
        try {
          return String.valueOf(field.get(source));
        } catch (IllegalAccessException e) {
          log.error(e.getLocalizedMessage(), e);
        }
      }
    }
    return StringUtils.EMPTY;
  }).orElse(StringUtils.EMPTY);
}

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

@Override
  public boolean parseData(String data, Class cls, AbstractManifestClass readedClass, String methodName) {
    try {
      this.invokeManifestMethod(cls, String.class, readedClass, data, methodName);
      return true;
    } catch (NoSuchMethodException | InvocationTargetException e) {
      System.err.println(e.getLocalizedMessage());
    } catch (IllegalAccessException e) {
      System.err.println(e.getLocalizedMessage());
    }
    return false;
  }
}, INT {

代码示例来源:origin: nailperry-zd/LazierTracker

public static List getActiveFragments(Activity activity) {
  List fragments = null;
  if (fieldmActive == null) {
    getFragmentManager();
  }
  if (fieldmActive != null) {
    fieldmActive.setAccessible(true);
    try {
      fragments = (List) fieldmActive.get(activity.getFragmentManager());
    } catch (IllegalAccessException e) {
      Log.e(EXCEPTION, e.getLocalizedMessage());
    }
  }
  return fragments;
}

代码示例来源: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: org.netbeans.modules/org-netbeans-modules-visualweb-dataconnectivity

private void loadDriver() throws SQLException {
  Log.getLogger().entering(getClass().getName(), toString()+".loadDriver"); //NOI18N
  if (driver == null) {
    try {
      Class driverClass =  Class.forName(driverClassName, true,
        getDriverClassLoader(getClass().getClassLoader()));
      driver = (Driver) driverClass.newInstance();
    } catch (ClassNotFoundException e) {
      throw new SQLException(e.getClass().getName()+": "+e.getLocalizedMessage());//NOI18N
    } catch (InstantiationException e) {
      throw new SQLException(e.getClass().getName()+": "+e.getLocalizedMessage());//NOI18N
    } catch (IllegalAccessException e) {
      throw new SQLException(e.getClass().getName()+": "+e.getLocalizedMessage());//NOI18N
    }
  }
}

代码示例来源:origin: ymex/banner

private void replaceViewPagerScroll() {
  try {
    Field field = ViewPager.class.getDeclaredField("mScroller");
    field.setAccessible(true);
    BannerScroller mScroller = new BannerScroller(getContext(), sInterpolator);
    mScroller.setDuration(mScroller.mDuration);
    field.set(this, mScroller);
  } catch (IllegalAccessException e) {
    e.printStackTrace();
    System.err.println(e.getLocalizedMessage());
  } catch (NoSuchFieldException e) {
    e.printStackTrace();
    System.err.println(e.getLocalizedMessage());
  }
}

代码示例来源:origin: febit/wit

public static Object invokeMethod(
    final Method method,
    final Object me,
    final Object[] args
) {
  final Object[] methodArgs = prepareArgs(method.getParameterCount(), args, 0);
  try {
    Object result = method.invoke(me, methodArgs);
    return ClassUtil.isVoidType(method.getReturnType())
        ? InternalContext.VOID
        : result;
  } catch (IllegalAccessException ex) {
    throw new ScriptRuntimeException("this method is inaccessible: ".concat(ex.getLocalizedMessage()), ex);
  } catch (IllegalArgumentException ex) {
    throw new ScriptRuntimeException("illegal argument: ".concat(ex.getLocalizedMessage()), ex);
  } catch (InvocationTargetException ex) {
    throw new ScriptRuntimeException("this method throws an exception", ex);
  }
}

代码示例来源:origin: febit/wit

public static Object invokeConstructor(final Constructor constructor, final Object[] args) {
  final Object[] methodArgs = prepareArgs(constructor.getParameterCount(), args, 0);
  try {
    return constructor.newInstance(methodArgs);
  } catch (InstantiationException ex) {
    throw new ScriptRuntimeException("Can't create new instance: ".concat(ex.getLocalizedMessage()), ex);
  } catch (IllegalAccessException ex) {
    throw new ScriptRuntimeException("Inaccessible method: ".concat(ex.getLocalizedMessage()), ex);
  } catch (IllegalArgumentException ex) {
    throw new ScriptRuntimeException("Illegal arguments: ".concat(ex.getLocalizedMessage()), ex);
  } catch (InvocationTargetException ex) {
    throw new ScriptRuntimeException("this method throws an exception", ex);
  }
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public String getLocalizedMessage() {		
  if(!MockFramework.isEnabled()){
    return super.getLocalizedMessage();
  }        
  return getDelegate().getLocalizedMessage();
}

代码示例来源:origin: org.febit.wit/wit-core

public static Object invokeConstructor(final Constructor constructor, final Object[] args) {
  final Object[] methodArgs = prepareArgs(constructor.getParameterCount(), args, 0);
  try {
    return constructor.newInstance(methodArgs);
  } catch (InstantiationException ex) {
    throw new ScriptRuntimeException("Can't create new instance: ".concat(ex.getLocalizedMessage()), ex);
  } catch (IllegalAccessException ex) {
    throw new ScriptRuntimeException("Unaccessible method: ".concat(ex.getLocalizedMessage()), ex);
  } catch (IllegalArgumentException ex) {
    throw new ScriptRuntimeException("Illegal arguments: ".concat(ex.getLocalizedMessage()), ex);
  } catch (InvocationTargetException ex) {
    throw new ScriptRuntimeException("this method throws an exception", ex);
  }
}

相关文章