vipul John

Ranch Hand
+ Follow
since Oct 14, 2010
India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by vipul John

Kathir jeyap wrote:
I used the same code...However 500 error is returned and the page got redirected to the error page

I want the same page or window or dialog should be retained..

Please advise.



Why 500 is returned. Could you post the code you've written or the exception that is thrown?
1 week ago
you can use ModelAndView object. set the error message  and return ModelAndView object as response.

Please check below code. It helps.


write this piece of code inside @ControllerAdvice annotation class.
1 week ago
You can use below link to download jar files and configure web.xml file.
http://www.mazong1123.com/use-jersey-2.0-without-maven/

To implement a jersey web service, just go through jersey documentation link:
https://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.5.1/jersey-documentation-2.5.1-user-guide.pdf

If you still get into problems, post your issue with all your findings. Thanks.
2 weeks ago

Dave Tolls wrote:

vipul John wrote:
What do you mean? My question is why parse() accepting extra input in the pattern? Is this functionality expected? I have set lenient to false. so that's strictly HH:mm should be accepted right.



Quoting from the documentation linked to by Campbell earlier, for the parse() method:
"
Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.

"



My requirement is, My project uses 24 hour format pattern. It works until one of the tester using the application specified time as 22:30 AM format which it still accepts and does not throw a validation error. After specifying the format I can write anything, it does not matter.
Should I handle this using string.split method separated by space. If the array contains more than one string, then throw a validation message saying "specify proper time format". Can It be handled in any other way, without writing much code.

It is unfortunate to write code in this way, but most probably this will be temporary once project is migrated to java 1.8 we start using LocalDate and LocalTime.
2 weeks ago

Campbell Ritchie wrote:

vipul John wrote:. . . What do you mean?

I mean that it is unfortunate that you are constrained to use poor quality legacy code when much better code is available.

My question is why parse() accepting extra input in the pattern? Is this functionality expected? . . .

Did you actually look at the documentation? As Dave Tolls points out, it is all in there.



Migration to Java 1.8 is a major change. It requires lot of effort, so most probably in couple of months we might work on it.

2 weeks ago

Campbell Ritchie wrote:

vipul John wrote:. . . . I can not use Java 8 API time package, as one of the other projects has a dependency of Java 7. . . .

What a pity. The details of the parse() method appear not to have changed between Java7 and Java8.



What do you mean? My question is why parse() accepting extra input in the pattern? Is this functionality expected? I have set lenient to false. so that's strictly HH:mm should be accepted right.
2 weeks ago

Campbell Ritchie wrote:What does the documentation for that method say? You are actually passing a valid time at the beginning of that text.
I think the wrong thing is using Date and DateFormat in the first place. Date is a dreadful class and it has been superseded by much better things which you can read about in the Java™ Tutorials.



I can not use Java 8 API time package, as one of the other projects has a dependency of Java 7. So, that is a lot of work , approvals and integration testing.
2 weeks ago
My SimpleDateFormat pattern is HH:mm, but I gave input as '22:33 JavaRanch'. This is incorrect.
'HH:mm' is 24-hour format. Suppose, If i give '22:30 AM' as input, SimpleDateFormat should throw ParseException.
2 weeks ago


This program gives output 22:33, instead of throwing error. Am I doing anything wrong?
2 weeks ago
Welcome Doug Schmidt. Happy to have you here.
Welcome, Barry Burd. Looking forward for Java for Dummies book.
9 months ago
Welcome David mayer, to the java ranch forum.