email.mail.Sender: fix order of (context, uri) arguments in reflection invocation of SmtpSender.newInstance().

Account creation was not possible because of this.
This commit is contained in:
Mihai Preda 2009-08-17 15:39:55 +02:00
parent 9627d014e1
commit a4bbb7d923
2 changed files with 7 additions and 6 deletions

View File

@ -49,11 +49,11 @@ public abstract class Sender {
Class<?> c = Class.forName(className);
// and invoke "newInstance" class method and instantiate sender object.
java.lang.reflect.Method m =
c.getMethod("newInstance", String.class, Context.class);
o = m.invoke(null, uri, context);
c.getMethod("newInstance", Context.class, String.class);
o = m.invoke(null, context, uri);
} catch (Exception e) {
Log.d(Email.LOG_TAG, String.format(
"exception %s invoking %s.newInstance.(String, Context) method for %s",
"exception %s invoking %s.newInstance.(Context, String) method for %s",
e.toString(), className, uri));
throw new MessagingException("can not instantiate Sender object for " + uri);
}

View File

@ -41,11 +41,12 @@ public class ExchangeSenderExample extends Sender {
/**
* Factory method.
*/
public static Sender newInstance(String uri, Context context) throws MessagingException {
return new ExchangeSenderExample(uri, context);
@Override
public static Sender newInstance(Context context, String uri) throws MessagingException {
return new ExchangeSenderExample(context, uri);
}
private ExchangeSenderExample(String _uri, Context context) throws MessagingException {
private ExchangeSenderExample(Context context, String _uri) throws MessagingException {
mContext = context;
URI uri = null;