1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I organize this code block?

Discussion in 'Programming/Internet' started by KYHSGeekCode, Oct 8, 2018.

  1. KYHSGeekCode

    KYHSGeekCode Guest

    //not an elf file. try PE parser
    PE pe=PEParser.parse(path);
    if(pe!=null)
    {
    PESignature ps =pe.getSignature();
    if(ps==null||!ps.isValid())
    {
    //What is it?
    Toast.makeText(this,"The file seems that it is neither an Elf file or PE file!",3).show();
    throw new IOException(e);
    }
    }
    else
    {
    //What is it?
    Toast.makeText(this,"The file seems that it is neither an Elf file or PE file!",3).show();
    throw new IOException(e);
    }


    How can I organize the above code, so that


    //What is it?
    Toast.makeText(this,"The file seems that it is neither an Elf file or PE file!",3).show();
    throw new IOException(e);​

    Appears only once, or just be better-looking?

    Summary

    Please comment or advise on organizing the if statements.

    Login To add answer/comment
     

Share This Page