Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:xiaofei.library.datastorage.database.DbService.java

@Override
public <T> List<Pair<String, T>> getAllObjects(Class<T> clazz) {
    List<Pair<String, T>> list = new LinkedList<Pair<String, T>>();
    Cursor cursor = mDb.query(DbConst.TABLE_NAME, null,
            generateEquation(DbConst.CLASS_ID, mAnnotationProcessor.getClassId(clazz)), null, null, null, null);
    while (cursor.moveToNext()) {
        String data = cursor.getString(cursor.getColumnIndex(DbConst.OBJECT_DATA));
        String id = cursor.getString(cursor.getColumnIndex(DbConst.OBJECT_ID));
        T object = null;//w ww . j  a va  2  s.c  o m
        try {
            object = mCoder.decode(data, clazz);
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        if (object != null) {
            list.add(new Pair<String, T>(id, object));
        }
    }
    cursor.close();
    return list;
}

From source file:com.predic8.plugin.membrane.components.messagefolder.MessageTabManager.java

public void copyBodyFromGUIToModel() {
    try {//from w  w w. j  a  v  a 2 s.  c o m
        baseComp.getMsg().setBodyContent(getBodyText().getBytes());
        // TODO header view must be refreshed
        log.debug("Body copied from GUI to model");
    } catch (RuntimeException e) {
        e.printStackTrace();
    }
}

From source file:xiaofei.library.datastorage.database.DbService.java

@Override
public <T> List<Pair<String, T>> getObjects(Class<T> clazz, Condition<T> condition) {
    List<Pair<String, T>> result = new LinkedList<Pair<String, T>>();
    Cursor cursor = mDb.query(DbConst.TABLE_NAME, null,
            generateEquation(DbConst.CLASS_ID, mAnnotationProcessor.getClassId(clazz)), null, null, null, null);
    while (cursor.moveToNext()) {
        String data = cursor.getString(cursor.getColumnIndex(DbConst.OBJECT_DATA));
        T object = null;/*from   w  w  w .  j  av  a2 s.  c  om*/
        try {
            object = mCoder.decode(data, clazz);
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        if (object == null) {
            continue;
        }
        if (condition == null || condition != null && condition.satisfy(object)) {
            String id = cursor.getString(cursor.getColumnIndex(DbConst.OBJECT_ID));
            result.add(new Pair<String, T>(id, object));
        }
    }
    return result;
}

From source file:com.limewoodmedia.nsdroid.activities.News.java

/**
 * Loads data from the NS API into the overview panels
 *///from  w  ww  .ja  va2s  .c o m
private void loadData() {
    errorMessage = getResources().getString(R.string.general_error);
    // Show loading animation
    final LoadingView loadingView = (LoadingView) findViewById(R.id.loading);
    LoadingHelper.startLoading(loadingView);
    new AsyncTask<Void, Void, Boolean>() {
        StringBuilder html;

        @Override
        protected void onPreExecute() {
            html = new StringBuilder();
        }

        protected Boolean doInBackground(Void... params) {
            try {
                XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
                XmlPullParser xpp = factory.newPullParser();

                HttpGet get = new HttpGet(NEWS_URL);
                HttpClient client = new DefaultHttpClient();
                HttpResponse response = client.execute(get);

                xpp.setInput(response.getEntity().getContent(), "UTF-8");
                String tagName;
                while (xpp.next() != XmlPullParser.END_DOCUMENT) {
                    switch (xpp.getEventType()) {
                    case XmlPullParser.START_TAG:
                        tagName = xpp.getName().toLowerCase();
                        if (tagName.equals("item")) {
                            html.append(parseItem(xpp));
                        } else {
                            Log.w(TAG, "Unknown rss tag: " + tagName);
                        }
                        break;
                    }
                }

                return true;
            } catch (RuntimeException e) {
                e.printStackTrace();
                errorMessage = e.getMessage();
            } catch (XmlPullParserException e) {
                e.printStackTrace();
                errorMessage = e.getMessage();
            } catch (ClientProtocolException e) {
                e.printStackTrace();
                errorMessage = e.getMessage();
            } catch (IOException e) {
                e.printStackTrace();
                errorMessage = e.getMessage();
            }

            return false;
        }

        protected void onPostExecute(Boolean result) {
            // Remove loading animation
            LoadingHelper.stopLoading(loadingView);
            if (result) {
                webView.getSettings().setUseWideViewPort(false);
                webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
                webView.loadDataWithBaseURL("http://www.nationstates.net",
                        "<link rel='stylesheet' href='/ns_v1422597706.css'>"
                                + "<style>h2 {color: #008000;}</style>" + html.toString(),
                        "text/html", "utf-8", null);
            } else {
                Toast.makeText(News.this, errorMessage, Toast.LENGTH_SHORT).show();
            }
        }
    }.execute();
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 *
 * @param user//ww w  .j  a va  2 s. c o  m
 */
public void actualizar(Usuario user) {
    Session sesion = HibernateUtil.getSessionFactory().openSession();

    try {
        sesion.update(user);

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 *
 * @param idUsuario/*from ww w  .  ja v a 2s  .co  m*/
 */
public void guardar(Usuario idUsuario) {
    Session sesion = HibernateUtil.getSessionFactory().openSession();

    try {
        sesion.save(idUsuario);

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
}

From source file:com.orchestra.portale.controller.TestController.java

@RequestMapping("/insertMongo")
public ModelAndView insertSectionsList() {

    ModelAndView model = new ModelAndView("testview");
    String msg = "ok";

    try {//w w w .  j av a  2  s.com

        CompletePOI poi = new CompletePOI();

        poi.setName("Pio Monte Della Misericordia");
        ArrayList<String> categories = new ArrayList<String>();
        categories.add("Museo");
        poi.setCategories(categories);
        poi.setLocation(new double[] { 40.85123, 14.258117 });
        poi.setAddress("Via dei Tribunali 253, 80138 Napoli");
        poi.setShortDescription("Bellissimo posto!");

        ArrayList<AbstractPoiComponent> listComponent = new ArrayList<AbstractPoiComponent>();

        //componente DescriptionComponent
        ArrayList<Section> list = new ArrayList<Section>();
        Section section = new Section();
        section.setTitle("Titolo1");
        section.setDescription("Descrizion1");
        Section section1 = new Section();
        section1.setTitle("Titolo2");
        section1.setDescription("Descrizion2");
        list.add(section);
        list.add(section1);
        DescriptionComponent description_component = new DescriptionComponent();
        description_component.setSectionsList(list);
        listComponent.add(description_component);
        //componente contatti
        ContactsComponent contacts_component = new ContactsComponent();
        //Recapiti telefonici
        ArrayList<PhoneContact> phoneList = new ArrayList<PhoneContact>();
        PhoneContact phone = new PhoneContact();
        phone.setLabel("Telefono");
        phone.setNumber("081123456789");
        PhoneContact phone1 = new PhoneContact();
        phone1.setLabel("Telefono1");
        phone1.setNumber("081555666777");
        phoneList.add(phone);
        phoneList.add(phone1);
        contacts_component.setPhoneList(phoneList);
        //Indirizzi email
        ArrayList<EmailContact> emailList = new ArrayList<EmailContact>();
        EmailContact email = new EmailContact();
        email.setLabel("Email");
        email.setEmail("email@email.com");
        EmailContact email1 = new EmailContact();
        email1.setLabel("Email1");
        email1.setEmail("email1@email.com");
        emailList.add(email);
        emailList.add(email1);
        contacts_component.setEmailsList(emailList);
        //facebook & twitter
        contacts_component.setFacebook("www.facebook.com/pagina");
        contacts_component.setTwitter("www.twitter.com/pagina");

        listComponent.add(contacts_component);

        //componente titolo
        TitleComponent title = new TitleComponent();
        title.setTitle("Pio Monte Della Misericordia");
        listComponent.add(title);

        //componente cover
        CoverImgComponent cover = new CoverImgComponent();
        cover.setLink("pm1.jpg");
        listComponent.add(cover);

        //componente galleria immagini
        ImageGalleryComponent img_gallery = new ImageGalleryComponent();
        ArrayList<String> links = new ArrayList<String>();
        links.add("pm1.jpg");
        links.add("pm2.jpg");
        links.add("pm3.jpg");
        img_gallery.setLinks(links);
        listComponent.add(img_gallery);

        poi.setComponents(listComponent);

        poiMongoRepo.save(poi);
    } catch (RuntimeException e) {
        msg = "error";
        e.printStackTrace();
    }

    model.addObject("msg", msg);

    return model;
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 * Bloquea/desbloquea usuario de la base de datos
 *
 * @param codigo/*from w w w. ja  va 2 s .  c  o m*/
 * @param bloqueado
 */
public void bloquear(Long codigo, String bloqueado) {
    Session sesion = HibernateUtil.getSessionFactory().openSession();

    try {
        Query qu = sesion.createQuery("Update Usuario U set U.bloqueado=:bloq where U.idUsuario=:cod")
                .setParameter("bloq", bloqueado).setParameter("cod", codigo);
        qu.executeUpdate();

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 *
 * @param idUsuario/*from  w  w w.ja v a 2  s  .co m*/
 */
public void setRegistroCompleto(Long idUsuario) {
    Session sesion = HibernateUtil.getSessionFactory().openSession();

    try {
        Query qu = sesion.createQuery("Update Usuario U set U.confirmado='S' where U.idUsuario=:id")
                .setParameter("id", idUsuario);
        qu.executeUpdate();

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 *
 * @return/*from w  ww.j ava  2s .c  o m*/
 */
public List<Usuario> getTodos() {
    List<Usuario> salida = new ArrayList();
    Session sesion = HibernateUtil.getSessionFactory().openSession();

    try {
        Query qu = sesion.createQuery("Select U from Usuario U");
        salida = qu.list();

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
    return salida;
}