manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1552729 - in /manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main: java/org/apache/manifoldcf/crawler/connectors/email/ resources/org/apache/manifoldcf/crawler/connectors/email/
Date Fri, 20 Dec 2013 16:45:43 GMT
Author: kwright
Date: Fri Dec 20 16:45:43 2013
New Revision: 1552729

URL: http://svn.apache.org/r1552729
Log:
Hook up port, so that we use the protocol default when it is not specified at all

Modified:
    manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConfig.java
    manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
    manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailSession.java
    manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/ConfigurationHeader.js

Modified: manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConfig.java?rev=1552729&r1=1552728&r2=1552729&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConfig.java
(original)
+++ manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConfig.java
Fri Dec 20 16:45:43 2013
@@ -63,7 +63,7 @@ public class EmailConfig {
   public static final String PROTOCOL_POP3S_PROVIDER = "pop3s";
   
   public static final String PROTOCOL_DEFAULT_VALUE = "IMAP";
-  public static final String PORT_DEFAULT_VALUE = "25";
+  public static final String PORT_DEFAULT_VALUE = "";
 
 
   public static final String NODE_PROPERTIES = "properties";

Modified: manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java?rev=1552729&r1=1552728&r2=1552729&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
Fri Dec 20 16:45:43 2013
@@ -74,7 +74,7 @@ public class EmailConnector extends org.
   // Parameters for establishing a session
   
   protected String server = null;
-  protected String port = null;
+  protected String portString = null;
   protected String username = null;
   protected String password = null;
   protected String protocol = null;
@@ -104,7 +104,7 @@ public class EmailConnector extends org.
   public void connect(ConfigParams configParameters) {
     super.connect(configParameters);
     this.server = configParameters.getParameter(EmailConfig.SERVER_PARAM);
-    this.port = configParameters.getParameter(EmailConfig.PORT_PARAM);
+    this.portString = configParameters.getParameter(EmailConfig.PORT_PARAM);
     this.protocol = configParameters.getParameter(EmailConfig.PROTOCOL_PARAM);
     this.username = configParameters.getParameter(EmailConfig.USERNAME_PARAM);
     this.password = configParameters.getParameter(EmailConfig.PASSWORD_PARAM);
@@ -128,7 +128,7 @@ public class EmailConnector extends org.
   public void disconnect()
     throws ManifoldCFException {
     this.server = null;
-    this.port = null;
+    this.portString = null;
     this.protocol = null;
     this.username = null;
     this.password = null;
@@ -356,6 +356,21 @@ public class EmailConnector extends org.
   protected void getSession()
     throws ManifoldCFException, ServiceInterruption {
     if (session == null) {
+      int port;
+      if (portString != null && portString.length() > 0)
+      {
+        try
+        {
+          port = Integer.parseInt(portString);
+        }
+        catch (NumberFormatException e)
+        {
+          throw new ManifoldCFException("Port number has bad format: "+e.getMessage(),e);
+        }
+      }
+      else
+        port = -1;
+
       try {
         session = new EmailSession(server, port, username, password,
           providerMap.get(protocol), properties);

Modified: manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailSession.java?rev=1552729&r1=1552728&r2=1552729&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailSession.java
Fri Dec 20 16:45:43 2013
@@ -30,7 +30,7 @@ import javax.mail.search.*;
 public class EmailSession
 {
   protected final String server;
-  protected final String port;
+  protected final int port;
   protected final String username;
   protected final String password;
   protected final String protocol;
@@ -40,7 +40,7 @@ public class EmailSession
   private Store store = null;
 
   /** Create a session */
-  public EmailSession(String server, String port, String username, String password,
+  public EmailSession(String server, int port, String username, String password,
     String protocol, Properties properties)
     throws MessagingException
   {
@@ -54,7 +54,7 @@ public class EmailSession
     // Now, try to connect
     Session thisSession = Session.getDefaultInstance(properties, null);
     Store thisStore = thisSession.getStore(protocol);
-    thisStore.connect(server, username, password);
+    thisStore.connect(server, port, username, password);
 
     session = thisSession;
     store = thisStore;

Modified: manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/ConfigurationHeader.js
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/ConfigurationHeader.js?rev=1552729&r1=1552728&r2=1552729&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/ConfigurationHeader.js
(original)
+++ manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/ConfigurationHeader.js
Fri Dec 20 16:45:43 2013
@@ -17,6 +17,17 @@
 
 <script type="text/javascript">
 <!--
+function checkConfig()
+{
+  if (editconnection.port.value != "" && !isInteger(editconnection.port.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('EmailConnector.PortMustBeIntegerOrBlank'))");
+    editconnection.port.focus();
+    return false;
+  }
+  return true;
+}
+
 function checkConfigForSave()
 {
   if (editconnection.server.value == "")
@@ -26,6 +37,13 @@ function checkConfigForSave()
     editconnection.server.focus();
     return false;
   }
+  if (editconnection.port.value != "" && !isInteger(editconnection.port.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('EmailConnector.PortMustBeIntegerOrBlank'))");
+    SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('EmailConnector.Server'))");
+    editconnection.port.focus();
+    return false;
+  }
   return true;
 }
 



Mime
View raw message