Revision 5617
Added by berkley about 14 years ago
src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java | ||
---|---|---|
437 | 437 |
catch(Exception e) |
438 | 438 |
{ |
439 | 439 |
String msg = "Could not get logs from CrudService: " + e.getMessage(); |
440 |
response.setStatus(500); |
|
440 | 441 |
ServiceFailure sf = new ServiceFailure("1490", msg); |
441 | 442 |
logMetacat.error(msg); |
442 | 443 |
e.printStackTrace(); |
... | ... | |
666 | 667 |
} |
667 | 668 |
catch(InvalidToken it) |
668 | 669 |
{ |
670 |
response.setStatus(500); |
|
669 | 671 |
serializeException(it, out); |
670 | 672 |
} |
671 | 673 |
catch(ServiceFailure sf) |
672 | 674 |
{ |
675 |
response.setStatus(500); |
|
673 | 676 |
serializeException(sf, out); |
674 | 677 |
} |
675 | 678 |
catch(NotAuthorized na) |
676 | 679 |
{ |
680 |
response.setStatus(500); |
|
677 | 681 |
serializeException(na, out); |
678 | 682 |
} |
679 | 683 |
catch(NotFound nf) |
680 | 684 |
{ |
685 |
response.setStatus(500); |
|
681 | 686 |
serializeException(nf, out); |
682 | 687 |
} |
683 | 688 |
catch(NotImplemented ni) |
684 | 689 |
{ |
690 |
response.setStatus(500); |
|
685 | 691 |
serializeException(ni, out); |
686 | 692 |
} |
687 | 693 |
catch(Exception e) |
688 | 694 |
{ |
695 |
response.setStatus(500); |
|
689 | 696 |
System.out.println("Error with Crud.get(). " + |
690 | 697 |
"If this is an 'Exception producing data' error, " + |
691 | 698 |
"go to CrudService.get() for better debugging. " + |
... | ... | |
784 | 791 |
} |
785 | 792 |
} |
786 | 793 |
} catch (BaseException e) { |
794 |
response.setStatus(500); |
|
787 | 795 |
serializeException(e, out); |
788 | 796 |
} catch (IOException e) { |
789 | 797 |
e.printStackTrace(); |
798 |
response.setStatus(500); |
|
790 | 799 |
ServiceFailure sf = new ServiceFailure("1030", |
791 | 800 |
"IO Error in ResourceHandler.getObject: " + e.getMessage()); |
792 | 801 |
serializeException(sf, out); |
793 | 802 |
} catch(NumberFormatException ne) { |
803 |
response.setStatus(500); |
|
794 | 804 |
InvalidRequest ir = new InvalidRequest("1030", "Invalid format for parameter: " + ne.getMessage()); |
795 | 805 |
serializeException(ir, out); |
796 | 806 |
} catch (Exception e) { |
797 | 807 |
e.printStackTrace(); |
808 |
response.setStatus(500); |
|
798 | 809 |
ServiceFailure sf = new ServiceFailure("1030", |
799 | 810 |
"Exception " + e.getClass().getName() + " raised while handling listObjects request: " + |
800 | 811 |
e.getMessage()); |
... | ... | |
872 | 883 |
throw new ServiceFailure("1190", "Failed to serialize SystemMetadata: " + e.getMessage()); |
873 | 884 |
} |
874 | 885 |
} catch (BaseException e) { |
886 |
response.setStatus(500); |
|
875 | 887 |
serializeException(e, out); |
876 | 888 |
} catch (IOException e) { |
889 |
response.setStatus(500); |
|
877 | 890 |
ServiceFailure sf = new ServiceFailure("1030", |
878 | 891 |
"Error in ResourceHandler.getSystemMetadataObject: " + e.getMessage()); |
879 | 892 |
serializeException(sf, out); |
... | ... | |
1016 | 1029 |
InputStream object = null; |
1017 | 1030 |
InputStream sysmeta = null; |
1018 | 1031 |
String s = IOUtils.toString(is); |
1019 |
System.out.println("mime: " + s); |
|
1032 |
//System.out.println("mime: " + s);
|
|
1020 | 1033 |
//figure out what the boundary marker is |
1021 | 1034 |
String searchString = "boundary="; |
1022 | 1035 |
int searchStringIndex = s.indexOf(searchString); |
... | ... | |
1045 | 1058 |
h.put("object", object); |
1046 | 1059 |
h.put("systemmetadata", sysmeta); |
1047 | 1060 |
|
1048 |
System.out.println("o: \"" + o + "\""); |
|
1049 |
System.out.println("sm: \"" + sm + "\""); |
|
1061 |
//System.out.println("o: \"" + o + "\"");
|
|
1062 |
//System.out.println("sm: \"" + sm + "\"");
|
|
1050 | 1063 |
return h; |
1051 | 1064 |
} |
1052 | 1065 |
|
... | ... | |
1146 | 1159 |
throw new InvalidRequest("1000", "Operation must be create or update."); |
1147 | 1160 |
} |
1148 | 1161 |
} catch (NotAuthorized e) { |
1162 |
response.setStatus(500); |
|
1149 | 1163 |
serializeException(e, out); |
1150 | 1164 |
} catch (InvalidToken e) { |
1165 |
response.setStatus(500); |
|
1151 | 1166 |
serializeException(e, out); |
1152 | 1167 |
} catch (ServiceFailure e) { |
1168 |
response.setStatus(500); |
|
1153 | 1169 |
serializeException(e, out); |
1154 | 1170 |
} catch (IdentifierNotUnique e) { |
1171 |
response.setStatus(500); |
|
1155 | 1172 |
serializeException(e, out); |
1156 | 1173 |
} catch (UnsupportedType e) { |
1174 |
response.setStatus(500); |
|
1157 | 1175 |
serializeException(e, out); |
1158 | 1176 |
} catch (InsufficientResources e) { |
1177 |
response.setStatus(500); |
|
1159 | 1178 |
serializeException(e, out); |
1160 | 1179 |
} catch (InvalidSystemMetadata e) { |
1180 |
response.setStatus(500); |
|
1161 | 1181 |
serializeException(e, out); |
1162 | 1182 |
} catch (NotImplemented e) { |
1183 |
response.setStatus(500); |
|
1163 | 1184 |
serializeException(e, out); |
1164 | 1185 |
} catch (InvalidRequest e) { |
1186 |
response.setStatus(500); |
|
1165 | 1187 |
serializeException(e, out); |
1166 | 1188 |
} /*catch (MessagingException e) { |
1167 | 1189 |
ServiceFailure sf = new ServiceFailure("1000", e.getMessage()); |
1168 | 1190 |
serializeException(sf, out); |
1169 | 1191 |
}*/ catch (IOException e) { |
1192 |
response.setStatus(500); |
|
1170 | 1193 |
ServiceFailure sf = new ServiceFailure("1000", e.getMessage()); |
1171 | 1194 |
serializeException(sf, out); |
1172 | 1195 |
} catch (JiBXException e) { |
1196 |
response.setStatus(500); |
|
1173 | 1197 |
e.printStackTrace(System.out); |
1174 | 1198 |
InvalidSystemMetadata ism = new InvalidSystemMetadata("1080", e.getMessage()); |
1175 | 1199 |
serializeException(ism, out); |
Also available in: Unified diff
fixing redmine task 738