@@ -62,20 +62,24 @@ public String registerNewPID(final Configuration configuration, Map<HandleField,
6262 .accept ("application/json" )
6363 .post (Entity .entity (jsonArray .toString (), MediaType .APPLICATION_JSON ));
6464
65- return processCreateResponse (response , configuration );
65+ return processCreateResponse (response , configuration );
6666 }
6767
6868 private String processCreateResponse (final Response response , final Configuration configuration )
6969 throws HttpException , RuntimeException {
7070 if (response .getStatus () != 201 ) {
71- throw new HttpException ("" + response .getStatus ());
71+ LOG .debug ("Invalid API respose: code=" +response .getStatus ()+", message=" +response .getStatusInfo ().getReasonPhrase ());
72+ throw new HttpException ("Invalid API response" + response .getStatus ());
7273 }
7374
7475 String base = configuration .getServiceBaseURL ();
7576 if (!base .endsWith ("/" )) {
7677 base += "/" ;
7778 }
78- return response .getLocation ().toString ().replace (base , "" );
79+
80+ String location = response .getLocation ().toString ().replace (base , "" );
81+ LOG .debug ("Registered new PID at location: " +location );
82+ return location ;
7983 }
8084
8185 @ Override
@@ -92,7 +96,10 @@ public void modifyPid(final Configuration configuration, final String pid, Map<H
9296 .put (Entity .entity (jsonArray .toString (), MediaType .APPLICATION_JSON ));
9397
9498 if (response .getStatus () != 201 ) {
95- throw new HttpException ("Invalid response: " +response .getStatus ());
99+ LOG .debug ("Invalid API respose: code=" +response .getStatus ()+", message=" +response .getStatusInfo ().getReasonPhrase ());
100+ throw new HttpException ("Invalid API response: " +response .getStatus ());
101+ } else {
102+ LOG .debug ("Successfully modified PID: " +pid );
96103 }
97104 }
98105
0 commit comments