Example usage for java.lang ClassNotFoundException printStackTrace

List of usage examples for java.lang ClassNotFoundException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.stj.fileexplorer.FileExplorerTabActivity.java

private boolean isUiFocusable(ActionMode actionMode) {
    try {/*from ww w  .  j a  v  a  2 s.  co m*/
        if (actionMode != null) {
            Class<?> c = Class.forName("android.view.ActionMode");
            Method method = c.getMethod("isUiFocusable", new Class[] {});
            method.setAccessible(true);
            Object isFocusable = method.invoke(actionMode, new Object[] {});
            if (isFocusable != null) {
                return ((Boolean) isFocusable);
            }
        }
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
    return false;
}

From source file:org.suren.autotest.web.framework.core.ui.Text.java

public Text appendValue() {
    String val4Fill = value;
    if (StringUtils.isNotBlank(callback)) {
        String methodName = "execute";
        String callbackClsName = callback;

        int methodIndex = callback.indexOf("!");
        if (methodIndex != -1 && !callback.endsWith("!")) {
            methodName = callback.substring(methodIndex + 1);
            callbackClsName = callback.substring(0, methodIndex);
        }//  ww w.  ja  v a 2  s. co  m

        try {
            if (!callbackClsName.contains(".")) {
                //?
                Map<Object, Object> engineConfig = engine.getEngineConfig();
                String pkg = (String) engineConfig.get("invoker.package");
                if (StringUtils.isBlank(pkg)) {
                    pkg = "org.suren.autotest.web.framework.invoker";
                }

                callbackClsName = (pkg + "." + callbackClsName);
            }

            Class<?> callbackCls = Class.forName(callbackClsName);
            Method callbackMethod = callbackCls.getMethod(methodName, SeleniumEngine.class, String.class);

            Object result = callbackMethod.invoke(null, engine, value);
            if (result != null) {
                val4Fill = result.toString();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

    advanceValueEditor.appendValue(this, val4Fill);

    return this;
}

From source file:org.suren.autotest.web.framework.core.ui.Text.java

public Text fillNotBlankValue() {
    String val4Fill = value;
    if (StringUtils.isNotBlank(callback)) {
        String methodName = "execute";
        String callbackClsName = callback;

        int methodIndex = callback.indexOf("!");
        if (methodIndex != -1 && !callback.endsWith("!")) {
            methodName = callback.substring(methodIndex + 1);
            callbackClsName = callback.substring(0, methodIndex);
        }//from   www.  j a v a  2 s. c  o m

        try {
            if (!callbackClsName.contains(".")) {
                //?
                Map<Object, Object> engineConfig = engine.getEngineConfig();
                String pkg = (String) engineConfig.get("invoker.package");
                if (StringUtils.isBlank(pkg)) {
                    pkg = "org.suren.autotest.web.framework.invoker";
                }

                callbackClsName = (pkg + "." + callbackClsName);
            }

            Class<?> callbackCls = Class.forName(callbackClsName);
            Method callbackMethod = callbackCls.getMethod(methodName, SeleniumEngine.class, String.class);

            Object result = callbackMethod.invoke(null, engine, value);
            if (result != null) {
                val4Fill = result.toString();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

    advanceValueEditor.fillNotBlankValue(this, val4Fill);

    return this;
}

From source file:org.suren.autotest.web.framework.core.ui.Text.java

/**
 * ?????//from   w w  w. j  a va2 s.c  om
 */
public Text fillValue() {
    String val4Fill = value;
    if (StringUtils.isNotBlank(callback)) {
        String methodName = "execute";
        String callbackClsName = callback;

        int methodIndex = callback.indexOf("!");
        if (methodIndex != -1 && !callback.endsWith("!")) {
            methodName = callback.substring(methodIndex + 1);
            callbackClsName = callback.substring(0, methodIndex);
        }

        try {
            if (!callbackClsName.contains(".")) {
                //?
                Map<Object, Object> engineConfig = engine.getEngineConfig();
                String pkg = (String) engineConfig.get("invoker.package");
                if (StringUtils.isBlank(pkg)) {
                    pkg = "org.suren.autotest.web.framework.invoker";
                }

                callbackClsName = (pkg + "." + callbackClsName);
            }

            Class<?> callbackCls = Class.forName(callbackClsName);
            Method callbackMethod = callbackCls.getMethod(methodName, SeleniumEngine.class, String.class);

            Object result = callbackMethod.invoke(null, engine, value);
            if (result != null) {
                val4Fill = result.toString();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

    valueEditor.setValue(this, val4Fill);

    return this;
}

From source file:com.projity.configuration.FieldDictionary.java

public void setClassName(String className) {
    //System.out.println("                  <include name=\""+className+"\"/>");
    try {/*from   w w w .j a  v  a 2 s . c  o  m*/
        clazz = ClassUtils.forName(className);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:no.uka.findmyapp.android.rest.client.RestProcessor.java

/**
 * Send to content provider.//ww  w  .  j a v a  2 s.  c  o m
 *
 * @param uri the uri
 * @param object the object
 * @param returnType the return type
 */
private void sendToContentProvider(Uri uri, Serializable object, String returnType) {
    Log.v(debug, "sendToContentProvider: serializable object " + object.getClass().getName());

    ContentResolver cr = mContext.getContentResolver();

    if (object instanceof List) {

        Class theClass = null;
        try {
            theClass = Class.forName(returnType);
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        List<ContentValues> list = ContentHelper.getContentValuesList(object, theClass);
        Log.v(debug, "parsing contentvalue array");
        ContentValues[] cva = new ContentValues[list.size()];
        for (ContentValues cv : list) {
            cva[list.indexOf(cv)] = cv;
        }
        Log.v(debug, cva.toString());
        cr.bulkInsert(UkaEventContract.EVENT_CONTENT_URI, cva);
    } else {
        ContentValues cv = new ContentValues(ContentHelper.getContentValues(object));
        cr.insert(uri, cv);
    }
}

From source file:com.cloudera.recordbreaker.analyzer.DataQuery.java

public DataQuery() throws SQLException {
    try {/*  w w w. ja va2s . c om*/
        this.conf = new Configuration();
        Class.forName(hiveDriverName);
        Class.forName(impalaDriverName);
        this.hiveConnectString = conf.get("hive.connectstring", "jdbc:hive2://localhost:10000/default");
        this.impalaConnectString = conf.get("impala.connectstring",
                "jdbc:hive2://localhost:21050/;auth=noSasl");
        LOG.info("Hive connect string: " + hiveConnectString);
        LOG.info("Impala connect string: " + impalaConnectString);

        this.tableCache = new HiveTableCache();

        try {
            this.hiveCon = DriverManager.getConnection(hiveConnectString, "cloudera", "cloudera");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        this.impalaCon = DriverManager.getConnection(impalaConnectString, "cloudera", "cloudera");
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    // Force impala to refresh metadata
    if (impalaCon != null) {
        Statement stmt = impalaCon.createStatement();
        try {
            try {
                LOG.info("Rebuilding Impala metadata...");
                stmt.execute("INVALIDATE METADATA");
            } catch (Exception iex) {
                LOG.info("Impala metadata rebuild failed: " + iex.toString());
            }
        } finally {
            stmt.close();
        }
    }

    // Misc data structures
    this.tables = new HashMap<Path, String>();
    this.isLoaded = new HashSet<Path>();
}

From source file:de.Keyle.MyPet.util.iconmenu.IconMenuItem.java

@SuppressWarnings("unchecked")
public IconMenuItem setMeta(ItemMeta meta, boolean useTitle, boolean useLore) {
    Validate.notNull(meta, "Name cannot be null");

    if (useTitle && meta.hasDisplayName()) {
        this.title = meta.getDisplayName();
        hasChanged = true;//from ww  w.ja va 2s  .  c om
    }
    if (useLore && meta.hasLore()) {
        this.lore.clear();
        this.lore.addAll(meta.getLore());
        hasChanged = true;
    }

    if (applyToItemMethhod == null) {
        try {
            Class craftMetaItemClass = Class.forName("org.bukkit.craftbukkit.v1_8_R2.inventory.CraftMetaItem");
            applyToItemMethhod = craftMetaItemClass.getDeclaredMethod("applyToItem", NBTTagCompound.class);
            applyToItemMethhod.setAccessible(true);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            DebugLogger.printThrowable(e);
            return this;
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
            DebugLogger.printThrowable(e);
            return this;
        }
    }
    try {
        NBTTagCompound compound = new NBTTagCompound();
        applyToItemMethhod.invoke(meta, compound);

        if (compound.hasKey("display")) {
            compound = compound.getCompound("display");

            if (compound.hasKey("Name")) {
                compound.remove("Name");
            }
            if (compound.hasKey("Lore")) {
                compound.remove("Lore");
            }

            for (String key : (Set<String>) compound.c()) {
                this.displayTags.put(key, compound.get(key).clone());
            }

            hasChanged = true;
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        DebugLogger.printThrowable(e);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        DebugLogger.printThrowable(e);
    }
    return this;
}

From source file:com.he5ed.lib.cloudprovider.picker.CloudPickerActivity.java

/**
 * Setup the relevant API instance to interact with server
 *
 * @param account of the service API/*from w  w  w.j ava2 s.  c o  m*/
 */
private void setupApi(CloudAccount account) {
    // use cloud API class reflection
    try {
        Class<?> clazz = Class.forName(account.api);
        Constructor constructor = clazz.getConstructor(Context.class, Account.class);
        mApi = (BaseApi) constructor.newInstance(this, account.getAccount());
        mApi.prepareApi(this);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        throw new ExceptionInInitializerError("Cloud API can not be found!");
    } catch (InstantiationException e) {
        e.printStackTrace();
        throw new ExceptionInInitializerError("Cloud API can not be initialized!");
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }

    mProgressBar.setVisibility(View.VISIBLE);
}

From source file:com.utest.webservice.builders.Builder.java

protected void populateLocators(Ti result, UriBuilder ub)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    Map<?, ?> resultProperties = PropertyUtils.describe(result);
    for (Object property : resultProperties.keySet()) {
        if (((String) property).endsWith("Locator")) {
            String resourcePath = null;
            Integer resourceId = null;
            String resourceName = ((String) property).substring(0, ((String) property).indexOf("Locator"));
            if (resultProperties.containsKey(resourceName + "Id")) {
                resourceId = (Integer) PropertyUtils.getProperty(result, resourceName + "Id");
                if (resourceId != null) {
                    resourcePath = getResourcePath(resourceName.toLowerCase());
                }/*w  ww  .j  a  va 2  s  .c o m*/
            }
            // represents a user who performed an operation
            else if (resourceName.endsWith("By")) {
                resourceId = (Integer) PropertyUtils.getProperty(result, resourceName);
                if (resourceId != null) {
                    resourcePath = getResourcePath("user");
                }
            }
            if (resourcePath != null) {
                String className = getResourceNamedClass(resourceName.toLowerCase());
                String name = "";
                if (className != null) {
                    try {
                        Class<?> clazz = Class.forName(className);
                        Object namedEntity = factory.getStaticDataService().getEntity(clazz, resourceId);
                        if (namedEntity != null && namedEntity instanceof Named) {
                            name = ((Named) namedEntity).getName();
                        }
                    } catch (ClassNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                ResourceLocator resourceLocator = new ResourceLocator(resourceId,
                        ub.clone().path(resourcePath).build(resourceId).toString(), name);
                PropertyUtils.setProperty(result, (String) property, resourceLocator);
            }
        }
    }
}