Revision 10468
Added by Jing Tao about 7 years ago
src/edu/ucsb/nceas/metacat/restservice/v1/CNResourceHandler.java | ||
---|---|---|
1226 | 1226 |
startTime = DateTimeMarshaller.deserializeDateToUTC(value); |
1227 | 1227 |
} catch (Exception e) { |
1228 | 1228 |
// if we can't parse it, just don't use the startTime param |
1229 |
logMetacat.warn("Could not parse fromDate: " + value); |
|
1230 |
startTime = null; |
|
1229 |
logMetacat.warn("Could not parse fromDate: " + value,e); |
|
1230 |
throw new InvalidRequest("1540", "Could not parse fromDate: " + value+" since "+e.getMessage()); |
|
1231 |
//startTime = null; |
|
1231 | 1232 |
} |
1232 | 1233 |
} else if (name.equals("toDate") && value != null) { |
1233 | 1234 |
try { |
1234 | 1235 |
endTime = DateTimeMarshaller.deserializeDateToUTC(value); |
1235 | 1236 |
} catch (Exception e) { |
1236 | 1237 |
// if we can't parse it, just don't use the endTime param |
1237 |
logMetacat.warn("Could not parse toDate: " + value); |
|
1238 |
endTime = null; |
|
1238 |
logMetacat.warn("Could not parse toDate: " + value, e); |
|
1239 |
throw new InvalidRequest("1540", "Could not parse toDate: " + value+" since "+e.getMessage()); |
|
1240 |
//endTime = null; |
|
1239 | 1241 |
} |
1240 | 1242 |
} else if (name.equals("formatId") && value != null) { |
1241 | 1243 |
formatId = new ObjectFormatIdentifier(); |
src/edu/ucsb/nceas/metacat/restservice/v1/MNResourceHandler.java | ||
---|---|---|
1150 | 1150 |
} |
1151 | 1151 |
catch(Exception e) |
1152 | 1152 |
{ //if we can't parse it, just don't use the fromDate param |
1153 |
logMetacat.warn("Could not parse fromDate: " + value[0]); |
|
1154 |
startTime = null; |
|
1153 |
logMetacat.warn("Could not parse fromDate: " + value[0], e); |
|
1154 |
throw new InvalidRequest("1540", "Could not parse fromDate: " + value[0]+" since "+e.getMessage()); |
|
1155 |
//startTime = null; |
|
1155 | 1156 |
} |
1156 | 1157 |
} |
1157 | 1158 |
else if(name.equals("toDate") && value != null) |
... | ... | |
1162 | 1163 |
} |
1163 | 1164 |
catch(Exception e) |
1164 | 1165 |
{ //if we can't parse it, just don't use the toDate param |
1165 |
logMetacat.warn("Could not parse toDate: " + value[0]); |
|
1166 |
endTime = null; |
|
1166 |
logMetacat.warn("Could not parse toDate: " + value[0], e); |
|
1167 |
throw new InvalidRequest("1540", "Could not parse toDate: " + value[0]+" since "+e.getMessage()); |
|
1168 |
//endTime = null; |
|
1167 | 1169 |
} |
1168 | 1170 |
} |
1169 | 1171 |
else if(name.equals("formatId") && value != null) |
src/edu/ucsb/nceas/metacat/restservice/v2/CNResourceHandler.java | ||
---|---|---|
1314 | 1314 |
startTime = DateTimeMarshaller.deserializeDateToUTC(value); |
1315 | 1315 |
} catch (Exception e) { |
1316 | 1316 |
// if we can't parse it, just don't use the startTime param |
1317 |
logMetacat.warn("Could not parse fromDate: " + value); |
|
1318 |
startTime = null; |
|
1317 |
logMetacat.warn("Could not parse fromDate: " + value, e); |
|
1318 |
throw new InvalidRequest("1540", "Could not parse fromDate: " + value+" since "+e.getMessage()); |
|
1319 |
//startTime = null; |
|
1319 | 1320 |
} |
1320 | 1321 |
} else if (name.equals("toDate") && value != null) { |
1321 | 1322 |
try { |
1322 | 1323 |
endTime = DateTimeMarshaller.deserializeDateToUTC(value); |
1323 | 1324 |
} catch (Exception e) { |
1324 | 1325 |
// if we can't parse it, just don't use the endTime param |
1325 |
logMetacat.warn("Could not parse toDate: " + value); |
|
1326 |
endTime = null; |
|
1326 |
logMetacat.warn("Could not parse toDate: " + value, e); |
|
1327 |
throw new InvalidRequest("1540", "Could not parse toDate: " + value+" since "+e.getMessage()); |
|
1328 |
//endTime = null; |
|
1327 | 1329 |
} |
1328 | 1330 |
} else if (name.equals("formatId") && value != null) { |
1329 | 1331 |
formatId = new ObjectFormatIdentifier(); |
src/edu/ucsb/nceas/metacat/restservice/v2/MNResourceHandler.java | ||
---|---|---|
1315 | 1315 |
} |
1316 | 1316 |
catch(Exception e) |
1317 | 1317 |
{ //if we can't parse it, just don't use the fromDate param |
1318 |
logMetacat.warn("Could not parse fromDate: " + value[0]); |
|
1319 |
startTime = null; |
|
1318 |
logMetacat.warn("Could not parse fromDate: " + value[0], e); |
|
1319 |
throw new InvalidRequest("1540", "Could not parse fromDate: " + value[0]+" since "+e.getMessage()); |
|
1320 |
//startTime = null; |
|
1320 | 1321 |
} |
1321 | 1322 |
} |
1322 | 1323 |
else if(name.equals("toDate") && value != null) |
... | ... | |
1327 | 1328 |
} |
1328 | 1329 |
catch(Exception e) |
1329 | 1330 |
{ //if we can't parse it, just don't use the toDate param |
1330 |
logMetacat.warn("Could not parse toDate: " + value[0]); |
|
1331 |
endTime = null; |
|
1331 |
logMetacat.warn("Could not parse toDate: " + value[0], e); |
|
1332 |
throw new InvalidRequest("1540", "Could not parse toDate: " + value[0]+" since "+e.getMessage()); |
|
1333 |
//endTime = null; |
|
1332 | 1334 |
} |
1333 | 1335 |
} |
1334 | 1336 |
else if(name.equals("formatId") && value != null) |
Also available in: Unified diff
In the mn/cn.listObject method, if the toDate or fromDate have an incorrect format, it will throw an exception.