Package com.substanceofcode.utils

Examples of com.substanceofcode.utils.CauseException


      } else if (cmd.getCommandType() == Command.CANCEL) {
        midlet.setCurrent(disp);
        return;
      }
    } catch (Throwable e) {
      final CauseException ce = new CauseException(
          "Unable to show alert.", e);
      //#ifdef DLOGGING
      logger.severe(ce.getMessage(), e);
      //#endif
      /** Error while parsing RSS feed */
      System.out.println(e.getClass().getName() + " " + ce.getMessage());
      e.printStackTrace();
    }
  }
View Full Code Here


            m_bookmarkList.insert(m_addBkmrk++, name, null);
          }
        } else {
          /* Error:  Feed already exists with name (name) */
          /*.  Existing feed not updated. */
          CauseException ce = new CauseException(
              ResourceProviderME.get("exc.fd.ex", name));
          m_loadForm.appendMsg(ce.getMessage());
          m_loadForm.addExc(ce);
          notesShown = true;
        }
      }
    }
View Full Code Here

    recordExcForm(ResourceProviderME.get(key), e);
  }

  /* Record the exception in the loading form, log it and give std error. */
  final public void recordExcForm(final String causeMsg, final Throwable e) {
    final CauseException ce = new CauseException(causeMsg, e);
    m_loadForm.addExc(ce);
    //#ifdef DLOGGING
    logger.severe(ce.getMessage(), e);
    //#endif
    /** Error while parsing RSS feed */
    System.out.println(e.getClass().getName() + " " + ce.getMessage());
    e.printStackTrace();
    m_loadForm.appendMsg(ce.getMessage());
    setCurrent( m_loadForm );
  }
View Full Code Here

      System.out.println("getAttributeValue error." + t + " " +
                     t.getMessage());
      if (m_acceptErrors) {
        return null;
      } else {
        CauseException ce = new CauseException(
            "Parse attribute read error. Internal error.", t);
        throw ce;
      }
    }
    }
View Full Code Here

      //#ifdef DLOGGING
      logger.severe("FeedListParser.run(): Error while parsing " +
                "feeds: " + m_url, ex);
      //#endif
            System.err.println("FeedListParser.run(): Error while parsing feeds: " + ex.toString());
      m_ex = new CauseException("Error while parsing feed " + m_url, ex);
        } catch( CauseMemoryException ex ) {
      m_feeds = null;
      System.gc();
      m_ex = new CauseMemoryException("Out of memory error while " +
          "parsing feed " + m_url, ex);
      //#ifdef DLOGGING
      logger.severe(m_ex.getMessage(), ex);
      //#endif
        } catch( Exception ex ) {
      //#ifdef DLOGGING
      logger.severe("FeedListParser.run(): Error while parsing " +
                "feeds: " + m_url, ex);
      //#endif
            System.err.println("FeedListParser.run(): Error while parsing feeds: " + ex.toString());
      m_ex = new CauseException("Error while parsing feed " + m_url, ex);
        } catch( OutOfMemoryError t ) {
      m_feeds = null;
      System.gc();
      //#ifdef DLOGGING
      logger.severe("FeedListParser.run(): Out Of Memory Error while " +
          "parsing feeds: " + m_url, t);
      //#endif
            System.err.println("FeedListParser.run(): " +
          "Out Of Memory Error while parsing feeds: " + t.toString());
      m_ex = new CauseMemoryException("Out Of Memory Error while " +
          "parsing feed " + m_url, t);
        } catch( Throwable t ) {
      //#ifdef DLOGGING
      logger.severe("FeedListParser.run(): Error while parsing " +
                "feeds: " + m_url, t);
      //#endif
            System.err.println("FeedListParser.run(): Error while parsing feeds: " + t.toString());
      m_ex = new CauseException("Internal error while parsing feed " +
                    m_url, t);
        } finally {
            m_ready = true;
        }       
    } 
View Full Code Here

      }
        } catch(CauseMemoryException e) {
      throw e;
        } catch(Exception e) {
            /* Error while parsing import data: */
            CauseException ce = new CauseException(ResourceProviderME.get(
            "exc.err.imp", m_url), e);
      //#ifdef DLOGGING
      logger.severe(ce.getMessage(), e);
      //#endif
      if ((m_url != null) && m_url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw ce;
        } catch(OutOfMemoryError t) {
      m_feeds = null;
      System.gc();
      //#ifdef DLOGGING
      logger.severe("Out Of Memory Error with " + m_url, t);
      //#endif
      if ((m_url != null) && m_url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            /* Out Of Memory Error while parsing RSS data */
            throw new CauseMemoryException(ResourceProviderME.get(
            "exc.om.rsd", m_url), t);
        } catch(Throwable t) {
      //#ifdef DLOGGING
      logger.severe("parseFeeds error with " + m_url, t);
      //#endif
      if ((m_url != null) && m_url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException(
          "Internal error while parsing RSS data " + m_url, t);
        } finally {
      super.handleClose();
    }
    }   
View Full Code Here

      logger.severe("parseRssFeedUrl error with " + url, e);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Error while parsing RSS data: "
                    + e.toString(), e);
    } catch (OutOfMemoryError e) {
      if (m_rssFeed != null) {
        m_rssFeed.setItems(null);
        m_rssFeed.setItems(new Vector());
      }
            CauseMemoryException ce =
          new CauseMemoryException("Out of memory error while " +
          "parsing RSS data: " + e.toString(), e);
      //#ifdef DLOGGING
      logger.severe(ce.getMessage(), e);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw ce;
        } catch(Throwable t) {
      //#ifdef DLOGGING
      logger.severe("parseRssFeedUrl error with " + url, t);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Error while parsing RSS data: "
                + t.toString(), t);
        } finally {
      super.handleClose();
    }
    }
