COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### JavaMail bug?

• Email
• Follow

I seem to have found a JavaMail-1.4.4 bug

If I try to open an SMTP connection by obtaining a transport instance
and then calling connect():

Transport tr = sesh.getTransport("smtp");

where:
sesh is the current mail session,
host is "zoogz.gregorie.org"
user is "kiwi"

Transport.connect() sets up the URLName "smtp://kiwi@zoogz.gregorie.org",
which is what I expect, but then promptly fails with:

javax.mail.MessagingException:
Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused

when the local Postfix MTA on the machine I'm connecting from
(zappa.gregorie.org) is stopped.

If I restart the local Postfix instance the connect request succeeds and
the mail message is sent, but its headers clearly show that JavaMail
delivered it to the local MTA, which then passed it to the Postfix MTA on
zoogz.gregorie.org, which has been listening on port 25 the whole time.

IOW the Transport.connect(host,user,password) method sets up its target
URL as expected but then promptly ignores it and defaults to connecting
to localhost on port 25.

Have any of you seen this problem?
Have I done anything stupid?
Is there a workround?

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/23/2011 8:32:46 PM

See related articles to this posting

On 7/23/2011 1:32 PM, Martin Gregorie wrote:
> I seem to have found a JavaMail-1.4.4 bug
>
> If I try to open an SMTP connection by obtaining a transport instance
> and then calling connect():
>
>              Transport tr = sesh.getTransport("smtp");
>
> where:
> 	sesh is the current mail session,
> 	host is "zoogz.gregorie.org"
> 	user is "kiwi"
>
> Transport.connect() sets up the URLName "smtp://kiwi@zoogz.gregorie.org",
> which is what I expect, but then promptly fails with:
>
> javax.mail.MessagingException:
> 	Could not connect to SMTP host: localhost, port: 25;
> nested exception is:
> 	java.net.ConnectException: Connection refused
>
> when the local Postfix MTA on the machine I'm connecting from
> (zappa.gregorie.org) is stopped.
>
> If I restart the local Postfix instance the connect request succeeds and
> the mail message is sent, but its headers clearly show that JavaMail
> delivered it to the local MTA, which then passed it to the Postfix MTA on
> zoogz.gregorie.org, which has been listening on port 25 the whole time.
>
> IOW the Transport.connect(host,user,password) method sets up its target
> URL as expected but then promptly ignores it and defaults to connecting
> to localhost on port 25.
>
> Have any of you seen this problem?
> Have I done anything stupid?
> Is there a workround?
>
>

The last time I used JavaMail I set it up differently with properties
and MimeMessages so I didn't use quite the same method as you did to
send.  That's one of the problems with JM, you can get at the problem
from about 50 different ways.  If you want to write a little simple test
program, I'll try it here.  I've got mail servers I can test it on
although I don't have the host names with quite the same organization.

There wouldn't be MX records on the DNS for zoogz would there?

--

Knute Johnson

 0
Reply september (33) 7/24/2011 3:54:31 AM

On Sat, 23 Jul 2011 20:54:31 -0700, Knute Johnson wrote:

> The last time I used JavaMail I set it up differently with properties
> and MimeMessages so I didn't use quite the same method as you did to
> send.  That's one of the problems with JM, you can get at the problem
> from about 50 different ways.  If you want to write a little simple test
> program, I'll try it here.  I've got mail servers I can test it on
> although I don't have the host names with quite the same organization.
>
Thanks. I'll put together a suitably parameterised test program over the
next day few days (it looks like soarable weather in the first half of
the week - something that's been all too rare recently to miss for
anything).

> There wouldn't be MX records on the DNS for zoogz would there?
>
Yes - I run a local DNS to handle names within my LAN and there is an MX
record for zoogz.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/24/2011 9:50:41 AM

On 7/24/2011 2:50 AM, Martin Gregorie wrote:
> On Sat, 23 Jul 2011 20:54:31 -0700, Knute Johnson wrote:
>
>> The last time I used JavaMail I set it up differently with properties
>> and MimeMessages so I didn't use quite the same method as you did to
>> send.  That's one of the problems with JM, you can get at the problem
>> from about 50 different ways.  If you want to write a little simple test
>> program, I'll try it here.  I've got mail servers I can test it on
>> although I don't have the host names with quite the same organization.
>>
> Thanks. I'll put together a suitably parameterised test program over the
> next day few days (it looks like soarable weather in the first half of
> the week - something that's been all too rare recently to miss for
> anything).
>
>> There wouldn't be MX records on the DNS for zoogz would there?
>>
> Yes - I run a local DNS to handle names within my LAN and there is an MX
> record for zoogz.

And it's pointing in the right place?

I just found out yesterday that my old friend Ron Gregg is running the
soaring operation at Crystallaire again.  I towed gliders and flight
instructed for him in the late 70s.  I've got to go out there and see
him and do some soaring this summer.  I'm off to Las Vegas today to
install some software but maybe next week.

--

Knute Johnson

 0
Reply september (33) 7/24/2011 4:27:49 PM

On 23/07/11 21:32, Martin Gregorie wrote:
> I seem to have found a JavaMail-1.4.4 bug
>
> If I try to open an SMTP connection by obtaining a transport instance
> and then calling connect():
>
>              Transport tr = sesh.getTransport("smtp");
>
> where:
> 	sesh is the current mail session,
> 	host is "zoogz.gregorie.org"
> 	user is "kiwi"
>
> Transport.connect() sets up the URLName "smtp://kiwi@zoogz.gregorie.org",
> which is what I expect, but then promptly fails with:
>
> javax.mail.MessagingException:
> 	Could not connect to SMTP host: localhost, port: 25;
> nested exception is:
> 	java.net.ConnectException: Connection refused
>
> when the local Postfix MTA on the machine I'm connecting from
> (zappa.gregorie.org) is stopped.
>
> If I restart the local Postfix instance the connect request succeeds and
> the mail message is sent, but its headers clearly show that JavaMail
> delivered it to the local MTA, which then passed it to the Postfix MTA on
> zoogz.gregorie.org, which has been listening on port 25 the whole time.
>
> IOW the Transport.connect(host,user,password) method sets up its target
> URL as expected but then promptly ignores it and defaults to connecting
> to localhost on port 25.

That certainly seems to be the problem. The MessagingException shows
it's failing to connect to localhost.

> Have any of you seen this problem?

No, mine works as expected. At least, when I attempt a simple
Transport.connect(host, user, pwd) it connects to my SMTP server on port
25. It doesn't authenticate because my SMTP server doesn't offer AUTH on
port 25. But it does connect to the correct host.

> Have I done anything stupid?

