unreported exception parseException

unreported exception parseException

Here is my code

import java.io.* ;
import java.util.*;
import java.text.*;

/*class QS1
{


    String[] buf = new String[50];
    // String[]buf={"select * from emp;"};
}*/

class QS2
{

String type;
     String contents;
     QS2  nestedquery;
     QS2 next;
    String[] buf;



     QS2(String t,String c,QS2 n,QS2 nx){
        type=t;
        contents=c;
        nestedquery=n;
        next=nx;
     }
}


public class GenerateGLL {

    ///private static class generateQueryStrcture {

        //public generateQueryStrcture() {
        //}



   // QS1 qs = new QS1();
     int count = 0 ;
  // static String[] token;

    public static void main(String args[])
    {

    generateQueryStrcture r=new generateQueryStrcture();
        QS2 generateQueryStrcture = r.generateQueryStrcture();

        //FormsPlSql p = new FormsPlSql();
        //String tokens[] = p.parseAndGenerateTokens("select * from emp where name='abc';");

    }

}

class generateQueryStrcture
{
   generateQueryStrcture()
    {

   }
public QS2 generateQueryStrcture() {
        QS2 qs1 = null,qs2 = null,qs3=null;
               // QS2 qs = null;
                //String[] buf = new String[50];

    //String[] tokens = {"select","lid,bid","from","emp","where","emp.id<5 and name='abc'",";"};

                //tail=null;
//tokens[] = { "select * from emp;" };
FormsPlSql t = new FormsPlSql();
        String tokens[] = t.parseAndGenerateTokens("select * from emp where name='abc';");

        int count = 0;
        int i;
        for( i = 0 ;i < tokens.length ; i++){
            if(tokens[i].equalsIgnoreCase("select"))
            {
               qs1 = new QS2("SELECT",null, null, null);

                  count = i;
                   while(!tokens[i].equalsIgnoreCase("from"))
                    {
                    if(tokens[i].equals("("))
                        {

                        }

                    qs1.contents = tokens[i];
                    i++;
                    }
                  qs1.next = qs2;

                    break;


                }
        }

        for( i = count ;i < tokens.length ; i++){
            if(tokens[i].equalsIgnoreCase("from"))
            {
                   qs2 = new QS2("FROM",null, null, null);

                  // handle nesting..
                  count = i;
                   while(!tokens[i].equalsIgnoreCase("where"))
                    {
                    qs2.contents = tokens[i];
                    i++;
                    }

                    qs1.next = qs2;

                    break;


                }

        }


        for( i = 0 ;i < tokens.length ; i++){
            if(tokens[i].equalsIgnoreCase("where"))
            {
                  qs3 = new QS2("WHERE",null, null, null);
// handle nesting..
                  //count = i;
                   while(!tokens[i].equals(";"))
                    {
                    qs3.contents = tokens[i];
                    i++;
                    }

                    qs2.next = qs3;
                    //QS2 tail = new QS2(null, null, null, null);

                    //qs3.next = tail;

                    break;

                }

        }

        qs1.next = qs2;
        qs2.next = qs3;
        QS2 tail = new QS2(null, null, null, null);
        qs3.next = tail;

        for(QS2 q=qs1; q.next!=null; q=q.next){
                System.out.println("Type "+q.type);
                System.out.println("Content : "+q.contents);
                System.out.println("=============");
                }
return qs1;
        }


}


//System.out.println(qs1);
View Answers









