Fwd: About "org.apache.commons.lang.time.DateUtils.getFragmentInHours ()" method

2011-07-06 Thread Gary Gregory
Begin forwarded message:

From: lupeng0527 mailto:lupeng0...@163.com>>
Date: July 6, 2011 21:53:55 EDT
To: sergek mailto:ser...@lokitech.com>>, ggregory 
mailto:ggreg...@seagullsw.com>>
Subject: About "org.apache.commons.lang.time.DateUtils.getFragmentInHours ()" 
method

Hello  Serge Knystautas, Gary Gregory:

I'm Lupeng.I come from China.I'm not good at English.If you do not understand, 
like him to forgive.
I like the Apache Software. But when I was learning commons-lang-2.5.jar,I 
encountered a problem.

Problem Description:
org.apache.commons.lang.time.DateUtils.getFragmentInHours(),
API(http://commons.apache.org/lang/api-2.5/index.html):
 static long getFragmentInHours(Calendar calendar, int fragment) method

My Example:
--
Calendar c = Calendar.getInstance();
long h = DateUtils.getFragmentInHours(cal, Calendar.MONTH);
String s = DateFormatUtils.format(cal, "-MM-dd HH:mm:ss");
System.out.println(s + "\t" + h);

// The results:
time: 2011-07-07 09:24:13 hour: 177
// However, after calculation, the results should not be a 177, the result is  
(6*24+9)=153
---


API example of official website:
---
// 2008-01-01 07:15:10
January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 7

// The results:  7
---


When I use, the result is not the same:
---
// Set Time
Calendar c2 = Calendar.getInstance();
c2.set(Calendar.YEAR, 2008);
c2.set(Calendar.MONTH, 00);
c2.set(Calendar.DAY_OF_MONTH, 01);
c2.set(Calendar.HOUR_OF_DAY, 7);
c2.set(Calendar.MINUTE, 15);
c2.set(Calendar.SECOND, 10);
c2.set(Calendar.MILLISECOND, 538);

long h2 = DateUtils.getFragmentInHours(c2, Calendar.MONTH);
String s2 = DateFormatUtils.format(c2, "-MM-dd HH:mm:ss.SSS");
System.out.println("time: " + s2 + "\thour:" + h2);

// The results:
time: 2008-01-01 07:15:10.538  hour:31
// Same period of time, but the results of different
---

Explanation:

I do not know my program is correct.
If the program is incorrect, please point it out!
If the program is correct,my results with the API results different. So special 
to ask!
Thank you,Waiting for your reply (please be concise language when you reply).

Personal information:

Name: Lupeng
E-mail:  
lupeng0...@163.com
MSN:  luepng0...@msn.com
Address: Beijing, China

2011-07-07

lupeng0527

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jexl] Differences between Expression, Script and Unified

2011-07-06 Thread henrib
Added your precisions to o.a.c.JEXL package.html in trunk.
Thanks again.

--
View this message in context: 
http://apache-commons.680414.n4.nabble.com/jexl-Differences-between-Expression-Script-and-Unified-tp3626808p3650547.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jexl] JEXL Secure Sandbox

2011-07-06 Thread henrib
Hi Sarel;

This is very interesting; I'm also evaluating options to implement
"sandboxed" evaluation.

1. The "white-list" classes could be addressed by (adding code to) filter
which classes can be instantiated (a pattern matching on the full class name
or even further, a JEXL expression to use as a condition).
1bis: There is also the case of "white-list" properties where you may want
to hide some properties; an annotation would come to mind but this is
intrusive.  A less intrusive one would be to describe those as a map of
class name to allowed method names/signatures list.

The Uberspect could most likely be derived to handle the filtering. It could
also handle the getClass and forName (2) issue since this is can be see as a
specialized filter on Object and Class / ClassLoader.

3. It may be easier to put a file() and/or url() function on the top-level
context (ie in the JexlContext) that filter the path (pattern matching or
JEXL expression) and of course, filter out the File and URL classes. By only
providing what can be accessed through functions, we flank the problem of
resource access in a generic unintrusive way.

4. I would tend to rely on the Interpreter class (rather than the
JexlArithmetic) which is definitely involved in each call; override each
visit method, check if time did not run-out and delegate to original visit
if ok. No external watchdog would be needed this way; may be a dedicated
(runtime) exception could be used to traverse up the stack and end the
script.

This could be provided as a SandBoxed engine - created from a JexlEngine
instance through a createSandboxed(Map>
whiteList, int timeOut) to filter classes/methods - that would wrap/delegate
to a filtering Uberspect and time-checking Interpreter.

Comments, loopholes, etc more than welcome. :-)
Cheers
Henrib


--
View this message in context: 
http://apache-commons.680414.n4.nabble.com/jexl-JEXL-Secure-Sandbox-tp3626959p3650468.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [email] Email attachment is inline for some reason

