You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2009/04/28 01:12:32 UTC

svn commit: r769199 [11/19] - in /maven/mercury/trunk: mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/ mercury-core/src/main/java/org/apache/maven/mercury/artifact/...

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtil.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtil.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtil.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtil.java Mon Apr 27 23:12:25 2009
@@ -68,969 +68,1069 @@
 
 /**
  * File related utilities: copy, write, sign, verify, etc.
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class FileUtil
 {
-  public static final String SEP = "/";
-  public static final char   SEP_CHAR = SEP.charAt( 0 );
+    public static final String SEP = "/";
 
-  public static final String DASH = "-";
-  public static final char   DASH_CHAR = DASH.charAt( 0 );
+    public static final char SEP_CHAR = SEP.charAt( 0 );
 
-  public static final String LOCK_FILE = ".lock";
-  public static final String DEFAULT_CHARSET = "utf-8";
+    public static final String DASH = "-";
 
-  public static final int    K = 1024;
-  public static final int    DEFAULT_BUFFER_SIZE = 10 * K;
-  
-  public static final String PROTOCOL_DELIM = "://";
-  public static final int    PROTOCOL_DELIM_LEN = PROTOCOL_DELIM.length();
-  public static final String [] URL_PROTOCOLS = new String [] {"http","https","dav","file","davs","webdav","webdavs","dav+http","dav+https"};
-  public static final String [] LOCAL_PROTOCOLS = new String [] {"file"};
-  //---------------------------------------------------------------------------------------------------------------
-  private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( FileUtil.class );
-  private static final Language LANG = new DefaultLanguage( FileUtil.class );
-
-  private static final OverlappingFileLockException FILE_LOCKED = new OverlappingFileLockException();
-  //---------------------------------------------------------------------------------------------------------------
-  public static void delete( File f )
-  {
-    if( ! f.exists()  )
-      return;
-
-    if( f.isDirectory() )
-    {
-      File [] kids = f.listFiles();
-      for( File kid : kids )
-        delete( kid );
-    }
-
-    f.delete();
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void copy( File fromFile, File toFile, boolean clean )
-  throws IOException
-  {
-    if( toFile.exists() && clean )
-      delete( toFile );
-
-    if( fromFile.isFile() )
-    {
-      copyFile( fromFile, toFile );
-      return;
-    }
-
-    File [] kids = fromFile.listFiles();
-    if( kids != null )
-    {
-      for( File kid : kids )
-      {
-        if( kid.isDirectory() )
-        {
-          File newDir = new File( toFile, kid.getName() );
-          newDir.mkdirs();
+    public static final char DASH_CHAR = DASH.charAt( 0 );
+
+    public static final String LOCK_FILE = ".lock";
+
+    public static final String DEFAULT_CHARSET = "utf-8";
+
+    public static final int K = 1024;
+
+    public static final int DEFAULT_BUFFER_SIZE = 10 * K;
+
+    public static final String PROTOCOL_DELIM = "://";
+
+    public static final int PROTOCOL_DELIM_LEN = PROTOCOL_DELIM.length();
+
+    public static final String[] URL_PROTOCOLS =
+        new String[] { "http", "https", "dav", "file", "davs", "webdav", "webdavs", "dav+http", "dav+https" };
+
+    public static final String[] LOCAL_PROTOCOLS = new String[] { "file" };
 
-          copy( kid, newDir, false );
+    // ---------------------------------------------------------------------------------------------------------------
+    private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( FileUtil.class );
+
+    private static final Language LANG = new DefaultLanguage( FileUtil.class );
+
+    private static final OverlappingFileLockException FILE_LOCKED = new OverlappingFileLockException();
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void delete( File f )
+    {
+        if ( !f.exists() )
+            return;
+
+        if ( f.isDirectory() )
+        {
+            File[] kids = f.listFiles();
+            for ( File kid : kids )
+                delete( kid );
         }
-        else
-          copyFile( kid, toFile );
-      }
+
+        f.delete();
     }
 
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  private static void copyFile( File f, File toFile )
-  throws IOException
-  {
-    File fOut = null;
-    
-    if( toFile.isDirectory() )
-      fOut = new File(toFile, f.getName() );
-    else
-      fOut = toFile;
-    
-    FileInputStream fis = new FileInputStream(f);
-    
-    writeRawData( fis, fOut );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /**
-   * Read the content of a file and converts it with UTF-8 encoding to a String.
-   */
-  public static String readRawDataAsString( File file )
-  throws IOException
-  {
-    return new String( readRawData( file ), DEFAULT_CHARSET );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static byte[] readRawData( File file )
-  throws IOException
-  {
-    if( ! file.exists() )
-      return null;
-
-    FileInputStream fis = null;
-
-    try
-    {
-      fis = new FileInputStream( file );
-      int len = (int)file.length();
-      if( len == 0 )
-      {
-        LOG.info( LANG.getMessage( "reading.empty.file", file.getAbsolutePath() ) );
-        return null;
-      }
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void copy( File fromFile, File toFile, boolean clean )
+        throws IOException
+    {
+        if ( toFile.exists() && clean )
+            delete( toFile );
 
-      byte [] pom = new byte [ len ];
-      while( fis.available() < 1 )
-        try { Thread.sleep( 8L ); } catch( InterruptedException e ){}
+        if ( fromFile.isFile() )
+        {
+            copyFile( fromFile, toFile );
+            return;
+        }
 
-      fis.read( pom, 0, len );
+        File[] kids = fromFile.listFiles();
+        if ( kids != null )
+        {
+            for ( File kid : kids )
+            {
+                if ( kid.isDirectory() )
+                {
+                    File newDir = new File( toFile, kid.getName() );
+                    newDir.mkdirs();
+
+                    copy( kid, newDir, false );
+                }
+                else
+                    copyFile( kid, toFile );
+            }
+        }
 
-      return pom;
     }
-    catch( IOException e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private static void copyFile( File f, File toFile )
+        throws IOException
     {
-      throw  e;
+        File fOut = null;
+
+        if ( toFile.isDirectory() )
+            fOut = new File( toFile, f.getName() );
+        else
+            fOut = toFile;
+
+        FileInputStream fis = new FileInputStream( f );
+
+        writeRawData( fis, fOut );
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    /**
+     * Read the content of a file and converts it with UTF-8 encoding to a String.
+     */
+    public static String readRawDataAsString( File file )
+        throws IOException
     {
-      if( fis != null ) try { fis.close(); } catch( Exception any ) {}
+        return new String( readRawData( file ), DEFAULT_CHARSET );
     }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static byte[] readRawData( File file, Collection<StreamVerifierFactory> vFacs  )
-  throws IOException, FileUtilException, StreamVerifierException
-  {
-    if( file == null || ! file.exists() )
-      return null;
-
-    boolean verify = vFacs != null && vFacs.size() > 0;
 
-    String fileName = file.getAbsolutePath();
+    // ---------------------------------------------------------------------------------------------------------------
+    public static byte[] readRawData( File file )
+        throws IOException
+    {
+        if ( !file.exists() )
+            return null;
 
-    HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( verify ? vFacs.size() : 1 );
+        FileInputStream fis = null;
 
-    for( StreamVerifierFactory svf : vFacs )
-    {
-      StreamVerifier sv = svf.newInstance();
-      String ext = sv.getAttributes().getExtension();
-      String sigFileName = fileName + ( ext.startsWith( "." ) ? "" : "." ) + ext;
-      File sigFile = new File( sigFileName );
-      if( sigFile.exists() )
-      {
         try
         {
-          sv.initSignature( FileUtil.readRawDataAsString( sigFile ) );
+            fis = new FileInputStream( file );
+            int len = (int) file.length();
+            if ( len == 0 )
+            {
+                LOG.info( LANG.getMessage( "reading.empty.file", file.getAbsolutePath() ) );
+                return null;
+            }
+
+            byte[] pom = new byte[len];
+            while ( fis.available() < 1 )
+                try
+                {
+                    Thread.sleep( 8L );
+                }
+                catch ( InterruptedException e )
+                {
+                }
+
+            fis.read( pom, 0, len );
+
+            return pom;
+        }
+        catch ( IOException e )
+        {
+            throw e;
         }
-        catch( IOException e )
+        finally
         {
-          throw new FileUtilException( LANG.getMessage( "cannot.read.signature.file", sigFileName, e.getMessage() ) );
+            if ( fis != null )
+                try
+                {
+                    fis.close();
+                }
+                catch ( Exception any )
+                {
+                }
         }
-        vs.add( sv );
-      }
-      else if( ! sv.getAttributes().isLenient() )
-      {
-        throw new FileUtilException( LANG.getMessage( "no.signature.file", ext, sigFileName ) );
-      }
-      // otherwise ignore absence of signature file, if verifier is lenient
     }
 
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-    FileInputStream fin = null;
-    try
+    // ---------------------------------------------------------------------------------------------------------------
+    public static byte[] readRawData( File file, Collection<StreamVerifierFactory> vFacs )
+        throws IOException, FileUtilException, StreamVerifierException
     {
-      fin = new FileInputStream( file );
-      byte [] buf = new byte[ DEFAULT_BUFFER_SIZE ];
-      int n = -1;
-      while( (n = fin.read( buf )) != -1 )
-      {
-        if( verify )
+        if ( file == null || !file.exists() )
+            return null;
+
+        boolean verify = vFacs != null && vFacs.size() > 0;
+
+        String fileName = file.getAbsolutePath();
+
+        HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( verify ? vFacs.size() : 1 );
+
+        for ( StreamVerifierFactory svf : vFacs )
         {
-          for( StreamVerifier sv : vs )
-            try
+            StreamVerifier sv = svf.newInstance();
+            String ext = sv.getAttributes().getExtension();
+            String sigFileName = fileName + ( ext.startsWith( "." ) ? "" : "." ) + ext;
+            File sigFile = new File( sigFileName );
+            if ( sigFile.exists() )
             {
-              sv.bytesReady( buf, 0, n );
+                try
+                {
+                    sv.initSignature( FileUtil.readRawDataAsString( sigFile ) );
+                }
+                catch ( IOException e )
+                {
+                    throw new FileUtilException( LANG.getMessage( "cannot.read.signature.file", sigFileName,
+                                                                  e.getMessage() ) );
+                }
+                vs.add( sv );
             }
-            catch( StreamObserverException e )
+            else if ( !sv.getAttributes().isLenient() )
             {
-              if( ! sv.getAttributes().isLenient() )
-                throw new FileUtilException(e);
+                throw new FileUtilException( LANG.getMessage( "no.signature.file", ext, sigFileName ) );
             }
+            // otherwise ignore absence of signature file, if verifier is lenient
         }
 
-        baos.write( buf, 0, n );
-      }
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-      if( verify )
-      {
-        for( StreamVerifier sv : vs )
+        FileInputStream fin = null;
+        try
         {
-          if( sv.verifySignature() )
-          {
-            if( sv.getAttributes().isSufficient() )
-              break;
-          }
-          else
-          {
-            if( !sv.getAttributes().isLenient() )
-              throw new StreamVerifierException( LANG.getMessage( "signature.failed", sv.getAttributes().getExtension(), fileName ) );
-          }
-        }
-      }
+            fin = new FileInputStream( file );
+            byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+            int n = -1;
+            while ( ( n = fin.read( buf ) ) != -1 )
+            {
+                if ( verify )
+                {
+                    for ( StreamVerifier sv : vs )
+                        try
+                        {
+                            sv.bytesReady( buf, 0, n );
+                        }
+                        catch ( StreamObserverException e )
+                        {
+                            if ( !sv.getAttributes().isLenient() )
+                                throw new FileUtilException( e );
+                        }
+                }
+
+                baos.write( buf, 0, n );
+            }
+
+            if ( verify )
+            {
+                for ( StreamVerifier sv : vs )
+                {
+                    if ( sv.verifySignature() )
+                    {
+                        if ( sv.getAttributes().isSufficient() )
+                            break;
+                    }
+                    else
+                    {
+                        if ( !sv.getAttributes().isLenient() )
+                            throw new StreamVerifierException( LANG.getMessage( "signature.failed",
+                                                                                sv.getAttributes().getExtension(),
+                                                                                fileName ) );
+                    }
+                }
+            }
 
-      return baos.toByteArray();
+            return baos.toByteArray();
+        }
+        catch ( IOException e )
+        {
+            throw new FileUtilException( e );
+        }
+        finally
+        {
+            if ( fin != null )
+                try
+                {
+                    fin.close();
+                }
+                catch ( Exception any )
+                {
+                }
+        }
     }
-    catch( IOException e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static byte[] readRawData( InputStream in )
+        throws IOException
     {
-      throw new FileUtilException( e );
+        byte[] bytes = new byte[DEFAULT_BUFFER_SIZE];
+        int n = -1;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        while ( ( n = in.read( bytes ) ) != -1 )
+            baos.write( bytes, 0, n );
+
+        return baos.toByteArray();
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    /**
+     * Write UTF-8 representation of a String to a File.
+     */
+    public static void writeRawData( File file, String sBytes )
+        throws IOException
     {
-      if( fin != null ) try { fin.close(); } catch( Exception any ) {}
+        writeRawData( file, sBytes.getBytes( DEFAULT_CHARSET ) );
     }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static byte[] readRawData( InputStream in )
-  throws IOException
-  {
-    byte [] bytes = new byte [ DEFAULT_BUFFER_SIZE ];
-    int n = -1;
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-    while( ( n = in.read( bytes ) ) != -1 )
-      baos.write( bytes, 0, n );
 
-    return baos.toByteArray();
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /**
-   * Write UTF-8 representation of a String to a File. 
-   */
-  public static void writeRawData( File file, String sBytes )
-  throws IOException
-  {
-    writeRawData( file, sBytes.getBytes( DEFAULT_CHARSET ) );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void writeRawData( InputStream in, File f )
-  throws IOException
-  {
-    OutputStream out = new FileOutputStream( f );
-    try
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void writeRawData( InputStream in, File f )
+        throws IOException
     {
-      byte [] buf = new byte[ DEFAULT_BUFFER_SIZE ];
-      int n;
+        OutputStream out = new FileOutputStream( f );
+        try
+        {
+            byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+            int n;
+
+            while ( ( n = in.read( buf ) ) > 0 )
+                out.write( buf, 0, n );
+
+            out.flush();
+        }
+        finally
+        {
+            out.close();
+        }
 
-      while( (n = in.read( buf ) ) > 0 )
-          out.write( buf, 0, n );
-      
-      out.flush();
+        in.close();
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static File writeTempData( byte[] bytes )
+        throws IOException
     {
-      out.close();
+        File f = File.createTempFile( "temp-", "-mercury-util" );
+
+        writeRawData( f, bytes );
+
+        return f;
     }
 
-    in.close();
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static File writeTempData( byte [] bytes )
-  throws IOException
-  {
-      File f = File.createTempFile( "temp-", "-mercury-util" );
-      
-      writeRawData( f, bytes );
-      
-      return f;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void writeRawData( File file, byte [] bytes )
-  throws IOException
-  {
-    if( file.exists() )
-      file.delete();
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void writeRawData( File file, byte[] bytes )
+        throws IOException
+    {
+        if ( file.exists() )
+            file.delete();
 
-    File parentDir = file.getParentFile();
+        File parentDir = file.getParentFile();
 
-    if( !parentDir.exists() )
-      parentDir.mkdirs();
+        if ( !parentDir.exists() )
+            parentDir.mkdirs();
 
-    FileOutputStream fos = null;
+        FileOutputStream fos = null;
 
-    try
-    {
-      fos = new FileOutputStream( file );
-      fos.write( bytes );
-      fos.flush();
+        try
+        {
+            fos = new FileOutputStream( file );
+            fos.write( bytes );
+            fos.flush();
+        }
+        catch ( IOException e )
+        {
+            throw e;
+        }
+        finally
+        {
+            if ( fos != null )
+                try
+                {
+                    fos.close();
+                }
+                catch ( Exception any )
+                {
+                }
+        }
     }
-    catch( IOException e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void writeAndSign( String fName, byte[] bytes, Set<StreamVerifierFactory> vFacs )
+        throws IOException, StreamObserverException
     {
-      throw  e;
+        ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
+        writeAndSign( fName, bais, vFacs );
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void writeAndSign( String fName, InputStream in, Set<StreamVerifierFactory> vFacs )
+        throws IOException, StreamObserverException
     {
-      if( fos != null ) try { fos.close(); } catch( Exception any ) {}
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void writeAndSign( String fName, byte [] bytes, Set<StreamVerifierFactory> vFacs )
-  throws IOException, StreamObserverException
-  {
-    ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
-    writeAndSign( fName, bais, vFacs );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void writeAndSign( String fName, InputStream in, Set<StreamVerifierFactory> vFacs )
-  throws IOException, StreamObserverException
-  {
-    byte [] buf = new byte[ DEFAULT_BUFFER_SIZE ];
-    int n = -1;
-    HashSet<StreamVerifier> vSet = new HashSet<StreamVerifier>( vFacs.size() );
+        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+        int n = -1;
+        HashSet<StreamVerifier> vSet = new HashSet<StreamVerifier>( vFacs.size() );
 
-    for( StreamVerifierFactory vf : vFacs )
-      vSet.add( vf.newInstance() );
+        for ( StreamVerifierFactory vf : vFacs )
+            vSet.add( vf.newInstance() );
 
-    FileOutputStream fout = null;
+        FileOutputStream fout = null;
 
-    try
-    {
-      File f = new File( fName );
+        try
+        {
+            File f = new File( fName );
 
-      f.getParentFile().mkdirs();
+            f.getParentFile().mkdirs();
 
-      fout = new FileOutputStream( f );
+            fout = new FileOutputStream( f );
 
-      while( ( n = in.read( buf ) ) != -1 )
-      {
-        for( StreamVerifier sv : vSet )
-          sv.bytesReady( buf, 0, n );
+            while ( ( n = in.read( buf ) ) != -1 )
+            {
+                for ( StreamVerifier sv : vSet )
+                    sv.bytesReady( buf, 0, n );
 
-        fout.write( buf, 0, n );
-      }
+                fout.write( buf, 0, n );
+            }
 
-      fout.flush();
-      fout.close();
-      fout = null;
+            fout.flush();
+            fout.close();
+            fout = null;
 
-      for( StreamVerifier sv : vSet )
-      {
-        String sig = sv.getSignature();
-        FileUtil.writeRawData( new File( fName + sv.getAttributes().getExtension() ), sig );
-      }
+            for ( StreamVerifier sv : vSet )
+            {
+                String sig = sv.getSignature();
+                FileUtil.writeRawData( new File( fName + sv.getAttributes().getExtension() ), sig );
+            }
+
+        }
+        finally
+        {
+            if ( fout != null )
+                try
+                {
+                    fout.close();
+                }
+                catch ( Exception any )
+                {
+                }
+        }
 
     }
-    finally
+
+    public List<String> dirToList( File dir, boolean includeDirs, boolean includeFiles )
     {
-      if( fout != null ) try { fout.close(); } catch( Exception any ) {}
-    }
+        if ( !dir.exists() )
+            return null;
 
-  }
+        File[] files = dir.listFiles();
 
-  public List<String> dirToList( File dir, boolean includeDirs, boolean includeFiles )
-  {
-    if( ! dir.exists() )
-      return null;
+        List<String> res = new ArrayList<String>( files.length );
 
-    File [] files = dir.listFiles();
+        for ( File f : files )
+            if ( f.isDirectory() )
+            {
+                if ( includeDirs )
+                    res.add( f.getName() );
+            }
+            else if ( includeFiles )
+                res.add( f.getName() );
 
-    List<String> res = new ArrayList<String>( files.length );
+        return res;
+    }
 
-    for( File f : files )
-      if( f.isDirectory() )
-      {
-        if( includeDirs )
-          res.add( f.getName() );
-      }
-      else
-        if( includeFiles )
-          res.add( f.getName() );
+    /**
+     * @param f
+     * @param vFacs
+     * @param recurse
+     * @param force
+     * @throws IOException
+     * @throws StreamObserverException
+     */
+    public static void sign( File f, Set<StreamVerifierFactory> vFacs, boolean recurse, boolean force )
+        throws IOException, StreamObserverException
+    {
+        if ( vFacs == null || vFacs.size() < 1 )
+            return;
 
-    return res;
-  }
+        if ( f.isDirectory() )
+        {
+            if ( !recurse )
+                return;
 
-  /**
-   * 
-   * @param f
-   * @param vFacs
-   * @param recurse
-   * @param force
-   * @throws IOException
-   * @throws StreamObserverException
-   */
-  public static void sign( File f, Set<StreamVerifierFactory> vFacs, boolean recurse, boolean force )
-  throws IOException, StreamObserverException
-  {
-    if( vFacs == null || vFacs.size() < 1 )
-      return;
+            File[] kids = f.listFiles();
+            for ( File kid : kids )
+                sign( kid, vFacs, recurse, force );
+            return;
+        }
 
-    if( f.isDirectory() )
-    {
-      if( ! recurse )
-        return;
+        String fName = f.getAbsolutePath();
 
-      File [] kids = f.listFiles();
-      for( File kid : kids )
-        sign( kid, vFacs, recurse, force );
-      return;
-    }
+        HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( vFacs.size() );
+        for ( StreamVerifierFactory vf : vFacs )
+        {
+            StreamVerifier sv = vf.newInstance();
+            String ext = sv.getAttributes().getExtension();
 
-    String fName = f.getAbsolutePath();
+            // don't sign signature files
+            if ( fName.endsWith( ext ) )
+                return;
 
-    HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( vFacs.size() );
-    for( StreamVerifierFactory vf : vFacs )
-    {
-      StreamVerifier sv = vf.newInstance();
-      String ext = sv.getAttributes().getExtension();
+            File sf = new File( fName + ext );
+            if ( sf.exists() )
+            {
+                if ( force )
+                    sf.delete();
+                else
+                    continue;
+            }
+            vs.add( sv );
+        }
 
-      // don't sign signature files
-      if( fName.endsWith( ext ) )
-        return;
+        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+        FileInputStream fis = null;
+        try
+        {
+            fis = new FileInputStream( f );
+            int n = -1;
+
+            while ( ( n = fis.read( buf ) ) != -1 )
+            {
+                for ( StreamVerifier sv : vs )
+                {
+                    sv.bytesReady( buf, 0, n );
+                }
+            }
+
+            for ( StreamVerifier sv : vs )
+            {
+                String sig = sv.getSignature();
+                String ext = sv.getAttributes().getExtension();
+                File sf = new File( fName + ext );
+                writeRawData( sf, sig );
+            }
+        }
+        finally
+        {
+            if ( fis != null )
+                try
+                {
+                    fis.close();
+                }
+                catch ( Exception any )
+                {
+                }
+        }
 
-      File sf = new File( fName + ext );
-      if( sf.exists() )
-      {
-        if( force )
-          sf.delete();
-        else
-          continue;
-      }
-      vs.add( sv );
     }
 
-    byte [] buf = new byte[ DEFAULT_BUFFER_SIZE ];
-    FileInputStream fis = null;
-    try
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void verify( File f, Set<StreamVerifierFactory> vFacs, boolean recurse, boolean force )
+        throws IOException, StreamObserverException
     {
-      fis = new FileInputStream( f );
-      int n = -1;
+        if ( vFacs == null || vFacs.size() < 1 )
+            return;
+
+        if ( f.isDirectory() )
+        {
+            if ( !recurse )
+                return;
+
+            File[] kids = f.listFiles();
+            for ( File kid : kids )
+                verify( kid, vFacs, recurse, force );
+            return;
+        }
 
-      while( ( n = fis.read( buf ) ) != -1 )
-      {
-        for( StreamVerifier sv : vs )
+        String fName = f.getAbsolutePath();
+        HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( vFacs.size() );
+        for ( StreamVerifierFactory vf : vFacs )
         {
-          sv.bytesReady( buf, 0, n );
+            StreamVerifier sv = vf.newInstance();
+            String ext = sv.getAttributes().getExtension();
+
+            // don't verify signature files
+            if ( fName.endsWith( ext ) )
+                return;
+
+            File sf = new File( fName + ext );
+            if ( !sf.exists() )
+            {
+                if ( force )
+                    throw new StreamVerifierException( LANG.getMessage( "no.mandatory.signature", f.getAbsolutePath(),
+                                                                        sf.getAbsolutePath() ) );
+                else
+                    continue;
+            }
+            else
+            {
+                String sig = readRawDataAsString( sf );
+                sv.initSignature( sig );
+            }
+            vs.add( sv );
+        }
+
+        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+        FileInputStream fis = null;
+        try
+        {
+            fis = new FileInputStream( f );
+            int n = -1;
+
+            while ( ( n = fis.read( buf ) ) != -1 )
+            {
+                for ( StreamVerifier sv : vs )
+                {
+                    sv.bytesReady( buf, 0, n );
+                }
+            }
+
+            List<String> fl = null;
+            char comma = ' ';
+
+            for ( StreamVerifier sv : vs )
+            {
+                if ( sv.verifySignature() )
+                    continue;
+
+                if ( fl == null )
+                    fl = new ArrayList<String>( 4 );
+
+                fl.add( sv.getAttributes().getExtension().replace( '.', comma ) );
+                comma = ',';
+            }
+
+            if ( fl != null )
+            {
+                throw new StreamVerifierException( LANG.getMessage( "file.failed.verification", f.getAbsolutePath(),
+                                                                    fl.toString() ) );
+            }
+        }
+        finally
+        {
+            if ( fis != null )
+                try
+                {
+                    fis.close();
+                }
+                catch ( Exception any )
+                {
+                }
         }
-      }
 
-      for( StreamVerifier sv : vs )
-      {
-        String sig = sv.getSignature();
-        String ext = sv.getAttributes().getExtension();
-        File sf = new File( fName + ext );
-        writeRawData( sf, sig );
-      }
-    }
-    finally
-    {
-      if( fis != null ) try { fis.close(); } catch( Exception any ) {}
     }
 
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void verify( File f, Set<StreamVerifierFactory> vFacs, boolean recurse, boolean force )
-  throws IOException, StreamObserverException
-  {
-    if( vFacs == null || vFacs.size() < 1 )
-      return;
+    // ---------------------------------------------------------------------------------------------------------------
+    @SuppressWarnings( "static-access" )
+    public static void main( String[] args )
+        throws IOException, StreamObserverException
+    {
+        Option sign = new Option( "sign", LANG.getMessage( "option.sign" ) );
+        Option verify = new Option( "verify", LANG.getMessage( "option.verify" ) );
+        OptionGroup cmd = new OptionGroup();
+        cmd.addOption( sign );
+        cmd.addOption( verify );
+
+        Option recurce = new Option( "r", LANG.getMessage( "option.r" ) );
+        Option force = new Option( "force", LANG.getMessage( "option.force" ) );
+
+        OptionGroup sig = new OptionGroup();
+        Option sha1 = new Option( "sha1", LANG.getMessage( "option.sha1" ) );
+        Option pgp = new Option( "pgp", LANG.getMessage( "option.pgp" ) );
+        sig.addOption( sha1 );
+        sig.addOption( pgp );
+
+        Option keyring =
+            OptionBuilder.withArgName( "file" ).hasArg().withType( java.io.File.class ).withDescription(
+                                                                                                         LANG.getMessage( "option.keyring" ) ).create(
+                                                                                                                                                       "keyring" );
+        Option keyid =
+            OptionBuilder.withArgName( "hexstring" ).hasArg().withDescription( LANG.getMessage( "option.keyid" ) ).create(
+                                                                                                                           "keyid" );
+        Option keypass =
+            OptionBuilder.withArgName( "string" ).hasArg().withDescription( LANG.getMessage( "option.keypass" ) ).create(
+                                                                                                                          "keypass" );
+
+        Options options = new Options();
+        options.addOptionGroup( cmd );
+        options.addOptionGroup( sig );
+
+        options.addOption( recurce );
+        options.addOption( force );
+
+        options.addOption( keyring );
+        options.addOption( keyid );
+        options.addOption( keypass );
 
-    if( f.isDirectory() )
-    {
-      if( !recurse )
-        return;
+        CommandLine commandLine = null;
+        CommandLineParser parser = new GnuParser();
+
+        if ( args == null || args.length < 2 )
+        {
+            HelpFormatter formatter = new HelpFormatter();
+            formatter.printHelp( "mercury-util", options );
+            return;
+        }
+
+        try
+        {
+            commandLine = parser.parse( options, args );
+        }
+        catch ( ParseException e )
+        {
+            System.err.println( "Command line parsing eror: " + e.getMessage() );
+            return;
+        }
+
+        Set<StreamVerifierFactory> vFacs = new HashSet<StreamVerifierFactory>( 4 );
+
+        if ( commandLine.hasOption( "pgp" ) )
+        {
+            if ( commandLine.hasOption( "sign" ) && commandLine.hasOption( "keyring" )
+                && commandLine.hasOption( "keyid" ) )
+            {
+                BufferedReader r = new BufferedReader( new InputStreamReader( System.in ) );
+                String pass =
+                    commandLine.hasOption( "keypass" ) ? commandLine.getOptionValue( "keypass" ) : r.readLine();
+
+                vFacs.add( new PgpStreamVerifierFactory(
+                                                         new StreamVerifierAttributes(
+                                                                                       PgpStreamVerifierFactory.DEFAULT_EXTENSION,
+                                                                                       false, true ),
+                                                         new FileInputStream( commandLine.getOptionValue( "keyring" ) ),
+                                                         commandLine.getOptionValue( "keyid" ), pass ) );
+            }
+            else if ( commandLine.hasOption( "verify" ) && commandLine.hasOption( "keyring" ) )
+            {
+
+                vFacs.add( new PgpStreamVerifierFactory(
+                                                         new StreamVerifierAttributes(
+                                                                                       PgpStreamVerifierFactory.DEFAULT_EXTENSION,
+                                                                                       false, true ),
+                                                         new FileInputStream( commandLine.getOptionValue( "keyring" ) ) ) );
+            }
+            else
+            {
+                System.err.println( LANG.getMessage( "bad.pgp.args" ) );
+                return;
+            }
+        }
+
+        if ( commandLine.hasOption( "sha1" ) )
+        {
+            vFacs.add( new SHA1VerifierFactory( true, false ) );
+        }
+
+        try
+        {
+            signAll( commandLine.getArgList(), vFacs, commandLine.hasOption( "r" ), commandLine.hasOption( "force" ),
+                     commandLine.hasOption( "sign" ) );
+        }
+        catch ( Exception e )
+        {
+            System.err.println( "Bummer: " + e.getMessage() );
+            return;
+        }
+        System.out.println( "Done" );
 
-      File [] kids = f.listFiles();
-      for( File kid : kids )
-        verify( kid, vFacs, recurse, force );
-      return;
     }
 
-    String fName = f.getAbsolutePath();
-    HashSet<StreamVerifier> vs = new HashSet<StreamVerifier>( vFacs.size() );
-    for( StreamVerifierFactory vf : vFacs )
+    // ---------------------------------------------------------------------------------------------------------------
+    private static void signAll( List<String> fileNames, Set<StreamVerifierFactory> vFacs, boolean recurse,
+                                 boolean force, boolean sign )
+        throws IOException, StreamObserverException
     {
-      StreamVerifier sv = vf.newInstance();
-      String ext = sv.getAttributes().getExtension();
+        if ( vFacs == null || vFacs.size() < 1 )
+        {
+            System.err.println( "no.verifiers" );
+            return;
+        }
 
-      // don't verify signature files
-      if( fName.endsWith( ext ) )
-        return;
+        File f = null;
 
-      File sf = new File( fName + ext );
-      if( !sf.exists() )
-      {
-        if( force )
-          throw new StreamVerifierException( LANG.getMessage( "no.mandatory.signature", f.getAbsolutePath(), sf.getAbsolutePath() ) );
-        else
-          continue;
-      }
-      else
-      {
-        String sig = readRawDataAsString( sf );
-        sv.initSignature( sig );
-      }
-      vs.add( sv );
+        for ( String fName : fileNames )
+        {
+            f = new File( fName );
+            if ( !f.exists() )
+            {
+                System.out.println( LANG.getMessage( "file.not.exists", fName ) );
+                continue;
+            }
+            if ( f.isDirectory() && !recurse )
+            {
+                System.out.println( LANG.getMessage( "file.is.directory", fName ) );
+                continue;
+            }
+            if ( sign )
+                sign( f, vFacs, recurse, force );
+            else
+                verify( f, vFacs, recurse, force );
+        }
     }
 
-    byte [] buf = new byte[ DEFAULT_BUFFER_SIZE ];
-    FileInputStream fis = null;
-    try
+    // ---------------------------------------------------------------------------------------------------------------
+    /**
+     * try to acquire lock on specified directory for <code>millis<code> milliseconds
+     * 
+     * @param dir directory to lock
+     * @param millis how long to wait for the lock before surrendering
+     * @param sleepFor how long to sleep between attempts
+     * @return obtained FileLock or null
+     * @throws IOException if there were problems obtaining the lock
+     */
+    public static FileLockBundle lockDir( String dir, long millis, long sleepFor )
+        throws IOException
     {
-      fis = new FileInputStream( f );
-      int n = -1;
 
-      while( ( n=fis.read( buf ) ) != -1 )
-      {
-        for( StreamVerifier sv : vs )
+        File df = new File( dir );
+
+        boolean exists = df.exists();
+
+        for ( int i = 0; i < 10 && !exists; i++ )
         {
-          sv.bytesReady( buf, 0, n );
+            try
+            {
+                Thread.sleep( 1l );
+            }
+            catch ( InterruptedException e )
+            {
+            }
+            df.mkdirs();
+            exists = df.exists();
+            LOG.info( LANG.getMessage( "had.to.create.directory", dir, exists + "" ) );
         }
-      }
 
-      List<String> fl = null;
-      char comma = ' ';
+        if ( !exists )
+            throw new IOException( LANG.getMessage( "cannot.create.directory", dir ) );
 
-      for( StreamVerifier sv : vs )
-      {
-        if( sv.verifySignature() )
-          continue;
+        if ( !df.isDirectory() )
+            throw new IOException( LANG.getMessage( "file.is.not.directory", dir, df.exists() + "", df.isDirectory()
+                + "", df.isFile() + "" ) );
 
-        if( fl == null )
-          fl = new ArrayList<String>( 4 );
+        File lockFile = new File( dir, LOCK_FILE );
+
+        long start = System.currentTimeMillis();
+
+        for ( long now = start; ( now - start ) < millis; now = System.currentTimeMillis() )
+            try
+            {
+                synchronized ( FileUtil.class )
+                {
+                    if ( !lockFile.exists() )
+                    {
+                        writeRawData( lockFile, "lock" );
+                        lockFile.deleteOnExit();
+                        return new FileLockBundle( dir );
+                    }
+                }
+                Thread.sleep( sleepFor );
 
-        fl.add( sv.getAttributes().getExtension().replace( '.', comma ) );
-        comma = ',';
-      }
+            }
+            catch ( InterruptedException ie )
+            {
+            }
 
-      if( fl != null )
-      {
-        throw new StreamVerifierException( LANG.getMessage( "file.failed.verification", f.getAbsolutePath(), fl.toString() ) );
-      }
+        // too long a wait
+        return null;
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    /**
+     * try to acquire lock on specified directory for <code>millis<code> milliseconds
+     * 
+     * @param dir directory to lock
+     * @param millis how long to wait for the lock before surrendering
+     * @param sleepFor how long to sleep between attempts
+     * @return obtained FileLock or null
+     * @throws IOException if there were problems obtaining the lock
+     */
+    public static FileLockBundle lockDirNio( String dir, long millis, long sleepFor )
+        throws IOException
     {
-      if( fis != null ) try { fis.close(); } catch( Exception any ) {}
-    }
+        File df = new File( dir );
 
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  @SuppressWarnings("static-access")
-  public static void main( String[] args )
-  throws IOException, StreamObserverException
-  {
-    Option sign      = new Option( "sign", LANG.getMessage( "option.sign" ) );
-    Option verify    = new Option( "verify", LANG.getMessage( "option.verify" ) );
-    OptionGroup  cmd = new OptionGroup();
-    cmd.addOption( sign );
-    cmd.addOption( verify );
+        boolean exists = df.exists();
 
-    Option recurce   = new Option( "r", LANG.getMessage( "option.r" ) );
-    Option force     = new Option( "force", LANG.getMessage( "option.force" ) );
+        for ( int i = 0; i < 10 && !exists; i++ )
+        {
+            try
+            {
+                Thread.sleep( 1l );
+            }
+            catch ( InterruptedException e )
+            {
+            }
+            df.mkdirs();
+            exists = df.exists();
+            LOG.info( LANG.getMessage( "had.to.create.directory", dir, exists + "" ) );
+        }
 
-    OptionGroup  sig = new OptionGroup();
-    Option sha1      = new Option( "sha1", LANG.getMessage( "option.sha1" ) );
-    Option pgp       = new Option( "pgp", LANG.getMessage( "option.pgp" ) );
-    sig.addOption( sha1 );
-    sig.addOption( pgp );
+        if ( !exists )
+            throw new IOException( LANG.getMessage( "cannot.create.directory", dir ) );
 
-    Option keyring   = OptionBuilder.withArgName( "file" )
-                                    .hasArg()
-                                    .withType( java.io.File.class )
-                                    .withDescription( LANG.getMessage( "option.keyring" ) )
-                                    .create( "keyring" )
-                                    ;
-    Option keyid     = OptionBuilder.withArgName( "hexstring" )
-                                    .hasArg()
-                                    .withDescription( LANG.getMessage( "option.keyid" ) )
-                                    .create( "keyid" )
-                                    ;
-    Option keypass   = OptionBuilder.withArgName( "string" )
-                                    .hasArg()
-                                    .withDescription( LANG.getMessage( "option.keypass" ) )
-                                    .create( "keypass" )
-                                    ;
+        if ( !df.isDirectory() )
+            throw new IOException( LANG.getMessage( "file.is.not.directory", dir, df.exists() + "", df.isDirectory()
+                + "", df.isFile() + "" ) );
 
-    Options options = new Options();
-    options.addOptionGroup( cmd );
-    options.addOptionGroup( sig );
+        File lockFile = new File( dir, LOCK_FILE );
+        if ( !lockFile.exists() )
+            writeRawData( lockFile, "lock" );
+        lockFile.deleteOnExit();
 
-    options.addOption( recurce );
-    options.addOption( force );
+        FileChannel ch = new RandomAccessFile( lockFile, "rw" ).getChannel();
+        FileLock lock = null;
 
-    options.addOption( keyring );
-    options.addOption( keyid );
-    options.addOption( keypass );
+        long start = System.currentTimeMillis();
 
-    CommandLine commandLine = null;
-    CommandLineParser parser = new GnuParser();
+        for ( ;; )
+            try
+            {
+                lock = ch.tryLock( 0L, 4L, false );
 
-    if( args == null || args.length < 2 )
-    {
-      HelpFormatter formatter = new HelpFormatter();
-      formatter.printHelp( "mercury-util", options );
-      return;
-    }
+                if ( lock == null )
+                    throw FILE_LOCKED;
+
+                return new FileLockBundle( dir, ch, lock );
+            }
+            catch ( OverlappingFileLockException oe )
+            {
+                try
+                {
+                    Thread.sleep( sleepFor );
+                }
+                catch ( InterruptedException e )
+                {
+                }
+                if ( System.currentTimeMillis() - start > millis )
+                    return null;
+            }
 
-    try
-    {
-        commandLine = parser.parse( options, args );
     }
-    catch( ParseException e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static synchronized void unlockDir( String dir )
     {
-        System.err.println( "Command line parsing eror: " + e.getMessage() );
-        return;
+        try
+        {
+            File df = new File( dir );
+            if ( !df.isDirectory() )
+                throw new IOException( LANG.getMessage( "file.is.not.directory", dir ) );
+
+            File lock = new File( dir, LOCK_FILE );
+            if ( lock.exists() )
+                lock.delete();
+        }
+        catch ( IOException e )
+        {
+            LOG.error( e.getMessage() );
+        }
     }
 
-    Set<StreamVerifierFactory> vFacs = new HashSet<StreamVerifierFactory>( 4 );
-
-    if( commandLine.hasOption( "pgp" ) )
+    // ---------------------------------------------------------------------------------------------------------------
+    public static final Set<StreamVerifierFactory> vSet( StreamVerifierFactory... facs )
     {
-      if( commandLine.hasOption( "sign" ) && commandLine.hasOption( "keyring" ) && commandLine.hasOption( "keyid" ) )
-      {
-        BufferedReader r = new BufferedReader( new InputStreamReader( System.in ) );
-        String pass = commandLine.hasOption( "keypass" ) ? commandLine.getOptionValue( "keypass" ) : r.readLine();
+        if ( facs == null || facs.length < 1 )
+            return null;
 
-        vFacs.add( 
-            new PgpStreamVerifierFactory(
-                    new StreamVerifierAttributes( PgpStreamVerifierFactory.DEFAULT_EXTENSION, false, true )
-                    , new FileInputStream( commandLine.getOptionValue( "keyring" ) )
-                    , commandLine.getOptionValue( "keyid" )
-                    , pass
-                                        )
-                    );
-      }
-      else if( commandLine.hasOption( "verify" ) && commandLine.hasOption( "keyring" ) )
-      {
+        HashSet<StreamVerifierFactory> res = new HashSet<StreamVerifierFactory>( facs.length );
+        for ( StreamVerifierFactory f : facs )
+        {
+            res.add( f );
+        }
 
-        vFacs.add(
-            new PgpStreamVerifierFactory(
-                    new StreamVerifierAttributes( PgpStreamVerifierFactory.DEFAULT_EXTENSION, false, true )
-                    , new FileInputStream( commandLine.getOptionValue( "keyring" ) )
-                                        )
-                    );
-      }
-      else
-      {
-        System.err.println( LANG.getMessage( "bad.pgp.args" ) );
-        return;
-      }
+        return res;
     }
 
-    if( commandLine.hasOption("sha1") )
+    // ---------------------------------------------------------------------------------------------------------------
+    public static final Set<StreamObserverFactory> oSet( StreamObserverFactory... facs )
     {
-      vFacs.add( new SHA1VerifierFactory( true,false ) );
+        if ( facs == null || facs.length < 1 )
+            return null;
+
+        HashSet<StreamObserverFactory> res = new HashSet<StreamObserverFactory>( facs.length );
+        for ( StreamObserverFactory f : facs )
+        {
+            res.add( f );
+        }
+
+        return res;
     }
 
-    try
+    // ---------------------------------------------------------------------------------------------------------------
+    public static void renameFile( File dir, String from, String to )
     {
-      signAll( commandLine.getArgList(), vFacs, commandLine.hasOption( "r" ), commandLine.hasOption( "force" ), commandLine.hasOption( "sign" ) );
+        if ( dir == null )
+            return;
+
+        File[] files = dir.listFiles();
+
+        if ( files == null || files.length < 1 )
+            return;
+
+        for ( File f : files )
+        {
+            if ( f.isDirectory() )
+                renameFile( f, from, to );
+            else if ( from.equals( f.getName() ) )
+            {
+                f.renameTo( new File( f.getParent(), to ) );
+            }
+        }
     }
-    catch( Exception e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static int depth( File file )
     {
-      System.err.println( "Bummer: " + e.getMessage() );
-      return;
+        if ( file == null || !file.exists() )
+            throw new IllegalArgumentException( LANG.getMessage( "file.not.exists.error", file == null ? "null"
+                            : file.getAbsolutePath() ) );
+
+        if ( file.isFile() )
+            return 0;
+
+        File[] files = file.listFiles();
+
+        int max = 0;
+
+        for ( File f : files )
+        {
+            if ( f.isDirectory() )
+            {
+                int res = depth( f );
+                if ( res > max )
+                    max = res;
+            }
+        }
+
+        return max + 1;
     }
-    System.out.println( "Done" );
 
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  private static void signAll( List<String> fileNames, Set<StreamVerifierFactory> vFacs, boolean recurse, boolean force, boolean sign )
-  throws IOException, StreamObserverException
-  {
-    if( vFacs == null || vFacs.size() < 1 )
+    // ---------------------------------------------------------------------------------------------------------------
+    public static InputStream toStream( String resource )
+        throws MalformedURLException, IOException
     {
-      System.err.println( "no.verifiers" );
-      return;
-    }
+        if ( resource == null )
+            return null;
 
-    File f = null;
+        int ind = resource.indexOf( PROTOCOL_DELIM );
 
-    for( String fName : fileNames )
-    {
-      f = new File( fName );
-      if( ! f.exists() )
-      {
-        System.out.println( LANG.getMessage( "file.not.exists", fName ) );
-        continue;
-      }
-      if( f.isDirectory() && ! recurse )
-      {
-        System.out.println( LANG.getMessage( "file.is.directory", fName ) );
-        continue;
-      }
-      if( sign )
-        sign( f, vFacs, recurse, force );
-      else
-        verify( f, vFacs, recurse, force );
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /**
-   * try to acquire lock on specified directory for <code>millis<code> milliseconds
-   * 
-   * @param dir directory to lock
-   * @param millis how long to wait for the lock before surrendering
-   * @param sleepFor how long to sleep between attempts
-   * 
-   * @return obtained FileLock or null
-   * @throws IOException if there were problems obtaining the lock
-   */
-  public static FileLockBundle lockDir( String dir, long millis, long sleepFor )
-  throws IOException
-  {
+        if ( ind > 1 )
+        {
+            String protocol = resource.substring( 0, ind );
+            resource = resource.substring( ind + PROTOCOL_DELIM_LEN );
 
-    File df = new File( dir );
+            for ( int i = 0; i < URL_PROTOCOLS.length; i++ )
+            {
+                String p = URL_PROTOCOLS[i];
 
-    boolean exists = df.exists();
+                if ( protocol.regionMatches( true, 0, p, 0, p.length() ) )
+                    return new URL( p + PROTOCOL_DELIM + resource ).openStream();
+            }
+        }
 
-    for( int i=0; i<10 && !exists; i++ )
-    {
-      try{ Thread.sleep( 1l ); } catch( InterruptedException e ){}
-      df.mkdirs();
-      exists = df.exists();
-      LOG.info( LANG.getMessage( "had.to.create.directory", dir, exists + "" ) );
+        return new FileInputStream( new File( resource ) );
     }
 
-    if( !exists )
-      throw new IOException( LANG.getMessage( "cannot.create.directory", dir ) );
+    // ---------------------------------------------------------------------------------------------------------------
+    public static boolean isLocalResource( String resource )
+    {
+        if ( resource == null )
+            return true;
 
-    if( !df.isDirectory() )
-      throw new IOException( LANG.getMessage( "file.is.not.directory", dir, df.exists() + "", df.isDirectory() + "", df.isFile() + "" ) );
+        int ind = resource.indexOf( PROTOCOL_DELIM );
 
-    File lockFile = new File( dir,LOCK_FILE );
+        if ( ind > 1 )
+        {
+            String protocol = resource.substring( 0, ind );
 
-    long start = System.currentTimeMillis();
+            for ( int i = 0; i < LOCAL_PROTOCOLS.length; i++ )
+            {
+                String p = LOCAL_PROTOCOLS[i];
 
-    for( long now = start; ( now - start ) < millis; now = System.currentTimeMillis() )
-      try
-      {
-        synchronized( FileUtil.class )
-        {
-          if( !lockFile.exists() )
-          {
-            writeRawData( lockFile, "lock" );
-            lockFile.deleteOnExit();
-            return new FileLockBundle( dir );
-          }
-        }
-        Thread.sleep( sleepFor );
-
-      }
-      catch( InterruptedException ie )
-      {
-      }
-
-      // too long a wait
-      return null;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /**
-   * try to acquire lock on specified directory for <code>millis<code> milliseconds
-   * 
-   * @param dir directory to lock
-   * @param millis how long to wait for the lock before surrendering
-   * @param sleepFor how long to sleep between attempts
-   * 
-   * @return obtained FileLock or null
-   * @throws IOException if there were problems obtaining the lock
-   */
-  public static FileLockBundle lockDirNio( String dir, long millis, long sleepFor )
-  throws IOException
-  {
-    File df = new File( dir );
-
-    boolean exists = df.exists(); 
-
-    for( int i = 0; i < 10 && !exists; i++ )
-    {
-      try{ Thread.sleep( 1l ); } catch( InterruptedException e ){}
-      df.mkdirs();
-      exists = df.exists();
-      LOG.info( LANG.getMessage( "had.to.create.directory", dir, exists + "" ) );
-    }
-
-    if( !exists )
-      throw new IOException( LANG.getMessage( "cannot.create.directory", dir ) );
-
-    if( !df.isDirectory() )
-      throw new IOException( LANG.getMessage( "file.is.not.directory", dir, df.exists() + "", df.isDirectory() + "", df.isFile() + "" ) );
-
-    File lockFile = new File( dir,LOCK_FILE );
-    if( !lockFile.exists() )
-      writeRawData( lockFile, "lock" );
-    lockFile.deleteOnExit();
-
-    FileChannel ch = new RandomAccessFile( lockFile, "rw" ).getChannel();
-    FileLock lock = null;
-
-    long start = System.currentTimeMillis();
-
-    for(;;)
-      try
-      {
-        lock = ch.tryLock( 0L, 4L, false );
-
-        if( lock == null )
-          throw FILE_LOCKED;
-
-        return new FileLockBundle( dir, ch, lock );
-      }
-      catch( OverlappingFileLockException oe )
-      {
-        try { Thread.sleep( sleepFor ); } catch( InterruptedException e ){}
-        if( System.currentTimeMillis() - start > millis )
-          return null;
-      }
-
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static synchronized void unlockDir( String dir )
-  {
-    try
-    {
-      File df = new File( dir );
-      if( !df.isDirectory() )
-        throw new IOException( LANG.getMessage( "file.is.not.directory", dir ) );
-
-      File lock = new File( dir,LOCK_FILE );
-      if( lock.exists() )
-        lock.delete();
-    }
-    catch( IOException e )
-    {
-      LOG.error( e.getMessage() );
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static final Set<StreamVerifierFactory> vSet( StreamVerifierFactory... facs )
-  {
-    if( facs == null || facs.length < 1 )
-      return null;
-
-    HashSet<StreamVerifierFactory> res = new HashSet<StreamVerifierFactory>( facs.length );
-    for( StreamVerifierFactory f : facs )
-    {
-      res.add( f );
-    }
-
-    return res;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static final Set<StreamObserverFactory> oSet( StreamObserverFactory... facs )
-  {
-    if( facs == null || facs.length < 1 )
-      return null;
-
-    HashSet<StreamObserverFactory> res = new HashSet<StreamObserverFactory>( facs.length );
-    for( StreamObserverFactory f : facs )
-    {
-      res.add( f );
-    }
-
-    return res;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static void renameFile( File dir, String from, String to )
-  {
-    if( dir == null )
-      return;
-
-    File [] files = dir.listFiles();
-
-    if( files == null || files.length < 1 )
-      return;
-
-    for( File f : files )
-    {
-      if( f.isDirectory() )
-        renameFile( f, from, to );
-      else if( from.equals( f.getName() ) )
-      {
-        f.renameTo( new File( f.getParent(), to ) );
-      }
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static int depth( File file )
-  {
-    if( file == null || !file.exists() )
-      throw new IllegalArgumentException( LANG.getMessage( "file.not.exists.error", file == null ? "null" : file.getAbsolutePath() ) );
-
-    if( file.isFile() )
-      return 0;
-
-    File [] files = file.listFiles();
-
-    int max = 0;
-
-    for( File f : files )
-    {
-      if( f.isDirectory() )
-      {
-        int res = depth( f );
-        if( res > max )
-          max = res;
-      }
-    }
-
-    return max + 1;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static InputStream toStream( String resource )
-  throws MalformedURLException, IOException
-  {
-    if( resource == null )
-      return null;
-    
-    int ind = resource.indexOf( PROTOCOL_DELIM );
-    
-    if( ind > 1 )
-    {
-        String protocol = resource.substring( 0, ind );
-        resource = resource.substring( ind + PROTOCOL_DELIM_LEN );
-
-        for( int i=0; i<URL_PROTOCOLS.length; i++ )
-        {
-            String p = URL_PROTOCOLS[i];
-            
-            if( protocol.regionMatches( true, 0, p, 0, p.length() ) )
-              return new URL( p+PROTOCOL_DELIM+resource).openStream();
-        }
-    }
-
-    return new FileInputStream( new File(resource) );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static boolean isLocalResource( String resource )
-  {
-    if( resource == null )
-      return true;
-    
-    int ind = resource.indexOf( PROTOCOL_DELIM );
-    
-    if( ind > 1 )
-    {
-        String protocol = resource.substring( 0, ind );
-
-        for( int i=0; i<LOCAL_PROTOCOLS.length; i++ )
-        {
-            String p = LOCAL_PROTOCOLS[i];
-            
-            if( protocol.regionMatches( true, 0, p, 0, p.length() ) )
-              return true;
-        }
-    }
-    else
-        return true;
-
-    return false;
-  }
-  // -----------------------------------------------------
+                if ( protocol.regionMatches( true, 0, p, 0, p.length() ) )
+                    return true;
+            }
+        }
+        else
+            return true;
+
+        return false;
+    }
+
+    // -----------------------------------------------------
     public static final void unZip( InputStream zipInputStream, File destDir )
         throws FileNotFoundException, IOException
     {
@@ -1042,14 +1142,14 @@
         while ( ( entry = zis.getNextEntry() ) != null )
         {
             String entryName = entry.getName();
-            
+
             File fo = new File( destDir, entryName );
-            
-            if( LOG.isDebugEnabled() )
+
+            if ( LOG.isDebugEnabled() )
                 LOG.debug( "Extracting: " + fo.getCanonicalPath() );
 
             int count;
-            byte data[] = new byte[ DEFAULT_BUFFER_SIZE ];
+            byte data[] = new byte[DEFAULT_BUFFER_SIZE];
 
             // write the files to the disk
             if ( entry.isDirectory() )
@@ -1057,28 +1157,28 @@
                 fo.mkdirs();
                 continue;
             }
-            
+
             fo.getParentFile().mkdirs();
 
             FileOutputStream fos = new FileOutputStream( fo );
-            
+
             dest = new BufferedOutputStream( fos, DEFAULT_BUFFER_SIZE );
-            
+
             while ( ( count = zis.read( data, 0, DEFAULT_BUFFER_SIZE ) ) != -1 )
             {
                 dest.write( data, 0, count );
             }
-            
+
             dest.flush();
-            
+
             dest.close();
         }
-        
+
         zis.close();
 
-        if( LOG.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
             LOG.debug( destDir + " - done." );
     }
-  //---------------------------------------------------------------------------------------------------------------
-  //---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtilException.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtilException.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtilException.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/FileUtilException.java Mon Apr 27 23:12:25 2009
@@ -19,54 +19,47 @@
 package org.apache.maven.mercury.util;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class FileUtilException
     extends Exception
 {
 
-  /**
+    /**
    * 
    */
-  public FileUtilException()
-  {
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param message
-   */
-  public FileUtilException(
-      String message )
-  {
-    super( message );
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param cause
-   */
-  public FileUtilException(
-      Throwable cause )
-  {
-    super( cause );
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param message
-   * @param cause
-   */
-  public FileUtilException(
-      String message,
-      Throwable cause )
-  {
-    super( message, cause );
-    // TODO Auto-generated constructor stub
-  }
+    public FileUtilException()
+    {
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param message
+     */
+    public FileUtilException( String message )
+    {
+        super( message );
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param cause
+     */
+    public FileUtilException( Throwable cause )
+    {
+        super( cause );
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public FileUtilException( String message, Throwable cause )
+    {
+        super( message, cause );
+        // TODO Auto-generated constructor stub
+    }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/TimeUtil.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/TimeUtil.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/TimeUtil.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/TimeUtil.java Mon Apr 27 23:12:25 2009
@@ -18,11 +18,8 @@
  */
 package org.apache.maven.mercury.util;
 
-import java.text.DateFormat;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.TimeZone;
 
 /**
  * @author Oleg Gusakov
@@ -101,7 +98,7 @@
 
         return dts.getTime();
     }
-    
+
     /**
      * conver SNAPSHOT timestampt into millis
      * 
@@ -110,44 +107,46 @@
      * @throws ParseException
      */
     public static long snTstoMillis( String ts )
-    throws ParseException
+        throws ParseException
     {
-        if( ts == null )
+        if ( ts == null )
             return 0;
-        
+
         int dot = ts.indexOf( '.' );
-        
+
         int dash = ts.indexOf( '-' );
-        
+
         int lastInd = dash == -1 ? ts.length() : dash;
-        
-        if( dot == -1 )
+
+        if ( dot == -1 )
             return toMillis( ts );
-        
-        return toMillis( ts.substring( 0, dot )+ts.substring( dot+1, lastInd ) );
+
+        return toMillis( ts.substring( 0, dot ) + ts.substring( dot + 1, lastInd ) );
     }
-    
+
     /**
      * convert current millis to UTC timestamp
+     * 
      * @param local
      * @return
      */
     public static String defaultToSnTs( long local )
     {
-      Date lDate = new Date(local);
+        Date lDate = new Date( local );
 
-      SN_TS_FORMAT.setTimeZone( TS_TZ );
-      return SN_TS_FORMAT.format(lDate);
+        SN_TS_FORMAT.setTimeZone( TS_TZ );
+        return SN_TS_FORMAT.format( lDate );
     }
 
-    public static void main( String[] args ) throws Exception
+    public static void main( String[] args )
+        throws Exception
     {
-        if( args == null || args.length < 0 )
+        if ( args == null || args.length < 0 )
             return;
-        
-        if( "-t".equals( args[0] ) )
+
+        if ( "-t".equals( args[0] ) )
         {
-            System.out.println( args[1]+" => " + new Date( toMillis( args[1] ) ) ) ;
+            System.out.println( args[1] + " => " + new Date( toMillis( args[1] ) ) );
             return;
         }
     }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/Util.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/Util.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/Util.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/util/Util.java Mon Apr 27 23:12:25 2009
@@ -23,84 +23,81 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Configurable;
-
 /**
  * general utility helpers
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class Util
 {
     public static final boolean bWindows = File.pathSeparatorChar == ';';
-    
+
     public static final boolean isWindows()
     {
-      return bWindows;
+        return bWindows;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public static final boolean isEmpty( Collection o )
+    {
+        return o == null || o.isEmpty();
+    }
+
+    public static final boolean isEmpty( String o )
+    {
+        return o == null || o.length() < 1;
+    }
+
+    public static final boolean isEmpty( File o )
+    {
+        return o == null || !o.exists() || o.length() < 1L;
+    }
+
+    public static final boolean isEmpty( Object[] o )
+    {
+        return o == null || o.length < 1;
+    }
+
+    public static final boolean isEmpty( Map o )
+    {
+        return o == null || o.isEmpty();
+    }
+
+    public static final boolean isEmpty( Object o )
+    {
+        return o == null;
+    }
+
+    public static final String nvlS( String s, String dflt )
+    {
+        return isEmpty( s ) ? dflt : s;
+    }
+
+    public static final void say( String msg, Monitor monitor )
+    {
+        if ( monitor != null )
+            monitor.message( msg );
+    }
+
+    public static final String convertLength( long sz )
+    {
+        if ( sz < 5000L )
+            return sz + " bytes";
+
+        return (int) ( Math.round( sz / 1024. ) ) + " kb";
+    }
+
+    public static Map<String, Object> mapOf( Object[][] entries )
+    {
+        if ( entries == null )
+            return null;
+
+        Map<String, Object> map = new HashMap<String, Object>( entries.length );
+
+        for ( Object[] kv : entries )
+            map.put( (String) kv[0], kv[1] );
+
+        return map;
     }
-    
-   @SuppressWarnings("unchecked")
-  public static final boolean isEmpty( Collection o )
-   {
-     return o == null || o.isEmpty();
-   }
-   
-   public static final boolean isEmpty( String o )
-   {
-     return o == null || o.length() < 1;
-   }
-   
-   public static final boolean isEmpty( File o )
-   {
-     return o == null || !o.exists() || o.length() < 1L;
-   }
-
-   public static final boolean isEmpty( Object [] o )
-   {
-     return o == null || o.length < 1;
-   }
-
-   public static final boolean isEmpty( Map o )
-   {
-     return o == null || o.isEmpty();
-   }
-
-   public static final boolean isEmpty( Object o )
-   {
-     return o == null;
-   }
-
-   public static final String nvlS( String s, String dflt )
-   {
-     return isEmpty(s) ? dflt : s;
-   }
-   
-   public static final void say( String msg, Monitor monitor )
-   {
-       if( monitor != null )
-           monitor.message( msg );
-   }
-   
-   public static final String convertLength( long sz )
-   {
-       if( sz < 5000L )
-           return sz+" bytes";
-       
-       return (int)(Math.round( sz / 1024.))+" kb";
-   }
-   
-   public static Map<String,Object> mapOf( Object [][] entries )
-   {
-       if( entries == null )
-           return null;
-       
-       Map<String,Object> map = new HashMap<String, Object>( entries.length );
-       
-       for( Object [] kv : entries )
-           map.put( (String)kv[0], kv[1] );
-       
-       return map;
-   }
 }

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/version/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/version/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/artifact/version/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/crypto/pgp/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/crypto/pgp/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/crypto/pgp/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/event/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/event/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/event/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/sat/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/sat/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/metadata/sat/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/api/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/api/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/api/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/cache/fs/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/cache/fs/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/cache/fs/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/flat/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/flat/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/flat/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/m2/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/m2/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/m2/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties (from r768764, maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Messages.properties)
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties?p2=maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties&p1=maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Messages.properties&r1=768764&r2=769199&rev=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Messages.properties (original)
+++ maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties Mon Apr 27 23:12:25 2009
@@ -33,3 +33,6 @@
 file.is.empty=File {0} exists, but is empty. Data corruption somewhere - please repair metadata.
 
 default.storage.bad.dir=supplied directory {0} is actually a file.
+
+reactor.storage.bad.dir=supplied directory {0} is actually a file.
+key.null.arg=cannot creat a Key out of empty or null string. Check the code ..

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/local/map/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/metadata/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/remote/m2/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/remote/m2/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/remote/m2/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/virtual/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/virtual/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/repository/virtual/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/api/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/api/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/api/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/http/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/http/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/transport/http/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/util/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/util/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/mercury/trunk/mercury-core/src/main/resources/org/apache/maven/mercury/util/Messages.properties
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: maven/mercury/trunk/mercury-core/src/test/java/org/apache/maven/mercury/artifact/ArtifactMetadataTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/test/java/org/apache/maven/mercury/artifact/ArtifactMetadataTest.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/test/java/org/apache/maven/mercury/artifact/ArtifactMetadataTest.java (original)
+++ maven/mercury/trunk/mercury-core/src/test/java/org/apache/maven/mercury/artifact/ArtifactMetadataTest.java Mon Apr 27 23:12:25 2009
@@ -15,28 +15,25 @@
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-*/
+ */
 
 package org.apache.maven.mercury.artifact;
 
 import junit.framework.TestCase;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class ArtifactMetadataTest
     extends TestCase
 {
     public void testTestJar()
     {
-        ArtifactMetadata md = new ArtifactMetadata("a:a:1::test-jar");
-        
+        ArtifactMetadata md = new ArtifactMetadata( "a:a:1::test-jar" );
+
         assertEquals( "tests", md.getClassifier() );
-        
+
         assertEquals( "jar", md.getType() );
     }
 }