URL tmpUrl = new URL(baseUrl);
new URL(baseUrl);
		private void fetch(Album a, String albumName, ArrayList newPictures)				throws GR2Exception {			su.updateProgressStatus(StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "fetchAlbImages",							new String[]{albumName}));			try {				// setup the protocol parameters				NVPair[] form_data = new NVPair[] {					new NVPair("cmd", "fetch-album-images"),					new NVPair("protocol_version", PROTOCOL_VERSION),					new NVPair("set_albumName", albumName),					new NVPair("albums_too", recursive?"yes":"no"),					new NVPair("random", random?"yes":"no"),					new NVPair("limit", maxPictures + "")				};				Log.log(Log.LEVEL_TRACE, MODULE, "fetch-album-images parameters: " +						Arrays.asList(form_data));				form_data = fudgeFormParameters(form_data);				// load and validate the response				GalleryProperties p = requestResponse(form_data, su, this);				if (p.getProperty("status").equals(GR_STAT_SUCCESS)) {					// parse and store the data					int numImages = p.getIntProperty("image_count");					String baseUrl = p.getProperty("baseurl");					try {						if (baseUrl == null) {							Log.log(Log.LEVEL_TRACE, MODULE, "Gallery root, baseurl is null");						} else {							// verify that baseUrl is a valid URL (don't remove)							URL tmpUrl = new URL(baseUrl);						}					} catch (MalformedURLException e) {						Log.log(Log.LEVEL_TRACE, MODULE, "baseurl is relative, tacking on Gallery URL (only works for standalone)");						URL tmpUrl = new URL(g.getStUrlString());						baseUrl = new URL(tmpUrl.getProtocol(), tmpUrl.getHost(), tmpUrl.getPort(), baseUrl).toString();					}					int width;					int height;					ArrayList extraFields = a.getExtraFields();					for (int i = 1; i <= numImages; i++) {						if (maxPictures> 0 && newPictures.size() >= maxPictures) {							Log.log(Log.LEVEL_TRACE, MODULE, "Fetched maximum of " + maxPictures +									" pictures: stopping.");							break;						}						String subAlbumName = p.getProperty("album.name." + i);						boolean subAlbumHidden = p.getBooleanProperty("album.hidden." + i, false);						if (subAlbumName != null) {							if (!subAlbumHidden) {								fetch(a, subAlbumName, newPictures);							}						} else {							Picture picture = new Picture(g);							picture.setOnline(true);							String rawName = p.getProperty("image.name." + i);							if (rawName != null) {								picture.setUrlFull(new URL(baseUrl + rawName));								width = p.getIntProperty("image.raw_width." + i, 0);								height = p.getIntProperty("image.raw_height." + i, 0);								picture.setSizeFull(new Dimension(width, height));								picture.setFileSize(p.getIntProperty("image.raw_filesize." + i));								picture.setUniqueId(a.getName() + '_' + rawName);								picture.setItemId(rawName);							}							String forceExtension = p.getProperty("image.forceExtension." + i);							if (forceExtension != null) {								picture.setForceExtension(forceExtension);							}							String resizedName = p.getProperty("image.resizedName." + i);							if (resizedName != null) {								picture.setUrlResized(new URL(baseUrl + resizedName));								width = p.getIntProperty("image.resized_width." + i);								height = p.getIntProperty("image.resized_height." + i);								picture.setSizeResized(new Dimension(width, height));							}							picture.setUrlThumbnail(new URL(baseUrl + p.getProperty("image.thumbName." + i)));							width = p.getIntProperty("image.thumb_width." + i);							height = p.getIntProperty("image.thumb_height." + i);							picture.setSizeThumbnail(new Dimension(width, height));							picture.setCaption(p.getProperty("image.caption." + i));							String title = p.getProperty("image.title." + i);							if (title != null) {								picture.setName(title);							}							if (extraFields != null) {								for (Iterator it = extraFields.iterator(); it.hasNext();) {									String name = (String) it.next();									String value = p.getProperty("image.extrafield." + name + "." + i);									if (value != null) {										picture.setExtraField(name, value);									}								}							}							picture.setHidden(p.getBooleanProperty("image.hidden." + i, false));							picture.setAlbumOnServer(a);							picture.setIndexOnServer(i - 1);							if (!picture.isHidden() && !(rawName == null && resizedName == null)) {								// don't add the picture if the current user can't get access to it								newPictures.add(picture);							}						}					}				} else {					throw new GR2Exception(p.getProperty("error"));				}			/*} catch (GR2Exception gr2e) {				Log.logException(Log.LEVEL_ERROR, MODULE, gr2e);				Object[] params2 = {gr2e.getMessage()};				error(su, GRI18n.getString(MODULE, "error", params2));*/			} catch (IOException ioe) {				Log.logException(Log.LEVEL_ERROR, MODULE, ioe);				Object[] params2 = {ioe.toString()};				error(su, GRI18n.getString(MODULE, "error", params2));			} catch (ModuleException me) {				Log.logException(Log.LEVEL_ERROR, MODULE, me);				Object[] params2 = {me.toString()};				error(su, GRI18n.getString(MODULE, "error", params2));			}		}