Author: nextgens
Date: 2006-11-16 22:51:32 +0000 (Thu, 16 Nov 2006)
New Revision: 10962

Modified:
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/ChangedAddress.java
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/MappedAddress.java
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/MessageAttribute.java
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/ReflectedFrom.java
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/ResponseAddress.java
   trunk/plugins/JSTUN/de/javawi/jstun/attribute/SourceAddress.java
   trunk/plugins/JSTUN/de/javawi/jstun/test/BindingLifetimeTest.java
   trunk/plugins/JSTUN/de/javawi/jstun/test/DiscoveryInfo.java
   trunk/plugins/JSTUN/de/javawi/jstun/util/Address.java
   trunk/plugins/Librarian/Librarian.java
   trunk/plugins/SNMP/SNMP.java
   trunk/plugins/SNMP/snmplib/BERDecoder.java
   trunk/plugins/SNMP/snmplib/DataStatisticsInfo.java
   trunk/plugins/SNMP/snmplib/InfoSystem.java
   trunk/plugins/SNMP/snmplib/SNMPAgent.java
   trunk/plugins/SNMP/snmplib/SNMPTimeTicks.java
   trunk/plugins/TestGallery/TestGallery.java
Log:
Apply YetAnotherPatch from uniqueperson. I'm quite reluctent to apply such big 
patches... but it's true we should spare our calls to Strings when not 
necessary...

Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/ChangedAddress.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/ChangedAddress.java   
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/ChangedAddress.java   
2006-11-16 22:51:32 UTC (rev 10962)
@@ -32,7 +32,7 @@
        public static MessageAttribute parse(byte[] data) throws 
MessageAttributeParsingException {
                ChangedAddress ca = new ChangedAddress();
                MappedResponseChangedSourceAddressReflectedFrom.parse(ca, data);
-               logger.finer("Message Attribute: Changed Address parsed: " + 
ca.toString() + ".");
+               logger.finer("Message Attribute: Changed Address parsed: " + 
ca.toString() + '.');
                return ca;
        }
 }

Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/MappedAddress.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/MappedAddress.java    
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/MappedAddress.java    
2006-11-16 22:51:32 UTC (rev 10962)
@@ -32,7 +32,7 @@
        public static MessageAttribute parse(byte[] data) throws 
MessageAttributeParsingException {
                MappedAddress ma = new MappedAddress();
                MappedResponseChangedSourceAddressReflectedFrom.parse(ma, data);
-               logger.finer("Message Attribute: Mapped Address parsed: " + 
ma.toString() + ".");
+               logger.finer("Message Attribute: Mapped Address parsed: " + 
ma.toString() + '.');
                return ma;
        }
 }

Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/MessageAttribute.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/MessageAttribute.java 
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/MessageAttribute.java 
2006-11-16 22:51:32 UTC (rev 10962)
@@ -108,7 +108,7 @@
                        case ERRORCODE: ma = ErrorCode.parse(valueArray); break;
                        case UNKNOWNATTRIBUTE: ma = 
UnknownAttribute.parse(valueArray); break;
                        case REFLECTEDFROM: ma = 
ReflectedFrom.parse(valueArray); break;
-                       default: logger.config("MessageAttribute with type " + 
type + " unkown" + "."); ma = Dummy.parse(valueArray); break;
+                       default: logger.config("MessageAttribute with type " + 
type + " unkown" + '.'); ma = Dummy.parse(valueArray); break;
                        }
                        return ma;
                } catch (UtilityException ue) {

Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/ReflectedFrom.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/ReflectedFrom.java    
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/ReflectedFrom.java    
2006-11-16 22:51:32 UTC (rev 10962)
@@ -32,7 +32,7 @@
        public static ReflectedFrom parse(byte[] data) throws 
MessageAttributeParsingException {
                ReflectedFrom result = new ReflectedFrom();
                MappedResponseChangedSourceAddressReflectedFrom.parse(result, 
data);
-               logger.finer("Message Attribute: ReflectedFrom parsed: " + 
result.toString() + ".");
+               logger.finer("Message Attribute: ReflectedFrom parsed: " + 
result.toString() + '.');
                return result;
        }


Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/ResponseAddress.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/ResponseAddress.java  
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/ResponseAddress.java  
2006-11-16 22:51:32 UTC (rev 10962)
@@ -32,7 +32,7 @@
        public static MessageAttribute parse(byte[] data) throws 
MessageAttributeParsingException {
                ResponseAddress ra = new ResponseAddress();
                MappedResponseChangedSourceAddressReflectedFrom.parse(ra, data);
-               logger.finer("Message Attribute: Response Address parsed: " + 
ra.toString() + ".");
+               logger.finer("Message Attribute: Response Address parsed: " + 
ra.toString() + '.');
                return ra;
        }
 }

