Bug #43332 | Avoidable NullReferenceException thrown in NativeDriver.SendFileToServer() | ||
---|---|---|---|
Submitted: | 3 Mar 2009 14:53 | Modified: | 5 Mar 2009 11:52 |
Reporter: | Yvan Rodrigues | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 5.2.5 | OS: | Any |
Assigned to: | Reggie Burnett | CPU Architecture: | Any |
Tags: | close, Dispose, FileStream, load, LOAD DATA LOCAL INFILE, MySqlBulkLoader, null, SendFileToServer |
[3 Mar 2009 14:53]
Yvan Rodrigues
[4 Mar 2009 8:10]
Tonci Grgin
Hi Yves and thanks for great report. Verified as described using latest sources. In this case (file does not exist for example) by the time we get into NativeDriver.cs LN:593 finally { fs.Close(); } file stream is null and exception is thrown. We should add check on fs before calling fs.close().
[4 Mar 2009 19:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/68280
[4 Mar 2009 19:34]
Reggie Burnett
fixed in 5.2.6
[5 Mar 2009 11:52]
Tony Bedford
An entry was added to the 5.2.6 changelog: When using MySqlBulkLoader.Load(), the text file is opened by NativeDriver.SendFileToServer. If it encountered a problem opening the file as a stream, an exception was generated and caught. An attempt to clean up resources was then made in the finally{} clause by calling fs.Close(), but since the stream was never successfully opened, this was an attempt to execute a method of a null reference.