finally { if (is!=null) { try { is.close(); } catch (IOException e) { throw new GalleryException(e.getMessage(), e); } } }
	public void loadFolder() throws GalleryException	{		int i;		String s;		if (!isDirectoryParsed)		{			String[] parts = folderPath.split("/");			StringBuffer sb = new StringBuffer();			StringBuffer currentParent = null;			parentFolderList = new ArrayList();			String hTMLBase = jgalleryContextPath;			String parentlink = null;			boolean skipReadImages = false;			// ParentLink			// [, galleries, Portugal, Lissabon]			// [0] is empty, [1..n-2] are parents, [n-1] is current			if (parts.length > 2)			{				for (i = 1; i < parts.length - 1; i++)				{					level = i;					sb.append(parts[i]);					sb.append('/');					parentlink = null;					if (i == 1)					{						s = configuration.getString("parentlink." + parts[1]);						if (s != null)						{							parentlink = s;						}						if ((s != null) && (parts.length == 2))						{							// at top folder and replacement given							skipReadImages = true;						}					}					currentParent = new StringBuffer();					if (parentlink != null)					{						currentParent.append(parentlink);					}					else					{						currentParent.append(hTMLBase).append("/").append(sb)								.append("index.").append(										configData.urlExtention);					}					parentFolderList.add(new ParentLink(parts[i], currentParent							.toString()));				}				parentIndexPage = currentParent.toString();			}			if (skipReadImages)			{				imageFiles = new String[0];			}			else			{				imageFiles = directory.list(new FilenameFilter()				{					public boolean accept(File dir, String name)					{						File f1 = new File(dir, name);						return (f1.isDirectory() && !thumbsdir.equals(name))								| isJPEGExtension(name);						// return isJPEGExtension(name);					};				});				subDirectories = getSubDirectories();			}			File f = new File(directory, CAPTIONSFILE);			InputStream is = null;			try			{				is = new FileInputStream(f);				captions.load(is);			}			catch (FileNotFoundException e)			{				// ignore, no captions			}			catch (IOException e)			{				throw new GalleryException(e.getMessage(), e);			}			imageCounters = new int[imageFiles.length];			Arrays.fill(imageCounters, -1);			endLoad();		}	}