mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-06-23 04:26:07 -04:00
fix NPE on empty blog importfile parameter
This commit is contained in:
@ -77,9 +77,9 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="hidden" name="page" value="#[pageid]#" />
|
||||
<input type="submit" name="submit" value="Submit" />
|
||||
<input type="submit" name="preview" value="Preview" />
|
||||
<input type="submit" name="discard" value="Discard" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Submit" />
|
||||
<input type="submit" name="preview" class="btn btn-default" value="Preview" />
|
||||
<input type="submit" name="discard" class="btn btn-danger" value="Discard" />
|
||||
</fieldset>
|
||||
</form>
|
||||
::
|
||||
@ -121,9 +121,9 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="hidden" name="page" value="#[pageid]#" />
|
||||
<input type="submit" name="submit" value="Submit" />
|
||||
<input type="submit" name="preview" value="Preview" />
|
||||
<input type="submit" name="discard" value="Discard" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Submit" />
|
||||
<input type="submit" name="preview" class="btn btn-default" value="Preview" />
|
||||
<input type="submit" name="discard" class="btn btn-danger" value="Discard" />
|
||||
</fieldset>
|
||||
</form>
|
||||
::
|
||||
@ -138,10 +138,10 @@
|
||||
<form action="Blog.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input type="hidden" name="delete" value="sure" />
|
||||
<input type="hidden" name="page" value="#[pageid]#" />
|
||||
<input type="submit" value="Yes, delete it." />
|
||||
<input type="submit" class="btn btn-danger" value="Yes, delete it." />
|
||||
</form>
|
||||
<form action="Blog.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input type="submit" value="No, leave it." />
|
||||
<input type="submit" class="btn btn-primary" value="No, leave it." />
|
||||
</form>
|
||||
</fieldset>
|
||||
::
|
||||
@ -157,7 +157,7 @@
|
||||
<form action="Blog.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<fieldset>
|
||||
<input type="file" size="50" name="xmlfile" />
|
||||
<input type="submit" name="importxml" value="Import" />
|
||||
<input type="submit" name="importxml" class="btn btn-primary" value="Import" />
|
||||
</fieldset>
|
||||
</form>
|
||||
#(/mode)#
|
||||
|
@ -70,9 +70,9 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="hidden" name="page" value="#[pageid]#" />
|
||||
<input type="submit" name="submit" value="Submit" />
|
||||
<input type="submit" name="preview" value="Preview" />
|
||||
<input type="submit" name="view" value="Discard" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Submit" />
|
||||
<input type="submit" name="preview" class="btn btn-default" value="Preview" />
|
||||
<input type="submit" name="view" class="btn btn-danger" value="Discard" />
|
||||
</fieldset>
|
||||
</form>
|
||||
#(/allow)#
|
||||
@ -109,9 +109,9 @@
|
||||
</dl>
|
||||
<input type="hidden" name="page" value="#[pageid]#" />
|
||||
<!-- <input type="text" name="page" value="#[pageid]#" /> -->
|
||||
<input type="submit" name="submit" value="Submit" />
|
||||
<input type="submit" name="preview" value="Preview" />
|
||||
<input type="submit" name="view" value="Discard" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Submit" />
|
||||
<input type="submit" name="preview" class="btn btn-default" value="Preview" />
|
||||
<input type="submit" name="view" class="btn btn-danger" value="Discard" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
@ -159,18 +159,19 @@ public class BlogBoard {
|
||||
}
|
||||
|
||||
public boolean importXML(final String input) {
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
final DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
return parseXMLimport(builder.parse(new ByteArrayInputStream(UTF8.getBytes(input))));
|
||||
} catch (final ParserConfigurationException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
} catch (final SAXException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
} catch (final IOException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
if (input != null && !input.isEmpty()) {
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
final DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
return parseXMLimport(builder.parse(new ByteArrayInputStream(UTF8.getBytes(input))));
|
||||
} catch (final ParserConfigurationException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
} catch (final SAXException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
} catch (final IOException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user