Bug in Hashtable put?

Hi,
I am not sure if I just found a bug in java.util.Hashtable, but take a look at
http://img112.imageshack.us/my.php?image=hashtablebug4je.png
As you can see this Hashtable has a size of 5, but only 4 entries. The reason for this is the fact, that the last (fifth) put operation replaced the element at index 2. Any ideas how this can happen??
Interestingly, the front end of my system finds the entries "kdSucheSortierkriterium", "kdSucheKonzernName", "kdSucheKonzernNr" (the item placed first at index 2) and "kdSucheKundeName". Gotta figure this one out; anyway the behaviour described above seems to occur independently from my system, as I only call (Hashtable).put.
Any idea would be helpful...
btw, "kdSucheKonzernName" etc. are the keys used in the Hashtable.

Btw, unless you are debugging java.util.Hashtable (which you shouldn't do) you should have no need to look at the internals of Hashtable. And if you do, make sure that you check how a Hashtable is implemented, specifically how collisions are handled (hint: there are several possible strategies, the Java Hashtable uses a linked list).

Similar Messages

  • Problem with Hashtable put

    Hi
    Can someone please tell what wrong with my code, I'm getting NullPointerException while I was compiling
    class X509Cert{
    private X509Certificate cert;
    //subject distinguished name
    String sbcn,sbou,sbo,sbl,sbc,sbe;
    public void X059Cert()
      this.sbcn="";
      this.sbou="";
      this.sbo="";
      this.sbl="";
      this.sbc="";
      this.sbe="";
    public void setSubjectDN(String CN, String OU, String O, String L, String C, String E)
      this.sbcn=CN;
      this.sbou=OU;
      this.sbo=O;
      this.sbl=L;
      this.sbc=C;
      this.sbe=E;
    public void genCert(PrivateKey prikey, PublicKey pubkey)
      //subject distinguished name
      Hashtable subjectdn=new Hashtable();
      subjectdn.put(X509Principal.CN, this.sbcn);  <--------- what problem with this 
      subjectdn.put(X509Principal.OU, this.sbou);
      subjectdn.put(X509Principal.O, this.sbo);
      subjectdn.put(X509Principal.L, this.sbl);
      subjectdn.put(X509Principal.C, this.sbc);
      subjectdn.put(X509Principal.E, this.sbe);I really need your help, Thank

    Hi UlrikaJ
    Thank for your help
    it wil not have that problem, if I change it to :
    attrs.put(X509Principal.C, "AU");
    attrs.put(X509Principal.O, "The Legion of the Bouncy Castle");
    attrs.put(X509Principal.L, "Melbourne");
    attrs.put(X509Principal.ST, "Victoria");
    attrs.put(X509Principal.E, "[email protected]");I thank this is somthing about pass by reference or value problem, isn't it .

  • Error in Hashtable put method-Can not resolve symbol

    Hi there!I am new to using java.util.Hashtable.
    I am using it for a command line instant messaging program for holding the list of clients and list of client names currently connected to the server.
    However when I compile my server with the command javac server.java it seems to give errors can not resolve symbol method put (java.lang.object,int).
    Here is my code for my server:
    * @(#)server.java
    * @author
    * @version 1.00 2008/3/22
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.*;
    public class server {
              static int key1=0;
              static Hashtable nameHolder=new Hashtable();
              //static ArrayList nameHolder=new ArrayList();
              //static ArrayList clientsConnected =new ArrayList();
              static Hashtable clientsConnected =new Hashtable();
         public static void main(String[] args) throws IOException {
              //nameHolder.add("controlelement");
              Socket connect=null;
              String name =null;
              PrintWriter out=null;
              BufferedReader in =null;
              String machinename;
              int port=0;
         ServerSocket serverSocket = null;
         serverSocket = new ServerSocket(2222);
         boolean listeningports = true;
         try {
                   if(args.length > 0)
                   port = Integer.parseInt(args[0]);
                   System.out.println(port);
                   else
                        System.out.println("You must enter port number");
                        System.exit(1);
                   while(true)
                             System.out.println("Hakan");
                             connect=serverSocket.accept();
                   in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                        System.out.println("Hakan");
                   String girdi = in.readLine();
                   StringTokenizer nameAl=new StringTokenizer(girdi);
                   String ad=null;
                   String host=null;
                   int portofclient=0;
                   int m=0;
                   while(nameAl.hasMoreTokens())
                        if(m==0)
                             ad=nameAl.nextToken();
                             System.out.println("Adim"+ad);
                        else if(m==1)
                             host=nameAl.nextToken();
                             System.out.println("Hostum"+host);
                        else if(m==2)
                             portofclient = Integer.parseInt(nameAl.nextToken());
                             System.out.println("Listening portum"+portofclient);
                             break;
                        m++;
                   out = new PrintWriter(connect.getOutputStream(), true);
                   System.out.println("Haso");
                   if(!isUsed(ad))
                        System.out.println(girdi);
                        System.out.println("H�so");
                        //Object fason=(Object)ad;
                        nameHolder.put(key1,ad);
    //The error seems to occur here
                        client myclient=new client(ad,host,portofclient);
                        //Object garson=(Object)myclient;
                        clientsConnected.put(key1,myclient);
                        key1++;
                        //clientInfoHolder.add(girdi);
                        out.println("Kullan&#305;mda");
                        System.out.println("Haso");
                        new MultiClientManager(connect).start();
                   else
                        //System.out.println("kulanilmaz");
                        out.println("Kullanim disi");
         catch(Exception e)
              System.out.println("You did not specify port number");
              System.out.println("Or connection was not established due to specifying invalid or used port");
              e.printStackTrace();
         public static boolean isUsed( String name )
                   if( nameHolder.containsValue(name) )
                        return true;
                   return false;
         public static client Ask(String name)
              ArrayList lombak=(ArrayList) clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return semsi;
              return null;
         public static int returnkeyoffromclients(String name)
              ArrayList lombak=(ArrayList)clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return i;
              return 0;
         public static int returnkeyoffromnames(String name)
              ArrayList lombak=(ArrayList)nameHolder.values();
              for(int i=0;i<lombak.size();i++)
                   String semsi = lombak.get(i).toString();
                   if(semsi.compareTo(name)==0)
                        return i;
              return 0;
    }

    Excuse me for not putting my code between tags. I am just sleepless.
    I am sending it again.
    * @(#)server.java
    * @author
    * @version 1.00 2008/3/22
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.*;
    public class server  {
              static int key1=0;
              static Hashtable nameHolder=new Hashtable();
              //static ArrayList nameHolder=new ArrayList();
              //static ArrayList clientsConnected =new ArrayList();
              static Hashtable clientsConnected =new Hashtable();
             public static void main(String[] args) throws IOException {
                  //nameHolder.add("controlelement");
                  Socket connect=null;
                  String name =null;
                  PrintWriter out=null;
                  BufferedReader in =null;
                  String machinename;
                  int port=0;
                 ServerSocket serverSocket = null;
                 serverSocket = new ServerSocket(2222);
                 boolean listeningports = true;
                 try {
                        if(args.length > 0)
                             port = Integer.parseInt(args[0]);
                             System.out.println(port);
                        else
                             System.out.println("You must enter port number");
                             System.exit(1);
                        while(true)
                                  System.out.println("Hakan");
                                   connect=serverSocket.accept();
                             in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                                  System.out.println("Hakan");
                             String girdi = in.readLine();
                             StringTokenizer nameAl=new StringTokenizer(girdi);
                             String ad=null;
                             String host=null;
                             int portofclient=0;
                             int m=0;
                             while(nameAl.hasMoreTokens())
                                  if(m==0)
                                       ad=nameAl.nextToken();
                                       System.out.println("Adim"+ad);
                                  else if(m==1)
                                       host=nameAl.nextToken();
                                       System.out.println("Hostum"+host);
                                  else if(m==2)
                                       portofclient = Integer.parseInt(nameAl.nextToken());
                                       System.out.println("Listening portum"+portofclient);
                                       break;
                                  m++;
                             out = new PrintWriter(connect.getOutputStream(), true);
                             System.out.println("Haso");
                             if(!isUsed(ad))
                                  System.out.println(girdi);
                                  System.out.println("H�so");
                                  //Object fason=(Object)ad;
                                  nameHolder.put(key1,ad);
                                  client myclient=new client(ad,host,portofclient);
                                  //Object garson=(Object)myclient;
                                  clientsConnected.put(key1,myclient);
                                  key1++;
                                  //clientInfoHolder.add(girdi);
                                  out.println("Kullan&#305;mda");
                                  System.out.println("Haso");
                                  new MultiClientManager(connect).start();
                             else
                                  //System.out.println("kulanilmaz");
                                  out.println("Kullanim disi");
                 catch(Exception e)
                      System.out.println("You did not specify port number");
                      System.out.println("Or connection was not established due to specifying invalid or used port");
                      e.printStackTrace();
             public static boolean isUsed( String name )
                       if( nameHolder.containsValue(name) )
                            return true;
                       return false;
             public static client Ask(String name)
                  ArrayList  lombak=(ArrayList) clientsConnected.values();
                  for(int i=0;i<lombak.size();i++)
                       client semsi = (client)lombak.get(i);
                       if(semsi.nickname.compareTo(name)==0)
                            return semsi;
                  return null;
             public static int returnkeyoffromclients(String name)
                  ArrayList lombak=(ArrayList)clientsConnected.values();
                  for(int i=0;i<lombak.size();i++)
                       client semsi = (client)lombak.get(i);
                       if(semsi.nickname.compareTo(name)==0)
                            return i;
                  return 0;
             public static int returnkeyoffromnames(String name)
                  ArrayList lombak=(ArrayList)nameHolder.values();
                  for(int i=0;i<lombak.size();i++)
                       String semsi = lombak.get(i).toString();
                       if(semsi.compareTo(name)==0)
                            return i;
                  return 0;
         These are the lines that are responsible from the error.
    nameHolder.put(key1,ad);
    client myclient=new client(ad,host,portofclient);
    //Object garson=(Object)myclient;
    clientsConnected.put(key1,myclient);

  • Big bug if i put a wrong birth date (2012). How can i modify it?

    When i try to access to adobe.com put accidentally 2012 like a birth date, that block me to acess all the function and i can't modify it.
    Please restore this BIG bug.
    Ridiculus

    Is this when you are trying to log in to acrobat.com files from within Reader?
    If so, this is sort-of by design, because of the US CIPA regulations. It does, however, catch accidental date entries as well.
    I'll pass the frustration along to our login service.
    Dennis

  • Xml reading specific node and putting them in hashtable

    Hi Friends
    I have to create program to print xml filenames and the id (which is a tag) inside the xml file.
    the filenames i have to print are the names of xml files themselves and then
    they have id taginside the file and there can be more then one id now I have
    to add all the id names and filenames to a hashtable. I don't know how to do this. Any help would be great.
    Hashtable should be like this
    id filename
    012125 hbn.xml
    012567 hbn.xml
    345669 xsf.xml
    Till now I hace made the code to create DOM for the files abd I can read the ID'd inside the files, But i do not know how to add id's with their files names in the hashtable.
    Part of my code lokks like this::
    NodeList idList = currDom.getElementsByTagName("ID");
    if( idList == null && idList.getLength() == 0 ) {
    System.out.print("LIST is empty ,return bad... " );
    } else {
    for(int i=0; i< idList.getLength(); i++ ){
    String strval = idList.item(i).getFirstChild().getNodeValue();
    int nodeval = Integer.parseInt(strval);
    System.out.println("grant id value is " + nodeval);
    any sample code will be great.
    Regards Preeti

    use put method of HashTable class.
    hashTable.put(key,value);
    here key and value both should be objects.
    so u can make id as key(u have to wrap it with Integer),and file name as the value.
    -seenu_ch

  • Hashtable - remove/put throws NullpointerException

    Hi,
    I have a hashtable, in which I include two (different) values. At random the are placed at the same key-value.
    So I have a hashtable of size=2.
    I iterate through it via an enumeration of the elements. If the value of the key isn't '-1' I use it and mark it with '-2' remove it and reinclude it.
    while(e.hasMoreElements())
    if((Integer)e.nextElement()==-1)                                             //unused
         String myString = (String) e.next();
         hashtable.remove(myString );
         hashtable.put(myString , -2);
    }Because of the keys matche on the position the remove-operation toggles my two items and I receive a Nullpointerexception.
    Does anybody know how to handle it? (maybe reinclude the point before the 2nd one, but how?)
    Thanks in adavance.
    adicko

    Sorry my fault, the 2nd next gets the key (String) to the value. The if-clause prevents a double handling (therefore the reincluding - perhabs also other values are reincluded ~> so I don't have to work with them).
    But in this case I only reinclude one value and so toggle the two one (one the same key-position).
    while(e.hasMoreElements())
    if((Integer)e.nextElement()==-1)                                             
            String myString = (String) key.next();
         //do sth. with the key
            hashtable.remove(myString);
         hashtable.put(myString, -2);
            //....  other treated points are "reincluded"
    }

  • Bug in 6.1 SP6 + 8.1 SP2 in WebAppServletContext.setAttribute

              Althoug I found a depending Fixed Problem Message for BEA 7.0, I get the following
              NullPointer Exception with BEA Weblogic Server 6.1 SP6 (in SP 4 it works fine)
              and in 8.1 SP2.
              The J2EE Spec allowes to use setAttribute("xy", null) and it should be handled
              in the same way like caling removeAttribute("xy").
              11:19:37,573 ERROR (AdministrationConstantReloadTab.java:101) - Fehler beim Anzeigen
              des AdministrationAntragReloadTabs
              java.lang.NullPointerException
              at java.util.Hashtable.put(Hashtable.java:389)
              at weblogic.servlet.internal.WebAppServletContext.setAttribute(WebAppServletContext.java:669)
              at de.abc.elektra.administration.control.AdministrationConstantReloadTab.handleAction(AdministrationConstantReloadTab.java:90)
              at de.abc.elektra.common.control.TabHandler$TabFormListener.formSubmitted(TabHandler.java:216)
              at com.javelin.swinglets.SForm.processFormEvent(SForm.java:168)
              at com.javelin.swinglets.SForm.processEvent(SForm.java:132)
              at com.javelin.swinglets.SComponent.dispatchEvent(SComponent.java:1179)
              at com.javelin.swinglets.ServletManager.handle(ServletManager.java:256)
              at de.abc.elektra.common.control.WindowHandler.handleContext(WindowHandler.java:44)
              at de.abc.elektra.common.control.Navigator.process(Navigator.java:239)
              at de.abc.elektra.common.control.Navigator.doPost(Navigator.java:117)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
              at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#setAttribute(java.lang.String,
              java.lang.Object)
              javax.servlet
              Interface ServletContext
              setAttribute
              public void setAttribute(java.lang.String name,
              java.lang.Object object)Binds an object to a given attribute
              name in this servlet context. If the name specified is already used for an attribute,
              this method will replace the attribute with the new to the new attribute.
              If listeners are configured on the ServletContext the container notifies them
              accordingly.
              If a null value is passed, the effect is the same as calling removeAttribute().
              Attribute names should follow the same convention as package names. The Java
              Servlet API specification reserves names matching java.*, javax.*, and sun.*.
              Parameters:
              name - a String specifying the name of the attribute
              object - an Object representing the attribute to be bound
              It is not really a problem if you have the chance to quickly change your implementation
              as you can use removeAttribute(String). But if there is a BEA employee reading
              this, then that bug should be fixed in the upcoming Service Packs.
              Guido Reiff
              

    I think we are running into a related issue with WLS6.1 SP6. We use struts
              and on re-loading some of the action classes, we see a NPE on a
              getServletContext call in org.apache.structs.action.RequestProcessor. This
              worked fine in WLS6.1 SP4.
              - Prasad
              "greiff" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Althoug I found a depending Fixed Problem Message for BEA 7.0, I get the
              following
              > NullPointer Exception with BEA Weblogic Server 6.1 SP6 (in SP 4 it works
              fine)
              > and in 8.1 SP2.
              >
              > The J2EE Spec allowes to use setAttribute("xy", null) and it should be
              handled
              > in the same way like caling removeAttribute("xy").
              >
              >
              > 11:19:37,573 ERROR (AdministrationConstantReloadTab.java:101) - Fehler
              beim Anzeigen
              > des AdministrationAntragReloadTabs
              > java.lang.NullPointerException
              > at java.util.Hashtable.put(Hashtable.java:389)
              > at
              weblogic.servlet.internal.WebAppServletContext.setAttribute(WebAppServletCon
              text.java:669)
              > at
              de.abc.elektra.administration.control.AdministrationConstantReloadTab.handle
              Action(AdministrationConstantReloadTab.java:90)
              > at
              de.abc.elektra.common.control.TabHandler$TabFormListener.formSubmitted(TabHa
              ndler.java:216)
              > at com.javelin.swinglets.SForm.processFormEvent(SForm.java:168)
              > at com.javelin.swinglets.SForm.processEvent(SForm.java:132)
              > at
              com.javelin.swinglets.SComponent.dispatchEvent(SComponent.java:1179)
              > at
              com.javelin.swinglets.ServletManager.handle(ServletManager.java:256)
              > at
              de.abc.elektra.common.control.WindowHandler.handleContext(WindowHandler.java
              :44)
              > at
              de.abc.elektra.common.control.Navigator.process(Navigator.java:239)
              > at
              de.abc.elektra.common.control.Navigator.doPost(Navigator.java:117)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > at weblogic.servlet.internal.ServletStubImpl$ServletInvocationActi
              on.run(ServletStubImpl.java:971)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :402)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :305)
              > at
              weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
              ebAppServletContext.java:6350)
              > at
              weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
              t.java:317)
              > at
              weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
              > at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:3635)
              > at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :2585)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              >
              >
              >
              http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#setAttribute(java.lang.String,
              > java.lang.Object)
              > --------------------------------------------------------
              >
              > javax.servlet
              > Interface ServletContext
              > setAttribute
              >
              > public void setAttribute(java.lang.String name,
              > java.lang.Object object)Binds an object to a
              given attribute
              > name in this servlet context. If the name specified is already used for an
              attribute,
              > this method will replace the attribute with the new to the new attribute.
              > If listeners are configured on the ServletContext the container notifies
              them
              > accordingly.
              >
              > If a null value is passed, the effect is the same as calling
              removeAttribute().
              >
              >
              > Attribute names should follow the same convention as package names. The
              Java
              > Servlet API specification reserves names matching java.*, javax.*, and
              sun.*.
              >
              > Parameters:
              > name - a String specifying the name of the attribute
              > object - an Object representing the attribute to be bound
              >
              >
              > It is not really a problem if you have the chance to quickly change your
              implementation
              > as you can use removeAttribute(String). But if there is a BEA employee
              reading
              > this, then that bug should be fixed in the upcoming Service Packs.
              >
              > Guido Reiff
              

  • Need to run a prog on 1.4 which is running on 1.5. .....using two hashtable

    hello,
    I've developed a program which is prefectly working on java 1.5.0 version.
    but when run on java1.4.0. it gives run time error in this code.
    first i'm getting error in second hashtable. put function where i'm using key as an integer.this is running on 1.5 version but have to change key as string on 1.4. but after that it is still not working properly.
    I want that when i clicked on open then it must show both file
    1. that have hdr extension
    2. that have same name as the corrseponding .hdr file but without extension.
    this program show desired result on 1.5 but on 1.4 it display only .hdr file.
    pls. help me regarding this .
    // class hdr file filter
    import java.io.File;
    import java.util.Hashtable;
    import java.util.Enumeration;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    public class hdrFileFilter extends FileFilter {
    private Hashtable filters = null;
    private Hashtable noextensionfilter = null;
    private String noextensionname=null;
    private String extensionname = null;
    private String description = null;
    private String fullDescription = null;
    private boolean useExtensionsInDescription = true;
    private String fname = null;
    public File noextensionarray[];
    int count=0;
    int counthdr=0;
    int i=0;     
         //all files are accepted.
    public hdrFileFilter()
         this.filters = new Hashtable();
         //Creates a file filter that accepts files with the given extension.
    public hdrFileFilter(String extension)
         this(extension,null);
         //Creates a file filter that accepts the given file type.
    public hdrFileFilter(String extension, String description)
         this();
         if(extension!=null)
         addExtension(extension);
         if(description!=null) setDescription(description);
         //Return true if this file should be shown in the directory pane,false if it shouldn't.
    public boolean accept(File f) {
         if(f != null) {
         if(f.isDirectory()) {
              return true;
         String extension = getExtension(f);
         if(extension != null && filters.get(getExtension(f)) != null)
              fname=f.getName();
              extensionname=fname.substring(0,fname.lastIndexOf('.'));
              counthdr+=1;
              return true;
         if(extension == null)
              noextensionfilter=new Hashtable(20);
              noextensionname=f.getName();          
              noextensionfilter.put(count,noextensionname);
              count=count + 1;
              if(noextensionfilter.get(count) == extensionname)
                   noextensionarray=new File[20];
                   noextensionarray=f
                   System.out.println("file:" +noextensionarray[i]);
                   i++;
                   return true;               
         return false;
         //Return the extension portion of the file's name .
    public String getExtension(File f)
              if(f != null)
                   String filename = f.getName();
                   int i = filename.lastIndexOf('.');
                   if(i>0 && i<filename.length()-1)
                        return filename.substring(i+1).toLowerCase();
              return null;
         //Adds a filetype "dot" extension to filter against.
    public void addExtension(String extension)
         if(filters == null)
         filters = new Hashtable(20);
         filters.put(extension.toLowerCase(), this);
         fullDescription = null;
    public String getDescription()
              if(fullDescription == null)
                   if(description == null || isExtensionListInDescription())
                        fullDescription = description==null ? "(" : description + " (";
                        // build the description from the extension list
                        Enumeration extensions = filters.keys();
                        if(extensions != null)
                             Object nn=extensions.nextElement();
                             fullDescription += "." + nn;     
                             while (extensions.hasMoreElements())
                                  fullDescription += ", ." + nn;
                        fullDescription += ")";
                   else
                        fullDescription = description;
              return fullDescription;
    public void setDescription(String description)
         this.description = description;
         fullDescription = null;
    public void setExtensionListInDescription(boolean b) {
         useExtensionsInDescription = b;
         fullDescription = null;
              public boolean isExtensionListInDescription()
              return useExtensionsInDescription;

    Might be fixable if you do something like
    javac -target 1.4
    Bytecodes are different in 1.5 and thus not backward compatible

  • Out put file is not genrated when calling xml reports from OAF page

    Dear all
    i am calling xml reports from OAF page
    the out put file is not generated
    i am writing this code
    public int tradingrequest(String quoid, String costoder,int orgid)
    try
    OADBTransaction tx = (OADBTransaction)getOADBTransaction();
    java.sql.Connection pConncection = tx.getJdbcConnection();
    ConcurrentRequest cr = new ConcurrentRequest(pConncection);
    String applnName =
    "XXCRM"; //Application that contains the concurrent program
    String cpName = "XXCRM_COSTSHEET"; //Concurrent program short name
    String cpDesc =
    "Trading Costsheet Report XXCRM"; // concurrent Program description
    Number orgid1=new Number(orgid);
    // Pass the Arguments using vector
    Vector cpArgs = new Vector();
    cpArgs.addElement(quoid);
    cpArgs.addElement(costoder);
    cpArgs.addElement(orgid1.toString());
    // Calling the Concurrent Program
    int requestId =
    cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs);
    tx.commit();
    System.out.println("Request ID is " + requestId);
    return requestId;
    } catch (RequestSubmissionException e)
    OAException oe = new OAException(e.getMessage());
    oe.setApplicationModule(this);
    throw oe;
    in controller i am writing this code
    OAMessageStyledTextBean y =
    (OAMessageStyledTextBean)webBean.findChildRecursive("quotationid");
    OAFormValueBean z =
    (OAFormValueBean)webBean.findChildRecursive("costorder");
    String quoid = y.getValue(pageContext).toString();
    String costorder = z.getValue(pageContext).toString();
    System.out.println("The quotation id and costing order are....." + quoid +
    " " + costorder);
    /*if click on run report button to run the report*/
    if ("Viewreport".equals(pageContext.getParameter(EVENT_PARAM)))
    if (tsflag.equals("Y"))
    int requestid = am.servicerequest(quoid, costorder, orgid);
    String url =
    "OA.jsp?akRegionCode=FNDCPREQUESTVIEWPAGE&akRegionApplicationId=0&retainAM=Y&addBreadCrumb=Y&REQUESTID=" +
    requestid;
    pageContext.setForwardURL(url, null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT, null,
    null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
    OAWebBeanConstants.IGNORE_MESSAGES);
    when i call the report from oaf page the request id is coming
    when i click on view output i am getting this message
    Error
    The concurrent request 7335031 did not create an output file.
    WHEN I GOTO FIND REQUESTS PAGE QUERY THIS REQUEST ID I AM GETTING THE OUTPUT IN XM FILE
    Regards
    Sreekanth

    java.io.FileNotFoundException: \..\..\..\xdoAqdFFZfuuJ051010_0628487460.fo (The system cannot find the path specified)
    MY CO code
    if("GenerateReport".equals(event))
    // Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
    DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
    try {
    // Hashtable hashtable = new Hashtable(1);
    // hashtable.put("TruckBookingRefNum",trucknum);
    // System.out.println("test"+trucknum);
    ServletOutputStream os = response.getOutputStream();
    // Set the Output Report File Name and Content Type
    String contentDisposition = "attachment;filename=LF Cargo Summary Report.htm";
    response.setHeader("Content-Disposition",contentDisposition);
    response.setContentType("application/HTML");
    // Get the Data XML File as the XMLNode
    XMLNode xmlNode = (XMLNode) am.invokeMethod("getTestDataXML");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    xmlNode.print(outputStream);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();
    System.out.println(" ByteArrayInputStream.ByteArrayOutputStream"+pdfFile+inputStream);
    //Generate the PDF Report.
    TemplateHelper.processTemplate(
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
    "LFCUST",
    "XXLFCARSUM_TARGET",
    "English",//((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
    "US",//((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
    inputStream,
    TemplateHelper.OUTPUT_TYPE_HTML,
    null,
    pdfFile);
    // hashtable);
    System.out.println(" TemplateHelper");
    // Write the PDF Report to the HttpServletResponse object and flush.
    byte[] b = pdfFile.toByteArray();
    System.out.println(" byte"+b);
    response.setContentLength(b.length);
    os.write(b, 0, b.length);
    os.flush();
    os.close();
    pdfFile.flush();
    pdfFile.close();
    catch(Exception e)
    System.out.println(" inside catch");
    response.setContentType("text/html");
    throw new OAException(e.getMessage(), OAException.ERROR);
    pageContext.setDocumentRendered(true);
    Edited by: user9367919 on May 13, 2010 10:31 AM

  • Shopping cart!! Retriving values from Hashtable?

    Hi,
    Could you please help me solve this problem?
    I am adding some values to the Hashtable. For every time I add the server is definitely showing
    me that some thing is added to the Hashtable. But when I try to print the values present in
    Hashtable, I do not see any thing on the browser other than "table headers" ? Can any one help
    me?
    Here are the codes
    ShopBean.java
    import java.util.*;
    import java.lang.*;
    public class ShopBean
         private Hashtable hashtable = new Hashtable();
         public ShopBean()
         public void addToCart(String itemid,String name,float price,int quantity)
              String[] items = {itemid,name,Float.toString(price),Integer.toString(quantity)};
              if(hashtable.containsKey(itemid))
                   String[] tmpItem = (String[])hashtable.get(itemid);     
                   int tmpQuantity = Integer.parseInt(tmpItem[3]);
                   quantity += tmpQuantity;
                   tmpItem[3] = Integer.toString(quantity);
              else
                   hashtable.put(itemid,items);
         public Enumeration getEnumeration()
              return hashtable.elements();
    Tibre.java
    public class Tibre extends HttpServlet
         String user,s1,s2,s3,s4,s5,s6,s7,prev,next,flag;
         int i,count=0,i1,i2,i3,i4,records=0,from,to,no,rem,k,c;
         public void doGet(HttpServletRequest req,HttpServletResponse res)
              doPost(req,res);
         public void doPost(HttpServletRequest req,HttpServletResponse res)
              try
                   ServletOutputStream sos = res.getOutputStream();
                   HttpSession ses = req.getSession(true);
                   user=(String)ses.getValue("user");
                   ShopBean cart = new ShopBean();
                   String id = req.getParameter("id");
                   if(id != null)
                        String name = req.getParameter("name");
                        Float price = new Float(req.getParameter("price"));
                        cart.addToCart(id,name,price.floatValue(),1);
                        System.out.println("cart values in tibre.java"+cart);
                   sos.println("<html>");
                   sos.println("<body bgcolor=lightyellow>");
                   sos.println("<p>Welcome to Online shopping "+user+" , Please see the
    gallery of items.</p>");
                   sos.println("<table border='1' cellspacing='1' width='41%'
    cellpadding='2' id='AutoNumber1'>");
                   sos.println("<tr>");
                        sos.println("<td width='21%'>");
                        sos.println("<img border='0' src='images/11.gif' width='120'
    height='150'>   ");
                        sos.println("</td>");
                        sos.println("<td width='79%'>");
                        sos.println("<img border='0' src='images/22.gif' width='120'
    height='150'></td>");
                   sos.println("</tr>");
                   sos.println("<tr>");
                   sos.println("<form method='post'
    action='http://localhost:8080/servlet/Tibre'>");
                        sos.println("<td width='21%'>$300 <input type=submit value='Add
    to Cart' name=tibre1>");
                        sos.println("</td>");
                        sos.println("<input type='hidden' value='100' name='id'>");
                        sos.println("<input type='hidden' value='Tibre' name='name'>");
                        sos.println("<input type='hidden' value='300.89' name='price'>");
                        res.sendRedirect("http://localhost:8080/servlet/Tibre");
                        sos.println("</form>");
                        sos.println("<form method='post'
    action='http://localhost:8080/servlet/Tibre'>");
                        sos.println("<td width='79%'>$800.99 <input type=submit
    value='Add to Cart' name=tibre2>");
                        sos.println("</td>");
                        sos.println("<input type='hidden' value='200' name='id'>");
                        sos.println("<input type='hidden' value='Compaq' name='name'>");
                        sos.println("<input type='hidden' value='800.99' name='price'>");
                        res.sendRedirect("http://localhost:8080/servlet/Tibre");
                        sos.println("</form>");
                   sos.println("</tr>");
                   sos.println("</table>");
                   sos.println("<a href='http://localhost:8080/servlet/ViewCart'>View
    Cart</a>");
                   sos.println("</body>");
                   sos.println("</html>");
              catch(Exception e)
                   e.printStackTrace();
    ViewCart.java // When I click viewcart I should display the contents from the hashtable
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class ViewCart extends HttpServlet
         public void doGet(HttpServletRequest req,HttpServletResponse res)
              try
                   ServletOutputStream sos = res.getOutputStream();
                   ShopBean cart = new ShopBean();
                   sos.println("<html><head>");
                   sos.println("<title> Shopping Cart Contents</title>");
                   sos.println("</head>");
                   sos.println("<body bgcolor=lightyellow>");
                   sos.println("<table border='1' width='300' cellspacing='0'
    cellpadding='2' align='center'>");
                   sos.println("<caption><b>Shopping cart contents</b></caption>");
    sos.println("<tr><th>description</th><th>Price</th><th>Quantity</th></tr>");
                   Enumeration enum=cart.getEnumeration();
                   String[] tmpItem;
                   while(enum.hasMoreElements())
                        tmpItem=(String[])enum.nextElement();
                        sos.println("<tr>");
                        sos.println("<td>"+tmpItem[1]+"</td>");
                        sos.println("<td align='center'>"+tmpItem[2]+"</td>");
                        sos.println("<td align='center'>"+tmpItem[3]+"</td></tr>");
                   sos.println("</table>");
                   sos.println("</center>");
                   sos.println("<a     href='http://localhost:8080/servlet/Tibre'>Back to
    Catalog</a>");
                   sos.println("</body>");
                   sos.println("</html>");
              catch(Exception e)
                   e.printStackTrace();
    Also please correct me if there are any mistakes in my code.
    Thanks for any help
    Uma

    Few errors,
    1.Your 'addToCart' method in the bean will not work as you are thinking. Try to find out the reason by yourself.
    2.ShopBean cart = new ShopBean(); in your ViewCart servlet gives you a fresh bean with a blank hashtable. Obviously it will not contain any items and hence you are not getting them displayed in the browser. Again you need to find out the error, I can give you a clue, Insert an item in the bean's constructor and test your code.
    3.You need to carry the information between your servlets, session is the best thing to use. So, your bean's scope must be session.
    Try to solve it by yourself, this forum will always be there to guide you.
    Hope this helps.
    Sudha

  • Bug in code HELP!!! please

    When i put a term that isnt in my dictionary it says it isnt in dictionary which is what i want it to do but when i type one that works and it asks to do another one and i click yes or no it says it cant be found, and i cant find what i did wrong.
    dont mind my language in the code, =o
    import javax.swing.JOptionPane;
    public class InternetTranslater
         public static void main(String [] args)
              String[] Slang = {"lol","lmao","lmfao","rofl","roflmfao",
              "imo","oic","joo","pwn","pwns","owned","ttyl","brb",
              "gtg","g2g","lvl","IM","omg"};
              String[] Real = {"Laugh out Loud","Laugh my ass off",
              "Laughing my fucking ass off","Rolling on floor laughing",
              "Rolling on floor laughing my fucking ass off",
              "in my opinion","oh i see","You","Better than","Very awsome",
              "Severly beaten","Talk to you later","Be right Back",
              "Got to go","Good too go","level","Instant Message","oh my god"};
              String Term;
              int o = 1;
              JOptionPane.showMessageDialog(null,
              "This program is easy to use.","Start",
              JOptionPane.INFORMATION_MESSAGE);
              while(o == 1){
              Term = JOptionPane.showInputDialog("Please enter the chat term");
              for(int i=0;i<18;++i)
                   if(Term.equalsIgnoreCase(Slang))
                        JOptionPane.showMessageDialog(null,
                        Real[i],"Chat",
                        JOptionPane.INFORMATION_MESSAGE);
                        int p;
                        Object[] options = { "YES", "NO" };
                        p = JOptionPane.showOptionDialog(null,
                        "Click YES to do another",
                        "Warning", JOptionPane.DEFAULT_OPTION,
                        JOptionPane.WARNING_MESSAGE,
                        null, options, options[0]);
                        if(p == 0)
                             o = 1;
                        else
                             o = 0;
                        i = 0;          
                   if(i == 17)
                        JOptionPane.showMessageDialog(null,
                        "Term not found in the dictionary","Chat",
                        JOptionPane.ERROR_MESSAGE);
                        o = 1;
              System.exit(0);     

    You need to improve on:
    -not using magic numbers (e.g. replace 18 with slang.length)
    -using Java naming conventions (e.g. slang not Slang)
    -using useful classes such as Hashtable
    import javax.swing.JOptionPane;
    import java.util.Hashtable;
    public class InternetTranslator
         public static void main(String [] args)
              String[] slang = {"lol","lmao","lmfao","rofl","roflmfao",
              "imo","oic","joo","pwn","pwns","owned","ttyl","brb",
              "gtg","g2g","lvl","IM","omg"};
              String[] real = {"Laugh out Loud","Laugh my ass off",
              "Laughing my ******* ass off","Rolling on floor laughing",
              "Rolling on floor laughing my ******* ass off",
              "in my opinion","oh i see","You","Better than","Very awsome",
              "Severly beaten","Talk to you later","Be right Back",
              "Got to go","Good too go","level","Instant Message","oh my god"};
              Hashtable hashtable = new Hashtable();
              if (slang.length != real.length)
                   throw new RuntimeException("oops, my arrays don't match");
              for (int i = 0; i < slang.length; i++)
                   hashtable.put(slang.toLowerCase(), real[i]);
              //JOptionPane.showMessageDialog(null,
              //"This program is easy to use.","Start",
              //JOptionPane.INFORMATION_MESSAGE);
              while (true) {
                   Object o = JOptionPane.showInputDialog("<html>Please enter the chat term:<br>(press cancel to stop)</html>");
                   if (o == JOptionPane.UNINITIALIZED_VALUE || o == null)
                        break;
                   String s = o.toString().trim().toLowerCase();
                   String r = (String) hashtable.get(s);
                   if (r != null)
                        JOptionPane.showMessageDialog(null, "The full expression is: " + r, "Result", JOptionPane.INFORMATION_MESSAGE);
                   else
                        JOptionPane.showMessageDialog(null, "Expression not found!", "Uh-Oh!", JOptionPane.ERROR_MESSAGE);
              System.exit(0);

  • Eyedropper: Bug or Feature

    This seems like bug:
    When i put something in group and want to sample it with eyedropper tool with: "All layers exlude Adjustment layer" sampling isn't avalaible, video HERE

    yeah, that does not seem right to me.
    If I put an Adjustment Layer above the Group, eyedropper seams to work as expected. But  even with adjustment layer in Group, it does not work like I think it should . Does not seem to matter if Group blend is set to Normal or Pass Through.
    Maybe someone from Adobe can comment on expected behavior for the new Eyedropper settings in CS6.

  • Apex. calendar es_es bug

    Hello,
    I'm not a parter of Oracle and I don't know how to report a bug so i put this here.
    After spending 5 hours on it I won't give more time to it.
    I've found a bug.
    Steps:
    put the locale to es_es en the web browser.
    create a page based on a calendar.
    Access to the calendar object and without changing anything press aplicar cambios (save changes).
    Be sure nobody is changing the object at the same time and repeat the last step.
    If the locale is changed to en-us the problem is solved.
    Occurs on Apex 4.0.*
    Salut!

    Hi,
    I am able to reproduce to the issue. Please confirm the following steps to recreate is correct and also the error message which you should have seen
    1. Create a Calendar Page
    2. Change the Browser Language to Spanish [es-es]
    3. Goto Edit Page View
    4. edit the Calendar Region
    5. Click on Calendar Attributes and Click on Apply Changes button without making any changes.
    6. Throws the following error.
    ORA-20503: La versión actual de los datos de la base de datos ha cambiado desde que el usuario inició el proceso de actualización. total de control actual = "E32276E3A51E08AD9612CC159B97E66D" total de control de la aplicación = "F3BC70FA0AB99968AAC29DD5A4D8056F"
    No se ha podido procesar la fila de la tabla WWV_FLOW_CALS.
    Volver a la Aplicación
    Is the steps to recreate is right ? and also is this the error which you are getting ?
    Thanks
    JS

  • Records Retreiving In Hashtable

    I got problem regarding hashtable..
    Actually i wrote a query which gets all results in descending order and i am putting these values in to Hashtable .while Enumerating(retreiving) i am not getting the records orderly as i had set in Hashtable.
    Could you please tell anybody what is the problem ?
    for this i used following code :
    import java.util.* ;
    import java.sql.* ;
    public class HashTest {
         public static void main(String args[]) throws Exception {
              String str ;
              Hashtable hashtable = new Hashtable() ;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection conn = DriverManager.getConnection("jdbc:odbc:datasourcename","userid","password");
              Statement stmt = conn.createStatement();
              String query = "select to_number(rtrim(ltrim(id))) , name from users order by 1 desc" ;
              ResultSet rset = stmt.executeQuery(query);
              while(rset.next()) {
                   hashtable.put(rset.getString(1),rset.getString("name"));
              Enumeration enum = hashtable.keys() ;
              while(enum.hasMoreElements()) {
                   str = (String)enum.nextElement();          
                   System.out.println(str + " : " + hashtable.get(str));

    There is a very good reason for this. There is no ordering in a Hashtable, so there is no way for the enumeration to know the order as it is not maintained. In any case there is no guarantee that an enumeration will respect the ordering even if there was one.
    Sorry I couldn't be more help.
    PS. I noticed you posted this three times, I assume by mistake as they are posted within a few minutes of each other but be more careful in the future.

  • Session object question put vs. putValue vs. setAttribute?

    I have the following code:
    <%@ page import="java.util.*" %>
    <jsp:useBean id="EducationBean" class="java.util.Hashtable" scope="session" />
    <%
    String swCurrFileName = "swcontrol.jsp";
    Enumeration params = request.getParameterNames();
    while (params.hasMoreElements()) {
         String name = (String)params.nextElement();
         EducationBean.put(name, request.getParameter(name));
    %>
    My question is I can't find any documentation on the put command, whats the difference between 'put', and 'putValue', and 'setAttribute'? When I try using the 'putValue' or 'setAttribute' command I get errors.
    What I'm trying to do is store form values in a session object across several pages, and on the last page display all the form values from the previous pages.

    the object you are calling put on is a java.util.Hashtable. put places an object into the table to be keyed off of another object. In your case, your key is the variable name and the object to be stored is your parameter from that name.
    the putValue and setAttribute are methods on the session object. They both do the same action as above, but are for HttpSession objects. putValue is deprecated and you should be using setAttribute, but most WebServers have putValue() pointing to the setAttribute() method. hope this helps.

Maybe you are looking for

  • Mail Backup and Address Book Sync w/o .Mac

    Two part post, I apologize if this is confusing. 1. Is there a clean way to back up Apple Mail? It would be nice to be able to have text/RTF accessible documents - but even just a mbox format would suffice. 2. Currently to share an Address Book group

  • Reading words from a text file

    I have written code to store words in a text file. they appear in the text file as shown below. word1 word2 word3 etc. I want to read each word individually and store them in an array. Im trying to do it using a BufferedReader but it doesn't seem to

  • ... how can i use 'enter' in java (text) -.-

    Hi all, first the simple version; How can i use 'enter' in java. Like turn HELLO into H E L L O The not so simpler version IF needed; I have the following piece of code;' if (line.startsWith("Monday")) {      String subjectsMonday = " math and philos

  • CRM Webclient 2007 CookBook

    Hi, Can someone please tell me when can I find a Cookbook or a training Material for CRM Webclient 2007? Thanks, Chaith.

  • Error in printing

    Okay, just installed HP Laserjet P1505 and received the confirmation print out "congratulations, you have just installed your printer correct".. But everytime I try to print, it keeps queing the prints up, and comes out saying there is a problem. Whe