org.eclipse.update.examples/Scrapbook2.jpage

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Mon Feb 25 21:22:27 2002 UTC (7 years, 9 months ago) by celek
Branch: MAIN
CVS Tags: v20020918H0815, v20020515, v20020517, v20020510, v20020531H2400, v20020418, v20020430, v20020318, v20020327_ce_intermediate, v20020518, v20030107H0700, v20020305, v20020308, v20020226, v20020327_vk_reconciled, v20020326, v20020320, v20020524_16513_16743_16748, v20030305H1715, v20020411, v2020531H1330, v20020312, v20020528, v20020529, v20020529H1045_16972, v20020617, v20020527, v20020612, v20020531, v20020611, r202_merge_core_210, v20021118H2000, v20030317H0845, r202_v20021016H1400, v20020409, v20020423, v20020425, R2_0, v20020508, v20020402, v20020530, r202_20020925H0745, v20020520H2100, v20021112H1100, v20020910H1000, v20020606, v20020520H1400, v20020520, v20020514, v20020609, r201_v20020812H2100, v20020314, v20020531H1500_18366, v20020607, v20020601, v20020912H0700, HEAD
Branch point for: R2_0_1
retry site and parsing defensive coding
SiteManager.getSite(URL)throws CoreException
  String type = getTypeForprotocol(URL.getprotocol);
  try {
    if (type != null){
	attemptCreationSite(type,URL);
    } else {
	attemptCreationSite("http",URL);
    }
  } catch (CoreException e){
    throw new CoreException("Cannot create site",e.getMessage());
  }

SiteManager.attemptCreationSite(type,URL)throws CoreException
  try {
    createSite(type,URL);
  } catch (InvalidTypeException e){
    try {
      createSite(e.getRealType(),URL);
    } catch (InvalidSiteExeption e){
      throw new CoreException("Wrong site type");
    }
  }

SiteManager.createSite(type,URL) throws CoreExeption, InvalidSiteTypeException


try {
			
	factory.createSite(url, forceCreation);
	
} catch (IOException e) {
	// if the URL is pointing to either a file 
// or a directory, without reference			
if (url.getRef() != null) {
	// 4 nothing we can do
	throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e.getMessage(),e);
} else if (url.getFile().endsWith("/")) {
	// 1 try to add site.xml
	try {
		url = new URL(url,Site.SITE_XML);
	} catch (MalformedURLException e1){
		throw newCoreException("Cannot create URL:"+url.toExternalForm()+"+"+Site.SITE_XML,e1);
	}
	try {
		site = factory.createSite(url, forceCreation);
	} catch (ParsingException e1){
		throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e1.getMessage(),e1);					
	} catch (IOException e1){
		throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e1.getMessage(),e1);					
	}
} else if (url.getFile().endsWith(Site.SITE_XML)) {
	// 3 nothing we can do
	throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e.getMessage(),e);
} else {
	// 2 try to add /site.xml
	try {
		url = new URL(url.getProtocol(),url.getHost(), url.getPort(), url.getFile()+"/"+Site.SITE_XML);
	} catch (MalformedURLException e1){
		throw newCoreException("Cannot create URL:"+url.toExternalForm()+"+"+Site.SITE_XML,e1);
	}
	
	try {
		site = factory.createSite(url, forceCreation);
	} catch (ParsingException e1){
		throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e1.getMessage()+"\r\nPrevious Input/Output Error:"+e.getMessage(),e1);					
	} catch (IOException e1){
		throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e1.getMessage()+"\r\nPrevious Input/Output Error:"+e.getMessage(),e1);					
				}				
			}

		} catch (ParsingException e) {
			
			// if the URL is pointing to either a file 
// or a directory, without reference			
if (url.getRef() != null) {
	// 4 nothing we can do
	throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e.getMessage(),e);
} else if (url.getFile().endsWith("/")) {
	// 1 try to add site.xml
	try {
		url = new URL(url,Site.SITE_XML);
	} catch (MalformedURLException e1){
		throw newCoreException("Cannot create URL:"+url.toExternalForm()+"+"+Site.SITE_XML,e1);
	}
	try {
		site = factory.createSite(url, forceCreation);
	} catch (ParsingException e1){
		throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e1.getMessage(),e1);					
	} catch (IOException e1){
		throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e1.getMessage(),e1);
				}				

			} else if (url.getFile().endsWith(Site.SITE_XML)) {
				// 3 nothing we can do
	throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e.getMessage(),e);					
} else {
	// 2 try to add /site.xml
	
	try {
		url = new URL(url.getProtocol(),url.getHost(), url.getPort(), url.getFile()+"/"+Site.SITE_XML);
	} catch (MalformedURLException e1){
		throw newCoreException("Cannot create URL:"+url.toExternalForm()+"+"+Site.SITE_XML,e1);
	}
	try {
		site = factory.createSite(url, forceCreation);
	} catch (ParsingException e1){
		throw newCoreException("Error parsing URL:"+url.toExternalForm()+"\r\n"+e1.getMessage()+"\r\nPrevious Parsing error:"+e.getMessage(),e1);					
	} catch (IOException e1){
		throw newCoreException("Error accessing url:"+url.toExternalForm()+"\r\n"+e1.getMessage()+"\r\nPrevious Parsing error:"+e.getMessage(),e1);