1

I am developing an app which stores username and password in RMS the app is working fine on Nokia s60 but in Nokia s40 phone the application is giving IllegalArgumentException and then app is closed. I am not able to understand what is the problem if its working fine on S60 phones.

    public void getLogin() {

    //System.out.println(getUsernameEdit().getString()+","+ getPasswordEdit().getString());

            m=new Message();
            reply=m.getLogin(getUsernameEdit().getString(), getPasswordEdit().getString());

    if (reply) {
        String response="";
        try{
            if(count==0){
                rs = RecordStore.openRecordStore(db, true);
                rs.addRecord("true".getBytes(), 0, "true".length());               
                rs.addRecord(getUsernameEdit().getString().getBytes(), 0, getUsernameEdit().getString().length());
                rs.addRecord(getPasswordEdit().getString().getBytes(), 0, getPasswordEdit().getString().length());
                rs.closeRecordStore();
            }
            else{
                rs = RecordStore.openRecordStore(db, false);
                byte b[]=rs.getRecord(1);
                response=new String(b,0,b.length);
                System.out.println(response);
                if(response.equals("true")){
                rs.setRecord(2, getUsernameEdit().getString().getBytes(), 0, getUsernameEdit().getString().length());
                rs.setRecord(3, getPasswordEdit().getString().getBytes(), 0, getPasswordEdit().getString().length());
            }
                rs.closeRecordStore();
                getSenderEdit().setString(getUsernameEdit().getString());
            }
        }catch(Exception e){
                getErrorBox().setString(e.toString());
        }
        switchDisplayable(getSavingSuccess(), getMessageForm());
        // write post-action user code here
    } else {
        // write pre-action user code here
        switchDisplayable(getSavingError(), getSettings());
        // write post-action user code here
    }
    // enter post-if user code here
}
  • what value `getUsernameEdit().getString()` holds ? – Lucifer Nov 18 '12 at 03:25
  • 'getUsernameEdit().getString()' holds a 10 digit mobile number but i have tried to comment everything except 'rs.addRecord("true".getBytes(), 0, "true".length());' still getting Illegal Argument Exception and application exits. – Devashish Raverkar Nov 18 '12 at 06:49
  • @Raffaele it is working on emulator so how to print stacktrace in s40 mobile? – Devashish Raverkar Nov 18 '12 at 06:50
  • How do you know that it throws an exception? – Raffaele Nov 18 '12 at 10:01
  • @Raffaele the aplication is giving message application error with to options Details and Quit, and in details it is giving IllegalArgumentException – Devashish Raverkar Nov 18 '12 at 13:59
  • You should find a stack trace somewhere. I don't develop on ME, but whenever there is an exception there must be a stack trace. And an exception is completely useless without its stack trace – Raffaele Nov 18 '12 at 18:38

1 Answers1

0

Why don't you try to use the Storage class? Is the evolution of RMS in lwuit

Mun0n
  • 4,438
  • 4
  • 28
  • 46