Author: natalia Date: Thu Aug 30 18:49:58 2007 New Revision: 571354 URL: http://svn.apache.org/viewvc?rev=571354&view=rev Log: Check configuration top element
Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/CollectionManager.java xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/CollectionManager.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/CollectionManager.java?rev=571354&r1=571353&r2=571354&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/core/CollectionManager.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/core/CollectionManager.java Thu Aug 30 18:49:58 2007 @@ -89,6 +89,11 @@ throw new DBException(FaultCodes.COL_CANNOT_CREATE, "Error creating collection '" + path + "': null config"); } + if (!COLLECTION.equals(cfg.getName())) { + throw new DBException(FaultCodes.COL_CANNOT_CREATE, + "Cannot create collection " + path + + ". Collection configuration top element must be '" + COLLECTION + "'"); + } if (path.indexOf("/") != -1) { CollectionManager cm = this; Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java?rev=571354&r1=571353&r2=571354&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java Thu Aug 30 18:49:58 2007 @@ -180,6 +180,11 @@ * @throws DBException if unable to create specified indexer */ public synchronized Indexer create(Configuration cfg) throws DBException { + if (!INDEX.equals(cfg.getName())) { + throw new CannotCreateException("Cannot create index in " + collection.getCanonicalName() + + ". Index configuration top element must be 'index'"); + } + String name = cfg.getAttribute(NAME); try { // Check for duplicates