From cd0f9ad6a73739a69386f9ad5f76a053d17c8a51 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sat, 11 Jun 2011 17:55:03 +0000 Subject: [PATCH] prefer StringBuilder to StringBuffer git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134712 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/web/action/reports/GenerateReportAction.java | 6 +++--- .../maven/archiva/web/mapper/RepositoryActionMapper.java | 2 +- .../java/org/apache/maven/archiva/web/startup/Banner.java | 6 +++--- .../archiva/web/startup/SecuritySynchronization.java | 2 +- .../maven/archiva/web/tags/CopyPasteSnippetTag.java | 8 ++++---- .../org/apache/maven/archiva/web/tags/GroupIdLink.java | 2 +- .../org/apache/maven/archiva/web/util/ContextUtils.java | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java index 7c4f8cd8e..bb6f30599 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java @@ -307,7 +307,7 @@ public class GenerateReportAction selectedRepositories = parseSelectedRepositories(); List repositoryStatistics = new ArrayList(); - StringBuffer input; + StringBuilder input; RepositorySession repositorySession = repositorySessionFactory.createSession(); try { @@ -331,7 +331,7 @@ public class GenerateReportAction return INPUT; } - input = new StringBuffer( + input = new StringBuilder( "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes," + "Jars,Wars\n" ); @@ -404,7 +404,7 @@ public class GenerateReportAction return ERROR; } - input = new StringBuffer( + input = new StringBuilder( "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins," + "Archetypes,Jars,Wars\n" ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java index 9bc28f28a..64f9225d4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java @@ -189,7 +189,7 @@ public class RepositoryActionMapper private String toUri( Map params, boolean artifactId, boolean version, String method ) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append( BROWSE_PREFIX ); buf.append( '/' ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java index 87bd73a06..8e1c20e6c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java @@ -39,7 +39,7 @@ public class Banner // Canonicalize line ends to make them easier to process raw = raw.replace("\r\n", "\n").replace("\r", "\n"); - StringBuffer encoded = new StringBuffer(); + StringBuilder encoded = new StringBuilder(); int rawlen = raw.length(); for ( int i = 0; i < rawlen; i++ ) @@ -109,7 +109,7 @@ public class Banner public static String decode( String encoded ) { - StringBuffer decoded = new StringBuffer(); + StringBuilder decoded = new StringBuilder(); int enlen = encoded.length(); for ( int i = 0; i < enlen; i++ ) { @@ -192,7 +192,7 @@ public class Banner { Pattern pat = Pattern.compile( "#{2,}" ); Matcher mat = pat.matcher( text ); - StringBuffer ret = new StringBuffer(); + StringBuilder ret = new StringBuilder(); int off = 0; while ( mat.find( off ) ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java index df510e80e..957b526d4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java @@ -205,7 +205,7 @@ public class SecuritySynchronization if ( CollectionUtils.isNotEmpty( violations ) ) { - StringBuffer msg = new StringBuffer(); + StringBuilder msg = new StringBuilder(); msg.append( "EnvironmentCheck Failure.\n" ); msg.append( "======================================================================\n" ); msg.append( " ENVIRONMENT FAILURE !! \n" ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java index 3e92f1448..96eb6bbf5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java @@ -61,9 +61,9 @@ public class CopyPasteSnippetTag public int doEndTag() throws JspException { - StringBuffer prefix = new StringBuffer(); - StringBuffer buf = new StringBuffer(); - StringBuffer suffix = new StringBuffer(); + StringBuilder prefix = new StringBuilder(); + StringBuilder buf = new StringBuilder(); + StringBuilder suffix = new StringBuilder(); if ( object == null ) { @@ -122,7 +122,7 @@ public class CopyPasteSnippetTag this.wrapper = wrapper; } - private void createSnippet( StringBuffer snippet, ManagedRepositoryConfiguration repo, PageContext pageContext ) + private void createSnippet( StringBuilder snippet, ManagedRepositoryConfiguration repo, PageContext pageContext ) { snippet.append( "\n" ); snippet.append( " ...\n" ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java index 866431381..05638a2d9 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java @@ -66,7 +66,7 @@ public class GroupIdLink @Override public boolean end( Writer writer, String body ) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append( "" ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java index f1b689cea..319d0a088 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java @@ -76,7 +76,7 @@ public class ContextUtils */ public static String getBaseURL( HttpServletRequest request, String resource ) { - StringBuffer baseUrl = new StringBuffer(); + StringBuilder baseUrl = new StringBuilder(); baseUrl.append( request.getScheme() ).append( "://" ); baseUrl.append( getServerName( request ) ); -- 2.39.5