[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-commit
Subject:    [Rt-commit] r2115 - in rt/branches/3.4-RELEASE: . lib/RT
From:       jesse () bestpractical ! com
Date:       2005-01-19 22:20:49
Message-ID: 20050119222049.48E6A4D806F () diesel ! bestpractical ! com
[Download RAW message or body]

Author: jesse
Date: Wed Jan 19 17:20:48 2005
New Revision: 2115

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm
Log:
 r3892@hualien:  jesse | 2005-01-19T18:38:38.233900Z
 Added better error checking for attachment insertion failure. (This unmasked more \
instances of oracle brokenness)  


Modified: rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Attachment_Overlay.pm	Wed Jan 19 17:20:48 2005
@@ -43,6 +43,7 @@
 # those contributions and any derivatives thereof.
 # 
 # END BPS TAGGED BLOCK }}}
+
 =head1 SYNOPSIS
 
   use RT::Attachment;
@@ -165,12 +166,18 @@
     # If a message has no bodyhandle, that means that it has subparts (or appears \
to)  # and we should act accordingly.  
     unless ( defined $Attachment->bodyhandle ) {
+
         $id = $self->SUPER::Create(
             TransactionId => $args{'TransactionId'},
             Parent        => 0,
             ContentType   => $Attachment->mime_type,
             Headers => $Attachment->head->as_string,
             Subject => $Subject);
+        
+        unless ($id) {
+            $RT::Logger->crit("Attachment insert failed - \
".$RT::Handle->dbh->errstr); +
+        }
 
         foreach my $part ( $Attachment->parts ) {
             my $SubAttachment = new RT::Attachment( $self->CurrentUser );
@@ -179,7 +186,6 @@
                 Parent        => $id,
                 Attachment    => $part,
                 ContentType   => $Attachment->mime_type,
-                Headers       => $Attachment->head->as_string(),
 
             );
         }
@@ -189,21 +195,19 @@
     #If it's not multipart
     else {
 
-
-        my $Body = $Attachment->bodyhandle->as_string;
-
-
 	my ($ContentEncoding, $Body) = \
                $self->_EncodeLOB($Attachment->bodyhandle->as_string, \
                $Attachment->mime_type);
-
-
         my $id = $self->SUPER::Create( TransactionId => $args{'TransactionId'},
                                        ContentType   => $Attachment->mime_type,
                                        ContentEncoding => $ContentEncoding,
                                        Parent          => $args{'Parent'},
-                                       Headers       =>  \
$Attachment->head->as_string,  +                                                  \
Headers       =>  $Attachment->head->as_string,  Subject       =>  $Subject,
                                        Content         => $Body,
                                        Filename => $Filename, );
+        unless ($id) {
+            $RT::Logger->crit("Attachment insert failed - \
".$RT::Handle->dbh->errstr); +        }
+
         return ($id);
     }
 }
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic