Compile time errors for large code in try-catch blocks

Hi, Has anyone ever faced this problem of a compile time error, where the Java compiler returns with the following error that Code is too large for try block.
I have about 5000 thousand lines in my try-catch block and am facing this problem. Please suggest possible solutions

1) Are you sure that your try/catch blocks contain 5 million lines?! I seriously don't believe this.Sounds like generated code. The generator needs to be a bit cleverer. In particular, it seems to be generating repeated blocks of code that ought to be stuffed into methods somewhere.

Similar Messages

  • Compilation Error for Login code

    hi!
    Can someone help me debug this?
    C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes>javac -deprecat
    ion Login.java
    Login.java:46: warning: putValue(java.lang.String,java.lang.Object) in javax.ser
    vlet.http.HttpSession has been deprecated
    userSession.putValue("userName", uName);
    ^
    Login.java:26: unreported exception java.sql.SQLException; must be caught or dec
    lared to be thrown
    String uName = validateUser(userId, password);
    ^
    Login.java:66: unreported exception java.lang.ClassNotFoundException; must be ca
    ught or declared to be thrown
    Class.forName("org.gjt.mm.mysql.Driver");
    ^
    2 errors
    1 warning
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import java.lang.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Login extends HttpServlet{
    public void doPost(HttpServletRequest req, HttpServletResponse res)
                   throws ServletException,IOException{
    String userId = req.getParameter("userId");
    String password = req.getParameter("password");
    ** call a method to validate the password which will return the
    ** User Name for authorized users and null string for un-authorised.
    String uName = validateUser(userId, password);
    // if uName is null .. user is not authorized.
    if (uName == null)
         PrintWriter ot = res.getWriter();
    System.out.println(" Please verify the Userid and password");
    System.out.close();
    else
    // So the user is valid let's create a seesion // for this user.
    HttpSession userSession = req.getSession(true);
    // put the user name session variable.
    userSession.putValue("userName", uName);
    // now we need to transfer the control to welcome.jsp
    RequestDispatcher rd =
         getServletContext().getRequestDispatcher("/welcome.jsp");
    if (rd != null)
         rd.forward(req,res);
    }// end of doPost
    public String validateUser(String inputUserid, String inputPwd)
    throws SQLException{
         String returnString = null;
         Class.forName("org.gjt.mm.mysql.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "test","test");
         Statement stmt = con.createStatement();
         String sql= "select USERID from USERTABLE where USERID = '" +
              inputUserid + "' and PASSWORD = '" + inputPwd +"' ;" ;
         ResultSet rs = stmt.executeQuery(sql);
         if (rs.next())
         returnString = rs.getString("USERID");
         stmt.close();
         con.close();
         return returnString ;
    }// end of servlet class
    Thank you!
    I'm using Win98 , JDK1.3 and Jrun4
    I also have j2sdkee1.2.1
    (if that matters)
    Dewi

    Hi,
    Put try catch block in your code and it will work fine.Please look at the code changes in your code.You find try-catch blocks.
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import java.lang.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Login extends HttpServlet{
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException,IOException{
    String userId = req.getParameter("userId");
    String password = req.getParameter("password");
    ** call a method to validate the password which will return the
    ** User Name for authorized users and null string for un-authorised.
    String uName = validateUser(userId, password);
    // if uName is null .. user is not authorized.
    if (uName == null)
    PrintWriter ot = res.getWriter();
    System.out.println(" Please verify the Userid and password");
    System.out.close();
    else
    // So the user is valid let's create a seesion // for this user.
    HttpSession userSession = req.getSession(true);
    // put the user name session variable.
    userSession.putValue("userName", uName);
    // now we need to transfer the control to welcome.jsp
    RequestDispatcher rd =
    getServletContext().getRequestDispatcher("/welcome.jsp");
    if (rd != null)
    rd.forward(req,res);
    }// end of doPost
    public String validateUser(String inputUserid, String inputPwd)
    String returnString = null;
    try{
    Class.forName("org.gjt.mm.mysql.Driver");
    }catch(ClassNotFoundException){
    System.out.println("An exception occurred ");
    Connection con = DriverManager.getConnection ("jdbc:mysql://localhost:3306/test", "test","test");
    Statement stmt = con.createStatement();
    try
    String sql= "select USERID from USERTABLE where USERID = '" +
    inputUserid + "' and PASSWORD = '" + inputPwd +"' ;" ;
    ResultSet rs = stmt.executeQuery(sql);
    if (rs.next())
    returnString = rs.getString("USERID");
    stmt.close();
    con.close();
    return returnString ;
    }catch(SQLException sqe){
    System.out.println("SQL Exception "+sqe.getMessage());
    }// end of servlet class
    Cheers,
    Rkanth

  • Pls suggest a reason for a compile time error

    the following program gives a compile time error bcoz of the statement
    ((State)this).val=this.val. if u could suggest why?
    public class Mainc
    public static void main(String args[])
    State st=new State();
    System.out.println(st.getvalue());
    State.Memento mem= st.memfunc();
    st.altervalue();
    System.out.println(st.getvalue());
    mem.restore();
    System.out.println(st.getvalue());
    public static class State
    protected int val=11;
    int getvalue()
         return val;
    void altervalue()
         val=(val+7)%31;
    Memento memfunc()
         return new Memento();
    class Memento
         int val;
    Memento()
         this.val=state.this.val;
         void restore()
              ((State)this).val=this.val;
    }

    The statement :
    ((State)this).val
    tries to cast Memento into its super class State which is inorrect [former is not latter's subclass]
    restore method should be as follows:
    void restore()
    State.this.val=this.val;
    }

  • Getting run time error for multiple counter plan

    Hi Friends,
    Its very critical issue,wherein i am getting run time error for multiple counter plan.
    Explanation:While try to change the Call horizon or scheduling period of the counter based plan through IP42 or IP15,systam allowing me to change the data but while saving also i am getting "Maintenance plan has changed" message and once come to the back of the transaction instantly i am getting pop up window saying that "Express document get terminated".However we have been maintaining copy of this data in another client wherein we are not getting any Run time error.
    Please find the screen shots for your reference and please let me know how to fix the issue.
    Regards,
    Srinika

    Hi,
         Please check reason for update termination in Transaction code SM13.

  • Compile time error

    I am a newbie in XML. I am trying to compile the following code. I am getting compile time errors. I have following environment varaibles set. Any help will be really appreciated.
    TIA.
    set JAVA_HOME=C:\Program Files\jdk1.3.1_03
    set JWSDP_HOME=C:\Program Files\jwsdp-1.1
    set JAXB_HOME=%JWSDP_HOME%\jaxb-1.0
    set JAXB_LIBS=%JAXB_HOME%\lib
    set JAXP_LIBS=%JWSDP_HOME%\jaxp-1.2.2\lib
    set JWSDP_LIBS=%JWSDP_HOME%\jwsdp-shared\lib
    set PATH=%JAVA_HOME%\bin;%JAXB_HOME%\bin;%JWSDP_HOME%\jwsdp-shared\bin;%PATH%
    set CLASSPATH=%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXP_LIBS%\jaxb-api.jar;%JAXP_LIBS%\endorsed\xercesImpl.jar;%JAXP_LIBS%\endorsed\xalan.jar;%JAXP_LIBS%\endorsed\sax.jar;%JAXP_LIBS%\endorsed\dom.jar;%JWSDP_LIBS%\jax-qname.jar;%JWSDP_LIBS%namespace.jar;.
    C:\Learn XML>javac -verbose CountSax.java
    [parsing started CountSax.java]
    [parsing completed 63ms]
    CountSax.java:3: package org.xml.sax does not exist
    import org.xml.sax.* ;
    ^
    CountSax.java:4: package org.xml.sax.helpers does not exist
    import org.xml.sax.helpers.* ;
    ^
    CountSax.java:5: package javax.xml.parsers does not exist
    import javax.xml.parsers.*;
    ^
    CountSax.java:7: cannot resolve symbol
    symbol : class DefaultHandler
    location: class CountSax
    public class CountSax extends DefaultHandler {
    ^
    [loading C:\jdk1.3.1_02\jre\lib\rt.jar(java/lang/String.class)]
    CountSax.java:22: cannot resolve symbol
    symbol : class Attributes
    location: class CountSax
    public void startElement(String name,Attributes atts) {
    import java.io.* ;
    import org.xml.sax.* ;
    import org.xml.sax.helpers.* ;
    import javax.xml.parsers.*;
    public class CountSax extends DefaultHandler {
    public static void main(String args[]) {
    SAXParserFactory factory = SAXParserFactory.newInstance() ;
    SAXParser saxParser = factory.newSAXParser() ;
    saxParser.parse(new File(args[0]),new CountSax()) ;
    static private int eltCount = 0 ;
    public void startDocument() {
    eltCount = 0 ;
    public void startElement(String name,Attributes atts) {
    eltCount ++ ;
    public void endDocument() {
    System.out.println("Total number of elements: " + eltCount) ;
    }

    Here is my classpath now
    set CLASSPATH=%JAVA_HOME%;%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXP_LIBS%\jaxb-api.jar;%JAXP_LIBS%\endorsed\xercesImpl.jar;%JAXP_LIBS%\endorsed\xalan.jar;%JAXP_LIBS%\endorsed\sax.jar;%JAXP_LIBS%\endorsed\dom.jar;%JWSDP_LIBS%\jax-qname.jar;%JWSDP_LIBS%namespace.jar;.
    It still doesn't work. The pakages that it is complaining about comes from sax.jar which is already in classpath. Can anybody please help.
    TIA

  • Getting compile time errors during gwt application compilation

    Hi,
    I am getting below compile errors while running ant script for my GWT application.
    javac:
    [javac] Compiling 32 source files to D:\Projects\workspace\MckSurvey\war\WEB-INF\classes
    [javac] D:\Projects\workspace\MckSurvey\src\com\spinsci\survey\client\model\QuestionBean.java:38: type parameters of <X>X cannot be determined; no unique maximal instance exists for type variable X with upper bounds int,java.lang.Object
    [javac]           return get("questionId");
    [javac] ^
    I am using JDK 1.6 and ANT 1.7 s/w.
    below is the target which is used in the build file:
    <javac srcdir="src" includes="**" encoding="utf-8"
    destdir="war/WEB-INF/classes"
    nowarn="true"
    debug="true" debuglevel="lines,vars,source"
         includeDestClasses="false"
         source="1.5" target="1.5"      
              >
    <classpath refid="project.class.path"/>
    <compilerarg value="-Xlint:-unchecked"/>
    </javac>
    Please suggest me accordingly to overcome this generics compile time errors.
    Regards,
    Sunder.

    dannyyates wrote:
    There are/have been numerous examples of differences in spec interpretation between Eclipse (ecj) and the Sun compiler. I generally find that Eclipse is more accurate in it's interpretation than Sun! :-)
    I would suggest raising this on an appropriate Eclipse forum. The guys there are normally very good at digging into the issue and explaining why they think they are right or else admitting that they've got it wrong.I totally agree on both accounts. I myself have seen at least two compiler bugs and asked both the Sun guys and the Eclipse guys (through their respective bug tracking systems) and both have been resolved (in both cases ecj was actually right, but I wouldn't dare drawing any conclusions from that ;-)).

  • RUN TIME ERROR IN THIS CODE

    HELLO EVERY ONE ...
    I AM GETTING run time error in this code.....can u send me the corrected code....
    START-OF-SELECTION.
    SELECT T1~MATNR
           T1~MEINS
           T1~ERSDA
           T1~ERNAM
           T1~SPART
           T2~MAKTX
           T3~LVORM
           T3~EKGRP
           T3~WERKS
           T4~LABST
           T4~SPEME
           T4~LGORT
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM MARA AS T1
           INNER JOIN MAKT AS T2
           ON T1MATNR = T2MATNR
           INNER JOIN MARC AS T3
           ON T2MATNR = T3NFMAT
           INNER JOIN MARD AS T4
           ON T3MATNR = T4MATNR
           WHERE T1~MATNR IN SMATNR.
    Thanx & Regards,
    PHANINDER

    ok i am sending u the full code.....
    REPORT  Z_SB_RP_MATERIAL.
    TABLES: MARA,
            MARD,
            MAKT,
            MARC,
            EINA,
            EINE.
    DATA: BEGIN OF ITAB OCCURS 15,
          MATNR LIKE MARA-MATNR,
          MEINS LIKE MARA-MEINS,
          ERSDA LIKE MARA-ERSDA,
          ERNAM LIKE MARA-ERNAM,
          SPART LIKE MARA-SPART,
          MAKTX LIKE MAKT-MAKTX,
          LVORM LIKE MARC-LVORM,
          EKGRP LIKE MARC-EKGRP,
          WERKS LIKE MARC-WERKS,
          LABST LIKE MARD-LABST,
          SPEME LIKE MARD-SPEME,
          LGORT LIKE MARD-SPEME,
          END OF ITAB.
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-T01.
    SELECT-OPTIONS: SMATNR FOR MARA-MATNR,
                    SERSDA FOR MARA-ERSDA,
                    SWERKS FOR MARC-WERKS,
                    SLGORT FOR MARD-LGORT.
    SELECTION-SCREEN END OF BLOCK BLK.
    TOP-OF-PAGE.
    WRITE:/ SY-VLINE,
          02 'S.NO',
          06 SY-VLINE,
          08 'MATNR',
          20 SY-VLINE,
          22 'MEINS',
          32 SY-VLINE,
          34 'ERSDA',
          44 SY-VLINE,
          46 'ERNAM',
          56 SY-VLINE,
          58 'SPART',
          68 SY-VLINE,
          70 'MAKTX',
          80 SY-VLINE,
          82 'LVORM',
          92 SY-VLINE,
          94 'EKGRP',
         104 SY-VLINE,
         106 'WERKS',
         116 SY-VLINE,
         118 'LABST',
         128 SY-VLINE,
         130 'SPEME',
         140 SY-VLINE,
         142 'LGORT',
         152 SY-VLINE.
    START-OF-SELECTION.
    SELECT T1~MATNR
           T1~MEINS
           T1~ERSDA
           T1~ERNAM
           T1~SPART
           T2~MAKTX
           T3~LVORM
           T3~EKGRP
           T3~WERKS
           T4~LABST
           T4~SPEME
           T4~LGORT
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM MARA AS T1
           INNER JOIN MAKT AS T2
           ON T1MATNR = T2MATNR
           INNER JOIN MARC AS T3
           ON T2MATNR = T3NFMAT
           INNER JOIN MARD AS T4
           ON T3MATNR = T4MATNR
           WHERE T1~MATNR IN SMATNR.
    END-OF-SELECTION.
    DATA: COUNT(4) TYPE N.
    LOOP AT ITAB.
    COUNT = COUNT + 1.
      WRITE:/ SY-VLINE,
          02 COUNT,
          06 SY-VLINE,
          08 ITAB-MATNR,
          20 SY-VLINE,
          22 ITAB-MEINS,
          32 SY-VLINE,
          34 ITAB-ERSDA,
          44 SY-VLINE,
          46 ITAB-ERNAM,
          56 SY-VLINE,
          58 ITAB-SPART,
          68 SY-VLINE,
          70 ITAB-MAKTX,
          80 SY-VLINE,
          82 ITAB-LVORM,
          92 SY-VLINE,
          94 ITAB-EKGRP,
         104 SY-VLINE,
         106 ITAB-WERKS,
         116 SY-VLINE,
         118 ITAB-LABST,
         128 SY-VLINE,
         130 ITAB-SPEME,
         140 SY-VLINE,
         142 ITAB-LGORT,
         152 SY-VLINE.
    ENDLOOP.
    THANX & REGARDS,
    PHANINDER

  • Compile-time checking for Serializable

    Hi,
    For an object to be Serialized it must implement the Serializable interface. If any of the objects it stores as instance variables do not implement this interface then run-time exceptions will be thrown. Why can't there be a compile-time check for this? It seems fairly simple to me... Also, why don't the writeObject methods only accept objects that are Serializable? Just changing the method signature to public void writeObject(Serializable obj) throws... should be enough if compile-time checking were available.
    Am I being really stupid or are Sun?
    Dan.

    It would be impossible to reasonably check at compile time, because what if you had a variable of type Object? At runtime it might work because anything could be in there, but if you check at compile time, it would have to fail, because the compiler can't gurantee that the value will be serializable. Also, a non-serializable field wouldn't cause a problem at runtime if it's null, which is another condition the compiler cannot check.

  • How to simulate a dml error in order to test try-catch code block inside a stored procedure

    Hi,
    What would be the easiest way to simulate a dml error in order to test a try catch block.
    I would like to do it with a simple command from outside the stored procedure if possible.
    I tried dropping the table that was updated but it hangs
    Thanks,
    Dani

    Dropping the table that is the target of the procedure will give you an unpleasant surprise: the CATCH block will not fire. To wit, errors like missing tables can only be caught in outer scopes, but not in the procedure where the error occurs.
    But you would add a fake constraint to a table which causes the update to fail. You need to do this in advance, not while running the procedure.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to get the returned error messages in the Try/Catch block in DS 3.0?

    A customer sent me the following questions when he tried to implement custom error handling in DS 3.0. I could only find the function "smtp_to" can return the last few lines of trace or error log file but this is not what he wants. Does anyone know the answers? Thanks!
    I am trying to implement the Try/Catch for error handling, but I have
    hard time to get the return the msg from DI, so I can write it to out
    custom log table.
    Can you tell me or point me to sample code that can do this, also, can
    you tell me which tables capture these info if I want to query it from
    DI system tables

    Hi Larry,
    In Data Services XI 3.1 (GAd yesterday) we made several enhancements for our Try/Catch blocks. One of them is the additional of functions to get details on the error that was catched :
    - error_message() Returns the error message of the caught exception
    - error_number() Returns the error number of the caught exception
    - error_timestamp() Returns the timestamp of the caught exception.
    - error_context() Returns the context of the caught exception. For example, "|Session Datapreview_job|Dataflow debug_DataFlow|Transform Debug"
    In previous versions, the only thing you could do was in the mail_to function specify the number of lines you want to include from the error_log, which would send the error_log details in the body of the mail.
    Thanks,
    Ben.

  • Try Catch Blocks

    This may be too vague of a question but is it bad practice to use one large try catch block? In my mind it seems like it would produce "cleaner" code as far as programmer reading is concerned, but does it affect the program adversely?
    try {
    // code goes here
    } catch (somekindofexception e){
    // print exception e
    } catch (anotherkindofexception e){
    // print exception e
    } // continue for all possible exceptions

    bolivartech wrote:
    I was mistaken it looks like the particular function I was thinking of throws 3 kinds of RuntimeExceptions, but the same idea applies right?
    try {
    } catch (RuntimeException e) {
    System.err.println("Caught RuntimeException: " +  e.getMessage());
    Yes, you can do that if you want to handle all of them the same.
    However, if you want to handle different exceptions differently, you'd catch those specific exceptions, rather than the parent exception type. This is a separate issue from whether you have one big try or lots of little trys.
    NOTE HOWEVER THAT YOU SHOULD NOT CATCH RuntimeException OR ITS DESCENDANTS. RuntimeException indicates an error in your code. Catching it is usually pointless, because you can't recover from it, and trying to continue on will probably lead to corrupt results at best.

  • Can't find class because of try catch block ?!

    Hello,
    I'm using the JNI to use a java library from my c++ code.
    JNI can't find the "Comverse10" class below, but when i put the try catch block in createMessage in comment, FindClass succeeds ?!
    Unfortunatly i need the code inside the try block ;-)
    I tried a few things, but none of them worked:
    - let createMessage throw the exception (public void createMessage throws ElementAlreadyExistsException ), so there isn't a try catch block in createMessage => result: the same
    - make a "wrapper" class Comverse that has a Comverse10 object as attribute and just calls the corresponding Comverse10.function. Result: Comvers could be found, but not constructed (NewObject failed).
    Can someone tell me what is going on ?!
    Thank you,
    Pieter.
    //Comverse10 class
    public class Comverse10 {
    MultimediaMessage message;
    /** Creates a new instance of Comverse10 */
    public Comverse10() {
    public void createMessage() {
    TextMediaElement text1 = new TextMediaElement("Pieter");
    text1.setColor(Color.blue);
    SimpleSlide slide1 = new SimpleSlide();
    //if i put this try catch block in comment, it works ?!
    try{
    slide1.add(text1);
    catch(com.comverse.mms.mmspade.api.ElementAlreadyExistsException e){}
    MessageContent content = new MessageContent();
    content.addSlide(slide1);
    this.message = new MultimediaMessage();
    message.setContent(content);
    message.setSubject("Mijn subjectje");
    for those of you who are intersted: here's my C++ code:
    //creation of JVM
    HRESULT Java::CreateJavaVMdll()
         HRESULT HRv = S_OK;
    char classpath[1024];
         jint res;
         if(blog)     this->oDebugLog->Printf("CreateJavaVMdll()");
         strcpy(classpath,"-Djava.class.path="); /*This tells jvm that it is getting the class path*/
         strcat(classpath,getenv("PATH"));
         strcat(classpath,";D:\\Projects\\RingRing\\MMSComposer;C:\\Progra~1\\j2sdk1~1.1_0\\lib");     //;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mail.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\activation.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mmspade.jar
         //------Set Options for virtual machine
         options[0].optionString = "-Djava.compiler=NONE"; //JIT compiler
         options[1].optionString = classpath;                                        //CLASSPATH
         //------Set argument structure components
         vm_args.options = options;
         vm_args.nOptions = 2;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         vm_args.version = JNI_VERSION_1_4;
         /* Win32 version */
         HINSTANCE hVM = LoadLibrary("C:\\Program Files\\j2sdk1.4.1_01\\jre\\bin\\client\\jvm.dll");
         if (hVM == NULL){
              if(blog) oDebugLog->Printf("Can't load jvm.dll");
              return E_FAIL;
         if(blog) oDebugLog->Printf("jvm.dll loaded\n");
         LPFNDLLFUNC1 func = (LPFNDLLFUNC1)GetProcAddress(hVM, "JNI_CreateJavaVM");
         if(!func){
              if(blog)     oDebugLog->Printf("Can't get ProcAddress of JNI_CreateJavaVM");
              FreeLibrary(hVM);     hVM = NULL;
              return E_FAIL;
         if(blog)     oDebugLog->Printf("ProcAddress found");
         res = func(&jvm,(void**)&env,&vm_args);
         if (res < 0) {
    if(blog)     oDebugLog->Printf("Can't create JVM with JNI_CreateJavaVM %d\n",res);
    return E_FAIL;
         if(blog)     oDebugLog->Printf("JVM created");
         return HRv;
    //finding Comverse10 class:
    HRESULT CALLAS MMSComposer::InitializeJNI(void)
         HRESULT HRv=E_FAIL;
         DWORD T=0;
         try
              if(blog)     oDebugLog->Printf("\nInitializeJNI()");
              bJVM = FALSE;
              jni = new Java(oDebugLog);
              if(jni->CreateJavaVMdll()!=S_OK){
                   if(blog)     oDebugLog->Printf("CreateJavaVMdll() failed");     
                   return HRv;
              jclass jcls = jni->env->FindClass("Comverse10");
              if (jcls == 0) {
    if(blog)     oDebugLog->Printf("Can't find Comverse10 class");
                   jclass jcls2 = jni->env->FindClass("test");
                   if (jcls2 == 0) {
                        if(blog)     oDebugLog->Printf("Can't find test class");
                        return HRv;
                   if(blog)     oDebugLog->Printf("test class found %08x",jcls2);
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 class found %08x",jcls);
              jmethodID mid = jni->env->GetMethodID(jcls , "<init>", "()V");
              if (mid == 0) {
                   if(blog)     oDebugLog->Printf("Can't find Comverse10() constructor");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10() constructor found");
              jobject jobj = jni->env->NewObject(jcls,mid);
              if(jobj==0)
                   if(blog)     oDebugLog->Printf("Can't construct a Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 object constucted");
              //Create Global reference, so java garbage collector won't delete it
              jni->jobj_comv = jni->env->NewGlobalRef(jobj);
              if(jni->jobj_comv==0)
                   if(blog)     oDebugLog->Printf("Can't create global reference to Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("global reference to Comverse10 object %08x created",jni->jobj_comv);
              bJVM=TRUE;
              HRv=S_OK;
         }     catch( IDB * bgError ) { throw bgError->ErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T); }
              catch(...) { throw IDB::NewErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T ); }
              return HRv;

    >
    I would guess that the real problem is that that the
    exception you are catching is not in the class path
    that you are defining.Thanks jschell, that was indeed the case.
    I don't have the docs, but I would guess that
    FindClass() only returns null if an exception is
    thrown. And you are not checking for the exception.
    Which would tell you the problem.Ok, i'll remember that. But what with exceptions thrown in my java code, the documents say
    // jthrowable ExceptionOccurred(JNIEnv *env);
    // Determines if an exception is being thrown. The exception stays being thrown until either the native code calls ExceptionClear(), or the Java code handles the exception
    so, what if the java code throws an exception and catches it, will i be able to see that in my c++ code with ExceptionOccurred ?
    or
    should the java method be declared to throw the exception (and not catch it inside the method)
    Again, thank you for your help, it's greatly appreciated !

  • Performance impact on using too much try catch block

    I have several questions here:
    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.
    2. I wanted to know which would be more efficient (result in faster processing)
    Have several generic try catch OR catch all exceptions individually?
    ex:
    try {
    } catch (Exception e){
    }vs.
    try{
    } catch (MalformedUrlException me){
    } catch(SQLException){
    }3. Which one would be faster, one big try catch block or several small try catch blocks?
    ex.
    try{
    //read from io file
    //query database
    //parse data
    //write to file
    //query database again
    } catch(Exception e){
    //log exception
    }vs.
    try{
    //read from io file
    } catch(FileNotFoundException fnfe){
    //log exception
    try{
    //query database
    }catch(SQLException se){
    //log exception
    try{
    //parse data
    }catch(SaxParserException saxe){
    //log exception
    try{
    //query database again
    }catch(SQLException se2){
    //log exception
    try{
    //write to file
    } catch(FileNotFoundException fnfe){
    //log exception

    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.Compared to what? You can't write an equivalent program that doesn't have a try-catch block, so the answer would have to be that it doesn't affect performance at all.
    2. I wanted to know which would be more efficient (result in faster processing)Have several generic try catch OR catch all exceptions individually?
    You still have it backwards. Do you need to do different things for different exceptions? If so, then that's what you have to do and there is no other code that might be "faster".
    Here's what you should do. Write the code that needs to be written. Don't leave out necessary stuff because of performance reasons. (If you left out all your code, the program would run much faster.) Then find out which parts of the program ACTUALLY take the most time and work on speeding them up.

  • How to use Try Catch Block in ABAP Like JAVA

    Hi Experts,
       I am using BAPI to post MIGO in one of my application. If the MIGO is successfully gets posted then BAPI returns no message, but if there is some error in posting then it returns an error message. Now I want to print that error message in catch block by calling method RAISE_ERROR_MESSAGE. How to use try catch block in ABAP. Please suggest with example.
    Thanks and Regards.
    Vaibhav Tiwari.

    Hi Vaibhav
    You may not catch exceptions returned by function module using try endtry block.
    It works well with the exception returned by methods.
    In case of function modules or BAPI what u can do is to check sy-subrc returned and give message accordingly. If it returns a structure like bapireturn then display message returned.
    in case of exception returned by a method,  do it like this...
    data: excep type cx_root.
    data: v_str type string.
    try.
    *any method call or division by zero (for ex)
    catch cx_root into excep.
    endtry.
    if  excep is not initial.
    CALL METHOD   excep->if_message~get_text
      receiving
        RESULT = v_str.
    endif.
    *display the value returned in v_str on screen

  • Nested try-catch blocks

    Hello All,
    If I have 2 nested try-catch blocks see below
    try{
        //Some code
        try{
            //Code that throws an IOException
        }catch(NumberFormatException nfe){
            //Handle the NFE
    }catch(Exception e){
        //Handle the Exception
    }Now what happens if in the inner try-catch an IOException is thrown? Will it be ignored, or will it get thrown out to the outer one and be caught by that catch?
    Thanks,
    Matt

    Thanks, should have just done this from the start, but here is the result...
    The following code
    public class Main {
         public void execute(){
              try{
                  try{
                       for(int i=0;i<100;i++){
                            System.out.println(i);
                            if(i==5){
                                 throw new java.io.IOException();
                  }catch(NumberFormatException nfe){
                     System.out.println("caught in inner block");
              }catch(Exception e){
                  //Handle the Exception
                 System.out.println("caught in outer block");
         public static void main(String[] args) {
              Main m = new Main();
              m.execute();
    }GENERATES:
    0
    1
    2
    3
    4
    caught in outer block
    Thanks,
    Matt

Maybe you are looking for

  • Vanishing User/Passwords

    A brand new bug in DW 8 A site that was fully displayed (all files and directories) in previous DW versions now requires "passive" to be checked, otherwise only the first directory is visitble and no files other than those uploaded during the current

  • How to fill info from database

    I have the database talking to livecycle. I am using OLEDB via the ODBC in server 2003 for the connection. I can access the database in PHP no problem using the ODBC functions. All I want to do is query a customer ID and return a first and last name.

  • Admin Tool Error When Viewing Data in Physical Layer nQSError: 43093

    I am trying to view the data in my Admin Tool in the Physical Layer, I am getting: [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSEr

  • Where do my source file clips go after optimization in Imovie 11.

    Does anybody know where i can retrieve my source files. I imported them into imovie 11 but unchecked the copy files option after optimization, so they were moved, but moved where? they are not in my original folder. Thanks

  • ETL Failing on TASK_GROUP_Extract_BOM

    Hello All, I am also facing an issue in the ETL (OBIA 7.9.6.4) for Supply Chain Management R12.1.3 I can see in DAC that the task "TASK_GROUP_Extract_BOM" is failing on truncate table. I have excluded this task from ETL container but this task is sti