Example #1
0
  @Override
  public void run() {
    Utility.showProgressDialog(
        progressDialog, handler, context.getString(R.string.subscribe_progress_dialog_message));

    try {
      Utility.isConnectingToInternet(context);
      subscribeToChannel(channel);
      adapter.addItem(channel);
      Log.d(TAG, String.format("Subscribed to %s successfully", channel));
      Utility.showToast(context, handler, context.getString(R.string.subscribe_successfully));
    } catch (IllegalArgumentException e) {
      Utility.showToast(context, handler, e.getMessage());
      Log.e(TAG, e.getMessage());
    } catch (IOException e) {
      Utility.showToast(context, handler, e.getMessage());
      Log.e(TAG, e.getMessage());
    } catch (InterruptedException e) {
      Utility.showToast(context, handler, e.getMessage());
      Log.e(TAG, e.getMessage());
    } catch (IllegalAccessError e) {
      Utility.showToast(context, handler, e.getMessage());
      Log.e(TAG, e.getMessage());
    }

    Utility.dissmissProgressDialog(progressDialog, handler);
  }
 @Test
 public void testConvert() {
   NeverUsedParamConvert convert = new NeverUsedParamConvert();
   try {
     convert.convert("hello", String.class);
   } catch (IllegalAccessError error) {
     // ok
     error.printStackTrace();
   }
 }
Example #3
0
    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
      CopyOnWriteList core = copyOnWriteListConverter.unmarshal(reader, context);

      try {
        PersistedList r = (PersistedList) context.getRequiredType().newInstance();
        r.data.replaceBy(core);
        return r;
      } catch (InstantiationException e) {
        InstantiationError x = new InstantiationError();
        x.initCause(e);
        throw x;
      } catch (IllegalAccessException e) {
        IllegalAccessError x = new IllegalAccessError();
        x.initCause(e);
        throw x;
      }
    }
Example #4
0
      public Object createProxy() {
        final SimpleInterceptorFactoryContext factoryContext =
            new SimpleInterceptorFactoryContext();
        factoryContext.getContextData().put(Component.class, component);
        factoryContext.getContextData().put(ComponentView.class, View.this);
        factoryContext.getContextData().put(ComponentViewInstance.class, this);

        final Map<Method, InterceptorFactory> clientInterceptorFactories =
            ViewService.this.clientInterceptorFactories;
        final Map<Method, Interceptor> clientEntryPoints =
            new IdentityHashMap<Method, Interceptor>(clientInterceptorFactories.size());
        for (Method method : clientInterceptorFactories.keySet()) {
          clientEntryPoints.put(
              method, clientInterceptorFactories.get(method).create(factoryContext));
        }
        final Interceptor postConstructInterceptor = clientPostConstruct.create(factoryContext);
        try {
          Object object =
              proxyFactory.newInstance(
                  new ProxyInvocationHandler(clientEntryPoints, component, View.this, this));
          InterceptorContext interceptorContext = new InterceptorContext();
          interceptorContext.putPrivateData(ComponentView.class, View.this);
          interceptorContext.putPrivateData(ComponentViewInstance.class, this);
          interceptorContext.putPrivateData(Component.class, component);
          try {
            postConstructInterceptor.processInvocation(interceptorContext);
          } catch (Exception e) {
            InstantiationException exception =
                new InstantiationException("Post-construct lifecycle failed");
            exception.initCause(e);
            throw exception;
          }
          return object;
        } catch (InstantiationException e) {
          InstantiationError error = new InstantiationError(e.getMessage());
          Throwable cause = e.getCause();
          if (cause != null) error.initCause(cause);
          throw error;
        } catch (IllegalAccessException e) {
          IllegalAccessError error = new IllegalAccessError(e.getMessage());
          Throwable cause = e.getCause();
          if (cause != null) error.initCause(cause);
          throw error;
        }
      }