Hard to say with the limited code you've provided.

This is the code I'm testing with.

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.MimeMessage;

public class TestMail {

static String SMTP_SERVER = "yahoo.com";

public static void main(String[] args) {

// Get system properties
Properties props = System.getProperties();

// Setup mail server
props.put("mail.smtp.host", SMTP_SERVER);

// Get session
Session session = Session.getDefaultInstance(props, null);

try {
Transport tr = session.getTransport("smtp");
System.out.println(tr);
System.out.println(tr.getURLName());
}
catch(MessagingException e) {
e.printStackTrace();
}

}
}

The value of the parameter host to connect() is overriding that set in
the Properties, which the correct behaviour. The URL output is:
smtp://user@mail.ion.le.ac.uk

I see the connection on mail.ion.le.ac.uk, and the SMTP handshake, using
Wireshark.

My guess is that there's a mistake somewhere in the code you haven't
shown us yet.

BTW, what version of JavaMail are you using? I've tested the above code
with both 1.3.1 and 1.4.4.

--


 0
Reply nmw-news (85) 7/25/2011 2:40:44 PM

On Sun, 24 Jul 2011 09:27:49 -0700, Knute Johnson wrote:

> On 7/24/2011 2:50 AM, Martin Gregorie wrote:

>> Yes - I run a local DNS to handle names within my LAN and there is an
>> MX record for zoogz.
>
> And it's pointing in the right place?
>
Yes. I use Evolution on 'zappa' for general mail access. It is configured
to send mail to zoogz via SMTP and to get incoming mail from 'zoogz' via
a Dovecot POP3 server. This works regardless of whether the 'zappa' MTA
is running or not and, unlike the messages sent via JavaMail, *doesnt*

> I just found out yesterday that my old friend Ron Gregg is running the
> soaring operation at Crystallaire again.  I towed gliders and flight
> instructed for him in the late 70s.  I've got to go out there and see
> him and do some soaring this summer.
>
Where does Crystallaire fly out of? Its not a name I know.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/25/2011 7:36:51 PM

On Mon, 25 Jul 2011 15:40:44 +0100, Nigel Wade wrote:

> This is the code I'm testing with.
>
Thanks (test code snipped).

I'll compile and run that as well as extracting an SSCE from my own code.

> My guess is that there's a mistake somewhere in the code you haven't
> shown us yet.
>
Possibly. On a quick look everything within the try/catch bolck looks
like what I'm going but I'm less certain that there are no differences in
the preceeding code that's getting hold of the Session.

> BTW, what version of JavaMail are you using? I've tested the above code
> with both 1.3.1 and 1.4.4.
>
I first noticed it with JavaMail 1.4.3. Since I noticed the problem I've
installed 1.4.4 and *think* I've been running against it. I said 'think'
because the JavaMail jar is called mail.jar in both versions and, as I
didn't reboot the machine or logout between nominal 1.4.3 and 1.4.4 tests
I'm not 100% sure that the later jar file got loaded.

Is there anything I can do to check which jar file is loaded, i.e. are
there any distinguishing marks inside the jar file that would tell me

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/25/2011 7:54:27 PM

On Mon, 25 Jul 2011 19:54:27 +0000, Martin Gregorie wrote:

> On Mon, 25 Jul 2011 15:40:44 +0100, Nigel Wade wrote:
>
>> This is the code I'm testing with.
>>
> Thanks (test code snipped).
>
> I'll compile and run that as well as extracting an SSCE from my own
> code.
>
I meant to add that I'm sorting out a bit of C at present. Running your
test program and extracting my SSCE it on the list behind it.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/25/2011 8:11:31 PM

On 7/25/2011 12:36 PM, Martin Gregorie wrote:
> Where does Crystallaire fly out of? Its not a name I know.

Crystallaire is in Pearblossom, just a few miles southeast of Palmdale.
I met my wife there in 1976, she was one of my students.

--

Knute Johnson
s/knute/nospam/

 0
Reply nospam8071 (1252) 7/26/2011 6:00:24 AM

In article <YJsXp.28709$tp.6608@newsfe06.iad>, Knute Johnson says... > > On 7/25/2011 12:36 PM, Martin Gregorie wrote: > > Where does Crystallaire fly out of? Its not a name I know. > > Crystallaire is in Pearblossom, just a few miles southeast of Palmdale. > I met my wife there in 1976, she was one of my students. Uh, what? I always thought Pearblossom was just a small patch of empty land :) -- Steve Sobol - Programming/WebDev/IT Support sjsobol@JustThe.net   0 Reply sjsobol (523) 7/26/2011 6:18:05 AM On Mon, 25 Jul 2011 23:00:24 -0700, Knute Johnson wrote: > On 7/25/2011 12:36 PM, Martin Gregorie wrote: >> Where does Crystallaire fly out of? Its not a name I know. > > Crystallaire is in Pearblossom, just a few miles southeast of Palmdale. > I met my wife there in 1976, she was one of my students. Gotcha. Google Earth finds all. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |   0 Reply martin1645 (571) 7/26/2011 5:42:01 PM On Mon, 25 Jul 2011 23:18:05 -0700, Steve Sobol wrote: > In article <YJsXp.28709$tp.6608@newsfe06.iad>, Knute Johnson says...
>>
>> On 7/25/2011 12:36 PM, Martin Gregorie wrote:
>> > Where does Crystallaire fly out of? Its not a name I know.
>>
>> Crystallaire is in Pearblossom, just a few miles southeast of Palmdale.
>>   I met my wife there in 1976, she was one of my students.
>
> Uh, what? I always thought Pearblossom was just a small patch of empty
> land :)
>
The airfield is called Crystal, a few miles east of Pearblossom on the
far side of the river - follow the Pearblossom Highway until it crosses
the river and take the first turn south on 165 East. There's a trailer
park right next to it that makes Pearblossom look like paradise.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/26/2011 5:49:46 PM

On Mon, 25 Jul 2011 20:11:31 +0000, Martin Gregorie wrote:

> I meant to add that I'm sorting out a bit of C at present. Running your
> test program and extracting my SSCE it on the list behind it.
>
Sorted. Now back the the JavaMail problem:

I modified the TestMail SSCE to suit my environment by changing the
'mail.smtp.host' property to "ukfsn.org" (my ISP) and the transport
connect statement became

tr.connect("zoogz.gregorie.org", "kiwi", "n/a")

This works regardless of whether the local MTA is running or stopped.

Then I made my own SSCE, MATestMail, from code in my mail dispatch class.
The only differences between my SSCE and TestMail are that it does not
add the 'mail.smtp.host' property to system props and it gets the session
with "Session.getInstance(props)" rather than "Session.getDefaultInstance
(props, null)".

