Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
		boolean uploadPicture(Picture p) {			try	{				boolean escapeCaptions = GalleryRemote.getInstance().properties.getBooleanProperty(HTML_ESCAPE_CAPTIONS);				status(su, StatusUpdate.LEVEL_UPLOAD_ONE, grRes.getString(MODULE, "upPrep"));				// can't set null as an NVPair value				String caption = p.getCaption();				caption = (caption == null) ? "" : caption;				if (escapeCaptions) {					caption = HTMLEscaper.escape(caption);				}				// setup the protocol parameters				NVPair[] opts = {					new NVPair("cmd", "add-item"),					new NVPair("protocol_version", PROTOCOL_VERSION),					new NVPair("set_albumName", p.getAlbum().getName()),					new NVPair("caption", caption ),					new NVPair("force_filename", p.getSource().getName()),					null				};				// set auto-rotate only if we do the rotation in GR, otherwise we'd be overriding the server setting				if (p.getAngle() != 0) {					opts[5] = new NVPair("auto_rotate", "no");				}				// set up extra fields				if (p.getExtraFieldsMap() != null && p.getExtraFieldsMap().size() > 0) {					ArrayList optsList = new ArrayList(Arrays.asList(opts));					Iterator it = p.getExtraFieldsMap().keySet().iterator();					while (it.hasNext()) {						String name = (String) it.next();						String value = p.getExtraField(name);						if (value != null) {							if (escapeCaptions) {								value = HTMLEscaper.escape(value);							}							optsList.add(new NVPair("extrafield_" + name, value));						}					}					opts = (NVPair[]) optsList.toArray(opts);				}				Log.log(Log.TRACE, MODULE, "add-item parameters: " + Arrays.asList(opts));								// setup the multipart form data				NVPair[] afile = { new NVPair("userfile", p.getUploadSource().getAbsolutePath()) };				NVPair[] hdrs = new NVPair[1];				byte[]   data = Codecs.mpFormDataEncode(opts, afile, hdrs);								// load and validate the response				Properties props = requestResponse( hdrs, data, g.getGalleryUrl(SCRIPT_NAME), true );				if ( props.getProperty( "status" ).equals(GR_STAT_SUCCESS) ) {					status(su, StatusUpdate.LEVEL_UPLOAD_ONE, grRes.getString(MODULE, "upSucc"));					return true;				} else {                    Object [] params = {props.getProperty( "status_text" )};					error(su, grRes.getString(MODULE, "upErr", params));					return false;				}							} catch ( GR2Exception gr2e ) {				Log.logException(Log.ERROR, MODULE, gr2e );                Object [] params = {gr2e.getMessage()};				error(su, grRes.getString(MODULE, "error", params));			} catch (SocketException swe) {				Log.logException(Log.ERROR, MODULE, swe);                Object [] params = {swe.toString()};				error(su, grRes.getString(MODULE, "confErr" , params));			} catch (IOException ioe)	{				Log.logException(Log.ERROR, MODULE, ioe);                Object [] params = {ioe.toString()};				error(su, grRes.getString(MODULE, "error", params));			} catch (ModuleException me) {				Log.logException(Log.ERROR, MODULE, me);                Object [] params = {me.getMessage()};				error(su, grRes.getString(MODULE, "errReq", params));			}								return false;		}