Ver código fonte

fix formatting no functionnal changes

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1203664 13f79535-47bb-0310-9956-ffa450edef68
tags/archiva-1.4-M2
Olivier Lamy 12 anos atrás
pai
commit
fcb3e8c534

+ 3
- 3
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java Ver arquivo

@@ -24,7 +24,7 @@ import java.net.URI;

/**
* BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
* for the file object based on that Base Directory value.
* for the file object based on that Base Directory value.
*
* @version $Id$
*/
@@ -78,8 +78,8 @@ public class BaseFile
public BaseFile( URI uri )
{
super( uri ); // only to satisfy java compiler.
throw new IllegalStateException( "The " + BaseFile.class.getName()
+ " object does not support URI construction." );
throw new IllegalStateException(
"The " + BaseFile.class.getName() + " object does not support URI construction." );
}

public File getBaseDir()

+ 3
- 3
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java Ver arquivo

@@ -24,7 +24,7 @@ import java.util.Date;
import java.util.GregorianCalendar;

/**
* DateUtil - some (not-so) common date utility methods.
* DateUtil - some (not-so) common date utility methods.
*
* @version $Id$
*/
@@ -34,7 +34,7 @@ public class DateUtil
{
return getDuration( new Date( 0 ), new Date( duration ) );
}
public static String getDuration( long ms1, long ms2 )
{
return getDuration( new Date( ms1 ), new Date( ms2 ) );
@@ -90,7 +90,7 @@ public class DateUtil
leftMins += 60;
--leftHours;
}
if ( leftHours < 0 )
{
leftHours += 24;

+ 7
- 7
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java Ver arquivo

@@ -25,7 +25,7 @@ import java.io.File;
import java.net.MalformedURLException;

/**
* PathUtil - simple utility methods for path manipulation.
* PathUtil - simple utility methods for path manipulation.
*
* @version $Id$
*/
@@ -62,9 +62,9 @@ public class PathUtil

/**
* Given a basedir and a child file, return the relative path to the child.
*
*
* @param basedir the basedir.
* @param file the file to get the relative path for.
* @param file the file to get the relative path for.
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
*/
public static String getRelative( String basedir, File file )
@@ -74,9 +74,9 @@ public class PathUtil

/**
* Given a basedir and a child file, return the relative path to the child.
*
*
* @param basedir the basedir.
* @param child the child path (can be a full path)
* @param child the child path (can be a full path)
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
*/
public static String getRelative( String basedir, String child )
@@ -100,7 +100,7 @@ public class PathUtil
}

// File is not within basedir.
throw new IllegalStateException( "Unable to obtain relative path of file " + child
+ ", it is not within basedir " + basedir + "." );
throw new IllegalStateException(
"Unable to obtain relative path of file " + child + ", it is not within basedir " + basedir + "." );
}
}

+ 72
- 40
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java Ver arquivo

