Android 版 Openymsg

发布于 2024-11-17 21:59:18 字数 2431 浏览 3 评论 0原文

我正在为 Android 开发 YM 客户端。我已经包含了 openymsg0.5 api。当我运行该程序时,它显示以下错误。

06-29 11:32:04.097: ERROR/InputThread(11206): org.openymsg.network.LoginRefusedException: Login Failed, unable to retrieve stage 2 url
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.yahooAuth16Stage2(Session.java:2048)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.yahooAuth16Stage1(Session.java:1955)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.receiveAuth(Session.java:1848)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.processPayload(InputThread.java:139)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.process(InputThread.java:129)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.run(InputThread.java:71)

这是主要错误:

LoginRefusedException:登录失败,无法检索第 2 阶段 url

这个问题之前已被问过,但我还没有找到对我有帮助的答案。有谁知道如何处理这个错误?我已经检查了 openymsg 测试代码和代码库,一切似乎都很好。

我刚刚检查过,它作为 java 应用程序工作正常,但如果用作 android 的一部分,则会出现登录错误。我正在创建会话,如下所示

Session session = new Session();
session.addSessionListener(new SessionListenerClass());
try{
    session.login("username", "password");
    if (session!=null 
        && session.getSessionStatus()== SessionState.LOGGED_ON) 
    {
        System.out.println("It logged on!!!!!!!");
    }
}

SessionListner :

public class SessionListenerClass extends SessionAdapter
{

    @Override
    public void messageReceived(SessionEvent event)
    {
        // TODO Auto-generated method stub
        super.messageReceived(event);
    }

    @Override
    public void notifyReceived(SessionNotifyEvent event)
    {
        // TODO Auto-generated method stub
        super.notifyReceived(event);
    }

    @Override
    public void newMailReceived(SessionNewMailEvent event)
    {
        // TODO Auto-generated method stub
        super.newMailReceived(event);
    }

    @Override
    public void errorPacketReceived(SessionErrorEvent event)
    {
        // TODO Auto-generated method stub
        super.errorPacketReceived(event);
    }

    @Override
    public void connectionClosed(SessionEvent event)
    {
        // TODO Auto-generated method stub
        super.connectionClosed(event);
    }

}

I am developing YM client for Android. I've included the openymsg0.5 api. When I run the program it shows following error.

06-29 11:32:04.097: ERROR/InputThread(11206): org.openymsg.network.LoginRefusedException: Login Failed, unable to retrieve stage 2 url
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.yahooAuth16Stage2(Session.java:2048)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.yahooAuth16Stage1(Session.java:1955)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.Session.receiveAuth(Session.java:1848)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.processPayload(InputThread.java:139)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.process(InputThread.java:129)
06-29 11:32:04.097: ERROR/InputThread(11206):     at org.openymsg.network.InputThread.run(InputThread.java:71)

This is the main error:

LoginRefusedException: Login Failed, unable to retrieve stage 2 url

This question has been asked before but I haven't found an answer that has helped me. Does anyone have any idea about how to deal with this error? I have gone through the openymsg test code and code base and everything seems to be fine.

I just checked , it works fine as a java application but if used as part of android it gives log in error .I am creating session as follows

Session session = new Session();
session.addSessionListener(new SessionListenerClass());
try{
    session.login("username", "password");
    if (session!=null 
        && session.getSessionStatus()== SessionState.LOGGED_ON) 
    {
        System.out.println("It logged on!!!!!!!");
    }
}

SessionListner :

public class SessionListenerClass extends SessionAdapter
{

    @Override
    public void messageReceived(SessionEvent event)
    {
        // TODO Auto-generated method stub
        super.messageReceived(event);
    }

    @Override
    public void notifyReceived(SessionNotifyEvent event)
    {
        // TODO Auto-generated method stub
        super.notifyReceived(event);
    }

    @Override
    public void newMailReceived(SessionNewMailEvent event)
    {
        // TODO Auto-generated method stub
        super.newMailReceived(event);
    }

    @Override
    public void errorPacketReceived(SessionErrorEvent event)
    {
        // TODO Auto-generated method stub
        super.errorPacketReceived(event);
    }

    @Override
    public void connectionClosed(SessionEvent event)
    {
        // TODO Auto-generated method stub
        super.connectionClosed(event);
    }

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追风人 2024-11-24 21:59:18

您使用的库基于jYMSG-库,该库具有更好的文档。

抛出异常的文档 LoginRefusedException 内容如下:

返回由给定的状态代码
服务器。这将是值之一
在 StatusConstants 中指定。价值观
将是 STATUS_BADUSERNAME
未知帐户,或 STATUS_BAD
密码错误(或其他错误)。

因此,您可以检查是否是“其他内容”或只是错误的用户名/密码。


好吧,这似乎是库中的一个错误。我发现这个这表明项目负责人之一知道问题。但我不确定这个问题是否会很快得到解决。

您还应该注意到,该项目被标记为“alpha”。我只能建议您继续关注解决此问题的新版本。

The library you're using is based on the jYMSG-library, which has a way better documentation.

The Documentation for your thrown exception, the LoginRefusedException reads:

Returns the status code given by the
server. This will one of the values
specified in StatusConstants. Values
will be either STATUS_BADUSERNAME for
an unknown account, or STATUS_BAD for
a bad password (or other fault).

So you can check if it's "something else" or just a wrong username/password.


Okay, this seams to be a bug in the library. I found this which shows that one of the project leaders knows about the problem. But I'm not sure if this will be fixed soon.

You should also notice, that the project is marked as "alpha". I can only suggest that you stay tuned for new releases which fix this issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文