Modified: trunk/plugins/JSTUN/de/javawi/jstun/attribute/SourceAddress.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/attribute/SourceAddress.java    
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/attribute/SourceAddress.java    
2006-11-16 22:51:32 UTC (rev 10962)
@@ -32,7 +32,7 @@
        public static MessageAttribute parse(byte[] data) throws 
MessageAttributeParsingException {
                SourceAddress sa = new SourceAddress();
                MappedResponseChangedSourceAddressReflectedFrom.parse(sa, data);
-               logger.finer("Message Attribute: Source Address parsed: " + 
sa.toString() + ".");
+               logger.finer("Message Attribute: Source Address parsed: " + 
sa.toString() + '.');
                return sa;
        }
 }
\ No newline at end of file

Modified: trunk/plugins/JSTUN/de/javawi/jstun/test/BindingLifetimeTest.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/test/BindingLifetimeTest.java   
2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/test/BindingLifetimeTest.java   
2006-11-16 22:51:32 UTC (rev 10962)
@@ -64,7 +64,7 @@
                }
                BindingLifetimeTask task = new BindingLifetimeTask();
                timer.schedule(task, binarySearchLifetime);
-               logger.finer("Timer scheduled initially: " + 
binarySearchLifetime + ".");
+               logger.finer("Timer scheduled initially: " + 
binarySearchLifetime + '.');
        }

        private boolean BindingCommunicationInitialSocket() throws 
UtilityException, IOException, MessageHeaderParsingException, 
MessageAttributeParsingException {
@@ -158,25 +158,25 @@
                                }
                                logger.finer("Binding Response received.");
                                if (upperBinarySearchLifetime == 
(lowerBinarySearchLifetime + 1)) {
-                                       logger.config("BindingLifetimeTest 
completed. UDP binding lifetime: " + binarySearchLifetime + ".");
+                                       logger.config("BindingLifetimeTest 
completed. UDP binding lifetime: " + binarySearchLifetime + '.');
                                        completed = true;
                                        return;
                                }
                                lifetime = binarySearchLifetime;
-                               logger.finer("Lifetime update: " + lifetime + 
".");
+                               logger.finer("Lifetime update: " + lifetime + 
'.');
                                lowerBinarySearchLifetime = 
binarySearchLifetime;
                                binarySearchLifetime = ( 
upperBinarySearchLifetime + lowerBinarySearchLifetime ) / 2;
                                if (binarySearchLifetime > 0) {
                                        BindingLifetimeTask task = new 
BindingLifetimeTask();
                                        timer.schedule(task, 
binarySearchLifetime);
-                                       logger.finer("Timer scheduled: " + 
binarySearchLifetime + ".");
+                                       logger.finer("Timer scheduled: " + 
binarySearchLifetime + '.');
                                } else {
                                        completed = true;
                                }
                        } catch (SocketTimeoutException ste) {
                                logger.finest("Read operation at query socket 
timeout.");
                                if (upperBinarySearchLifetime == 
(lowerBinarySearchLifetime + 1)) {
-                                       logger.config("BindingLifetimeTest 
completed. UDP binding lifetime: " + binarySearchLifetime + ".");
+                                       logger.config("BindingLifetimeTest 
completed. UDP binding lifetime: " + binarySearchLifetime + '.');
                                        completed = true;
                                        return;
                                }
@@ -188,7 +188,7 @@
                                        }
                                        BindingLifetimeTask task = new 
BindingLifetimeTask();
                                        timer.schedule(task, 
binarySearchLifetime);
-                                       logger.finer("Timer scheduled: " + 
binarySearchLifetime + ".");
+                                       logger.finer("Timer scheduled: " + 
binarySearchLifetime + '.');
                                } else {
                                        completed = true;
                                }

Modified: trunk/plugins/JSTUN/de/javawi/jstun/test/DiscoveryInfo.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/test/DiscoveryInfo.java 2006-11-16 
22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/test/DiscoveryInfo.java 2006-11-16 
22:51:32 UTC (rev 10962)
@@ -129,12 +129,12 @@
                } catch (SocketException se) {
                        sb.append("unknown");
                }
-               sb.append("\n");
+               sb.append('\n');
                sb.append("Local IP address: ");
                sb.append(testIP.getHostAddress());
-               sb.append("\n");
+               sb.append('\n');
                if (error) {
-                       sb.append(errorReason + " - Responsecode: " + 
errorResponseCode);
+            sb.append(errorReason).append(" - Responsecode: 
").append(errorResponseCode);
                        return sb.toString();
                }
                sb.append("Result: ");
@@ -152,7 +152,7 @@
                } else {
                        sb.append("unknown");
                }
-               sb.append("\n");
+               sb.append('\n');
                return sb.toString();
        }       
 }

