You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2005/02/16 14:59:49 UTC

cvs commit: xml-xindice/java/src/org/apache/xindice/xml NamespaceMap.java

vgritsenko    2005/02/16 05:59:49

  Modified:    java/src/org/apache/xindice/core Collection.java
               java/src/org/apache/xindice/core/indexer
                        MemValueIndexer.java ValueIndexer.java
               java/src/org/apache/xindice/tools/command AddCollection.java
                        ExportTree.java
               java/src/org/apache/xindice/xml NamespaceMap.java
  Log:
  Bug #33600: Cleanup. Thanks to Dave Brosius <db...@qis.net>
  
  Revision  Changes    Path
  1.53      +3 -3      xml-xindice/java/src/org/apache/xindice/core/Collection.java
  
  Index: Collection.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/Collection.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Collection.java	20 Mar 2004 13:43:23 -0000	1.52
  +++ Collection.java	16 Feb 2005 13:59:49 -0000	1.53
  @@ -1010,7 +1010,7 @@
                   temp.add(key.toString());
               }
   
  -            return (String[]) temp.toArray(new String[0]);
  +            return (String[]) temp.toArray(new String[temp.size()]);
           }
       }
   
  
  
  
  1.10      +3 -3      xml-xindice/java/src/org/apache/xindice/core/indexer/MemValueIndexer.java
  
  Index: MemValueIndexer.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/MemValueIndexer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MemValueIndexer.java	20 Jul 2004 20:31:37 -0000	1.9
  +++ MemValueIndexer.java	16 Feb 2005 13:59:49 -0000	1.10
  @@ -974,7 +974,7 @@
                       //break;
                   case BOOLEAN:
                       // represented a a Byte of 0 (false) or 1 (true) so Comparable is implemented (true > false)
  -                    return "[true][yes][1][y][on]".indexOf("[" + theValue.toString().toLowerCase() + "]") == -1 ? new Byte((byte) 0) : new Byte((byte) 1);
  +                    return "[true][yes][1][y][on]".indexOf("[" + theValue.toLowerCase() + "]") == -1 ? new Byte((byte) 0) : new Byte((byte) 1);
                       //break;
               }
           } catch (Exception anException) {
  
  
  
  1.20      +4 -4      xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java
  
  Index: ValueIndexer.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ValueIndexer.java	20 Mar 2004 14:02:38 -0000	1.19
  +++ ValueIndexer.java	16 Feb 2005 13:59:49 -0000	1.20
  @@ -221,9 +221,9 @@
                           b[1] = (byte) ((c >>> 0) & 0xFF);
                           break;
                       case BOOLEAN:
  -                        if ("[true][yes][1][y][on]".indexOf("[" + value.toString().toLowerCase() + "]") != -1) {
  +                        if ("[true][yes][1][y][on]".indexOf("[" + value.toLowerCase() + "]") != -1) {
                               b[0] = 1;
  -                        } else if ("[false][no][0][n][off]".indexOf("[" + value.toString().toLowerCase() + "]") != -1) {
  +                        } else if ("[false][no][0][n][off]".indexOf("[" + value.toLowerCase() + "]") != -1) {
                               b[0] = 0;
                           } else {
                               return EmptyValue;
  
  
  
  1.12      +8 -14     xml-xindice/java/src/org/apache/xindice/tools/command/AddCollection.java
  
  Index: AddCollection.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/AddCollection.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AddCollection.java	8 Feb 2004 02:57:35 -0000	1.11
  +++ AddCollection.java	16 Feb 2005 13:59:49 -0000	1.12
  @@ -54,28 +54,22 @@
                                                             (String) table.get(XMLTools.LOCAL));
   
                   col = DatabaseManager.getCollection(colstring);
  -
                   if (col == null) {
                       System.out.println("ERROR : Collection not found!");
                       return false;
                   }
   
  -                String newcol = (String) table.get(XMLTools.NAME_OF);
  -
                   // Create an instance of the collection manager and create the collection
  -
                   CollectionManager colman = (CollectionManager) col.getService("CollectionManager", XMLDBAPIVERSION);
   
  +                String colPath = (String) table.get(XMLTools.NAME_OF);
                   String colName = "";
  -                String parName = newcol;
  -
  -                int idx = parName.lastIndexOf("/");
   
  +                int idx = colPath.lastIndexOf("/");
                   if (idx != -1) {
  -                    colName = parName.substring(idx + 1);
  -                    parName = parName.substring(0, idx);
  +                    colName = colPath.substring(idx + 1);
                   } else if (idx == -1) {
  -                    colName = parName;
  +                    colName = colPath;
                   }
   
                   if (colName.equals("")) {
  @@ -105,9 +99,9 @@
   
                   colEle.appendChild(filEle);
   
  -                tempcol = colman.createCollection(newcol, doc);
  +                tempcol = colman.createCollection(colPath, doc);
   
  -                System.out.println("Created : " + table.get(XMLTools.COLLECTION) + "/" + newcol);
  +                System.out.println("Created : " + table.get(XMLTools.COLLECTION) + "/" + colPath);
               } else {
                   System.out.println("ERROR : Collection Context and New Collection name required");
               }
  
  
  
  1.12      +6 -12     xml-xindice/java/src/org/apache/xindice/tools/command/ExportTree.java
  
  Index: ExportTree.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/ExportTree.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ExportTree.java	8 Feb 2004 02:57:35 -0000	1.11
  +++ ExportTree.java	16 Feb 2005 13:59:49 -0000	1.12
  @@ -75,18 +75,12 @@
       }
   
       private String parentDir(String parent) {
  -        String dirName = "";
  -        String parName = parent;
  -
  -        int idx = parName.lastIndexOf("/");
  -
  +        int idx = parent.lastIndexOf("/");
           if (idx != -1) {
  -            dirName = parName.substring(idx + 1);
  -            parName = parName.substring(0, idx);
  -        } else if (idx == -1) {
  -            dirName = parName;
  +            return parent.substring(idx + 1);
  +        } else {
  +            return parent;
           }
  -        return dirName;
       }
   
       /**
  
  
  
  1.11      +8 -6      xml-xindice/java/src/org/apache/xindice/xml/NamespaceMap.java
  
  Index: NamespaceMap.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/xml/NamespaceMap.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NamespaceMap.java	24 Feb 2004 03:20:27 -0000	1.10
  +++ NamespaceMap.java	16 Feb 2005 13:59:49 -0000	1.11
  @@ -54,13 +54,15 @@
               Document d = new DocumentImpl();
               elem = d.createElement("nsmap");
               d.appendChild(elem);
  -            Iterator i = keySet().iterator();
  +            Iterator i = entrySet().iterator();
               while (i.hasNext()) {
  -                String pfx = (String) i.next();
  +                Map.Entry entry = (Map.Entry) i.next();
  +                String pfx = (String) entry.getKey();
  +                String uri = (String) entry.getValue();
                   if (pfx.equals("")) {
  -                    elem.setAttribute("xmlns", (String) get(pfx));
  +                    elem.setAttribute("xmlns", uri);
                   } else {
  -                    elem.setAttribute("xmlns:" + pfx, (String) get(pfx));
  +                    elem.setAttribute("xmlns:" + pfx, uri);
                   }
               }
           }