+++ /dev/null
-package org.apache.maven.archiva.converter.artifact;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.io.FileUtils;
-
-/**
- * AsciiFileUtil - conveinence utility for reading / writing ascii files.
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @todo switch to commons-lang and use their high-performance versions of these utility methods.
- */
-public class AsciiFileUtil
-{
- /**
- * Read a file into a {@link String} and return it.
- *
- * @param file the file to read
- * @return the {@link String} contents of the file.
- * @throws IOException if there was a problem performing this operation.
- */
- public static String readFile( File file )
- throws IOException
- {
- return FileUtils.readFileToString( file, null );
- }
-
- /**
- * Write the contents of a {@link String} to a file.
- *
- * @param file the file to write to
- * @param content the {@link String} contents to write.
- * @throws IOException if there was a problem performing this operation.
- */
- public static void writeFile( File file, String content )
- throws IOException
- {
- FileUtils.writeStringToFile( file, content, null );
- }
-}
}
// Even if the checksums for the POM are invalid we should still convert the POM
- contents = AsciiFileUtil.readFile( file );
+ contents = FileUtils.readFileToString( file, null );
}
catch ( IOException e )
{
boolean matching = false;
if ( !force && targetFile.exists() )
{
- String targetContents = AsciiFileUtil.readFile( targetFile );
+ String targetContents = FileUtils.readFileToString( targetFile, null );
matching = targetContents.equals( contents );
}
if ( force || !matching )
File checksumFile = new File( file.getParentFile(), fileName );
if ( checksumFile.exists() )
{
- String checksum = AsciiFileUtil.readFile( checksumFile );
+ String checksum = FileUtils.readFileToString( checksumFile, null );
try
{
digester.verify( file, checksum );
import org.apache.maven.archiva.converter.artifact.ArtifactConversionException;
import org.apache.maven.archiva.converter.artifact.ArtifactConverter;
-import org.apache.maven.archiva.converter.artifact.AsciiFileUtil;
import org.apache.maven.archiva.converter.artifact.Messages;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
private static void compareFiles( File expectedPomFile, File pomFile )
throws IOException
{
- String expectedContent = normalizeString( AsciiFileUtil.readFile( expectedPomFile ) );
- String targetContent = normalizeString( AsciiFileUtil.readFile( pomFile ) );
+ String expectedContent = normalizeString( org.apache.commons.io.FileUtils.readFileToString( expectedPomFile, null ) );
+ String targetContent = normalizeString( org.apache.commons.io.FileUtils.readFileToString( pomFile, null ) );
assertEquals( "Check file match between " + expectedPomFile + " and " + pomFile, expectedContent, targetContent );
}