Modified: trunk/plugins/JSTUN/de/javawi/jstun/util/Address.java
===================================================================
--- trunk/plugins/JSTUN/de/javawi/jstun/util/Address.java       2006-11-16 
22:49:45 UTC (rev 10961)
+++ trunk/plugins/JSTUN/de/javawi/jstun/util/Address.java       2006-11-16 
22:51:32 UTC (rev 10962)
@@ -70,7 +70,7 @@
        }

        public String toString() {
-               return new String(firstOctet + "." + secondOctet + "." + 
thirdOctet + "." + fourthOctet);
+               return new String(firstOctet + "." + secondOctet + '.' + 
thirdOctet + '.' + fourthOctet);
        }

        public byte[] getBytes() throws UtilityException {

Modified: trunk/plugins/Librarian/Librarian.java
===================================================================
--- trunk/plugins/Librarian/Librarian.java      2006-11-16 22:49:45 UTC (rev 
10961)
+++ trunk/plugins/Librarian/Librarian.java      2006-11-16 22:51:32 UTC (rev 
10962)
@@ -78,10 +78,9 @@

        private void appendDefaultPostFields(StringBuffer out, String search, 
String index) {
                out.append("Search for:<br/>");
-               out.append("<form method=\"GET\"><input type=text 
value=\""+search
-                               +"\" name=\"search\" size=80/><br/><br/>");
+        out.append("<form method=\"GET\"><input type=text 
value=\"").append(search).append("\" name=\"search\" size=80/><br/><br/>");
                out.append("Using the index:<br/>");
-               out.append("<input type=text name=\"index\" value=\"" + index + 
"\" size=80/>");
+        out.append("<input type=text name=\"index\" 
value=\"").append(index).append("\" size=80/>");
                out.append("<input type=submit value=\"Find!\"/></form>\n");
                // index - key to index
                // search - text to search for
@@ -108,7 +107,7 @@
                                if (uriw.descr==null)
                                        uriw.descr = index[i].substring(1);
                                else
-                                       uriw.descr += "\n"+ 
index[i].substring(1);
+                                       uriw.descr += '\n' + 
index[i].substring(1);
                        } else
                                break;

@@ -167,7 +166,7 @@
                        appendDefaultPageStart(out);
                        appendDefaultPostFields(out, search, indexuri);

-                       out.append("Searching for: " + search + "\n");
+            out.append("Searching for: ").append(search).append('\n');

                        //String searchWords[] = search.replaceAll("%20", 
"+").split("+");
                        // Get search result
@@ -207,14 +206,14 @@
                                        showurl = showurl.substring(0,10) + 
"..." + 
                                        showurl.substring(showurl.length()-45);
                                out.append("<table width=\"100%\" 
border=1><tr><td align=center bgcolor=\"#D0D0D0\">\n");
-                               out.append("  <A HREF=\"" + 
(o.URI.startsWith("/")?"":"/") + o.URI + "\" title=\""+o.URI+"\">" + showurl + 
"</A>\n");
+                out.append("  <A HREF=\"").append(o.URI.startsWith("/") ? "" : 
"/").append(o.URI).append("\" 
title=\"").append(o.URI).append("\">").append(showurl).append("</A>\n");
                                out.append("</td></tr><tr><td align=left>\n");
-                               out.append("<pre>" + o.descr + "</pre>\n");
+                out.append("<pre>").append(o.descr).append("</pre>\n");
                                out.append("</td></tr></table>\n");
                                results++;
                        }
                        out.append("</tr><table>\n");
-                       out.append("Found: " + results + " results\n");
+            out.append("Found: ").append(results).append(" results\n");


                        appendDefaultPageEnd(out);

