java

How should one unit test the hashCode-equals contract?

In a nutshell, the hashCode contract, according to Java's object.hashCode(): The hash code shouldn't change unless something affecting equals() changes equals() implies hash codes are == Let's assume interest primarily in immutable data objects - their information never changes after they're constructed, so #1 is assumed to hold. Th...

How well do Eclipse and Netbeans coexist?

I would like to have both Eclipse and Netbeans (with JUnit) installed on one system, so I can be somewhat familiar with both. Besides GUI development (see "Using both Eclipse and Netbeans"), are there any other issues with using both IDEs on the same system, or even the same project? ...

How do I add an extra source directory that will be used by the maven-jxr-plugin?

I'm using the build-helper-maven-plugin to add it to my build, but I'd like to see the XREF source for this extra source directory as well. FYI: maven-jxr-plugin - The JXR plugin produces a cross-reference of the project's sources. The generated reports make it easier for the user to reference or find specific lines of code. It is also...

Eclipse reading stdin (System.in) from a file.

Is it possible for Eclipse to read stdin from a file? ...

HTTP posts and multiple threads in Java

I am writing an internal Java Applet to do file uploads via HTTP. I started using the built in ClientHttpRequest which worked great if I want to post one after another. When I try to have multiple threads post at the same time, something on the server side freaks out and the connection will hang for large files while still uploading th...

How to make junit testing to stop after first failing test

Is there a way to make running junit test to stop after a test fails? ...

What tools are available for creating in process COM servers in Java?

What tools are available for creating in process COM servers in Java? ...

Java/Swing: How to draw a simple bar graph in a custom renderer for a JLabel.

I would like to dynamically create a minimal transparent bar graph to display over a canvas. I was thinking of using a custom renderer for a JButton or a JLabel; but how do I draw my bar graph in this renderer? ...

How to scan a folder in Java?

How can I get a tree of all the files from a current folder in Java? ...

Do you really use your reverse domain for package naming in java?

For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward. Which do you use for package naming in your projects? ...

No stack trace generated on client site for NullPointerException?

I've been learning Java for about a month now, and not very familiar with a client/server situation like this one. Basically I ran into a situation where our client java software (GUI) displayed a nullpointerexception popup but no stack trace on the client side. Someone had to go check the server side for the stack trace. My question i...

Identifying the season from the Date using Java

I've had nothing but good luck from SO, so why not try again? I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons. What I would like from you geniuses is a method called GetSeason that takes a date as inpu...

NFS Server in Java

I search an implementation of a network (or distributed) file system like NFS in Java. The goal is to extend it and do some research stuff with it. On the web I found some implementation e.g. DJ NFS, but the open question is how mature and fast they are. Can anyone purpose a good starting point, has anyone experience with such things? ...

ORA-00942: table or view does not exist : How do I find which table or view it is talking about

Hi Guys, We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error(ORA-00942: table or view does not exist). Is there a way to find out which table/view(s) ORACLE is talking about ? I know that I can add extra levels of logging in hibernate which will show all the SQL that it execu...

How do I join two lists in Java?

Conditions: do not modifiy the original lists; JDK only, no external libraries. Bonus points for a one-liner or a JDK 1.3 version. Is there a simpler way than: List<String> newList = new ArrayList<String>(); newList.addAll(listOne); newList.addAll(listTwo); ...

Eclipse as IDE + Mercurial for version control + ? Bug tracking = Good idea?

Hi, For a new Java web project I thought about using: Eclipse as IDE Mercurial for version control Some kind of bug tracking software I have heard of bug tracking software where you can tie a change to an unresolved bug when you check it in. I haven't used any such solution myself, but it sounds good. Are there any good bug tracking...

Sharing source between two Netbeans projects

I have an existing Java project in Netbeans (a JSF web application). I'd like to experiment with GWT in a separate project - put pull in source from the original project. Is there any way to share source between two Netbeans projects. When I attempt to add the source directory from the original project into the new the IDE complains th...

How to format methods with large parameter lists

I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String origin, ...

IE6 generated strange worksheet name when doing export from java application

I am encountering error like test(10)[1].csv file cannot be found at C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW When trying to do export of CSV file using the following codes. Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefox and is only specific to ...

Java MessageFormat - How can I insert values between single quotes?

I'm having a problem using the java.text.MessageFormat object. I'm trying to create SQL insert statements. The problem is, when I do something like this: MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4} )"; Object[] args = { str0, str1, str2, str3, str4 }; String result = messageFormat.format(args); ...