Project

General

Profile

« Previous | Next » 

Revision 6469

use d1_common_java's date serialization utility for parsing parameters

View differences:

D1ResourceHandler.java
99 99
     */
100 100
    protected static final String FUNCTION_NAME_INSERT = "insert";
101 101
    protected static final String FUNCTION_NAME_UPDATE = "update";
102

  
103
    protected static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
104 102
    
105 103
    protected ServletContext servletContext;
106 104
    protected Logger logMetacat;
......
314 312
            params.put(name, value);
315 313
        }
316 314
    }
317

  
315
   
318 316
    /**
319
     * parse a date and return it in GMT if it ends with a 'Z'
320
     * @param date
321
     * @return
322
     * @throws ParseException
323
     */
324
    protected Date parseDateAndConvertToGMT(String date) throws ParseException
325
    {
326
        try
327
        {   //the format we want
328
            return dateFormat.parse(date);
329
        }
330
        catch(java.text.ParseException pe)
331
        {   //try another legacy format
332
            DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
333
            dateFormat2.setTimeZone(TimeZone.getTimeZone("GMT-0"));
334
            return dateFormat2.parse(date);
335
        }    
336
    }
337

  
338
        
339
    /**
340 317
     * locate the boundary marker for an MMP
341 318
     * @param is
342 319
     * @return

Also available in: Unified diff