Author: jleroux
Date: Fri Aug 31 00:44:20 2007
New Revision: 571392
URL:
http://svn.apache.org/viewvc?rev=571392&view=revLog:
Applied fix from trunk for revision: 571262
Modified:
ofbiz/branches/release4.0/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
Modified: ofbiz/branches/release4.0/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=571392&r1=571391&r2=571392&view=diff==============================================================================
--- ofbiz/branches/release4.0/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java (original)
+++ ofbiz/branches/release4.0/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java Fri Aug 31 00:44:20 2007
@@ -86,11 +86,7 @@
ContainerConfig.Container cfg = ContainerConfig.getContainer("javamail-container", configFile);
String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
- if ("true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"))) {
- this.deleteMail = true;
- } else {
- this.deleteMail = false;
- }
+ this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));
this.delegator = GenericDelegator.getGenericDelegator(delegatorName);
this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator);
@@ -161,7 +157,7 @@
protected Store getStore(Session session) throws ContainerException {
// create the store object
- Store store = null;
+ Store store;
try {
store = session.getStore();
} catch (NoSuchProviderException e) {
@@ -179,6 +175,10 @@
}
}
+ if (store == null) {
+ throw new ContainerException("No store configured!");
+ }
+
// test the store
try {
store.connect();
@@ -306,9 +306,9 @@
for (int i = 0; i < messages.length; i++) {
// process each un-read message
if (!messages[i].isSet(Flags.Flag.SEEN)) {
- long messageSize = ((MimeMessage) messages[i]).getSize();
+ long messageSize = messages[i].getSize();
if (messages[i] instanceof MimeMessage && messageSize >= maxSize) {
- Debug.logWarning("Message from: " + ((MimeMessage)messages[i]).getFrom()[0] + "not received, to big, size:" + messageSize + " cannot be more than " + maxSize + " bytes", module);
+ Debug.logWarning("Message from: " + messages[i].getFrom()[0] + "not received, to big, size:" + messageSize + " cannot be more than " + maxSize + " bytes", module);
} else {
this.processMessage(messages[i], session);
if (Debug.verboseOn()) Debug.logVerbose("Message from " + UtilMisc.toListArray(messages[i].getFrom()) + " with subject [" + messages[i].getSubject() + "] has been processed." , module);