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 84718 Details for
Bug 206499
Symptom catalog import not showing error message when incorrect import format is chosen
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 file
patch_bugzilla206499_20071206.txt (text/plain), 11.28 KB, created by
Yasuhisa Gotoh
on 2007-12-07 06:39:24 EST
(
hide
)
Description:
Patch file
Filename:
MIME Type:
Creator:
Yasuhisa Gotoh
Created:
2007-12-07 06:39:24 EST
Size:
11.28 KB
patch
obsolete
>Index: src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/handler/util/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.sdb/src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/handler/util/messages.properties,v >retrieving revision 1.6 >diff -u -r1.6 messages.properties >--- src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/handler/util/messages.properties 7 May 2007 03:29:08 -0000 1.6 >+++ src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/handler/util/messages.properties 7 Dec 2007 11:35:21 -0000 >@@ -35,3 +35,5 @@ > _10040 = Validating contents of symptom catalog... > _10090 = Successfully imported {0} > _10100 = The symptom catalog {0} is being imported by another background job. Please choose another file name. >+ >+_10200 = The specified symptom catalog file is not supported by the selected importer. Please make sure you select the correct importer. >Index: src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SymptomLoader.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.sdb/src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SymptomLoader.java,v >retrieving revision 1.15 >diff -u -r1.15 SymptomLoader.java >--- src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SymptomLoader.java 6 Dec 2007 08:27:07 -0000 1.15 >+++ src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SymptomLoader.java 7 Dec 2007 11:35:21 -0000 >@@ -4,7 +4,7 @@ > * 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 >- * $Id >+ * $Id$ > * > * Contributors: > * IBM - Initial API and implementation >@@ -91,6 +91,9 @@ > private long readBytes = 0; > private int currentPercent = 0; > >+ // bug 206499 >+ private boolean isSupportedElementFound = false; >+ public static final String V5_ROOT_ELEMENT_NAME = "symptomDatabase"; //$NON-NLS-1$ > > public SymptomLoader() { > super(); >@@ -115,8 +118,10 @@ > */ > public void endElement(String namespaceURI, String localName, String qName) throws SAXException { > if (qName.equals(MATCH_PATTERN_CLASS)) { >+ isSupportedElementFound = true; > createMatchPattern(); > } else if (qName.equals(SOLUTION_CLASS)) { >+ isSupportedElementFound = true; > createSolution(); > } > >@@ -192,9 +197,9 @@ > } > > try { >- >- saveResource(container.eResource()); >- >+ if (isSupportedElementFound) { >+ saveResource(container.eResource()); >+ } > } catch (Exception exc) { > errMsg = exc.toString(); > // bugzilla 137186 >@@ -268,7 +273,9 @@ > > try { > is.close(); >- saveResource(container.eResource()); >+ if (isSupportedElementFound) { >+ saveResource(container.eResource()); >+ } > } catch (Exception exc) { > errMsg = exc.toString(); > // bugzilla 137186 >@@ -296,7 +303,11 @@ > return; > } > >- parse(is); >+ try { >+ parse(is); >+ } finally { >+ is.close(); >+ } > } > > protected SAXParser makeParser() throws ParserConfigurationException, SAXException { >@@ -389,6 +400,7 @@ > //// parser.setErrorHandler(this); > //// parser.setContentHandler(this); > // parser.parse(inputSource); >+ isSupportedElementFound = false; > parser.parse(inputSource, this); > if(processingXPath && symptom!=null && rule!=null){ > xPathExpression.append("]"); >@@ -396,7 +408,10 @@ > xPathExpression.setLength(0); > processingXPath = false; > } >- >+ if (!isSupportedElementFound) { >+ // well-formed XML but unsupported format >+ throw new FormatNotSupportedException(LogSDBMessages.getString("_10200")); >+ } > } catch (SAXException se) { > errMsg = se.getMessage(); > ModelDebugger.log(se); >@@ -415,17 +430,27 @@ > */ > public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { > if (elementName.equals(V5_RUNTIME_CLASS)) { >+ isSupportedElementFound = true; > createContainer(atts); > } else if (elementName.equals(V5_MATCH_PATTERN_CLASS)) { >+ isSupportedElementFound = true; > createMatchPattern(atts); > } else if (elementName.equals(V5_SOLUTION_CLASS)) { >+ isSupportedElementFound = true; > createSolution(atts); > } else if (elementName.equals(V5_SYMPTOM_CLASS)) { >+ isSupportedElementFound = true; > createSymptom(atts); > } else if (elementName.equals(V5_DIRECTIVE_CLASS)) { >+ isSupportedElementFound = true; > createDirective(atts); > } else if (elementName.equals(SYMPTOM_CLASS)) { >+ isSupportedElementFound = true; > createV4Symptom(atts); >+ } else if (elementName.equals(RUNTIME_CLASS)) { >+ isSupportedElementFound = true; >+ } else if (elementName.equals(V5_ROOT_ELEMENT_NAME)) { >+ isSupportedElementFound = true; > } > > // bugzilla 137186 >Index: src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SDBLoader.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.sdb/src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SDBLoader.java,v >retrieving revision 1.8 >diff -u -r1.8 SDBLoader.java >--- src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SDBLoader.java 21 Mar 2007 23:00:36 -0000 1.8 >+++ src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/SDBLoader.java 7 Dec 2007 11:35:21 -0000 >@@ -73,6 +73,10 @@ > private long readBytes = 0; > private int currentPercent = 0; > >+ // bug 206499 >+ private boolean isSupportedElementFound = false; >+ public static final String V5_ROOT_ELEMENT_NAME = "symptomDatabase"; //$NON-NLS-1$ >+ > //~ Constructors ------------------------------------------------------------------------------- > > public SDBLoader() { >@@ -104,8 +108,10 @@ > */ > public void endElement(String namespaceURI, String localName, String qName) throws SAXException { > if (qName.equals(MATCH_PATTERN_CLASS)) { >+ isSupportedElementFound = true; > createMatchPattern(); > } else if (qName.equals(SOLUTION_CLASS)) { >+ isSupportedElementFound = true; > createSolution(); > } > >@@ -182,11 +188,11 @@ > } > > try { >- Map options = new HashMap(); >- >- options.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE); >- _symptomDB.eResource().save(options); >- >+ if (isSupportedElementFound) { >+ Map options = new HashMap(); >+ options.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE); >+ _symptomDB.eResource().save(options); >+ } > } catch (Exception exc) { > errMsg = exc.toString(); > // bugzilla 137186 >@@ -253,11 +259,11 @@ > > try { > is.close(); >- Map options = new HashMap(); >- >- options.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE); >- _symptomDB.eResource().save(options); >- >+ if (isSupportedElementFound) { >+ Map options = new HashMap(); >+ options.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE); >+ _symptomDB.eResource().save(options); >+ } > } catch (Exception exc) { > errMsg = exc.toString(); > // bugzilla 137186 >@@ -286,7 +292,11 @@ > return; > } > >- parse(is); >+ try { >+ parse(is); >+ } finally { >+ is.close(); >+ } > } > > protected SAXParser makeParser() throws ParserConfigurationException, SAXException { >@@ -381,8 +391,12 @@ > //// parser.setErrorHandler(this); > //// parser.setContentHandler(this); > // parser.parse(inputSource); >+ isSupportedElementFound = false; > parser.parse(inputSource, this); >- >+ if (!isSupportedElementFound) { >+ // well-formed XML but unsupported format >+ throw new FormatNotSupportedException(LogSDBMessages.getString("_10200")); >+ } > } catch (SAXException se) { > errMsg = se.getMessage(); > ModelDebugger.log(se); >@@ -401,17 +415,27 @@ > */ > public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { > if (elementName.equals(V5_RUNTIME_CLASS)) { >+ isSupportedElementFound = true; > createRuntime(atts); > } else if (elementName.equals(V5_MATCH_PATTERN_CLASS)) { >+ isSupportedElementFound = true; > createMatchPattern(atts); > } else if (elementName.equals(V5_SOLUTION_CLASS)) { >+ isSupportedElementFound = true; > createSolution(atts); > } else if (elementName.equals(V5_SYMPTOM_CLASS)) { >+ isSupportedElementFound = true; > createSymptom(atts); > } else if (elementName.equals(V5_DIRECTIVE_CLASS)) { >+ isSupportedElementFound = true; > createDirective(atts); > } else if (elementName.equals(SYMPTOM_CLASS)) { >+ isSupportedElementFound = true; > createV4Symptom(atts); >+ } else if (elementName.equals(RUNTIME_CLASS)) { >+ isSupportedElementFound = true; >+ } else if (elementName.equals(V5_ROOT_ELEMENT_NAME)) { >+ isSupportedElementFound = true; > } > > // bugzilla 137186 >Index: src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/FormatNotSupportedException.java >=================================================================== >RCS file: src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/FormatNotSupportedException.java >diff -N src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/FormatNotSupportedException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-symptom-handler/org/eclipse/tptp/monitoring/symptom/provisional/models/util/FormatNotSupportedException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/********************************************************************** >+ * Copyright (c) 2007 IBM Corporation 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 >+ * $Id$ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.monitoring.symptom.provisional.models.util; >+ >+/** >+ * Signals that the specified file is not supported by the importer. >+ * >+ * @author ygotoh >+ */ >+public class FormatNotSupportedException extends Exception { >+ >+ public FormatNotSupportedException() { >+ super(); >+ } >+ >+ public FormatNotSupportedException(String message, Throwable cause) { >+ super(message, cause); >+ } >+ >+ public FormatNotSupportedException(String message) { >+ super(message); >+ } >+ >+ public FormatNotSupportedException(Throwable cause) { >+ super(cause); >+ } >+ >+}
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 206499
:
84718
|
84794
|
84795
|
84877