|
Lines 50-55
Link Here
|
| 50 |
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery; |
50 |
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery; |
| 51 |
import org.eclipse.mylyn.tasks.core.ITaskAttachment; |
51 |
import org.eclipse.mylyn.tasks.core.ITaskAttachment; |
| 52 |
import org.eclipse.mylyn.tasks.core.ITaskCollector; |
52 |
import org.eclipse.mylyn.tasks.core.ITaskCollector; |
|
|
53 |
import org.eclipse.mylyn.tasks.core.LanguageSettings; |
| 53 |
import org.eclipse.mylyn.tasks.core.QueryHitCollector; |
54 |
import org.eclipse.mylyn.tasks.core.QueryHitCollector; |
| 54 |
import org.eclipse.mylyn.tasks.core.RepositoryOperation; |
55 |
import org.eclipse.mylyn.tasks.core.RepositoryOperation; |
| 55 |
import org.eclipse.mylyn.tasks.core.RepositoryStatus; |
56 |
import org.eclipse.mylyn.tasks.core.RepositoryStatus; |
|
Lines 160-166
Link Here
|
| 160 |
|
161 |
|
| 161 |
private boolean lastModifiedSupported = true; |
162 |
private boolean lastModifiedSupported = true; |
| 162 |
|
163 |
|
| 163 |
private BugzillaLanguageSettings languageSettings; |
164 |
private LanguageSettings languageSettings; |
| 164 |
|
165 |
|
| 165 |
private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { |
166 |
private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { |
| 166 |
public BugzillaRetryHandler() { |
167 |
public BugzillaRetryHandler() { |
|
Lines 183-193
Link Here
|
| 183 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
184 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
| 184 |
String characterEncoding) { |
185 |
String characterEncoding) { |
| 185 |
this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), |
186 |
this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), |
| 186 |
BugzillaCorePlugin.getLanguageSettings("en")); |
187 |
BugzillaCorePlugin.getDefault().getLanguageSetting("en")); |
| 187 |
} |
188 |
} |
| 188 |
|
189 |
|
| 189 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
190 |
public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, |
| 190 |
String characterEncoding, Map<String, String> configParameters, BugzillaLanguageSettings languageSettings) { |
191 |
String characterEncoding, Map<String, String> configParameters, LanguageSettings languageSettings) { |
| 191 |
this.username = username; |
192 |
this.username = username; |
| 192 |
this.password = password; |
193 |
this.password = password; |
| 193 |
this.repositoryUrl = url; |
194 |
this.repositoryUrl = url; |
|
Lines 835-842
Link Here
|
| 835 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
836 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
| 836 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
837 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
| 837 |
|
838 |
|
| 838 |
if (!taskData.isNew() |
839 |
boolean found = false; |
| 839 |
&& (title.toLowerCase(Locale.ENGLISH).indexOf(languageSettings.getProcessed()) != -1)) { |
840 |
for (Iterator<String> iterator = languageSettings.getProcessed().iterator(); iterator.hasNext() && !found;) { |
|
|
841 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 842 |
found = found || title.indexOf(value) != -1; |
| 843 |
} |
| 844 |
|
| 845 |
if (!taskData.isNew() && found) { |
| 840 |
existingBugPosted = true; |
846 |
existingBugPosted = true; |
| 841 |
} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null |
847 |
} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null |
| 842 |
&& postfix2 != null) { |
848 |
&& postfix2 != null) { |
|
Lines 1048-1077
Link Here
|
| 1048 |
} else if (token.getType() == Token.TAG |
1054 |
} else if (token.getType() == Token.TAG |
| 1049 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
1055 |
&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE |
| 1050 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
1056 |
&& ((HtmlTag) token.getValue()).isEndTag()) { |
| 1051 |
|
1057 |
|
| 1052 |
if (title.indexOf(languageSettings.getLogin()) != -1 |
1058 |
boolean found = false; |
| 1053 |
|| (title.indexOf(languageSettings.getInvalid()) != -1 && title.indexOf(languageSettings.getPassword()) != -1) |
1059 |
for (Iterator<String> iterator = languageSettings.getErrorLogin().iterator(); iterator.hasNext() && !found;) { |
| 1054 |
|| title.indexOf(languageSettings.getCheckEmail()) != -1 |
1060 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 1055 |
|| (languageSettings.getLogin2() != null && title.indexOf(languageSettings.getLogin2()) != -1)) { |
1061 |
found = found || title.indexOf(value) != -1; |
|
|
1062 |
int i = 12; |
| 1063 |
i = i +2; |
| 1064 |
} |
| 1065 |
if (found) { |
| 1056 |
authenticated = false; |
1066 |
authenticated = false; |
| 1057 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
1067 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
| 1058 |
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); |
1068 |
RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); |
| 1059 |
} else if (title.indexOf(languageSettings.getMidairCollision()) != -1) { |
1069 |
} |
|
|
1070 |
found = false; |
| 1071 |
for (Iterator<String> iterator = languageSettings.getErrorCollision().iterator(); iterator.hasNext() && !found;) { |
| 1072 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 1073 |
found = found || title.indexOf(value) != -1; |
| 1074 |
} |
| 1075 |
if (found) { |
| 1060 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
1076 |
throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, |
| 1061 |
RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); |
1077 |
RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); |
| 1062 |
} else if (title.indexOf(languageSettings.getCommentRequired()) != -1) { |
1078 |
} |
|
|
1079 |
found = false; |
| 1080 |
for (Iterator<String> iterator = languageSettings.getErrorCommentReqired().iterator(); iterator.hasNext() && !found;) { |
| 1081 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 1082 |
found = found || title.indexOf(value) != -1; |
| 1083 |
} |
| 1084 |
if (found) { |
| 1063 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
1085 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
| 1064 |
RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); |
1086 |
RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); |
| 1065 |
} else if (title.indexOf(languageSettings.getLoggedOut()) != -1) { |
1087 |
} |
|
|
1088 |
found = false; |
| 1089 |
for (Iterator<String> iterator = languageSettings.getErrorLoggedOut().iterator(); iterator.hasNext() && !found;) { |
| 1090 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 1091 |
found = found || title.indexOf(value) != -1; |
| 1092 |
} |
| 1093 |
if (found) { |
| 1066 |
authenticated = false; |
1094 |
authenticated = false; |
| 1067 |
// throw new |
1095 |
// throw new |
| 1068 |
// BugzillaException(IBugzillaConstants.LOGGED_OUT); |
1096 |
// BugzillaException(IBugzillaConstants.LOGGED_OUT); |
| 1069 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
1097 |
throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, |
| 1070 |
RepositoryStatus.REPOSITORY_LOGGED_OUT, |
1098 |
RepositoryStatus.REPOSITORY_LOGGED_OUT, |
| 1071 |
"You have been logged out. Please retry operation.")); |
1099 |
"You have been logged out. Please retry operation.")); |
| 1072 |
} else if (title.indexOf(IBugzillaConstants.CHANGES_SUBMITTED) != -1) { |
1100 |
} |
|
|
1101 |
found = false; |
| 1102 |
for (Iterator<String> iterator = languageSettings.getChangesSubmitted().iterator(); iterator.hasNext() && !found;) { |
| 1103 |
String value = iterator.next().toLowerCase(Locale.ENGLISH); |
| 1104 |
found = found || title.indexOf(value) != -1; |
| 1105 |
} |
| 1106 |
if (found) { |
| 1073 |
return; |
1107 |
return; |
| 1074 |
} |
1108 |
} |
|
|
1109 |
isTitle = false; |
| 1075 |
} |
1110 |
} |
| 1076 |
} |
1111 |
} |
| 1077 |
} |
1112 |
} |
|
Lines 1100-1106
Link Here
|
| 1100 |
method = getConnectGzip(url); |
1135 |
method = getConnectGzip(url); |
| 1101 |
if (method != null) { |
1136 |
if (method != null) { |
| 1102 |
BugzillaTaskHistoryParser parser = new BugzillaTaskHistoryParser( |
1137 |
BugzillaTaskHistoryParser parser = new BugzillaTaskHistoryParser( |
| 1103 |
method.getResponseBodyAsUnzippedStream(), characterEncoding); |
1138 |
method.getResponseBodyAsUnzippedStream(), characterEncoding,languageSettings); |
| 1104 |
try { |
1139 |
try { |
| 1105 |
return parser.retrieveHistory(); |
1140 |
return parser.retrieveHistory(); |
| 1106 |
} catch (LoginException e) { |
1141 |
} catch (LoginException e) { |