2011-07-06 Thread David Hoffer
Yes, with this changed it works great!  Thanks for your help!

-Dave

On Wed, Jul 6, 2011 at 8:07 AM, Siegfried Goeschl
 wrote:
> Hi David,
>
> the following snippet might help if you update it accordingly - this are the
> exclude I'm using for one of my projects.
>
> If it works please don't hesitate to send a success message - we all love to
> hear when something works ... ;-)
>
> Cheers,
>
> Siegfried Goeschl
>
>     
>     
>     org.apache.cxf
>     cxf-rt-frontend-jaxws
>     ${it20one.cxf.version}
>     
>     
>     org.apache.geronimo.specs
>     geronimo-javamail_1.4_spec
>     
>     
>     org.apache.geronimo.specs
>     geronimo-activation_1.1_spec
>     
>     
>     
>     
>     org.apache.cxf
>     cxf-rt-transports-http
>     ${it20one.cxf.version}
>     
>     
>     org.apache.geronimo.specs
>     geronimo-javamail_1.4_spec
>     
>     
>     org.apache.geronimo.specs
>     geronimo-activation_1.1_spec
>     
>     
>     
>
>
> On 06.07.11 15:31, David Hoffer wrote:
>
> Or can/should I configure commons-email to use geronimo?
>
> -Dave
>
> On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer  wrote:
>>
>> I didn't think so at first...but yes I do have
>> geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
>> plus a bunch of other geronimo-xxx jars.  I'm not sure where these came from
>> but I do use CXF (web service) so I'm guessing geronimo is used by CXF.
>> Also I have activation-1.1.jar and mail-1.4.1.jar used by
>> commons-email-1.2.jar.
>>
>> Is that the problem that I have two mail jars?  Can I safely exclude the
>> geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
>> from CXF's dependencies?
>>
>> Thanks,
>> -Dave
>>
>> On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl
>>  wrote:
>>>
>>> More specifically - do you have the geronimo mail libraries in your
>>> classpath?
>>>
>>> Cheers,
>>>
>>> Siegfried Goeschl
>>>
>>> On 06.07.11 14:28, James Carman wrote:

 Are you sure you have a clean classpath?

 Sent from my Android device.  Please excuse typos and brevity.
 On Jul 6, 2011 8:12 AM, "David Hoffer"  wrote:
>
> I've had another email failure this time it's usage with no attachment.
> I'll paste the code below. It's dropping the subject...same as the
> other
> case. Note that (No Subject) is being added by GMail on the receiving
> side
> as all emails with no subject show that.
>
> try {
> Email email = new SimpleEmail();
> email.setHostName("smtp.gmail.com");
> email.setSmtpPort(587);
> final String gMailUsername = appProperties.getGMailUsername();
> email.setAuthenticator(new DefaultAuthenticator(gMailUsername,
> appProperties.getGMailPassword()));
> email.setTLS(true);
> email.setFrom(gMailUsername);
> email.setSubject("App System Error");
> email.setMsg(msg);
> String[] toEmails = appProperties.getSystemErrorSendToEmails();
> for (String toEmail : toEmails) {
> email.addTo(toEmail);
> }
> email.send();
> } catch (EmailException e) {
> log.error("Failed to send system email", e);
> }
>
> Thanks,
> -Dave
>
>
> On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
> siegfried.goes...@it20one.at>  wrote:
>
>> Hi David,
>>
>> that sound a little bit strange - can you have a look at the JUnit
>> tests?
>> There is an "EmailLiveTest" which allows sending real emails with a
>> bit

 of
>>
>> tinkering - I suggest to have a look at the test, configure them to
>> send
>> test emails to your email account and then double-check your
>> production
>> code.
>>
>> Cheers,
>>
>> Siegfried Goeschl
>>
>>
>> On 06.07.11 05:46, David Hoffer wrote:
>>
>>> I have a strange problem. I've used commons-email for a while now
>>> with good success but now all of the sudden it isn't working right
>>> and
>>> I don't know why. The emails have 3 problems:
>>>
>>> 1. Although I attach a file to the email as an attachment it is
>>> received inline as base64 encoded text. I.e. my code does this:
>>> attachment.setDisposition(**EmailAttachment.ATTACHMENT);
>>>
>>> 2. The subject is replaced with this: (no subject)
>>>
>>> 3. The from and reply to email addresses are dropped and replaced
>>> with
>>> the email address used in as the authenticator.
>>>
>>> This is only a problem when I run the code on the production server
>>> which is Linux (hosted virtual server). It works as expected on
>>> Windows during test. This code on the Linux 

Re: [scxml] SCXML model thread-safe?

