I have messages that I want to migrate that seem to contain CDATA tags in
the message body. This causes a ServiceException that looks like:
SEVERE: Caught ServiceException:
com.google.gdata.client.batch.BatchInterruptedException: Batch Interrupted
(some
operations might have succeeded) : The character sequence "]]>" must not
appear
in content unless used to mark the end of a CDATA section.
com.google.gdata.client.batch.BatchInterruptedException: Batch Interrupted
(some
operations might have succeeded) : The character sequence "]]>" must not
appear
in content unless used to mark the end of a CDATA section.
at
com.google.gdata.model.batch.BatchUtils.throwIfInterrupted(BatchUtils.java:256)
at com.google.gdata.client.Service.batch(Service.java:1459)
at com.google.gdata.client.GoogleService.batch(GoogleService.java:756)
at
com.google.gdata.client.appsforyourdomain.migration.MailItemService.batch(MailIte
mService.java:148)
at
edu.kettering.MailMigration.MigrateMail.batchInsertMailItems(MigrateMail.java:196
)
at edu.kettering.MailMigration.MigrateMail.runBatch(MigrateMail.java:91)
at edu.kettering.MailMigration.MigrateMail.main(MigrateMail.java:385)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.
java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at
org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Right now I've just run a regex on the message body when reading the
messages from the file system to filter them out if they contain "]]>" but
this is not really ideal. Can anyone suggest how I might deal with these
types of messages or get them migrated.
One message contained a uuencoded compressed tarball with script that a
vendor sent me that contained a diagnostic tool. Another example is a mail
message from a developer forum where the topic was handling CDATA and had
sample code which contain "]]>". With my current migration process these
e-mails would not get migrated and so potentially e-mails that users may
consider important will not get migrated. Is there some way to wrap the
message body or otherwise migrate these messages with the java API?
Not entirely sure what part of the code would be useful to see.
Right now I am doing the following to create the MailItemEntry:
/**
* Helper method to set up a new MailItemEntry with the given values.
*
* @param rfcText the RFC822 text of the message
* @param properties a list of properties to be applied to the message
* @param labels a list of labels the message should have when
inserted into
* Gmail
* @return the {@code MailItemEntry} set up with the message, labels
and
* properties
*/
private MailItemEntry setupMailItem(String rfcText,
List<MailItemProperty> properties, List<String> labels) {
Rfc822Msg rfcMsg = new Rfc822Msg(rfcText);
// create MailItemEntry with appropriate data
MailItemEntry mailItem = new MailItemEntry();
mailItem.setRfc822Msg(rfcMsg);
for (String label : labels) {
mailItem.addLabel(new Label(label));
}
for (MailItemProperty property : properties) {
mailItem.addMailProperty(property);
}
return mailItem;
}
Thanks,
--
You received this message because you are subscribed to the Google Groups
"Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-apps-mgmt-apis/-/NlNyUDdUeEhLLWdK.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.