BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-06-2008, 03:23 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Location: Columbia, MD
Model: 8130
PIN: N/A
Carrier: verizon
Posts: 95
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Continued Attachment Handler issues - this time w/code

Please Login to Remove!

I apologize for the length of this message, but I really need some help.

If anybody else uses third-party attachment handlers, I'd love to know if they are still working for you, and if so, what file types you're using....

(BTW, thanks to holy3daps for letting me know he's seen similar probs)

-----------------------
So I decided to try and reduce my attachment code to the bare bones. I followed all the documentation I could find. I have been unsuccessful at getting any kind of third-party attachment to work thru BIS.

I wrote an example program that both reads and sends the same kind of email attachment.

If I send the attachment from the program, I can read the attachment from the email in the inbox. However, I cannot read THE VERY SAME ATTACHMENT after it comes back thru BIS.

I've been testing this on my VZN 8130 running OS 4.3.0.

I will include the relevant code here. I can send anybody the entire program code if you'd like.

Every time I run this on the message returned from BIS it fails because the temp byte array returned from p.getContent() is of size 0. However, if I run it on the message in the sent folder it works (note the content type is changed in BIS).

I get the following in my log:


------------- LOG OUTPUT FROM BIS INBOX ------------------
supports contenttype: application/x-rimdevicemydata.testme;filename=x-r imdevicemydata.testme

contenttype is application/x-rimdevicemydata.testme

Filename is x-rimdevicemydata.testme

Name is x-rimdevicemydata.testme

Size is 20

------------- LOG OUTPUT FROM SENT BOX ------------------
supports contenttype: application/octet-stream;filename=x-rimdevicemyda ta.testme

contenttype is application/octet-stream

Filename is x-rimdevicemydata.testme

Name is x-rimdevicemydata.testme

Size is 20

Got the attachment


--------------------- CODE ---------------------
// Sends the email
public static Message sendTermSetEmail(String recipient, String nick)
{
Session sess = Session.getDefaultInstance();
Store store = sess.getStore();


Folder[] folders = store.list(Folder.SENT);
Message msg = new Message(folders[0]);
try {
msg.setSubject("This is a test");
msg.addRecipient(Message.RecipientType.TO, new Address(recipient,nick));
msg.setFrom(new Address(recipient, nick));

Multipart multipart = new Multipart();

TextBodyPart textMsg = new TextBodyPart(multipart, "This is body text");
multipart.addBodyPart(textMsg);

byte b[] = new String("This is my test file").getBytes();



SupportedAttachmentPart attach = new SupportedAttachmentPart(
multipart, "application/octet-stream", "x-rimdevicemydata.testme", b);



multipart.addBodyPart(attach);

msg.setContent(multipart);
Transport.send(msg);

return msg;
} catch (MessagingException ex){
Log.bblog(TAG, "Problem sending email: "+ex.getMessage());
return null;
}
}



/// Processes the attachment
static class TermSetAttachmentHandler implements AttachmentHandler
{
public boolean supports(String contentType){
Log.bblog(TAG,"supports contenttype: "+contentType);
return (contentType.toLowerCase().indexOf(".testme") != -1);
}
public String menuString() {
return "Save My Stuff";
}
public void run(Message m, SupportedAttachmentPart p){
Log.bblog(TAG, "Content type is "+p.getContentType());
Log.bblog(TAG, "Filename is "+p.getFilename());
Log.bblog(TAG, "Name is "+p.getName());
Log.bblog(TAG, "Size is "+p.getSize());
byte[] temp = (byte[])p.getContent();
if (temp == null || temp.length < 1){
AsyncMessage.show("Sorry, BES/BIS did not forward the attachment contents to your phone.");
return;
}
Log.bblog(TAG, "Got the attachment");
}
}
Offline  
Old 07-07-2008, 12:18 PM   #2 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by skicson View Post
I apologize for the length of this message, but I really need some help.

If anybody else uses third-party attachment handlers, I'd love to know if they are still working for you, and if so, what file types you're using....

(BTW, thanks to holy3daps for letting me know he's seen similar probs)

-----------------------
So I decided to try and reduce my attachment code to the bare bones. I followed all the documentation I could find. I have been unsuccessful at getting any kind of third-party attachment to work thru BIS.

I wrote an example program that both reads and sends the same kind of email attachment.

If I send the attachment from the program, I can read the attachment from the email in the inbox. However, I cannot read THE VERY SAME ATTACHMENT after it comes back thru BIS.

I've been testing this on my VZN 8130 running OS 4.3.0.

I will include the relevant code here. I can send anybody the entire program code if you'd like.

Every time I run this on the message returned from BIS it fails because the temp byte array returned from p.getContent() is of size 0. However, if I run it on the message in the sent folder it works (note the content type is changed in BIS).

I get the following in my log:


------------- LOG OUTPUT FROM BIS INBOX ------------------
supports contenttype: application/x-rimdevicemydata.testme;filename=x-r imdevicemydata.testme

contenttype is application/x-rimdevicemydata.testme

Filename is x-rimdevicemydata.testme

Name is x-rimdevicemydata.testme

Size is 20

------------- LOG OUTPUT FROM SENT BOX ------------------
supports contenttype: application/octet-stream;filename=x-rimdevicemyda ta.testme

contenttype is application/octet-stream

Filename is x-rimdevicemydata.testme

Name is x-rimdevicemydata.testme

Size is 20

Got the attachment


--------------------- CODE ---------------------
// Sends the email
public static Message sendTermSetEmail(String recipient, String nick)
{
Session sess = Session.getDefaultInstance();
Store store = sess.getStore();


Folder[] folders = store.list(Folder.SENT);
Message msg = new Message(folders[0]);
try {
msg.setSubject("This is a test");
msg.addRecipient(Message.RecipientType.TO, new Address(recipient,nick));
msg.setFrom(new Address(recipient, nick));

Multipart multipart = new Multipart();

TextBodyPart textMsg = new TextBodyPart(multipart, "This is body text");
multipart.addBodyPart(textMsg);

byte b[] = new String("This is my test file").getBytes();



SupportedAttachmentPart attach = new SupportedAttachmentPart(
multipart, "application/octet-stream", "x-rimdevicemydata.testme", b);



multipart.addBodyPart(attach);

msg.setContent(multipart);
Transport.send(msg);

return msg;
} catch (MessagingException ex){
Log.bblog(TAG, "Problem sending email: "+ex.getMessage());
return null;
}
}



/// Processes the attachment
static class TermSetAttachmentHandler implements AttachmentHandler
{
public boolean supports(String contentType){
Log.bblog(TAG,"supports contenttype: "+contentType);
return (contentType.toLowerCase().indexOf(".testme") != -1);
}
public String menuString() {
return "Save My Stuff";
}
public void run(Message m, SupportedAttachmentPart p){
Log.bblog(TAG, "Content type is "+p.getContentType());
Log.bblog(TAG, "Filename is "+p.getFilename());
Log.bblog(TAG, "Name is "+p.getName());
Log.bblog(TAG, "Size is "+p.getSize());
byte[] temp = (byte[])p.getContent();
if (temp == null || temp.length < 1){
AsyncMessage.show("Sorry, BES/BIS did not forward the attachment contents to your phone.");
return;
}
Log.bblog(TAG, "Got the attachment");
}
}
I have the same problem, suddenly around 2 weeks ago, the attachments started reading 0 bytes in length. Any luck so far ?
Spoke to Orange, master reset......still 0 zero !
Offline  
Old 07-07-2008, 03:25 PM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Location: Columbia, MD
Model: 8130
PIN: N/A
Carrier: verizon
Posts: 95
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Darren, Thanks for the info. I noticed it the same weekend that BIS 2.5 (which had changes for email attachments) was being upgraded.

Thus far I have had no luck thus far figuring out any kind of workaround.

Quote:
Originally Posted by DarrenHeaton View Post
I have the same problem, suddenly around 2 weeks ago, the attachments started reading 0 bytes in length. Any luck so far ?
Spoke to Orange, master reset......still 0 zero !
Offline  
Old 07-09-2008, 06:48 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default BIS Email Attachment Mishandlings

Hi!

Sorry for the long delay in responses, it's been a tough week

Check out

RSA SecurID

Near the very end, posted by Vin McClellan, is a description of what's probably going on. RIM has upgraded the BIS (BlackBerry Internet Service) servers, and apparently the email-attachment transmission part of the BIS'es is broken. VM's post indicates that there is a fix coming Real Soon, so you may have to wait a week for any improvement with BIS-based devices. Note that this issue affects all BIS'ed devices, no matter what OS version the device is running. This explains why skicson and DarrenHeaton both saw failures happen recently.

BES-based devices seem to handle email attachments well. Oh, and if you're using a version of 4.5 prior to 4.5.0.52, email attachment handling is non-working (on the device, either BIS or BES). But those are Beta OS'es, with the exception of Rogers Wireless and Vodafone Germany.

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 07-09-2008, 07:13 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Location: Columbia, MD
Model: 8130
PIN: N/A
Carrier: verizon
Posts: 95
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Karl -

Thanks for the info! It certainly sounds like this is the issue. Hopefully Vin is right on the timing of the fix. Thanks for your help!

Mike

Quote:
Originally Posted by holy3daps View Post
Hi!

Sorry for the long delay in responses, it's been a tough week

Check out

RSA SecurID

Near the very end, posted by Vin McClellan, is a description of what's probably going on. RIM has upgraded the BIS (BlackBerry Internet Service) servers, and apparently the email-attachment transmission part of the BIS'es is broken. VM's post indicates that there is a fix coming Real Soon, so you may have to wait a week for any improvement with BIS-based devices. Note that this issue affects all BIS'ed devices, no matter what OS version the device is running. This explains why skicson and DarrenHeaton both saw failures happen recently.

BES-based devices seem to handle email attachments well. Oh, and if you're using a version of 4.5 prior to 4.5.0.52, email attachment handling is non-working (on the device, either BIS or BES). But those are Beta OS'es, with the exception of Rogers Wireless and Vodafone Germany.

Cheers,

karl
Offline  
Old 07-09-2008, 07:34 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike:

No problem. It's all about solving problems - especially those that I've run into.

Good luck, and may The Force be with you.

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 07-13-2008, 12:55 PM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Location: Columbia, MD
Model: 8130
PIN: N/A
Carrier: verizon
Posts: 95
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Apparently BIS has been fixed/patched over the weekend. It works now.
Offline  
Old 07-14-2008, 08:42 AM   #8 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Confirmed. Receiving and importing email attachments on 4.2.X and 4.5.X devices as of this moment. It's Miller time. Well, more like, it's Absolut time.....
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 07-22-2008, 05:15 AM   #9 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by skicson View Post
Apparently BIS has been fixed/patched over the weekend. It works now.
Thank you, this problem was driving me Nucking Futz !
Blew away so much time didn't it.
Orange saying "no our problem, etc, etc.."

Again, Thank You for the info.

Worked on V4.2.190 (Platform 2.3.0.72)
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.