throw new MapyrusException("Dataset type '" + type + "' not available."); } else if (errorMessage != null) { throw new MapyrusException("Error opening dataset '" + name + "': " + errorMessage);
if (errorMessage == null) errorMessage = "";  throw new MapyrusException("Error opening dataset '" + name + "': " + errorMessage);
	public static GeographicDataset open(String type, String name,		String extras, String []geometryFieldNames) throws MapyrusException	{		GeographicDataset retval = null;		String errorMessage = null;		/*		 * Branch to open dataset, depending on type.		 * Catch all kinds of dataset openning exceptions here and return		 * them all as MapyrusExceptions to avoid exposing higher level code		 * to lots of exception types.		 */				try		{			// XXX dynamically load class for datasets for easier extensionsibility.			if (type.equalsIgnoreCase("textfile"))				retval = new TextfileDataset(name, extras, geometryFieldNames);			else if (type.equalsIgnoreCase("shapefile"))				retval = new ShapefileDataset(name, extras, geometryFieldNames);		}		catch (IOException e)		{			errorMessage = e.getMessage();		}		if (retval == null)						{			throw new MapyrusException("Dataset type '" + type + "' not available.");		}		else if (errorMessage != null)		{			throw new MapyrusException("Error opening dataset '" + name + "': " +				errorMessage);		}		return(retval);	}