boolean error = false;
    public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException {        try {                                   //InitialContext jndicontext = new InitialContext();            InitialContext jndicontext = getInitialContext();            Object obj1 = jndicontext.lookup("CertificateStoreSession");            ICertificateStoreSessionHome certificatesessionhome = (ICertificateStoreSessionHome) javax.rmi.PortableRemoteObject.narrow(obj1,                    ICertificateStoreSessionHome.class);            ICertificateStoreSessionRemote certificatesession = certificatesessionhome.create();            obj1 = jndicontext.lookup("RaAdminSession");            IRaAdminSessionHome raadminsessionhome = (IRaAdminSessionHome) javax.rmi.PortableRemoteObject.narrow(jndicontext.lookup(                        "RaAdminSession"), IRaAdminSessionHome.class);            IRaAdminSessionRemote raadminsession = raadminsessionhome.create();            Collection certprofids = certificatesession.getAuthorizedCertificateProfileIds(administrator,0);                                                                  			Collection endentityprofids = raadminsession.getAuthorizedEndEntityProfileIds(administrator);                                                                    if (args.length < 2) {                getOutputStream().println(                    "Usage: CA exportprofiles <outpath>");                getOutputStream().print("\n");                return;            }            String outpath = args[1];            boolean error = false;            getOutputStream().println("Exporting certificate profiles: ");            Iterator iter = certprofids.iterator();            while (iter.hasNext()) {            	int profileid = ((Integer) iter.next()).intValue();                if (profileid == SecConst.PROFILE_NO_PROFILE) { // Certificate profile not found i database.                    getOutputStream().println("Error : Couldn't find certificate profile '"+profileid+"' in database.");                } else {					String profilename = certificatesession.getCertificateProfileName(administrator, profileid);									                    CertificateProfile profile = certificatesession.getCertificateProfile(administrator,profileid);                    if (profile == null) {                        getOutputStream().println("Error : Couldn't find certificate profile '"+profilename+"'-"+profileid+" in database.");                    } else {                        String outfile = outpath+"/certprofile_"+profilename+"-"+profileid+".xml";                        getOutputStream().println(outfile+".");                        XMLEncoder encoder = new XMLEncoder(new  FileOutputStream(outfile));                        encoder.writeObject(profile.saveData());                        encoder.close();                    }                }            }            getOutputStream().println("Exporting end entity profiles: ");            iter = endentityprofids.iterator();            while (iter.hasNext()){                                int profileid = ((Integer) iter.next()).intValue();                if (profileid == SecConst.PROFILE_NO_PROFILE) { // Entity profile not found i database.                    getOutputStream().println("Error : Couldn't find entity profile '"+profileid+"' in database.");                } else {                	String profilename = raadminsession.getEndEntityProfileName(administrator, profileid);                    EndEntityProfile profile = raadminsession.getEndEntityProfile(administrator, profileid);                    if (profile == null) {                        getOutputStream().println("Error : Couldn't find entity profile '"+profilename+"'-"+profileid+" in database.");                    } else {                        String outfile = outpath+"/entityprofile_"+profilename+"-"+profileid+".xml";                        getOutputStream().println(outfile+".");                        XMLEncoder encoder = new XMLEncoder(new  FileOutputStream(outfile));                        encoder.writeObject(profile.saveData());                        encoder.close();                    }                }            }                 } catch (Exception e) {            throw new ErrorAdminCommandException(e);        }    }