-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDEP-651] Warn on duplicate archive entries (#128)
- Loading branch information
1 parent
36bf6bc
commit efd980d
Showing
3 changed files
with
275 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
src/test/java/org/codehaus/plexus/archiver/CapturingLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package org.codehaus.plexus.archiver; | ||
|
||
import org.codehaus.plexus.logging.AbstractLogger; | ||
import org.codehaus.plexus.logging.Logger; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class CapturingLog extends AbstractLogger | ||
{ | ||
public CapturingLog( int threshold, String name ) | ||
{ | ||
super( threshold, name ); | ||
} | ||
|
||
static class Message { | ||
public final String message; | ||
public final Throwable throwable; | ||
|
||
public Message( String message, Throwable throwable ) | ||
{ | ||
this.message = message; | ||
this.throwable = throwable; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "Message{" + "message='" + message + '\'' + ", throwable=" + throwable + '}'; | ||
} | ||
} | ||
|
||
private final List<Message> debugs = new ArrayList<>(); | ||
@Override | ||
public void debug( String s, Throwable throwable ) | ||
{ | ||
debugs.add( new Message( s, throwable ) ); | ||
} | ||
|
||
public List<Message> getDebugs() | ||
{ | ||
return debugs; | ||
} | ||
|
||
|
||
private final List<Message> infos = new ArrayList<>(); | ||
@Override | ||
public void info( String s, Throwable throwable ) | ||
{ | ||
infos.add( new Message( s, throwable ) ); | ||
} | ||
|
||
public List<Message> getInfos() | ||
{ | ||
return infos; | ||
} | ||
|
||
private final List<Message> warns = new ArrayList<>(); | ||
@Override | ||
public void warn( String s, Throwable throwable ) | ||
{ | ||
warns.add( new Message( s, throwable ) ); | ||
} | ||
|
||
public List<Message> getWarns() | ||
{ | ||
return warns; | ||
} | ||
|
||
private final List<Message> errors = new ArrayList<>(); | ||
@Override | ||
public void error( String s, Throwable throwable ) | ||
{ | ||
errors.add( new Message( s, throwable ) ); | ||
} | ||
|
||
public List<Message> getErors() | ||
{ | ||
return errors; | ||
} | ||
|
||
private final List<Message> fatals = new ArrayList<>(); | ||
@Override | ||
public void fatalError( String s, Throwable throwable ) | ||
{ | ||
fatals.add( new Message( s, throwable ) ); | ||
} | ||
|
||
public List<Message> getFatals() | ||
{ | ||
return fatals; | ||
} | ||
|
||
@Override | ||
public Logger getChildLogger( String s ) | ||
{ | ||
return null; | ||
} | ||
} |