You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <no...@apache.org> on 2008/02/23 16:40:57 UTC
Re: svn commit: r630452 -
/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java
Hi,
I have started to fix this stuff.. I need to recheck the tests because
some fails now so if you want jump in.
Bye
Norman
Am Samstag, den 23.02.2008, 15:36 +0000 schrieb norman@apache.org:
> Author: norman
> Date: Sat Feb 23 07:36:57 2008
> New Revision: 630452
>
> URL: http://svn.apache.org/viewvc?rev=630452&view=rev
> Log:
> Next try to fix JSPF-60
>
> Modified:
> james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java
>
> Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java
> URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java?rev=630452&r1=630451&r2=630452&view=diff
> ==============================================================================
> --- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java (original)
> +++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFSession.java Sat Feb 23 07:36:57 2008
> @@ -86,8 +86,6 @@
> * The helo provided by the sender
> * @param clientIP
> * The ipaddress of the client
> - * @throws IllegalArgumentException
> - * Get thrown if invalid data get passed
> *
> */
> public SPFSession(String mailFrom, String heloDomain, String clientIP) {
> @@ -100,12 +98,16 @@
> // get the in Address
> this.inAddress = IPAddr.getInAddress(clientIP);
> } catch (PermErrorException e) {
> - // throw an exception cause the ip was not rfc conform
> - throw new IllegalArgumentException(e.getMessage());
> + // ip was not rfc conform
> + this.setCurrentResultExpanded(e.getResult());
> }
>
> // setup the data!
> - setupData(mailFrom, hostName);
> + try {
> + setupData(mailFrom, hostName);
> + } catch (NoneException e) {
> + this.setCurrentResultExpanded(e.getResult());
> + }
> }
>
> /**
> @@ -115,10 +117,11 @@
> * The emailaddress of the sender
> * @param helo
> * The provided helo
> + * @throws NoneException
> * @throws NoneException
> * Get thrown if an invalid emailaddress get passed
> */
> - private void setupData(String mailFrom, String helo) {
> + private void setupData(String mailFrom, String helo) throws NoneException {
>
> // if nullsender is used postmaster@helo will be used as email
> if (mailFrom.equals("")) {
> @@ -127,13 +130,10 @@
> this.mailFrom = currentSenderPart + "@" + helo;
> } else {
> String[] fromParts = mailFrom.split("@");
> -
> - // should never be bigger as 2 !
> - if (fromParts.length > 2) {
> - throw new IllegalArgumentException("Not a valid email address " + mailFrom);
> - } else if (fromParts.length == 2) {
> - this.currentSenderPart = fromParts[0];
> - this.senderDomain = fromParts[1];
> +
> + if (fromParts.length > 1) {
> + this.senderDomain = fromParts[fromParts.length -1];
> + this.currentSenderPart = mailFrom.substring(0, mailFrom.length() - senderDomain.length() + 1);
> } else {
> this.currentSenderPart = "postmaster";
> this.senderDomain = mailFrom;
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org