[Arakhnę-Dev] [334] Since JDK 1.5, the + operator is optimized. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 334
Author: galland
Date: 2012-03-24 13:45:32 +0100 (Sat, 24 Mar 2012)
Log Message:
-----------
Since JDK 1.5, the + operator is optimized. It invokes the StringBuilder class. StringBuilder class is equivalent to StringBuffer, but the first is not thread-safe, the second is thread-safe (synchronized).
Because the class StringBuffer is thread-safe, it is too time consuming. It should be replaced by the StringBuilder class or the + operator (now optimized).
Modified Paths:
--------------
trunk/arakhneLogger/src/main/java/org/arakhne/logging/AbstractPrintStreamLogger.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractReferencedValueMap.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java
trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java
trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/AbstractTestCase.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AbstractOperatingSystemWrapper.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Android.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/MACNumber.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Resources.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/StandardJREResourceWrapper.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/URLHandlerUtil.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/VMCommandLine.java
trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java
trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java
trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/License.java
trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
trunk/pom.xml
trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java
Modified: trunk/arakhneLogger/src/main/java/org/arakhne/logging/AbstractPrintStreamLogger.java
===================================================================
--- trunk/arakhneLogger/src/main/java/org/arakhne/logging/AbstractPrintStreamLogger.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneLogger/src/main/java/org/arakhne/logging/AbstractPrintStreamLogger.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -73,7 +73,7 @@
public void log(Object source, LogLevel level, String msg, Throwable exception) {
if (isLoggableFor(level)) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
if (this.name!=null) {
buffer.append("["); //$NON-NLS-1$
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractReferencedValueMap.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractReferencedValueMap.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/AbstractReferencedValueMap.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -612,7 +612,7 @@
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
VK key = getKey();
buffer.append(key==null ? null : key.toString());
@@ -718,7 +718,7 @@
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
VK key = getKey();
buffer.append(key==null ? null : key.toString());
@@ -824,7 +824,7 @@
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
VK key = getKey();
buffer.append(key==null ? null : key.toString());
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableSoftReference.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -115,7 +115,7 @@
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
T obj = get();
if (obj==null) buffer.append("#null#"); //$NON-NLS-1$
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/ComparableWeakReference.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -115,7 +115,7 @@
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append('{');
T obj = get();
if (obj==null) buffer.append("#null#"); //$NON-NLS-1$
Modified: trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java
===================================================================
--- trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneRefs/src/main/java/org/arakhne/util/ref/WeakArrayList.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -146,7 +146,7 @@
@Override
@SuppressWarnings("unchecked")
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
Reference<T> ref;
T obj;
for(int i=0; i<this.size; i++) {
Modified: trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/AbstractTestCase.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/AbstractTestCase.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/AbstractTestCase.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -96,7 +96,7 @@
* @return the message
*/
protected String formatFailMessage(String message, Object expected, Object actual) {
- StringBuffer formatted = new StringBuffer();
+ StringBuilder formatted = new StringBuilder();
if (message!=null) {
formatted.append(message);
formatted.append(' ');
@@ -118,7 +118,7 @@
* @return the message
*/
protected String formatFailMessage(String message, String msg, Object actual) {
- StringBuffer formatted = new StringBuffer();
+ StringBuilder formatted = new StringBuilder();
if (message!=null) {
formatted.append(message);
formatted.append(' ');
@@ -138,7 +138,7 @@
* @return the message
*/
protected String formatFailNegMessage(String message, Object notexpected) {
- StringBuffer formatted = new StringBuffer();
+ StringBuilder formatted = new StringBuilder();
if (message!=null) {
formatted.append(message);
formatted.append(' ');
@@ -690,7 +690,7 @@
*/
protected String randomString(int maxSize) {
Random rnd = new Random();
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
int count = rnd.nextInt(maxSize<=0 ? 255 : maxSize-1)+1;
for(int i=0; i<count; i++) {
char c = (char)('A' + rnd.nextInt(26));
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AbstractOperatingSystemWrapper.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AbstractOperatingSystemWrapper.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AbstractOperatingSystemWrapper.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -56,7 +56,7 @@
if (p==null) return null;
InputStream standardOutput = null;
try {
- StringBuffer bStr = new StringBuffer();
+ StringBuilder bStr = new StringBuilder();
standardOutput = p.getInputStream();
byte[] buffer = new byte[4086];
int len;
@@ -83,7 +83,7 @@
*/
protected String grep(String selector, String text) {
if (text==null || text.isEmpty()) return null;
- StringBuffer line = new StringBuffer();
+ StringBuilder line = new StringBuilder();
char c;
String s;
for(int i=0; i<text.length(); ++i) {
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Android.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Android.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Android.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -113,10 +113,9 @@
ClassLoader loader = ClassLoaderFinder.findClassLoader();
Throwable ex = null;
try {
- StringBuffer b = new StringBuffer(enclosingClassname);
- b.append("$"); //$NON-NLS-1$
- b.append(innerClassname);
- Class<?> innerClass = Class.forName(b.toString(), true, loader);
+ Class<?> innerClass = Class.forName(
+ enclosingClassname + "$" + innerClassname, //$NON-NLS-1$
+ true, loader);
return innerClass;
}
catch(Throwable e) {
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -66,7 +66,7 @@
String validChars = "[^\\\\/:*?\"<>|]"; //$NON-NLS-1$
String bslashChar = "\\\\"; //$NON-NLS-1$
- StringBuffer pattern = new StringBuffer();
+ StringBuilder pattern = new StringBuilder();
pattern.append("^"); //$NON-NLS-1$
pattern.append("(([a-zA-Z]:"); //$NON-NLS-1$
pattern.append(validChars);
@@ -275,7 +275,7 @@
*/
public static URL toJarURL(URL jarFile, String insideFile) throws MalformedURLException {
if (jarFile==null || insideFile==null) return null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(jarFile.toExternalForm());
buf.append(JAR_URL_FILE_ROOT);
String path = getFilePath(insideFile);
@@ -741,7 +741,7 @@
*/
public static File join(File fileBase, String... elements) {
if (fileBase==null) return null;
- StringBuffer buf = new StringBuffer(fileBase.getPath());
+ StringBuilder buf = new StringBuilder(fileBase.getPath());
boolean empty;
for(String elt : elements) {
empty = (elt==null || elt.length()==0);
@@ -766,7 +766,7 @@
*/
public static File join(File fileBase, File... elements) {
if (fileBase==null) return null;
- StringBuffer buf = new StringBuffer(fileBase.getPath());
+ StringBuilder buf = new StringBuilder(fileBase.getPath());
for(File elt : elements) {
if (!elt.isAbsolute()) {
if (buf.length()>=0 && buf.charAt(buf.length()-1)!=File.separatorChar) {
@@ -786,7 +786,7 @@
*/
public static URL join(URL urlBase, String... elements) {
if (urlBase==null) return null;
- StringBuffer buf = new StringBuffer(urlBase.getPath());
+ StringBuilder buf = new StringBuilder(urlBase.getPath());
boolean empty;
for(String elt : elements) {
empty = (elt==null || elt.length()==0);
@@ -840,7 +840,7 @@
*/
public static URL join(URL urlBase, File... elements) {
if (urlBase==null) return null;
- StringBuffer buf = new StringBuffer(urlBase.getPath());
+ StringBuilder buf = new StringBuilder(urlBase.getPath());
for(File elt : elements) {
if (!elt.isAbsolute()) {
if (buf.length()==0 || buf.charAt(buf.length()-1)!=URL_PATH_SEPARATOR_CHAR) {
@@ -948,7 +948,7 @@
if (filename==null) return null;
String path = filename.getPath();
int idx = path.lastIndexOf(URL_PATH_SEPARATOR);
- StringBuffer buf = new StringBuffer((idx<0) ? "" : decodeHTMLEntities(path.substring(0, idx+1))); //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder((idx<0) ? "" : decodeHTMLEntities(path.substring(0, idx+1))); //$NON-NLS-1$
String largeBasename = decodeHTMLEntities(path.substring(idx+1));
idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
if (idx<0) return filename;
@@ -1004,7 +1004,7 @@
File dir = filename.getParentFile();
String name = filename.getName();
int idx = name.lastIndexOf(getFileExtensionCharacter());
- StringBuffer n = new StringBuffer();
+ StringBuilder n = new StringBuilder();
if (idx<0) {
n.append(name);
}
@@ -1034,7 +1034,7 @@
end --;
idx = path.lastIndexOf(URL_PATH_SEPARATOR, end-1);
}
- StringBuffer buf = new StringBuffer((idx<0) ? "" : decodeHTMLEntities(path.substring(0, idx+1))); //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder((idx<0) ? "" : decodeHTMLEntities(path.substring(0, idx+1))); //$NON-NLS-1$
String largeBasename = decodeHTMLEntities(path.substring(idx+1, end));
idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
if (idx<0) {
@@ -2389,7 +2389,7 @@
path = classpath.next();
sp = path.toExternalForm().replaceAll("/$", ""); //$NON-NLS-1$//$NON-NLS-2$
if (s.startsWith(sp)) {
- StringBuffer buffer = new StringBuffer("resource:"); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder("resource:"); //$NON-NLS-1$
buffer.append(s.substring(sp.length()).replaceAll("^/", "")); //$NON-NLS-1$//$NON-NLS-2$
try {
return new URL(buffer.toString());
@@ -2504,7 +2504,7 @@
}
}
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
if (firstDiff<0) {
firstDiff = Math.min(parts1.length, parts2.length);
}
@@ -2556,7 +2556,7 @@
}
}
- StringBuffer newPathBuffer = new StringBuffer();
+ StringBuilder newPathBuffer = new StringBuilder();
boolean isFirst = true;
for(String component : canonicalPath) {
if (!isFirst) {
@@ -2843,7 +2843,7 @@
else {
n = Math.abs(n);
}
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(prefix);
buffer.append(Long.toString(n));
buffer.append(s);
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -190,7 +190,7 @@
// Find the 64bits version of the DLL
String realLibName;
if (platform!=null) {
- StringBuffer buf = new StringBuffer(libName);
+ StringBuilder buf = new StringBuilder(libName);
buf.append("-"); //$NON-NLS-1$
buf.append(platform);
if (arch!=null) buf.append(arch);
@@ -199,7 +199,7 @@
if (idx>0) realLibName = realLibName.substring(idx);
}
else {
- StringBuffer buf = new StringBuffer(libName);
+ StringBuilder buf = new StringBuilder(libName);
if (arch!=null) buf.append(arch);
realLibName = System.mapLibraryName(buf.toString());
}
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/MACNumber.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/MACNumber.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/MACNumber.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -92,7 +92,7 @@
*/
public static String join(MACNumber... addresses) {
if ((addresses==null)||(addresses.length==0)) return null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (MACNumber number : addresses) {
if (buf.length()>0) buf.append(MACNUMBER_SEPARATOR);
buf.append(number);
@@ -347,7 +347,7 @@
@Override
public String toString() {
int blen = this.bytes.length;
- StringBuffer sb = new StringBuffer(blen*3);
+ StringBuilder sb = new StringBuilder(blen*3);
for (int i = 0; i < blen; i++) {
int lo = this.bytes[i];
int hi = ((lo >> 4) & 0xF);
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Resources.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Resources.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/Resources.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -124,7 +124,7 @@
*/
public static URL getResource(ClassLoader classLoader, Package packagename, String path) {
if (packagename==null || path==null) return null;
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
b.append(packagename.getName().replaceAll(
Pattern.quote("."), //$NON-NLS-1$
Matcher.quoteReplacement(NAME_SEPARATOR)));
@@ -234,7 +234,7 @@
*/
public static InputStream getResourceAsStream(ClassLoader classLoader, Package packagename, String path) {
if (packagename==null || path==null) return null;
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
b.append(packagename.getName().replaceAll(
Pattern.quote("."), //$NON-NLS-1$
Matcher.quoteReplacement(NAME_SEPARATOR)));
@@ -324,7 +324,7 @@
* not found in class paths.
*/
public static URL getPropertyFile(ClassLoader classLoader, Class<?> classname, Locale locale) {
- StringBuffer name = new StringBuffer();
+ StringBuilder name = new StringBuilder();
// Localized file
if (locale!=null) {
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/StandardJREResourceWrapper.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/StandardJREResourceWrapper.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/StandardJREResourceWrapper.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -69,10 +69,7 @@
if (url==null) {
// Try to find in ./resources sub directory
- StringBuffer b = new StringBuffer();
- b.append(RESOURCE_PREFIX);
- b.append(resourcePath);
- url = loader.getResource(b.toString());
+ url = loader.getResource(RESOURCE_PREFIX+resourcePath);
}
return url;
}
@@ -99,10 +96,7 @@
InputStream is = loader.getResourceAsStream(resourcePath);
if (is==null) {
// Try to find in ./resources sub directory
- StringBuffer b = new StringBuffer();
- b.append(RESOURCE_PREFIX);
- b.append(resourcePath);
- is = loader.getResourceAsStream(b.toString());
+ is = loader.getResourceAsStream(RESOURCE_PREFIX+resourcePath);
}
return is;
}
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/URLHandlerUtil.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/URLHandlerUtil.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/URLHandlerUtil.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -51,7 +51,7 @@
}
}
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for(String s : array) {
if (buffer.length()>0)
buffer.append('|');
@@ -74,7 +74,7 @@
array.removeAll(Arrays.asList(packageNames));
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for(String s : array) {
if (buffer.length()>0)
buffer.append('|');
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/VMCommandLine.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/VMCommandLine.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/VMCommandLine.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -149,7 +149,7 @@
* @since 6.2
*/
public static Process launchVMWithClassPath(String classToLaunch, File[] classpath, String... additionalParams) throws IOException {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for(File f : classpath) {
if (b.length()>0) {
b.append(File.pathSeparator);
Modified: trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java
===================================================================
--- trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -1568,7 +1568,7 @@
}
private String readInputStream(InputStream is) throws IOException {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
byte[] buffer = new byte[2048];
int len;
while ((len=is.read(buffer))>0) {
Modified: trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java
===================================================================
--- trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -266,7 +266,7 @@
resource = lic.getFullTextResource();
if (resource != null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(this.name);
sb.append("_"); //$NON-NLS-1$
@@ -298,7 +298,7 @@
info("Installing license notice: ", //$NON-NLS-1$
filename);
- StringBuffer addParts = new StringBuffer();
+ StringBuilder addParts = new StringBuilder();
for (Entry<String, License> licenseMap : includedLicenses.entrySet()) {
lic = licenseMap.getValue();
if (lic != null) {
@@ -308,7 +308,7 @@
}
}
- StringBuffer fullLicenseText = new StringBuffer();
+ StringBuilder fullLicenseText = new StringBuilder();
int n = 0;
for (License l : coreInstalled) {
if (n > 0) {
@@ -339,7 +339,7 @@
info("Installing authors: ", //$NON-NLS-1$
filename);
- StringBuffer authorsText = new StringBuffer();
+ StringBuilder authorsText = new StringBuilder();
if (this.projectURL != null) {
authorsText.append(getLString(InstallLicenseMojo.class, "AUTHOR_INTRO", this.projectURL.toExternalForm())); //$NON-NLS-1$
} else {
Modified: trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/License.java
===================================================================
--- trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/License.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/License.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -124,11 +124,9 @@
this.filename = filename;
}
else {
- StringBuffer b = new StringBuffer();
- b.append(p.getName().replace('.', '/'));
- b.append('/');
- b.append(filename);
- this.filename = b.toString();
+ this.filename = p.getName().replace('.', '/') +
+ "/" + //$NON-NLS-1$
+ filename;
}
this.licenseName = licenseName;
this.isOpenSource = isOpenSource;
Modified: trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
===================================================================
--- trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -349,10 +349,10 @@
* @return the <var>file</var> without the prefix.
*/
public final String removePathPrefix(File prefix, File file) {
- StringBuffer b = new StringBuffer();
- b.append("^"); //$NON-NLS-1$
- b.append(Pattern.quote(prefix.getAbsolutePath()));
- String r = file.getAbsolutePath().replaceFirst(b.toString(), EMPTY_STRING);
+ String r = file.getAbsolutePath().replaceFirst(
+ "^"+ //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
+ EMPTY_STRING);
if (r.startsWith(File.separator))
return r.substring(File.separator.length());
return r;
@@ -725,7 +725,7 @@
* @param message
*/
public final synchronized void info(Object... message) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (Object o : message) {
if (o != null) {
b.append(o.toString());
@@ -741,7 +741,7 @@
* @param message
*/
public final synchronized void info(Throwable error, Object... message) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (Object o : message) {
if (o != null) {
b.append(o.toString());
@@ -757,7 +757,7 @@
* are the messages to log.
*/
public final void debug(Object... messages) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (Object s : messages) {
if (s != null)
buffer.append(s);
@@ -772,7 +772,7 @@
* are the messages to log.
*/
public final void warn(Object... messages) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (Object s : messages) {
if (s != null)
buffer.append(s);
@@ -786,7 +786,7 @@
* @param message
*/
public final synchronized void error(Object... message) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (Object o : message) {
if (o != null) {
b.append(o.toString());
@@ -802,7 +802,7 @@
* @param message
*/
public final synchronized void error(Throwable error, Object... message) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (Object o : message) {
if (o != null) {
b.append(o.toString());
@@ -1116,7 +1116,7 @@
return "D"; //$NON-NLS-1$
if (o instanceof BigInteger)
return "I"; //$NON-NLS-1$
- if (o instanceof String || o instanceof StringBuffer)
+ if (o instanceof CharSequence)
return "s"; //$NON-NLS-1$
if (o instanceof Array) {
Array a = (Array) o;
@@ -1142,14 +1142,13 @@
*/
protected final void assertNotNull(String message, Object o) {
if (getLog().isDebugEnabled()) {
- StringBuffer b = new StringBuffer();
- b.append("\t("); //$NON-NLS-1$
- b.append(getLogType(o));
- b.append(") "); //$NON-NLS-1$
- b.append(message);
- b.append(" = "); //$NON-NLS-1$
- b.append(o);
- getLog().debug(b.toString());
+ getLog().debug(
+ "\t(" //$NON-NLS-1$
+ + getLogType(o)
+ + ") " //$NON-NLS-1$
+ + message
+ + " = " //$NON-NLS-1$
+ + o);
}
if (o == null)
throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$
@@ -1191,7 +1190,7 @@
* @return the jointed values
*/
public static String join(String joint, String... values) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (String value : values) {
if (value != null && !EMPTY_STRING.equals(value)) {
if (b.length() > 0) {
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/pom.xml 2012-03-24 12:45:32 UTC (rev 334)
@@ -25,32 +25,32 @@
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>arakhneVmutils</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>arakhneVmutils-java</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>josuuid-linux32</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>josuuid-linux64</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>josuuid-mingw32</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
<artifactId>josuuid-mingw64</artifactId>
- <version>6.4-SNAPSHOT</version>
+ <version>7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.arakhne.afc</groupId>
Modified: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java 2012-02-13 15:48:13 UTC (rev 333)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java 2012-03-24 12:45:32 UTC (rev 334)
@@ -364,7 +364,7 @@
}
private Pattern buildMacroPattern(String macroName) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
b.append(Pattern.quote("$")); //$NON-NLS-1$
b.append(macroName);
b.append("(?:"); //$NON-NLS-1$
@@ -375,7 +375,7 @@
}
private Pattern buildMacroPatternWithGroup(String macroName) {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
b.append(Pattern.quote("$")); //$NON-NLS-1$
b.append(macroName);
b.append("(?:"); //$NON-NLS-1$
@@ -463,7 +463,7 @@
if (hasResult) {
StringBuffer sb = new StringBuffer();
- StringBuffer replacement = new StringBuffer();
+ StringBuilder replacement = new StringBuilder();
String login;
URL url;
Contributor contributor;
@@ -576,11 +576,9 @@
} else {
String rev = null;
if (replacementRevision != null) {
- StringBuffer b = new StringBuffer();
- b.append("(rev:"); //$NON-NLS-1$
- b.append(replacementRevision);
- b.append(")"); //$NON-NLS-1$
- rev = b.toString();
+ rev = "(rev:" + //$NON-NLS-1$
+ replacementRevision +
+ ")"; //$NON-NLS-1$
}
replacementFullVersion = join(" ", //$NON-NLS-1$
replacementVersion, rev, currentDate);
@@ -597,7 +595,7 @@
nline = replaceMacro(MACRO_FULLVERSION, nline, replacementFullVersion, replacementType, sourceFile, sourceLine);
nline = replaceMacro(MACRO_FILENAME, nline, replacementFilename, replacementType, sourceFile, sourceLine);
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.setLength(0);
buffer.append("$Id: "); //$NON-NLS-1$
buffer.append(file);