Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!

Nikhil Menon

Ranch Hand
+ Follow
since Nov 22, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nikhil Menon

The issue got resolved, we were able to identify there Object holding the PrintWriter instance was not thread safe and multiple threads were using the object and changing the PrintWriter instance to point to a new instance!!!

Thank you everyone for taking time in looking into the question.
[ August 25, 2008: Message edited by: Nikhil Menon ]
13 years ago
Yes, the exceptions, if any, are handled properly. I did not receive any exception in this case.
13 years ago
I am trying that now along with autoflush, but the current code (just calling close() and not flush()) works most of the times. Occasionally I am facing data loss that was in the buffer. Do you think it is due to any socket timeout? Or is it due to buffer size? any suggestions?
13 years ago
Thank you Ravi

The problem is that, the file to which the PrintWriter printed the data contains only a portion of the data. However, the program completes successfully, there are no errors.

Please let me know if this information is sufficient. I appreciate any pointers that you think might contribute to this issue.
[ August 07, 2008: Message edited by: Nikhil Menon ]
13 years ago

new PrintWriter(new OutputStreamWriter(new FileOutputStream("filename")))

I am using a printWriter as given above to write large amounts of data. There is also a considerable (sometime 15 mins) wait for loading data from database that needs to be written to the file.
The problem is that the file is getting terminated prematurely. I checked all the log file, there are no signs of any error.

Is it possible that the Socket got closed unexpectedly? Or is there any timeout for which Outstream can be kept open? Please advice.

Has anyone experienced this issue?
13 years ago
Try the code that I have written below.

You can use the RandomAccessFile to temporarily write your string into a file and the while reading from the same file you can read it in the reverse direction.
RandomAccessFile gives you the luxury of accessing the file pointer (cursor) so you can define where to read in the file.

PS: By the way why do you want to avoid the built in String and StringBuffer methods?
15 years ago
Can any body help me to get some information on Collations on Db2
I have a situation where I need to search data in DB2 under this condition:

If a person wish to search on a name : Mathew the search results should also return the values where the name is having the latin-1 Supplement characters in that name such as for the character 'a' it should also search for 'a' with a tilde above it or 'a' with a ring above it etc. Has anybody come across such requirements? does some one has any thoughts?
I thought I will have to use Unicode based search on the DB2.. . Or to resolve the various combinations for search in Java itself by creating the Composite Unicode for the Latin-1 Supplement using the Unicode of 'a'. Any ideas? or Any api available for this translation. Please share your thoughts
Hi aren't you guys discussing on the same topic?

You can see in your if condition you have used reference equality instead of value equality.

16 years ago
Hak Khan,

You just made a minor mistake.
Dont use == operator for comparing value equality in Strings. (It actually compares references). Use equals(String str) method instead. That will work fine, and remember if you need to ignore the case when comparing better use equalsIgnoreCase(String str) instead. Thats all.
See api

Nikhil Kanjulli Menon.
Hi how are you returning the Hashmap from servlet? as an attribute or parameter and in which scope?

Make sure your class has not thrown any exception and is containing elements in hashmap. Please send the servlet and jsp code to verify

16 years ago

If you haven't figured out the issue, this may help.

As you have mentioned you have the commons-logging.jar in your app's lib directory. So the only possible reason could be a conflict. That is primarily because there could be another commons-logging.jar in one of the following places,
(1) C:\j2sdk1.4.2_04\jre\lib\ext
(2) D:\Tomcat 5.0\common\lib

Remove if it is there or anyother place other than your app's lib folder. Then restart your tomcat and see what happens.

PS: I usually keep the jar files that are common to every application in the tomcats' lib folder, and never bother to keep those in my webapplication level. This assures that there is no conflicts. It is upto the induvidual's choice.

Nikhil Kanjulli Menon
16 years ago

originally posted by Adeel Ansari
- forward to error page from your servlet using RequestDispatcher. Or make an error page entry in your deployment descriptor. Both would work fine.

1.If you use RequestDispacther to forward to an 'jsp error page' then you have to set the request attribute asrequest.setAttribute("java.servlet.jsp.jpsException",e) and then forward('e' is your exception object). Advantage of doing so is can get the exception object in your error page too as the jsp implicit object 'exception'. Then you do stack trace or handle it in your way.

2.If you use deployment descriptor then it works fine and is easier.

Nikhil Kanjulli Menon
16 years ago
Congrats Ben..
You gave good,helpful posts.
16 years ago