2011-07-06 Thread Rahul Akolkar
On Wed, Jul 6, 2011 at 12:48 AM, Dario D  wrote:
> Thank you Rahul. In regards to custom actions in such usage case, from what
> we've seen, a new instance of the custom action class is created on each
> execution of the action. This makes it impossible for two threads to access
> the same custom action object simultaneously. Am I correct?
>


There is a new instance in the model for each instance of the custom
action in the document i.e. the following:

  
  
  
  

will create two instances of the custom action foo class as children
of the onentry. Either of these instances may be accessed by multiple
threads if the same model is shared across many executors.

Custom actions implementations should be stateless beyond things like
fields that store attribute values which are identical across
invocations and not meant to be mutable. Other state should be derived
within the execute() method by introspecting the state or root context
and persisting changes to said context (which is specific to the
executor).

-Rahul


> 2011/7/5 Rahul Akolkar 
>
>>  On Tue, Jul 5, 2011 at 3:37 AM, Dario D  wrote:
>> > Is the SCXML model thread-safe? We're considering to parse the SCXML
>> files
>> > on application startup and then store the resulting SCXML models in a
>> cache
>> > where multiple threads will access them. Should we expect any
>> > inconsistencies? Note that executors will not be cached, and a new
>> executor
>> > will be created per request.
>> >
>> 
>>
>> The above usage pattern is fine. We have a test or two running in the
>> nightlies that does the above (one model, many executors). Ofcourse,
>> I'd recommend authoring tests that closely match your scenario as
>> well.
>>
>> -Rahul
>>
>>
>> > Thank you!
>> >
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCE] Apache Commons Digester 3.0 released!

2011-07-06 Thread Simone Tripodi
The Apache Commons team is pleased to announce the Apache Commons
Digester 3.0 release!

The Apache Commons Digester package lets you configure an XML to Java
object mapping module which triggers certain actions called rules
whenever a particular pattern of nested XML elements is recognized.

The Apache Commons Digester 3.0 is an almost complete rewrite of the
original Digester implementation, which offers:

o A universal loader: core features and extensions became not so easy
to maintain, since every contribution was created with a different
approach; a fresh new architecture is able to load modules that allow
users write and include easily their own extensions;
o Reusability of Digester configurations: what was missing is a way to
describe how the Digester instances have to be built and not how to
set rules given an existing instance;
o Rules are now expressed via EDSL: the key feature of Digester3 is
expressing rule bindings using a fluent APIs collection, that speak
more in English rather than in a programming language;
o Improved errors reporting: rules binding debug operations have made
easier, a detailed errors list of wrong binding is reported just when
the loader attempts to create a new Digester instance, and not when
running it.


Moreover, changes in this version include:

New features:
o Allow SetNextRule to fire on begin  Issue: DIGESTER-72.
o Include filename or uri if Digester.parse(File file or String uri
throws a SAXException  Issue: DIGESTER-85.
o xmlrules does not support setNamespaceURI  Issue: DIGESTER-90.
o Need to process [attribute id="name"]somename[/attribute]  Issue:
DIGESTER-105.
o Allow DigesterLoader to accept an instance of a preconfigured
Digester  Issue: DIGESTER-127.
o Allow recursive match in ExtendedBaseRules.  Issue: DIGESTER-131.
o Add a CompoundSubstitutor to support more than one Substitutors at a
time.  Issue: DIGESTER-132.

Fixed Bugs:
o Default ClassLoader policy unusable in EAR archive  Issue: DIGESTER-28.
o xmlrules does not support NodeCreateRule  Issue: DIGESTER-103.
o ObjectCreateRule shouldn't keep className as a field.  Issue: DIGESTER-118.
o xmlrules dtd does not define xmlattrs for node-create-rule  Issue:
DIGESTER-123.
o Bug in SetPropertyRule.  Issue: DIGESTER-134.

Changes:
o Public/protected static fields which intended as constants, but
which are not marked final.  Issue: DIGESTER-137.


Have fun!
-Simo, on behalf of the Apache Commons community

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [email] Email attachment is inline for some reason

2011-07-06 Thread Siegfried Goeschl

Hi David,

the following snippet might help if you update it accordingly - this are 
the exclude I'm using for one of my projects.


If it works please don't hesitate to send a success message - we all 
love to hear when something works ... ;-)


Cheers,

Siegfried Goeschl



org.apache.cxf
cxf-rt-frontend-jaxws
${it20one.cxf.version}


org.apache.geronimo.specs
geronimo-javamail_1.4_spec


org.apache.geronimo.specs
geronimo-activation_1.1_spec




org.apache.cxf
cxf-rt-transports-http
${it20one.cxf.version}


org.apache.geronimo.specs
geronimo-javamail_1.4_spec


org.apache.geronimo.specs
geronimo-activation_1.1_spec





On 06.07.11 15:31, David Hoffer wrote:

Or can/should I configure commons-email to use geronimo?

-Dave

