Java Code Examples for java.lang.reflect.InvocationTargetException.getMessage()

The following are Jave code examples for showing how to use getMessage() of the java.lang.reflect.InvocationTargetException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: CommentView   File: CanvasAreaView.java   Source Code and License Vote up 6 votes
@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());
        }
    }
 
Example 2
Project: android-project-gallery   File: Bus.java   Source Code and License Vote up 6 votes
/**
 * 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);
  }
}
 
Example 3
Project: monarch   File: DSFIDFactory.java   Source Code and License Vote up 5 votes
/**
 * 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);

  }
}