You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "David Bertoni (JIRA)" <xe...@xml.apache.org> on 2006/12/27 19:04:21 UTC
[jira] Reopened: (XERCESC-1658) Inaccurate error message
"Type:XMLPlatformException, Message:Could not close the file"
[ http://issues.apache.org/jira/browse/XERCESC-1658?page=all ]
David Bertoni reopened XERCESC-1658:
------------------------------------
Assignee: Alberto Massari
Hi Alberto,
I think I already fixed this with revision 450540 (util/BinFileInputStream.cpp) and that your changes conflict with mine. Also, on Solaris, XERCES_Invalid_File_Handle is defined to -1, so returning 0 from the open won't indicate failure with code using XERCES_Invalid_File_Handle, such as framework/LocalFileFormatTarget.cpp.
This is my fault, as I forget to create a defect for the problem when I found it and fixed it, so there was no record of it being fixed. Sorry about that!
> Inaccurate error message "Type:XMLPlatformException, Message:Could not close the file"
> --------------------------------------------------------------------------------------
>
> Key: XERCESC-1658
> URL: http://issues.apache.org/jira/browse/XERCESC-1658
> Project: Xerces-C++
> Issue Type: Improvement
> Components: Validating Parser (Schema) (Xerces 1.5 or up only)
> Affects Versions: 2.7.0
> Environment: Solaris 10
> Reporter: Paul Fee
> Assigned To: Alberto Massari
>
> XMLPlatformUtils::openFile() in SolarisPlatformUtils.cpp:227 directly returns the result of the open(2) system call.
> This can return -1 on error, such as "File not found". However other parts of Xerces take this return could without further validation. Also, when an error occurs, valuable information is available for a short time in errno, this information (i.e. the reason why -1 was return) is not captured for use in error messages.
> An example of when the return is stored is in
> BinFileInputStream::BinFileInputStream(const XMLCh* const fileName, MemoryManager* const manager)
> Here fSource can end up with a value of -1, which in turn means that the destructor for BinFileInputStream will fail.
> BinFileInputStream::~BinFileInputStream()
> {
> if (fSource)
> XMLPlatformUtils::closeFile(fSource, fMemoryManager);
> }
> It detects that fSource is non-zero and tries to close the file, but -1 is not a valid file descriptor.
> Hence we end up with the inaccurate error message "Could not close the file".
> Error checking surrounding XMLPlatformUtils::openFile() should be improved.
> Thank you,
> Paul
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org