import java.util.regex.Pattern;
import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia;
-import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.WikipediaDE;
import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.MethodException;
import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.PageNotEditableException;
import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.UnexpectedAnswerException;
} else if (responseCode == 200 && responseBody.matches(config.getLoginWrongPw()) || responseCode == 200
&& responseBody.matches(config.getLoginNoUser())) {
result = false;
+ if (responseBody.matches(config.getLoginNoUser())) {
+ throw new UnexpectedAnswerException("login not successful: wrong user name: "+user);
+ } else if (responseBody.matches(config.getLoginWrongPw())) {
+ throw new UnexpectedAnswerException("login not successful: wrong password for user: "+user);
+ } else {
+ throw new UnexpectedAnswerException("logout not successful: responseCode == 200");
+ }
} else {
throw new UnexpectedAnswerException("login not successful: " + method.getStatusLine());
}
} else if (responseCode == 200) {
//### should check for a failure message
result = false;
+ throw new UnexpectedAnswerException("logout not successful: responseCode == 200");
} else {
throw new UnexpectedAnswerException("logout not successful: " + method.getStatusLine());
}
return result;
}
- public ArrayList loadXML(IWikipedia config, String actionURL, String pages) throws UnexpectedAnswerException, MethodException {
+ public ArrayList loadXML(IWikipedia config, String actionURL, String pages) throws UnexpectedAnswerException, MethodException , InterruptedException{
+ storeThrottle.delay();
PostMethod method = new PostMethod(actionURL);
method.setFollowRedirects(false);
method.addRequestHeader("User-Agent", userAgent);
} catch (UnexpectedAnswerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (MethodException e) {
+ } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}