Related Tutorials/Questions & Answers:
unreported exception parseException
unreported exception parseException  Here is my code import java.io.* ; import java.util.*; import java.text.*; /*class QS1...; for(QS2 q=qs1; q.next!=null; q=q.next
when will we get JasperException and parseException?
when will we get JasperException and parseException?  when will we get JasperException and parseException
Advertisements
exception
exception  wHEN RUNTIME EXCEPTION CLASS IS SUB OF EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED EXCEPTION
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
exception
arguments are not equalto two,throw a user defined exception "invalid parameter exception" ,otherwise display the two parameters.   Here is an example... is not equal to two then invalid parameter exception is thrown ,otherwise display the two
exception
exception  what is the use of catch block even though we have predefined exception object
exception
exception  example for numberformat exception   Hi Friend, Try the following code:ADS_TO_REPLACE_1 class NumberFormatExceptionEx...); } catch(Exception e){ System.out.println(e
exception
defined checked exception ââ?¬Å?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
Exception
Exception  public class FooException extends Exception { public..."); } public void calculate() throws FooException, Exception { try { int.... ex.printStackTrace(); System.exit(1); } catch(Exception ex
Exception
Exception   I was creating a table dynamically but it shows exception i.e shown down Suplier created0 Suplier created0 Suplier created0 Product created0 Product created0 Product created0 Product created0 could not fetch initial
exception
user defined unchecked exception  can we create user defined unchecked exceptions? if so what is the exact use of it in real time?   Please visit the following links: http://www.roseindia.net/java/java-exception/user
exception
exception  Identify the reason for SQLException exception, which is encountered when the developer tries to run the following code snippet to insert..."); ps.executeUpdate(); } catch(Exception e
Different types of exception handling in Java
Different types of exception handling in Java Mostly an error or exception.... The base class for Runtime exception class is java.lang.RuntimeException..., SystemException, JMRuntimeException and WebServiceException etc. A RunTime exception
Java Exception - Java Beginners
" it leads to compiletime error: unreported exception. main use of try/catch... if we have try...catch block? If throws will throw the exception then who will catch... as throw use to make the related exception in our program. where as throws used
exception handling
exception handling  explain about exception handling
Exception handling
Exception handling  how to resolve file not found error exception
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Exception Handling
Exception Handling  create an exception class, which thros an exception if operand is non-numeric in claculating modules. ( Use command line arguments
Java exception
Java exception  What happens if an exception is not caught
Java exception
Java exception  Can an exception be rethrown
custom exception
custom exception  What is user defined exception
Java Exception
Java Exception  Which is superclass of Exception
Exception handling
Exception handling  exception are occur at run time but when we connect to the database errors will come at compile time why
exception handling
exception handling  can you explain how to handle the exception in java with picture representation
exception reason
exception reason  i had an exception equal sign is missing at line pst.executeUpdate() method line
exception handling
exception handling  could you please tell me detail the concept of exception handling
Exception: com.mysql.jdbc.Driver
Exception: com.mysql.jdbc.Driver  How to resolve Exception: com.mysql.jdbc.Driver in netbeans? Thanks in advance
Java exception
Java exception  What is the difference between exception and error
Java exception
Java exception  What is the difference between Checked and Unchecked exception
Getting Exception
Getting Exception  How to get exception from commented code in java
unchecked exception
unchecked exception  What happens if the service method throws an unchecked Exception
Exception in PDFBOX
Exception in PDFBOX  "OperatorProcessor class org.pdfbox.util.operator.pagedrawer.StrokePath could not be instantiated" Not understanding about the exception.Kindly help me out to find why this exception is occuring
custom exception
custom exception  Explain the process of creating custom exception and handling it.   Please visit the following link: Making custom exception
exception in servlet
exception in servlet  If a servlet is not properly initialized, what exception may be thrown?   During initialization or service of a request, the servlet instance can throw an UnavailableException
Exception Handling
Exception Handling  wrtie a java program to enable the user to handle any change of divide by zero exception.   Please visit the following link: http://www.roseindia.net/java/exceptions/how-to-throw-exceptions.shtml
ArrayStore Exception
ArrayStore Exception  whis is the ArrayStore Exception in java? or define ArrayStore Exception with exp?   ArrayStore Exception occurs...] = new Integer(0); } catch(Exception e
exception handling
exception handling  What is an exception and what are the advantages of exception handling mechanism.   Java Exception Exception are the runtime errors. Advantages: 1)Exception provides the means to separate

Ads