Project

General

Profile

Revision 6562

include clearer error message when UPDATE action is requested on a replicated document and we fail to successfully get a lock from the source Metacat server
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4907

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
2663 2663
                    + "&action=getlock&updaterev=" + updaterev + "&docid="
2664 2664
                    + docid);
2665 2665
            //System.out.println("sending message: " + u.toString());
2666
            String serverResStr = ReplicationService.getURLContent(u);
2667
            String openingtag = serverResStr.substring(0, serverResStr
2668
                    .indexOf(">") + 1);
2666
            String openingtag = null;
2667
            try {
2668
            	String serverResStr = ReplicationService.getURLContent(u);
2669
            	openingtag = serverResStr.substring(0, serverResStr.indexOf(">") + 1);
2670
            } catch (IOException e) {
2671
				// give a more meaningful error if replication check fails
2672
            	// see http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4907
2673
            	String msg = "Error during replication lock request on server=" + server;
2674
            	logReplication.error(msg);
2675
            	throw new Exception(msg, e);
2676
			}
2677
            
2669 2678
            if (openingtag.equals("<lockgranted>")) {//the lock was granted go
2670 2679
                                                     // ahead with the insert
2671 2680
                XMLReader parser = null;

Also available in: Unified diff