Author: xavier Date: Mon Sep 15 02:17:13 2008 New Revision: 695390 URL: http://svn.apache.org/viewvc?rev=695390&view=rev Log: fix style
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java Mon Sep 15 02:17:13 2008 @@ -19,7 +19,6 @@ import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; import java.text.ParseException; import java.util.Date; import java.util.Map; @@ -238,7 +237,7 @@ } public ModuleDescriptorMemoryCache getMemoryCache() { - if (memoryModuleDescrCache==null) { + if (memoryModuleDescrCache == null) { memoryModuleDescrCache = new ModuleDescriptorMemoryCache(DEFAULT_MEMORY_CACHE_SIZE); } return memoryModuleDescrCache; @@ -637,7 +636,7 @@ private ModuleDescriptor getMdFromCache(XmlModuleDescriptorParser mdParser, CacheMetadataOptions options, File ivyFile) - throws ParseException, IOException, MalformedURLException { + throws ParseException, IOException { ModuleDescriptorMemoryCache cache = getMemoryCache(); ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser); return cache.get(ivyFile, settings, options.isValidate(), mdProvider); @@ -645,7 +644,7 @@ private ModuleDescriptor getStaledMd(ModuleDescriptorParser mdParser, CacheMetadataOptions options, File ivyFile) - throws ParseException, IOException, MalformedURLException { + throws ParseException, IOException { ModuleDescriptorMemoryCache cache = getMemoryCache(); ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser); return cache.getStale(ivyFile, settings, options.isValidate(), mdProvider); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java Mon Sep 15 02:17:13 2008 @@ -53,7 +53,7 @@ ModuleDescriptorProvider mdProvider) throws ParseException, IOException { ModuleDescriptor descriptor = getFromCache(ivyFile, ivySettings, validated); - if (descriptor==null) { + if (descriptor == null) { descriptor = getStale(ivyFile, ivySettings, validated, mdProvider); } return descriptor; @@ -72,15 +72,15 @@ } ModuleDescriptor getFromCache(File ivyFile, ParserSettings ivySettings, boolean validated) { - if (maxSize<=0) { + if (maxSize <= 0) { //cache is disbaled return null; } CacheEntry entry = (CacheEntry) valueMap.get(ivyFile); - if (entry!=null) { + if (entry != null) { if (entry.isStale(validated, ivySettings)) { - Message.debug("Entry is found in the ModuleDescriptorCache but entry should be " + - "reevaluated : " + ivyFile); + Message.debug("Entry is found in the ModuleDescriptorCache but entry should be " + + "reevaluated : " + ivyFile); valueMap.remove(ivyFile); return null; } else { @@ -90,8 +90,7 @@ Message.debug("Entry is found in the ModuleDescriptorCache : " + ivyFile); return entry.md; } - } - else { + } else { Message.debug("No entry is found in the ModuleDescriptorCache : " + ivyFile); return null; } @@ -101,11 +100,11 @@ void putInCache(File url, ParserSettingsMonitor ivySettingsMonitor, boolean validated, ModuleDescriptor descriptor) { - if (maxSize<=0) { + if (maxSize <= 0) { //cache is disabled return; } - if (valueMap.size()>=maxSize) { + if (valueMap.size() >= maxSize) { Message.debug("ModuleDescriptorCache is full, remove one entry"); Iterator it = valueMap.values().iterator(); it.next(); @@ -116,18 +115,20 @@ private static class CacheEntry { - final ModuleDescriptor md; - final boolean validated; - final ParserSettingsMonitor parserSettingsMonitor; + private final ModuleDescriptor md; + private final boolean validated; + private final ParserSettingsMonitor parserSettingsMonitor; - CacheEntry(ModuleDescriptor md ,boolean validated, ParserSettingsMonitor parserSettingsMonitor ) { + CacheEntry(ModuleDescriptor md , boolean validated, + ParserSettingsMonitor parserSettingsMonitor) { this.md = md; this.validated = validated; this.parserSettingsMonitor = parserSettingsMonitor; } boolean isStale(boolean validated, ParserSettings newParserSettings) { - return (validated && !this.validated) || parserSettingsMonitor.hasChanged(newParserSettings); + return (validated && !this.validated) + || parserSettingsMonitor.hasChanged(newParserSettings); } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java Mon Sep 15 02:17:13 2008 @@ -34,13 +34,16 @@ import org.apache.ivy.plugins.resolver.DependencyResolver; import org.apache.ivy.util.Message; - /** - * Keep traces of the usage of a ParserSettings in order to check afterwards that - * the relevant settings didn't changed. - * A ParserSettingsMonitor provide a ParserSettings that must be used in place of the - * orignal one. - * The current implementation consider that a settings changed iff one of the used variable has changed. + * Keep traces of the usage of a ParserSettings in order to check afterwards that the relevant + * settings didn't changed. + * <p> + * A ParserSettingsMonitor provide a ParserSettings that must be used in place of the orignal one. + * </p> + * <p> + * The current implementation consider that a settings changed iff one of the used variable has + * changed. + * </p> */ class ParserSettingsMonitor { @@ -75,12 +78,12 @@ * has been monitored. Only the info that was actually used is compared. */ public boolean hasChanged(ParserSettings newSettings) { - for(Iterator it = substitutes.entrySet().iterator() ; it.hasNext() ;) { + for (Iterator it = substitutes.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry) it.next(); String key = (String) entry.getKey(); Object oldValue = entry.getValue(); String newValue = newSettings.substitute(key); - if (! oldValue.equals(newValue)) { + if (!oldValue.equals(newValue)) { Message.debug("settings variable has changed for : " + entry.getKey()); return true; } @@ -138,7 +141,7 @@ public String substitute(String value) { String r = delegatedSettings.substitute(value); - if (value!=null && value!=r) { + if (value != null && value != r) { substitutes.put(value, r); } return r; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Mon Sep 15 02:17:13 2008 @@ -131,7 +131,8 @@ + " Parent=" + parentModRevID); } - Map parentPomProps = PomModuleDescriptorBuilder.extractPomProperties(parentDescr.getExtraInfo()); + Map parentPomProps = PomModuleDescriptorBuilder.extractPomProperties( + parentDescr.getExtraInfo()); for (Iterator iter = parentPomProps.entrySet().iterator(); iter.hasNext();) { Map.Entry prop = (Map.Entry) iter.next(); domReader.setProperty((String) prop.getKey(), (String) prop.getValue()); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java Mon Sep 15 02:17:13 2008 @@ -89,9 +89,9 @@ public Resource resolveResource(String path) { try { ChannelSftp c = getSftpChannel(path); - + Collection r = c.ls(getPath(path)); - + if (r != null) { for (Iterator iter = r.iterator(); iter.hasNext();) { Object obj = iter.next(); @@ -107,7 +107,7 @@ Message.debug("reolving resource error: " + e.getMessage()); // silent fail, return unexisting resource } - + return new BasicResource(path, false, 0, 0, false); } @@ -186,18 +186,18 @@ c.mkdir(directory); } } - - private String getPath(String sftpURI) throws URISyntaxException { - String result = null; - URI uri = new URI(sftpURI); - result = uri.getPath(); - - if (result == null) { - throw new URISyntaxException(sftpURI, "Missing path in URI."); - } - - return result; - } + + private String getPath(String sftpURI) throws URISyntaxException { + String result = null; + URI uri = new URI(sftpURI); + result = uri.getPath(); + + if (result == null) { + throw new URISyntaxException(sftpURI, "Missing path in URI."); + } + + return result; + } public List list(String parent) throws IOException { try { Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/URLRepository.java Mon Sep 15 02:17:13 2008 @@ -22,7 +22,13 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; + import org.apache.ivy.plugins.repository.AbstractRepository; import org.apache.ivy.plugins.repository.RepositoryCopyProgressListener; import org.apache.ivy.plugins.repository.Resource; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java Mon Sep 15 02:17:13 2008 @@ -100,7 +100,8 @@ ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res); ModuleDescriptor md = - parser.parseDescriptor(getSettings(), temp.toURI().toURL(), res, false); + parser.parseDescriptor( + getSettings(), temp.toURI().toURL(), res, false); revision = md.getRevision(); if ((revision == null) || (revision.length() == 0)) { revision = "working@" + name; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java Mon Sep 15 02:17:13 2008 @@ -81,7 +81,7 @@ } } } else if (confs[i].startsWith("!")) { - excluded.add(confs[i].substring( 1 )); + excluded.add(confs[i].substring(1)); } else { result.add(confs[i]); } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java Mon Sep 15 02:17:13 2008 @@ -46,7 +46,8 @@ return getURLInfo(url, timeout).getLastModified(); } - protected void validatePutStatusCode(URL dest, int statusCode, String statusMessage) throws IOException { + protected void validatePutStatusCode( + URL dest, int statusCode, String statusMessage) throws IOException { switch (statusCode) { case HttpURLConnection.HTTP_OK: /* intentional fallthrough */ @@ -59,9 +60,11 @@ case HttpURLConnection.HTTP_UNAUTHORIZED: /* intentional fallthrough */ case HttpURLConnection.HTTP_FORBIDDEN: - throw new IOException("Access to URL " + dest + " was refused by the server" + (statusMessage == null ? "" : ": " + statusMessage)); + throw new IOException("Access to URL " + dest + " was refused by the server" + + (statusMessage == null ? "" : ": " + statusMessage)); default: - throw new IOException("PUT operation to URL " + dest + " failed with status code " + statusCode + (statusMessage == null ? "" : ": " + statusMessage)); + throw new IOException("PUT operation to URL " + dest + " failed with status code " + + statusCode + (statusMessage == null ? "" : ": " + statusMessage)); } } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java Mon Sep 15 02:17:13 2008 @@ -17,7 +17,13 @@ */ package org.apache.ivy.util.url; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URI; @@ -25,7 +31,6 @@ import java.net.URL; import java.net.URLConnection; import java.net.UnknownHostException; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.ivy.Ivy; @@ -105,8 +110,8 @@ String uriString = uri.toString(); url = new URL(ESCAPE_PATTERN.matcher(uriString).replaceAll("%$1")); } catch (URISyntaxException e) { - IOException ioe = new MalformedURLException("Couldn't convert '" + - url.toString() + "' to a valid URI"); + IOException ioe = new MalformedURLException("Couldn't convert '" + + url.toString() + "' to a valid URI"); ioe.initCause(e); throw ioe; } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=695390&r1=695389&r2=695390&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Mon Sep 15 02:17:13 2008 @@ -18,10 +18,9 @@ package org.apache.ivy.util.url; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.FileInputStream; -import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; import java.text.ParseException; @@ -40,9 +39,8 @@ import org.apache.commons.httpclient.auth.AuthPolicy; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.HeadMethod; -import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.InputStreamRequestEntity; -import org.apache.commons.httpclient.params.HttpMethodParams; +import org.apache.commons.httpclient.methods.PutMethod; import org.apache.ivy.Ivy; import org.apache.ivy.util.CopyProgressListener; import org.apache.ivy.util.Credentials; @@ -278,7 +276,8 @@ } // user-agent - httpClient.getParams().setParameter("http.useragent", "Apache Ivy/" + Ivy.getIvyVersion()); + httpClient.getParams().setParameter( + "http.useragent", "Apache Ivy/" + Ivy.getIvyVersion()); } Credentials c = getCredentials(url);