It also creates and sends a message to myself so the headers can be seen
and I added a quick and dirty hack to optionally turn on SMTP debugging.
Both turned out to be useful for working out exactly what was going on.

The 'gotcha' turned out to be my omission to set the 'mail.smtp.host'
property. I didn't do that because the connect() documentation says that
it overrides the default host. This turns out to be incorrect: the MTA
host named in connect() appears in all the debugging and is used by the
getURL method, *but* the hostname supplied in the 'mail.smtp.host'
property is what defines the MTA that is actually used. If the property
is omitted the MTA host name defaults to localhost.

When I added that property and messed about with its value I found the
following behaviour, which was clearly shown by looking at the test
message headers and the /var/log/maillog on zoogz:

- With the 'mail.smtp.host' property unset the local MTA is always used:
if its running the message is sent via 'localhost' and if it is stopped
JavaMail reports a connection failure.

- With it set to 'mail.ukfsn.org' the mail went via my ISP's mail server.

- With it set to 'zoogz.gregorie.org' the mail is sent directly to zoogz.

During all three property values the connect() method was using
"zoogz.gregorie.org" as the 'host' parameter.

For completeness, here's my SSCE:

import java.util.Date;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

public class MATestMail
{
public static void main(String args[])
{
String         host      = "zoogz.gregorie.org";
String         user      = "kiwi";
String         to        = "martin@gregorie.org";
String         from      = "ma@gregorie.org";
String         subject   = "Test message";
boolean        debug     = true;
Session        sesh;

try
{
Properties props = System.getProperties();

sesh = Session.getInstance(props);
if (args.length > 0)
sesh.setDebug(debug);

MimeMessage    msg  = new MimeMessage(sesh);
MimeMultipart  body = new MimeMultipart();
msg.setFrom(sender);
msg.setRecipients(Message.RecipientType.TO, recipients);
msg.setSubject(subject);
msg.setSentDate(new Date());
MimeBodyPart b = new MimeBodyPart();
b.setText("This is an SSCE test message\n");
msg.setContent(body);
msg.saveChanges();

Transport tr = sesh.getTransport("smtp");
System.out.println(tr);
System.out.println(tr.getURLName());
tr.send(msg);
tr.close();
}
catch(MessagingException e)
{
e.printStackTrace();
}
}
}

This SSCE doesn't set 'mail.smtp.host' and so will fail if the localhost
MTA isn't running: I develop on a Linux box, so there's always a local
MTA - hence the comment about the localhost MTA not running rather than
it not existing.

To make this SSCE connect directly to the target MTA (zoogz) I added the
statement:

props.put("mail.smtp.host", "zoogz.gregorie.org");

immediately after the 'Properties props = System.getProperties();'
statement.

The description of Transport.connect(host, user, password) is not at all
clearly written, but having read it and the description of
Transport.connect(user, password) I still think it means that the values
supplied as connect() parameters should take precedence over those set
via the property system, however connect() is plainly written to do the
opposite, leaving me to wonder why connect(host, user, password) even
exists.

So, what do you think: have I found a bug?

Many thanks to Nigel and Knute for helpful suggestions and example code.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 7/29/2011 9:32:23 PM

On 7/29/2011 2:32 PM, Martin Gregorie wrote:
> On Mon, 25 Jul 2011 20:11:31 +0000, Martin Gregorie wrote:
>
>> I meant to add that I'm sorting out a bit of C at present. Running your
>> test program and extracting my SSCE it on the list behind it.
>>
> Sorted. Now back the the JavaMail problem:
>
> I modified the TestMail SSCE to suit my environment by changing the
> 'mail.smtp.host' property to "ukfsn.org" (my ISP) and the transport
> connect statement became
>
>      tr.connect("zoogz.gregorie.org", "kiwi", "n/a")
>
> This works regardless of whether the local MTA is running or stopped.
>
> Then I made my own SSCE, MATestMail, from code in my mail dispatch class.
> The only differences between my SSCE and TestMail are that it does not
> add the 'mail.smtp.host' property to system props and it gets the session
> with "Session.getInstance(props)" rather than "Session.getDefaultInstance
> (props, null)".
>
> It also creates and sends a message to myself so the headers can be seen
> and I added a quick and dirty hack to optionally turn on SMTP debugging.
> Both turned out to be useful for working out exactly what was going on.
>
> The 'gotcha' turned out to be my omission to set the 'mail.smtp.host'
> property. I didn't do that because the connect() documentation says that
> it overrides the default host. This turns out to be incorrect: the MTA
> host named in connect() appears in all the debugging and is used by the
> getURL method, *but* the hostname supplied in the 'mail.smtp.host'
> property is what defines the MTA that is actually used. If the property
> is omitted the MTA host name defaults to localhost.
>
> When I added that property and messed about with its value I found the
> following behaviour, which was clearly shown by looking at the test
> message headers and the /var/log/maillog on zoogz:
>
> - With the 'mail.smtp.host' property unset the local MTA is always used:
>    if its running the message is sent via 'localhost' and if it is stopped
>    JavaMail reports a connection failure.
>
> - With it set to 'mail.ukfsn.org' the mail went via my ISP's mail server.
>
> - With it set to 'zoogz.gregorie.org' the mail is sent directly to zoogz.
>
> During all three property values the connect() method was using
> "zoogz.gregorie.org" as the 'host' parameter.
>
> For completeness, here's my SSCE:
>
> import java.util.Date;
> import java.util.Properties;
> import javax.mail.*;
> import javax.mail.internet.*;
>
> public class MATestMail
> {
>     public static void main(String args[])
>     {
>        String         host      = "zoogz.gregorie.org";
>        String         user      = "kiwi";
>        String         to        = "martin@gregorie.org";
>        String         from      = "ma@gregorie.org";
>        String         subject   = "Test message";
>        boolean        debug     = true;
>        Session        sesh;
>
>        try
>        {
>           Properties props = System.getProperties();
>
>           sesh = Session.getInstance(props);
>           if (args.length>  0)
>              sesh.setDebug(debug);
>
>           MimeMessage    msg  = new MimeMessage(sesh);
>           MimeMultipart  body = new MimeMultipart();
>           msg.setFrom(sender);
>           msg.setRecipients(Message.RecipientType.TO, recipients);
>           msg.setSubject(subject);
>           msg.setSentDate(new Date());
>           MimeBodyPart b = new MimeBodyPart();
>           b.setText("This is an SSCE test message\n");
>           msg.setContent(body);
>           msg.saveChanges();
>
>           Transport tr = sesh.getTransport("smtp");
>           System.out.println(tr);
>           System.out.println(tr.getURLName());
>           tr.send(msg);
>           tr.close();
>        }
>        catch(MessagingException e)
>        {
>           e.printStackTrace();
>        }
>     }
> }
>
> This SSCE doesn't set 'mail.smtp.host' and so will fail if the localhost
> MTA isn't running: I develop on a Linux box, so there's always a local
> MTA - hence the comment about the localhost MTA not running rather than
> it not existing.
>
> To make this SSCE connect directly to the target MTA (zoogz) I added the
> statement:
>
> 	props.put("mail.smtp.host", "zoogz.gregorie.org");
>
> immediately after the 'Properties props = System.getProperties();'
> statement.
>
> The description of Transport.connect(host, user, password) is not at all
> clearly written, but having read it and the description of
> Transport.connect(user, password) I still think it means that the values
> supplied as connect() parameters should take precedence over those set
> via the property system, however connect() is plainly written to do the
> opposite, leaving me to wonder why connect(host, user, password) even
> exists.
>
> So, what do you think: have I found a bug?
>
> Many thanks to Nigel and Knute for helpful suggestions and example code.
>

