Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 79854 Details for
Bug 173352
Make parsed post success string/regexp a preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch New implementation as in comment 9 and comment 11
patch173352.txt (text/plain), 19.48 KB, created by
Frank Becker
on 2007-10-07 16:03:49 EDT
(
hide
)
Description:
Patch New implementation as in comment 9 and comment 11
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-10-07 16:03:49 EDT
Size:
19.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java,v >retrieving revision 1.70 >diff -u -r1.70 BugzillaRepositorySettingsPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 4 Oct 2007 22:12:01 -0000 1.70 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 7 Oct 2007 19:45:38 -0000 >@@ -84,6 +84,8 @@ > private String platform = null; > > private String os = null; >+ >+ private Combo languageSettingCombo; > > public BugzillaRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) { > super(TITLE, DESCRIPTION, repositoryUi); >@@ -265,6 +267,36 @@ > defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY); > populateOsCombo(); > >+ new Label(parent, SWT.NONE).setText("Language : "); >+ languageSettingCombo = new Combo(parent, SWT.DROP_DOWN); >+ >+ for (String languageSettings : BugzillaCorePlugin.getLanguageSettings().keySet()) { >+ languageSettingCombo.add(languageSettings); >+ } >+// languageSettingCombo.addSelectionListener(new SelectionAdapter() { >+// @Override >+// public void widgetSelected(SelectionEvent e) { >+// String text = languageSettingCombo.getText(); >+//// RepositoryTemplate template = connector.getTemplate(text); >+//// if (template != null) { >+//// repositoryLabelEditor.setStringValue(template.label); >+//// setUrl(template.repositoryUrl); >+//// // setAnonymous(info.anonymous); >+//// setBugzillaVersion(template.version); >+//// if (template.characterEncoding != null) { >+//// setEncoding(template.characterEncoding); >+//// } >+// getContainer().updateButtons(); >+// return; >+//// } >+// } >+// }); >+ if (repository != null) { >+ String language = repository.getProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING); >+ if (language != null && !language.equals("")) >+ languageSettingCombo.select(languageSettingCombo.indexOf(language)); >+ } >+ > } > > private void populateOsCombo() { >@@ -346,6 +378,9 @@ > public void updateProperties(TaskRepository repository) { > repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN, > String.valueOf(cleanQAContact.getSelection())); >+ repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING, >+ languageSettingCombo.getText()); >+ > // if (cachedConfigButton.getSelection()) { > // repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, ""); > // } else { >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java,v >retrieving revision 1.8 >diff -u -r1.8 BugzillaClientManager.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java 26 Jun 2007 01:16:07 -0000 1.8 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java 7 Oct 2007 19:46:09 -0000 >@@ -33,9 +33,16 @@ > String htUser = taskRepository.getHttpUser() != null ? taskRepository.getHttpUser() : ""; > String htPass = taskRepository.getHttpPassword() != null ? taskRepository.getHttpPassword() : ""; > >+ String language = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING); >+ if (language == null || language.equals("")) { >+ language = "en"; >+ } >+ BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getLanguageSettings(language); >+ >+ > client = BugzillaClientFactory.createClient(taskRepository.getUrl(), taskRepository.getUserName(), > taskRepository.getPassword(), htUser, htPass, taskRepository.getProxy(), >- taskRepository.getCharacterEncoding(), taskRepository.getProperties()); >+ taskRepository.getCharacterEncoding(), taskRepository.getProperties(),languageSettings); > clientByUrl.put(taskRepository.getUrl(), client); > } > return client; >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java,v >retrieving revision 1.16 >diff -u -r1.16 BugzillaCorePlugin.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java 29 Aug 2007 18:03:33 -0000 1.16 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java 7 Oct 2007 19:46:15 -0000 >@@ -56,6 +56,13 @@ > /** Product configuration for the current server */ > private static Map<String, RepositoryConfiguration> repositoryConfigurations = new HashMap<String, RepositoryConfiguration>(); > >+ private static boolean cacheLanguageSettingsFileRead = false; >+ >+ private static File languageSettingsFile = null; >+ >+ private static Map<String, BugzillaLanguageSettings> bugzillaLanguageSettings = new HashMap<String, BugzillaLanguageSettings>(); >+ >+ > public BugzillaCorePlugin() { > super(); > java2buzillaPlatformMap.put("x86", "PC"); // can be PC or Macintosh! >@@ -74,6 +81,10 @@ > @Override > public void start(BundleContext context) throws Exception { > super.start(context); >+ IPath stateLocation = Platform.getStateLocation(this.getBundle()); >+ IPath languageLocationPath = stateLocation.append("languageSettings"); >+ languageSettingsFile = languageLocationPath.toFile(); >+ > INSTANCE = this; > } > >@@ -82,6 +93,11 @@ > if (!repositoryConfigurations.isEmpty()) { > writeRepositoryConfigFile(); > } >+ >+ if (!bugzillaLanguageSettings.isEmpty()) { >+ writeBugzillaLanguageSettingsFile(); >+ } >+ > INSTANCE = null; > super.stop(context); > } >@@ -362,4 +378,99 @@ > StatusHandler.fail(e, "could not set platform options", false); > } > } >+ >+ private static void setDefaultBugzillaLanguageSettings () { >+ bugzillaLanguageSettings.clear(); >+ bugzillaLanguageSettings.put("en", new BugzillaLanguageSettings("en", "check e-mail", "comment required", "invalid", >+ "logged out", "login", "collision", "password", "processed")); >+ >+ bugzillaLanguageSettings.put("de", new BugzillaLanguageSettings("de", "check e-mail", "Kommentar erforderlich", "Ungltig", >+ "logged out", "login", "Kollision", "password", "bearbeitet")); >+ >+ } >+ >+ private static void readBugzillaLanguageSettingsFile() { >+ if (!languageSettingsFile.exists()) { >+ setDefaultBugzillaLanguageSettings(); >+ return; >+ } >+ ObjectInputStream in = null; >+ try { >+ in = new ObjectInputStream(new FileInputStream(languageSettingsFile)); >+ int size = in.readInt(); >+ for (int nX = 0; nX < size; nX++) { >+ BugzillaLanguageSettings item = (BugzillaLanguageSettings) in.readObject(); >+ if (item != null) { >+ bugzillaLanguageSettings.put(item.getLanguageName(), item); >+ } >+ } >+ } catch (Exception e) { >+ log(e); >+ try { >+ if (in != null) { >+ in.close(); >+ } >+ if (languageSettingsFile != null && languageSettingsFile.exists()) { >+ if (languageSettingsFile.delete()) { >+ // successfully deleted >+ } else { >+ log(new Status(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, ERROR_DELETING_CONFIGURATION, e)); >+ } >+ } >+ >+ } catch (Exception ex) { >+ log(new Status(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, ERROR_DELETING_CONFIGURATION, e)); >+ } >+ } finally { >+ if (in != null) { >+ try { >+ in.close(); >+ } catch (IOException e) { >+ // ignore >+ } >+ } >+ } >+ } >+ >+ private static void writeBugzillaLanguageSettingsFile() { >+ if (languageSettingsFile != null) { >+ ObjectOutputStream out = null; >+ try { >+ out = new ObjectOutputStream(new FileOutputStream(languageSettingsFile)); >+ out.writeInt(bugzillaLanguageSettings.size()); >+ for (String key : bugzillaLanguageSettings.keySet()) { >+ BugzillaLanguageSettings item = bugzillaLanguageSettings.get(key); >+ if (item != null) { >+ out.writeObject(item); >+ } >+ } >+ } catch (IOException e) { >+ log(e); >+ } finally { >+ if (out != null) { >+ try { >+ out.close(); >+ } catch (IOException e) { >+ // ignore >+ } >+ } >+ } >+ } >+ } >+ >+ public static Map<String, BugzillaLanguageSettings> getLanguageSettings() { >+ if (!cacheLanguageSettingsFileRead) { >+ readBugzillaLanguageSettingsFile(); >+ cacheLanguageSettingsFileRead = true; >+ } >+ return bugzillaLanguageSettings; >+ } >+ >+ public static BugzillaLanguageSettings getLanguageSettings(String language) { >+ if (!cacheLanguageSettingsFileRead) { >+ readBugzillaLanguageSettingsFile(); >+ cacheLanguageSettingsFileRead = true; >+ } >+ return bugzillaLanguageSettings.get(language); >+ } > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java,v >retrieving revision 1.7 >diff -u -r1.7 BugzillaClientFactory.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java 10 Jul 2007 00:30:23 -0000 1.7 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java 7 Oct 2007 19:46:08 -0000 >@@ -21,17 +21,18 @@ > > public static BugzillaClient createClient(String hostUrl, String username, String password, String htAuthUser, > String htAuthPass, Proxy proxy, String encoding) throws MalformedURLException { >+ BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getLanguageSettings("en"); > return createClient(hostUrl, username, password, htAuthUser, htAuthPass, proxy, encoding, >- new HashMap<String, String>()); >+ new HashMap<String, String>(), languageSettings); > } > > public static BugzillaClient createClient(String hostUrl, String username, String password, String htAuthUser, >- String htAuthPass, Proxy proxy, String encoding, Map<String, String> configParameters) >+ String htAuthPass, Proxy proxy, String encoding, Map<String, String> configParameters, BugzillaLanguageSettings bugzillaLanguageSettings) > throws MalformedURLException { > URL url = new URL(hostUrl); > > BugzillaClient client = new BugzillaClient(url, username, password, htAuthUser, htAuthPass, encoding, >- configParameters); >+ configParameters, bugzillaLanguageSettings); > client.setProxy(proxy); > return client; > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.96 >diff -u -r1.96 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 5 Oct 2007 14:37:15 -0000 1.96 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 7 Oct 2007 19:46:08 -0000 >@@ -159,6 +159,8 @@ > private boolean isValidation = false; > > private boolean lastModifiedSupported = true; >+ >+ private BugzillaLanguageSettings languageSettings; > > private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { > public BugzillaRetryHandler() { >@@ -180,11 +182,11 @@ > > public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, > String characterEncoding) { >- this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>()); >+ this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), BugzillaCorePlugin.getLanguageSettings("en")); > } > > public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, >- String characterEncoding, Map<String, String> configParameters) { >+ String characterEncoding, Map<String, String> configParameters, BugzillaLanguageSettings languageSettings) { > this.username = username; > this.password = password; > this.repositoryUrl = url; >@@ -192,6 +194,7 @@ > this.htAuthPass = htAuthPass; > this.characterEncoding = characterEncoding; > this.configParameters = configParameters; >+ this.languageSettings = languageSettings; > } > > public void validate() throws IOException, CoreException { >@@ -807,6 +810,7 @@ > boolean existingBugPosted = false; > boolean isTitle = false; > String title = ""; >+ > for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { > > if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE >@@ -823,7 +827,10 @@ > } else if (token.getType() == Token.TAG > && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE > && ((HtmlTag) token.getValue()).isEndTag()) { >- if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf("processed") != -1)) { >+ >+ >+ >+ if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf(languageSettings.getProcessed()) != -1)) { > existingBugPosted = true; > } else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null > && postfix2 != null) { >@@ -1019,7 +1026,6 @@ > String body = ""; > > try { >- > for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { > body += token.toString(); > if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == HtmlTag.Type.TITLE >@@ -1037,19 +1043,20 @@ > && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE > && ((HtmlTag) token.getValue()).isEndTag()) { > >- if (title.indexOf("login") != -1 || title.indexOf("log in") != -1 >- || (title.indexOf("invalid") != -1 && title.indexOf("password") != -1) >- || title.indexOf("check e-mail") != -1) { >+ languageSettings.getProcessed(); >+ if (title.indexOf(languageSettings.getLogin()) != -1 >+ || (title.indexOf(languageSettings.getInvalid()) != -1 && title.indexOf(languageSettings.getPassword()) != -1) >+ || title.indexOf(languageSettings.getCheckEmail()) != -1) { > authenticated = false; > throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); >- } else if (title.indexOf(IBugzillaConstants.ERROR_MIDAIR_COLLISION) != -1) { >+ } else if (title.indexOf(languageSettings.getMidairCollision()) != -1) { > throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); >- } else if (title.indexOf(IBugzillaConstants.ERROR_COMMENT_REQUIRED) != -1) { >+ } else if (title.indexOf(languageSettings.getCommentRequired()) != -1) { > throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); >- } else if (title.indexOf(IBugzillaConstants.LOGGED_OUT) != -1) { >+ } else if (title.indexOf(languageSettings.getLoggedOut()) != -1) { > authenticated = false; > // throw new > // BugzillaException(IBugzillaConstants.LOGGED_OUT); >Index: src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java,v >retrieving revision 1.50 >diff -u -r1.50 IBugzillaConstants.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 4 Sep 2007 20:49:18 -0000 1.50 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 7 Oct 2007 19:46:17 -0000 >@@ -274,4 +274,7 @@ > > public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform"; > >+ public static final String BUGZILLA_LANGUAGE_SETTING = "bugzilla.languageSetting"; >+ >+ > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java >diff -N src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,128 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.bugzilla.core; >+ >+import java.io.Serializable; >+ >+/** >+ * Class describing the html response of Bugzilla requests which are used within Mylyn. >+ * >+ * Strings should be in the language which is the default for an Bugzilla instance. >+ * >+ * @author Frank Becker >+ */ >+ >+public class BugzillaLanguageSettings implements Serializable { >+ >+ private static final long serialVersionUID = 5181964115189805497L; >+ >+ private String languageName = "<unknown>"; >+ >+ private String login; >+ >+ private String invalid; >+ >+ private String password; >+ >+ private String checkEmail; >+ >+ private String midairCollision; >+ >+ private String commentRequired; >+ >+ private String loggedOut; >+ >+ private String processed; >+ >+ public BugzillaLanguageSettings(String languageName, String checkEmail, String commentRequired, String invalid, >+ String loggedOut, String login, String midairCollision, String password, String processed) { >+ super(); >+ this.checkEmail = checkEmail; >+ this.commentRequired = commentRequired; >+ this.invalid = invalid; >+ this.languageName = languageName; >+ this.loggedOut = loggedOut; >+ this.login = login; >+ this.midairCollision = midairCollision; >+ this.password = password; >+ this.processed = processed; >+ } >+ >+ public String getLanguageName() { >+ return languageName; >+ } >+ >+ public void setLanguageName(String languageName) { >+ this.languageName = languageName; >+ } >+ >+ public String getLogin() { >+ return login; >+ } >+ >+ public void setLogin(String login) { >+ this.login = login; >+ } >+ >+ public String getInvalid() { >+ return invalid; >+ } >+ >+ public void setInvalid(String invalid) { >+ this.invalid = invalid; >+ } >+ >+ public String getPassword() { >+ return password; >+ } >+ >+ public void setPassword(String password) { >+ this.password = password; >+ } >+ >+ public String getCheckEmail() { >+ return checkEmail; >+ } >+ >+ public void setCheckEmail(String checkEmail) { >+ this.checkEmail = checkEmail; >+ } >+ >+ public String getMidairCollision() { >+ return midairCollision; >+ } >+ >+ public void setMidairCollision(String midairCollision) { >+ this.midairCollision = midairCollision; >+ } >+ >+ public String getCommentRequired() { >+ return commentRequired; >+ } >+ >+ public void setCommentRequired(String commentRequired) { >+ this.commentRequired = commentRequired; >+ } >+ >+ public String getLoggedOut() { >+ return loggedOut; >+ } >+ >+ public void setLoggedOut(String loggedOut) { >+ this.loggedOut = loggedOut; >+ } >+ >+ public String getProcessed() { >+ return processed; >+ } >+ >+ public void setProcessed(String processed) { >+ this.processed = processed; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 173352
:
78692
|
78693
| 79854 |
79855
|
79856
|
80264
|
80265