dion 2003/08/20 21:02:52
Modified: src/java/org/apache/maven/repository AbstractArtifact.java
Log:
System.out -> log.info or log.debug
Various little code issues
Revision Changes Path
1.22 +20 -18 maven/src/java/org/apache/maven/repository/AbstractArtifact.java
Index: AbstractArtifact.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/repository/AbstractArtifact.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AbstractArtifact.java 11 Apr 2003 23:45:33 -0000 1.21
+++ AbstractArtifact.java 21 Aug 2003 04:02:52 -0000 1.22
@@ -56,6 +56,8 @@
* ====================================================================
*/
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenUtils;
import org.apache.maven.verifier.ChecksumVerificationException;
@@ -75,6 +77,9 @@
public abstract class AbstractArtifact
implements Artifact
{
+ /** logger for output */
+ private Log log = LogFactory.getLog(AbstractArtifact.class);
+
/** Platform specific file separator used for file system operations. */
protected static final String ps = File.separator;
@@ -84,7 +89,10 @@
/** Path to artifact. */
private String path;
- /** Default constructor. */
+ /**
+ * Default constructor.
+ * @param dependency the dependency the artifact is based on
+ */
public AbstractArtifact( Dependency dependency )
{
this.dependency = dependency;
@@ -157,14 +165,7 @@
/** @see Artifact#exists */
public boolean exists()
{
- if ( getFile().exists() )
- {
- return true;
- }
- else
- {
- return false;
- }
+ return getFile().exists();
}
/** @see Artifact#isSnapshot */
@@ -179,10 +180,10 @@
return new File( getPath() );
}
- // ----------------------------------------------------------------------
- // C H E C K S U M V E R I F I C A T I O N
- // ----------------------------------------------------------------------
-
+ /**
+ * C H E C K S U M V E R I F I C A T I O N
+ * @throws ChecksumVerificationException when the checksum differs
+ */
public void verify()
throws ChecksumVerificationException
{
@@ -192,7 +193,7 @@
// checksum files yet so we'll be a little lax right now but
// hopefully in the future we can differentiate or specify
// repositories whose artifacts must undergo verification.
- if ( checksumFile.exists() == false )
+ if ( !checksumFile.exists() )
{
return;
}
@@ -214,10 +215,10 @@
return;
}
- System.out.println( "'" + actualChecksum + "'" );
- System.out.println( "'" + md5.getChecksum() + "'" );
+ log.debug( "Actual checksum: '" + actualChecksum + "'" );
+ log.debug( "MD5 checksum: '" + md5.getChecksum() + "'" );
- if ( actualChecksum.equals( md5.getChecksum() ) == false )
+ if ( !actualChecksum.equals( md5.getChecksum() ) )
{
throw new ChecksumVerificationException(
MavenUtils.getMessage( "checksum.verification.error", getPath() ) );
@@ -229,6 +230,7 @@
*
* @param file The name of the file to read.
* @return The file contents or null if read failed.
+ * @throws IOException if there is an error reading the file
*/
String fileRead( File file )
throws IOException
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]