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:org.apache.click.extras.jpa.JpaForm.java

/**
 * Load form value from entity.//w  w w  .j  a va2 s .  c  om
 * 
 * @param id Primary key object.
 */
public void loadEntity(Object id) {
    Class valueClass;
    try {
        valueClass = Class.forName(classField.getValue());
        Object entity = getEntityManager().find(valueClass, id);
        setValueObject(entity);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:com.cnm.cnmrc.fragment.vodtvch.VodTvch.java

/**
 * ? ? ?  fragment VodTvch ?? loadingDataForSidrebar()? no addToBackStack ??.
 * ? MainActivity onBackPressed()? back key ?.
 * ? VodTvch fragment addToBackStack ?? ?,  ?? Base back key . 
 * back key?   ??... Base? destoryView()?  ? ?.
 * no addToBackStack(null)/*w w  w  . j  a  v  a 2  s  . co m*/
 * ft.replace(R.id.loading_data_panel, base)
 */
private void loadingDataForSidrebar() {
    FragmentManager fm = getActivity().getSupportFragmentManager();
    Log.i("hwang", "before vodTvch fragment count (no add to stack) --> "
            + Integer.toString(fm.getBackStackEntryCount()));

    FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
    Class<?> classObject;
    try {
        String packageName = this.getClass().getPackage().getName() + ".";
        classObject = Class.forName(packageName + mClassTypeArray[selectedCategory]); // CommonList, VodSemiDetail, VodDetail, TvchSemiDetail, TvchDetail
        Object obj = classObject.newInstance();

        Base base = ((Base) obj).newInstance(mCategoryArray[selectedCategory], true); // true : 1 depth (vod:VodSemiDetail, VodSemiDetail, VodSemiDetail, VodList)
        // true : 1 depth (tvch: TvchSemiDetail, TvchList, TvchSemiDetail, TvchSemiDetail)

        //ft.addToBackStack(null);   // addTBackStack  onBackPressed() ? ?... remove fragment onDestroyView() ?.
        ft.replace(R.id.loading_data_panel, base);
        ft.commit();
        //fm.executePendingTransactions();   // fragment? ? pending recursive error,  ?? pending .
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (java.lang.InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    Log.i("hwang", "after vodTvch fragment count (no add to stack) --> "
            + Integer.toString(fm.getBackStackEntryCount()));

    // ------------------------------------
    // ? bottom menu? depth level 
    // ------------------------------------
    Fragment f = getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_rc_bottom_menu);
    if (f != null)
        ((RcBottomMenu) f).setDepthLevelClear(); // set 1 depth
}

From source file:com.apatar.http.HttpNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");
    try {// www  .j av  a 2  s.co  m
        WizardPanelDescriptor descriptor1;

        descriptor1 = new DBConnectionDescriptor(this, new JPropertySheetPage(wd),
                TableSchemaDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.http.HttpConnection"), "db_connector", "http");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        SchemaTable schema = getTiForConnection(AbstractDataBaseNode.OUT_CONN_POINT_NAME).getSchemaTable();
        TableSchemaDescriptor descriptor2 = new TableSchemaDescriptor(
                new JTableSchemaPanel(ApplicationData.getTempDataBase().getDataBaseInfo().getAvailableTypes(),
                        schema.getRecords()),
                this);
        wizard.registerWizardPanel(TableSchemaDescriptor.IDENTIFIER, descriptor2);

        wizard.setKeyForReferringToDescription("help.connector.http");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:at.flack.MailOutActivity.java

public ArrayList<Email> loadMails() throws StreamCorruptedException, FileNotFoundException, IOException {
    if (getActivity() == null)
        return null;
    ObjectInputStream inputStream = null;
    ArrayList<Email> erg = null;
    try {/*from ww w .j a v  a  2 s  .c o  m*/
        inputStream = new ObjectInputStream(
                new FileInputStream(new File(getActivity().getFilesDir(), "mails_outgoing.dat")));
        erg = (ArrayList<Email>) inputStream.readObject();
    } catch (ClassNotFoundException e) {
    } finally {
        try {
            if (inputStream != null)
                inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return erg;
}

From source file:files.populate.java

public populate() {

    System.out.println("-------- Oracle JDBC Connection Testing ------");
    System.out.println("-------- Oracle JDBC Connection Testing ------");
    try {/*from   w  ww . j a va 2 s.c  om*/

        Class.forName("oracle.jdbc.driver.OracleDriver");

    } catch (ClassNotFoundException e) {

        System.out.println("Where is your Oracle JDBC Driver?");
        e.printStackTrace();
        return;

    }

    System.out.println("Oracle JDBC Driver Registered!");

    Connection connection = null;

    try {

        connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:cdb1", "system", "oracle");

    } catch (SQLException e) {

        System.out.println("Connection Failed! Check output console");
        e.printStackTrace();
        return;

    }

    if (connection != null) {
        System.out.println("Database Connection Successfull!");
        //            populate_users(connection,"/Users/yash/Documents/workspace/HW 3/data/yelp_user");
        //            populate_business(connection, "");
        //            populate_reviews(connection , "");
        populate_checkin(connection, "");

    } else {
        System.out.println("Failed to make connection!");
    }
}

From source file:edu.washington.cs.mystatus.odk.database.ODKSQLiteOpenHelper.java

/**
 * Create and/or open a database. This will be the same object returned by
 * {@link #getWritableDatabase} unless some problem, such as a full disk, requires the database
 * to be opened read-only. In that case, a read-only database object will be returned. If the
 * problem is fixed, a future call to {@link #getWritableDatabase} may succeed, in which case
 * the read-only database object will be closed and the read/write object will be returned in
 * the future.//from   ww  w  .j  a v  a2s  . c o m
 * 
 * @throws SQLiteException if the database cannot be opened
 * @return a database object valid until {@link #getWritableDatabase} or {@link #close} is
 *         called.
 */
public synchronized SQLiteDatabase getReadableDatabase() {
    if (mDatabase != null && mDatabase.isOpen()) {
        return mDatabase; // The database is already open for business
    }

    if (mIsInitializing) {
        throw new IllegalStateException("getReadableDatabase called recursively");
    }

    // if the cacheword is locked throw exception
    if (mHandler == null)
        mHandler = ((MyStatus) mContext).getCacheWordHandler();

    // work around for now...
    // @CD
    Base64Wrapper b64w = null;
    try {
        b64w = new Base64Wrapper();
    } catch (ClassNotFoundException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    byte[] encryption_key = null;
    if (mHandler.isLocked()) {
        SharedPreferences prefs = mContext.getSharedPreferences("mystatus", mContext.MODE_PRIVATE);
        String key = prefs.getString("encoded_key", null);
        if (key != null)
            encryption_key = b64w.decode(key);
    }
    //throw new SQLiteException("Database locked. Decryption key unavailable.");

    try {
        return getWritableDatabase();
    } catch (SQLiteException e) {
        if (mName == null)
            throw e; // Can't open a temp database read-only!
        Log.e(t, "Couldn't open " + mName + " for writing (will try read-only):", e);
    }

    SQLiteDatabase db = null;
    try {
        mIsInitializing = true;
        String path = mPath + File.separator + mName;
        // mContext.getDatabasePath(mName).getPath();
        // allow open readable database
        if (mHandler.isLocked() && encryption_key != null)
            db = SQLiteDatabase.openDatabase(path, encodeRawKey(encryption_key), mFactory,
                    SQLiteDatabase.OPEN_READONLY);
        else
            db = SQLiteDatabase.openDatabase(path, encodeRawKey(mHandler.getEncryptionKey()), mFactory,
                    SQLiteDatabase.OPEN_READONLY);

        if (db.getVersion() != mNewVersion) {
            throw new SQLiteException("Can't upgrade read-only database from version " + db.getVersion()
                    + " to " + mNewVersion + ": " + path);
        }

        onOpen(db);
        Log.w(t, "Opened " + mName + " in read-only mode");
        mDatabase = db;
        return mDatabase;
    } finally {
        mIsInitializing = false;
        if (db != null && db != mDatabase)
            db.close();
    }
}

From source file:cern.c2mon.shared.common.datatag.address.impl.HardwareAddressImpl.java

/**
 * Create a HardwareAddress object from its XML representation.
 *
 * @param pElement DOM element containing the XML representation of a HardwareAddress object, as created by the
 *                 toConfigXML() method.
 * @throws RuntimeException if unable to instantiate the Hardware address
 * @see cern.c2mon.shared.common.datatag.address.HardwareAddress#toConfigXML()
 *//*from ww w  . j  ava 2s  .c o  m*/
public final synchronized HardwareAddress fromConfigXML(Element pElement) {
    Class hwAddressClass = null;
    HardwareAddressImpl hwAddress = null;

    try {
        hwAddressClass = Class.forName(pElement.getAttribute("class"));
        hwAddress = (HardwareAddressImpl) hwAddressClass.newInstance();
    } catch (ClassNotFoundException cnfe) {
        cnfe.printStackTrace();
        throw new RuntimeException("Exception caught when instantiating a hardware address from XML", cnfe);
    } catch (IllegalAccessException iae) {
        iae.printStackTrace();
        throw new RuntimeException("Exception caught when instantiating a hardware address from XML", iae);
    } catch (InstantiationException ie) {
        ie.printStackTrace();
        throw new RuntimeException("Exception caught when instantiating a hardware address from XML", ie);
    }

    NodeList fields = pElement.getChildNodes();
    Node fieldNode = null;
    int fieldsCount = fields.getLength();
    String fieldName;
    String fieldValueString;
    String fieldTypeName = "";

    for (int i = 0; i < fieldsCount; i++) {
        fieldNode = fields.item(i);
        if (fieldNode.getNodeType() == Node.ELEMENT_NODE) {
            fieldName = fieldNode.getNodeName();

            if (fieldNode.getFirstChild() != null) {
                fieldValueString = fieldNode.getFirstChild().getNodeValue();
            } else {
                fieldValueString = "";
            }
            try {
                Field field = hwAddressClass.getDeclaredField(decodeFieldName(fieldName));
                fieldTypeName = field.getType().getName();

                if (fieldTypeName.equals("short")) {
                    field.setShort(hwAddress, Short.parseShort(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Short")) {
                    field.set(hwAddress, new Integer(Integer.parseInt(fieldValueString)));
                } else if (fieldTypeName.equals("int")) {
                    field.setInt(hwAddress, Integer.parseInt(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Integer")) {
                    field.set(hwAddress, new Integer(Integer.parseInt(fieldValueString)));
                } else if (fieldTypeName.equals("float")) {
                    field.setFloat(hwAddress, Float.parseFloat(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Float")) {
                    field.set(hwAddress, new Float(Float.parseFloat(fieldValueString)));
                } else if (fieldTypeName.equals("double")) {
                    field.setDouble(hwAddress, Double.parseDouble(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Double")) {
                    field.set(hwAddress, new Double(Double.parseDouble(fieldValueString)));
                } else if (fieldTypeName.equals("long")) {
                    field.setLong(hwAddress, Long.parseLong(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Long")) {
                    field.set(hwAddress, new Long(Long.parseLong(fieldValueString)));
                } else if (fieldTypeName.equals("byte")) {
                    field.setByte(hwAddress, Byte.parseByte(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Byte")) {
                    field.set(hwAddress, new Byte(Byte.parseByte(fieldValueString)));
                } else if (fieldTypeName.equals("char")) {
                    field.setChar(hwAddress, fieldValueString.charAt(0));
                } else if (fieldTypeName.equals("java.lang.Character")) {
                    field.set(hwAddress, new Character(fieldValueString.charAt(0)));
                } else if (fieldTypeName.equals("boolean")) {
                    field.setBoolean(hwAddress, Boolean.getBoolean(fieldValueString));
                } else if (fieldTypeName.equals("java.lang.Boolean")) {
                    field.set(hwAddress, new Boolean(Boolean.getBoolean(fieldValueString)));
                } else if (fieldTypeName.equals("java.util.HashMap")) {
                    field.set(hwAddress, SimpleXMLParser.domNodeToMap(fieldNode));
                } else if (field.getType().isEnum()) {
                    Object[] enumConstants = field.getType().getEnumConstants();
                    for (Object enumConstant : enumConstants) {
                        if (enumConstant.toString().equals(fieldValueString)) {
                            field.set(hwAddress, enumConstant);
                        }
                    }
                } else {
                    field.set(hwAddress, fieldValueString);
                }
            } catch (NoSuchFieldException nsfe) {
                String errorMsg = "fromConfigXML(...) - Error occured while parsing XML <HardwareAddress> tag. "
                        + "The following variable does not exist in " + hwAddressClass.toString() + ": \""
                        + decodeFieldName(fieldName) + "\"";
                log.error(errorMsg);
                throw new IllegalArgumentException(errorMsg);
            } catch (IllegalAccessException iae) {
                iae.printStackTrace();
                throw new RuntimeException(iae);
            } catch (NumberFormatException npe) {
                String errorMsg = "fromConfigXML(...) - Error occured while parsing XML <HardwareAddress> tag. Field \""
                        + fieldName + "\" shall not be empty since we expect a \"" + fieldTypeName
                        + "\" value. Please correct the XML configuration for " + hwAddressClass.toString();
                log.error(errorMsg);
                throw new IllegalArgumentException(errorMsg);
            }
        }
    }
    return hwAddress;
}

From source file:org.apache.accumulo.core.client.mock.MockTableOperationsImpl.java

@Override
public boolean testClassLoad(String tableName, String className, String asTypeName)
        throws AccumuloException, AccumuloSecurityException, TableNotFoundException {

    try {/* w  ww.ja v  a2  s .  c  om*/
        AccumuloVFSClassLoader.loadClass(className, Class.forName(asTypeName));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:com.apatar.buzzsaw.BuzzsawNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");

    try {// w ww .j a v  a2s  . c om
        WizardPanelDescriptor descriptor1 = new DBConnectionDescriptor(this,
                new JPropertySheetPage(wizard.getDialog()), BuzzsawFolderTreeDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.buzzsaw.BuzzsawConnection"), "db_connector",
                "buzzsaw");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        WizardPanelDescriptor descriptor2 = new BuzzsawFolderTreeDescriptor(this,
                DBConnectionDescriptor.IDENTIFIER, WebDavModeDescriptor.IDENTIFIER);
        wizard.registerWizardPanel(BuzzsawFolderTreeDescriptor.IDENTIFIER, descriptor2);

        WizardPanelDescriptor descriptor3 = new WebDavModeDescriptor(this,
                BuzzsawFolderTreeDescriptor.IDENTIFIER, WizardPanelDescriptor.FINISH);
        wizard.registerWizardPanel(WebDavModeDescriptor.IDENTIFIER, descriptor3);

        wizard.setKeyForReferringToDescription("help.connector.buzzsaw");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.apparatus_templi.Coordinator.java

/**
 * Returns a list of available drivers. This list is queried from a hard-coded directory, and
 * may not represent drivers loaded from a different CLASSPATH.
 * /*from  w  w w.  j a  v a 2 s. c o  m*/
 * @return an ArrayList<String> of available driver classes.
 */
public static synchronized ArrayList<String> getAvailableDrivers() {
    ArrayList<String> list = new ArrayList<String>();
    try {
        for (Class<org.apparatus_templi.driver.Driver> c : findClasses(
                new File("bin/org/apparatus_templi/driver/"), "org.apparatus_templi.driver")) {
            list.add(c.getSimpleName());
        }
    } catch (ClassNotFoundException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    return list;
}