By Govind Rai
The code seems to behave differently in local environment and differently in a live one. A code that works locally doesnt seem to work on digital ocean server.
This is the code I am using and it works fine in local environment
def date = params.deadline
def dateAgain = date.tokenize('/')
def BD = dateAgain[2] + "-" + dateAgain[0] + "-" + dateAgain[1] + " "+ params.deadLinSubmiteTime +":00"
def deadline = Date.parse("yyyy-MM-dd HH:mm:ss", BD)
And this error is what I get in live environment
Unparseable date: "null-10-01-2018-null 16:51:00". Stacktrace follows:
java.text.ParseException: Unparseable date: "null-10-01-2018-null 16:51:00"
at java.text.DateFormat.parse(DateFormat.java:357)
at crm.ContactsController.addTask(ContactsController.groovy:1017)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Using MySQL, Tomcat 7 in Ubuntu 14.04.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
According to the error that you’ve shared, it looks like that as the value of params.deadline is null in the live environment, the tokenize() method is failing and throwing an error.
To resolve the issue, you should confirm that the deadline parameter is passed correctly and meets the expected format before trying to parse it into a Date object.
You could try setting a default value for the deadline parameter so that you don’t hit that error in case that the parameter is not passed.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.