You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2012/10/22 21:58:01 UTC
svn commit: r1401057 - in
/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils:
PathTool.java StringUtils.java io/IOUtil.java
Author: krosenvold
Date: Mon Oct 22 19:58:00 2012
New Revision: 1401057
URL: http://svn.apache.org/viewvc?rev=1401057&view=rev
Log:
o Fixed more improper annotations
Modified:
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java?rev=1401057&r1=1401056&r2=1401057&view=diff
==============================================================================
--- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PathTool.java Mon Oct 22 19:58:00 2012
@@ -194,7 +194,7 @@ public class PathTool
* terminated with a forward slash. A zero-length string is
* returned if: the filename is zero-length.
*/
- private static @Nonnull String determineRelativePath( @Nonnull String filename, @Nonnull String separator )
+ private @Nonnull static String determineRelativePath( @Nonnull String filename, @Nonnull String separator )
{
if ( filename.length() == 0 )
{
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java?rev=1401057&r1=1401056&r2=1401057&view=diff
==============================================================================
--- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java Mon Oct 22 19:58:00 2012
@@ -79,7 +79,7 @@ public class StringUtils
* @return the trimmed text (never <code>null</code>)
* @see java.lang.String#trim()
*/
- public static @Nonnull String clean( String str )
+ public @Nonnull static String clean( String str )
{
return ( str == null ? "" : str.trim() );
}
@@ -108,7 +108,7 @@ public class StringUtils
* @return the String without whitespaces
* @throws NullPointerException
*/
- public static @Nonnull String deleteWhitespace( @Nonnull String str )
+ public @Nonnull static String deleteWhitespace( @Nonnull String str )
{
StringBuilder buffer = new StringBuilder();
int sz = str.length();
@@ -510,7 +510,7 @@ public class StringUtils
* @param str the String to parse
* @return an array of parsed Strings
*/
- public static @Nonnull String[] split( @Nonnull String str )
+ public @Nonnull static String[] split( @Nonnull String str )
{
return split( str, null, -1 );
}
@@ -518,7 +518,7 @@ public class StringUtils
/**
* @see #split(String, String, int)
*/
- public static @Nonnull String[] split( @Nonnull String text, String separator )
+ public @Nonnull static String[] split( @Nonnull String text, String separator )
{
return split( text, separator, -1 );
}
@@ -541,7 +541,7 @@ public class StringUtils
* array. A zero or negative value implies no limit.
* @return an array of parsed Strings
*/
- public static @Nonnull String[] split( @Nonnull String str, String separator, int max )
+ public @Nonnull static String[] split( @Nonnull String str, String separator, int max )
{
StringTokenizer tok;
if ( separator == null )
@@ -599,7 +599,7 @@ public class StringUtils
* @param array the array of values to concatenate.
* @return the concatenated string.
*/
- public static @Nonnull String concatenate( @Nonnull Object... array )
+ public @Nonnull static String concatenate( @Nonnull Object... array )
{
return join( array, "" );
}
@@ -615,7 +615,7 @@ public class StringUtils
* @param separator the separator character to use
* @return the joined String
*/
- public static @Nonnull String join( @Nonnull Object[] array, String separator )
+ public @Nonnull static String join( @Nonnull Object[] array, String separator )
{
if ( separator == null )
{
@@ -647,7 +647,7 @@ public class StringUtils
* @param separator the separator character to use
* @return the joined String
*/
- public static @Nonnull String join( @Nonnull Iterator<?> iterator, String separator )
+ public @Nonnull static String join( @Nonnull Iterator<?> iterator, String separator )
{
if ( separator == null )
{
@@ -795,7 +795,7 @@ public class StringUtils
* @throws NullPointerException if text or overlay is <code>null</code>
*/
@SuppressWarnings( "ConstantConditions" )
- public static @Nonnull String overlayString( @Nonnull String text, @Nonnull String overlay, int start, int end )
+ public @Nonnull static String overlayString( @Nonnull String text, @Nonnull String overlay, int start, int end )
{
if ( overlay == null )
{
@@ -818,7 +818,7 @@ public class StringUtils
* @return String containing centered String
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String center( @Nonnull String str, int size )
+ public @Nonnull static String center( @Nonnull String str, int size )
{
return center( str, size, " " );
}
@@ -835,7 +835,7 @@ public class StringUtils
* @throws NullPointerException if str or delim is <code>null</code>
* @throws ArithmeticException if delim is the empty String
*/
- public static @Nonnull String center( @Nonnull String str, int size, @Nonnull String delim )
+ public @Nonnull static String center( @Nonnull String str, int size, @Nonnull String delim )
{
int sz = str.length();
int p = size - sz;
@@ -858,7 +858,7 @@ public class StringUtils
* @return String without chomped newline
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String chomp( @Nonnull String str )
+ public @Nonnull static String chomp( @Nonnull String str )
{
return chomp( str, "\n" );
}
@@ -872,7 +872,7 @@ public class StringUtils
* @return String without chomped ending
* @throws NullPointerException if str or sep is <code>null</code>
*/
- public static @Nonnull String chomp( @Nonnull String str, @Nonnull String sep )
+ public @Nonnull static String chomp( @Nonnull String str, @Nonnull String sep )
{
int idx = str.lastIndexOf( sep );
if ( idx != -1 )
@@ -893,7 +893,7 @@ public class StringUtils
* @return String without chomped ending
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String chompLast( @Nonnull String str )
+ public @Nonnull static String chompLast( @Nonnull String str )
{
return chompLast( str, "\n" );
}
@@ -906,7 +906,7 @@ public class StringUtils
* @return String without chomped ending
* @throws NullPointerException if str or sep is <code>null</code>
*/
- public static @Nonnull String chompLast( @Nonnull String str, @Nonnull String sep )
+ public @Nonnull static String chompLast( @Nonnull String str, @Nonnull String sep )
{
if ( str.length() == 0 )
{
@@ -932,7 +932,7 @@ public class StringUtils
* @return String chomped
* @throws NullPointerException if str or sep is <code>null</code>
*/
- public static @Nonnull String getChomp( @Nonnull String str, @Nonnull String sep )
+ public @Nonnull static String getChomp( @Nonnull String str, @Nonnull String sep )
{
int idx = str.lastIndexOf( sep );
if ( idx == str.length() - sep.length() )
@@ -958,7 +958,7 @@ public class StringUtils
* @return String without chomped beginning
* @throws NullPointerException if str or sep is <code>null</code>
*/
- public static @Nonnull String prechomp( @Nonnull String str, @Nonnull String sep )
+ public @Nonnull static String prechomp( @Nonnull String str, @Nonnull String sep )
{
int idx = str.indexOf( sep );
if ( idx != -1 )
@@ -980,7 +980,7 @@ public class StringUtils
* @return String prechomped
* @throws NullPointerException if str or sep is <code>null</code>
*/
- public static @Nonnull String getPrechomp( @Nonnull String str, String sep )
+ public @Nonnull static String getPrechomp( @Nonnull String str, String sep )
{
int idx = str.indexOf( sep );
if ( idx != -1 )
@@ -1006,7 +1006,7 @@ public class StringUtils
* @return String without last character
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String chop( @Nonnull String str )
+ public @Nonnull static String chop( @Nonnull String str )
{
if ( "".equals( str ) )
{
@@ -1037,7 +1037,7 @@ public class StringUtils
* @return String without newline
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String chopNewline( @Nonnull String str )
+ public @Nonnull static String chopNewline( @Nonnull String str )
{
int lastIdx = str.length() - 1;
char last = str.charAt( lastIdx );
@@ -1070,7 +1070,7 @@ public class StringUtils
* @return String with escaped values
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String escape( @Nonnull String str )
+ public @Nonnull static String escape( @Nonnull String str )
{
// improved with code from cybertiger@cyberiantiger.org
// unicode from him, and defaul for < 32's.
@@ -1167,7 +1167,7 @@ public class StringUtils
* @throws NegativeArraySizeException if <code>repeat < 0</code>
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String repeat( @Nonnull String str, int repeat )
+ public @Nonnull static String repeat( @Nonnull String str, int repeat )
{
StringBuilder buffer = new StringBuilder( repeat * str.length() );
for ( int i = 0; i < repeat; i++ )
@@ -1187,7 +1187,7 @@ public class StringUtils
* @return right padded String
* @throws NullPointerException if str is <code>null</code>
*/
- public static @Nonnull String rightPad( @Nonnull String str, int size )
+ public @Nonnull static String rightPad( @Nonnull String str, int size )
{
return rightPad( str, size, " " );
}
@@ -1204,7 +1204,7 @@ public class StringUtils
* @throws NullPointerException if str or delim is <code>null</code>
* @throws ArithmeticException if delim is the empty String
*/
- public static @Nonnull String rightPad( @Nonnull String str, int size, @Nonnull String delim )
+ public @Nonnull static String rightPad( @Nonnull String str, int size, @Nonnull String delim )
{
size = ( size - str.length() ) / delim.length();
if ( size > 0 )
@@ -1224,7 +1224,7 @@ public class StringUtils
* @return left padded String
* @throws NullPointerException if str or delim is <code>null</code>
*/
- public static @Nonnull String leftPad( @Nonnull String str, int size )
+ public @Nonnull static String leftPad( @Nonnull String str, int size )
{
return leftPad( str, size, " " );
}
@@ -1239,7 +1239,7 @@ public class StringUtils
* @throws NullPointerException if str or delim is null
* @throws ArithmeticException if delim is the empty string
*/
- public static @Nonnull String leftPad( @Nonnull String str, int size, @Nonnull String delim )
+ public @Nonnull static String leftPad( @Nonnull String str, int size, @Nonnull String delim )
{
size = ( size - str.length() ) / delim.length();
if ( size > 0 )
@@ -1865,7 +1865,7 @@ public class StringUtils
* @return the passed in Object's toString, or blank if it was
* <code>null</code>
*/
- public static @Nonnull String defaultString( Object obj )
+ public @Nonnull static String defaultString( Object obj )
{
return defaultString( obj, "" );
}
@@ -1881,7 +1881,7 @@ public class StringUtils
* @return the passed in string, or the default if it was
* <code>null</code>
*/
- public static @Nonnull String defaultString( Object obj, @Nonnull String defaultString )
+ public @Nonnull static String defaultString( Object obj, @Nonnull String defaultString )
{
return ( obj == null ) ? defaultString : obj.toString();
}
@@ -1917,7 +1917,7 @@ public class StringUtils
* @param delimiter the delimiter to use
* @return the reversed String
*/
- public static @Nonnull String reverseDelimitedString( @Nonnull String str, String delimiter )
+ public @Nonnull static String reverseDelimitedString( @Nonnull String str, String delimiter )
{
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
@@ -1964,7 +1964,7 @@ public class StringUtils
*
* @param maxWidth maximum length of result string
*/
- public static @Nonnull String abbreviate( @Nonnull String s, int maxWidth )
+ public @Nonnull static String abbreviate( @Nonnull String s, int maxWidth )
{
return abbreviate( s, 0, maxWidth );
}
@@ -1981,7 +1981,7 @@ public class StringUtils
* @param offset left edge of source string
* @param maxWidth maximum length of result string
*/
- public static @Nonnull String abbreviate( @Nonnull String s, int offset, int maxWidth )
+ public @Nonnull static String abbreviate( @Nonnull String s, int offset, int maxWidth )
{
if ( maxWidth < 4 )
{
@@ -2108,7 +2108,7 @@ public class StringUtils
* @param replaceThis
* @return
*/
- public static @Nonnull String removeAndHump( @Nonnull String data, @Nonnull String replaceThis )
+ public @Nonnull static String removeAndHump( @Nonnull String data, @Nonnull String replaceThis )
{
String temp;
@@ -2141,7 +2141,7 @@ public class StringUtils
* @return data string with the first character transformed to uppercase
* @throws NullPointerException if data is <code>null</code>
*/
- public static @Nonnull String capitalizeFirstLetter( @Nonnull String data )
+ public @Nonnull static String capitalizeFirstLetter( @Nonnull String data )
{
char firstLetter = Character.toTitleCase( data.substring( 0, 1 ).charAt( 0 ) );
@@ -2163,7 +2163,7 @@ public class StringUtils
* @return data string with the first character transformed to lowercase
* @throws NullPointerException if data is <code>null</code>
*/
- public static @Nonnull String lowercaseFirstLetter( @Nonnull String data )
+ public @Nonnull static String lowercaseFirstLetter( @Nonnull String data )
{
char firstLetter = Character.toLowerCase( data.substring( 0, 1 ).charAt( 0 ) );
@@ -2180,7 +2180,7 @@ public class StringUtils
* @param view
* @return deHumped string
*/
- public static @Nonnull String addAndDeHump( @Nonnull String view )
+ public @Nonnull static String addAndDeHump( @Nonnull String view )
{
StringBuilder sb = new StringBuilder();
@@ -2349,7 +2349,7 @@ public class StringUtils
* @return a string with unique whitespace.
* @since 1.5.7
*/
- public static @Nonnull String removeDuplicateWhitespace( @Nonnull String s )
+ public @Nonnull static String removeDuplicateWhitespace( @Nonnull String s )
{
StringBuilder result = new StringBuilder();
int length = s.length();
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java?rev=1401057&r1=1401056&r2=1401057&view=diff
==============================================================================
--- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java Mon Oct 22 19:58:00 2012
@@ -256,7 +256,7 @@ public final class IOUtil
* Get the contents of an <code>InputStream</code> as a String.
* The platform's default encoding is used for the byte-to-char conversion.
*/
- public static @Nonnull String toString( @Nonnull final InputStream input )
+ public @Nonnull static String toString( @Nonnull final InputStream input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -268,7 +268,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull String toString( @Nonnull final InputStream input, final int bufferSize )
+ public @Nonnull static String toString( @Nonnull final InputStream input, final int bufferSize )
throws IOException
{
final StringWriter sw = new StringWriter();
@@ -283,7 +283,7 @@ public final class IOUtil
* <a href="http://www.iana.org/assignments/character-sets">IANA
* Charset Registry</a> for a list of valid encoding types.
*/
- public static @Nonnull String toString( @Nonnull final InputStream input, @Nonnull final String encoding )
+ public @Nonnull static String toString( @Nonnull final InputStream input, @Nonnull final String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
@@ -297,7 +297,7 @@ public final class IOUtil
* Charset Registry</a> for a list of valid encoding types.
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull String toString( @Nonnull final InputStream input, @Nonnull final String encoding, final int bufferSize )
+ public @Nonnull static String toString( @Nonnull final InputStream input, @Nonnull final String encoding, final int bufferSize )
throws IOException
{
final StringWriter sw = new StringWriter();
@@ -311,7 +311,7 @@ public final class IOUtil
/**
* Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final InputStream input )
+ public @Nonnull static byte[] toByteArray( @Nonnull final InputStream input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -322,7 +322,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final InputStream input, final int bufferSize )
+ public @Nonnull static byte[] toByteArray( @Nonnull final InputStream input, final int bufferSize )
throws IOException
{
final ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -370,7 +370,7 @@ public final class IOUtil
/**
* Get the contents of a <code>Reader</code> as a String.
*/
- public static @Nonnull String toString( @Nonnull final Reader input )
+ public @Nonnull static String toString( @Nonnull final Reader input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -381,7 +381,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull String toString( @Nonnull final Reader input, final int bufferSize )
+ public @Nonnull static String toString( @Nonnull final Reader input, final int bufferSize )
throws IOException
{
final StringWriter sw = new StringWriter();
@@ -395,7 +395,7 @@ public final class IOUtil
/**
* Get the contents of a <code>Reader</code> as a <code>byte[]</code>.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final Reader input )
+ public @Nonnull static byte[] toByteArray( @Nonnull final Reader input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -406,7 +406,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final Reader input, final int bufferSize )
+ public @Nonnull static byte[] toByteArray( @Nonnull final Reader input, final int bufferSize )
throws IOException
{
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -488,7 +488,7 @@ public final class IOUtil
/**
* Get the contents of a <code>String</code> as a <code>byte[]</code>.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final String input )
+ public @Nonnull static byte[] toByteArray( @Nonnull final String input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -499,7 +499,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull byte[] toByteArray( @Nonnull final String input, final int bufferSize )
+ public @Nonnull static byte[] toByteArray( @Nonnull final String input, final int bufferSize )
throws IOException
{
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -578,7 +578,7 @@ public final class IOUtil
* Get the contents of a <code>byte[]</code> as a String.
* The platform's default encoding is used for the byte-to-char conversion.
*/
- public static @Nonnull String toString( @Nonnull final byte[] input )
+ public @Nonnull static String toString( @Nonnull final byte[] input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -590,7 +590,7 @@ public final class IOUtil
*
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull String toString( @Nonnull final byte[] input, final int bufferSize )
+ public @Nonnull static String toString( @Nonnull final byte[] input, final int bufferSize )
throws IOException
{
final StringWriter sw = new StringWriter();
@@ -605,7 +605,7 @@ public final class IOUtil
* <a href="http://www.iana.org/assignments/character-sets">IANA
* Charset Registry</a> for a list of valid encoding types.
*/
- public static @Nonnull String toString( @Nonnull final byte[] input, @Nonnull final String encoding )
+ public @Nonnull static String toString( @Nonnull final byte[] input, @Nonnull final String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
@@ -619,7 +619,7 @@ public final class IOUtil
* Charset Registry</a> for a list of valid encoding types.
* @param bufferSize Size of internal buffer to use.
*/
- public static @Nonnull String toString( @Nonnull final byte[] input, @Nonnull final String encoding, final int bufferSize )
+ public @Nonnull static String toString( @Nonnull final byte[] input, @Nonnull final String encoding, final int bufferSize )
throws IOException
{
final StringWriter sw = new StringWriter();