Revision 7051
Added by Chris Jones almost 13 years ago
src/edu/ucsb/nceas/metacat/restservice/MNResourceHandler.java | ||
---|---|---|
1031 | 1031 |
if (trailingPid == null) { |
1032 | 1032 |
// get the pid string from the body and set the value |
1033 | 1033 |
String pidString = multipartparams.get("pid").get(0); |
1034 |
pid.setValue(pidString); |
|
1034 |
if (pidString != null) { |
|
1035 |
pid.setValue(pidString); |
|
1036 |
|
|
1037 |
} else { |
|
1038 |
throw new InvalidRequest("1102", "The pid param must be included and contain the identifier."); |
|
1039 |
|
|
1040 |
} |
|
1035 | 1041 |
} else { |
1036 | 1042 |
// use the pid included in the URL |
1037 | 1043 |
pid.setValue(trailingPid); |
Also available in: Unified diff
If PID is not part of the multipart params, we end up with a NullPointerException. Throw an InvalidRequest in this case rather than ServiceFailure resulting from the NPE.