Project

General

Profile

« Previous | Next » 

Revision 2918

Added by sgarg almost 19 years ago

Fix in getNamespace function. Bug reported by Margaret in testing for cases where no namespace is specified.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
1988 1988
            return namespace;
1989 1989
        }
1990 1990
        String targetLine = getSchemaLine(xml);
1991

  
1991
		
1992 1992
        if (targetLine != null) {
1993 1993

  
1994 1994
        	// find if the root element has prefix
......
2120 2120
    {
2121 2121
        Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
2122 2122
    	String prefix = null;
2123
    	String rootElement = schemaLine.substring(0, schemaLine.indexOf(" "));
2124
        logMetacat.debug("rootElement:" + rootElement);
2123
		if(schemaLine.indexOf(" ") > 0){
2124
    		String rootElement = schemaLine.substring(0, schemaLine.indexOf(" "));
2125
        	logMetacat.debug("rootElement:" + rootElement);
2125 2126
        
2126
        if(rootElement.indexOf(":") > 0){
2127
        	prefix = rootElement.substring(rootElement.indexOf(":") + 1,
2127
        	if(rootElement.indexOf(":") > 0){
2128
        		prefix = rootElement.substring(rootElement.indexOf(":") + 1,
2128 2129
        			rootElement.length());
2129
        }
2130
        	}
2130 2131

  
2131
	if(prefix != null){
2132
        	return prefix.trim();
2133
	}
2134

  
2135
	return null;
2132
			if(prefix != null){
2133
        		return prefix.trim();
2134
			}
2135
		}
2136
		return null;
2136 2137
    }
2137 2138

  
2138 2139
    /**

Also available in: Unified diff