Would like to redirect java error ExceptionHelper.java

Hi All,
I think this might be the right forum... anyway, I'd like to redirect this java exception handler to a different URL. Pretty simple.
I've tried this line of code, but I can't compile... might just be in the wrong place, line 348 :
response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') );This is the whole exception file. Thank youf or your help.. I'm a newbie...
* Copyright � 2001 The JA-SIG Collaborative.  All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the
*    distribution.
* 3. Redistributions of any form whatsoever must retain the following
*    acknowledgment:
*    "This product includes software developed by the JA-SIG Collaborative
*    (http://www.jasig.org/)."
* THIS SOFTWARE IS PROVIDED BY THE JA-SIG COLLABORATIVE "AS IS" AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JA-SIG COLLABORATIVE OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
package org.jasig.portal;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ExceptionHelper {
    private static final Log log = LogFactory.getLog(ExceptionHelper.class);
    // List of strings to match in traceback for various containers
     // This array must be expanded as additional Application Server
     // containers become better known
    public static final String boundaries[] =
              "at javax.servlet.http.HttpServlet."
     * Generate traceback only to the Servlet-container interface.
     * @param ex any throwable exception
     * @return stack trace string without container layers
    public static String shortStackTrace(Throwable ex) {
         if (ex == null)
              return "";
        java.io.StringWriter sw = new java.io.StringWriter();
        ex.printStackTrace(new java.io.PrintWriter(sw));
        sw.flush();
        String stktr = sw.toString();
        return trimStackTrace(stktr);
     * Trims a String representation of a Stack Trace to remove
     * the portion of the trace that is in the servlet container layer.
     * @param stackTrace - String result of printStackTrace
     * @return the stack trace with portions of the trace that dive into the container
     * layer removed.
    static String trimStackTrace(String stackTrace) {
        StringBuffer trimmedTrace = new StringBuffer();
        // a List of Strings to be trimmed and appended to the buffer
        // these represent elements in the causal chain
        List fragments = new ArrayList();
        int causeCut = (stackTrace.indexOf("Caused by"));
        if (causeCut > 0) {
            // there are one or more Caused by fragments to consider
            // we traverse stackTrace, parsing out fragments for later processing
            // and updating stackTrace to contain the remaining unparsed portion
            // as we go
            while (stackTrace.length() > 0) {
                if (stackTrace.startsWith("Caused by")){
                    // don't count the "Caused by" leading the stackTrace
                    causeCut = stackTrace.substring(9).indexOf("Caused by");
                    if (causeCut > 0)
                        causeCut += 9;
                } else {
                    causeCut = stackTrace.indexOf("Caused by");
                if (causeCut > -1) {
                    // stackTrace currently includes multiple fragments
                    // parse out the first and leave the rest for next iteration
                    fragments.add(stackTrace.substring(0, causeCut));
                    stackTrace = stackTrace.substring(causeCut);
                } else {
                    // stackTrace currently is a bare fragment
                    // grab it
                    fragments.add(stackTrace);
                    stackTrace = "";
        } else {
            // there's ony a single Throwable in the chain
            fragments.add(stackTrace);
        // now that we have fragments to consider
        for (Iterator iter = fragments.iterator(); iter.hasNext();){
            String consideredFragment = (String) iter.next();
            // flag to indicate that a trimmed form of this fragment has been appended
            // to the trimmed stack trace buffer
            boolean appended = false;
            for (int i=0; i < boundaries.length; i++) {
                int cut = consideredFragment.indexOf(boundaries);
if (cut > 0) {
// stack trace includes a trace through our container
// in which we are not interested: trim it.
// grab the desired portion up to the boundary
trimmedTrace.append(consideredFragment.substring(0, cut).trim());
trimmedTrace.append("\n");
appended = true;
break;
if (! appended) {
// a trimmed version of this fragment was not appended
// because it doesn't need to be trimmed -- append the whole thing.
trimmedTrace.append(consideredFragment.trim());
trimmedTrace.append("\n");
return trimmedTrace.toString();
* Generic Exception Handler called from catch clause
* @param eid the ErrorID (as seen from catch)
* @param parm
* @param ex the Exception caught
* @throws PortalException
public static void genericHandler(ErrorID eid, String parm, Throwable ex)
throws PortalException {
// *** Handle PortalExceptions ***
     // Log it if logging was deferred in .signal() call
     // Rethrow it
if (ex instanceof PortalException) {
     if (((PortalException)ex).isLogPending())
          traceToLog(eid,parm,ex);
               throw (PortalException) ex;
// *** Handle all other Exceptions ***
// Log the message and traceback
traceToLog(eid, parm, ex);
// Create a derived PortalException chained to this
PortalException nex;
if (ex instanceof Exception) {
nex = new PortalException(eid, (Exception) ex);
} else {
     // Sorry, at this point PortalExceptions don't chain to
     // non-Exception subclasses of Throwable
nex = new PortalException(eid);
nex.setLogPending(false);
ProblemsTable.store(nex);
throw nex;
     public static void genericHandler(ErrorID eid, Throwable ex)
          throws PortalException {
               genericHandler(eid,null,ex);
     * Create PortalException from ErrorID and throw it. Maybe trace it.
     * @param eid ErrorId
     * @param parm Additional error information
     * @param tracenow Trace now or defer till first catch.
     * @throws PortalException
public static void signal(ErrorID eid, String parm, boolean tracenow)
throws PortalException {
PortalException nex = new PortalException(eid);
          nex.setParameter(parm);
signal(nex,tracenow);
* Create PortalException from Errorid, trace, and throw it.
* @param eid ErrorID to use to generate PortalException
* @param parm Additional error information
* @throws PortalException
public static void signal(ErrorID eid, String parm) throws PortalException {
     signal(eid,parm,true);
* Throw PortalException provided by caller, maybe trace it.
* @param nex Exception provided by caller
* @param tracenow Trace now, or later after first catch.
* @throws PortalException
private static void signal(PortalException nex, boolean tracenow)
throws PortalException {
if (tracenow) {
     traceToLog(nex.getErrorID(), nex.getParameter(), nex);
     ProblemsTable.store(nex);
throw nex;
* Generate, trace, and throw Portal Exception given ErrorID.
* @param eid ErrorID
* @throws PortalException
public static void signal(ErrorID eid)
     throws PortalException {
     signal(eid,null,true);
* Common logic for generating log entry of errors
* @param eid ErrorID with initial message
* @param parm Parameter string to append to eid msg
* @param ex Old exception
private static void traceToLog(ErrorID eid, String parm, Throwable ex) {
     if (ex !=null &&
          ex instanceof PortalException) {
               if (!((PortalException)ex).isLogPending())
                    return; // This PortalException was already logged.
               else
                    ((PortalException)ex).setLogPending(false);
String logmsg = errorInfo(eid, parm, ex);
log.error( logmsg);
* Generate error string for logging or /problems online display
* @param eid Error ID
* @param parm Parameter string
* @param ex Exception
* @return Multiline text with message and traceback
public static String errorInfo(ErrorID eid, String parm, Throwable ex) {
          StringBuffer errorinfobuffer = new StringBuffer(1000);
          if (eid!=Errors.legacy)
     errorinfobuffer.append(eid.getMessage()); // Error ID message
else
     errorinfobuffer.append(ex.getMessage());
          if (parm != null) { // Parameter data
               errorinfobuffer.append("\n [specific data: ");
               errorinfobuffer.append(parm);
               errorinfobuffer.append("] ");
          errorinfobuffer.append("\n");
          if (ex!=null)
               errorinfobuffer.append(shortStackTrace(ex)); // Stack trace
          return errorinfobuffer.toString();
* Generic Top-Level Exception Handler caled from catch clause
* (doesn't rethrow exception)
* @param eid Error ID
* @param parm Parameter string
* @param ex Exception caught
public static void genericTopHandler(ErrorID eid, String parm, Throwable ex) {
// If this is an already logged Portal Exception, we are done
if (ex instanceof PortalException &&
     !((PortalException)ex).isLogPending()) {
     return;
traceToLog(eid, parm, ex);
if (ex instanceof PortalException) // already in the table
     return;
          // Create a derived PortalException (just for Problems Table)
          PortalException nex=null;
          if (ex instanceof Exception)
               nex = new PortalException(eid, (Exception) ex);
          else
               nex = new PortalException(eid);
          ProblemsTable.store(nex);
     public static void genericTopHandler(ErrorID eid, Throwable ex) {
          genericTopHandler(eid, null, ex);
* Generate HTML page to send to end user after fatal error
* @param resp Servlet response object
* @param e PortalException received at Servlet code.
     public static void generateErrorPage(HttpServletResponse resp, Exception e) {
          resp.setContentType("text/html");
          try {
               response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') );
               PrintWriter out = resp.getWriter();
               out.println("<h1>Cannot start uPortal</h1>");
               out.println("<p>Sorry, but a problem is preventing the Portal from starting. "+
                    "The error must be corrected by system administrators. Try again later.</p>");
               //out.println("<p><a href='http://www.yale.edu/portal'>Click here to display the static Yaleinfo page.</a></p>");     
               out.println("<!--");
               ErrorID eid = Errors.bug;
               String parm = "";
               if (e instanceof PortalException) {
                    PortalException pe = (PortalException)e;
                    if (pe.errorID!=null)
                         eid=pe.errorID;
                    if (pe.parameter!=null)
                         parm=pe.parameter;     
               out.println(errorInfo(eid,parm,e));
               out.println("-->");     
               out.flush();
          } catch (Exception ex) {

I've tried this line of code, but I can't compile...
might just be in the wrong place, line 348 :
response.sendRedirect(response.encodeRedirectURL ('http://dev.sheridan.edu/uportal/errors/') );
Use double quotes instead of single quotes!
Single quotes are for char literals, not string literals.
And next time please copy and paste the complete error message, instead of just saying "it doesn't compile".

Similar Messages

  • ProductException: (error code = 200; message="Java error"; exception = [jav

    hello
    Take me if you have the power to fa is that I have a good time trying to install the demo of sap, but I fail to do so últimamemente follows all the steps but in the end I get the following error java:
    productException: (error code = 200; message="Java error"; exception = java.lang.Exception)
    at com.sap.installshield.sdcstepswrapper.StepWrapperI nstallFiles.execute(StepWrapperInstallFiles.java:2 54)
    at com.sap.installshield.sdcstepswrapper.StepWrapperI nstallFiles.executeAllSteps(StepWrapperInstallFile s.java:224)
    at com.sap.installshield.sdcstepswrapper.StepWrapperI nstallFiles.executeAllInstallationSteps(StepWrappe rInstallFiles.java:177)
    at java.lang.Thread.run(Unknown Source)
    may be that the Java Virtual Machine? what virtual machine
    it is recomd
    i don´t know how to correct them
    thank you very much
    bye

    Hello,
    This looks like a known issue error code: 200
    check this document:
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/6055f523-df6e-2910-f0bf-acccbb0a7d37
    Also, please make sure the service SAPNSP_00 @ OS level is running. If not, start the service manually and proceed with the installation.
    Hope it helps,
    Regards,
    Satish.
    Edited by: Satish Arram on Oct 10, 2008 6:30 PM

  • (error code = 200; message="Java error"; exception = [java.lang.Exception])

    Hi, I have several times tried to install ABAP Trial, but failed.
    So I need your help.
    As soon as I set up XP, I download and install the newest Java, then started installation of ABAP Trial.
    But at the end I just get an error message as belows.
    I hope you will guide me correct direction.
    Thanks for reading & Have a good day!
    (Jul 11, 2008 7:38:06 AM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, An error occurred and product installation failed.  Look at the log file C:\SAP\NSP\log.txt for details.
    (Jul 11, 2008 7:38:06 AM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllInstallationSteps(StepWrapperInstallFiles.java:177)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.install(StepWrapperInstallFiles.java:268)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.installProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.getResultForProductAction(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    (Jul 11, 2008 7:43:08 AM), Install, com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct, err, An error occurred and product uninstallation failed.  Look at the log file C:\SAP\NSP\log.txt for details.
    (Jul 11, 2008 7:43:08 AM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllUninstallationSteps(StepWrapperInstallFiles.java:192)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.uninstall(StepWrapperInstallFiles.java:313)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.uninstallProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.processActionsFailed(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    Hi YUN SEOK,
    I got the same error than you when I tried to install SAP NetWeaver ABAP Trial Version. 
    Could you help me in giving exactly the link you wrote.
    https://www.sdn.sap.com/irj
    Where is located exactly the answer ?
    I looked at this link but I did not find the answer.
    So could you give me exactly the location in this link ?
    Thanks in advance.
    STD,

  • We would like an request with error is not imported over and over again.

    We have an periodically sheduled job which imports all released requests(queue). We would like that request with error is not imported over and over again.
    How to achieve that?

    Hi,
    Please do run the import job for transport in STMS only as described in SAP Note below:
    https://service.sap.com/sap/support/notes/398589
    The periodic sadly can only be done for "import all" & not "import single".
    However, you can try the following unconditional modes:
    http://help.sap.com/saphelp_nw70/helpdata/EN/3d/ad5b814ebc11d182bf0000e829fbfe/frameset.htm
    - Regards, Dibya

  • I would like to know which Sun Cert Java Course I should take ???

    I am a very good C programmer that is trying to learn Java programming.
    I know my way around all the various programming statements such as if-then-else, switch etc etc ...
    I know the basics of an Applet and a Stand Alone application ...
    I feel that I need some grounding on OO Technology ...
    I would like to learn JAVA from where I am ...
    I have also been reading up a lot on Java Programming lately ...
    I am more of an Intermediate programmer ...
    I have seen the Sun Certified Java courses web page and is quite confused by the many assortment of courses available ...
    I would like to ask which Java Course is right for me at my level of programming experiences ???
    Thanks in advance !!!
    Andy

    My limited understanding is that there are two main tests you can go for. The first is the Programmer certification, which tests your knowledge of the Java language itself, so you're asked questions about very specific things about the language syntax and such. I think these questions are stupid, because they serve no practical purpose, and some questions are more of a test of your memory.
    Then you can take the Developer certification, which is focused more on evaulating and writing programs.
    I haven't taken either, but there are some good resources for preparing for these tests.
    http://www.javaprepare.com/quests/test.html

  • I would like to know which Sun Cert JAVA Course should I take ???

    I am a very good C programmer that is trying to learn Java programming.
    I know my way around all the various programming statements such as if-then-else, switch etc etc ...
    I know the basics of an Applet and a Stand Alone application ...
    I feel that I need some grounding on OO Technology ...
    I would like to learn JAVA from where I am ...
    I have also been reading up a lot on Java Programming lately ...
    I am more of an Intermediate programmer ...
    I have seen the Sun Certified Java courses web page and is quite confused by the many assortment of courses available ...
    I would like to ask which Java Course is right for me at my level of programming experiences ???
    Thanks in advance !!!
    Andy

    www.jcert.org has the information laid out a little better. I picked up Java without a formal course and I had about the same specs as you (although I had done a fair amount of c++ work). I would suggest the Java book by van der Linden (I know I'm not spelling the name right). I think it's called Just Java 2. Also Thinking in Java by Eckel has gotten good recommendations. For exam prep, the Exam Cram book by Brogden is highly recommended, but it won't teach you OO.

  • Would like to redirect page

    Hi All,
    First, I'm not a java programmer at all...
    Okay.. I have this portal with an ExceptionHelper.java file and instead of displaying this page to the user, I'd like to redirect the page to an HTML page, perhaps carrying a variable for the error with it.
    I've tried: response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') ); to no avail.. maybe I just put it in the wrong place in the code? line 344
    * Copyright � 2001 The JA-SIG Collaborative.  All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    *    notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
    * 3. Redistributions of any form whatsoever must retain the following
    *    acknowledgment:
    *    "This product includes software developed by the JA-SIG Collaborative
    *    (http://www.jasig.org/)."
    * THIS SOFTWARE IS PROVIDED BY THE JA-SIG COLLABORATIVE "AS IS" AND ANY
    * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JA-SIG COLLABORATIVE OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    package org.jasig.portal;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class ExceptionHelper {
        private static final Log log = LogFactory.getLog(ExceptionHelper.class);
        // List of strings to match in traceback for various containers
         // This array must be expanded as additional Application Server
         // containers become better known
        public static final String boundaries[] =
                  "at javax.servlet.http.HttpServlet."
         * Generate traceback only to the Servlet-container interface.
         * @param ex any throwable exception
         * @return stack trace string without container layers
        public static String shortStackTrace(Throwable ex) {
             if (ex == null)
                  return "";
            java.io.StringWriter sw = new java.io.StringWriter();
            ex.printStackTrace(new java.io.PrintWriter(sw));
            sw.flush();
            String stktr = sw.toString();
            return trimStackTrace(stktr);
         * Trims a String representation of a Stack Trace to remove
         * the portion of the trace that is in the servlet container layer.
         * @param stackTrace - String result of printStackTrace
         * @return the stack trace with portions of the trace that dive into the container
         * layer removed.
        static String trimStackTrace(String stackTrace) {
            StringBuffer trimmedTrace = new StringBuffer();
            // a List of Strings to be trimmed and appended to the buffer
            // these represent elements in the causal chain
            List fragments = new ArrayList();
            int causeCut = (stackTrace.indexOf("Caused by"));
            if (causeCut > 0) {
                // there are one or more Caused by fragments to consider
                // we traverse stackTrace, parsing out fragments for later processing
                // and updating stackTrace to contain the remaining unparsed portion
                // as we go
                while (stackTrace.length() > 0) {
                    if (stackTrace.startsWith("Caused by")){
                        // don't count the "Caused by" leading the stackTrace
                        causeCut = stackTrace.substring(9).indexOf("Caused by");
                        if (causeCut > 0)
                            causeCut += 9;
                    } else {
                        causeCut = stackTrace.indexOf("Caused by");
                    if (causeCut > -1) {
                        // stackTrace currently includes multiple fragments
                        // parse out the first and leave the rest for next iteration
                        fragments.add(stackTrace.substring(0, causeCut));
                        stackTrace = stackTrace.substring(causeCut);
                    } else {
                        // stackTrace currently is a bare fragment
                        // grab it
                        fragments.add(stackTrace);
                        stackTrace = "";
            } else {
                // there's ony a single Throwable in the chain
                fragments.add(stackTrace);
            // now that we have fragments to consider
            for (Iterator iter = fragments.iterator(); iter.hasNext();){
                String consideredFragment = (String) iter.next();
                // flag to indicate that a trimmed form of this fragment has been appended
                // to the trimmed stack trace buffer
                boolean appended = false;
                for (int i=0; i < boundaries.length; i++) {
                    int cut = consideredFragment.indexOf(boundaries);
    if (cut > 0) {
    // stack trace includes a trace through our container
    // in which we are not interested: trim it.
    // grab the desired portion up to the boundary
    trimmedTrace.append(consideredFragment.substring(0, cut).trim());
    trimmedTrace.append("\n");
    appended = true;
    break;
    if (! appended) {
    // a trimmed version of this fragment was not appended
    // because it doesn't need to be trimmed -- append the whole thing.
    trimmedTrace.append(consideredFragment.trim());
    trimmedTrace.append("\n");
    return trimmedTrace.toString();
    * Generic Exception Handler called from catch clause
    * @param eid the ErrorID (as seen from catch)
    * @param parm
    * @param ex the Exception caught
    * @throws PortalException
    public static void genericHandler(ErrorID eid, String parm, Throwable ex)
    throws PortalException {
    // *** Handle PortalExceptions ***
         // Log it if logging was deferred in .signal() call
         // Rethrow it
    if (ex instanceof PortalException) {
         if (((PortalException)ex).isLogPending())
              traceToLog(eid,parm,ex);
                   throw (PortalException) ex;
    // *** Handle all other Exceptions ***
    // Log the message and traceback
    traceToLog(eid, parm, ex);
    // Create a derived PortalException chained to this
    PortalException nex;
    if (ex instanceof Exception) {
    nex = new PortalException(eid, (Exception) ex);
    } else {
         // Sorry, at this point PortalExceptions don't chain to
         // non-Exception subclasses of Throwable
    nex = new PortalException(eid);
    nex.setLogPending(false);
    ProblemsTable.store(nex);
    throw nex;
         public static void genericHandler(ErrorID eid, Throwable ex)
              throws PortalException {
                   genericHandler(eid,null,ex);
         * Create PortalException from ErrorID and throw it. Maybe trace it.
         * @param eid ErrorId
         * @param parm Additional error information
         * @param tracenow Trace now or defer till first catch.
         * @throws PortalException
    public static void signal(ErrorID eid, String parm, boolean tracenow)
    throws PortalException {
    PortalException nex = new PortalException(eid);
              nex.setParameter(parm);
    signal(nex,tracenow);
    * Create PortalException from Errorid, trace, and throw it.
    * @param eid ErrorID to use to generate PortalException
    * @param parm Additional error information
    * @throws PortalException
    public static void signal(ErrorID eid, String parm) throws PortalException {
         signal(eid,parm,true);
    * Throw PortalException provided by caller, maybe trace it.
    * @param nex Exception provided by caller
    * @param tracenow Trace now, or later after first catch.
    * @throws PortalException
    private static void signal(PortalException nex, boolean tracenow)
    throws PortalException {
    if (tracenow) {
         traceToLog(nex.getErrorID(), nex.getParameter(), nex);
         ProblemsTable.store(nex);
    throw nex;
    * Generate, trace, and throw Portal Exception given ErrorID.
    * @param eid ErrorID
    * @throws PortalException
    public static void signal(ErrorID eid)
         throws PortalException {
         signal(eid,null,true);
    * Common logic for generating log entry of errors
    * @param eid ErrorID with initial message
    * @param parm Parameter string to append to eid msg
    * @param ex Old exception
    private static void traceToLog(ErrorID eid, String parm, Throwable ex) {
         if (ex !=null &&
              ex instanceof PortalException) {
                   if (!((PortalException)ex).isLogPending())
                        return; // This PortalException was already logged.
                   else
                        ((PortalException)ex).setLogPending(false);
    String logmsg = errorInfo(eid, parm, ex);
    log.error( logmsg);
    * Generate error string for logging or /problems online display
    * @param eid Error ID
    * @param parm Parameter string
    * @param ex Exception
    * @return Multiline text with message and traceback
    public static String errorInfo(ErrorID eid, String parm, Throwable ex) {
              StringBuffer errorinfobuffer = new StringBuffer(1000);
              if (eid!=Errors.legacy)
         errorinfobuffer.append(eid.getMessage()); // Error ID message
    else
         errorinfobuffer.append(ex.getMessage());
              if (parm != null) { // Parameter data
                   errorinfobuffer.append("\n [specific data: ");
                   errorinfobuffer.append(parm);
                   errorinfobuffer.append("] ");
              errorinfobuffer.append("\n");
              if (ex!=null)
                   errorinfobuffer.append(shortStackTrace(ex)); // Stack trace
              return errorinfobuffer.toString();
    * Generic Top-Level Exception Handler caled from catch clause
    * (doesn't rethrow exception)
    * @param eid Error ID
    * @param parm Parameter string
    * @param ex Exception caught
    public static void genericTopHandler(ErrorID eid, String parm, Throwable ex) {
    // If this is an already logged Portal Exception, we are done
    if (ex instanceof PortalException &&
         !((PortalException)ex).isLogPending()) {
         return;
    traceToLog(eid, parm, ex);
    if (ex instanceof PortalException) // already in the table
         return;
              // Create a derived PortalException (just for Problems Table)
              PortalException nex=null;
              if (ex instanceof Exception)
                   nex = new PortalException(eid, (Exception) ex);
              else
                   nex = new PortalException(eid);
              ProblemsTable.store(nex);
         public static void genericTopHandler(ErrorID eid, Throwable ex) {
              genericTopHandler(eid, null, ex);
    * Generate HTML page to send to end user after fatal error
    * @param resp Servlet response object
    * @param e PortalException received at Servlet code.
         response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') );
         public static void generateErrorPage(HttpServletResponse resp, Exception e) {
              resp.setContentType("text/html");
              try {
                   PrintWriter out = resp.getWriter();
                   out.println("<h1>Cannot start uPortal</h1>");
                   out.println("<p>Sorry, but a problem is preventing the Portal from starting. "+
                        "The error must be corrected by system administrators. Try again later.</p>");
                   //out.println("<p><a href='http://www.yale.edu/portal'>Click here to display the static Yaleinfo page.</a></p>");     
                   out.println("<!--");
                   ErrorID eid = Errors.bug;
                   String parm = "";
                   if (e instanceof PortalException) {
                        PortalException pe = (PortalException)e;
                        if (pe.errorID!=null)
                             eid=pe.errorID;
                        if (pe.parameter!=null)
                             parm=pe.parameter;     
                   out.println(errorInfo(eid,parm,e));
                   out.println("-->");     
                   out.flush();
              } catch (Exception ex) {
    Thanks for your help.
    John

    HI,
    IE is not available on the Note 4, and this option is only available on the desktop version of Firefox.
    I also could not find an addon that gives a warning of a refresh in the Android version of Firefox.
    However there is one in Accessibility setting of Desktop under Options.

  • Timestamp/Date format error with Java 1.6

    I'm getting this error trying to getObjects from a ResultSet query for an Oracle Lite 10G table that has colums of the TIMESTAMP or DATE type. This works fine under java 1.5. Java 1.6 seems to have broken TIMESTAMP/DATE compatibility with Oracle Lite. Are there any plans to make 10G compatible with Java 1.6? We would like to port our application from Java 1.5 to 1.6, but this is an obstacle. I suppose one work-around would be to use TO_CHAR on all the DATE fields and convert them back to java Dates programatically, but that would be a hassle.
    Update: I changed the column types of the table from TIMESTAMP to DATE. The same exception occurs when calling POLJDBCResultSet.getObject() on the DATE columns. Again, this works fine under Java 1.5, but not 1.6.
    java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
         at java.sql.Timestamp.valueOf(Timestamp.java:194)
         at oracle.lite.poljdbc.LiteEmbResultSet.jniGetDataTimestamp(Native Method)
         at oracle.lite.poljdbc.LiteEmbResultSet.getVal(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCResultSet.getTimestamp(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCResultSet.getObject(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCResultSet.getObject(Unknown Source)

    I just found a pretty easy java work-around for this that doesn't involve changing the table column types or the SQL:
    Check the column type from the ResultSetMetaData before calling ResultSet.getObject(). If the type is DATE, TIMESTAMP or TIME, call ResultSet.getString() which doesn't throw an exception. Then convert the string to a java.util.Date using java.text.SimpleDateFormat. That can then be used to instantiate a Timestamp.
    This seems to work.
    Message was edited by:
    user490596

  • ABAP Sneakpreview - Java error

    Hi,
    I un-installed all my previous installation & downloaded 2 ABAP Preview files (Part 1 &2) again. I got the following error while installing..THe below message i took it from log.txt.
    (Jan 30, 2007 10:14:00 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, An error occurred and product installation failed.  Look at the log file C:\SAP\NSP\log.txt for details.
    (Jan 30, 2007 10:14:00 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllInstallationSteps(StepWrapperInstallFiles.java:177)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.install(StepWrapperInstallFiles.java:268)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.installProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.getResultForProductAction(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    (Jan 30, 2007 10:14:25 PM), Install, com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct, err, An error occurred and product uninstallation failed.  Look at the log file C:\SAP\NSP\log.txt for details.
    (Jan 30, 2007 10:14:25 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllUninstallationSteps(StepWrapperInstallFiles.java:192)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.uninstall(StepWrapperInstallFiles.java:313)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.uninstallProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.processActionsFailed(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Can anyone tell me what is the issue..
    <b>Note:</b> The installation steps are different than my previous installation. May be SAP has changed the wizard.
    Thanks in advance..
    BM
    Message was edited by:
            Bharathi M

    Hi,
    Installation fails with error log: ProductException: error code = 200
    Run the clean-up tool for the registry. Install the MS Loopback Adapter or connect the computer to the network. For further information regarding the MS Loopback Adapter please have a look in the Installation Guide
    Check the link more details:
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/6055f523-df6e-2910-f0bf-acccbb0a7d37
    Regards,
    Siddhesh

  • Java Error by installation of NetWeaver 7.01 ABAP Trial Version

    If i try to install "New SAP NetWeaver 7.01 ABAP Trial Version" on Windows XP SP2 in 3 seconds after start I get this errormassage : Java.lang.noclassdeffounderror: run Exception in thread "main" and then is installer dawn. What is to do? Plaese help !!!

    hi,rbollo  and Darell,
    i'm meet the same problem install the Netwear 7.0.1 ABAP trail version several times. first time used jdk1.5,second times with jdk1.6. and then pick up your sugssion i used with j2sdk-1_4_2_19,since i have't find j2sdk-1_4_2_16 (this is not big deal?) but still same problem occured .  my detail information as below :
    1. Windows XP pack 3. 1.128 GB ROM. enough space .
    2. enabled MS LoopBack Adapter and make the hosts entry
    3. x86 operation system .
    4. even i can't see last installtion page let me click next "start application server" ,but after then i get I:\SAP\NSP\log.txt same as you .
    log.txt details :
    (Dec 22, 2008 3:34:36 AM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, An error occurred and product installation failed.  Look at the log file I:\SAP\NSP\log.txt for details.
    (Dec 22, 2008 3:34:36 AM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err, ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
    STACK_TRACE: 15 ProductException: (error code = 200; message="Java error"; exception = [java.lang.Exception])
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllInstallationSteps(StepWrapperInstallFiles.java:177)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.install(StepWrapperInstallFiles.java:268)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.installProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.getResultForProductAction(Unknown Source)....
    THanks
    hans.

  • Shutting off java after faulty java code runs in WinXP

    I would like to know how to shut java off after a webpage with faulty java code is loaded. Ever since the version of Java that introduced "jsched" into the mix, I've had problems with Java on every computer and every install of windows I've had and worked with. If a webpage has faulty code in it, instead of crashing Firefox/Mozilla like the older versions did (in which I could simply reload the browser after it crashes), it makes Firefox inoperable (disabling most of the menu items and making the mouse scroller not work), and continues to run even after Firefox is no longer running. To make matters worse, Java was programmed in such a way that makes it a process that cannot be seen in the task manager. Java's ability to hide its running process quite frankly makes me nervous.
    I'm thankful that the latest version fixed a lot of bugs--the version before this would give me a blue screen of death every time I tried to access the control panel.
    I would like to know how to turn off java once it's running. The only documentation I have been able to find was in relation to a shell in Linux which uses commands that don't work in Windows.

    How do I shut off Java once it is loaded when I'm on a page that doens't have any errors? If I go to a page that requires java, and Java gets loaded, it doesn't automatically quit when I go to another page. Why does Java need to continue running when it's no longer being used? Why should I have to quit and reload Firefox in order to quit Java?
    It would be nice if there was something in Java to shut itself off when it encounters an error instead of requiring a windows restart in order to quit Java since it isn't a separate process, and also something that shuts off Java when there is no longer a webpage in memory that requires Java.

  • Using Google GWT to create (Dashcode) widgets for iBook Author  I would like to embed interactive widgets in iBooks using iBookAuthor. The widgets in question started life in Java but GWT has allowed them to be converted to javascript and to run on web pa

    I would like to embed interactive widgets in iBooks using iBookAuthor. The widgets in question started life in Java but GWT has allowed them to be converted to javascript and to run on web pages (for example, http://softoption.us/content/node/437 scroll to the bottom). In theory, iBookAuthor can bring in most html5, and much javascript. The technique is to wrap the html in a folder, with 2 extra files, a plist and a default png and then change the extension of the folder to ‘.wdgt’. This is the technique for making Dashboard widgets for the Mac, and Apple even have the Dashcode software to do it. So what you really do is to make a Dashboard widget, then iBookAuthor can import it.  So far, so good. And some  folk have been doing this, for example http://www.prweb.com/releases/2012/2/prweb9242432.htm http://www.panophoto.org/forums/viewtopic.php?f=64&t=10417&p=158330#p158423 However, if you start with GWT and create a single page with one button and a Hello World, compile it, and get the WAR file (I use Eclipse here)… the Safari browser and others will run it properly (even on an iPad). Then if you wrap it, a proper Dashboard widget is created, which runs properly on a Mac. Then if you go to iBookAuthor and put a custom widget in the Text, then drag it in. It is accepted by the text and shown as being there. However, if you use Preview to look at it on an iPad, it is gone (or was never there in the first place). Anyone any ideas on this? [And iBook Author seems to give no warnings.] The widget is at https://dl.dropbox.com/u/46713473/Test6.wdgt.zip I have bells and whistles that I’d like to get into an iBook!
    Thanks for any insights.
    Martin

    I do have a little to add, which might help someone. Indeed, opening a blank page and dragging the widget straight in seems good in difficult cases. But, actually, I was also able to insert successfully from the Toolbar especially to blank pages. So, it may have been something to do with the columns and stuff like that. Anyway back then the insertion would show in iBooks Author but not in the Preview on the iPad. I moved on to actual Google Web Toolkit output javascript. Basically I had three at hand to try: a Hello World with a button which went straight it, one of moderate complexity, (for example with a built in Lisp interpreter), which also went straight in, and finally a more complex one that initially was rejected by iBook Author. Author complained that there was an unsupported media file (of course, Author does not tell you which one it is, that would be too easy). [Remember, this was a proper working Dashboard widget which could be installed on a Mac]. Among other things I had read remarks about .gif files. When looking through the GWT war directory at the actual javascript etc files, I noticed there were two gifs there one called ‘clear.cache.gif ‘  and a second one called  ‘0F89659FF3F324AE4116F700257E32BD.cache.gif’. (Now, there is obfuscation so the numbers here may be different from case to case.) The clear.cache.gif did not seem to be anything special. But the other one is an animation. It is three little boxes that twinkle (rather like a waiting spinning cursor).  So, I opened that file and saved it to itself (that picks the top frame of the animation and saves only that, leaving you with an unanimated gif). The resulting widget drags and drops into iBooks Author (and seems to work properly at a quick glance). So, if you are having trouble with ‘unsupported media files’ converting animated gifs into unanimated gifs might help in some cases.

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • I would like to zip two .Txt files in java

    hi all,
    i would like to zip two temporaray files(.Txt) in java

    Do you want to write a part of it yourself or do you want us to prepare you a complete solution? I provided you with a link to Java's zipping tutorial. If you took the effort to read it, you'll know there is an example zip.java.
    You can put the initialisation in your main, take what's in the for loop, put it into a function. I assume you can write a program that takes 2 command line parameters, and pass those params to your zip function and you've got it... That's how far I'll go for your solution!

  • I would like to make a screen saver in java.

    I would like to make a screen saver in java. But i do not find in the appropriate documentation classes.
    Can you help me.
    My screen saver may ask a password when the user want to exit it.

    https://jdic.dev.java.net/documentation/incubator/screensaver/
    "The SaverBeans Screensaver SDK (Early Access) is a Java screensaver development kit, enabling developers to create cross-platform screensavers. The developer writes a set of Java classes along with an XML description of the screensaver settings, and uses the tools in this development kit to produce a screensaver for any Java-supported OS. The resulting screensavers behave just like a native screensaver (i.e. with preview capabilities and control over settings)."
    This was found as the first result of a simple google search. You should try it sometime.

Maybe you are looking for