Skip to content

Commit

Permalink
Merge pull request #71 from apache/toString
Browse files Browse the repository at this point in the history
remove unreachable catch block
  • Loading branch information
elharo authored Jan 22, 2021
2 parents c6ae143 + 6853e1a commit ec85190
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ else if ( " ".equals( nextTok ) )
}

/**
* @param line The line
* @return The concatenate lines.
* @param line the lines
* @return the concatenated lines, quoted and escaped, separated by spaces
*/
public static String toString( String... line )
{
Expand All @@ -595,22 +595,14 @@ public static String toString( String... line )
return "";
}

// path containing one or more elements
final StringBuilder result = new StringBuilder();
for ( int i = 0; i < line.length; i++ )
{
if ( i > 0 )
{
result.append( ' ' );
}
try
{
result.append( StringUtils.quoteAndEscape( line[i], '\"' ) );
}
catch ( Exception e )
{
System.err.println( "Error quoting argument: " + e.getMessage() );
}
result.append( StringUtils.quoteAndEscape( line[i], '\"' ) );
}
return result.toString();
}
Expand Down

0 comments on commit ec85190

Please sign in to comment.