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.allmycode.flags.other.MyActivityOther.java

public void go(View view) {
    Intent intent = new Intent();
    String targetActivityName = "com.allmycode.flags";
    String fromEditText = targetActivity.getText().toString().trim();
    String other = (fromEditText.contains("Other")) ? ".other" : "";
    targetActivityName += other;/*from  ww w  .  ja  v a 2 s .com*/
    targetActivityName += ".FlagsDemoActivity";
    targetActivityName += fromEditText;
    Log.i(CLASSNAME, "Target activity: >>" + targetActivityName + "<<");
    intent.setClassName("com.allmycode.flags" + other, targetActivityName);
    String allFlags = flags.getText().toString();
    int flagsValue = 0;
    if (allFlags != "" && allFlags != null) {

        TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter('|');
        splitter.setString(allFlags);
        boolean existErrors = false;
        for (String flagName : splitter) {

            Log.i(CLASSNAME, ">>" + flagName + "<<");

            flagName = flagName.trim();
            if (!flagName.equals("") && flagName != null) { // BARRY
                                                            // need
                                                            // both?
                if (isHex(flagName)) {
                    Log.i(CLASSNAME, flagName + " is hex");
                    flagsValue |= Integer.parseInt(flagName.substring(2), 16);
                } else if (isDec(flagName)) {
                    Log.i(CLASSNAME, flagName + " is decimal");
                    flagsValue |= Integer.parseInt(flagName);
                } else {
                    Field flagsField = null;
                    try {
                        Log.i(CLASSNAME, "About to do reflection>>" + flagName + "<<");
                        flagsField = Intent.class.getField(flagName);
                        Log.i(CLASSNAME, Integer.toString(flagsField.getInt(this)));
                        flagsValue |= flagsField.getInt(this);
                    } catch (SecurityException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (NoSuchFieldException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (IllegalAccessException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    }
                    try {
                        Log.i(CLASSNAME, Integer.toHexString(flagsValue));
                        if (flagsValue != 0) {
                            intent.addFlags(flagsValue);
                        }
                    } catch (IllegalArgumentException e) {
                        existErrors = true;
                        e.printStackTrace();
                    }
                }
            }
        }
        if (flagsValue != 0) {
            intent.addFlags(flagsValue);
        }
        intent.putExtra("existErrors", existErrors);

        Log.i(CLASSNAME, "About to start " + intent.toString());
        startActivity(intent);
    }
}

From source file:com.ok.utils.widget.LoopViewPager.java

@Override
public boolean onTouchEvent(MotionEvent e) {
    try {/*from   www .  j a  va 2 s. c o  m*/
        return super.onTouchEvent(e);
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    }
    return false;
}

From source file:com.ok.utils.widget.LoopViewPager.java

@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
    try {/*  ww w. java 2  s.  co m*/
        return super.onInterceptTouchEvent(e);
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    }
    return false;
}

From source file:de.fuberlin.wiwiss.marbles.loading.DereferencerBatch.java

/**
 * Loads URL if not yet loaded/*from  ww w . j  a va  2s .  c  om*/
 * 
 * @param url   The URL to load
 * @param step   The distance from the focal resource
 * @param redirectCount   The number of redirects performed in the course of this individual request
 * @param forceReload   Set this to true if the URL should be loaded even if a valid copy is already in the cache
 * @throws URIException
 */
public void loadURL(URI url, int step, int redirectCount, boolean forceReload) throws URIException {
    if (step > maxSteps || redirectCount > maxRedirects)
        return;

    /* Cut off local names from URI */
    url.setFragment("");

    if (retrievedURLs.contains(
            url)) /* force reload doesn't apply on batch level, as they are short-lived and this could cause infinite loops */
        return;

    if (!forceReload && cacheController.hasURLData(url.toString())) {
        /* Treat as retrieved when reading from cache */
        retrievedURLs.add(url);

        String redirect = cacheController.getCachedRedirect(url.toString());

        /* Process a cached redirect */
        if (redirect != null) {
            URI redirectUrl = new URI(url, redirect, true);
            loadURL(redirectUrl, step, redirectCount + 1, forceReload);
        } else {
            /* Data is already loaded; try to find new links within it */
            try {
                org.openrdf.model.URI sesameUri = new URIImpl(url.toString());
                processLinks(step + 1, sesameUri);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        }
    } else {
        /* No data about this URL; get it */
        ExtendedDereferencingTask task = new ExtendedDereferencingTask(this, url.toString(), step,
                redirectCount, forceReload);
        if (uriQueue.addTask(task)) {
            pendingTasks.add(task);
            retrievedURLs.add(url);
        }
    }
}

From source file:com.online.fullsail.SaveWebMedia.java

private Bitmap getVideoFrame(String uri) {
    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    try {/* w  w  w.j  a v  a  2s. com*/
        if (Integer.parseInt(Build.VERSION.SDK) > Build.VERSION_CODES.GINGERBREAD) {
            retriever.setDataSource(uri);
            return retriever.getFrameAtTime();
        } else {
            retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
            retriever.setDataSource(uri);
            return retriever.captureFrame();
            // These items were handled by the custom android media class
            // Despite being marked errors, they compile without an issue
        }
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    } catch (RuntimeException ex) {
        ex.printStackTrace();
    } finally {
        try {
            retriever.release();
        } catch (RuntimeException ex) {
        }
    }
    return null;
}

From source file:org.apache.woden.internal.resolver.SimpleURIResolver.java

/**
 * Load properties from specified catalog location and append to exising catalog.
 * // www  .j  a  v a 2 s.  com
 * @param catalogLocation - location of catalog file to load
 * @param catalog - exisiting catalog data to which to append
 * @return appended catalog
 */
private Properties loadCatalog(URL catalogLocation, Properties catalog) {
    if (catalogLocation != null) {
        try {
            catalog.load(catalogLocation.openStream());
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            // treat missing properties file as empty file, ie no resolves specified.
            // TODO log this
        } catch (MalformedURLException e) {
            e.printStackTrace();
            // load() failed, continue with no resolves
            // TODO log this
        } catch (IOException e) {
            e.printStackTrace();
            // load() failed, continue with no resolves
            // TODO log this
        }
    }
    return catalog;
}

From source file:info.rmapproject.core.model.impl.openrdf.ORAdapterTest.java

@Test
public void testOpenRdfValue2RMapResource() throws Exception {
    Value value = ORAdapter.getValueFactory().createLiteral("OpenRDF Literal");
    RMapValue rmr = null;// w  ww .j  a v  a  2s  . c om
    try {
        rmr = ORAdapter.openRdfValue2RMapValue(value);
        assertTrue(rmr instanceof RMapLiteral);
        assertEquals(value.stringValue(), rmr.getStringValue());
        assertEquals(value.stringValue(), rmr.toString());
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        fail();
    }
    String bnId = null;
    try {
        bnId = rmapIdService.createId().toASCIIString();
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
    value = ORAdapter.getValueFactory().createBNode(bnId);
    try {
        rmr = ORAdapter.openRdfValue2RMapValue(value);
        assertTrue(rmr instanceof RMapBlankNode);
        assertEquals(value.stringValue(), rmr.toString());
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        fail();
    }
    String urString = "http://rmap-project.info/rmap/";
    value = ORAdapter.getValueFactory().createIRI(urString);
    try {
        rmr = ORAdapter.openRdfValue2RMapValue(value);
        assertTrue(rmr instanceof RMapIri);
        assertEquals(value.toString(), rmr.toString());
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        fail();
    }
}

From source file:playground.sergioo.capacitiesChanger2012.gui.NetworkPanel.java

public String getLabelText(playground.sergioo.visualizer2D2012.LayersWindow.Labels label) {
    try {/*from   ww  w.  j a  va  2s. c om*/
        return (String) CarNetworkPainterManager.class.getMethod("refresh" + label.getText(), new Class[0])
                .invoke(((NetworkPainter) getActiveLayer().getPainter()).getNetworkPainterManager(),
                        new Object[0]);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:kr.re.dev.LikeAA.LikeAA.java

@SuppressLint("HandlerLeak")
private void callAfterViews() {
    for (Method method : mAfterViewsMethods) {
        if (!method.isAccessible())
            method.setAccessible(true);//from ww  w .j a va2s  . c  om
        final WeakReference<Handler> waekHandler = new WeakReference<Handler>(
                new Handler(Looper.getMainLooper()) {
                    public void dispatchMessage(Message msg) {
                        Object target = mFinder.getTarget();
                        if (target == null)
                            return;
                        Method method = (Method) msg.obj;
                        try {
                            method.invoke(target, makeEmptyArgs(method.getParameterTypes()));
                        } catch (IllegalArgumentException e) {
                            e.printStackTrace();
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        } catch (InvocationTargetException e) {
                            e.printStackTrace();
                        } catch (Exception e) {
                            Thread.getDefaultUncaughtExceptionHandler()
                                    .uncaughtException(Looper.getMainLooper().getThread(), e);
                        }

                    };
                });
        Message msg = waekHandler.get().obtainMessage();
        msg.obj = method;
        waekHandler.get().sendMessage(msg);
        waekHandler.clear();
    }
}

From source file:de.clusteval.data.dataset.generator.DataSetGenerator.java

@Override
public RepositoryObject clone() {
    try {/* ww  w  .j av  a 2  s .c  o m*/
        return this.getClass().getConstructor(this.getClass()).newInstance(this);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    this.log.warn("Cloning instance of class " + this.getClass().getSimpleName() + " failed");
    return null;
}