Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 834217 Details for
Bug 1022749
traceback on empty results.xml file
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Fix the traceback when the xml file is not valid
0001-1022749-traceback-on-empty-results.xml-file.patch (text/plain), 3.50 KB, created by
Dong Zhu
on 2013-12-09 07:04:39 UTC
(
hide
)
Description:
Fix the traceback when the xml file is not valid
Filename:
MIME Type:
Creator:
Dong Zhu
Created:
2013-12-09 07:04:39 UTC
Size:
3.50 KB
patch
obsolete
>From a2a6fe915f5c5eed045ae21553cd72fa1e48cf0d Mon Sep 17 00:00:00 2001 >From: Dong Zhu <dzhu@redhat.com> >Date: Mon, 9 Dec 2013 14:53:10 +0800 >Subject: [PATCH] 1022749 - traceback on empty results.xml file > >Signed-off-by: Dong Zhu <dzhu@redhat.com> >--- > hwcert/certificationtest.py | 19 +++++++++++-------- > hwcert/documentbase.py | 9 ++++++--- > hwcert/harness.py | 5 +++-- > 3 files changed, 20 insertions(+), 13 deletions(-) > >diff --git a/hwcert/certificationtest.py b/hwcert/certificationtest.py >index c257891..f2bfd45 100644 >--- a/hwcert/certificationtest.py >+++ b/hwcert/certificationtest.py >@@ -180,14 +180,17 @@ class ResultsDocument(CertificationDocument): > > def load(self, filename): > DocumentBase.load(self, filename) >- self.deviceClasses = dict() >- deviceClassElements = list() >- for element in self.document.documentElement.childNodes: >- if element.nodeName == Tags.device_class: >- deviceClassElements.append(element) >- for deviceClassElement in deviceClassElements: >- deviceClass = deviceclassdocument.GetDeviceClass(deviceClassElement, self.document) >- self.deviceClasses[deviceClass.getName()] = deviceClass >+ if self.document: >+ self.deviceClasses = dict() >+ deviceClassElements = list() >+ for element in self.document.documentElement.childNodes: >+ if element.nodeName == Tags.device_class: >+ deviceClassElements.append(element) >+ for deviceClassElement in deviceClassElements: >+ deviceClass = deviceclassdocument.GetDeviceClass(deviceClassElement, self.document) >+ self.deviceClasses[deviceClass.getName()] = deviceClass >+ return True >+ return False > > def importElement(self, topElement): > DocumentBase.importElement(self, topElement) >diff --git a/hwcert/documentbase.py b/hwcert/documentbase.py >index f28bd56..c7505ac 100644 >--- a/hwcert/documentbase.py >+++ b/hwcert/documentbase.py >@@ -264,16 +264,19 @@ class DocumentBase(DocumentWrapper): > if filename[-2:] == "gz": > file = gzip.open(filename, 'rb') > self.loadedFileSize = os.path.getsize(self.loadedFilePath) >- self.document = parse(file) >- file.close() > else: > try: > self.loadedFileSize = os.path.getsize(self.loadedFilePath) # bytes > except OSError: > pass > file = open(filename, "r") >+ try: > self.document = parse(file) >- file.close() >+ except Exception, e: >+ print "It's not a vaild xml file" >+ self.document = None >+ >+ file.close() > > def save(self, filename): > file = open(filename, "w") >diff --git a/hwcert/harness.py b/hwcert/harness.py >index 281a6e5..ddaee92 100644 >--- a/hwcert/harness.py >+++ b/hwcert/harness.py >@@ -54,10 +54,11 @@ class HardwareTestHarness(Controller): > def load(self): > try: > self.certification = ResultsDocument(self.options.debug != Constants.off) >- self.certification.load(self.environment.getResultsPath()) >+ if not self.certification.load(self.environment.getResultsPath()): >+ self.certification = None > except IOError: > self.certification = None >- return >+ return > > def doDiscover(self): > self.certification = ResultsDocument(self.options.debug != Constants.off) >-- >1.8.3.1 >
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
Flags:
gnichols
: review-
Actions:
View
|
Diff
Attachments on
bug 1022749
:
834217
|
835025