Looks like a bug to me.  I tried to search the Sun bug list but it isn't
working today.  I also looked around the Internet but didn't see
anything there either.  I'd try to file a bug report.

--

Knute Johnson

 0
Reply september (33) 7/29/2011 11:26:06 PM

On 29/07/11 22:32, Martin Gregorie wrote:
> The 'gotcha' turned out to be my omission to set the 'mail.smtp.host'
> property. I didn't do that because the connect() documentation says that
> it overrides the default host. This turns out to be incorrect: the MTA
> host named in connect() appears in all the debugging and is used by the
> getURL method,*but*  the hostname supplied in the 'mail.smtp.host'
> property is what defines the MTA that is actually used. If the property
> is omitted the MTA host name defaults to localhost.

That is in conflict with my findings.

If you look at the message I posted, with the code I sent, you'll see
that I set mail.smtp.host to yahoo.com. However, in  Transport.connect()
I explicitly connect to our mail server, overriding the value in the
mail.smtp.host property. This worked for me, as I mentioned in the post.
If I comment out that line, so mail.smtp.host is unset, it still
connects to our mail server as per the Transport.connect() host setting.

What does my code do if you run it exactly as is? Does it attempt to
connect to yahoo.com or our mail server (you won't actually be able to
connect, it's blocked on port 25)?

--

 0
Reply nmw-news (85) 8/1/2011 12:20:09 PM

Martin Gregorie <martin@address-in-sig.invalid> wrote:
> The 'gotcha' turned out to be my omission to set the 'mail.smtp.host'
> property. I didn't do that because the connect() documentation says that
> it overrides the default host. This turns out to be incorrect: the MTA
> host named in connect() appears in all the debugging and is used by the
> getURL method, *but* the hostname supplied in the 'mail.smtp.host'
> property is what defines the MTA that is actually used. If the property
> is omitted the MTA host name defaults to localhost.

Fwiw: I recently saw this kind of behaviour on Oracle on a Solaris host:
Some mailhost is configured for "smtp_out_server", which is supposed to
be used for utl_mail (pl/sql), but is also used for utl_smtp (ignoring
the hostname passed to utl_smtp.Open_Connection(...).)

I haven't used JavaMail myself, so can't say much about that.


 0
Reply avl1 (2753) 8/1/2011 12:54:18 PM

On Mon, 01 Aug 2011 13:20:09 +0100, Nigel Wade wrote:

> What does my code do if you run it exactly as is? Does it attempt to
> connect to yahoo.com or our mail server (you won't actually be able to
> connect, it's blocked on port 25)?
>
It fails connecting to your server.

So, where does THAT leave us? The only difference is that you call
getDefaultInstance(props) while I call getInstance(props) and, according
to the documentation, these should do exactly the same the first time
they're called.

BTW, I added the single property setting line to my application code so
that it uses the same hostname for 'mail.smtp.host' as connect(host,
user, passwd) does. That code now connects directly to the expected
server.

What does my SSCE do in your environment?

Do please post a response, but be aware that I'm unlikely to read it
until next week.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/1/2011 9:49:34 PM

On 01/08/11 22:49, Martin Gregorie wrote:
> On Mon, 01 Aug 2011 13:20:09 +0100, Nigel Wade wrote:
>
>> What does my code do if you run it exactly as is? Does it attempt to
>> connect to yahoo.com or our mail server (you won't actually be able to
>> connect, it's blocked on port 25)?
>>
> It fails connecting to your server.

Yes, well, that's what I said would happen.

>
> So, where does THAT leave us?

With the fact that it /attempted/ to connect to our mail server - not
localhost, and not yahoo.com.

> The only difference is that you call
> getDefaultInstance(props) while I call getInstance(props) and, according
> to the documentation, these should do exactly the same the first time
> they're called.

I see the same behaviour with either getDefaultInstance() or
getInstance() - it connects to our mail server.

>
> BTW, I added the single property setting line to my application code so
> that it uses the same hostname for 'mail.smtp.host' as connect(host,
> user, passwd) does. That code now connects directly to the expected
> server.
>
> What does my SSCE do in your environment?

I get:

javax.mail.MessagingException: Unknown SMTP host: zoogz.gregorie.org;
nested exception is:
java.net.UnknownHostException: zoogz.gregorie.org

I presume your DNS does not propagate upward from your zone. But it /is/
attempting to resolve that hostname via our DNS servers. It's not using
localhost.

--


 0
Reply nmw-news (85) 8/2/2011 3:34:20 PM

On Tue, 02 Aug 2011 16:34:20 +0100, Nigel Wade wrote:

>> What does my SSCE do in your environment?
>
> I get:
>
> javax.mail.MessagingException: Unknown SMTP host: zoogz.gregorie.org;
>    nested exception is:
>          java.net.UnknownHostException: zoogz.gregorie.org
>
> I presume your DNS does not propagate upward from your zone.
>
Correct. Its definitive only within my LAN and my firewall refused all
connections from outside.

> But it /is/ attempting to resolve that hostname via our DNS servers.
> It's not using localhost.
>
Interesting. I wonder why we're seeing a difference.
I assume you ran it with no command line arguments except (possibly)
'debug'.

When I do that the debugging text says that it was trying to connect to
zoogz.gregorie.org.  Lines 7 and 8 show the first 220 followed a DEBUG
line reporting this. Then lines 31 and 32 report a failure to connect to
localhost and the resulting exception. If you're following this with
Wireshark I'd expect you to see the first connect attempt but maybe not
the second. Here's the debugging output:

$java MATestMail debug DEBUG: setDebug: JavaMail version 1.4.4 DEBUG: getProvider() returning javax.mail.Provider [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth false DEBUG SMTP: trying to connect to host "zoogz.gregorie.org", port 25, isSSL false 220 zoogz.gregorie.org ESMTP Postfix DEBUG SMTP: connected to host "zoogz.gregorie.org", port: 25 EHLO zappa.gregorie.org 250-zoogz.gregorie.org 250-PIPELINING 250-SIZE 51200000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN DEBUG SMTP: Found extension "PIPELINING", arg "" DEBUG SMTP: Found extension "SIZE", arg "51200000" DEBUG SMTP: Found extension "VRFY", arg "" DEBUG SMTP: Found extension "ETRN", arg "" DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg "" DEBUG SMTP: Found extension "8BITMIME", arg "" DEBUG SMTP: Found extension "DSN", arg "" smtp://kiwi@zoogz.gregorie.org smtp://kiwi@zoogz.gregorie.org DEBUG: getProvider() returning javax.mail.Provider [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth false DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused at com.sun.mail.smtp.SMTPTransport.openServer (SMTPTransport.java:1934) at com.sun.mail.smtp.SMTPTransport.protocolConnect (SMTPTransport.java:638) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at MATestMail.main(MATestMail.java:59) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) at java.net.PlainSocketImpl.connectToAddress (PlainSocketImpl.java:213) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at com.sun.mail.util.SocketFetcher.createSocket (SocketFetcher.java:288) at com.sun.mail.util.SocketFetcher.getSocket (SocketFetcher.java:231) at com.sun.mail.smtp.SMTPTransport.openServer (SMTPTransport.java:1900) ... 7 more At this point I really am going to drop off the net for a few days - got a 5AM start tomorrow. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |   0 Reply martin1645 (571) 8/2/2011 8:01:36 PM On 02/08/11 21:01, Martin Gregorie wrote: > On Tue, 02 Aug 2011 16:34:20 +0100, Nigel Wade wrote: > >>> What does my SSCE do in your environment? >> >> I get: >> >> javax.mail.MessagingException: Unknown SMTP host: zoogz.gregorie.org; >> nested exception is: >> java.net.UnknownHostException: zoogz.gregorie.org >> >> I presume your DNS does not propagate upward from your zone. >> > Correct. Its definitive only within my LAN and my firewall refused all > connections from outside. > >> But it /is/ attempting to resolve that hostname via our DNS servers. >> It's not using localhost. >> > Interesting. I wonder why we're seeing a difference. > I assume you ran it with no command line arguments except (possibly) > 'debug'. I doubt it would help. Since the host doesn't resolve, there's really nothing to debug. It can't connect to anything because it has no IP for the connect. > > When I do that the debugging text says that it was trying to connect to > zoogz.gregorie.org. Lines 7 and 8 show the first 220 followed a DEBUG > line reporting this. Then lines 31 and 32 report a failure to connect to > localhost and the resulting exception. If you're following this with > Wireshark I'd expect you to see the first connect attempt but maybe not > the second. Here's the debugging output: > >$ java MATestMail debug
> DEBUG: setDebug: JavaMail version 1.4.4
> DEBUG: getProvider() returning javax.mail.Provider
> [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "zoogz.gregorie.org", port 25, isSSL
> false
> 220 zoogz.gregorie.org ESMTP Postfix
> DEBUG SMTP: connected to host "zoogz.gregorie.org", port: 25

Here, you have connected to your mail server zoogz.gregorie.org

>
> EHLO zappa.gregorie.org
> 250-zoogz.gregorie.org
> 250-PIPELINING
> 250-SIZE 51200000
> 250-VRFY
> 250-ETRN
> 250-ENHANCEDSTATUSCODES
> 250-8BITMIME
> 250 DSN

and received the standard mail server 250 connection response.

Note that it does not include AUTH, so no authentication will be allowed
and the client should not attempt it.

> DEBUG SMTP: Found extension "PIPELINING", arg ""
> DEBUG SMTP: Found extension "SIZE", arg "51200000"
> DEBUG SMTP: Found extension "VRFY", arg ""

This isn't a good idea. It's an open invitation to spammers to verify
the existence of every recipient in your domain.

> DEBUG SMTP: Found extension "ETRN", arg ""
> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> DEBUG SMTP: Found extension "8BITMIME", arg ""
> DEBUG SMTP: Found extension "DSN", arg ""
> smtp://kiwi@zoogz.gregorie.org
> smtp://kiwi@zoogz.gregorie.org
> DEBUG: getProvider() returning javax.mail.Provider
> [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false

I presume that this is due to the fact that the connect() above failed.
You have specified authentication by using a user/password, but the
connection does not allow authentication. When you subsequently use
tr.send() there is no open session so a default session is created which
appears to be to localhost.

> javax.mail.MessagingException: Could not connect to SMTP host: localhost,
> port: 25;
>    nested exception is:
> 	java.net.ConnectException: Connection refused
> 	at com.sun.mail.smtp.SMTPTransport.openServer
> (SMTPTransport.java:1934)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect
> (SMTPTransport.java:638)
> 	at javax.mail.Service.connect(Service.java:295)
> 	at javax.mail.Service.connect(Service.java:176)
> 	at javax.mail.Service.connect(Service.java:125)
> 	at javax.mail.Transport.send0(Transport.java:194)
> 	at javax.mail.Transport.send(Transport.java:124)
> 	at MATestMail.main(MATestMail.java:59)
> Caused by: java.net.ConnectException: Connection refused
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
> (PlainSocketImpl.java:213)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
> 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> 	at java.net.Socket.connect(Socket.java:529)
> 	at java.net.Socket.connect(Socket.java:478)
> 	at com.sun.mail.util.SocketFetcher.createSocket
> (SocketFetcher.java:288)
> 	at com.sun.mail.util.SocketFetcher.getSocket
> (SocketFetcher.java:231)
> 	at com.sun.mail.smtp.SMTPTransport.openServer
> (SMTPTransport.java:1900)
> 	... 7 more
>
> At this point I really am going to drop off the net for a few days - got
> a 5AM start tomorrow.
>
>


 0
Reply nmw-news (85) 8/3/2011 8:27:43 AM

I've just been reviewing the JavaMail API as it's a while since I used
it. You need to be aware that Transport.send() is a /static/ method. I
presume this means it takes no note of any connection established by an
object of class Transport, since the class method has no knowledge of
any contents of any Transport object. That probably explains why it uses
the values in the Session, not those established by the Transport object
you've created.

--


 0
Reply nmw-news (85) 8/3/2011 8:38:41 AM

On Wed, 03 Aug 2011 09:27:43 +0100, Nigel Wade wrote:

> Note that it does not include AUTH, so no authentication will be allowed
> and the client should not attempt it.
>
Fair point.

> This isn't a good idea. It's an open invitation to spammers to verify
> the existence of every recipient in your domain.
>
Except that this server really is private: my firewall blocks all inbound
connection requests and so its only contact with the outside world are
its outbound SMTP connections to my ISP's mail server when it needs to
send mail. Incoming mail is fetched by getmail and passed to the MTA via
the Postfix.sendmail utility.

> I presume that this is due to the fact that the connect() above failed.
> You have specified authentication by using a user/password, but the
> connection does not allow authentication. When you subsequently use
> tr.send() there is no open session so a default session is created which
> appears to be to localhost.
>
OK, that makes sense.

behaviour I'm seeing, but there's still a heap of anomalies, mainly in
the documentation:

- Transport.send() says that its not a good idea to inherit the
connection from a Session and doesn't provide a suitable way of setting
the hostname (at least its docs don't mention one or mention the use of
properties, though obviously they are used by it.

- now go and look at SMTPTransport. Its documentation includes
example code doing as we did, and getting the connection from Session.

Gaargh!

The double connect is now explained by the Session.connect() making one
connection and Transport.send() making a second

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/8/2011 10:50:12 PM

On 08/08/11 23:50, Martin Gregorie wrote:
> On Wed, 03 Aug 2011 09:27:43 +0100, Nigel Wade wrote:
>
>> Note that it does not include AUTH, so no authentication will be allowed
>> and the client should not attempt it.
>>
> Fair point.
>
>> This isn't a good idea. It's an open invitation to spammers to verify
>> the existence of every recipient in your domain.
>>
> Except that this server really is private: my firewall blocks all inbound
> connection requests and so its only contact with the outside world are
> its outbound SMTP connections to my ISP's mail server when it needs to
> send mail. Incoming mail is fetched by getmail and passed to the MTA via
> the Postfix.sendmail utility.

Ok. Fairy snuff.

Personally I'd still get rid of it unless you are actively using it.
It's somewhat in the realm of "security by obscurity". There's a potential for the vulnerability to be exposed, or for the configuration to migrate somewhere where it is exposed. Imagine your firewall goes down, the mail server stops working and users are clamouring for their email (it's like a drug here, users will get along without any other system, but not the mail server). Panic, Panic. Bypass the broken firewall to get the mail server back online - and now you're exposed.

>
>> I presume that this is due to the fact that the connect() above failed.
>> You have specified authentication by using a user/password, but the
>> connection does not allow authentication. When you subsequently use
>> tr.send() there is no open session so a default session is created which
>> appears to be to localhost.
>>
> OK, that makes sense.
>
> Your point about Transport.send() being static would seem to explain the
> behaviour I'm seeing, but there's still a heap of anomalies, mainly in
> the documentation:
>
> - Transport.send() says that its not a good idea to inherit the
>    connection from a Session and doesn't provide a suitable way of setting
>    the hostname (at least its docs don't mention one or mention the use of
>    properties, though obviously they are used by it.
>
> - now go and look at SMTPTransport. Its documentation includes
>    example code doing as we did, and getting the connection from Session.
>

I see the documentation showing use of Transport.sendMessage() (an abstract
instance method) following a Session.getTransport().

I don't see use of Transport.send().

--

 0
Reply nmw-news (85) 8/9/2011 12:31:49 PM

On Tue, 09 Aug 2011 13:31:49 +0100, Nigel Wade wrote:

> Personally I'd still get rid of it unless you are actively using it.
> It's somewhat in the realm of "security by obscurity". There's a
> potential for the vulnerability to be exposed, or for the configuration
> to migrate somewhere where it is exposed.
>
Its unlikely that anything like that would happen. This is my house
server that I'm describing. The config is whatever I set it to and nobody
else is ever likely to touch it.

> down, the mail server stops working
>
Indeed. If the firewall breaks, nothing will work until it gets replaced.

> I see the documentation showing use of Transport.sendMessage() (an
> abstract instance method) following a Session.getTransport().
>
Sure, but they are all static apart from sendMessage, which is abstract.

> I don't see use of Transport.send().
>
True enough.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/9/2011 10:47:03 PM

On 09/08/11 23:47, Martin Gregorie wrote:
> On Tue, 09 Aug 2011 13:31:49 +0100, Nigel Wade wrote:
>

>> I see the documentation showing use of Transport.sendMessage() (an
>> abstract instance method) following a Session.getTransport().
>>
> Sure, but they are all static apart from sendMessage, which is abstract.

It's sendMessage() which they use in the example, not any of the static
methods - that's the important fact. sendMessage() must be implemented
by whatever class creates the Transport which is returned by
Session.getTransport(), it could not instantiate a Transport unless it

--


 0
Reply nmw-news (85) 8/10/2011 8:34:40 AM

On Wed, 10 Aug 2011 09:34:40 +0100, Nigel Wade wrote:

> It's sendMessage() which they use in the example, not any of the static
> methods - that's the important fact. sendMessage() must be implemented
> by whatever class creates the Transport which is returned by
> Session.getTransport(), it could not instantiate a Transport unless it
> had implemented the abstract methods.
>
Thanks for the reminder. I was knackered last night due to having flown a
4 1/4 hour soaring flight yesterday PM and that didn't register.

I still think we're dealing with an ugly bit of design, though: IMO there
too many ways of specifying the MTA host and login parameters and, worse,
the design decision to use static methods has prevented these from being
orthogonal to the methods that send messages.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/10/2011 7:37:13 PM

On Wed, 03 Aug 2011 09:38:41 +0100, Nigel Wade wrote:

> I've just been reviewing the JavaMail API as it's a while since I used
> it. You need to be aware that Transport.send() is a /static/ method. I
> presume this means it takes no note of any connection established by an
> object of class Transport, since the class method has no knowledge of
> any contents of any Transport object. That probably explains why it uses
> the values in the Session, not those established by the Transport object
> you've created.
>
Final comment:

On Sunday this whole mess niggled me again, so I ripped out the property
setting the default MTAname and replaced the call of tr.send(msg) with
tr.sendMessage(msg, recipients) so the Transport acquired from the
Session is used. This all works as expected: there's only the one EHLO
conversation and the recipient is validated (which I don't remember
seeing earlier).

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/16/2011 9:06:14 PM

On 16/08/11 22:06, Martin Gregorie wrote:
> On Wed, 03 Aug 2011 09:38:41 +0100, Nigel Wade wrote:
>
>> I've just been reviewing the JavaMail API as it's a while since I used
>> it. You need to be aware that Transport.send() is a /static/ method. I
>> presume this means it takes no note of any connection established by an
>> object of class Transport, since the class method has no knowledge of
>> any contents of any Transport object. That probably explains why it uses
>> the values in the Session, not those established by the Transport object
>> you've created.
>>
> Final comment:
>
> On Sunday this whole mess niggled me again, so I ripped out the property
> setting the default MTAname and replaced the call of tr.send(msg) with
> tr.sendMessage(msg, recipients) so the Transport acquired from the
> Session is used. This all works as expected: there's only the one EHLO
> conversation and the recipient is validated (which I don't remember
> seeing earlier).
>
>

Yes, I think that's the best way to do authentication. If you look at
the top of the Javadocs for com.sun.mail.smtp (the protocol which is
actually used behind the scenes, it's not exactly obvious because the
design hides this from you) it states:

To use SMTP authentication you'll need to set the mail.smtp.auth
property (see below) or provide the SMTP Transport with a username and
password when connecting to the SMTP server. You can do this using one
of the following approaches:

* Provide an Authenticator object when creating your mail Session
Authenticator callback.

Note that the mail.smtp.user property can be set to provide a
default username for the callback, but the password will still need to
be supplied explicitly.

This approach allows you to use the static Transport send method
to send messages.

* Call the Transport connect method explicitly with username and

This approach requires you to explicitly manage a Transport
object and use the Transport sendMessage method to send the message. The
transport.java demo program demonstrates how to manage a Transport
object. The following is roughly equivalent to the static Transport send

Transport tr = session.getTransport("smtp");
msg.saveChanges();      // don't forget this
tr.sendMessage(msg, msg.getAllRecipients());
tr.close();

--

 0
Reply nmw-news (85) 8/17/2011 9:29:24 AM

On Wed, 17 Aug 2011 10:29:24 +0100, Nigel Wade wrote:

> On 16/08/11 22:06, Martin Gregorie wrote:
>> On Wed, 03 Aug 2011 09:38:41 +0100, Nigel Wade wrote:
>>
>>> I've just been reviewing the JavaMail API as it's a while since I used
>>> it. You need to be aware that Transport.send() is a /static/ method. I
>>> presume this means it takes no note of any connection established by
>>> an object of class Transport, since the class method has no knowledge
>>> of any contents of any Transport object. That probably explains why it
>>> uses the values in the Session, not those established by the Transport
>>> object you've created.
>>>
>> Final comment:
>>
>> On Sunday this whole mess niggled me again, so I ripped out the
>> property setting the default MTAname and replaced the call of
>> tr.send(msg) with tr.sendMessage(msg, recipients) so the Transport
>> acquired from the Session is used. This all works as expected: there's
>> only the one EHLO conversation and the recipient is validated (which I
>> don't remember seeing earlier).
>>
>>
>>
> Yes, I think that's the best way to do authentication. If you look at
> the top of the Javadocs for com.sun.mail.smtp (the protocol which is
> actually used behind the scenes, it's not exactly obvious because the
> design hides this from you) it states:
>
> To use SMTP authentication you'll need to set the mail.smtp.auth
> property (see below) or provide the SMTP Transport with a username and
> password when connecting to the SMTP server. You can do this using one
> of the following approaches:
>
Yes, I found that too.

>            Transport tr = session.getTransport("smtp");
>                // don't forget this tr.sendMessage(msg,
>            msg.getAllRecipients());
>            tr.close();
>
I'm not calling Message.saveChanges(), but as something wrapped your text
up in a bit of a ball I'm not sure that your 'don't forget'  refers to.
Instead I hung onto the recipient array and just passed it into
Transport.sendMessage(). It also works correctly.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/17/2011 7:54:15 PM

On 17/08/11 20:54, Martin Gregorie wrote:

>>
> I'm not calling Message.saveChanges(), but as something wrapped your text
> up in a bit of a ball I'm not sure that your 'don't forget'  refers to.
> Instead I hung onto the recipient array and just passed it into
> Transport.sendMessage(). It also works correctly.
>

It isn't "mine". It's a quote from the Javadocs. It refers to the
saveMessage(), which I've never used. I presume that's in case you want
to save the changes to the messages into some message store (Drafts?).
The entire package is rather convoluted for simple message
generation/submission.

I don't know why you don't see the text correctly. The post appears ok
newsreader doesn't like that.  But, as far as I can tell, the code part
is correctly line-wrapped anyway, rather than flowed.

--

 0
Reply nmw-news (85) 8/18/2011 8:34:21 AM

On Thu, 18 Aug 2011 09:34:21 +0100, Nigel Wade wrote:

> It isn't "mine". It's a quote from the Javadocs. It refers to the
> saveMessage(), which I've never used.
>
Thanks for the clarification.

> I presume that's in case you want
> to save the changes to the messages into some message store (Drafts?).
>
Thats what the method description says its for.

> The entire package is rather convoluted for simple message
> generation/submission.
>
It certainly gives me the impression of having been written before it was
designed or documented and that it wasn't fully understood by the
documentation's author.

> I don't know why you don't see the text correctly. The post appears ok
> viewed in my newsreader (Thunderbird).
>
OK. I thought that finding "msg.saveMessage();" had been wrapped onto the
end of the preceding line since the rest of the snippet is one statement
per line. I've noticed that some constructions - particularly 'bulleted
points', i.e. lines each starting with '- ' tend to get wrapped by
something in USENET and thought this was another case of it.

--
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

 0
Reply martin1645 (571) 8/18/2011 7:50:54 PM

30 Replies
50 Views

Similar Articles

12/6/2013 9:01:34 AM
page loaded in 4737 ms. (0)

Similar Artilces:

bug or feature?
Hi there, in the IDL 6.3 documentation it says: Dollar Sign ($) The dollar sign at the end of a line indicates that the current statement is continued on the following line. The dollar sign character can appear anywhere a space is legal except within a string constant or between a function name and the first open parenthesis. Any number of continuation lines are allowed. So I do: IDL>plot, indgen(23), indgen(23), xminor = 4 Lovely! However: IDL>plot, indgen(23), indgen(23), xminor$ plot, indgen(23), indgen(23), xminor \$ ^ IDL: PLOT: Incorrect number of arguments. plot, indgen(

rubygem BUG
; from /home/cec/s/c/cc1/usr/bin/gem:694 Should bug reports like this go to c.l.r. or to the rubyforge bug reports page or the wiki or something? Charles Comstock Charles wrote: > Noticed this while I was playing around trying to uninstall my older > version of rake with rubygems: > > Attempting to uninstall gem 'rake' > Select RubyGem to uninstall: > 1. rake-0.3.1 > 2. rake-0.3.2 > 3. All versions > > 3 > /home/cec/s/c/cc1/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:282:in > uninstall': undefined method remove_all' for [...] Sigh. That's another one of my achievements :( Will be fixed in CVS real soon. > Should bug reports like this go to c.l.r. or to the rubyforge bug > reports page or the wiki or something? I suppose the rubyforge bug report is most appropriate, but I don't mind where it's reported, as long as I find out :) Cheers, Gavin On 3/5/2004, at 1:59 AM, Charles Comstock wrote: > Noticed this while I was playing around trying to uninstall my older > version of rake with rubygems: > > Attempting to uninstall gem 'rake' > Select RubyGem

Is that a bug for JTabbedPane?
Hi, I found that in JTabbedPane, when I set tabLayoutPolicy to "SCROLL_TAB_LAYOUT", it can't return the correct number of tab for the function "getComponentCount()", it return with add 3 so if there is 4 tab then it return 7...... but when I set tabLayoutPolicy to "WRAP_TAB_LAYOUT", then the function "getComponentCount()" can return correct number of tab that is 4. Is that a bug?!!!!! James wrote: > Hi, I found that in JTabbedPane, when I set tabLayoutPolicy to > "SCROLL_TAB_LAYOUT", it can't return the correct number of tab for the > function "getComponentCount()", it return with add 3 so if there is 4 tab > then it return 7...... > but when I set tabLayoutPolicy to "WRAP_TAB_LAYOUT", then the function > "getComponentCount()" can return correct number of tab > that is 4. > Is that a bug?!!!!! > > Use JTabbedPane.getTabCount() instead. AFAIK it's not a bug. If the layout policy is set to SCROLL_TAB_LAYOUT, two arrow buttons will become visible if not all the tabs can be displayed (allowing you to scroll the tabs). Just like the tabs themselves

Weird Bug ( And Weird Google Bug...??? )
i posted this yesterday with the Google Groups dealie, and it's not here, so i'm posting again, but there seems to be a lack of recent postings... altogether...??? anyways... Concerning the HP48 Try this: { #2d #2d } 1 << TYPE >> DOLIST and it returns { 10 10 } But it doesn't == a typed in { 10 10 } !!! Nor is it the SAME...!!! In fact you can EVAL 2 ->LIST it and it still doesn't == { 10 10 } You can save it, and it still won't == { 10 10 } You can HEAD it, and 10 == 10 But if you TAIL it, { 10 } Does Not == { 10 } !!! What is What...??? Hi, Of course you

If it looks like a bug acts like a bug ...
I say its a bug. What do you think? public class test public static void main(String args) int n Integer I I = new Integer(0) for (int i = 0 i < 5 i++) System.out.println("n = "+I) n = I.intValue() I = new Integer(n+1) //increment// I = new Integer(0) for (int i = 0 i < 5 i++) System.out.println("n = "+I) n = I.intValue() I = new Integer(n++) //increment// P.S. Thank you, Raymond DeCampo, for you help with the porxyHost System propery problem. Nomen Nescio wrote: > I say its a bug. What do you think? > > public class test > public static void main(String args) > > int n > Integer I > > I = new Integer(0) > for (int i = 0 i < 5 i++) > System.out.println("n = "+I) > n = I.intValue() > I = new Integer(n+1) //increment// > > > I = new Integer(0) > for (int i = 0 i < 5 i++) > System.out.println("n = "+I) > n

histeq
Hi all, some results I dont understand: whos IMG Name Size Bytes Class Attributes IMG 1500x1800 2700000 uint8 size(unique(IMG)) ans = 198 1 size(unique(histeq(IMG))) ans = 2 1 with values 251 255 is not the 'transform minimizing...' according to the docs? my mistake? Felix.

action performed bug?
While working with JButton class I experienced this problem: The method ActionPerformed is executing twice instead of once like it should normaly be. I cannot find out the reason why it's happening. Anyone can help? "Perica Milosevic" <hyle@tesla.rcub.bg.ac.yu> wrote in message news:9fb85d62.0311040628.6a721fe1@posting.google.com... > While working with JButton class I experienced this problem: > The method ActionPerformed is executing twice instead of once like it > should normaly be. > I cannot find out the reason why it's happening. Anyone can help?

Bug in beamer / \reset@color
Hello, In the beamer class, \reset@color does \unskip. This removes coloured leaders under certain circumstances. % ------------------------------------------------------- \documentclass {beamer} \usepackage {etex,colortbl} \begin{document} \null\vskip25mm {\loggingall A: {\color{red}\leaders \hrule \hfil}\null }% *FAIL* {B: \color{red}\leaders \hrule \hfil\null }% PASS {\loggingall \arrayrulecolor{cyan} \begin{tabular}{ c } \cline{1-1} % *FAIL* Hello World \end{tabular} } \end{document}\endinput % --------------------------------------------------------- Regards.

bug in j2me implementation of Random?
bug in j2me Random implementation? From: tom arnall <kloro2006@gmail.com> To: Date: Sunday 05:17:49 pm the following: public class Test1 extends MIDlet implements CommandListener { public void startApp() { Random rand = new Random(); System.out.println(rand.nextInt(5)); } . . . from the J2me compiler gets: home/kloro/cell/WTK2.2/apps/Test1/src/Test1.java:11: nextInt() in java.util.Random cannot be applied to (int) System.out.println(rand.nextInt(5)); yet the doc' for Random states in the methods section: nextInt(int n) - Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. same type of result for long, double, short. kloro wrote: > bug in j2me Random implementation? > From: > tom arnall <kloro2006@gmail.com> > To: > Date: > Sunday 05:17:49 pm > the following: > > public class Test1 extends MIDlet implements

Nested packages and import order bug
Hi all, I have a package a.b with the following content: a/b/__init__.py: import a.b dir(a.b) Running "import a.b" generates an AttributeError for b, obviously the import didn't add b to the module "a". Even though it can be argued that importing a package from within is bad style, this a clearly a bug since its at least surprising. Shouldn't the import create the namespace entry in a after it created the module entry in sys.modules? Therefore should I submit a bug report? Joerg On Monday, October 6, 2003, at 11:53 AM, Joerg Sonnenberger wrote: > Hi all, > I have a package a.b with the following content: > > a/b/__init__.py: > import a.b > dir(a.b) > > Running "import a.b" generates an AttributeError for b, obviously > the import didn't add b to the module "a". Even though it can be > argued that importing a package from within is bad style, this > a clearly a bug since its at least surprising. This sort of bug is more common with circular imports, but in this case the circle is very small (the module importing itself). The module isn't "imported" until all its