TreeSet bug? Please take a look.

I just got back from a programming competition. I'm very frustrated because I wrote what seems to be correct code for one of the problems, but I'm getting very strange results. After the competition I showed the code to several people and no one could figure out what's wrong with it. I'd like to know if it's a bug in Java 1.4.2_05 or my fault. Here's the problem:
You are given a file with a list of names of songs in it. For each song you find, you must increment it's popularity, it is also case insensitive. So if you find "oh yeah" and "oH YEah", that song has a popularity of 2. Finally you must display the top five most popular songs.
Here is the input file (songs.in):
ACM ROX
syzygy
123
thisisasong5
myfavoritesong
ACM ROX
SYZYGY
123
thisisasong5
ACM ROX
sYzYgY
123
Acm Rox
syzygy
ACM ROxAnd here is my code:
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Comparator;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileReader;
import java.io.File;
public class Songs {
     private static final String file = "songs.in";
     TreeSet songs;
     public static void main(String[] args) {
          new Songs();
     public Songs() {
          songs = new TreeSet(new CompareSongs());
          try {
               BufferedReader in = new BufferedReader(new FileReader(file));
               String aSong;
               int asdf = 0; // just for debugging; ignore this variable
               while ((aSong = in.readLine()) != null) {
                    asdf++;
                    Iterator i = songs.iterator();
                    boolean foundSong = false;
                    while (i.hasNext()) {
                         Song song = (Song)i.next();
                         System.out.println("Loop "+asdf+": "+song.name);
                         if (song.name.equalsIgnoreCase(aSong)) {
                              System.out.println("already have "+song.name);
                              song.popularity++;
                              foundSong = true;
                    if (foundSong == false) {
                         Song song1 = new Song(aSong);
                         song1.popularity++;
                         songs.add(song1);
                         System.out.println("Added song "+aSong);
               try {
                    for (int i=0; i<5; i++) {
                         Song song2 = (Song)songs.last();
                         System.out.println(song2.name + " "+song2.popularity);
                         songs.remove(song2);
               } catch (NoSuchElementException e) {
                    System.out.println("finish");
          } catch (IOException e) {
               e.printStackTrace();
               System.exit(-1);
     private class CompareSongs implements Comparator {
          public int compare(Object o1, Object o2) {
               if (((Song)o1).popularity > ((Song)o2).popularity) {
                    return 1;
               } else if (((Song)o1).popularity < ((Song)o2).popularity) {
                    return -1;
               } else {
                    return 0;
     private class Song {
          public int popularity=0;
          public String name;
          public Song(String name) {
               popularity = 0;
               this.name = name;
          public boolean equals(Object o) {
               if (this.name.equalsIgnoreCase(((Song)o).name))
                    return true;
               else
                    return false;
}The result from running this code is describe as follows: At first it will add the song to the TreeSet correctly, and the next time around it'll correctly show that there is one Song in the TreeSet. However, as more songs are added, the amount of songs returned by the Iterator remains only 1. It then says for a while that there are only two songs (when there should be a lot more), and sometimes it will actually decrease in the amount of Songs returned! (It will iterate through 3 songs, and then drop down to 1 song in the next loop around).
Any help figuring out what's going on is greatly appreciated!

It's not a bug in TreeSet. Lots of code uses TreeSet and works just as it should (with respect to the Set). Given a wild guess I would suppose you are modifying your Objects WHILE THEY ARE IN THE SORTED SET, thus making them unsorted and basically unfindable later. I would suggest (for a quick fix) taking the Songs out of the Tree, incrementing the popularity, and reinserting them. As a long term fix I suggest you Map names to popularities (or songs) and then finding the best ones afterward.
~Cheers

Similar Messages

  • Can you please take a look at my TM Buddy log and opine on what the problem is?

    Pondini,
    Can you please take a look at my TM Buddy log and opine on what the problem is?  I'm stuck in the "Preparing Backup" phase for what must be hours now.  My last successful backup was this morning at 7:16 am.  I did do a series of Software Update this morning, one of which, a security update I believe, required a restart.
    I'm confused as to what the issue is, and how to get everything back to "it just works".
    Many thanks in advance.
    Starting standard backup
    Backing up to: /Volumes/JDub's Drop Zone/Backups.backupdb
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotState path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Error: (5) getxattr for key:com.apple.backupd.SnapshotContainer path:/Volumes/JDub's Drop Zone/Backups.backupdb/Jason Wisniowski’s iMac/2013-05-30-002104
    Event store UUIDs don't match for volume: Area 420
    Event store UUIDs don't match for volume: Macintosh HD
    Error: (5) getxattr for key:com.apple.backupd.SnapshotSt

    Time Machine can't read some data it needs from your backups (each of those date-stamps is one of your backups). 
    That's usually a problem with the drive itself, but could be the directory on it. First be sure all plugs are snug and secure, then see if you can repair it, per #A5 in Time Machine - Troubleshooting. 
    If that doesn't help, post back with the results.  Also either tell us what kind of Mac you have, what version of OSX you're running, or post that to your Profile, so it's accessible.  
    This is unrelated to the original post here, so I'm going to ask the Hosts to split it off into a new thread.  Since you've posted in the Lion forum, I'll assume that's what you're running.  You should get a notice from them

  • Please take a look at this. Attempting to make a professional brochure/bound 5-page presentation.

    Please take a look at this template I made for a Statement of Qualifications pamphlet.
    Here is a link to google drive. I made this template from scratch in Photoshop CS6.
    SOQ Page_Blank(no lettering).pdf - Google Drive
    What I am curious about, is that some of the lettering often looks blurry, although the page is 500pixels per inch 8.5x11, 76MB .psd file. What can I do about that?
    Also, I want to make it easy to write and edit the actual content that will go onto the page. Not all of us here have photoshop to edit the lettering. Is there a way I can export this to word so they can edit the content whenever? Are there better options (programs) to help me design this template? I am guessing I am somewhat pushing photoshops limit as to making a bound 5-page presentation. I am stuck and would like this to be easier. All suggestions for both of my questions as well as overall action toward making this would be great.
    Here is an example of a SOQ Pamphlet that I have been using as reference. In my eyes the design is perfect!
    http://www.ch2m.com/corporate/markets/environmental/conferences/setac-2013/assets/CH2M-HIL L-land-conservation-restoratio…
    Any help is great,
    Thanks,
    Adam

    Since photoshop can not do pages, your on the right track by using pdf format. Since it can do pages, but really requires acrobat pro to bind the pages together.
    Your best bet is InDesign then Illustrator would be the next option. Each of these can do multi page documents.
    There is absolutely no reason to use 500px/inch for the resolution anything between 150 and 300 would suffice leaning towards 300ppi.
    If the text is blurred a few things that can cause that, 1) anti-aliasing 2) document was created as a low resolution then upsampled 3) text is rasterized 4) document is rasterized.

  • TS1292 Hi, can you please take a look at my account and why its asking me to contact support. I have my billing address correct and everything but for some reason its not letting me to authorize my transaction

    Hi, can you please take a look at my account and why its asking me to contact support. I have my billing address correct and everything but for some reason its not letting me to authorize my transaction

    We are all fellow users here and have no way of accessing your account information; iTunes Store employees do not participate in these forums. You will need to do what it says, contact iTunes Support. Go here:
    http://www.apple.com/emea/support/itunes/contact.html
    to contact the iTunes Store.
    Regards.

  • Workaround for some W510 Audio Problems. Lenovo, please take a look at this!

    Hi all
    I believe most or all of the people are affected with poor sound quality of W510. I do believe there are some people who bring their laptops along and not convenient to get a external sound card and external speakers on the road. I am not too sure, but what I think that causes audio problem in W510, T410 or T510 is due to the implementations of Combo Audio/Mic Jack. So far, I have not heard any audio problems from X201 or W701/W701ds with a separate mic and audio jack (1 green and red, instead of 1 combo) Listed machines are using Conexant 20585 SmartAudio HD Sound Card.
    The workaround is to force install Conexant 20561 SmartAudio HD Driver through Device Manager
    http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-73721
    Problem Partially Resolved
    1. Using Audio Director - Classic mode enables you to use both internal speakers and external speakers/headphone simultaneously. (By right, this should be in Multi-Stream mode, due to this driver not programmed for W510). However, the volume of the internal speaker will be reduced by half if an external speakers/headphone is plugged.
    2. The sound quality is improved (tested with internal speakers).
    3. Solved Irregular Volume Problems.
    Drawback of using this driver
    1. Using Multi-Stream mode in this case would not enables you to use both internal speakers and external speakers/headphone simultaneously. However it would just make your internal speaker to be louder. External speaker/headphone would not work if Multi-Stream mode is selected.
    2. Custom EQ is not usable, if used, only the right channel of internal speaker, external speaker/headphone would work, and the sound quality will be like a spoilt radio.
    3. Only Voice (VoIP) EQ is optimized for external speaker/headphone. Using Off, Jazz, Dance or Concert EQ would make you feel that the vocal (singer's voice) is diffused, blurred like excessive 3D effects.
    4. Even if any preloaded EQ is selected, after system has been restarted, the selected EQ would still be saved, but the band (31Hz - 16KHz would be changed back to Off EQ) It is ok as it just affects the graphics, not the sound.
    I know that Forum Administrators, Lenovo Staff, Community Moderators, Gurus and Volunteered Moderators/Users would be surfing around and looking for new post. Please take a look and leave a post or PM to me, thank you very much.
    It is alright if Lenovo don't think that there is any problems regarding the sound in W510. However, I do believe most users/owners of W510 would appreciate if the sound system could be further improved through a better driver or new revision of hardware to something like a T400 standards or something. Some users would spent so much $ just to get all-in-a-box solution and would not want to invest further just for a external card to sacrifice portability and use more $. Finally, I still do believe that W510 audio problems can be resolved.
    Best Regards
    Peter

    Hi ckhordiasma
    Thanks for reviving ths old thread. How about trying Dolby drivers? It sounds great and could possibly resolve those issues without going through too much troubleshooting.
    The link is under my signature.
    Hope it helps!
    Happy 2012! 
    Peter
    W520 (4284-A99)
    Does someone’s post help you? Give them kudos as a reward, as they will do better to improve | Mark it as solved if the solution works for you, so it could be reference for others in the future 
    =====================================
    Sound Enthusiast and Enhancement (Post comments, share mixes, etc.)
    http://forums.lenovo.com/t5/General-Discussion/Dolby-Home-Theater-v4-for-most-Lenovo-Laptops/td-p/62...

  • Mods. Please take a look at this topic

    Hi,
    Please take a look at this topic:
    http://discussions.apple.com/thread.jspa?threadID=422678&tstart=0
    It's becoming 'unfriendly'
    Thanks.
    M

    Hi Kady,
    Thanks for putting the inappropriate parts in the 'Trash'
    M

  • Someone please take a look at this

    Please take a look at this.
    This is my jsp file:
    <%@ page import="java.sql.*" %>
    <%
    String url="jdbc:mysql://localhost/ali";
    String user="root";
    String password="";
    Connection conn=null;
    String classPath="com.mysql.jdbc.Driver";
    try{
         Class.forName(classPath);
         conn = DriverManager.getConnection(url,user,password);
         }catch(Exception exc){
         out.println(exc.toString());
    %>
    <%
         Statement stm=conn.createStatement();
         String update="CREATE TABLE product(id varchar(20) PRIMARY KEY, name char(20))";
         try{
              stm.executeUpdate(update);
              out.println("Successful")
         }catch(Exception exc){
              out.println("sorry loser!!");
         stm.close();
         conn.close();
    %>
    but when I try opening it up in tomcat i get this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 16 in the jsp file: /mytest/createTable.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /usr/java/jakarta-tomcat-4.1.31/work/Standalone/localhost/_/mytest/createTable_jsp.java:64: ';' expected
         }catch(Exception exc){
    ^
    1 error
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)

    i've repaired that one already but now i get this.Please....Help me.
    org.apache.jasper.JasperException
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.NullPointerException
         at org.apache.jsp.createTable_jsp._jspService(createTable_jsp.java:60)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)

  • CSS - Please take a look

    Hey there,
    I am just drafting a web site and I ran into a CSS issue...
    Please take a look here:
    URL:
    http://anuragdesign.com/vitaminx/layouttest.php
    In FF the float of the content / sidebar works
    In IE7 beta it works as well
    BUT in IE6 it doesn't.
    Any idea why ?
    I can't seem to be able to locate it
    Thanks in advance,
    Anurag

    The IE6 box model is to standard. It's IE5x you have to worry
    about.
    > IE 6 adds together the size of the element, the margin
    and the padding.
    > That
    > is, the padding and margin make the element bigger, in
    essence. The
    > standard
    > says that the size of the padding and margin are part of
    the size of the
    > element.
    The two sentences are the same. But the standard says that
    padding and
    border are part of the element's size.
    > So I think the content area is flowing below the sidebar
    because the
    > combined
    > size is greater than the containing area...but only in
    IE6 because of the
    > box
    > model issue.
    On a page with a valid and complete doctype, you will not
    have a box model
    problem with IE6. Its standards mode gets the box model
    right.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "DLoe" <[email protected]> wrote in message
    news:eb0p0j$59t$[email protected]..
    > This could have something to do with the IE 6 box model,
    which isn't to
    > standard.
    >
    > IE 6 adds together the size of the element, the margin
    and the padding.
    > That
    > is, the padding and margin make the element bigger, in
    essence. The
    > standard
    > says that the size of the padding and margin are part of
    the size of the
    > element.
    >
    > So I think the content area is flowing below the sidebar
    because the
    > combined
    > size is greater than the containing area...but only in
    IE6 because of the
    > box
    > model issue.
    >
    >

  • An exciting question, please take a look

    This question is actually not quite exciting, but since you are here, please take a look. thank you.
    I have a question as following: I have three classes, Panel1, Panel2, and PanelPrimary, all 3 extends JPanel. Panel1 and Panel2 both have a JButton, button1 and button2 respectively. PanelPrimary has a CardLayout. In PanelPrimary, I created a Panel1 and a Panel2 and added them to PanelPrimary as the cards because i'm using CardLayout.
    I want to click on button1 so that PanelPrimary shows Panel2, and click on button2 so that PanelPrimary shows Panel1.
    But I dont know how to access PanelPrimary in Panel1 and Panel 2.
    here's what i get so far:
    public class Panel1 extends JPanel
    private JButton button;
    public Panel1()
    button=new JButton();
    button.addActionListener(new BListener())
    private class Blistener implements ActionListener
    public void actionPerformed(ActionEvent e)
    //Here's the code I dont know how to write
    class Panel2 is same as Panel1 except the actionPerformed part.
    public class PanelPrimary
    //i'm not very sure about how to write this class
    thanks for reading

    This question is actually not quite exciting, but
    since you are here, please take a look. thank you.This approach working out for you? Usually a title which actually describes your problem gets the better responses.
    And to "do tabs", you put your code within [ code ] tags (there's even a button for it).

  • Please take a look here: a lot of picture's from the Mac Pro and Upgrades.

    Just like any other Mac Pro owner, i'am really happy with it!
    Please take a look at my site: http://mac.powerbras.nl
    This is the first site i have ever made (on a Mac) so i hope you will like it!
    Before i had my Mac Pro i would really like too see a little more from the inside. But there where just a few site's with some small pictures. Now i made this site with some high resolution pictures so everyone can see the inside off the Mac Pro and how perfect it is!
    Also you can find the Xbench results from my configuration and all the Apple System Profiler specifications
    Please take a look, you will like it. Especially when you have no Mac Pro!

    Anne,
    Great job on the site.
    There are a number of third party templates available for iWeb that, with some creativity, can yield a site that looks nothing like the template-based norm. An example of one such site, "The Camera Obscura", a site created in iWeb and hosted on .Mac, demonstrates very well the limitless capabilities of iWeb. Some post-publishing html editing has been done on Obscura, but is easily accomplished with the right tools.
    Additional iWeb templates and other tools that support this great application can be found in The iWeb Tool Chest.
    Keep up the great work on your site!
    Mark

  • PieroF - Can you please take a look at M.Mantovani's RT problem?

    Hi Piero.
    M.Mantovani seems to be having problems with FCE 3.5 on his MBP.
    I suspect he is new to FCE. As a fellow countryman and expert with FCE I think you would probably be his best helper.
    Could you take a look at his problems please as I have run out of ideas!
    http://discussions.apple.com/thread.jspa?threadID=570466&tstart=0
    Ian.

    Hi Ian,
    even though too late, I answered the post you pointed to.
    Piero

  • Weird behaviour of getText() ...!!!! PLEASE TAKE A LOOK!!

    Hi.
    my problem is that i have two forms named JF_ChangeAP and DisplayTree. Suppose that JF_ChangeAP has two string variables named XMLFile and ElementDesired... I try to set the value of these two variables from the form DisplayTree(after i've created an JF_ChangeAP object,of course)... Take a look at the following code :
    CODE THAT WORKS:
    ShowAncestorsFrm.XMLFile=this.txtFilePath.getText();
    ShowAncestorsFrm.ElementDesired="Logistics_person";
    CODE THAT DOESN'T WORK:
    ShowAncestorsFrm.XMLFile=this.txtFilePath.getText();
    ShowAncestorsFrm.ElementDesired=this.txtElementDesired.getText();
    (ALTHOUGH I TYPE Logistics_person in the TextField!!!!!)
    I am going crazy...!!!!!!!!!!!!!!!!!!!!!!
    When i debug the value of the ElementDesired in the JF_ChangeAP object is Logistics_person!!!! But it does not work! ! ! ! ! ! ! ! ! ! .......WHY??!?!?!?!?!?!?
    Thnx in advance Guys.!

    your code convetion is arkward..it's hard to tell what is a class and what is an object. you should try not to declar your variable public
    MyClass.myVariable = ""; is not a good idea..and not object oriented (you broke encapsulation)
    since your listing is vague and confussing, i can't really hel you debug your problem. although i'm thinking it's a reference problem..check to make sure you have pass in the correct reference..etc.
    also make sure you created the textfield correctly..
    for example:
    public class Form1 extends JFrame{
        private JTextField textField = new JTextField(10);
        public Form1(){
            JTextField textField = new JTextField(20); 
            // this is wrong..your textfield declared above is not the same one
            // as you add to the frame..so when you call this.textfield.getText(),
            // you are geting the text from the textfield of the instance..not this    
            // local one (which will be displaying in the Frame)
           this.getContentPane.add(textfield);
    }check to make sure the reference to the objects are correct.
    you should redesign your application: here is an example
    public void Form1{
        private JTextField txtFilePath = null;
        private JTextField txtElementDesired = null;
        public Form1(){
            final Form2 = new Form2();
            txtPath = new JTextField();
            txtElementDesired = new JTextField(10);
            JPanel panel1 = new JPanel();
            panel1.add(txtFilePath);
            panel1.add(txtElementDesired);
            JButton = new JButton("Submit");
            button.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e){
                    form2.setFilePath(txtFilePath.getText());
                    form2.setElementDesired(txtElementDesired.getText());
            JPanel panel2 = new JPanel();
            panel2.add(button);
            this.getContentPane.add(panel1, "Center");
            this.getContentPane.add(panel2, "Center");
        public String getFilePath(){ return txtFilePath.getText(); }
        public String getElementDesired(){ return txtElementDesired.getText(); }
    public class Form2{
        private String elementDesired = null;
        private String filePath = null;
        public void setFilePath(String filePath){
            this.filePath = filePath;
        public void setElementDesired(String elementDesired){
            this.elementDesired = elementDesired;
    }

  • Could anybody please take a look at a test video podcast?

    I'm able to load this into itunes using the advanced tab and download a test video podcast. It's a minute long and 2.6MB in size, and used the MOV>IPOD preset in QT7.
    If anybody could take a look at it and let me know that they can download it and view it on their ipod, I'd appreciate it. I'm also interested to know if the smaller titles are legible to you on your ipod.
    http://subversive-entertainment.com/feed.xml
    Thanks,
    TW

    bb

  • Bug in session manager. If you work for Sun, please take a look.

    While evaluating what it would take to transition from Iplanet 6 to Sun Webserver 6.1, I found a problem with the Sun Webserver's s1ws60 session managers. If the page is not explicitly flushed before ending, the session cookie JSESSIONID is never sent. So as long as the user continues to visit small pages, they keep getting new sessions (because they are never sent a session id, so the session manager creates a new one every time they visit). The session cookie is sent if larger pages are visited (the buffer is automatically flushes). The session cookie is also sent if out.flushBuffer() is explicitly called within the JSP. This problem was not present in IWS6.0.
    The problem has been tracked down to a combination of the code in com.iplanet.server.http.session.IWSSessionManager (found in the "plugins" directory) and the JSP's Java code generated by a component of the webserver (Catalina?). Under Iplanet, the code generated in the finally{} section of the JSP first flushed the buffer, then called releasePageContext. Under Sun Webserver, the code generated just calls releasePageContext without explicitly flushing the buffer before the call. When flushing the buffer for a non-committed response, the headers are first generated and sent, along with any cookies, including the session cookie. The server only sends the session cookie if, among other things, the session satisfies "_session.isNew()". The order of events in releasePageContext ensures that this is never true when used in combination with IWSSessionManager. I don't have the source code to verify this, but from experimentation I think this is the reason: Before the buffer is flushed, the session is saved by IWSSessionManager.update(session), which at line 498 calls "sn.unsetNew()". So the session is never isNew() when it gets around to sending the session cookie. This can be resolved by either adding an explicit buffer flush to the finally{} section of the JSP, or removing the unsetNew() call from IWSSessionManager. Since I don't know where the code that generates the JSP is (or if I can even change it), I ended up removing the sn.unsetNew() call from the update() function.
    Here's the code generated in the finally{} section using IWS6 and Sun Webserver:
    Iplanet 6
            } finally {
                if (out != null && (out instanceof org.apache.jasper.runtime.JspWriterImpl)) {
                    ((org.apache.jasper.runtime.JspWriterImpl) out).flushBuffer();
                if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
            }Sun Webserver
            } finally {
                _jspx_releaseTags(_jspx_curTag, null);
                if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
            }

    I posted a bug report on this.

  • I think I have got it! (Almost)...Please take a look.

    Hi - I am working on a homework assignment for my Java Programming class and I have already gotten some really good advice here. I am trying to create a program that allows me to Encode/Decode Morse Code and display the cipher text or plain text depending.
    I have created one base class MorseCode and have two derived classes EncodeApp and DecodeApp to illustrate the core functionality of the MorseCode class.
    I have used a variety of methods. Some directly from my own twisted little mind and others after receiving excellent instruction from some of you in this forum. (thanks)
    Essentially, I now have a couple of problems that I am having trouble solving.
    1. I cannot figure out how to test for the entry of invalid characters in the morse code part. I mean I do not know how to account for "." and "-" as opposed to looking for valid input with Character.isLetterOrDigit() or isWhiteSpace(). Help!
    2. I recieved some help earlier and did my research on HashMaps...of course this was very enlightening. So I basically followed the guidelines given by the instructions I received. But since I am an ethical person, and this is for school, I did not copy the code I received earlier. Now of course I have a bug. Essentially, when I use the Decode() method with the following input:
    ...<1 Space>---<1 Space>...<3 Spaces>...<1 Space>---<1 Space>... (where <Space> means hitting the spacebar on my keyboard) I should get output of SOS SOS but instead I get SOS SSOS...Why?
    I have included the code below:
    MorseCode.java
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.Arrays.*;
    import java.lang.Character.*;
    public class MorseCode extends Object
         //A-Z as elements of char array
         public static char arrayAlpha[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G',
         'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
         'W', 'X', 'Y', 'Z'};
         //A-Z in Morse Code Strings (0-25 indexes in alphabetical order)
         public static String arrayAlphaMorse [] = {".-", "-...","-.-.","-..",".",
         //0-9 as elements of char array
         public static char arrayNumb[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
         //0-9 in Morse Code Strings (0-9 indexes in numberical order beginning at 0)
         public static String arrayNumbMorse [] = {"-----", ".----", "..---", "...--", "....-",
         //All of the characters and numbers with corresponding MC as a hashmap
         public static HashMap cipherKey = new HashMap();
         //String to hold output
         private String output = "";
         public void Encode ( String s )
              char messageArray[];
              String messageIn = "";
              messageIn = s;
              messageArray = messageIn.toCharArray();
              for( int i = 0; i < messageArray.length; i++)
                   if(Character.isLetter(messageArray))
                   output += arrayAlphaMorse[Arrays.binarySearch(arrayAlpha, messageArray[i])] + " ";
              } else
                        if(Character.isDigit(messageArray[i]))
                             output += arrayNumbMorse[Arrays.binarySearch(arrayNumb, messageArray[i])] + " ";
                        } else
                             if(Character.isWhitespace(messageArray[i]))
                                  output += " ";
                             } else
                                  if(!(Character.isLetterOrDigit(messageArray[i])) && !(Character.isWhitespace(messageArray[i])))
                                       JOptionPane.showMessageDialog (null, "Unsupported Characters Entered. You may only use letters, numbers and spaces.","Message as Morse Code - System Message", JOptionPane.ERROR_MESSAGE );
              }//EndForLoop
         }//EOEncode
         public void Decode ( String s )
              cipherKey.put( ".-", "A" );
              cipherKey.put( "-...", "B" );
              cipherKey.put( "-.-.", "C" );
              cipherKey.put( "-..", "D" );
              cipherKey.put( ".", "E" );
              cipherKey.put( "..-.", "F" );
              cipherKey.put( "--.", "G" );
              cipherKey.put( "....", "H" );
              cipherKey.put( "..", "I" );
              cipherKey.put( ".---", "J" );
              cipherKey.put( "-.-", "K" );
              cipherKey.put( ".-..", "L" );
              cipherKey.put( "--", "M" );
              cipherKey.put( "-.", "N" );
              cipherKey.put( "---", "O" );
              cipherKey.put( ".--.", "P" );
              cipherKey.put( "--.-", "Q" );
              cipherKey.put( ".-.", "R" );
              cipherKey.put( "...", "S" );
              cipherKey.put( "-", "T" );
              cipherKey.put( "..-", "U" );
              cipherKey.put( "...-", "V" );
              cipherKey.put( ".--", "W" );
              cipherKey.put( "-..-", "X" );
              cipherKey.put( "-.--", "Y" );
              cipherKey.put( "--..", "Z" );
              cipherKey.put( "-----", "0" );
              cipherKey.put( ".----", "1" );
              cipherKey.put( "..---", "2" );
              cipherKey.put( "...--", "3" );
              cipherKey.put( "....-", "4" );
              cipherKey.put( ".....", "5" );
              cipherKey.put( "-....", "6" );
              cipherKey.put( "--...", "7" );
              cipherKey.put( "---..", "8" );
              cipherKey.put( "----.", "9" );
              String input ="";
              String intermsg = "";
              String alphaString = "";
              String morseString = "";
              String delimiter = "#";
              input = s;
              StringBuffer buffer = new StringBuffer(input);
                   Problem is that char cannot be dereferenced??? Need to fix.               
                   for( int i = 0; i < buffer.length()- 1; i++)
                        if((!(buffer.charAt(i).equals("."))) ||(!(buffer.charAt(i).equals("-"))))
                        JOptionPane.showMessageDialog (null, "Unsupported Characters Entered. You may only use letters, numbers and spaces.","Morse Code as Text - System Message", JOptionPane.ERROR_MESSAGE);     
                        System.exit(0);
                   for( int i = 0; i < buffer.length()- 1; i++)
                        if((Character.isWhitespace(buffer.charAt(i))) && (Character.isWhitespace(buffer.charAt(i + 1))))
                             buffer.setCharAt(i + 1, '#');
                   intermsg = buffer.toString();
                   StringTokenizer tokens = new StringTokenizer( intermsg );
                   int length = tokens.countTokens();
                   StringBuffer Output = new StringBuffer((length * 2));
                   while(tokens.hasMoreTokens())
                             morseString = tokens.nextToken();
                             if(morseString.equals(delimiter))
                                  Output.append(" ");
                             } else
                                  alphaString = (String)cipherKey.get( morseString );
                   Output.append( alphaString != null ? alphaString : delimiter );
                   output = Output.toString();
         }//EODecode
         public String Output()
              return output;
    }//EOF
    EncodeApp.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class EncodeApp extends MorseCode
         public static void main(String args[] )
              String input ="";
              String intermsg = "";
              String messageIn = "";
              input = JOptionPane.showInputDialog(
    "Enter Message to be Converted to Morse Code:");
              intermsg = input.trim();
              messageIn = intermsg.toUpperCase();
              MorseCode e = new MorseCode();
              e.Encode(messageIn);
              JOptionPane.showMessageDialog (null, e.Output(),
              "Message as Morse Code", JOptionPane.INFORMATION_MESSAGE );
              System.exit( 0 );
    }//EOF
    DecodeApp.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class DecodeApp extends MorseCode
         public static void main(String args[] )
              String input = "";
              String messageout = "";
              input = JOptionPane.showInputDialog(
                   "Enter Morse Code to be Converted to Plain Text:");
              messageout = input;
              MorseCode d = new MorseCode();
              d.Decode(messageout);
              JOptionPane.showMessageDialog (null, d.Output(),
              "Morse Code as Plain Text", JOptionPane.INFORMATION_MESSAGE );
              System.exit( 0 );
    }//EOF
    Thanks for your help!

    Input only <ONE SPACE> after ... --- ...
    code may be taking spaces as input
    or hard code a stream of " " to = a space in output

Maybe you are looking for

  • How to provision an app for all users with all dependencies?

    I have created an app package with VS that I want to provision for all users of a target system using DISM /Online /Add-ProvisionedAppxPackage /FolderPath:".\%package%" /SkipLicense The path contains the content of the *Test folders VS creates when c

  • How to create moving, fading and changing color movie

    Hi I want to make a simple movie where a graphic shaped as a ! (exp. mark) randomly appears on canvas, fading in and out and changing colors. I have studied the tutorial but I need a little help. Can you help me?

  • BI Content Datasource Errors

    Hi SDN Gurus, I am Activating SD related BI Content, I am getting following below Errors. I am unable find the Datasources in R/3. Installation of: 3.x DataSource (ISFS):- The extract structure /BI0/ARF_DS0100 of the DataSource 0RF_ARTHIER_ACT is inv

  • MacBook not receiving AOL emails

    My macbookpro stopped receiving and sending emails through AOL about 4 days ago. I ca still get emails through other servers and I can get my AOL mail on my iPhone, but my MacBook just sits there with the circle (I'm busy sign) continuously.

  • Report Navigation

    hello All, I have a complex requirement. Here is the scenario. Report contains Account type-A and Account Type_B along with other measure columns I need to pass the Account type B value to another report. But the problem here is I need to just displa