[Mono-bugs] [Bug 431748] New: Object reference error converting a BLOB oracle data type to byte[]

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 2 16:16:31 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=431748


           Summary: Object reference error converting a BLOB oracle data
                    type to byte[]
           Product: Mono: Class Libraries
           Version: 1.9
          Platform: x86-64
        OS/Version: RHEL 4
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: ernezto at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Hi there,

I trying to retrieve a BLOB field from a OracleDataReader and cast or convert
it to byte[], the following code work just fine in Microsoft .NET, I debugged
the code in Mono and the OracleDataReader field do have a value there but I
always get an NullReferenceException.

Code Snippet:

cmd.ExecuteNonQuery();
OracleDataReader rd = (OracleDataReader)cmd.Parameters["io_AllRec"].Value;
byte[] img;
if (rd.HasRows)
{
  rd.Read();
  img = (byte[])rd["IMAGEN"]; <========== NullReferenceException throw here

  caminoImagen = directorio + idImagen.ToString() + ".pdf";
  fs = new FileStream(caminoImagen, FileMode.Create, FileAccess.Write);
  fs.Write(img, 0, img.Length);
  fs.Close();
}



Exception:

System.NullReferenceException: Object reference not set to an instance of an
object
  at System.Data.OracleClient.Oci.OciLobLocator.GetLength (Boolean binary)
[0x00000] 
  at System.Data.OracleClient.OracleLob.get_Length () [0x00000] 
  at System.Data.OracleClient.OracleLob.get_Value () [0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Data.OracleClient.OracleLob:get_Value ()
  at System.Data.OracleClient.OracleDataReader.GetValue (Int32 i) [0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Data.OracleClient.OracleDataReader:GetValue (int) at
System.Data.OracleClient.OracleDataReader.get_Item (System.String name)
[0x00000] at (wrapper remoting-invoke-with-check)
System.Data.OracleClient.OracleDataReader:get_Item (string)
  at SARENWS.Negocio.Documento.ObtenerPDF (System.String cadenaConexion, Int32
tipoOficina, System.String id) [0x00000] 
--- End of inner exception stack trace ---


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list