Skip to content
Snippets Groups Projects
Commit 844419fb authored by srosse's avatar srosse
Browse files

OO-3543: catch errors on initialization of the InterWikiHandler

parent 86eda3ce
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,7 @@ public class OlatWikiDataHandler implements DataHandler { ...@@ -68,6 +68,7 @@ public class OlatWikiDataHandler implements DataHandler {
* @see org.jamwiki.DataHandler#lookupTopic(java.lang.String, * @see org.jamwiki.DataHandler#lookupTopic(java.lang.String,
* java.lang.String, boolean, java.lang.Object) * java.lang.String, boolean, java.lang.Object)
*/ */
@Override
public Topic lookupTopic(String virtualWiki, String topicName, boolean deleteOK, Object transactionObject) throws Exception { public Topic lookupTopic(String virtualWiki, String topicName, boolean deleteOK, Object transactionObject) throws Exception {
String decodedName = null; String decodedName = null;
...@@ -114,6 +115,7 @@ public class OlatWikiDataHandler implements DataHandler { ...@@ -114,6 +115,7 @@ public class OlatWikiDataHandler implements DataHandler {
* @see org.jamwiki.DataHandler#lookupWikiFile(java.lang.String, * @see org.jamwiki.DataHandler#lookupWikiFile(java.lang.String,
* java.lang.String) * java.lang.String)
*/ */
@Override
public WikiFile lookupWikiFile(String virtualWiki, String topicName) throws Exception { public WikiFile lookupWikiFile(String virtualWiki, String topicName) throws Exception {
WikiFile wikifile = new WikiFile(); WikiFile wikifile = new WikiFile();
if (topicName.startsWith(IMAGE_NAMESPACE)) { if (topicName.startsWith(IMAGE_NAMESPACE)) {
...@@ -131,17 +133,23 @@ public class OlatWikiDataHandler implements DataHandler { ...@@ -131,17 +133,23 @@ public class OlatWikiDataHandler implements DataHandler {
/** /**
* @see org.jamwiki.DataHandler#exists(java.lang.String, java.lang.String) * @see org.jamwiki.DataHandler#exists(java.lang.String, java.lang.String)
*/ */
@Override
public boolean exists(String virtualWiki, String topic) { public boolean exists(String virtualWiki, String topic) {
if (!StringUtils.hasText(topic)) { return false; } if (!StringUtils.hasText(topic)) {
if (PseudoTopicHandler.isPseudoTopic(topic)) { return true; } return false;
if (InterWikiHandler.isInterWiki(topic)) { return true; } }
if (PseudoTopicHandler.isPseudoTopic(topic)) {
// try { return true;
// Utilities.validateTopicName(topic); }
// } catch (WikiException e) {
// throw new OLATRuntimeException(this.getClass(), "invalid topic name!", e); try {
// } if (InterWikiHandler.isInterWiki(topic)) {
return true;
}
} catch (Exception e) {
log.warn("Cannot initialize InterWikiHandler", e);
}
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores); Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
if (topic.startsWith(IMAGE_NAMESPACE) || topic.startsWith(MEDIA_NAMESPACE)) { if (topic.startsWith(IMAGE_NAMESPACE) || topic.startsWith(MEDIA_NAMESPACE)) {
return wiki.pageExists(topic); return wiki.pageExists(topic);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment