StringBuffer cmdline = new StringBuffer(jpegtranPath);
if (flip) { r = jpegtranExec(filename, " -flip horizontal"); filename = r.getPath(); }
	public static File rotate( String filename, int angle, boolean flip ) {		File r = null;		if ( ! GalleryFileFilter.canManipulate(filename) ) {			return new File(filename);		}		if (useJpegtran) {			try {				StringBuffer cmdline = new StringBuffer(jpegtranPath);				if (angle != 0) {					cmdline.append(" -rotate ").append(angle * 90);				}				if (flip) {					cmdline.append(" -flip horizontal");				}				cmdline.append(" \"").append(filename).append("\"");				r = File.createTempFile("res"					, "." + GalleryFileFilter.getExtension(filename), tmpDir);				toDelete.add(r);				cmdline.append(" \"").append(r.getPath()).append("\"");				Log.log(Log.TRACE, MODULE, "Executing " + cmdline.toString());				Process p = Runtime.getRuntime().exec(cmdline.toString());				p.waitFor();				Log.log(Log.TRACE, MODULE, "Returned with value " + p.exitValue());				if (p.exitValue() != 0) {					Log.log(Log.CRITICAL, MODULE, "jpegtran doesn't seem to be working. Disabling");					useJpegtran = false;					r = null;				}			} catch (IOException e1) {				Log.logException(Log.ERROR, MODULE, e1);			} catch (InterruptedException e2) {				Log.logException(Log.ERROR, MODULE, e2);			}		}		if ( ! useJpegtran && r == null ) {			throw new UnsupportedOperationException("jpegtran must be installed for this operation");		}		return r;	}