Results 1 to 3 of 3

Thread: Spring cant convert String to Date on Server, local tests pass

Threaded View

  1. #1
    Join Date
    Oct 2011
    Posts
    8

    Default Spring cant convert String to Date on Server, local tests pass

    Hello,
    I do have some controllers reading the conditional get header form an request.
    In detail the "If-Modified-Since" header is required.
    My Unit tests looks as follows:

    Code:
    // setup date
    		Date currentDate = mu2.getLastModified();
    		Calendar calendar = Calendar.getInstance();
    		calendar.setTime(currentDate);
    		calendar.add(Calendar.DATE, 1);
    		//Sat, 12 Aug 1995 13:30:00 GMT+0000
    		//EEE, dd.MM.yyyy HH:mm:ss Z
    		SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zZ");
    		formatter.setTimeZone((TimeZone.getTimeZone("GMT")));
    		
    		// setup request
    		request.setMethod("GET");
    		request.setRequestURI("/customer");
    		request.addHeader("Accept", "application/json");
    		request.addHeader("If-Modified-Since", formatter.format((calendar.getTime())));
    So local all tests are fine and pass. On the Jenkins I'll get an Exception:

    org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Date]: no matching editors or conversion strategy found

    How is that possible?

    Local everything allright, on the jenkins thos errors?

    I would appreciate any help
    Last edited by Alex04; Oct 27th, 2011 at 08:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •