|
Lines 159-164
Link Here
|
| 159 |
private boolean isValidation = false; |
159 |
private boolean isValidation = false; |
| 160 |
|
160 |
|
| 161 |
private boolean lastModifiedSupported = true; |
161 |
private boolean lastModifiedSupported = true; |
|
|
162 |
|
| 163 |
private BugzillaLanguageSettings languageSettings; |
| 162 |
|
164 |
|
| 163 |
private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { |
165 |
private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { |
| 164 |
public BugzillaRetryHandler() { |
166 |
public BugzillaRetryHandler() { |
|
Lines 180-190
Link Here
|
| 180 |
|
182 |
|
| 181 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
183 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
| 182 |
String characterEncoding) { |
184 |
String characterEncoding) { |
| 183 |
this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>()); |
185 |
this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), BugzillaCorePlugin.getLanguageSettings("en")); |
| 184 |
} |
186 |
} |
| 185 |
|
187 |
|
| 186 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
188 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
| 187 |
String characterEncoding, Map<String, String> configParameters) { |
189 |
String characterEncoding, Map<String, String> configParameters, BugzillaLanguageSettings languageSettings) { |
| 188 |
this.username = username; |
190 |
this.username = username; |
| 189 |
this.password = password; |
191 |
this.password = password; |
| 190 |
this.repositoryUrl = url; |
192 |
this.repositoryUrl = url; |
|
Lines 192-197
Link Here
|
| 192 |
this.htAuthPass = htAuthPass; |
194 |
this.htAuthPass = htAuthPass; |
| 193 |
this.characterEncoding = characterEncoding; |
195 |
this.characterEncoding = characterEncoding; |
| 194 |
this.configParameters = configParameters; |
196 |
this.configParameters = configParameters; |
|
|
197 |
this.languageSettings = languageSettings; |
| 195 |
} |
198 |
} |
| 196 |
|
199 |
|
| 197 |
public void validate() throws IOException, CoreException { |
200 |
public void validate() throws IOException, CoreException { |
|
Lines 807-812
Link Here
|
| 807 |
boolean existingBugPosted = false; |
810 |
boolean existingBugPosted = false; |
| 808 |
boolean isTitle = false; |
811 |
boolean isTitle = false; |
| 809 |
String title = ""; |
812 |
String title = ""; |
|
|
813 |
|
| 810 |
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { |
814 |
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { |
| 811 |
|
815 |
|
| 812 |
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE |
816 |
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE |
|
Lines 823-829
Link Here
|
| 823 |
} else if (token.getType() == Token.TAG |
827 |
} else if (token.getType() == Token.TAG |
| 824 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
828 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
| 825 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
829 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
| 826 |
if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf("processed") != -1)) { |
830 |
|
|
|
831 |
|
| 832 |
|
| 833 |
if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf(languageSettings.getProcessed()) != -1)) { |
| 827 |
existingBugPosted = true; |
834 |
existingBugPosted = true; |
| 828 |
} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null |
835 |
} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null |
| 829 |
&& postfix2 != null) { |
836 |
&& postfix2 != null) { |
|
Lines 1019-1025
Link Here
|
| 1019 |
String body = ""; |
1026 |
String body = ""; |
| 1020 |
|
1027 |
|
| 1021 |
try { |
1028 |
try { |
| 1022 |
|
|
|
| 1023 |
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { |
1029 |
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { |
| 1024 |
body += token.toString(); |
1030 |
body += token.toString(); |
| 1025 |
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE |
1031 |
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE |
|
Lines 1037-1055
Link Here
|
| 1037 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
1043 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
| 1038 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
1044 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
| 1039 |
|
1045 |
|
| 1040 |
if (title.indexOf("login") != -1 || title.indexOf("log in") != -1 |
1046 |
languageSettings.getProcessed(); |
| 1041 |
|| (title.indexOf("invalid") != -1 && title.indexOf("password") != -1) |
1047 |
if (title.indexOf(languageSettings.getLogin()) != -1 |
| 1042 |
|| title.indexOf("check e-mail") != -1) { |
1048 |
|| (title.indexOf(languageSettings.getInvalid()) != -1 && title.indexOf(languageSettings.getPassword()) != -1) |
|
|
1049 |
|| title.indexOf(languageSettings.getCheckEmail()) != -1) { |
| 1043 |
authenticated = false; |
1050 |
authenticated = false; |
| 1044 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
1051 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
| 1045 |
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); |
1052 |
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); |
| 1046 |
} else if (title.indexOf(IBugzillaConstants.ERROR_MIDAIR_COLLISION) != -1) { |
1053 |
} else if (title.indexOf(languageSettings.getMidairCollision()) != -1) { |
| 1047 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
1054 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
| 1048 |
RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); |
1055 |
RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); |
| 1049 |
} else if (title.indexOf(IBugzillaConstants.ERROR_COMMENT_REQUIRED) != -1) { |
1056 |
} else if (title.indexOf(languageSettings.getCommentRequired()) != -1) { |
| 1050 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
1057 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
| 1051 |
RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); |
1058 |
RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); |
| 1052 |
} else if (title.indexOf(IBugzillaConstants.LOGGED_OUT) != -1) { |
1059 |
} else if (title.indexOf(languageSettings.getLoggedOut()) != -1) { |
| 1053 |
authenticated = false; |
1060 |
authenticated = false; |
| 1054 |
// throw new |
1061 |
// throw new |
| 1055 |
// BugzillaException(IBugzillaConstants.LOGGED_OUT); |
1062 |
// BugzillaException(IBugzillaConstants.LOGGED_OUT); |