Project

General

Profile

« Previous | Next » 

Revision 2992

Added by berkley over 18 years ago

fixed bugs in teh client that were preventing the lsid service from working right

View differences:

test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
600 600
               System.err.println("Metacat is: " + metacatUrl);
601 601
               fail("Metacat connection failed." + mie.getMessage());
602 602
           }
603
          
604 603
           String lastId = m3.getLastDocid(prefix);
605
           //System.err.println("Last Id: " + lastId);
604
           System.err.println("Last Id: " + lastId);
606 605
           assertTrue(lastId.equals(newdocid + ".1"));
607 606
       } catch (MetacatException me) {
608 607
           fail("Metacat Error:\n" + me.getMessage());
src/edu/ucsb/nceas/metacat/client/MetacatClient.java
673 673
         String response = null;
674 674
         try {
675 675
             response = sendDataForString(prop, null, null, 0);
676
             //parseRevisionResponse will return null if there is an 
677
             //error that it can't handle
676 678
             String revStr = parserRevisionResponse(response);
677 679
             Integer revObj = new Integer(revStr);
678 680
             rev = revObj.intValue();
679 681
             // Check for an error condition
680
             if (response.indexOf("<error>") != -1) {
682
             if (response.indexOf("<error>") != -1 && revStr == null) {
681 683
                 throw new MetacatException(response);
682 684
             }
683 685
         } catch (Exception e) {
......
852 854
      String revision = null;
853 855
      if (response != null)
854 856
      {
855
        int firstSemiCol = response.indexOf(";");
856
        revision = response.substring(0, firstSemiCol);
857
      }
857
        if(response.indexOf("<error>") != -1)
858
        {
859
          if(response.indexOf("There is not record") != -1)
860
          {
861
            return "0";
862
          }
863
          else
864
          {
865
            return null;
866
          }
867
        }
868
        else
869
        {
870
          int firstSemiCol = response.indexOf(";");
871
          revision = response.substring(0, firstSemiCol);
872
        }
873
      } 
858 874
      return revision;
859 875
    }
860 876
}

Also available in: Unified diff