|
Lines 4-10
Link Here
|
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* $Id |
7 |
* $Id$ |
| 8 |
* |
8 |
* |
| 9 |
* Contributors: |
9 |
* Contributors: |
| 10 |
* IBM - Initial API and implementation |
10 |
* IBM - Initial API and implementation |
|
Lines 91-96
Link Here
|
| 91 |
private long readBytes = 0; |
91 |
private long readBytes = 0; |
| 92 |
private int currentPercent = 0; |
92 |
private int currentPercent = 0; |
| 93 |
|
93 |
|
|
|
94 |
// bug 206499 |
| 95 |
private boolean isSupportedElementFound = false; |
| 96 |
public static final String V5_ROOT_ELEMENT_NAME = "symptomDatabase"; //$NON-NLS-1$ |
| 94 |
|
97 |
|
| 95 |
public SymptomLoader() { |
98 |
public SymptomLoader() { |
| 96 |
super(); |
99 |
super(); |
|
Lines 115-122
Link Here
|
| 115 |
*/ |
118 |
*/ |
| 116 |
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { |
119 |
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { |
| 117 |
if (qName.equals(MATCH_PATTERN_CLASS)) { |
120 |
if (qName.equals(MATCH_PATTERN_CLASS)) { |
|
|
121 |
isSupportedElementFound = true; |
| 118 |
createMatchPattern(); |
122 |
createMatchPattern(); |
| 119 |
} else if (qName.equals(SOLUTION_CLASS)) { |
123 |
} else if (qName.equals(SOLUTION_CLASS)) { |
|
|
124 |
isSupportedElementFound = true; |
| 120 |
createSolution(); |
125 |
createSolution(); |
| 121 |
} |
126 |
} |
| 122 |
|
127 |
|
|
Lines 192-200
Link Here
|
| 192 |
} |
197 |
} |
| 193 |
|
198 |
|
| 194 |
try { |
199 |
try { |
| 195 |
|
200 |
if (isSupportedElementFound) { |
| 196 |
saveResource(container.eResource()); |
201 |
saveResource(container.eResource()); |
| 197 |
|
202 |
} |
| 198 |
} catch (Exception exc) { |
203 |
} catch (Exception exc) { |
| 199 |
errMsg = exc.toString(); |
204 |
errMsg = exc.toString(); |
| 200 |
// bugzilla 137186 |
205 |
// bugzilla 137186 |
|
Lines 268-274
Link Here
|
| 268 |
|
273 |
|
| 269 |
try { |
274 |
try { |
| 270 |
is.close(); |
275 |
is.close(); |
| 271 |
saveResource(container.eResource()); |
276 |
if (isSupportedElementFound) { |
|
|
277 |
saveResource(container.eResource()); |
| 278 |
} |
| 272 |
} catch (Exception exc) { |
279 |
} catch (Exception exc) { |
| 273 |
errMsg = exc.toString(); |
280 |
errMsg = exc.toString(); |
| 274 |
// bugzilla 137186 |
281 |
// bugzilla 137186 |
|
Lines 296-302
Link Here
|
| 296 |
return; |
303 |
return; |
| 297 |
} |
304 |
} |
| 298 |
|
305 |
|
| 299 |
parse(is); |
306 |
try { |
|
|
307 |
parse(is); |
| 308 |
} finally { |
| 309 |
is.close(); |
| 310 |
} |
| 300 |
} |
311 |
} |
| 301 |
|
312 |
|
| 302 |
protected SAXParser makeParser() throws ParserConfigurationException, SAXException { |
313 |
protected SAXParser makeParser() throws ParserConfigurationException, SAXException { |
|
Lines 389-394
Link Here
|
| 389 |
//// parser.setErrorHandler(this); |
400 |
//// parser.setErrorHandler(this); |
| 390 |
//// parser.setContentHandler(this); |
401 |
//// parser.setContentHandler(this); |
| 391 |
// parser.parse(inputSource); |
402 |
// parser.parse(inputSource); |
|
|
403 |
isSupportedElementFound = false; |
| 392 |
parser.parse(inputSource, this); |
404 |
parser.parse(inputSource, this); |
| 393 |
if(processingXPath && symptom!=null && rule!=null){ |
405 |
if(processingXPath && symptom!=null && rule!=null){ |
| 394 |
xPathExpression.append("]"); |
406 |
xPathExpression.append("]"); |
|
Lines 396-402
Link Here
|
| 396 |
xPathExpression.setLength(0); |
408 |
xPathExpression.setLength(0); |
| 397 |
processingXPath = false; |
409 |
processingXPath = false; |
| 398 |
} |
410 |
} |
| 399 |
|
411 |
if (!isSupportedElementFound) { |
|
|
412 |
// well-formed XML but unsupported format |
| 413 |
throw new FormatNotSupportedException(LogSDBMessages.getString("_10200")); |
| 414 |
} |
| 400 |
} catch (SAXException se) { |
415 |
} catch (SAXException se) { |
| 401 |
errMsg = se.getMessage(); |
416 |
errMsg = se.getMessage(); |
| 402 |
ModelDebugger.log(se); |
417 |
ModelDebugger.log(se); |
|
Lines 415-431
Link Here
|
| 415 |
*/ |
430 |
*/ |
| 416 |
public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { |
431 |
public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { |
| 417 |
if (elementName.equals(V5_RUNTIME_CLASS)) { |
432 |
if (elementName.equals(V5_RUNTIME_CLASS)) { |
|
|
433 |
isSupportedElementFound = true; |
| 418 |
createContainer(atts); |
434 |
createContainer(atts); |
| 419 |
} else if (elementName.equals(V5_MATCH_PATTERN_CLASS)) { |
435 |
} else if (elementName.equals(V5_MATCH_PATTERN_CLASS)) { |
|
|
436 |
isSupportedElementFound = true; |
| 420 |
createMatchPattern(atts); |
437 |
createMatchPattern(atts); |
| 421 |
} else if (elementName.equals(V5_SOLUTION_CLASS)) { |
438 |
} else if (elementName.equals(V5_SOLUTION_CLASS)) { |
|
|
439 |
isSupportedElementFound = true; |
| 422 |
createSolution(atts); |
440 |
createSolution(atts); |
| 423 |
} else if (elementName.equals(V5_SYMPTOM_CLASS)) { |
441 |
} else if (elementName.equals(V5_SYMPTOM_CLASS)) { |
|
|
442 |
isSupportedElementFound = true; |
| 424 |
createSymptom(atts); |
443 |
createSymptom(atts); |
| 425 |
} else if (elementName.equals(V5_DIRECTIVE_CLASS)) { |
444 |
} else if (elementName.equals(V5_DIRECTIVE_CLASS)) { |
|
|
445 |
isSupportedElementFound = true; |
| 426 |
createDirective(atts); |
446 |
createDirective(atts); |
| 427 |
} else if (elementName.equals(SYMPTOM_CLASS)) { |
447 |
} else if (elementName.equals(SYMPTOM_CLASS)) { |
|
|
448 |
isSupportedElementFound = true; |
| 428 |
createV4Symptom(atts); |
449 |
createV4Symptom(atts); |
|
|
450 |
} else if (elementName.equals(RUNTIME_CLASS)) { |
| 451 |
isSupportedElementFound = true; |
| 452 |
} else if (elementName.equals(V5_ROOT_ELEMENT_NAME)) { |
| 453 |
isSupportedElementFound = true; |
| 429 |
} |
454 |
} |
| 430 |
|
455 |
|
| 431 |
// bugzilla 137186 |
456 |
// bugzilla 137186 |