Project

General

Profile

« Previous | Next » 

Revision 1816

Added by Jing Tao over 20 years ago

Fixed the bug that if path query without xml declaration will cause a non well-formed result doc.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
640 640
    //the <?xml version="1.0"?> tag is the first 22 characters of the
641 641
    xmlquery = xmlquery.trim();
642 642
    int index = xmlquery.indexOf("?>");
643
    return xmlquery.substring(index + 2, xmlquery.length());
643
    if ( index != -1 )
644
    {
645
      //have <?xml version="1.0"?>
646
      return xmlquery.substring(index + 2, xmlquery.length());
647
    }
648
    else
649
    {
650
      // don't have <?xml version="1.0"?>
651
      return xmlquery;
652
    }
644 653
  }
645 654

  
646 655
  /**
......
653 662
  {
654 663
    xmlquery = xmlquery.trim();
655 664
    int index = xmlquery.indexOf("?>");
656
    return xmlquery.substring(index + 2, xmlquery.length());
665
    if (index != -1)
666
    {
667
      return xmlquery.substring(index + 2, xmlquery.length());
668
    }
669
    else
670
    {
671
      return xmlquery;
672
    }
657 673
  }
658 674

  
659 675
  /**

Also available in: Unified diff