Example usage for java.lang IllegalArgumentException printStackTrace

List of usage examples for java.lang IllegalArgumentException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.fanfou.app.opensource.api.ApiParser.java

public static String parseString(final Cursor c, final String columnName) {
    try {/*w ww  .  ja va 2s  . c om*/
        return c.getString(c.getColumnIndexOrThrow(columnName));
    } catch (final IllegalArgumentException e) {
        if (AppContext.DEBUG) {
            e.printStackTrace();
        }
    }
    return null;
}

From source file:edu.cuny.cat.market.matching.FourHeapShoutEngine.java

/**
 * Insert a shout into a binary heap.//from ww w .jav  a  2  s  .  c o m
 * 
 * @param heap
 *          The heap to insert into
 * @param shout
 *          The shout to insert
 * 
 */
private static void insertShout(final PriorityBuffer<Shout> heap, final Shout shout)
        throws DuplicateShoutException {
    try {
        heap.add(shout);
    } catch (final IllegalArgumentException e) {
        FourHeapShoutEngine.logger.error(e.toString());
        e.printStackTrace();
        throw new DuplicateShoutException("Duplicate shout: " + shout.toString());
    }
}

From source file:fm.smart.r1.activity.CreateSoundActivity.java

private static void playSound(FileDescriptor fileDescriptor) {

    if (mMediaPlayer != null) {
        mMediaPlayer.release();/*from  www .  j av a 2s. co m*/
        mMediaPlayer = null;
    }

    mMediaPlayer = new MediaPlayer();

    try {
        mMediaPlayer.setDataSource(fileDescriptor);
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        mMediaPlayer.prepare();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    mMediaPlayer.start();

    // if (action.equals(Intent.ACTION_PICK)
    // || action.equals(Intent.ACTION_GET_CONTENT)) {
    // Uri uri = ContentUris.withAppendedId(getIntent().getData(), list_id);
    //
    // Intent intent = getIntent();
    // intent.setData(uri);
    // setResult(RESULT_OK, intent);
    // } else {
    // Uri uri = ContentUris.withAppendedId(SmartFm.Items.CONTENT_URI,
    // list_id);
    //
    // startActivity(new Intent(Intent.ACTION_VIEW, uri));
    // }
}

From source file:net.dries007.coremod.Coremod.java

private static void parseModule(JsonNode modulesJSON, String moduleName) {
    msg("Parsing module " + moduleName);
    try {//from   ww w  .ja  v a  2s  .  c o  m
        JsonNode moduleJSON = modulesJSON.getNode(moduleName);
        // Getting default from JSON
        if (!Data.modules.containsKey(moduleName)) {
            if (Data.hasKey(Data.JSONKEY_DEFAULT))
                Data.modules.put(moduleName, moduleJSON.getBooleanValue(Data.get(Data.JSONKEY_DEFAULT),
                        FMLLaunchHandler.side().name().toLowerCase()).toString());
            else
                Data.modules.put(moduleName, false);
        }

        // Actual parsing if we want the module
        if (Boolean.parseBoolean(Data.modules.getProperty(moduleName))) {
            Module module = new Module(moduleName);

            if (!moduleJSON.isNode(Data.get(Data.MC_VERSION))) {
                msg("Module (" + moduleName + ") not available for your MC version. Skipping.");
                return;
            }

            // Get the files from the JSON
            for (JsonNode fileJSON : moduleJSON.getArrayNode(Data.get(Data.MC_VERSION), Data.branch,
                    Data.get(Data.JSONKEY_FILES))) {
                File file = new File(Data.modulesFolder,
                        fileJSON.getStringValue(Data.get(Data.JSONKEY_FILE_NAME)));
                moduleFiles.add(file);
                module.files.add(
                        new ModuleFile(file, new URL(fileJSON.getStringValue(Data.get(Data.JSONKEY_FILE_URL))),
                                fileJSON.getStringValue(Data.get(Data.JSONKEY_FILE_HASH))));
            }

            // Get the INTERMODULE dependencies from the JSON
            for (JsonNode dependencyJSON : moduleJSON.getArrayNode(Data.get(Data.MC_VERSION), Data.branch,
                    Data.get(Data.JSONKEY_DEPENDENCIES))) {
                if (Boolean.parseBoolean(Data.modules.getProperty(dependencyJSON.getText(), "false"))) {
                    msg("Module (" + moduleName + ") needs another module (" + dependencyJSON.getText()
                            + ") as dependency that is not enabled. Enabling!");
                    Data.modules.setProperty(dependencyJSON.getText(), "true");
                    if (!moduleMap.containsKey(dependencyJSON.getText()))
                        parseModule(modulesJSON, dependencyJSON.getText());
                }
            }

            module.checkJarFiles();
            module.parceJarFiles();

            depencies.addAll(module.dependecies);
            moduleMap.put(moduleName, module);
        }
    } catch (IllegalArgumentException e) {
        msg("Parsing module (" + moduleName + ") FAILED");
        e.printStackTrace();
    } catch (MalformedURLException e) {
        msg("Parsing module (" + moduleName + ") FAILED");
        e.printStackTrace();
    } catch (IOException e) {
        msg("Parsing module (" + moduleName + ") FAILED");
        e.printStackTrace();
    }
}

From source file:com.projity.util.ClassUtils.java

public static void setStaticField(String field, String value) {
    try {// w  ww  . j  a v a  2 s  . c  om
        staticFieldFromFullName(field).set(null, value);
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.projity.util.ClassUtils.java

/**
 * Set the array size of the custom field this applies to
 * @param boundsField/*  w  w w.  j a  v a2s. c  om*/
 */
public static void setStaticField(String field, int value) {
    try {
        staticFieldFromFullName(field).setInt(null, value);
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:net.sourceforge.jasa.market.FourHeapOrderBook.java

/**
 * Insert a shout into a binary heap.//  w w w  . j  a  v  a2s . co  m
 * 
 * @param heap
 *          The heap to insert into
 * @param shout
 *          The shout to insert
 * 
 */
private static void insertShout(PriorityQueue<Order> heap, Order shout) throws DuplicateShoutException {
    try {
        heap.add(shout);
    } catch (IllegalArgumentException e) {
        logger.error(e);
        e.printStackTrace();
        throw new DuplicateShoutException("Duplicate shout: " + shout.toString());
    }
}

From source file:org.mrgeo.utils.HadoopUtils.java

public static JobContext createJobContext(final Configuration conf, final JobID id) {
    if (jobContext == null) {
        loadJobContextClass();//  w ww.  ja v  a 2  s.  c  om
    }

    try {
        return (JobContext) jobContext.newInstance(new Object[] { conf, id });
    } catch (final IllegalArgumentException e) {
        e.printStackTrace();
    } catch (final InstantiationException e) {
        e.printStackTrace();
    } catch (final IllegalAccessException e) {
        e.printStackTrace();
    } catch (final InvocationTargetException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:org.mrgeo.utils.HadoopUtils.java

public static TaskAttemptContext createTaskAttemptContext(final Configuration conf, final TaskAttemptID id) {
    if (taskAttempt == null) {
        loadTaskAttemptClass();/*from w  ww. j  a  v  a  2 s  .c o  m*/
    }

    try {
        return (TaskAttemptContext) taskAttempt.newInstance(new Object[] { conf, id });
    } catch (final IllegalArgumentException e) {
        e.printStackTrace();
    } catch (final InstantiationException e) {
        e.printStackTrace();
    } catch (final IllegalAccessException e) {
        e.printStackTrace();
    } catch (final InvocationTargetException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:li.barter.utils.Utils.java

public static boolean copyFile(final File src, final File dst) {
    boolean returnValue = true;

    FileChannel inChannel = null, outChannel = null;

    try {/* w ww . ja  va2s  .c  om*/

        inChannel = new FileInputStream(src).getChannel();
        outChannel = new FileOutputStream(dst).getChannel();

    } catch (final FileNotFoundException fnfe) {

        Logger.d(TAG, "inChannel/outChannel FileNotFoundException");
        fnfe.printStackTrace();
        return false;
    }

    try {
        inChannel.transferTo(0, inChannel.size(), outChannel);

    } catch (final IllegalArgumentException iae) {

        Logger.d(TAG, "TransferTo IllegalArgumentException");
        iae.printStackTrace();
        returnValue = false;

    } catch (final NonReadableChannelException nrce) {

        Logger.d(TAG, "TransferTo NonReadableChannelException");
        nrce.printStackTrace();
        returnValue = false;

    } catch (final NonWritableChannelException nwce) {

        Logger.d(TAG, "TransferTo NonWritableChannelException");
        nwce.printStackTrace();
        returnValue = false;

    } catch (final ClosedByInterruptException cie) {

        Logger.d(TAG, "TransferTo ClosedByInterruptException");
        cie.printStackTrace();
        returnValue = false;

    } catch (final AsynchronousCloseException ace) {

        Logger.d(TAG, "TransferTo AsynchronousCloseException");
        ace.printStackTrace();
        returnValue = false;

    } catch (final ClosedChannelException cce) {

        Logger.d(TAG, "TransferTo ClosedChannelException");
        cce.printStackTrace();
        returnValue = false;

    } catch (final IOException ioe) {

        Logger.d(TAG, "TransferTo IOException");
        ioe.printStackTrace();
        returnValue = false;

    } finally {

        if (inChannel != null) {
            try {

                inChannel.close();
            } catch (final IOException e) {
                e.printStackTrace();
            }
        }

        if (outChannel != null) {
            try {
                outChannel.close();
            } catch (final IOException e) {
                e.printStackTrace();
            }
        }

    }

    return returnValue;
}