On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer > wrote:


I didn't think so at first...but yes I do have
geronimo-javamail_1.4_spec-1.3.jar &
geronimo-activation_1.1_spec-1.0.2.jar plus a bunch of other
geronimo-xxx jars.  I'm not sure where these came from but I do
use CXF (web service) so I'm guessing geronimo is used by CXF. 
Also I have activation-1.1.jar and mail-1.4.1.jar used by

commons-email-1.2.jar.

Is that the problem that I have two mail jars?  Can I safely
exclude the geronimo-javamail_1.4_spec-1.3.jar &
geronimo-activation_1.1_spec-1.0.2.jar from CXF's dependencies?

Thanks,
-Dave


On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl
mailto:siegfried.goes...@it20one.at>> wrote:

More specifically - do you have the geronimo mail libraries in
your classpath?

Cheers,

Siegfried Goeschl


On 06.07.11 14:28, James Carman wrote:

Are you sure you have a clean classpath?

Sent from my Android device.  Please excuse typos and brevity.
On Jul 6, 2011 8:12 AM, "David Hoffer"mailto:dhoff...@gmail.com>>  wrote:

I've had another email failure this time it's usage
with no attachment.
I'll paste the code below. It's dropping the
subject...same as the other
case. Note that (No Subject) is being added by GMail
on the receiving side
as all emails with no subject show that.