View Full Code Here

      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }

            throw new CauseException("Error while parsing RSS data:  " +
                    url, e);
        } catch(ConnectionNotFoundException e) {
      //#ifdef DLOGGING
      logger.severe("handleOpen connection error with " + url, e);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Bad URL/File or protocol error while " +
                   "opening: " + url, e);
    //#ifdef DMIDP20
        } catch(CertificateException e) {
      //#ifdef DLOGGING
      logger.severe("handleOpen https security error with " + url, e);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Bad URL/File or protocol error or " +
          "certifacate error while opening: " + url, e);
    //#endif
        } catch(IOException e) {
      throw e;
        } catch(SecurityException e) {
      //#ifdef DLOGGING
      logger.severe("handleOpen security error with " + url, e);
      //#endif
      if ((url != null) && url.startsWith("file://")) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Security error while oening " +
                   ": " + url, e);
        } catch(Exception e) {
      //#ifdef DLOGGING
      logger.severe("handleOpen internal error with " + url, e);
      //#endif
      if ((url != null) && (url.startsWith("file://"))) {
        System.err.println("Cannot process file.");
      }
            throw new CauseException("Internal error while parsing " +
                   ": " + url, e);
        } catch(Throwable t) {
      //#ifdef DLOGGING
      logger.severe("handleOpen internal error with " + url, t);
      //#endif
      t.printStackTrace();
            throw new CauseException("Internal error while parsing RSS data " +
                ":l" + url, t);
        }
    }
View Full Code Here

    }
    if (m_docEncoding.length() != 0) {
      try {
        String a = new String("a".getBytes(), m_docEncoding);
      } catch (UnsupportedEncodingException e) {
        CauseException ce = new CauseException(
            "UnsupportedEncodingException while trying to " +
            "convert doc encoding: " + m_docEncoding, e);
        if (m_excs == null) {
          m_excs = new Vector();
        }
        m_excs.addElement(ce);
        //#ifdef DLOGGING
        logger.severe(ce.getMessage(), e);
        //#endif
        System.out.println(ce.getMessage());
        // If encoding problem, use the main encoding as it is
        // close enough.
        if (m_windows) {
          if (hasWinEncoding) {
            m_docEncoding = winEncoding;
          } else {
            m_docEncoding = "";
          }
        } else if (m_utf) {
          m_docEncoding = "";
        } else {
          if (hasIso8859Encoding) {
            m_docEncoding = isoEncoding;
          } else {
            m_docEncoding = "";
          }
        }
        try {
          String a = new String("a".getBytes(), m_docEncoding);
        } catch (UnsupportedEncodingException e2) {
          CauseException ce2 = new CauseException(
              "Second unsupportedEncodingException while " +
              " trying to convert doc encoding: " +
              m_docEncoding, e2);
          m_excs.addElement(ce2);
          //#ifdef DLOGGING
          logger.severe(ce2.getMessage(), e2);
          //#endif
          System.out.println(ce2.getMessage());
          m_docEncoding = "";
        }
      }
    }
    m_encodingStreamReader.setModEncoding(modEncoding);
View Full Code Here

    try {
      try {
        String convStr = new String("a".getBytes(), "Cp1252");
        return "Cp1252";
      } catch (UnsupportedEncodingException e) {
        CauseException ce = new CauseException(
            "initWinEncoding UnsupportedEncodingException " +
            "while trying to convert encoding Cp1252.", e);
        if (m_statExcs == null) {
          m_statExcs = new Vector();
        }
        m_statExcs.addElement(ce);
        //#ifdef DTEST
        System.out.println(ce.getMessage());
        //#endif
        //#ifdef DLOGGING
        Logger logger = Logger.getLogger("EncodingUtil");
        logger.severe(ce.getMessage(), e);
        //#endif
        try {
          String convStr2 = new String("a".getBytes(), "WINDOWS-1252");
          return "WINDOWS-1252";
        } catch (UnsupportedEncodingException e2) {
          CauseException ce2 = new CauseException(
              "initWinEncoding second " +
              "unsupportedEncodingException while " +
              " trying to convert encoding WINDOWS-1252.", e2);
          m_statExcs.addElement(ce2);
          //#ifdef DTEST
          System.out.println(ce2.getMessage());
          //#endif
          //#ifdef DLOGGING
          logger.severe(ce2.getMessage(), e2);
          //#endif
        }
      }
    } catch (Throwable t) {
      //#ifdef DLOGGING
View Full Code Here

TOP

Related Classes of com.substanceofcode.utils.CauseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.