當前位置: 首頁>>代碼示例>>Java>>正文


Java InvocationTargetException.getMessage方法代碼示例

本文整理匯總了Java中java.lang.reflect.InvocationTargetException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java InvocationTargetException.getMessage方法的具體用法?Java InvocationTargetException.getMessage怎麽用?Java InvocationTargetException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.lang.reflect.InvocationTargetException的用法示例。


在下文中一共展示了InvocationTargetException.getMessage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setContentAreaForJsonFile

import java.lang.reflect.InvocationTargetException; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.KITKAT)
    public void setContentAreaForJsonFile(String str) {
        try {
            final ArrayMap fields = getFields();
            ArrayMap[] methods = getMethods();
            final ArrayMap arrayMap = methods[0];
            final ArrayMap arrayMap2 = methods[1];
//            setCanvasArea(CanvasUIEngine.g().inflateCanvasArea((CanvasHost) this, str, new CanvasUIEngineInflateListener() {
//                public void didInflatedArea(CanvasArea canvasArea, String str) {
//                    if (fields.containsKey(str)) {
//                        Field field = (Field) fields.get(str);
//                        field.setAccessible(true);
//                        try {
//                            field.set(CanvasAreaView.this, canvasArea);
//                        } catch (IllegalAccessException e) {
//                            e.printStackTrace();
//                            throw new RuntimeException(e.getMessage());
//                        }
//                    }
//                    if (arrayMap.containsKey(str)) {
//                        canvasArea.clickListener = CanvasAreaView.getListener((Method) arrayMap.get(str), canvasArea, CanvasAreaView.this);
//                    }
//                    if (arrayMap2.containsKey(str)) {
//                        canvasArea.longClickListener = CanvasAreaView.getLongListener((Method) arrayMap2.get(str), canvasArea, CanvasAreaView.this);
//                    }
//                }
//            }));
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
            throw new RuntimeException(e2.getMessage());
        } catch (InvocationTargetException e3) {
            e3.printStackTrace();
            throw new RuntimeException(e3.getMessage());
        }
    }
 
開發者ID:xieyangxuejun,項目名稱:CommentView,代碼行數:39,代碼來源:CanvasAreaView.java

示例2: throwRuntimeException

import java.lang.reflect.InvocationTargetException; //導入方法依賴的package包/類
/**
 * Throw a {@link RuntimeException} with given message and cause lifted from an {@link
 * InvocationTargetException}. If the specified {@link InvocationTargetException} does not have a
 * cause, neither will the {@link RuntimeException}.
 */
private static void throwRuntimeException(String msg, InvocationTargetException e) {
  Throwable cause = e.getCause();
  if (cause != null) {
    throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
  } else {
    throw new RuntimeException(msg + ": " + e.getMessage(), e);
  }
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:14,代碼來源:Bus.java

示例3: create

import java.lang.reflect.InvocationTargetException; //導入方法依賴的package包/類
/**
 * Creates a DataSerializableFixedID or StreamableFixedID instance by deserializing it from the
 * data input.
 */
public static Object create(int dsfid, DataInput in) throws IOException, ClassNotFoundException {
  switch (dsfid) {
    case REGION:
      return (DataSerializableFixedID) DataSerializer.readRegion(in);
    case END_OF_STREAM_TOKEN:
      return Token.END_OF_STREAM;
    case DLOCK_REMOTE_TOKEN:
      return DLockRemoteToken.createFromDataInput(in);
    case TRANSACTION_ID:
      return TXId.createFromData(in);
    case INTEREST_RESULT_POLICY:
      return readInterestResultPolicy(in);
    case UNDEFINED:
      return readUndefined(in);
    case RESULTS_BAG:
      return readResultsBag(in);
    case TOKEN_INVALID:
      return Token.INVALID;
    case TOKEN_LOCAL_INVALID:
      return Token.LOCAL_INVALID;
    case TOKEN_DESTROYED:
      return Token.DESTROYED;
    case TOKEN_REMOVED:
      return Token.REMOVED_PHASE1;
    case TOKEN_REMOVED2:
      return Token.REMOVED_PHASE2;
    case TOKEN_TOMBSTONE:
      return Token.TOMBSTONE;
    case NULL_TOKEN:
      return readNullToken(in);
    case CONFIGURATION_REQUEST:
      return readConfigurationRequest(in);
    case CONFIGURATION_RESPONSE:
      return readConfigurationResponse(in);
    case PR_DESTROY_ON_DATA_STORE_MESSAGE:
      return readDestroyOnDataStore(in);
    default:
      final Constructor<?> cons;
      if (dsfid >= Byte.MIN_VALUE && dsfid <= Byte.MAX_VALUE) {
        cons = dsfidMap[dsfid + Byte.MAX_VALUE + 1];
      } else {
        cons = (Constructor<?>) dsfidMap2.get(dsfid);
      }
      if (cons != null) {
        try {
          Object ds = cons.newInstance((Object[]) null);
          InternalDataSerializer.invokeFromData(ds, in);
          return ds;
        } catch (InstantiationException ie) {
          throw new IOException(ie.getMessage(), ie);
        } catch (IllegalAccessException iae) {
          throw new IOException(iae.getMessage(), iae);
        } catch (InvocationTargetException ite) {
          Throwable targetEx = ite.getTargetException();
          if (targetEx instanceof IOException) {
            throw (IOException) targetEx;
          } else if (targetEx instanceof ClassNotFoundException) {
            throw (ClassNotFoundException) targetEx;
          } else {
            throw new IOException(ite.getMessage(), targetEx);
          }
        }
      }
      throw new DSFIDNotFoundException("Unknown DataSerializableFixedID: " + dsfid, dsfid);

  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:72,代碼來源:DSFIDFactory.java


注:本文中的java.lang.reflect.InvocationTargetException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。