Modified: trunk/plugins/SNMP/SNMP.java
===================================================================
--- trunk/plugins/SNMP/SNMP.java        2006-11-16 22:49:45 UTC (rev 10961)
+++ trunk/plugins/SNMP/SNMP.java        2006-11-16 22:51:32 UTC (rev 10962)
@@ -50,9 +50,9 @@
                        bindto="127.0.0.1";

                        SNMPAgent.setSNMPPort(port);
-                       System.out.println("Starting SNMP server on 
"+bindto+":"+port);
+                       System.out.println("Starting SNMP server on "+bindto+ 
':' +port);
                        SNMPStarter.initialize();
-                       Logger.normal(this,"Starting SNMP server on 
"+bindto+":"+port);
+                       Logger.normal(this,"Starting SNMP server on "+bindto+ 
':' +port);
                        while(goon){
                                try {
                                        Thread.sleep(10000);

Modified: trunk/plugins/SNMP/snmplib/BERDecoder.java
===================================================================
--- trunk/plugins/SNMP/snmplib/BERDecoder.java  2006-11-16 22:49:45 UTC (rev 
10961)
+++ trunk/plugins/SNMP/snmplib/BERDecoder.java  2006-11-16 22:51:32 UTC (rev 
10962)
@@ -20,7 +20,7 @@
                if (buf[ptr] != id)
                        throw new BadFormatException("Unknown Sequence 
(expected: 0x" +
                                        Integer.toHexString(id) + ", got: 0x" +
-                                       Integer.toHexString(buf[ptr]) + ")");
+                                       Integer.toHexString(buf[ptr]) + ')');
                ptr++;
                int len = readBERInt();
                seqStack.push(new Integer(ptr + len));
@@ -32,7 +32,7 @@
                int pos = ((Integer)seqStack.pop()).intValue();
                if (pos != ptr)
                        throw new BadFormatException("Wrong length of field " + 
-                                       length + ":" + pos + ":" + ptr);
+                                       length + ':' + pos + ':' + ptr);
        }

        public boolean sequenceHasMore() {

Modified: trunk/plugins/SNMP/snmplib/DataStatisticsInfo.java
===================================================================
--- trunk/plugins/SNMP/snmplib/DataStatisticsInfo.java  2006-11-16 22:49:45 UTC 
(rev 10961)
+++ trunk/plugins/SNMP/snmplib/DataStatisticsInfo.java  2006-11-16 22:51:32 UTC 
(rev 10962)
@@ -8,7 +8,7 @@
        boolean in;

        public DataStatisticsInfo(int blocks, boolean in) {
-               this.OID = "1.1." + blocks + "." + (in?"1":"0");
+               this.OID = "1.1." + blocks + '.' + (in?"1":"0");
                //System.err.println("adding: " + this.OID);
                this.in = in;
                this.blocks = blocks;

Modified: trunk/plugins/SNMP/snmplib/InfoSystem.java
===================================================================
--- trunk/plugins/SNMP/snmplib/InfoSystem.java  2006-11-16 22:49:45 UTC (rev 
10961)
+++ trunk/plugins/SNMP/snmplib/InfoSystem.java  2006-11-16 22:51:32 UTC (rev 
10962)
@@ -44,7 +44,7 @@


                if (oid.equals(".1.3.6.1.2.1.1.5.0")) //SNMPv2-MIB::sysName.0
-                       return (Version.nodeName + " " + Version.nodeVersion + 
" (" + Version.buildNumber() + ")");
+                       return (Version.nodeName + ' ' + Version.nodeVersion + 
" (" + Version.buildNumber() + ')');


                if (oid.equals(".1.3.6.1.4.1.2021.4.5")) 
//UCD-SNMP-MIB::memTotalReal.0

Modified: trunk/plugins/SNMP/snmplib/SNMPAgent.java
===================================================================
--- trunk/plugins/SNMP/snmplib/SNMPAgent.java   2006-11-16 22:49:45 UTC (rev 
10961)
+++ trunk/plugins/SNMP/snmplib/SNMPAgent.java   2006-11-16 22:51:32 UTC (rev 
10962)
@@ -191,7 +191,7 @@
                for (int i = 0 ; i < packet.getLength() ; i++) {
                        String num = "000" + Integer.toHexString(buf[i]);
                        num = num.substring(num.length()-2);
-                       System.err.print("0x" + num + " ");
+                       System.err.print("0x" + num + ' ');
                        if ((i+1)%8 == 0)
                                System.err.print("  ");
                        if ((i+1)%16 == 0)

Modified: trunk/plugins/SNMP/snmplib/SNMPTimeTicks.java
===================================================================
--- trunk/plugins/SNMP/snmplib/SNMPTimeTicks.java       2006-11-16 22:49:45 UTC 
(rev 10961)
+++ trunk/plugins/SNMP/snmplib/SNMPTimeTicks.java       2006-11-16 22:51:32 UTC 
(rev 10962)
@@ -19,6 +19,6 @@
                long hour = rest%24;
                rest = rest/24;
                long day = rest;
-               return day + ":" + hour + ":" + min + ":" + sec + "." + dec;
+               return day + ":" + hour + ':' + min + ':' + sec + '.' + dec;
        }
 }

Modified: trunk/plugins/TestGallery/TestGallery.java
===================================================================
--- trunk/plugins/TestGallery/TestGallery.java  2006-11-16 22:49:45 UTC (rev 
10961)
+++ trunk/plugins/TestGallery/TestGallery.java  2006-11-16 22:51:32 UTC (rev 
10962)
@@ -98,9 +98,9 @@
                        String[] imgarr = imglist.split("\n");
                        String title = 
(imgarr[0].trim().replaceAll("^freenet:", "").indexOf("@") == 
3)?"Untitled":imgarr[i++];
                        //imgarr[0] == title;
-                       out.append("<HTML><HEAD><TITLE>" + title + 
"</TITLE></HEAD><BODY>\n");
-                       out.append("<CENTER><H1>" + title + "</H1><BR/>Page " + 
page + "<BR/><BR/>\n");
-                       mkPageIndex(out, imgarr.length, page, uri+"?");
+            
out.append("<HTML><HEAD><TITLE>").append(title).append("</TITLE></HEAD><BODY>\n");
+            out.append("<CENTER><H1>").append(title).append("</H1><BR/>Page 
").append(page).append("<BR/><BR/>\n");
+                       mkPageIndex(out, imgarr.length, page, uri+ '?');
                        out.append("<table><tr>\n");
                        int images = 0;
                        int flush = (page - 1)*6*4;
@@ -127,19 +127,19 @@
                                iurl = iurl.replaceAll("^URI: ", "");
                                iurl = iurl.replaceAll("^freenet:", "");
                                if (!iurl.startsWith("/"))
-                                       iurl = "/" + iurl;
+                                       iurl = '/' + iurl;



                                out.append("<td align=\"center\" valign=\"top\" 
width=\"102px\">\n");
-                               out.append("  <a title=\""+iname+"\" href=\"" + 
iurl + "\"><img src=\"" + iurl + "\" border=\"0\" width=\"100\"><br/>\n");
+                out.append("  <a title=\"").append(iname).append("\" 
href=\"").append(iurl).append("\"><img src=\"").append(iurl).append("\" 
border=\"0\" width=\"100\"><br/>\n");
                                if (imginfo.length > 1) {
-                                       out.append("  <font size=\"-2\">\"" + 
isname + "\"</font>\n");
+                    out.append("  <font 
size=\"-2\">\"").append(isname).append("\"</font>\n");
                                }
                                out.append("  </a>\n");

                                for (int j = 2 ; j < imginfo.length ; j++)
-                                       out.append("  <br><font size=\"-2\">" + 
imginfo[j].trim() + "</font>\n");
+                    out.append("  <br><font 
size=\"-2\">").append(imginfo[j].trim()).append("</font>\n");
                                out.append("</td>\n");

                                // new row?
@@ -149,7 +149,7 @@
                        }
                        out.append("</tr><table>\n");

-                       mkPageIndex(out, imgarr.length, page, uri+"?");
+                       mkPageIndex(out, imgarr.length, page, uri+ '?');


                        out.append("</CENTER></BODY></HTML>");
@@ -164,9 +164,9 @@
                for (int pg = 1 ; pg <= (int)Math.ceil((imgarrlength-1)/(6*4)) 
; pg++) {
                        out.append("&nbsp;");
                        if (pg != page)
-                               out.append("<a 
href=\""+uri+"page="+pg+"\">["+pg+"]</a>");
+                out.append("<a 
href=\"").append(uri).append("page=").append(pg).append("\">[").append(pg).append("]</a>");
                        else
-                               out.append("["+pg+"]");
+                out.append('[').append(pg).append(']');
                        out.append("&nbsp;\n");
                }
        }


Reply via email to