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 39833 Details for
Bug 136219
convert bug parser to use xml and rdf sources
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]
More cleaning up of attribute handling
patch136219assign.txt (text/plain), 38.46 KB, created by
Robert Elves
on 2006-04-28 16:29:13 EDT
(
hide
)
Description:
More cleaning up of attribute handling
Filename:
MIME Type:
Creator:
Robert Elves
Created:
2006-04-28 16:29:13 EDT
Size:
38.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.bugzilla.core >Index: src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.core/src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java,v >retrieving revision 1.18 >diff -u -r1.18 BugzillaRepositoryUtil.java >--- src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java 28 Apr 2006 02:47:47 -0000 1.18 >+++ src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java 28 Apr 2006 20:28:52 -0000 >@@ -22,10 +22,9 @@ > import java.net.URL; > import java.net.URLConnection; > import java.net.URLEncoder; >-import java.security.KeyManagementException; >-import java.security.NoSuchAlgorithmException; > import java.util.ArrayList; > import java.util.HashMap; >+import java.util.LinkedHashMap; > import java.util.List; > > import javax.security.auth.login.LoginException; >@@ -51,7 +50,6 @@ > import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants.BugzillaServerVersion; > import org.eclipse.mylar.internal.bugzilla.core.internal.BugParser; > import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; >-import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser; > import org.eclipse.mylar.internal.bugzilla.core.internal.OfflineReportsFile; > import org.eclipse.mylar.internal.bugzilla.core.internal.RepositoryConfiguration; > import org.eclipse.mylar.internal.bugzilla.core.internal.ServerConfigurationFactory; >@@ -69,6 +67,8 @@ > */ > public class BugzillaRepositoryUtil { > >+ private static final String BUG_STATUS_NEW = "NEW"; >+ > private static final String ATTACHMENT_DOWNLOAD_FAILED = "Attachment download FAILED."; > > private static final String VALUE_CONTENTTYPEMETHOD_MANUAL = "manual"; >@@ -229,108 +229,132 @@ > > } > >- /** >- * Get the attribute values for a new bug >- * >- * @param nbm >- * A reference to a NewBugModel to store all of the data >- * @throws Exception >- */ >- public static void setupNewBugAttributes(String serverUrl, NewBugModel nbm, boolean getProd) throws Exception { >- BufferedReader in = null; >- try { >- // create a new input stream for getting the bug >- String prodname = URLEncoder.encode(nbm.getProduct(), BugzillaPlugin.ENCODING_UTF_8); >- >- TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository( >- BugzillaPlugin.REPOSITORY_KIND, serverUrl); >- >- if (repository == null) { >- throw new LoginException("Repository configuration error."); >- } >- if (repository.getUserName() == null || repository.getUserName().trim().equals("") >- || repository.getPassword() == null) { >- throw new LoginException("Login credentials missing."); >- } >- >- String url = repository.getUrl() + "/enter_bug.cgi"; >- >- // use the proper url if we dont know the product yet >- if (!getProd) >- url += "?product=" + prodname + "&"; >- else >- url += "?"; >- >- url += POST_ARGS_LOGIN + URLEncoder.encode(repository.getUserName(), BugzillaPlugin.ENCODING_UTF_8) >- + POST_ARGS_PASSWORD + URLEncoder.encode(repository.getPassword(), BugzillaPlugin.ENCODING_UTF_8); >- >- URL bugUrl = new URL(url); >- URLConnection cntx = BugzillaPlugin.getDefault().getUrlConnection(bugUrl); >- if (cntx != null) { >- InputStream input = cntx.getInputStream(); >- if (input != null) { >- in = new BufferedReader(new InputStreamReader(input)); >- >- new NewBugParser(in).parseBugAttributes(nbm, getProd); >- } >- } >- >- } catch (Exception e) { >- >- if (e instanceof KeyManagementException || e instanceof NoSuchAlgorithmException >- || e instanceof IOException) { >- if (MessageDialog.openQuestion(null, "Bugzilla Connect Error", >- "Unable to connect to Bugzilla server.\n" >- + "Bug report will be created offline and saved for submission later.")) { >- nbm.setConnected(false); >- setupBugAttributes(serverUrl, nbm); >- } else >- throw new Exception("Bug report will not be created."); >- } else >- throw e; >- } finally { >- try { >- if (in != null) >- in.close(); >- } catch (IOException e) { >- BugzillaPlugin.log(new Status(IStatus.ERROR, IBugzillaConstants.PLUGIN_ID, IStatus.ERROR, >- "Problem closing the stream", e)); >- } >- } >- } >+ // /** >+ // * Get the attribute values for a new bug >+ // * >+ // * @param nbm >+ // * A reference to a NewBugModel to store all of the data >+ // * @throws Exception >+ // */ >+ // public static void setupNewBugAttributes(String serverUrl, NewBugModel >+ // nbm, boolean getProd) throws Exception { >+ // BufferedReader in = null; >+ // try { >+ // // create a new input stream for getting the bug >+ // String prodname = URLEncoder.encode(nbm.getProduct(), >+ // BugzillaPlugin.ENCODING_UTF_8); >+ // >+ // TaskRepository repository = >+ // MylarTaskListPlugin.getRepositoryManager().getRepository( >+ // BugzillaPlugin.REPOSITORY_KIND, serverUrl); >+ // >+ // if (repository == null) { >+ // throw new LoginException("Repository configuration error."); >+ // } >+ // if (repository.getUserName() == null || >+ // repository.getUserName().trim().equals("") >+ // || repository.getPassword() == null) { >+ // throw new LoginException("Login credentials missing."); >+ // } >+ // >+ // String url = repository.getUrl() + "/enter_bug.cgi"; >+ // >+ // // use the proper url if we dont know the product yet >+ // if (!getProd) >+ // url += "?product=" + prodname + "&"; >+ // else >+ // url += "?"; >+ // >+ // url += POST_ARGS_LOGIN + URLEncoder.encode(repository.getUserName(), >+ // BugzillaPlugin.ENCODING_UTF_8) >+ // + POST_ARGS_PASSWORD + URLEncoder.encode(repository.getPassword(), >+ // BugzillaPlugin.ENCODING_UTF_8); >+ // >+ // URL bugUrl = new URL(url); >+ // URLConnection cntx = >+ // BugzillaPlugin.getDefault().getUrlConnection(bugUrl); >+ // if (cntx != null) { >+ // InputStream input = cntx.getInputStream(); >+ // if (input != null) { >+ // in = new BufferedReader(new InputStreamReader(input)); >+ // >+ // new NewBugParser(in).parseBugAttributes(nbm, getProd); >+ // } >+ // } >+ // >+ // } catch (Exception e) { >+ // >+ // if (e instanceof KeyManagementException || e instanceof >+ // NoSuchAlgorithmException >+ // || e instanceof IOException) { >+ // if (MessageDialog.openQuestion(null, "Bugzilla Connect Error", >+ // "Unable to connect to Bugzilla server.\n" >+ // + "Bug report will be created offline and saved for submission later.")) >+ // { >+ // nbm.setConnected(false); >+ // setupBugAttributes(serverUrl, nbm); >+ // } else >+ // throw new Exception("Bug report will not be created."); >+ // } else >+ // throw e; >+ // } finally { >+ // try { >+ // if (in != null) >+ // in.close(); >+ // } catch (IOException e) { >+ // BugzillaPlugin.log(new Status(IStatus.ERROR, >+ // IBugzillaConstants.PLUGIN_ID, IStatus.ERROR, >+ // "Problem closing the stream", e)); >+ // } >+ // } >+ // } > > /** > * Adds bug attributes to new bug model and sets defaults > */ > public static void setupBugAttributes(String serverUrl, NewBugModel model) { > >- HashMap<String, Attribute> attributes = new HashMap<String, Attribute>(); >- >- Attribute a = new Attribute(BugReportElement.BUG_SEVERITY.toString()); >- a.setParameterName(BugReportElement.BUG_SEVERITY.getKeyString()); >- List<String> optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getSeverities(); >- for (String option : optionValues) { >- a.addOptionValue(option, option); >- } >- a.setValue(optionValues.get((optionValues.size() / 2))); >- attributes.put(a.getName(), a); >+// // order is important >+// BugReportElement[] newBugElements = { BugReportElement.PRODUCT, >+// BugReportElement.BUG_STATUS, >+// BugReportElement.VERSION, >+// BugReportElement.COMPONENT, >+// BugReportElement.TARGET_MILESTONE, >+// BugReportElement.REP_PLATFORM, >+// BugReportElement.OP_SYS, >+// BugReportElement.PRIORITY, >+// BugReportElement.BUG_SEVERITY, >+// BugReportElement.ASSIGNED_TO, >+//// NOT USED BugReportElement.CC, >+// BugReportElement.BUG_FILE_LOC, >+// //NOT USED BugReportElement.SHORT_DESC, >+// //NOT USED BugReportElement.LONG_DESC >+// }; >+ >+ >+ >+ >+ HashMap<String, Attribute> attributes = new LinkedHashMap<String, Attribute>(); > >- a = new Attribute(BugReportElement.OP_SYS.toString()); >- a.setParameterName(BugReportElement.OP_SYS.getKeyString()); >- optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getOSs(); >+ Attribute a = new Attribute(BugReportElement.PRODUCT.toString()); >+ a.setParameterName(BugReportElement.PRODUCT.getKeyString()); >+ List<String> optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getProducts(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >+ a.setValue(model.getProduct()); > attributes.put(a.getName(), a); >- >- a = new Attribute(BugReportElement.REP_PLATFORM.toString()); >- a.setParameterName(BugReportElement.REP_PLATFORM.getKeyString()); >- optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getPlatforms(); >+ >+ >+ a = new Attribute(BugReportElement.BUG_STATUS.toString()); >+ a.setParameterName(BugReportElement.BUG_STATUS.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getStatusValues(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >+ a.setValue(BUG_STATUS_NEW); > attributes.put(a.getName(), a); >- >+ > a = new Attribute(BugReportElement.VERSION.toString()); > a.setParameterName(BugReportElement.VERSION.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getVersions(model.getProduct()); >@@ -339,7 +363,7 @@ > } > a.setValue(optionValues.get(optionValues.size() - 1)); > attributes.put(a.getName(), a); >- >+ > a = new Attribute(BugReportElement.COMPONENT.toString()); > a.setParameterName(BugReportElement.COMPONENT.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getComponents(model.getProduct()); >@@ -347,6 +371,22 @@ > a.addOptionValue(option, option); > } > attributes.put(a.getName(), a); >+ >+ a = new Attribute(BugReportElement.REP_PLATFORM.toString()); >+ a.setParameterName(BugReportElement.REP_PLATFORM.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getPlatforms(); >+ for (String option : optionValues) { >+ a.addOptionValue(option, option); >+ } >+ attributes.put(a.getName(), a); >+ >+ a = new Attribute(BugReportElement.OP_SYS.toString()); >+ a.setParameterName(BugReportElement.OP_SYS.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getOSs(); >+ for (String option : optionValues) { >+ a.addOptionValue(option, option); >+ } >+ attributes.put(a.getName(), a); > > a = new Attribute(BugReportElement.PRIORITY.toString()); > a.setParameterName(BugReportElement.PRIORITY.getKeyString()); >@@ -357,22 +397,33 @@ > a.setValue(optionValues.get((optionValues.size() / 2))); > attributes.put(a.getName(), a); > >- a = new Attribute(BugReportElement.PRODUCT.toString()); >- a.setParameterName(BugReportElement.PRODUCT.getKeyString()); >- optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getProducts(); >+ a = new Attribute(BugReportElement.BUG_SEVERITY.toString()); >+ a.setParameterName(BugReportElement.BUG_SEVERITY.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getSeverities(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >+ a.setValue(optionValues.get((optionValues.size() / 2))); > attributes.put(a.getName(), a); >- >- a = new Attribute(BugReportElement.BUG_STATUS.toString()); >- a.setParameterName(BugReportElement.BUG_STATUS.getKeyString()); >- optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getStatusValues(); >+ >+ a = new Attribute(BugReportElement.TARGET_MILESTONE.toString()); >+ a.setParameterName(BugReportElement.TARGET_MILESTONE.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getTargetMilestones(model.getProduct()); > for (String option : optionValues) { > a.addOptionValue(option, option); > } > attributes.put(a.getName(), a); > >+ a = new Attribute(BugReportElement.ASSIGNED_TO.toString()); >+ a.setParameterName(BugReportElement.ASSIGNED_TO.getKeyString()); >+ a.setValue(""); >+ attributes.put(a.getName(), a); >+ >+ a = new Attribute(BugReportElement.BUG_FILE_LOC.toString()); >+ a.setParameterName(BugReportElement.BUG_FILE_LOC.getKeyString()); >+ a.setValue("http://"); >+ attributes.put(a.getName(), a); >+ > model.attributes = attributes; > } > >Index: src/org/eclipse/mylar/internal/bugzilla/core/NewBugModel.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.core/src/org/eclipse/mylar/internal/bugzilla/core/NewBugModel.java,v >retrieving revision 1.6 >diff -u -r1.6 NewBugModel.java >--- src/org/eclipse/mylar/internal/bugzilla/core/NewBugModel.java 31 Mar 2006 23:17:42 -0000 1.6 >+++ src/org/eclipse/mylar/internal/bugzilla/core/NewBugModel.java 28 Apr 2006 20:28:52 -0000 >@@ -13,9 +13,10 @@ > import java.io.Serializable; > import java.util.ArrayList; > import java.util.Date; >-import java.util.HashMap; > import java.util.Iterator; >+import java.util.LinkedHashMap; > import java.util.List; >+import java.util.Map; > > import org.eclipse.mylar.bugzilla.core.Attribute; > import org.eclipse.mylar.bugzilla.core.IBugzillaBug; >@@ -44,7 +45,7 @@ > protected String product; > > /** A list of the attributes that can be changed for the new bug */ >- public HashMap<String, Attribute> attributes = new HashMap<String, Attribute>(); >+ public Map<String, Attribute> attributes = new LinkedHashMap<String, Attribute>(); > > /** The summary for the bug */ > protected String summary = ""; >Index: src/org/eclipse/mylar/internal/bugzilla/core/BugzillaReportSubmitForm.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.core/src/org/eclipse/mylar/internal/bugzilla/core/BugzillaReportSubmitForm.java,v >retrieving revision 1.13 >diff -u -r1.13 BugzillaReportSubmitForm.java >--- src/org/eclipse/mylar/internal/bugzilla/core/BugzillaReportSubmitForm.java 26 Apr 2006 01:12:47 -0000 1.13 >+++ src/org/eclipse/mylar/internal/bugzilla/core/BugzillaReportSubmitForm.java 28 Apr 2006 20:28:51 -0000 >@@ -34,9 +34,9 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.mylar.bugzilla.core.Attribute; > import org.eclipse.mylar.bugzilla.core.BugReport; >-import org.eclipse.mylar.bugzilla.core.IBugzillaBug; > import org.eclipse.mylar.bugzilla.core.Operation; > import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants.BugzillaServerVersion; >+import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; > import org.eclipse.mylar.internal.bugzilla.core.internal.HtmlStreamTokenizer; > import org.eclipse.mylar.internal.bugzilla.core.internal.HtmlTag; > import org.eclipse.mylar.internal.bugzilla.core.internal.HtmlStreamTokenizer.Token; >@@ -47,14 +47,15 @@ > * > * @author Shawn Minto > * @author Mik Kersten (hardening of prototype) >+ * @author Rob Elves > * > * Class to handle the positing of a bug > */ > public class BugzillaReportSubmitForm { > >- private static final String KEY_BUG_FILE_LOC = "bug_file_loc"; >+ // private static final String KEY_BUG_FILE_LOC = "bug_file_loc"; > >- private static final String KEY_PRODUCT = "product"; >+ // private static final String KEY_PRODUCT = "product"; > > private static final String VAL_TRUE = "true"; > >@@ -96,21 +97,21 @@ > > private static final String KEY_ASSIGNED_TO = "Assigned To"; > >- private static final String KEY_ASSIGN_TO = "Assign To"; >- >- private static final String KEY_URL = "URL"; >- >- private static final String KEY_PRIORITY = "Priority"; >- >- private static final String KEY_COMPONENT = "Component"; >- >- private static final String KEY_PLATFORM = "Platform"; >- >- private static final String KEY_SEVERITY = "Severity"; >- >- private static final String KEY_VERSION = "Version"; >- >- private static final String KEY_OS = "OS"; >+ // private static final String KEY_ASSIGN_TO = "Assign To"; >+ // >+ // private static final String KEY_URL = "URL"; >+ // >+ // private static final String KEY_PRIORITY = "Priority"; >+ // >+ // private static final String KEY_COMPONENT = "Component"; >+ // >+ // private static final String KEY_PLATFORM = "Platform"; >+ // >+ // private static final String KEY_SEVERITY = "Severity"; >+ // >+ // private static final String KEY_VERSION = "Version"; >+ // >+ // private static final String KEY_OS = "OS"; > > public static final String FORM_POSTFIX_218 = " Submitted"; > >@@ -140,69 +141,75 @@ > > private String error = null; > >- /** >- * TODO: get rid of this? >- */ >- public static BugzillaReportSubmitForm makeNewBugPost(TaskRepository repository, IBugzillaBug bug) { >- BugzillaReportSubmitForm bugzillaReportSubmitForm = new BugzillaReportSubmitForm(); >- bugzillaReportSubmitForm.setPrefix(BugzillaReportSubmitForm.FORM_PREFIX_BUG_218); >- bugzillaReportSubmitForm.setPrefix2(BugzillaReportSubmitForm.FORM_PREFIX_BUG_220); >- >- bugzillaReportSubmitForm.setPostfix(BugzillaReportSubmitForm.FORM_POSTFIX_216); >- bugzillaReportSubmitForm.setPostfix2(BugzillaReportSubmitForm.FORM_POSTFIX_218); >- >- // go through all of the attributes and add them to the bug post >- Iterator<Attribute> itr = bug.getAttributes().iterator(); >- while (itr.hasNext()) { >- Attribute a = itr.next(); >- if (a != null && a.getParameterName() != null && a.getParameterName().compareTo("") != 0 && !a.isHidden()) { >- String key = a.getName(); >- String value = null; >- >- // get the values from the attribute >- if (key.equalsIgnoreCase(KEY_OS)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_VERSION)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_SEVERITY)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_PLATFORM)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_COMPONENT)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_PRIORITY)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_URL)) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase(KEY_ASSIGN_TO) || key.equalsIgnoreCase(KEY_ASSIGNED_TO)) { >- value = a.getValue(); >- } >- >- // add the attribute to the bug post >- if (value == null) >- value = ""; >- >- bugzillaReportSubmitForm.add(a.getParameterName(), value); >- } else if (a != null && a.getParameterName() != null && a.getParameterName().compareTo("") != 0 >- && a.isHidden()) { >- // we have a hidden attribute, add it to the posting >- bugzillaReportSubmitForm.add(a.getParameterName(), a.getValue()); >- >- } >- } >- >- setURL(bugzillaReportSubmitForm, repository, POST_BUG_CGI); >- >- // add the summary to the bug post >- bugzillaReportSubmitForm.add(KEY_SHORT_DESC, bug.getSummary()); >- bug.setDescription(formatTextToLineWrap(bug.getDescription(), repository)); >- if (bug.getDescription().length() != 0) { >- bugzillaReportSubmitForm.add(KEY_COMMENT, bug.getDescription()); >- } >- return bugzillaReportSubmitForm; >- } >+ // /** >+ // * TODO: get rid of this? >+ // */ >+ // public static BugzillaReportSubmitForm makeNewBugPost(TaskRepository >+ // repository, IBugzillaBug bug) { >+ // BugzillaReportSubmitForm bugzillaReportSubmitForm = new >+ // BugzillaReportSubmitForm(); >+ // bugzillaReportSubmitForm.setPrefix(BugzillaReportSubmitForm.FORM_PREFIX_BUG_218); >+ // bugzillaReportSubmitForm.setPrefix2(BugzillaReportSubmitForm.FORM_PREFIX_BUG_220); >+ // >+ // bugzillaReportSubmitForm.setPostfix(BugzillaReportSubmitForm.FORM_POSTFIX_216); >+ // bugzillaReportSubmitForm.setPostfix2(BugzillaReportSubmitForm.FORM_POSTFIX_218); >+ // >+ // // go through all of the attributes and add them to the bug post >+ // Iterator<Attribute> itr = bug.getAttributes().iterator(); >+ // while (itr.hasNext()) { >+ // Attribute a = itr.next(); >+ // if (a != null && a.getParameterName() != null && >+ // a.getParameterName().compareTo("") != 0 && !a.isHidden()) { >+ // String key = a.getName(); >+ // String value = null; >+ // >+ // // get the values from the attribute >+ // if (key.equalsIgnoreCase(KEY_OS)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_VERSION)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_SEVERITY)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_PLATFORM)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_COMPONENT)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_PRIORITY)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_URL)) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase(KEY_ASSIGN_TO) || >+ // key.equalsIgnoreCase(KEY_ASSIGNED_TO)) { >+ // value = a.getValue(); >+ // } >+ // >+ // // add the attribute to the bug post >+ // if (value == null) >+ // value = ""; >+ // >+ // bugzillaReportSubmitForm.add(a.getParameterName(), value); >+ // } else if (a != null && a.getParameterName() != null && >+ // a.getParameterName().compareTo("") != 0 >+ // && a.isHidden()) { >+ // // we have a hidden attribute, add it to the posting >+ // bugzillaReportSubmitForm.add(a.getParameterName(), a.getValue()); >+ // >+ // } >+ // } >+ // >+ // setURL(bugzillaReportSubmitForm, repository, POST_BUG_CGI); >+ // >+ // // add the summary to the bug post >+ // bugzillaReportSubmitForm.add(KEY_SHORT_DESC, bug.getSummary()); >+ // bug.setDescription(formatTextToLineWrap(bug.getDescription(), >+ // repository)); >+ // if (bug.getDescription().length() != 0) { >+ // bugzillaReportSubmitForm.add(KEY_COMMENT, bug.getDescription()); >+ // } >+ // return bugzillaReportSubmitForm; >+ // } > >- public static BugzillaReportSubmitForm makeNewBugPost2(TaskRepository repository, NewBugModel model) { >+ public static BugzillaReportSubmitForm makeNewBugPost(TaskRepository repository, NewBugModel model) { > BugzillaReportSubmitForm form = new BugzillaReportSubmitForm(); > form.setPrefix(BugzillaReportSubmitForm.FORM_PREFIX_BUG_218); > form.setPrefix2(BugzillaReportSubmitForm.FORM_PREFIX_BUG_220); >@@ -217,59 +224,68 @@ > while (itr.hasNext()) { > Attribute a = itr.next(); > if (a != null && a.getParameterName() != null && a.getParameterName().compareTo("") != 0 && !a.isHidden()) { >- String key = a.getName(); >+ // String key = a.getName(); > String value = null; > >- // get the values from the attribute >- if (key.equalsIgnoreCase("OS")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Version")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Severity")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Platform")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Component")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Priority")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Target Milestone")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("URL")) { >- value = a.getValue(); >- } else if (key.equalsIgnoreCase("Assign To") || key.equalsIgnoreCase("Assigned To")) { >- value = a.getValue(); >- } >- >- // add the attribute to the bug post >+ // // get the values from the attribute >+ // if (key.equalsIgnoreCase("OS")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Version")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Severity")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Platform")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Component")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Priority")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Target Milestone")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("URL")) { >+ // value = a.getValue(); >+ // } else if (key.equalsIgnoreCase("Assign To") || >+ // key.equalsIgnoreCase("Assigned To")) { >+ // value = a.getValue(); >+ // } >+ // >+ // // add the attribute to the bug post >+ // if (value == null) >+ // value = ""; >+ // >+ // form.add(a.getParameterName(), value); >+ // } else if (a != null && a.getParameterName() != null && >+ // a.getParameterName().compareTo("") != 0 >+ // && a.isHidden()) { >+ // // we have a hidden attribute, add it to the >+ // // posting >+ value = a.getValue(); > if (value == null) >- value = ""; >- >+ continue; > form.add(a.getParameterName(), value); >- } else if (a != null && a.getParameterName() != null && a.getParameterName().compareTo("") != 0 >- && a.isHidden()) { >- // we have a hidden attribute, add it to the >- // posting >- form.add(a.getParameterName(), a.getValue()); > } > } > >- form.add(KEY_BUG_FILE_LOC, ""); >- >+ // form.add(KEY_BUG_FILE_LOC, ""); >+ > // specify the product >- form.add(KEY_PRODUCT, model.getProduct()); >+ form.add(BugReportElement.PRODUCT.getKeyString(), model.getProduct()); > > // add the summary to the bug post >- form.add("short_desc", model.getSummary()); >+ form.add(BugReportElement.SHORT_DESC.getKeyString(), model.getSummary()); > >- BugzillaServerVersion bugzillaServerVersion = IBugzillaConstants.BugzillaServerVersion.fromString(repository >- .getVersion()); >- if (bugzillaServerVersion != null && bugzillaServerVersion.compareTo(BugzillaServerVersion.SERVER_220) >= 0) { >- // if >- // (repository.getVersion().equals(BugzillaServerVersion.SERVER_220.toString())) >- // { >- form.add("bug_status", "NEW"); >- } >+ // BugzillaServerVersion bugzillaServerVersion = >+ // IBugzillaConstants.BugzillaServerVersion.fromString(repository >+ // .getVersion()); >+ // if (bugzillaServerVersion != null && >+ // bugzillaServerVersion.compareTo(BugzillaServerVersion.SERVER_220) >= >+ // 0) { >+ // // if >+ // // >+ // (repository.getVersion().equals(BugzillaServerVersion.SERVER_220.toString())) >+ // // { >+ // form.add("bug_status", "NEW"); >+ // } > > String formattedDescription = formatTextToLineWrap(model.getDescription(), repository); > model.setDescription(formattedDescription); >@@ -278,7 +294,7 @@ > // add the new comment to the bug post if there > // is some text in > // it >- form.add("comment", model.getDescription()); >+ form.add(KEY_COMMENT, model.getDescription()); > } > return form; > } >@@ -442,7 +458,7 @@ > // while(aString != null) { > // System.err.println(aString); > // aString = in.readLine(); >- // } >+ // } > > boolean possibleFailure = true; > error = ""; >Index: src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.core/src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java,v >retrieving revision 1.1 >diff -u -r1.1 BugReportElement.java >--- src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java 27 Apr 2006 00:15:18 -0000 1.1 >+++ src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java 28 Apr 2006 20:28:52 -0000 >@@ -55,6 +55,7 @@ > FILENAME ("filename", "filename"), > TYPE ("type", "type"), > DATA ("data", "data"), >+ BUG_FILE_LOC ("URL", "bug_file_loc"), > UNKNOWN ("UNKNOWN", "UNKNOWN"); > > private final String prettyName; >#P org.eclipse.mylar.bugzilla.ui >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugWizard.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugWizard.java,v >retrieving revision 1.9 >diff -u -r1.9 AbstractBugWizard.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugWizard.java 28 Mar 2006 01:16:32 -0000 1.9 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugWizard.java 28 Apr 2006 20:28:52 -0000 >@@ -126,7 +126,7 @@ > protected void execute(final IProgressMonitor monitor) throws CoreException { > PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { > public void run() { >- BugzillaReportSubmitForm form = BugzillaReportSubmitForm.makeNewBugPost2(repository, model); >+ BugzillaReportSubmitForm form = BugzillaReportSubmitForm.makeNewBugPost(repository, model); > try { > id = form.submitReportToRepository(); > >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java,v >retrieving revision 1.8 >diff -u -r1.8 AbstractBugzillaWizardPage.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java 27 Apr 2006 00:15:21 -0000 1.8 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java 28 Apr 2006 20:28:53 -0000 >@@ -21,7 +21,6 @@ > import org.eclipse.jface.wizard.IWizardPage; > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.mylar.bugzilla.core.Attribute; >-import org.eclipse.mylar.bugzilla.core.BugReport; > import org.eclipse.mylar.internal.bugzilla.core.NewBugModel; > import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; > import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor; >@@ -51,8 +50,6 @@ > */ > public abstract class AbstractBugzillaWizardPage extends WizardPage implements Listener { > >- private static final String KEY_OP_SYS = "op_sys"; >- > /** The instance of the workbench */ > protected IWorkbench workbench; > >@@ -321,33 +318,36 @@ > try { > if (values == null) > values = new HashMap<String, String>(); >- if (key.equals(BugReport.ATTRIBUTE_OS)) { >+ if (key.equals(BugReportElement.OP_SYS.toString())) { > String os = oSCombo.getItem(oSCombo.getSelectionIndex()); > attribute.setValue(os); >- } else if (key.equals(BugReport.ATTRIBUTE_VERSION)) { >+ } else if (key.equals(BugReportElement.VERSION.toString())) { > String version = versionCombo.getItem(versionCombo.getSelectionIndex()); > attribute.setValue(version); >- } else if (key.equals(BugReport.ATTRIBUTE_SEVERITY)) { >+ } else if (key.equals(BugReportElement.BUG_SEVERITY.toString())) { > String severity = severityCombo.getItem(severityCombo.getSelectionIndex()); > attribute.setValue(severity); >- } else if (key.equals(BugReport.ATTRIBUTE_PLATFORM)) { >+ } else if (key.equals(BugReportElement.REP_PLATFORM.toString())) { > String platform = platformCombo.getItem(platformCombo.getSelectionIndex()); > attribute.setValue(platform); >- } else if (key.equals(BugReport.ATTRIBUTE_MILESTONE)) { >- String milestone = milestoneCombo.getItem(milestoneCombo.getSelectionIndex()); >- attribute.setValue(milestone); >- } else if (key.equals(BugReport.ATTRIBUTE_COMPONENT)) { >+ } else if (key.equals(BugReportElement.TARGET_MILESTONE.toString())) { >+ int index = milestoneCombo.getSelectionIndex(); >+ if(index >= 0) { >+ String milestone = milestoneCombo.getItem(milestoneCombo.getSelectionIndex()); >+ attribute.setValue(milestone); >+ } >+ } else if (key.equals(BugReportElement.COMPONENT.toString())) { > String component = componentCombo.getItem(componentCombo.getSelectionIndex()); > attribute.setValue(component); >- } else if (key.equals(BugReport.ATTRIBUTE_PRIORITY)) { >+ } else if (key.equals(BugReportElement.PRIORITY.toString())) { > String priority = priorityCombo.getItem(priorityCombo.getSelectionIndex()); > attribute.setValue(priority); >- } else if (key.equals(BugReport.ATTRIBUTE_URL)) { >+ } else if (key.equals(BugReportElement.BUG_FILE_LOC.toString())) { > String url = urlText.getText(); > if (url.equalsIgnoreCase("http://")) > url = ""; > attribute.setValue(url); >- } else if (key.equals("Assign To")) { >+ } else if (key.equals(BugReportElement.ASSIGNED_TO.toString())) { > String assignTo = assignedToText.getText(); > attribute.setValue(assignTo); > } else { >@@ -436,7 +436,7 @@ > data.horizontalIndent = HORZ_INDENT; > data.widthHint = 150; > // create and populate the combo fields for the attributes >- if (key.equals(KEY_OP_SYS)) { >+ if (key.equals(BugReportElement.OP_SYS.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > oSCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY); > >@@ -451,7 +451,7 @@ > index = 0; > oSCombo.select(index); > oSCombo.addListener(SWT.Modify, this); >- } else if (key.equals("version")) { >+ } else if (key.equals(BugReportElement.VERSION.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > > versionCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL >@@ -468,7 +468,7 @@ > index = 0; > versionCombo.select(index); > versionCombo.addListener(SWT.Modify, this); >- } else if (key.equals("bug_severity")) { >+ } else if (key.equals(BugReportElement.BUG_SEVERITY.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > severityCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -485,7 +485,7 @@ > severityCombo.select(index); > severityCombo.addListener(SWT.Modify, this); > >- } else if (key.equals("rep_platform")) { >+ } else if (key.equals(BugReportElement.REP_PLATFORM.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > platformCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -501,7 +501,7 @@ > index = 0; > platformCombo.select(index); > platformCombo.addListener(SWT.Modify, this); >- } else if (key.equals(BugReport.KEY_MILESTONE)) { >+ } else if (key.equals(BugReportElement.TARGET_MILESTONE.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > milestoneCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -516,8 +516,9 @@ > index = 0; > milestoneCombo.select(index); > milestoneCombo.addListener(SWT.Modify, this); >+ //if(s.isEmpty()) milestoneCombo.setEnabled(false); > mileExist = true; >- } else if (key.equals("component")) { >+ } else if (key.equals(BugReportElement.COMPONENT.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > componentCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -533,7 +534,7 @@ > index = 0; > componentCombo.select(index); > componentCombo.addListener(SWT.Modify, this); >- } else if (key.equals("priority")) { >+ } else if (key.equals(BugReportElement.PRIORITY.getKeyString())) { > newLayout(attributesComposite, 1, name, PROPERTY); > priorityCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -550,7 +551,7 @@ > priorityCombo.select(index); > priorityCombo.addListener(SWT.Modify, this); > priExist = true; >- } else if (key.equals("bug_file_loc")) { >+ } else if (key.equals(BugReportElement.BUG_FILE_LOC.getKeyString())) { > url = value; > } else { > // do nothing if it isn't a standard value to change >@@ -569,24 +570,23 @@ > textCompositeGD.grabExcessHorizontalSpace = true; > textComposite.setLayoutData(textCompositeGD); > >- GridData summaryTextData; >- >- if (url != null) { >- // add the assigned to text field >- newLayout(textComposite, 1, BugReport.ATTRIBUTE_URL, PROPERTY); >+ >+ GridData urlTextData; >+ if (url != null) { >+ newLayout(textComposite, 1, BugReportElement.BUG_FILE_LOC.toString(), PROPERTY); > urlText = new Text(textComposite, SWT.BORDER | SWT.SINGLE | SWT.WRAP); >- summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ urlTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > >- summaryTextData.horizontalSpan = 2; >+ urlTextData.horizontalSpan = 2; > // summaryTextData.widthHint = 200; >- urlText.setLayoutData(summaryTextData); >+ urlText.setLayoutData(urlTextData); > urlText.setText(url); > urlText.addListener(SWT.FocusOut, this); > } > >- newLayout(textComposite, 1, "Assigned To", PROPERTY); >+ GridData summaryTextData; >+ newLayout(textComposite, 1, BugReportElement.ASSIGNED_TO.toString(), PROPERTY); > Label l = new Label(textComposite, SWT.NONE); >- // l.setText(" "); > l.setText("(if email is incorrect submit will not proceed)"); > summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > summaryTextData.horizontalSpan = 1; >@@ -600,7 +600,7 @@ > assignedToText.setText(""); > > // add the summary text field >- newLayout(textComposite, 1, "Summary", PROPERTY); >+ newLayout(textComposite, 1, BugReportElement.SHORT_DESC.toString(), PROPERTY); > summaryText = new Text(textComposite, SWT.BORDER | SWT.SINGLE | SWT.WRAP); > summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > >#P org.eclipse.mylar.bugzilla.tests >Index: src/org/eclipse/mylar/bugzilla/tests/AllBugzillaTests.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.tests/src/org/eclipse/mylar/bugzilla/tests/AllBugzillaTests.java,v >retrieving revision 1.12 >diff -u -r1.12 AllBugzillaTests.java >--- src/org/eclipse/mylar/bugzilla/tests/AllBugzillaTests.java 25 Apr 2006 01:41:17 -0000 1.12 >+++ src/org/eclipse/mylar/bugzilla/tests/AllBugzillaTests.java 28 Apr 2006 20:28:53 -0000 >@@ -20,7 +20,7 @@ > > public static Test suite() { > TestSuite suite = new TestSuite("Test for org.eclipse.mylar.bugzilla.tests"); >- // $JUnit-BEGIN$ >+ // $JUnit-BEGIN$ > suite.addTestSuite(BugzillaConfigurationTest.class); > suite.addTestSuite(BugzillaTaskHyperlinkDetectorTest.class); > suite.addTestSuite(ReportAttachmentTest.class); >@@ -30,11 +30,11 @@ > suite.addTestSuite(EncodingTest.class); > suite.addTestSuite(NewBugWizardTest.class); > suite.addTestSuite(RegularExpressionMatchTest.class); >- suite.addTestSuite(BugzillaNewBugParserTestCDT.class); >- suite.addTestSuite(BugzillaNewBugParserTestEquinox.class); >- suite.addTestSuite(BugzillaNewBugParserTestGMT.class); >- suite.addTestSuite(BugzillaNewBugParserTestPlatform.class); >- suite.addTestSuite(BugzillaNewBugParserTestVE.class); >+ // suite.addTestSuite(BugzillaNewBugParserTestCDT.class); >+ // suite.addTestSuite(BugzillaNewBugParserTestEquinox.class); >+ // suite.addTestSuite(BugzillaNewBugParserTestGMT.class); >+ // suite.addTestSuite(BugzillaNewBugParserTestPlatform.class); >+ // suite.addTestSuite(BugzillaNewBugParserTestVE.class); > suite.addTestSuite(BugzillaParserTestNoBug.class); > suite.addTestSuite(BugzillaProductParserTest.class); > // TODO: enable
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 136219
:
39378
|
39381
|
39429
|
39484
|
39498
|
39599
|
39615
| 39833 |
39835
|
40093
|
40670
|
40671