if (writer != null)
if (fout != null)
    public void write(String file) throws Exception    {        if (inMemory())        {            FileWriter writer = null;            try            {                writer = new FileWriter(file);                writer.write(getString());            }            finally            {                if (writer != null)                {                    writer.close();                }            }        }        else if (storeLocation != null)        {            /*             * The uploaded file is being stored on disk             * in a temporary location so move it to the             * desired file.             */            if (storeLocation.renameTo(new File(file)) == false)            {                BufferedInputStream in = null;                BufferedOutputStream out = null;                try                {                    in = new BufferedInputStream(                        new FileInputStream(storeLocation));                    out = new BufferedOutputStream(new FileOutputStream(file));                    byte[] bytes = new byte[2048];                    int s = 0;                    while ( (s = in.read(bytes)) != -1 )                    {                        out.write(bytes,0,s);                    }                }                finally                {                    try                    {                        in.close();                    }                    catch (Exception e)                    {                        // ignore                    }                    try                    {                        out.close();                    }                    catch (Exception e)                    {                        // ignore                    }                }            }        }        else        {            /*             * For whatever reason we cannot write the             * file to disk.             */            throw new FileUploadException(                "Cannot write uploaded file to disk!");        }    }