@@ -28,102 +28,134 @@ import org.slf4j.LoggerFactory;
*
* @version $Id$
*/
public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger {
public class Slf4JPlexusLogger
implements org.codehaus.plexus.logging.Logger
{
private Logger log;

public Slf4JPlexusLogger(Class<?> clazz) {
log = LoggerFactory.getLogger(clazz);
public Slf4JPlexusLogger( Class<?> clazz )
{
log = LoggerFactory.getLogger( clazz );
}

public Slf4JPlexusLogger(String name) {
log = LoggerFactory.getLogger(name);
public Slf4JPlexusLogger( String name )
{
log = LoggerFactory.getLogger( name );
}

public void debug(String message) {
log.debug(message);
public void debug( String message )
{
log.debug( message );
}

public void debug(String message, Throwable throwable) {
log.debug(message, throwable);
public void debug( String message, Throwable throwable )
{
log.debug( message, throwable );
}

public void error(String message) {
log.error(message);
public void error( String message )
{
log.error( message );
}

public void error(String message, Throwable throwable) {
log.error(message, throwable);
public void error( String message, Throwable throwable )
{
log.error( message, throwable );
}

public void fatalError(String message) {
log.error(message);
public void fatalError( String message )
{
log.error( message );
}

public void fatalError(String message, Throwable throwable) {
log.error(message, throwable);
public void fatalError( String message, Throwable throwable )
{
log.error( message, throwable );
}

public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
return new Slf4JPlexusLogger(log.getName() + "." + name);
public org.codehaus.plexus.logging.Logger getChildLogger( String name )
{
return new Slf4JPlexusLogger( log.getName() + "." + name );
}

public String getName() {
public String getName()
{
return log.getName();
}

public int getThreshold() {
if (log.isTraceEnabled()) {
public int getThreshold()
{
if ( log.isTraceEnabled() )
{
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
} else if (log.isDebugEnabled()) {
}
else if ( log.isDebugEnabled() )
{
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
} else if (log.isInfoEnabled()) {
}
else if ( log.isInfoEnabled() )
{
return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
} else if (log.isWarnEnabled()) {
}
else if ( log.isWarnEnabled() )
{
return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
} else if (log.isErrorEnabled()) {
}
else if ( log.isErrorEnabled() )
{
return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
}

return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
}

public void info(String message) {
log.info(message);
public void info( String message )
{
log.info( message );
}

public void info(String message, Throwable throwable) {
log.info(message, throwable);
public void info( String message, Throwable throwable )
{
log.info( message, throwable );
}

public boolean isDebugEnabled() {
public boolean isDebugEnabled()
{
return log.isDebugEnabled();
}

public boolean isErrorEnabled() {
public boolean isErrorEnabled()
{
return log.isErrorEnabled();
}

public boolean isFatalErrorEnabled() {
public boolean isFatalErrorEnabled()
{
return log.isErrorEnabled();
}

public boolean isInfoEnabled() {
public boolean isInfoEnabled()
{
return log.isInfoEnabled();
}

public boolean isWarnEnabled() {
public boolean isWarnEnabled()
{
return log.isWarnEnabled();
}

public void setThreshold(int threshold) {
public void setThreshold( int threshold )
{
/* do nothing */
}

public void warn(String message) {
log.warn(message);
public void warn( String message )
{
log.warn( message );
}

public void warn(String message, Throwable throwable) {
log.warn(message, throwable);
public void warn( String message, Throwable throwable )
{
log.warn( message, throwable );
}
}

+ 24
- 37
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java Ver arquivo

@@ -25,7 +25,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Version utility methods.
* Version utility methods.
*
* @version $Id$
*/
@@ -35,26 +35,12 @@ public class VersionUtil
* These are the version patterns found in the filenames of the various artifact's versions IDs.
* These patterns are all tackling lowercase version IDs.
*/
private static final String versionPatterns[] = new String[] {
"([0-9][_.0-9a-z]*)",
"(snapshot)",
"(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
"(dev[_.0-9]*)",
"(alpha[_.0-9]*)",
"(beta[_.0-9]*)",
"(rc[_.0-9]*)",
private static final String versionPatterns[] =
new String[]{ "([0-9][_.0-9a-z]*)", "(snapshot)", "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)", "(dev[_.0-9]*)",
"(alpha[_.0-9]*)", "(beta[_.0-9]*)", "(rc[_.0-9]*)",
// "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712
"(debug[_.0-9]*)",
"(unofficial[_.0-9]*)",
"(current)",
"(latest)",
"(fcs)",
"(release[_.0-9]*)",
"(nightly)",
"(final)",
"(incubating)",
"(incubator)",
"([ab][_.0-9]+)" };
"(debug[_.0-9]*)", "(unofficial[_.0-9]*)", "(current)", "(latest)", "(fcs)", "(release[_.0-9]*)",
"(nightly)", "(final)", "(incubating)", "(incubator)", "([ab][_.0-9]+)" };

public static final String SNAPSHOT = "SNAPSHOT";

@@ -64,19 +50,20 @@ public class VersionUtil

public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT );

private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );
private static final Pattern VERSION_MEGA_PATTERN =
Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );

/**
* <p>
* Tests if the unknown string contains elements that identify it as a version string (or not).
* </p>
*
* <p/>
* <p>
* The algorithm tests each part of the string that is delimited by a '-' (dash) character.
* If 75% or more of the sections are identified as 'version' strings, the result is
* determined to be of a high probability to be version identifier string.
* </p>
*
*
* @param unknown the unknown string to test.
* @return true if the unknown string is likely a version string.
*/
@@ -115,12 +102,12 @@ public class VersionUtil
* <p>
* Tests if the identifier is a known simple version keyword.
* </p>
*
* <p/>
* <p>
* This method is different from {@link #isVersion(String)} in that it tests the whole input string in
* one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
* </p>
*
*
* @param identifier the identifier to test.
* @return true if the unknown string is likely a version string.
*/
@@ -140,7 +127,7 @@ public class VersionUtil
}
else
{
return isGenericSnapshot(version);
return isGenericSnapshot( version );
}
}

@@ -156,43 +143,43 @@ public class VersionUtil
return version;
}
}
/**
* <p>
* Get the release version of the snapshot version.
* </p>
*
* <p/>
* <p>
* If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0
* And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0
* </p>
*
*
* @param snapshotVersion
* @return
*/
public static String getReleaseVersion( String snapshotVersion )
{
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion );
if( isGenericSnapshot( snapshotVersion ) )
if ( isGenericSnapshot( snapshotVersion ) )
{
m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion );
}
if ( m.matches() )
{
{
return m.group( 1 );
}
else
{
{
return snapshotVersion;
}
}

public static boolean isUniqueSnapshot( String version )
{
{
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
if( m.matches() )
if ( m.matches() )
{
return true;
}
@@ -202,6 +189,6 @@ public class VersionUtil

public static boolean isGenericSnapshot( String version )
{
return version.endsWith( SNAPSHOT );
return version.endsWith( SNAPSHOT );
}
}

Carregando…
Cancelar
Salvar