Revision 2922
Added by Matt Jones almost 19 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
2132 | 2132 |
private String getPrefix(String schemaLine) |
2133 | 2133 |
{ |
2134 | 2134 |
Logger logMetacat = Logger.getLogger(MetaCatServlet.class); |
2135 |
String prefix = null; |
|
2136 |
if(schemaLine.indexOf(" ") > 0){ |
|
2137 |
String rootElement = schemaLine.substring(0, schemaLine.indexOf(" ")); |
|
2138 |
logMetacat.debug("rootElement:" + rootElement); |
|
2135 |
String prefix = null; |
|
2136 |
if(schemaLine.indexOf(" ") > 0){ |
|
2137 |
String rootElement = ""; |
|
2138 |
try { |
|
2139 |
rootElement = schemaLine.substring(0, schemaLine.indexOf(" ")); |
|
2140 |
} catch (StringIndexOutOfBoundsException sioobe) { |
|
2141 |
rootElement = schemaLine; |
|
2142 |
} |
|
2143 |
|
|
2144 |
logMetacat.debug("rootElement:" + rootElement); |
|
2139 | 2145 |
|
2140 |
if(rootElement.indexOf(":") > 0){
|
|
2141 |
prefix = rootElement.substring(rootElement.indexOf(":") + 1,
|
|
2142 |
rootElement.length());
|
|
2143 |
}
|
|
2146 |
if(rootElement.indexOf(":") > 0){
|
|
2147 |
prefix = rootElement.substring(rootElement.indexOf(":") + 1,
|
|
2148 |
rootElement.length());
|
|
2149 |
}
|
|
2144 | 2150 |
|
2145 |
if(prefix != null){
|
|
2146 |
return prefix.trim();
|
|
2147 |
}
|
|
2148 |
}
|
|
2149 |
return null;
|
|
2151 |
if(prefix != null){
|
|
2152 |
return prefix.trim();
|
|
2153 |
}
|
|
2154 |
}
|
|
2155 |
return null;
|
|
2150 | 2156 |
} |
2151 | 2157 |
|
2152 | 2158 |
/** |
Also available in: Unified diff
Patched to fix regression bug that prevented insertion of documents
without a DOCTYPE or namespace declaration due to an
ArrayOutOfBoundsException. Now these documents can be inserted, which
is useful for inserting FGDC documents that frequently do not have a
namespace declared.