try {
Email email = new SimpleEmail();
email.setHostName("smtp.gmail.com
");
email.setSmtpPort(587);
final String gMailUsername =
appProperties.getGMailUsername();
email.setAuthenticator(new
DefaultAuthenticator(gMailUsername,
appProperties.getGMailPassword()));
email.setTLS(true);
email.setFrom(gMailUsername);
email.setSubject("App System Error");
email.setMsg(msg);
String[] toEmails =
appProperties.getSystemErrorSendToEmails();
for (String toEmail : toEmails) {
email.addTo(toEmail);
}
email.send();
} catch (EmailException e) {
log.error("Failed to send system email", e);
}

Thanks,
-Dave


On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
siegfried.goes...@it20one.at
>  wrote:

Hi David,

that sound a little bit strange - can you have a
look at the JUnit tests?
There is an "EmailLiveTest" which allows sending
real emails with a bit

of

tinkering - I suggest to have a look at the test,
configure them to send
test emails to your email account and then
double-check your production
code.

Cheers,

Siegfried Goeschl


On 06.07.11 05:46, David Hoffer wrote:

I have a strange problem. I've used
commons-email for a while now
with good success but now all of the sudden it
isn't working right and
I don't know why. The emails have 3 problems:

1. Although I attach a file to the email as an
attachment it is
received inline as base64 encoded text. I.e.
my code does this:
attachment.setDisposition(**EmailAttachment.ATTACHMENT);

2. The subject is replaced with this: (no subject)

3. The from and reply to email addresses are
dropped and replaced with
the email address u

Re: [email] Email attachment is inline for some reason

2011-07-06 Thread Siegfried Goeschl

Hi David,

this is a common issue coming up regularly (and the FAQ section is 
somehow missing on the deployed site which addresses the problem), e.g. 
see 
http://brightdadson.blogspot.com/2010/06/if-you-are-working-on-spring-web.html


I would recommend to exclude all geronimo specs jars for javamail and 
activation and I'm pretty sure that this solves the issue ... :-)


Cheers,

Siegfried Goeschl

On 06.07.11 15:31, David Hoffer wrote:

Or can/should I configure commons-email to use geronimo?

-Dave

On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer > wrote:


I didn't think so at first...but yes I do have
geronimo-javamail_1.4_spec-1.3.jar &
geronimo-activation_1.1_spec-1.0.2.jar plus a bunch of other
geronimo-xxx jars.  I'm not sure where these came from but I do
use CXF (web service) so I'm guessing geronimo is used by CXF. 
Also I have activation-1.1.jar and mail-1.4.1.jar used by

commons-email-1.2.jar.

Is that the problem that I have two mail jars?  Can I safely
exclude the geronimo-javamail_1.4_spec-1.3.jar &
geronimo-activation_1.1_spec-1.0.2.jar from CXF's dependencies?

Thanks,
-Dave


On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl
mailto:siegfried.goes...@it20one.at>> wrote:

More specifically - do you have the geronimo mail libraries in
your classpath?

Cheers,

Siegfried Goeschl


On 06.07.11 14:28, James Carman wrote:

Are you sure you have a clean classpath?

Sent from my Android device.  Please excuse typos and brevity.
On Jul 6, 2011 8:12 AM, "David Hoffer"mailto:dhoff...@gmail.com>>  wrote:

I've had another email failure this time it's usage
with no attachment.
I'll paste the code below. It's dropping the
subject...same as the other
case. Note that (No Subject) is being added by GMail
on the receiving side
as all emails with no subject show that.

try {
Email email = new SimpleEmail();
email.setHostName("smtp.gmail.com
");
email.setSmtpPort(587);
final String gMailUsername =
appProperties.getGMailUsername();
email.setAuthenticator(new
DefaultAuthenticator(gMailUsername,
appProperties.getGMailPassword()));
email.setTLS(true);
email.setFrom(gMailUsername);
email.setSubject("App System Error");
email.setMsg(msg);
String[] toEmails =
appProperties.getSystemErrorSendToEmails();
for (String toEmail : toEmails) {
email.addTo(toEmail);
}
email.send();
} catch (EmailException e) {
log.error("Failed to send system email", e);
}

Thanks,
-Dave


On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
siegfried.goes...@it20one.at
>  wrote:

Hi David,

that sound a little bit strange - can you have a
look at the JUnit tests?
There is an "EmailLiveTest" which allows sending
real emails with a bit

of

tinkering - I suggest to have a look at the test,
configure them to send
test emails to your email account and then
double-check your production
code.

Cheers,

Siegfried Goeschl


On 06.07.11 05:46, David Hoffer wrote:

I have a strange problem. I've used
commons-email for a while now
with good success but now all of the sudden it
isn't working right and
I don't know why. The emails have 3 problems:

1. Although I attach a file to the email as an
attachment it is
received inline as base64 encoded text. I.e.
my code does this:
attachment.setDisposition(**EmailAttachment.ATTACHMENT);

2. The subject is replaced with this: (no subject)

3. The from and reply to email addresses are
dropped and replaced with
the email address used in as the authenticator.

This is only a problem when I run the code on
the production server
which is Linux (hosted virtual server). It
 

Re: [email] Email attachment is inline for some reason

2011-07-06 Thread David Hoffer
Or can/should I configure commons-email to use geronimo?

-Dave

On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer  wrote:

> I didn't think so at first...but yes I do have
> geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
> plus a bunch of other geronimo-xxx jars.  I'm not sure where these came from
> but I do use CXF (web service) so I'm guessing geronimo is used by CXF.
> Also I have activation-1.1.jar and mail-1.4.1.jar used by
> commons-email-1.2.jar.
>
> Is that the problem that I have two mail jars?  Can I safely exclude the
> geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
> from CXF's dependencies?
>
> Thanks,
> -Dave
>
>
> On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl <
> siegfried.goes...@it20one.at> wrote:
>
>> More specifically - do you have the geronimo mail libraries in your
>> classpath?
>>
>> Cheers,
>>
>> Siegfried Goeschl
>>
>>
>> On 06.07.11 14:28, James Carman wrote:
>>
>>> Are you sure you have a clean classpath?
>>>
>>> Sent from my Android device.  Please excuse typos and brevity.
>>> On Jul 6, 2011 8:12 AM, "David Hoffer"  wrote:
>>>
 I've had another email failure this time it's usage with no attachment.
 I'll paste the code below. It's dropping the subject...same as the other
 case. Note that (No Subject) is being added by GMail on the receiving
 side
 as all emails with no subject show that.

 try {
 Email email = new SimpleEmail();
 email.setHostName("smtp.gmail.**com ");
 email.setSmtpPort(587);
 final String gMailUsername = appProperties.**getGMailUsername();
 email.setAuthenticator(new DefaultAuthenticator(**gMailUsername,
 appProperties.**getGMailPassword()));
 email.setTLS(true);
 email.setFrom(gMailUsername);
 email.setSubject("App System Error");
 email.setMsg(msg);
 String[] toEmails = appProperties.**getSystemErrorSendToEmails();
 for (String toEmail : toEmails) {
 email.addTo(toEmail);
 }
 email.send();
 } catch (EmailException e) {
 log.error("Failed to send system email", e);
 }

 Thanks,
 -Dave


 On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
 siegfried.goes...@it20one.at>  wrote:

  Hi David,
>
> that sound a little bit strange - can you have a look at the JUnit
> tests?
> There is an "EmailLiveTest" which allows sending real emails with a bit
>
 of
>>>
 tinkering - I suggest to have a look at the test, configure them to send
> test emails to your email account and then double-check your production
> code.
>
> Cheers,
>
> Siegfried Goeschl
>
>
> On 06.07.11 05:46, David Hoffer wrote:
>
>  I have a strange problem. I've used commons-email for a while now
>> with good success but now all of the sudden it isn't working right and
>> I don't know why. The emails have 3 problems:
>>
>> 1. Although I attach a file to the email as an attachment it is
>> received inline as base64 encoded text. I.e. my code does this:
>> attachment.setDisposition(EmailAttachment.ATTACHMENT);
>>
>> 2. The subject is replaced with this: (no subject)
>>
>> 3. The from and reply to email addresses are dropped and replaced with
>> the email address used in as the authenticator.
>>
>> This is only a problem when I run the code on the production server
>> which is Linux (hosted virtual server). It works as expected on
>> Windows during test. This code on the Linux server used to work but
>> it was a prior build, not sure what changed but nothing in the email
>> code changed...just a different file being sent with different
>> description.
>>
>> Any ideas why these three things might be occurring?
>>
>> -Dave
>>
>>
>>  --**
>>> --**-
>>>
 To unsubscribe, e-mail: 
 user-unsubscribe@commons.**apa**che.org
>> <
>>
> user-unsubscribe@commons.**apache.org
>>> >
>>>
 For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
>>  --**
> --**-
> To unsubscribe, e-mail: 
> user-unsubscribe@commons.**apa**che.org
> <
>
 user-unsubscribe@commons.**apache.org
>>> >
>>>
 For additional commands, e-mail: user-h...@commons.apache.org
>
>
>
>> --**--**-
>>
>> To unsubscribe, e-mail: 
>> user-unsubscribe@commons.**apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
>


Re: [email] Email attachment is inline for some reason

2011-07-06 Thread David Hoffer
I didn't think so at first...but yes I do have
geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
plus a bunch of other geronimo-xxx jars.  I'm not sure where these came from
but I do use CXF (web service) so I'm guessing geronimo is used by CXF.
Also I have activation-1.1.jar and mail-1.4.1.jar used by
commons-email-1.2.jar.

Is that the problem that I have two mail jars?  Can I safely exclude the
geronimo-javamail_1.4_spec-1.3.jar & geronimo-activation_1.1_spec-1.0.2.jar
from CXF's dependencies?

Thanks,
-Dave

On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl <
siegfried.goes...@it20one.at> wrote:

> More specifically - do you have the geronimo mail libraries in your
> classpath?
>
> Cheers,
>
> Siegfried Goeschl
>
>
> On 06.07.11 14:28, James Carman wrote:
>
>> Are you sure you have a clean classpath?
>>
>> Sent from my Android device.  Please excuse typos and brevity.
>> On Jul 6, 2011 8:12 AM, "David Hoffer"  wrote:
>>
>>> I've had another email failure this time it's usage with no attachment.
>>> I'll paste the code below. It's dropping the subject...same as the other
>>> case. Note that (No Subject) is being added by GMail on the receiving
>>> side
>>> as all emails with no subject show that.
>>>
>>> try {
>>> Email email = new SimpleEmail();
>>> email.setHostName("smtp.gmail.**com ");
>>> email.setSmtpPort(587);
>>> final String gMailUsername = appProperties.**getGMailUsername();
>>> email.setAuthenticator(new DefaultAuthenticator(**gMailUsername,
>>> appProperties.**getGMailPassword()));
>>> email.setTLS(true);
>>> email.setFrom(gMailUsername);
>>> email.setSubject("App System Error");
>>> email.setMsg(msg);
>>> String[] toEmails = appProperties.**getSystemErrorSendToEmails();
>>> for (String toEmail : toEmails) {
>>> email.addTo(toEmail);
>>> }
>>> email.send();
>>> } catch (EmailException e) {
>>> log.error("Failed to send system email", e);
>>> }
>>>
>>> Thanks,
>>> -Dave
>>>
>>>
>>> On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
>>> siegfried.goes...@it20one.at>  wrote:
>>>
>>>  Hi David,

 that sound a little bit strange - can you have a look at the JUnit
 tests?
 There is an "EmailLiveTest" which allows sending real emails with a bit

>>> of
>>
>>> tinkering - I suggest to have a look at the test, configure them to send
 test emails to your email account and then double-check your production
 code.

 Cheers,

 Siegfried Goeschl


 On 06.07.11 05:46, David Hoffer wrote:

  I have a strange problem. I've used commons-email for a while now
> with good success but now all of the sudden it isn't working right and
> I don't know why. The emails have 3 problems:
>
> 1. Although I attach a file to the email as an attachment it is
> received inline as base64 encoded text. I.e. my code does this:
> attachment.setDisposition(EmailAttachment.ATTACHMENT);
>
> 2. The subject is replaced with this: (no subject)
>
> 3. The from and reply to email addresses are dropped and replaced with
> the email address used in as the authenticator.
>
> This is only a problem when I run the code on the production server
> which is Linux (hosted virtual server). It works as expected on
> Windows during test. This code on the Linux server used to work but
> it was a prior build, not sure what changed but nothing in the email
> code changed...just a different file being sent with different
> description.
>
> Any ideas why these three things might be occurring?
>
> -Dave
>
>
>  --**
>> --**-
>>
>>> To unsubscribe, e-mail: 
>>> user-unsubscribe@commons.**apa**che.org
> <
>
 user-unsubscribe@commons.**apache.org
>> >
>>
>>> For additional commands, e-mail: user-h...@commons.apache.org
>
>
>  --**
 --**-
 To unsubscribe, e-mail: 
 user-unsubscribe@commons.**apa**che.org
 <

>>> user-unsubscribe@commons.**apache.org
>> >
>>
>>> For additional commands, e-mail: user-h...@commons.apache.org



> --**--**-
>
> To unsubscribe, e-mail: 
> user-unsubscribe@commons.**apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [email] Email attachment is inline for some reason

2011-07-06 Thread Siegfried Goeschl
More specifically - do you have the geronimo mail libraries in your 
classpath?


Cheers,

Siegfried Goeschl

On 06.07.11 14:28, James Carman wrote:

Are you sure you have a clean classpath?

Sent from my Android device.  Please excuse typos and brevity.
On Jul 6, 2011 8:12 AM, "David Hoffer"  wrote:

I've had another email failure this time it's usage with no attachment.
I'll paste the code below. It's dropping the subject...same as the other
case. Note that (No Subject) is being added by GMail on the receiving side
as all emails with no subject show that.

try {
Email email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.setSmtpPort(587);
final String gMailUsername = appProperties.getGMailUsername();
email.setAuthenticator(new DefaultAuthenticator(gMailUsername,
appProperties.getGMailPassword()));
email.setTLS(true);
email.setFrom(gMailUsername);
email.setSubject("App System Error");
email.setMsg(msg);
String[] toEmails = appProperties.getSystemErrorSendToEmails();
for (String toEmail : toEmails) {
email.addTo(toEmail);
}
email.send();
} catch (EmailException e) {
log.error("Failed to send system email", e);
}

Thanks,
-Dave


On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl<
siegfried.goes...@it20one.at>  wrote:


Hi David,

that sound a little bit strange - can you have a look at the JUnit tests?
There is an "EmailLiveTest" which allows sending real emails with a bit

of

tinkering - I suggest to have a look at the test, configure them to send
test emails to your email account and then double-check your production
code.

Cheers,

Siegfried Goeschl


On 06.07.11 05:46, David Hoffer wrote:


I have a strange problem. I've used commons-email for a while now
with good success but now all of the sudden it isn't working right and
I don't know why. The emails have 3 problems:

1. Although I attach a file to the email as an attachment it is
received inline as base64 encoded text. I.e. my code does this:
attachment.setDisposition(**EmailAttachment.ATTACHMENT);

2. The subject is replaced with this: (no subject)

3. The from and reply to email addresses are dropped and replaced with
the email address used in as the authenticator.

This is only a problem when I run the code on the production server
which is Linux (hosted virtual server). It works as expected on
Windows during test. This code on the Linux server used to work but
it was a prior build, not sure what changed but nothing in the email
code changed...just a different file being sent with different
description.

Any ideas why these three things might be occurring?

-Dave



--**--**-

To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<

user-unsubscr...@commons.apache.org>

For additional commands, e-mail: user-h...@commons.apache.org



--**--**-
To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<

user-unsubscr...@commons.apache.org>

For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [email] Email attachment is inline for some reason

2011-07-06 Thread James Carman
Are you sure you have a clean classpath?

Sent from my Android device.  Please excuse typos and brevity.
On Jul 6, 2011 8:12 AM, "David Hoffer"  wrote:
> I've had another email failure this time it's usage with no attachment.
> I'll paste the code below. It's dropping the subject...same as the other
> case. Note that (No Subject) is being added by GMail on the receiving side
> as all emails with no subject show that.
>
> try {
> Email email = new SimpleEmail();
> email.setHostName("smtp.gmail.com");
> email.setSmtpPort(587);
> final String gMailUsername = appProperties.getGMailUsername();
> email.setAuthenticator(new DefaultAuthenticator(gMailUsername,
> appProperties.getGMailPassword()));
> email.setTLS(true);
> email.setFrom(gMailUsername);
> email.setSubject("App System Error");
> email.setMsg(msg);
> String[] toEmails = appProperties.getSystemErrorSendToEmails();
> for (String toEmail : toEmails) {
> email.addTo(toEmail);
> }
> email.send();
> } catch (EmailException e) {
> log.error("Failed to send system email", e);
> }
>
> Thanks,
> -Dave
>
>
> On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl <
> siegfried.goes...@it20one.at> wrote:
>
>> Hi David,
>>
>> that sound a little bit strange - can you have a look at the JUnit tests?
>> There is an "EmailLiveTest" which allows sending real emails with a bit
of
>> tinkering - I suggest to have a look at the test, configure them to send
>> test emails to your email account and then double-check your production
>> code.
>>
>> Cheers,
>>
>> Siegfried Goeschl
>>
>>
>> On 06.07.11 05:46, David Hoffer wrote:
>>
>>> I have a strange problem. I've used commons-email for a while now
>>> with good success but now all of the sudden it isn't working right and
>>> I don't know why. The emails have 3 problems:
>>>
>>> 1. Although I attach a file to the email as an attachment it is
>>> received inline as base64 encoded text. I.e. my code does this:
>>> attachment.setDisposition(**EmailAttachment.ATTACHMENT);
>>>
>>> 2. The subject is replaced with this: (no subject)
>>>
>>> 3. The from and reply to email addresses are dropped and replaced with
>>> the email address used in as the authenticator.
>>>
>>> This is only a problem when I run the code on the production server
>>> which is Linux (hosted virtual server). It works as expected on
>>> Windows during test. This code on the Linux server used to work but
>>> it was a prior build, not sure what changed but nothing in the email
>>> code changed...just a different file being sent with different
>>> description.
>>>
>>> Any ideas why these three things might be occurring?
>>>
>>> -Dave
>>>
>>>
--**--**-
>>> To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<
user-unsubscr...@commons.apache.org>
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>>
>> --**--**-
>> To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<
user-unsubscr...@commons.apache.org>
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>


Re: [email] Email attachment is inline for some reason

2011-07-06 Thread David Hoffer
I've had another email failure this time it's usage with no attachment.
I'll paste the code below.  It's dropping the subject...same as the other
case.  Note that (No Subject) is being added by GMail on the receiving side
as all emails with no subject show that.

try {
Email email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.setSmtpPort(587);
final String gMailUsername = appProperties.getGMailUsername();
email.setAuthenticator(new DefaultAuthenticator(gMailUsername,
appProperties.getGMailPassword()));
email.setTLS(true);
email.setFrom(gMailUsername);
email.setSubject("App System Error");
email.setMsg(msg);
String[] toEmails = appProperties.getSystemErrorSendToEmails();
for (String toEmail : toEmails) {
email.addTo(toEmail);
}
email.send();
} catch (EmailException e) {
log.error("Failed to send system email", e);
}

Thanks,
-Dave


On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl <
siegfried.goes...@it20one.at> wrote:

> Hi David,
>
> that sound a little bit strange - can you have a look at the JUnit tests?
> There is an "EmailLiveTest" which allows sending real emails with a bit of
> tinkering - I suggest to have a look at the test, configure them to send
> test emails to your email account and then double-check your production
> code.
>
> Cheers,
>
> Siegfried Goeschl
>
>
> On 06.07.11 05:46, David Hoffer wrote:
>
>> I have a strange problem.  I've used commons-email for a while now
>> with good success but now all of the sudden it isn't working right and
>> I don't know why.  The emails have 3 problems:
>>
>> 1. Although I attach a file to the email as an attachment it is
>> received inline as base64 encoded text.  I.e. my code does this:
>> attachment.setDisposition(**EmailAttachment.ATTACHMENT);
>>
>> 2. The subject is replaced with this:  (no subject)
>>
>> 3. The from and reply to email addresses are dropped and replaced with
>> the email address used in as the authenticator.
>>
>> This is only a problem when I run the code on the production server
>> which is Linux (hosted virtual server).  It works as expected on
>> Windows during test.  This code on the Linux server used to work but
>> it was a prior build, not sure what changed but nothing in the email
>> code changed...just a different file being sent with different
>> description.
>>
>> Any ideas why these three things might be occurring?
>>
>> -Dave
>>
>> --**--**-
>> To unsubscribe, e-mail: 
>> user-unsubscribe@commons.**apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
> --**--**-
> To unsubscribe, e-mail: 
> user-unsubscribe@commons.**apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [email] Email attachment is inline for some reason

2011-07-06 Thread Siegfried Goeschl

Hi David,

that sound a little bit strange - can you have a look at the JUnit 
tests? There is an "EmailLiveTest" which allows sending real emails with 
a bit of tinkering - I suggest to have a look at the test, configure 
them to send test emails to your email account and then double-check 
your production code.


Cheers,

Siegfried Goeschl

On 06.07.11 05:46, David Hoffer wrote:

I have a strange problem.  I've used commons-email for a while now
with good success but now all of the sudden it isn't working right and
I don't know why.  The emails have 3 problems:

1. Although I attach a file to the email as an attachment it is
received inline as base64 encoded text.  I.e. my code does this:
attachment.setDisposition(EmailAttachment.ATTACHMENT);

2. The subject is replaced with this:  (no subject)

3. The from and reply to email addresses are dropped and replaced with
the email address used in as the authenticator.

This is only a problem when I run the code on the production server
which is Linux (hosted virtual server).  It works as expected on
Windows during test.  This code on the Linux server used to work but
it was a prior build, not sure what changed but nothing in the email
code changed...just a different file being sent with different
description.

Any ideas why these three things might be occurring?

-Dave

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org