Skip to content

Tag: java

Spring 3.1 HandlerInterceptor Not being called

I followed the documentation for HandlerInterceptors. Noting that in the new version of Spring: “the configured interceptor will apply to all requests handled with annotated controller methods”. The following is in an xml configuration file: I have an annotated controller beginning like this: When…

How to override toString() properly in Java?

Sounds a little stupid, but I need help on my toString() method and it is very irking. I tried looking up online because the toString is the one where it is screwing up and “not finding Kid constructor #2” even though it is there and I would even do something else and it doesn’t work. Ok tha…

Loop through Months in Java / Android

I want to loop through months of the year and print out. for example: 01/2012 02/2012 03/2012 04/2012 etc… Here is my code: It is printing out in int’s 1 2 3 4 5 However, when I convert it to a date string, as seen in code above, it does this: 05/2012 06/2012 08/2012 11/2012 03/2013 08/2013 Basica…

java RMI – unexpected error

I have been working on to create a sample RMI project for a while and having difficulty with the following error for a few hours now. If anyone of you can point me towards my mistake, I will be grateful. I will be posting the trimmed code with the error. Thanks in advance for your time. PrimeFinder.java Prime…

How to manage Heap Space in Java

I’m trying to recursively traverse through my Drive to search some files. The code is working fine when there are limited folders/files but when I target my search to C drive where in I have lots of files it throws Out of Heap memory. Exception in thread “Thread-4” java.lang.OutOfMemoryError…