james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harmeet Bedi" <hb...@yahoo.com>
Subject Re: java.net.MalformedURLException: unknown protocol: town
Date Sat, 21 Apr 2001 21:08:25 GMT
This seems to be the problem:

james\core\AvalonMailStore has code like this

URL url = new URL(destinationURL);
String protocol = url.getProtocol();

town, is not a know protocol so java.net.URL constructor throws a
MalformedURLException.

In order to avoid this one could either write a URL Handler for town
protocol or avoid using java.net.URL.

I am planning to add this change to james\core\AvalonMailStore.java.
This should cause the exception to go away.
---------------------------------------------------------------------------
-        URL destination = null;
+        String destination = null;
+        String protocol = null;
         try {
-            destination = new URL(repConf.getAttribute("destinationURL"));
+            destination = repConf.getAttribute("destinationURL");
+            int idx = destination.indexOf(':');
+            if ( idx == -1 )
+                throw new ComponentException
+                    ("destination is malformed. Must be a valid URL:
"+destination);
+            protocol = destination.substring(0,idx);
         } catch (ConfigurationException ce) {
             throw new ComponentException("Malformed configuration has no
destinationURL attribute", ce);
-        } catch (MalformedURLException mue) {
-            throw new ComponentException("destination is malformed. Must be
a valid URL", mue);
         }
----------------------------------------------------------------

Harmeet

----- Original Message -----
From: "Charles Benett" <charles@benett1.demon.co.uk>
To: <james-dev@jakarta.apache.org>
Sent: Monday, April 16, 2001 3:18 AM
Subject: Re: java.net.MalformedURLException: unknown protocol: town


> Steve,
> When I ported James from Avalon-1.2.1 to Avalon 3.0 I didn't have an
> RDBMS to test it against - which I pointed out on the list. I started
> looking at it last week and there are bugs. But I haven't pinned them
> down - although I found something different & corrected that.
>
> I suspect it is a very simple bug - we just need to find it. If you find
> it before I do, can you send a patch to the list? (See
> http://jakarta.apache.org/site/source.html for how to submit patches)
>
> Thanks,
>
> Charles
>
> Steve Cockwell wrote:
> >
> > I just moved from 1.2.1 to the CVS source (yesterdays).  Using the
> > supplied assembly.xml (same as james.conf.xml) if I uncomment:
> >
> > <spoolRepository>
> >         <repository destinationURL="town://mainspool" type="SPOOL"
> > model="SYNCHRONOUS">
> >                 <conn>file:///etc.....
> >         </repository>
> > </spoolRepository>
> >
> > I get the above error in the phoenix.log file.
> >
> > Also, there is a missing "/" in the supplied assembly.xml file for DBMS
> > user storage:
> >
> > <repository name="LocalUsers"
> > class="org.apache.james.userrepository.UsersTownRepository">
> >         <destination URL="town://users/">
> >         <conn>file:///var/maildatabase</conn>
> >         <table>Users</table>
> > </repository>
> >
> > Or perhaps the "/" should just be outside (instead of inside) the '"' on
> > the <destination> line?
> >
> > Thanks,
> >
> > ..src
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message