Example usage for java.lang NoSuchMethodException printStackTrace

List of usage examples for java.lang NoSuchMethodException printStackTrace

Introduction

In this page you can find the example usage for java.lang NoSuchMethodException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.aliyun.odps.mapred.conf.JobConf.java

/**
 * ?.// www.j a va  2s .  c  om
 *
 * @return 
 */
@Deprecated
public Column[] getOutputSchema() {
    try {
        onDeprecated(JobConf.class.getMethod("getOutputSchema"));
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.aliyun.odps.mapred.conf.JobConf.java

/**
 * ?label//from www .ja  va 2  s  .  co  m
 *
 * @param label
 *     
 * @return 
 */
@Deprecated
public Column[] getOutputSchema(String label) {
    try {
        onDeprecated(JobConf.class.getMethod("getOutputSchema", String.class));
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.android.kalite27.ScriptActivity.java

private void setWebViewUserAgent(XWalkView webView, String userAgent) {
    try {/* ww w .  ja v a 2 s  .co m*/
        Method ___getBridge = XWalkView.class.getDeclaredMethod("getBridge");
        ___getBridge.setAccessible(true);
        XWalkViewBridge xWalkViewBridge = null;
        xWalkViewBridge = (XWalkViewBridge) ___getBridge.invoke(webView);
        XWalkSettings xWalkSettings = xWalkViewBridge.getSettings();
        xWalkSettings.setUserAgentString(userAgent);
    } catch (NoSuchMethodException e) {
        // Could not set user agent
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:com.googlecode.fascinator.portal.services.impl.PortalSecurityManagerImpl.java

/**
 * Retrieve the login URL for redirection against a given provider.
 * /*from www . ja v a2  s .  c  o m*/
 * @param String The SSO source to use
 * @return String The URL used by the SSO Service for logins
 */
public String ssoGetRemoteLogoutURL(JsonSessionState session, String source) {
    if (!sso.containsKey(source)) {
        return null;
    } else {
        // return sso.get(source).ssoGetRemoteLogonURL(session);
        Class ssoInterfaceClass = sso.get(source).getClass();
        Method remoteLogoutURLMethod;
        try {
            remoteLogoutURLMethod = ssoInterfaceClass.getMethod("ssoGetRemoteLogoutURL",
                    JsonSessionState.class);
            if (remoteLogoutURLMethod != null) {
                return (String) remoteLogoutURLMethod.invoke(sso.get(source), session);
            }
        } catch (NoSuchMethodException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return null;
    }
}

From source file:cn.edu.zafu.corepage.base.BaseActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);/*from   w  w  w  . ja v a2  s.  co  m*/
                m.invoke(menu, true);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
    return super.onMenuOpened(featureId, menu);
}

From source file:com.jennifer.ui.chart.ChartBuilder.java

private void drawObject(String type) {

    if (builderoptions.has(type) && !builderoptions.isNull(type)) {
        JSONArray list = (JSONArray) builderoptions.getJSONArray(type);

        for (int i = 0, len = list.length(); i < len; i++) {
            JSONObject obj = list.getJSONObject(i);
            String objType = obj.getString("type");
            Class cls = "brush".equals(type) ? brushes.get(objType) : widgets.get(objType);

            JSONObject drawObject;/*from   w  w  w  .ja va  2s  . com*/
            if ("widget".equals(type)) {
                drawObject = JSONUtil.clone(builderoptions.getJSONArray(type).getJSONObject(i));
            } else {
                drawObject = JSONUtil.clone(obj);
            }

            setGridAxis(obj, drawObject);

            obj.put("index", i);

            // create object and rendering

            try {
                Drawable drawable = (Drawable) cls.getDeclaredConstructor(ChartBuilder.class, JSONObject.class)
                        .newInstance(this, obj);
                JSONObject result = (JSONObject) drawable.render();

                Transform root = (Transform) result.get("root");
                root.addClass(type + " " + objType);

                this.root.append(root);

            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }

        }
    }
}

From source file:com.google.dexmaker.ProxyBuilder.java

public Class<? extends T> buildProxyClass() throws IOException {
    Class<? extends T> proxyClass = null;
    synchronized (baseClass) {
        // we only populate the map with matching types
        proxyClass = (Class) generatedProxyClasses.get(baseClass);
        if (proxyClass != null && proxyClass.getClassLoader().getParent() == parentClassLoader
                && interfaces.equals(asSet(proxyClass.getInterfaces()))) {
            return proxyClass; // cache hit!
        }/*from  w w  w. j ava  2 s. c om*/
        // ---------------------------------------------------------------------------------------
        // ??class??class
        DexMaker dexMaker = new DexMaker(application);
        String generatedName = getMethodNameForProxyOf(baseClass);

        ClassLoader classLoader = dexMaker.getJarClassLoader(parentClassLoader, dexCache, generatedName);
        ArrayList<MethodEntity> entities = null;
        if (proxy.containsKey(generatedName)) {
            entities = proxy.get(generatedName);
        } else {
            entities = getObject(generatedName);
            if (null != entities) {
                proxy.put(generatedName, methods);
            }
        }
        Method[] methodsToProxy = null;
        if (classLoader == null || entities == null) {
            // the cache missed; generate the class
            TypeId<? extends T> generatedType = TypeId.get("L" + generatedName + ";");
            TypeId<T> superType = TypeId.get(baseClass);
            generateConstructorsAndFields(dexMaker, generatedType, superType, baseClass);
            methodsToProxy = getMethodsToProxyRecursive();

            generateCodeForAllMethods(dexMaker, generatedType, methodsToProxy, superType);
            dexMaker.declare(generatedType, generatedName + ".generated", PUBLIC, superType,
                    getInterfacesAsTypeIds());

            classLoader = dexMaker.generateAndLoad(parentClassLoader, dexCache, generatedName);

            setObject(generatedName, methods);
            proxy.put(generatedName, methods);
        } else {
            methodsToProxy = new Method[entities.size()];
            int i = 0;
            for (MethodEntity entity : entities) {
                Method method = null;
                try {
                    method = entity.clazz.getDeclaredMethod(entity.name, entity.params);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
                methodsToProxy[i++] = method;
            }
        }
        try {
            proxyClass = loadClass(classLoader, generatedName);
        } catch (IllegalAccessError e) {
            throw new UnsupportedOperationException("cannot proxy inaccessible class " + baseClass, e);
        } catch (ClassNotFoundException e) {
            throw new AssertionError(e);
        } catch (Exception e) {
            e.printStackTrace();
        }
        setMethodsStaticField(proxyClass, methodsToProxy);
        generatedProxyClasses.put(baseClass, proxyClass);
    }
    return proxyClass;
}

From source file:com.connectsdk.discovery.DiscoveryManager.java

@SuppressWarnings("unchecked")
public void addServiceDescriptionToDevice(ServiceDescription desc, ConnectableDevice device) {
    Log.d("Connect SDK", "Adding service " + desc.getServiceID() + " to device with address "
            + device.getIpAddress() + " and id " + device.getId());

    Class<? extends DeviceService> deviceServiceClass;

    if (isNetcast(desc)) {
        deviceServiceClass = NetcastTVService.class;
        Method m;/*w  w  w .jav  a 2  s . c  o m*/
        Object result = null;
        try {
            m = deviceServiceClass.getMethod("discoveryParameters");
            result = m.invoke(null);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        if (result == null)
            return;

        JSONObject discoveryParameters = (JSONObject) result;
        String serviceId = discoveryParameters.optString("serviceId");

        if (serviceId == null || serviceId.length() == 0)
            return;

        desc.setServiceID(serviceId);
    } else {
        deviceServiceClass = (Class<DeviceService>) deviceClasses.get(desc.getServiceID());
    }

    if (deviceServiceClass == null)
        return;

    if (DLNAService.class.isAssignableFrom(deviceServiceClass)) {
        String netcast = "netcast";
        String webos = "webos";

        String locationXML = desc.getLocationXML().toLowerCase();

        int locNet = locationXML.indexOf(netcast);
        int locWeb = locationXML.indexOf(webos);

        if (locNet == -1 && locWeb == -1)
            return;
    }

    ServiceConfig serviceConfig = null;

    if (connectableDeviceStore != null)
        serviceConfig = connectableDeviceStore.getServiceConfig(desc.getUUID());

    if (serviceConfig == null)
        serviceConfig = new ServiceConfig(desc);

    serviceConfig.setListener(DiscoveryManager.this);

    boolean hasType = false;
    boolean hasService = false;

    for (DeviceService service : device.getServices()) {
        if (service.getServiceDescription().getServiceID().equals(desc.getServiceID())) {
            hasType = true;
            if (service.getServiceDescription().getUUID().equals(desc.getUUID())) {
                hasService = true;
            }
            break;
        }
    }

    if (hasType) {
        if (hasService) {
            device.setServiceDescription(desc);

            DeviceService alreadyAddedService = device.getServiceByName(desc.getServiceID());

            if (alreadyAddedService != null)
                alreadyAddedService.setServiceDescription(desc);

            return;
        }

        device.removeServiceByName(desc.getServiceID());
    }

    DeviceService deviceService = DeviceService.getService(deviceServiceClass, desc, serviceConfig);
    deviceService.setServiceDescription(desc);
    device.addService(deviceService);
}

From source file:org.photovault.swingui.PhotoInfoEditor.java

/**     
 Set the multivalued state of given field
 @param field Field to set/*from  w  w  w.  j a va2  s  . c  o m*/
 @param isMultivalued If <code>null, set the field to multivalued state. If not, set
 it to normal state 
 */
public void setFieldMultivalued(PhotoInfoFields field, boolean isMultivalued) {
    String propertyName = field.getName() + "Multivalued";
    try {
        PropertyUtils.setProperty(this, propertyName, isMultivalued);
    } catch (NoSuchMethodException ex) {
        log.error("Cannot set property " + propertyName);
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        log.error(ex.getMessage());
    } catch (InvocationTargetException ex) {
        log.error(ex.getMessage());
    }
}

From source file:org.photovault.swingui.PhotoInfoEditor.java

public void setField(PhotoInfoFields field, Object newValue) {
    StringBuffer debugMsg = new StringBuffer();
    debugMsg.append("setField ").append(field).append(": ").append(newValue);
    log.debug(debugMsg.toString());/*  w  ww .  ja  v a 2  s.  c  om*/
    String propertyName = field.getName();
    try {
        PropertyUtils.setProperty(this, propertyName, newValue);
    } catch (NoSuchMethodException ex) {
        log.error("Cannot set property " + propertyName);
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        log.error(ex.getMessage());
    } catch (InvocationTargetException ex) {
        log.error(ex.getMessage());
    }
}