java

MalformedInputException while using Shrinksafe with IBM JRE

While trying to use Shrinksafe custom_rhino.jar to build Dojo I get MalformedInputException. The problem occurs when build reaches custom widgets/templates which contain french letters stored in UTF-8. The AIX machine has LANG=en_US which should be correct, judging by other documented problems regarding MalformedInputException with IBM J...

Is there a Java unit-test framework that auto-tests getters and setters?

There is a well-known debate in Java (and other communities, I'm sure) whether or not trivial getter/setter methods should be tested. Usually, this is with respect to code coverage. Let's agree that this is an open debate, and not try to answer it here. There have been several blog posts on using Java reflection to auto-test such metho...

Are EJB still alive ?

Do you still use session or entity EJB in your project ? Why ? ...

Running code in the context of a java WAR from the command line

How would I go about writing some code to allow access to a Java class in my webapp from the command line. E.g. I have a java class with command line interface, that can runs code in the context of the webapp, with access to the DB etc. I want to log on the machine hosting my WARred app in tomcat and be able to interact with it Where ...

Testing all classes which implement an interface in Java

Is there anything out there (for Java specifically) that allow you to automatically test the behavior of an interface? As an example, let's say I have a bunch of tests for the Comparable interface, that should apply to anything that implements Comparable. What I'd like is to be able to include "ComparableTests" automatically in the test ...

Are writes from within a Tomcat 6 CometProcessor non-blocking

I have a CometProcessor implementation that is effectively doing a Multicast to a potentially large number of clients. When an event occurs that needs propagated to to all the clients, the CometProcessor will need to loop through the list of clients writing out the response. If writing responses block then there is the possibility that...

How to sort a Map<Key, Value> on the values in Java?

I am relatively new to Java, and often find that I need to sort a Map on the values. Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key. Is there an easier way? ...

Update a backend database on software update with Java

With which tool / library it is possible to update an existing database structure. On the update of the software it is also needed to change the database. Because there can be different versions of the software it should compare the current status with the target status of the database. It should: add table columns, fill it with defaul...

Xcode: 'Generics are not supported in -source 1.3' compiler error?

Hello everyone, just a quick question: I am a CS undergrad and have only had experience with the Eclipse, and Net Beans IDEs. I have recently acquired a Macbook and was wanting to recompile a recent school project in Xcode just to test it out. Right after the line where I declare a new instance of an ArrayList: dictionary = new Arra...

JTable Sort

I know that Jtable can sort by a single column. But is it possible to allow for multiple column sort or do i need to write the code myself? Thanks in advance ...

Which loop has better performance? Why?

String s = ""; for(i=0;i<....){ s = some Assignment; } or for(i=0;i<..){ String s = some Assignment; } I don't need to use 's' outside the loop ever again. The first option is perhaps better since a new String is not initialized each time. The second however would result in the scope of the variable being limited to the loo...

How much business logic should Value objects contain?

One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful. Another says such code is difficult to maintain and that all business logic must be externalized. I realize this question is subjective. Asking anyway - want to know answers from more perspectives....

How to unit test a DAO that is extending SqlMapClientDaoSupport

Spring DA helps in writing DAOs. When using iBATIS as the persistence framework, and extending SqlMapClientDaoSupport, a SqlMapClient mock should be set for the DAO, but I can't do it. SqlMapClientTemplate is not an interface and EasyMock cannot creates a mock for it. ...

Which Continuous Integration library to use?

I've worked with Cruise Control as the CI framework in my last project. Any recommendations on some other tools? (Not that i found CruiseControl lacking, just wanted to know if someone did some comparisons) ...

Read divert sockets in java?

If I was to create a ipfw divert rule to forward all FTP traffic to a specific socket, is it possible to use Java to connect to the socekt and read the packet information? If so, how would i go about reading/writing to the scoket? ...

Supplementary development tools for Java

What are your favorite supplementary tools for Java development? Mine are: 1) Total Commander (due to the ability to search inside JARs). 2) JAD + Jadclipse (to understand and debug libraries) And of-course, Google. (can't really live without it) ...

Should domain objects and simple JavaBeans be unit tested?

Should simple JavaBeans that have only simple getters and setters be unit tested?? What about Beans with some logic in getters and setters? ...

Secure Gmail login on web browser from external Java program

Is there a secure way of logging into a Gmail account on a web browser, from an external Java program? I know the following works, but is there a safer alternative? Desktop.getDesktop().browse(new URI( "https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmail" + "&service=mail&Email=LOGIN&Pa...

What is the best java conference to visit

My company allows me to visit one international work related (I'm Java/JEE Developer/Technical Lead interested in polyglot programming) conference each year. I've visited JavaOne and Javapolis (devox?) in the past. For next year I'm looking for a conference which is less technology but a bit more methodology focussed... possible like J...

Searching for regex patterns on a 30GB xml dataset. Making use of 16gb of memory.

I currently have a Java SAX parser that is extracting some info from a 30GB xml file. Presently it is reading each xml node storing it into a string object, running some regexex on the string storing the results to the database For several million elements. I'm running this on a computer with 16GB of memory, but the memory is not be...