p.waitFor(); Log.log(Log.TRACE, MODULE, "Returned with value " + p.exitValue());
int exitValue = p.waitFor(); Log.log(Log.TRACE, MODULE, "Returned with value " + exitValue);
	public static File resize( String filename, Dimension d ) {		File r = null;		long start = System.currentTimeMillis();		if ( ! GalleryFileFilter.canManipulateJpeg(filename) ) {			return new File(filename);		}		if (useIM) {			try {				StringBuffer cmdline = new StringBuffer(imPath);				cmdline.append(" -size ").append(d.width).append("x").append(d.height);				if (filterName[UPLOAD] != null && filterName[UPLOAD].length() > 0) {					cmdline.append(" -filter ").append(filterName[UPLOAD]);				}				cmdline.append(" \"").append(filename).append("\"");				cmdline.append(" -resize \"").append(d.width).append("x").append(d.height).append(">\" ");				//cmdline.append("-gravity SouthEast -draw \"image Over 200,200 0,0 G:\\Projects\\Dev\\gallery_remote10\\2ni.png\" ");				cmdline.append(" -quality ").append(jpegQuality);				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, "ImageMagick doesn't seem to be working. Disabling");					useIM = false;					r = null;				}			} catch (IOException e1) {				Log.logException(Log.ERROR, MODULE, e1);			} catch (InterruptedException e2) {				Log.logException(Log.ERROR, MODULE, e2);			}		}		if ( ! useIM && r == null ) {			throw new UnsupportedOperationException("IM must be installed for this operation");		}		long time = System.currentTimeMillis() - start;		totalTime += time;		totalIter++;		Log.log(Log.TRACE, MODULE, "Time: " + time + " - Avg: " + (totalTime/totalIter) );		return r;	}