GetString returning 0.0

How do I solve the problem with ResultString.getString returning 0.0
instead of 0.
I retrieve data from a column of type
number(10).
Rickard Eneroth
WM-data
[email protected]
null

@Op. Strange select you got there.
select * from some_table where modification_date < ?
Then use a prepared statement and set the date that you want.

Similar Messages

  • ResultSet.getString() returning null.

    I'm using a PreparedStatement to select 1 row/10 columns from a
    table. The first time I getXXX() my values all is fine. I close
    the result set, clear the parameters and set the one variable on
    the statement and executeQuery. I can now read about 3 getXXX()
    and then the remaining getString() calls return null.
    The problem occurs when using the 1.1.1 thin driver but NOT when
    using an jdbcodbc driver.
    Any thoughts?
    Thanks, Frank
    PS: Please respond to my email address of [email protected]
    as well.
    null

    I believe there is/was a bug where once a NULL column value was
    retrieved, it would corrupt the ResultSet data (i.e. you will get
    NULL from then on). Not sure if this was resolved in a driver
    patch yet or not. Try downloading the latest version of the THIN
    driver.
    null

  • ResultSet.getString() returns only 2000 characters

    Hi
    I am using the JDBC (1.0 API) thin client version with Oracle 8.0.6 and one of my table columns uses the datatype VARCHAR2(4000). When inserting, I can insert values correctly but when I read values from this column (using rs.getString("col_name") or rs.getAsciiStream("col_name")), i can only read the first 2000 characters. How can I read all the data in the column...
    thanks,
    -aravind
    (i can view all the data when I use Delphi SQL-Explorer so I know that the data has been entered correctly)

    Hello Argyn,
    I have a similar problem with you but with Greek characters.
    Try this:
    When you write into oracle use:
    conn.statement.executeQuery("insert into testlang (Text_1) values (" + new String(sS.getBytes(),"UTF-8") + "')");
    When you read from oracle use:
    String sS = new String(resultSet.getBytes(i), "XXXX");
    Where XXXX is the encode character set that you want.
    (Note: getBytes work only if your ResultSet is not Scrollable)
    Please let me know if this help you.
    Piperis
    My problem is that I want to store Greek Characters in a way that I can read them via sqlplus too.
    By encoding when I write and decode them when I read doesn't satisfy me... any help!!!

  • Is there a constaint on number of characters returned in resultset?

    Hello,
    I am trying to retrieve a field from database which is 5000 - 6000 character long using the rs.getString() method. (Data stored is XML). When the number of characters exceed 4096, the getString() returns only 4096 characters. The rest is ignored even though data is available. After getting the XML, I parse it again.
    This standalone program fails at this point since the retrieved data (XML) is not complete.
    Any ideas?
    Thanks,
    Des

    Any ideas?Yeah. One idea would be to post JDBC questions in the JDBC forum.
    I use the getAsciiStream() method of ResultSet to give me an InputStream from which I can read the column.
    PC&#178;

  • Powershell ADODB Recordset getstring comma separated

    I am having problems with the getstring method of the Adodb.recordset object in Powershell 
    I wish to output a comma-separated string of a persisted recordset. I am not entirely sure the correct syntax for the getstring method 
    when I write the following
    $objRecordset.Getstring(,,",",,)
    I get the following error
    Missing ')' in method call.
    At :line:1 char:25
    + $objRecordset.Getstring(, <<<< ,",",,)
    The full code is below
    $adOpenStatic = 3
    $adLockOptimistic = 3
    $objRecordset = New-Object -comobject ADODB.Recordset
    ## where Modeldata.rs is recordset save to ADTG file
    $objRecordset.Open("Modeldata.rs" , "Provider=MSPersist",$adOpenStatic,$adLockOptimistic)$objRecordset.MoveFirst()
    ## outputs a tab delimited string by default
    $objRecordset.Getstring()
    ## output a comma delimited string
    $objRecordset.Getstring(,,",",,)
    ## returns the following error
    ##Missing ')' in method call.
    ##At :line:1 char:25
    ##+ $objRecordset.Getstring(, <<<< ,",",,)
    $objRecordset.Close()
    Can you please help?
    If this is not possible, is there a suitable workaround? 

    Thanks, jrv. That set me on the right track. I discovered also that I needed to enter a value for the second parameter (NumRows)
    as well. To return all records, I need to enter -1. 
    $objRecordset.Getstring(2,-1,",")

  • GetString() and column datatypes

    Hi,
    I have a program that reads the row values of a SELECT statement as strings.
    std::string value = resultSet->getString(IntCol); // read an integer value as string instead of getInt()
    The getString() function returns a std::string for almost all datatypes (like integer, float) correctly, except when it comes to Timestamp. Here getString() returns an empty string.
    What surprised me that it worked as well for a column with the DATE datatype (getString() returns a string formatted with the session parameter NLS_DATE_FORMAT).
    But this is not true for the Timestamp datatype. Here, I have to create explicitly a Timestamp object:
    Timestamp time = resultSet->getTimestamp();
    std::string value = time.toText(format, 6);
    Is that a bug? Why isn't the session variable NLS_TIMESTAMP_FORMAT used (like DATE)?
    Any suggestions appreciated! Thanks.
    Christian

    Use either a NLS_TIMESTAMP_FORMAT or explicitly convert timestamp to string by using TO_CHAR

  • Exception in thread "main" java.lang.NumberFormatException:For input String

    this is a code about arrylist. but when I debug it.it metion:Exception in thread "main" java.lang.NumberFormatException:For input String at java.lang.NumberFormatException.forInputString(numberFomatExceptionio java:48)
    at java.lang.Integer.parseInt(integer.java:468)
    at java.lang.Integer.parseInt(integer.java:497)
    at Get.getInt(manerger.java:208)
    at LinkList.insertFirst(manager.java:94)
    at manager.main(manager.java;20)
    this is my code:
    import java.io.*;
    import java.lang.*;
    public class manager
         public static void main(String args[]) throws IOException
         LinkList list=new LinkList();
         System.out.println("input S can scan the grade\ninput D can delete one entry\ninput U can update the entry\ninput A can add one entry\ninput E can end");
         int cr=System.in.read();
    switch(cr)
         case 'A':
         list.insertFirst();break;//this is 20 row
         case 'S':
         System.out.println("input the s");break;
         case 'D':
         System.out.println("input the d");break;
         case 'U':
         System.out.println("input the u");break;
    class Link
    public int number;
    public String name=new String();
    public int chs;
    public int eng;
    public int math;
    public Link next;
    public Link(int number,String name, int chs,int eng,int math)
    this.number=number;
    this.name=name;
    this.chs=chs;
    this.eng=eng;
    this.math=math;
    public Link()
         this(0,"",0,0,0);
    public void displayLink()
    System.out.println(number + " "+name+ " "+chs+ " "+eng+ " "+math+ " ");
    class LinkList
    public Link first;
    public LinkList()
    first = null;
    public boolean isEmpty()
    return first==null;
    public void displayList()
         System.out.println("");
         Link current=first;
         while(current!=null)
              current.displayLink();
              current=current.next;
         System.out.println("");
    public Link insertFirst() throws IOException
         Get getdata=new Get();
         int number=getdata.getInt();//this is 94 row
         String name=getdata.getString();
         int chs=getdata.getInt();
         int eng=getdata.getInt();
         int math=getdata.getInt();
         Link newLink = new Link(number,name,chs,eng,math);
         first=newLink;
         return first;
    public Link find(int key)
         Link current=first;
         while(current.number!=key)
              if(current.next==null)
              return null;
              else
              current=current.next;
         return current;
    public Link update(int key) throws IOException
         Link current=first;
         while(current.number!=key)
         if(current.next==null)
         return null;
         else
              System.out.println("Input the first letter of the subject:");
         int c=System.in.read();
         Get get=new Get();
              switch(c)
                   case 'c':
                   current.chs=get.getInt();break;
                   case 'e':
                   current.eng=get.getInt();break;
                   case 'm':
                   current.math=get.getInt();break;
         return current;
    public float average(char key)
         Link current=first;
         float total=0;
         float average=0;
         float counter=0;
         if(current==null)
         return 0;
         while(current!=null)
              switch(key)
                   case 'c':
                   total=current.chs+current.next.chs;break;
                   case 'e':
                   total=current.eng+current.next.eng;break;
                   case 'm':
                   total=current.math+current.next.math;break;
              current=current.next.next;
              counter++;
         average=total/counter;
         return average;
    public Link delete(int key)
         Link current=first;
         Link previous=first;
         while(current.number!=key)
              if(current.next==null)
              return null;
              else
                   previous=current;
                   current=current.next;
              if(current==first)
              first=first.next;
              else
              previous.next=current.next;
              return current;
    class Get
    public static String getString() throws IOException
    System.out.println("Input your name:");
    InputStreamReader str = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(str);
    String s = br.readLine();
    return s;
    public static int getInt() throws IOException
    System.out.println("Input your data:");
    String st = getString();
    return Integer.parseInt(st);//this is 208 row
    }

    It may be that the code in getString() returns a
    String that ends with a newline. If that is the
    problem, you can use
    return (Integer.parseInt(st)).trim();1. getString will never return a String ending in newline. BufferedReader.readLine strips off the newline.
    2. Even if you had a newline, String.trim doesn't trim newlines.
    3. You would need to trim the String, not the int:
    return (Integer.parseInt(st.trim()));As JimDinosaur said, you are passing bad data (the value of "st").
    In getInt, add this before trying to parse "st":
    System.out.println("###"+st+"###");What does it print?

  • How to use java classes of DC1 in DC2

    When I was trying to use a java-class from another DC, I stumbled into an error I didn't expect:
    java.lang.NoClassDefFoundError: com/company/application/utils
    This is what I did to get this far:
    1. Created an empty Web Dynpro DC (DC1), to be used as a utilities library.
    2. Added a Java class to the webdynpro project.
    3. Added the class to a public part of type compilation.
    4. Created a second Web Dynpro DC (DC2), which is supposed to consume the class from DC1.
    5. Added a DC-usage relation, so that DC1 is in DC2's used DCs. In this usage-relation built-time and run-time were checked
    5. Used DC1's class in DC2's component controller
    6. Built both DCs and deployed them
    7. Ran the application in DC2.
    When I run the application, the application dumps a stack trace at the moment that and object is created based on the class in DC1.
    Any idea how to get this working?

    Vincenzo, here is the real error message:
    java.lang.IllegalAccessError: tried to access method nl.phoqus.pataut.Guid.getGuidString()Ljava/lang/String; from class nl.phoqus.pataut.PatientAuthorization
    I have inserted a very simple GUID generator that I used in a previous project. Please find the class file below:
    package nl.phoqus.pataut;
    import java.util.Random;
    public class Guid {
         private static Guid guidFactory = new Guid();
         static Random random = new Random();
          * Allow global replacement of the GUID generator.  Applications
          * wishing to install their own GUID generators should sub-class
          * Guid, override the getGuid() method, and use this method to
          *  install their generator.
         public static void
         setGuidImpl(Guid factory) {
         guidFactory = factory;
          * Return a GUID as a string.
         public static String getString() {
         return guidFactory.getGuidString();
          * Return a GUID as a string.  This is completely arbitrary, and
          * returns the hexification of a random value followed by a
          * timestamp.
         protected String getGuidString() {
            long rand = (random.nextLong() & 0x7FFFFFFFFFFFFFFFL) | 0x4000000000000000L;
            return Long.toString(rand, 32) + Long.toString(System.currentTimeMillis()&0xFFFFFFFFFFFFFL, 32);
    I'm calling the class using the following statements from the component controller of DC2:
    Guid x = new Guid();
    String y = x.getGuidString();
    The component controller resides in package package nl.phoqus.pataut.
    Would that be the problem?

  • Need Help with a String Binary Tree

    Hi, I need the code to build a binary tree with string values as the nodes....i also need the code to insert, find, delete, print the nodes in the binarry tree
    plssss... someone pls help me on this
    here is my code now:
    // TreeApp.java
    // demonstrates binary tree
    // to run this program: C>java TreeApp
    import java.io.*; // for I/O
    import java.util.*; // for Stack class
    import java.lang.Integer; // for parseInt()
    class Node
         //public int iData; // data item (key)
         public String iData;
         public double dData; // data item
         public Node leftChild; // this node's left child
         public Node rightChild; // this node's right child
         public void displayNode() // display ourself
              System.out.print('{');
              System.out.print(iData);
              System.out.print(", ");
              System.out.print(dData);
              System.out.print("} ");
    } // end class Node
    class Tree
         private Node root; // first node of tree
         public Tree() // constructor
         { root = null; } // no nodes in tree yet
         public Node find(int key) // find node with given key
         {                           // (assumes non-empty tree)
              Node current = root; // start at root
              while(current.iData != key) // while no match,
                   if(key < current.iData) // go left?
                        current = current.leftChild;
                   else // or go right?
                        current = current.rightChild;
                   if(current == null) // if no child,
                        return null; // didn't find it
              return current; // found it
         } // end find()
         public Node recfind(int key, Node cur)
              if (cur == null) return null;
              else if (key < cur.iData) return(recfind(key, cur.leftChild));
              else if (key > cur.iData) return (recfind(key, cur.rightChild));
              else return(cur);
         public Node find2(int key)
              return recfind(key, root);
    public void insert(int id, double dd)
    Node newNode = new Node(); // make new node
    newNode.iData = id; // insert data
    newNode.dData = dd;
    if(root==null) // no node in root
    root = newNode;
    else // root occupied
    Node current = root; // start at root
    Node parent;
    while(true) // (exits internally)
    parent = current;
    if(id < current.iData) // go left?
    current = current.leftChild;
    if(current == null) // if end of the line,
    {                 // insert on left
    parent.leftChild = newNode;
    return;
    } // end if go left
    else // or go right?
    current = current.rightChild;
    if(current == null) // if end of the line
    {                 // insert on right
    parent.rightChild = newNode;
    return;
    } // end else go right
    } // end while
    } // end else not root
    } // end insert()
    public void insert(String id, double dd)
         Node newNode = new Node(); // make new node
         newNode.iData = id; // insert data
         newNode.dData = dd;
         if(root==null) // no node in root
              root = newNode;
         else // root occupied
              Node current = root; // start at root
              Node parent;
              while(true) // (exits internally)
                   parent = current;
                   //if(id < current.iData) // go left?
                   if(id.compareTo(current.iData)>0)
                        current = current.leftChild;
                        if(current == null) // if end of the line,
                        {                 // insert on left
                             parent.leftChild = newNode;
                             return;
                   } // end if go left
                   else // or go right?
                        current = current.rightChild;
                        if(current == null) // if end of the line
                        {                 // insert on right
                             parent.rightChild = newNode;
                             return;
                   } // end else go right
              } // end while
         } // end else not root
    } // end insert()
         public Node betterinsert(int id, double dd)
              // No duplicates allowed
              Node return_val = null;
              if(root==null) {       // no node in root
                   Node newNode = new Node(); // make new node
                   newNode.iData = id; // insert data
                   newNode.dData = dd;
                   root = newNode;
                   return_val = root;
              else // root occupied
                   Node current = root; // start at root
                   Node parent;
                   while(current != null)
                        parent = current;
                        if(id < current.iData) // go left?
                             current = current.leftChild;
                             if(current == null) // if end of the line,
                             {                 // insert on left
                                  Node newNode = new Node(); // make new node
                                  newNode.iData = id; // insert data
                                  newNode.dData = dd;
                                  return_val = newNode;
                                  parent.leftChild = newNode;
                        } // end if go left
                        else if (id > current.iData) // or go right?
                             current = current.rightChild;
                             if(current == null) // if end of the line
                             {                 // insert on right
                                  Node newNode = new Node(); // make new node
                                  newNode.iData = id; // insert data
                                  newNode.dData = dd;
                                  return_val = newNode;
                                  parent.rightChild = newNode;
                        } // end else go right
                        else current = null; // duplicate found
                   } // end while
              } // end else not root
              return return_val;
         } // end insert()
         public boolean delete(int key) // delete node with given key
              if (root == null) return false;
              Node current = root;
              Node parent = root;
              boolean isLeftChild = true;
              while(current.iData != key) // search for node
                   parent = current;
                   if(key < current.iData) // go left?
                        isLeftChild = true;
                        current = current.leftChild;
                   else // or go right?
                        isLeftChild = false;
                        current = current.rightChild;
                   if(current == null)
                        return false; // didn't find it
              } // end while
              // found node to delete
              // if no children, simply delete it
              if(current.leftChild==null &&
                   current.rightChild==null)
                   if(current == root) // if root,
                        root = null; // tree is empty
                   else if(isLeftChild)
                        parent.leftChild = null; // disconnect
                   else // from parent
                        parent.rightChild = null;
              // if no right child, replace with left subtree
              else if(current.rightChild==null)
                   if(current == root)
                        root = current.leftChild;
                   else if(isLeftChild)
                        parent.leftChild = current.leftChild;
                   else
                        parent.rightChild = current.leftChild;
              // if no left child, replace with right subtree
              else if(current.leftChild==null)
                   if(current == root)
                        root = current.rightChild;
                   else if(isLeftChild)
                        parent.leftChild = current.rightChild;
                   else
                        parent.rightChild = current.rightChild;
                   else // two children, so replace with inorder successor
                        // get successor of node to delete (current)
                        Node successor = getSuccessor(current);
                        // connect parent of current to successor instead
                        if(current == root)
                             root = successor;
                        else if(isLeftChild)
                             parent.leftChild = successor;
                        else
                             parent.rightChild = successor;
                        // connect successor to current's left child
                        successor.leftChild = current.leftChild;
                        // successor.rightChild = current.rightChild; done in getSucessor
                   } // end else two children
              return true;
         } // end delete()
         // returns node with next-highest value after delNode
         // goes to right child, then right child's left descendents
         private Node getSuccessor(Node delNode)
              Node successorParent = delNode;
              Node successor = delNode;
              Node current = delNode.rightChild; // go to right child
              while(current != null) // until no more
              {                                 // left children,
                   successorParent = successor;
                   successor = current;
                   current = current.leftChild; // go to left child
              // if successor not
              if(successor != delNode.rightChild) // right child,
              {                                 // make connections
                   successorParent.leftChild = successor.rightChild;
                   successor.rightChild = delNode.rightChild;
              return successor;
         public void traverse(int traverseType)
              switch(traverseType)
              case 1: System.out.print("\nPreorder traversal: ");
                   preOrder(root);
                   break;
              case 2: System.out.print("\nInorder traversal: ");
                   inOrder(root);
                   break;
              case 3: System.out.print("\nPostorder traversal: ");
                   postOrder(root);
                   break;
              System.out.println();
         private void preOrder(Node localRoot)
              if(localRoot != null)
                   localRoot.displayNode();
                   preOrder(localRoot.leftChild);
                   preOrder(localRoot.rightChild);
         private void inOrder(Node localRoot)
              if(localRoot != null)
                   inOrder(localRoot.leftChild);
                   localRoot.displayNode();
                   inOrder(localRoot.rightChild);
         private void postOrder(Node localRoot)
              if(localRoot != null)
                   postOrder(localRoot.leftChild);
                   postOrder(localRoot.rightChild);
                   localRoot.displayNode();
         public void displayTree()
              Stack globalStack = new Stack();
              globalStack.push(root);
              int nBlanks = 32;
              boolean isRowEmpty = false;
              System.out.println(
              while(isRowEmpty==false)
                   Stack localStack = new Stack();
                   isRowEmpty = true;
                   for(int j=0; j<nBlanks; j++)
                        System.out.print(' ');
                   while(globalStack.isEmpty()==false)
                        Node temp = (Node)globalStack.pop();
                        if(temp != null)
                             System.out.print(temp.iData);
                             localStack.push(temp.leftChild);
                             localStack.push(temp.rightChild);
                             if(temp.leftChild != null ||
                                  temp.rightChild != null)
                                  isRowEmpty = false;
                        else
                             System.out.print("--");
                             localStack.push(null);
                             localStack.push(null);
                        for(int j=0; j<nBlanks*2-2; j++)
                             System.out.print(' ');
                   } // end while globalStack not empty
                   System.out.println();
                   nBlanks /= 2;
                   while(localStack.isEmpty()==false)
                        globalStack.push( localStack.pop() );
              } // end while isRowEmpty is false
              System.out.println(
         } // end displayTree()
    } // end class Tree
    class TreeApp
         public static void main(String[] args) throws IOException
              int value;
              double val1;
              String Line,Term;
              BufferedReader input;
              input = new BufferedReader (new FileReader ("one.txt"));
              Tree theTree = new Tree();
         val1=0.1;
         while ((Line = input.readLine()) != null)
              Term=Line;
              //val1=Integer.parseInt{Term};
              val1=val1+1;
              //theTree.insert(Line, val1+0.1);
              val1++;
              System.out.println(Line);
              System.out.println(val1);          
    theTree.insert(50, 1.5);
    theTree.insert(25, 1.2);
    theTree.insert(75, 1.7);
    theTree.insert(12, 1.5);
    theTree.insert(37, 1.2);
    theTree.insert(43, 1.7);
    theTree.insert(30, 1.5);
    theTree.insert(33, 1.2);
    theTree.insert(87, 1.7);
    theTree.insert(93, 1.5);
    theTree.insert(97, 1.5);
              theTree.insert(50, 1.5);
              theTree.insert(25, 1.2);
              theTree.insert(75, 1.7);
              theTree.insert(12, 1.5);
              theTree.insert(37, 1.2);
              theTree.insert(43, 1.7);
              theTree.insert(30, 1.5);
              theTree.insert(33, 1.2);
              theTree.insert(87, 1.7);
              theTree.insert(93, 1.5);
              theTree.insert(97, 1.5);
              while(true)
                   putText("Enter first letter of ");
                   putText("show, insert, find, delete, or traverse: ");
                   int choice = getChar();
                   switch(choice)
                   case 's':
                        theTree.displayTree();
                        break;
                   case 'i':
                        putText("Enter value to insert: ");
                        value = getInt();
                        theTree.insert(value, value + 0.9);
                        break;
                   case 'f':
                        putText("Enter value to find: ");
                        value = getInt();
                        Node found = theTree.find(value);
                        if(found != null)
                             putText("Found: ");
                             found.displayNode();
                             putText("\n");
                        else
                             putText("Could not find " + value + '\n');
                        break;
                   case 'd':
                        putText("Enter value to delete: ");
                        value = getInt();
                        boolean didDelete = theTree.delete(value);
                        if(didDelete)
                             putText("Deleted " + value + '\n');
                        else
                             putText("Could not delete " + value + '\n');
                        break;
                   case 't':
                        putText("Enter type 1, 2 or 3: ");
                        value = getInt();
                        theTree.traverse(value);
                        break;
                   default:
                        putText("Invalid entry\n");
                   } // end switch
              } // end while
         } // end main()
         public static void putText(String s)
              System.out.print(s);
              System.out.flush();
         public static String getString() throws IOException
              InputStreamReader isr = new InputStreamReader(System.in);
              BufferedReader br = new BufferedReader(isr);
              String s = br.readLine();
              return s;
         public static char getChar() throws IOException
              String s = getString();
              return s.charAt(0);
         public static int getInt() throws IOException
              String s = getString();
              return Integer.parseInt(s);
    } // end class TreeApp

    String str = "Hello";
              int index = 0, len = 0;
              len = str.length();
              while(index < len) {
                   System.out.println(str.charAt(index));
                   index++;
              }

  • How to call a static method of a class from another class?

    Hello,
    I have two classes in a package. The first one
    package my package;
    public class class1
    protected static ImageIcon createIcon(String path)
    The second one
    package my package;
    public class class2
    private ImageIcon image1;
    image1 = class1.createIcon("/mypath");
    This does not work since class2 cannot load the appropriate image. Where do I have to define the ImageIcon variables in class one or two and do they have to be static variables?
    Thanks in advance
    Christos

    If the two classes are in the same package, that will work, in fact. A trivial example:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    // Note: Member of the same package
    package foo;
    public class Foo2 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }However, if they are in different packages that won't work - the protected keyword guarantees that only classes derived from the class with the protected method can access it: Therefore this will not work:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2{
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }But this will:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2 extends foo.Foo1 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }I think you should read up a bit more about packages and inheritance, because you're going to have a lot of trouble without a good understanding of both. Try simple examples first, like the above, and if you hit problems try to produce a simple test case to help you understand the problem rather than trying to debug your whole application.
    Dave.

  • Generic working in eclipse compiler but not through builds

    The following code snippet works fine in my eclipse development environment (1.6.0_06), but the build system running 1.6.0_06 throws exception:
    MyClass:343: incompatible types
    found : java.util.List<C>
    required: java.util.List<B>
    entries = createListFromSmartCopy(myAList, new B(), true);
    Types:
    A is an interface
    B is an interface of A
    C is an implementation of B
    List<A> aList = new ArrayList<A>();
    aList.add(new A());
    List<B> return = createListFromSmartCopy(aList, new C(), true);
        * <p>Creates a copy of a list where the source list could be an ancestor
        * type of the returned list. It also uses a reference object to actually
        * construct the objects that populate the return list.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param <S> - The more derived type of the prototype object used to
        * construct the list of R's
        * @param sourceList - The source list
        * @param referenceObject - The object used to construct the return list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
        * @return a list of R's (as defined by the caller) of entries with the
        * object constructed as a copy of referenceObject with the properties of the
        * sourceList copyied in after construction
    public static <T extends Serializable, R extends T, S extends R> List<R> createListFromSmartCopy(
                List<T> sourceList, S referenceObject, boolean deepCopy)
          List<R> retr = new ArrayList<R>();
          for(int i = 0; i < sourceList.size(); i++)
             retr.add(copyOf(referenceObject));
             copyInto(sourceList.get(i), retr.get(i), deepCopy);
          return retr;
       }Any thoughts on either:
    1. How does this pass the compiler validation inside eclipse, even through 'R' has not been defined? I believe that the code is doing some sort of return type inference to return the exactly correct type of list as referred by the return result or else it is simply ignoring the invariant capture of R all together and silently dropping the error. The funny thing is that the code does work just fine in practice in my development system without an issue.
    or
    2. Why if the code is valid does the independent build system disallow this generic return type 'inference' to occur? Are there compiler flags I can use to withhold this special condition?

    Thanks for the response, I wasn't trying to show a full example but just my implementation's snippet. I'll list one now:
    package test;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    public class TestMe
        * <p>This method performs a deep copy of an object by serializing and
        * deserialzing the object in question.</p>
        * @param <T> - The type of data to copy
        * @param original - The original object to copy
        * @return The object who's state should be the same as the original. This
        * call uses serialization to guarantee this copy is fully separate from the
        * original, so all sub-object references are also deep copies of their
        * originals
       @SuppressWarnings("unchecked")
       public static <T extends Serializable> T clone(T original)
          T obj = null;
          try
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             ObjectOutputStream out = new ObjectOutputStream(bos);
             out.writeObject(original);
             out.flush();
             out.close();
             ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(
                      bos.toByteArray()));
             obj = (T)in.readObject();
          catch(IOException e)
             e.printStackTrace();
          catch(ClassNotFoundException cnfe)
             cnfe.printStackTrace();
          return obj;
        * <p>Copies the properties from one object to another. The destined object
        * in this method must be derived from the source object. This allows for a
        * faster and smoother transition.</p>
        * @param <T> The type of source
        * @param <R> The type of destination
        * @param source - The source object
        * @param destination - The destination object
        * @param deepCopy - Copies the reference objects instead of just passing
        * back the reference pointer reference
       public static <T, R extends T> void copyInto(T source, R destination,
                boolean deepCopy)
       // Stubbed because it links into a ton of unnecessary methods
        * <p>Copies the values of a list of an ancestor class into the values of
        * another list who's value is derived from the ancestor.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param sourceList - The source list
        * @param destinationList - The destination list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
       public static <T, R extends T> void copyIntoList(List<T> sourceList,
                List<R> destinationList, boolean deepCopy)
          if(sourceList.size() > destinationList.size())
             throw new IllegalArgumentException(
                      "Cannot copy entire source set into destination list");
          for(int i = 0; i < sourceList.size(); i++)
             copyInto(sourceList.get(i), destinationList.get(i), deepCopy);
        * <p>Creates a copy of a list where the source list could be an ancestor
        * type of the returned list. It also uses a reference object to actually
        * construct the objects that populate the return list.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param <S> - The more derived type of the prototype object used to
        * construct the list of R's
        * @param sourceList - The source list
        * @param referenceObject - The object used to construct the return list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
        * @return a list of R's (as defined by the caller) of entries with the
        * object constructed as a copy of referenceObject with the properties of the
        * sourceList copyied in after construction
       public static <T extends Serializable, R extends T, S extends R> List<R> createListFromSmartCopy(
                List<T> sourceList, S referenceObject, boolean deepCopy)
          List<R> retr = new ArrayList<R>();
          for(int i = 0; i < sourceList.size(); i++)
             retr.add(clone(referenceObject));
             copyInto(sourceList.get(i), retr.get(i), deepCopy);
          return retr;
       public static void main(String[] args)
          List<A> aList = new ArrayList<A>();
          aList.add(new AImpl());
          aList.add(new AImpl());
          List<B> bList = createListFromSmartCopy(aList, new C(), true);
          for(B bItem : bList)
             System.out.println("My String = "
                      + bItem.getString() + " and my number = " + bItem.getInt());
       public static interface A extends Serializable
          public void setString(String string);
          public String getString();
       public static class AImpl implements A
          private static final long serialVersionUID = 1L;
          @Override
          public void setString(String string)
          @Override
          public String getString()
             return null;
       public static interface B extends A
          public void setInt(int number);
          public String getInt();
       public static class C implements B
          private static final long serialVersionUID = 1L;
          public C()
          @Override
          public String getInt()
             return null;
          @Override
          public void setInt(int number)
          @Override
          public String getString()
             return null;
          @Override
          public void setString(String string)
    }In my eclipse (20090920-1017), this compiles and runs just fine. I stripped out the functional pieces that weren't pertinent to the discussion.

  • Help me choose a datastructure please - urgent

    hi all,i have a very serious problem,to which i am not able to find the solution.the problem is as follows
    i have a large number of datas in a database table.now i need to query that table so many times,so to improve the performance i thought i can retrieve the datas and put them in a datastructure so that the system need not query the database again and again.the table structure has two fields.one number and the other string.the numbers are not unique,and i need to have these numbers ans strings in the single datastructure.i saw that all the util datastructures have their own indexes and so they do not allow me to enter my numbers and strings from the table in the same datastructure.which structure will allow the flexibility that i need,or is there any other way to do it.please reply soon,bye thiyagu.

    Not exactly sure what you're looking for in terms of a data structure... but I'll just give you what I think the simplest solution is to your problem.
    Define a new object (i.e. MyData) which has variables, theNumber (an int or float or whatever yer number is) and theString. Then, all you need to do is query your database, create new MyData objects for each record, and put them into an ArrayList.
    public class MyData {
    private int theNumber;
    private String theString;
    public MyData(int number, String str) {
    theNumber = number;
    theString = str;
    public int getNumber() {
    return theNumber;
    public String getString() {
    return theString;
    Thats my solution...

  • How to set  dynamic parameter in bean

    I want to set a change able paramerter in my bean what can I do?
    like
    db.setCatalog(" HkData "); hard code, work fine.
    but if
    public String getOurDatabase(){
    return ourDatabase;}
    public void setOurDatabase ( String ourDatabase ) {
    this.ourDatabase =ourDatabase; }
    what is the correct syntax in
    db.setCatalog(" ? ");

    Hi follow is my bean, I need code in ???? place
    Thank you
    package num;
    import java.util.*;
    import java.sql.*;
    public class NameBean1 implements java.io.Serializable {
      /* Member Variables */
      private String fieldNumber;
      private String name;
      private String hiTiter;
      private String subType;
      private String string;
      private String ourDatabase;
      /* ArrayLists to hold recordsets */
      private List fieldNumberList, nameList, hiTiterList, subTypeList;
      /* Helper Variables */
      private int currentRow;
      private int rowCount;
      private boolean anyRecords = false;
      private Connection db = null;
      private ResultSet rs=null;
      /* Constructor */
      public NameBean1() {
         again(); 
      /* Get Database Connection */
      private void dbConnect() {
        if (db == null) {
          try {
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            db = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;selectMethod=cursor","test","1234");
           what is code in here????????
          catch (Exception e) {
            System.out.println("Error Connecting to catalog DB: " + e.toString());
      /* Accessor Methods */
      public String getfieldNumber() {
        return fieldNumber;
    /* one way to set data will get from database */
      public void setFieldNumber(String fieldNumber) {
         this.fieldNumber =fieldNumber;
      public String getName() {
        return name;
      public void setName(String _name) {
        name = _name;
      public String getHiTiter() {
        return hiTiter;
      public void setHiTiter(String _hiTiter) {
        hiTiter = _hiTiter;
       public String getSubType() {
        return subType;
      public void setSubType(String _subType) {
        subType = _subType;
    public  String getString(){
        return string;
    public void setString( String string ) {
       this.string =string;    }
    public void setOurDatabase(String ourDatabase){
            ourDatabase=ourDatabase;
    public String getOurDatabase() {
        return ourDatabase;
      /* Read-only attribute */
      public int getCurrentRow() {
        return currentRow;
      public int getRowCount() {
        return rowCount;
      /* Populate Record List */
      public boolean Mysearch() {
        /* If fieldNumberList is empty, then execute the query  */
        if (fieldNumberList.isEmpty()) {
          try {
                       Statement s = db.createStatement();
                        String Sql=" select ourDatabase.dbo.ViruName00.FieldNumber, Name, HiTiter, SubType, Storage";
                             Sql+=" from ourDatabse.dbo.ViruName00,ourDatabse.dbo.Storage00";
                             Sql+=" where ourDatabse.dbo.ViruName00.NewNum=ourDatabse.dbo.Storage00.NewNum and Name like'%"+string+"%'";
                             Sql+=" Union";
                             Sql+=" ourDatabse.dbo.select ViruName01.FieldNumber,Name, HiTiter,SubType, Storage";
                             Sql+=" from ourDatabse.dbo.ViruName01, ourDatabse.dbo.Storage01";
                             Sql+=" where ourDatabse.dbo.ViruName01.NewNum = ourDatabse.dbo.Storage01.NewNum and Name like'%"+string+"%'";
                             Sql+=" Union";
                             Sql+=" select ourDatabse.dbo.ViruName02.FieldNumber,Name, HiTiter, SubType,Storage";
                             Sql+=" from ourDatabse.dbo.ViruName02, ourDatabse.dbo.Storage02";
                             Sql+=" where ourDatabse.dbo.ViruName02.NewNum=ourDatabse.dbo.ourDatabse.dbo.Storage02.NewNum and Name like'%"+string+"%'";
                             Sql+=" Union";
                             Sql+=" select ViruName03.FieldNumber,Name, HiTiter, SubType, Storage";
                             Sql+=" fromourDatabse.dbo. ViruName03, ourDatabse.dbo.Storage03";
                             Sql+=" where ourDatabse.dbo.ViruName03.NewNum=ourDatabse.dbo.Storage03.NewNum and Name like'%"+string+"%'";
                rs = s.executeQuery (Sql);
            fieldNumberList.clear();
            nameList.clear();
            hiTiterList.clear();
            subTypeList.clear();
            rowCount = 0;
            while (rs.next()) {
               fieldNumberList.add(rs.getString("FieldNumber"));
               nameList.add(rs.getString("Name"));
               hiTiterList.add(rs.getString("HiTiter"));   
               subTypeList.add(rs.getString("SubType"));
               rowCount++;
              anyRecords = true;
            }//end while
          }//end try
          catch (Exception e) {
            System.out.println("Error populating productBean: " + e.toString());
        }//end if   
         return anyRecords; }//end function
    public boolean getAnyRecords() {
        return anyRecords;  }
      /* Reset current row */
      public void setStartRow(int start) {
        if (start < rowCount) {
          currentRow = start;
      /* Move to next row */
      public int nextRow() {
        if (currentRow == rowCount) {
          currentRow = 0; // Reset for next page request
          return 0; // return 0 to indicate end of recordset
        /* Populate bean properties with current row */
        setFieldNumber((String)fieldNumberList.get(currentRow));
        setName((String)nameList.get(currentRow));
        setHiTiter((String)hiTiterList.get(currentRow));
        setSubType((String)subTypeList.get(currentRow));   
        currentRow++;
        /* return currentRow*/
        return currentRow;
    public void again(){
        /* Initialize bean properties */
        setFieldNumber("");
        setName("");
        setHiTiter("");
        setSubType("");
        /* Initialize arrayLists to hold recordsets */
        fieldNumberList = new ArrayList();
        nameList = new ArrayList();
        hiTiterList = new ArrayList();
        subTypeList = new ArrayList();
         fieldNumberList.clear();
            nameList.clear();
            hiTiterList.clear();
            subTypeList.clear();
        /* Initialize helper variables */
        currentRow = 0;
        rowCount = 0;
        anyRecords= false;
        /* Get database connection */
        dbConnect();
      rs=null;
    }

  • How to Use GnuPG(GPG) winth in java

    Hi all
    I am having one tough time getting How to use GnuPg with in Java languge to encrypt and decrypt file. Can anyone offer any help ...
    Satya

    I'm using this wrapper founded somewhere. Works fine to me.
    /* License: GPL
    * Author: John Anderson
    * Description: A small class to encrypt and decrypt text using GnuPG.
    import java.io.*;
    public class GnuPG {
            private Process p;
            private String gpg_result;
            private String gpg_err;
            GnuPG() {
            public void verifySign(String signedFile, String originalFile){
                    System.out.print("Verifying...");
                    try {
                            //p = Runtime.getRuntime().exec("gpg --output "+originalFile+" --decrypt --yes --verbose " + signedFile);
                            p = Runtime.getRuntime().exec("gpg --verify " + signedFile);
                    } catch (IOException io) {
                            System.out.println("Error creating process.");
                    ProcessStreamReader psr_stdout = new ProcessStreamReader("STDIN", p.getInputStream());
                    ProcessStreamReader psr_stderr = new ProcessStreamReader("STDERR",p.getErrorStream());
                    psr_stdout.start();
                    psr_stderr.start();
                    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
                    try {
                            out.write("\n");
                            out.close();
                    } catch (IOException io) {
                    try {
                            p.waitFor();
                            psr_stdout.join();
                            psr_stderr.join();
                    } catch (InterruptedException i) {
                    gpg_result = psr_stdout.getString();
                    gpg_err = psr_stdout.getString();
                    System.out.println("Done.");
            public void encrypt(String str, String rcpt) {
                    System.out.print("Encrypting... ");
                    try {
                            p = Runtime.getRuntime().exec("gpg --armor --batch --encrypt -r " + rcpt);
                    } catch (IOException io) {
                            System.out.println("Error creating process.");
                    ProcessStreamReader psr_stdout = new ProcessStreamReader("STDIN", p.getInputStream());
                    ProcessStreamReader psr_stderr = new ProcessStreamReader("STDERR",p.getErrorStream());
                    psr_stdout.start();
                    psr_stderr.start();
                    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
                    try {
                            out.write(str);
                            out.close();
                    } catch (IOException io) {
                    try {
                            p.waitFor();
                            psr_stdout.join();
                            psr_stderr.join();
                    } catch (InterruptedException i) {
                    gpg_result = psr_stdout.getString();
                    gpg_err = psr_stdout.getString();
                    System.out.println("Done.");
            public void decrypt(String str, String passphrase) {
                    File f = null;
                    try {
                            f = File.createTempFile("gpg-decrypt", null);
                            FileWriter fw = new FileWriter(f);
                            fw.write(str);
                            fw.flush();
                    } catch (IOException io) {
                    System.out.print("Decrypting from: " + f.getAbsolutePath());
                    try {
                            p = Runtime.getRuntime().exec("gpg --passphrase-fd 0 --batch --decrypt " +
                                    f.getAbsolutePath());
                    } catch (IOException io) {
                            System.out.println("Error creating process.");
                    ProcessStreamReader psr_stdout =
                            new ProcessStreamReader("STDIN",
                            p.getInputStream());
                    ProcessStreamReader psr_stderr =
                            new ProcessStreamReader("STDERR",
                            p.getErrorStream());
                    psr_stdout.start();
                    psr_stderr.start();
                    BufferedWriter out = new BufferedWriter(
                            new OutputStreamWriter(p.getOutputStream()));
                    try {
                            out.write(passphrase);
                            out.close();
                    } catch (IOException io) {
                    try {
                            p.waitFor();
                            psr_stdout.join();
                            psr_stderr.join();
                    } catch (InterruptedException i) {
                    gpg_result = psr_stdout.getString();
                    gpg_err = psr_stdout.getString();
                    System.out.println("Done.");
            public String getResult() {
                    return gpg_result;
            public String getError() {
                    return gpg_err;
    class ProcessStreamReader extends Thread {
            String name;
            StringBuffer stream;
            InputStreamReader in;
            final static int BUFFER_SIZE = 256;
            ProcessStreamReader(String name, InputStream in) {
                    super();
                    this.name = name;
                    this.in = new InputStreamReader(in);
                    this.stream = new StringBuffer();
            public void run() {
                    try {
                            int read;
                            char[] c = new char[BUFFER_SIZE];
                            while ((read = in.read(c, 0, BUFFER_SIZE - 1)) >
                                    0) {
                                    stream.append(c, 0, read);
                                    if (read < BUFFER_SIZE - 1)
                                            break;
                    } catch (IOException io) {}
            String getString() {
                    return stream.toString();
    }

  • Help required in jsp

    hi guys i have a problem in jsp here in my code i get input from first html and pass th second jsp an d my jsp is connected to usebean
    welcome.html
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1>JSP Page</h1>
    <form action="usedbean.jsp" method="POST">
    <table border="1">
    <tbody>
    <tr>
    <td> <input type="radio" name="a1" value="add" />addition</td>
    </tr>
    <tr>
    <td><input type="radio" name="a1" value="sub" />subration</td>
    </tr>
    <tr>
    <td><input type="radio" name="a1" value="div" />division</td>
    </tr>
    </tbody>
    </table>
    input two number <input type="text" name="t1" value="" size="20" />
    <input type="submit" value="submit" />
    <input type="reset" value="cancel" />
    </form>
    </body>
    </html>
    usebean.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <jsp:useBean id="tag" scope="page" class="test.optionbean" />
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    String str =request.getParameter("r1");
    String str1 = request.getParameter("t1");
    //String str2 = request.getParameter("t2");
    int n1 = Integer.parseInt(str1);
    // int n2 = Integer.parseInt(str2);
    int N3 = 0;
    optionbean.setstr(str);
    optionbean.setN3(n1);
    %>
    thus the output      <%=optionbean.getN3()%>
    </body>
    </html>
    and optionbean.java
    * optionbean.java
    * Created on September 1, 2007, 5:06 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package test;
    import java.io.*;
    * @author d
    public class optionbean implements Serializable {
    public String str ;
    public int N3;
    String final_output="" ;
    public int getN3() {
    return N3;
    public void setN3(int n1 ) {
                   if(str.equals("add")){
    N3 = n1+10;
    final_output="addition";
    if(str.equals("sub")){
    N3 = n1-10;
    final_output="subration";
    if(str.equals("add")){
    N3 = n1/10;
    final_output="division";
    public String getStr() {
    return str;
    public void setStr(String str) {
    this.str = str;
    th error it shows is
    C:\Documents and Settings\d\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\WebApplication11\org\apache\jsp\usedbean_jsp.java:75: cannot find symbol
    symbol : variable optionbean
    location: class org.apache.jsp.usedbean_jsp
    optionbean.setstr(str);
    ^
    C:\Documents and Settings\d\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\WebApplication11\org\apache\jsp\usedbean_jsp.java:76: cannot find symbol
    symbol : variable optionbean
    location: class org.apache.jsp.usedbean_jsp
    optionbean.setN3(n1);
    ^
    C:\Documents and Settings\d\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\WebApplication11\org\apache\jsp\usedbean_jsp.java:84: cannot find symbol
    symbol : variable optionbean
    location: class org.apache.jsp.usedbean_jsp
    out.print(optionbean.getN3());
    ^
    3 errors

    ya i corrected that error to
    now the problem is that is not excuting
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <jsp:useBean id="optionbean" scope="page" class="test.optionbean" />
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    String data =request.getParameter("r1");
    String str1 = request.getParameter("t1");
    //String str2 = request.getParameter("t2");
    int n1 = Integer.parseInt(str1);
    // int n2 = Integer.parseInt(str2);
    optionbean.setdata(data);
    optionbean.setN3(n1);
    %>
    thus the output      <%=optionbean.getN3()%>
    </body>
    </html>
    an my bean class optionbean is
    * optionbean.java
    * Created on September 1, 2007, 5:06 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package test;
    import java.io.*;
    * @author d
    public class optionbean implements Serializable {
    private String data ;
    public int N3;
    String final_output="" ;
    public int getN3() {
    return N3;
    public void setN3(int n1 ) {
                   if(data.equals("add")){
    N3 = n1+10;
    final_output="addition";
    if(data.equals("sub")){
    N3 = n1-10;
    final_output="subration";
    if(data.equals("div")){
    N3 = n1/10;
    final_output="division";
    public String getdata() {
    return data;
    public void setdata(String data) {
    this.data = data;
    the error it shows
    rg.apache.jasper.JasperException: Exception in JSP: /usedbean.jsp:33
    30:
    31:
    32: optionbean.setdata(data);
    33: optionbean.setN3(n1);
    34:
    35:
    36:
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    java.lang.NullPointerException
         test.optionbean.setN3(optionbean.java:28)
         org.apache.jsp.usedbean_jsp._jspService(usedbean_jsp.java:77)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

Maybe you are looking for