Fix ALL the logging!
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 2 May 2012 06:33:33 +0000 (08:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 2 May 2012 08:53:27 +0000 (10:53 +0200)
15 files changed:
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
src/main/java/net/pterodactylus/sone/core/SoneDownloader.java
src/main/java/net/pterodactylus/sone/core/SoneInserter.java
src/main/java/net/pterodactylus/sone/core/UpdateChecker.java
src/main/java/net/pterodactylus/sone/data/Sone.java
src/main/java/net/pterodactylus/sone/freenet/wot/DefaultIdentity.java
src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java
src/main/java/net/pterodactylus/sone/main/SonePlugin.java
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
src/main/java/net/pterodactylus/sone/text/SoneTextParser.java
src/main/java/net/pterodactylus/sone/web/CreateSonePage.java
src/main/java/net/pterodactylus/sone/web/SearchPage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/java/net/pterodactylus/sone/web/page/FreenetTemplatePage.java

index 811950d..26d21ed 100644 (file)
@@ -858,7 +858,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        try {
                                sone = getLocalSone(ownIdentity.getId()).setIdentity(ownIdentity).setInsertUri(new FreenetURI(ownIdentity.getInsertUri())).setRequestUri(new FreenetURI(ownIdentity.getRequestUri()));
                        } catch (MalformedURLException mue1) {
-                               logger.log(Level.SEVERE, "Could not convert the Identity’s URIs to Freenet URIs: " + ownIdentity.getInsertUri() + ", " + ownIdentity.getRequestUri(), mue1);
+                               logger.log(Level.SEVERE, String.format("Could not convert the Identity’s URIs to Freenet URIs: %s, %s", ownIdentity.getInsertUri(), ownIdentity.getRequestUri()), mue1);
                                return null;
                        }
                        sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), (long) 0));
@@ -887,7 +887,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                try {
                        ownIdentity.addContext("Sone");
                } catch (WebOfTrustException wote1) {
-                       logger.log(Level.SEVERE, "Could not add “Sone” context to own identity: " + ownIdentity, wote1);
+                       logger.log(Level.SEVERE, String.format("Could not add “Sone” context to own identity: %s", ownIdentity), wote1);
                        return null;
                }
                Sone sone = addLocalSone(ownIdentity);
@@ -1050,7 +1050,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public Trust getTrust(Sone origin, Sone target) {
                if (!isLocalSone(origin)) {
-                       logger.log(Level.WARNING, "Tried to get trust from remote Sone: %s", origin);
+                       logger.log(Level.WARNING, String.format("Tried to get trust from remote Sone: %s", origin));
                        return null;
                }
                return target.getIdentity().getTrust((OwnIdentity) origin.getIdentity());
@@ -1071,7 +1071,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                try {
                        ((OwnIdentity) origin.getIdentity()).setTrust(target.getIdentity(), trustValue, preferences.getTrustComment());
                } catch (WebOfTrustException wote1) {
-                       logger.log(Level.WARNING, "Could not set trust for Sone: " + target, wote1);
+                       logger.log(Level.WARNING, String.format("Could not set trust for Sone: %s", target), wote1);
                }
        }
 
@@ -1088,7 +1088,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                try {
                        ((OwnIdentity) origin.getIdentity()).removeTrust(target.getIdentity());
                } catch (WebOfTrustException wote1) {
-                       logger.log(Level.WARNING, "Could not remove trust for Sone: " + target, wote1);
+                       logger.log(Level.WARNING, String.format("Could not remove trust for Sone: %s", target), wote1);
                }
        }
 
@@ -1153,7 +1153,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                if (hasSone(sone.getId())) {
                        Sone storedSone = getSone(sone.getId());
                        if (!soneRescueMode && !(sone.getTime() > storedSone.getTime())) {
-                               logger.log(Level.FINE, "Downloaded Sone %s is not newer than stored Sone %s.", new Object[] { sone, storedSone });
+                               logger.log(Level.FINE, String.format("Downloaded Sone %s is not newer than stored Sone %s.", sone, storedSone));
                                return;
                        }
                        synchronized (posts) {
@@ -1266,12 +1266,12 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public void deleteSone(Sone sone) {
                if (!(sone.getIdentity() instanceof OwnIdentity)) {
-                       logger.log(Level.WARNING, "Tried to delete Sone of non-own identity: %s", sone);
+                       logger.log(Level.WARNING, String.format("Tried to delete Sone of non-own identity: %s", sone));
                        return;
                }
                synchronized (localSones) {
                        if (!localSones.containsKey(sone.getId())) {
-                               logger.log(Level.WARNING, "Tried to delete non-local Sone: %s", sone);
+                               logger.log(Level.WARNING, String.format("Tried to delete non-local Sone: %s", sone));
                                return;
                        }
                        localSones.remove(sone.getId());
@@ -1283,7 +1283,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        ((OwnIdentity) sone.getIdentity()).removeContext("Sone");
                        ((OwnIdentity) sone.getIdentity()).removeProperty("Sone.LatestEdition");
                } catch (WebOfTrustException wote1) {
-                       logger.log(Level.WARNING, "Could not remove context and properties from Sone: " + sone, wote1);
+                       logger.log(Level.WARNING, String.format("Could not remove context and properties from Sone: %s", sone), wote1);
                }
                try {
                        configuration.getLongValue("Sone/" + sone.getId() + "/Time").setValue(null);
@@ -1319,7 +1319,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public void loadSone(Sone sone) {
                if (!isLocalSone(sone)) {
-                       logger.log(Level.FINE, "Tried to load non-local Sone: %s", sone);
+                       logger.log(Level.FINE, String.format("Tried to load non-local Sone: %s", sone));
                        return;
                }
 
@@ -1451,7 +1451,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        if (albumParentId != null) {
                                Album parentAlbum = getAlbum(albumParentId, false);
                                if (parentAlbum == null) {
-                                       logger.log(Level.WARNING, "Invalid parent album ID: " + albumParentId);
+                                       logger.log(Level.WARNING, String.format("Invalid parent album ID: %s", albumParentId));
                                        return;
                                }
                                parentAlbum.addAlbum(album);
@@ -1594,7 +1594,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public Post createPost(Sone sone, Sone recipient, long time, String text) {
                if (!isLocalSone(sone)) {
-                       logger.log(Level.FINE, "Tried to create post for non-local Sone: %s", sone);
+                       logger.log(Level.FINE, String.format("Tried to create post for non-local Sone: %s", sone));
                        return null;
                }
                final Post post = new Post(sone, time, text);
@@ -1628,7 +1628,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public void deletePost(Post post) {
                if (!isLocalSone(post.getSone())) {
-                       logger.log(Level.WARNING, "Tried to delete post of non-local Sone: %s", post.getSone());
+                       logger.log(Level.WARNING, String.format("Tried to delete post of non-local Sone: %s", post.getSone()));
                        return;
                }
                post.getSone().removePost(post);
@@ -1734,7 +1734,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public PostReply createReply(Sone sone, Post post, long time, String text) {
                if (!isLocalSone(sone)) {
-                       logger.log(Level.FINE, "Tried to create reply for non-local Sone: %s", sone);
+                       logger.log(Level.FINE, String.format("Tried to create reply for non-local Sone: %s", sone));
                        return null;
                }
                final PostReply reply = new PostReply(sone, post, System.currentTimeMillis(), text);
@@ -1768,7 +1768,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
        public void deleteReply(PostReply reply) {
                Sone sone = reply.getSone();
                if (!isLocalSone(sone)) {
-                       logger.log(Level.FINE, "Tried to delete non-local reply: %s", reply);
+                       logger.log(Level.FINE, String.format("Tried to delete non-local reply: %s", reply));
                        return;
                }
                synchronized (replies) {
@@ -2014,15 +2014,15 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        private synchronized void saveSone(Sone sone) {
                if (!isLocalSone(sone)) {
-                       logger.log(Level.FINE, "Tried to save non-local Sone: %s", sone);
+                       logger.log(Level.FINE, String.format("Tried to save non-local Sone: %s", sone));
                        return;
                }
                if (!(sone.getIdentity() instanceof OwnIdentity)) {
-                       logger.log(Level.WARNING, "Local Sone without OwnIdentity found, refusing to save: %s", sone);
+                       logger.log(Level.WARNING, String.format("Local Sone without OwnIdentity found, refusing to save: %s", sone));
                        return;
                }
 
-               logger.log(Level.INFO, "Saving Sone: %s", sone);
+               logger.log(Level.INFO, String.format("Saving Sone: %s", sone));
                try {
                        /* save Sone into configuration. */
                        String sonePrefix = "Sone/" + sone.getId();
@@ -2137,11 +2137,11 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
 
                        ((OwnIdentity) sone.getIdentity()).setProperty("Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
 
-                       logger.log(Level.INFO, "Sone %s saved.", sone);
+                       logger.log(Level.INFO, String.format("Sone %s saved.", sone));
                } catch (ConfigurationException ce1) {
-                       logger.log(Level.WARNING, "Could not save Sone: " + sone, ce1);
+                       logger.log(Level.WARNING, String.format("Could not save Sone: %s", sone), ce1);
                } catch (WebOfTrustException wote1) {
-                       logger.log(Level.WARNING, "Could not set WoT property for Sone: " + sone, wote1);
+                       logger.log(Level.WARNING, String.format("Could not set WoT property for Sone: %s", sone), wote1);
                }
        }
 
@@ -2378,7 +2378,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                try {
                        options.getIntegerOption(optionName).set(configuration.getIntValue("Option/" + optionName).getValue(null));
                } catch (IllegalArgumentException iae1) {
-                       logger.log(Level.WARNING, "Invalid value for " + optionName + " in configuration, using default.");
+                       logger.log(Level.WARNING, String.format("Invalid value for %s in configuration, using default.", optionName));
                }
        }
 
@@ -2394,7 +2394,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        FreenetURI uri = new FreenetURI(uriString).setDocName("Sone").setMetaString(new String[0]);
                        return uri;
                } catch (MalformedURLException mue1) {
-                       logger.log(Level.WARNING, "Could not create Sone URI from URI: " + uriString, mue1);
+                       logger.log(Level.WARNING, String.format("Could not create Sone URI from URI: %s", uriString, mue1));
                        return null;
                }
        }
@@ -2408,7 +2408,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void ownIdentityAdded(OwnIdentity ownIdentity) {
-               logger.log(Level.FINEST, "Adding OwnIdentity: %s", ownIdentity);
+               logger.log(Level.FINEST, String.format("Adding OwnIdentity: %s", ownIdentity));
                if (ownIdentity.hasContext("Sone")) {
                        trustedIdentities.put(ownIdentity, Collections.synchronizedSet(new HashSet<Identity>()));
                        addLocalSone(ownIdentity);
@@ -2420,7 +2420,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void ownIdentityRemoved(OwnIdentity ownIdentity) {
-               logger.log(Level.FINEST, "Removing OwnIdentity: " + ownIdentity);
+               logger.log(Level.FINEST, String.format("Removing OwnIdentity: %s", ownIdentity));
                trustedIdentities.remove(ownIdentity);
        }
 
@@ -2429,7 +2429,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void identityAdded(OwnIdentity ownIdentity, Identity identity) {
-               logger.log(Level.FINEST, "Adding Identity: %s", identity);
+               logger.log(Level.FINEST, String.format("Adding Identity: %s", identity));
                trustedIdentities.get(ownIdentity).add(identity);
                addRemoteSone(identity);
        }
@@ -2548,7 +2548,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void imageInsertStarted(Image image) {
-               logger.log(Level.WARNING, "Image insert started for " + image);
+               logger.log(Level.WARNING, String.format("Image insert started for %s...", image));
                coreListenerManager.fireImageInsertStarted(image);
        }
 
@@ -2557,7 +2557,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void imageInsertAborted(Image image) {
-               logger.log(Level.WARNING, "Image insert aborted for " + image);
+               logger.log(Level.WARNING, String.format("Image insert aborted for %s.", image));
                coreListenerManager.fireImageInsertAborted(image);
        }
 
@@ -2566,7 +2566,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void imageInsertFinished(Image image, FreenetURI key) {
-               logger.log(Level.WARNING, "Image insert finished for " + image + ": " + key);
+               logger.log(Level.WARNING, String.format("Image insert finished for %s: %s", image, key));
                image.setKey(key.toString());
                deleteTemporaryImage(image.getId());
                saveSone(image.getSone());
@@ -2578,7 +2578,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        @Override
        public void imageInsertFailed(Image image, Throwable cause) {
-               logger.log(Level.WARNING, "Image insert failed for " + image, cause);
+               logger.log(Level.WARNING, String.format("Image insert failed for %s." + image), cause);
                coreListenerManager.fireImageInsertFailed(image, cause);
        }
 
index c63231a..3348e88 100644 (file)
@@ -111,7 +111,7 @@ public class FreenetInterface {
                                        currentUri = fe1.newURI;
                                        continue;
                                }
-                               logger.log(Level.WARNING, "Could not fetch “" + uri + "”!", fe1);
+                               logger.log(Level.WARNING, String.format("Could not fetch “%s”!", uri), fe1);
                                return null;
                        }
                }
@@ -189,13 +189,13 @@ public class FreenetInterface {
         */
        public void registerUsk(final Sone sone, final SoneDownloader soneDownloader) {
                try {
-                       logger.log(Level.FINE, "Registering Sone “%s” for USK updates at %s…", new Object[] { sone, sone.getRequestUri().setMetaString(new String[] { "sone.xml" }) });
+                       logger.log(Level.FINE, String.format("Registering Sone “%s” for USK updates at %s…", sone, sone.getRequestUri().setMetaString(new String[] { "sone.xml" })));
                        USKCallback uskCallback = new USKCallback() {
 
                                @Override
                                @SuppressWarnings("synthetic-access")
                                public void onFoundEdition(long edition, USK key, ObjectContainer objectContainer, ClientContext clientContext, boolean metadata, short codec, byte[] data, boolean newKnownGood, boolean newSlotToo) {
-                                       logger.log(Level.FINE, "Found USK update for Sone “%s” at %s, new known good: %s, new slot too: %s.", new Object[] { sone, key, newKnownGood, newSlotToo });
+                                       logger.log(Level.FINE, String.format("Found USK update for Sone “%s” at %s, new known good: %s, new slot too: %s.", sone, key, newKnownGood, newSlotToo));
                                        if (edition > sone.getLatestEdition()) {
                                                sone.setLatestEdition(edition);
                                                new Thread(new Runnable() {
@@ -221,7 +221,7 @@ public class FreenetInterface {
                        soneUskCallbacks.put(sone.getId(), uskCallback);
                        node.clientCore.uskManager.subscribe(USK.create(sone.getRequestUri()), uskCallback, (System.currentTimeMillis() - sone.getTime()) < 7 * 24 * 60 * 60 * 1000, (HighLevelSimpleClientImpl) client);
                } catch (MalformedURLException mue1) {
-                       logger.log(Level.WARNING, "Could not subscribe USK “" + sone.getRequestUri() + "”!", mue1);
+                       logger.log(Level.WARNING, String.format("Could not subscribe USK “%s”!", sone.getRequestUri()), mue1);
                }
        }
 
@@ -237,10 +237,10 @@ public class FreenetInterface {
                        return;
                }
                try {
-                       logger.log(Level.FINEST, "Unsubscribing from USK for %s…", new Object[] { sone });
+                       logger.log(Level.FINEST, String.format("Unsubscribing from USK for %s…", sone));
                        node.clientCore.uskManager.unsubscribe(USK.create(sone.getRequestUri()), uskCallback);
                } catch (MalformedURLException mue1) {
-                       logger.log(Level.FINE, "Could not unsubscribe USK “" + sone.getRequestUri() + "”!", mue1);
+                       logger.log(Level.FINE, String.format("Could not unsubscribe USK “%s”!", sone.getRequestUri()), mue1);
                }
        }
 
@@ -276,7 +276,7 @@ public class FreenetInterface {
                        node.clientCore.uskManager.subscribe(USK.create(uri), uskCallback, true, (HighLevelSimpleClientImpl) client);
                        uriUskCallbacks.put(uri, uskCallback);
                } catch (MalformedURLException mue1) {
-                       logger.log(Level.WARNING, "Could not subscribe to USK: " + uri, uri);
+                       logger.log(Level.WARNING, String.format("Could not subscribe to USK: %s", uri), mue1);
                }
        }
 
@@ -289,13 +289,13 @@ public class FreenetInterface {
        public void unregisterUsk(FreenetURI uri) {
                USKCallback uskCallback = uriUskCallbacks.remove(uri);
                if (uskCallback == null) {
-                       logger.log(Level.INFO, "Could not unregister unknown USK: " + uri);
+                       logger.log(Level.INFO, String.format("Could not unregister unknown USK: %s", uri));
                        return;
                }
                try {
                        node.clientCore.uskManager.unsubscribe(USK.create(uri), uskCallback);
                } catch (MalformedURLException mue1) {
-                       logger.log(Level.INFO, "Could not unregister invalid USK: " + uri);
+                       logger.log(Level.INFO, String.format("Could not unregister invalid USK: %s", uri), mue1);
                }
        }
 
index 90f926a..98337b9 100644 (file)
@@ -151,7 +151,7 @@ public class SoneDownloader extends AbstractService {
         *         downloaded
         */
        public Sone fetchSone(Sone sone, FreenetURI soneUri, boolean fetchOnly) {
-               logger.log(Level.FINE, "Starting fetch for Sone “%s” from %s…", new Object[] { sone, soneUri });
+               logger.log(Level.FINE, String.format("Starting fetch for Sone “%s” from %s…", sone, soneUri));
                FreenetURI requestUri = soneUri.setMetaString(new String[] { "sone.xml" });
                sone.setStatus(SoneStatus.downloading);
                try {
@@ -160,7 +160,7 @@ public class SoneDownloader extends AbstractService {
                                /* TODO - mark Sone as bad. */
                                return null;
                        }
-                       logger.log(Level.FINEST, "Got %d bytes back.", fetchResults.getRight().size());
+                       logger.log(Level.FINEST, String.format("Got %d bytes back.", fetchResults.getRight().size()));
                        Sone parsedSone = parseSone(sone, fetchResults.getRight(), fetchResults.getLeft());
                        if (parsedSone != null) {
                                if (!fetchOnly) {
@@ -186,7 +186,7 @@ public class SoneDownloader extends AbstractService {
         * @return The parsed Sone, or {@code null} if the Sone could not be parsed
         */
        public Sone parseSone(Sone originalSone, FetchResult fetchResult, FreenetURI requestUri) {
-               logger.log(Level.FINEST, "Parsing FetchResult (%d bytes, %s) for %s…", new Object[] { fetchResult.size(), fetchResult.getMimeType(), originalSone });
+               logger.log(Level.FINEST, String.format("Parsing FetchResult (%d bytes, %s) for %s…", fetchResult.size(), fetchResult.getMimeType(), originalSone));
                Bucket soneBucket = fetchResult.asBucket();
                InputStream soneInputStream = null;
                try {
@@ -202,7 +202,7 @@ public class SoneDownloader extends AbstractService {
                        }
                        return parsedSone;
                } catch (Exception e1) {
-                       logger.log(Level.WARNING, "Could not parse Sone from " + requestUri + "!", e1);
+                       logger.log(Level.WARNING, String.format("Could not parse Sone from %s!", requestUri), e1);
                } finally {
                        Closer.close(soneInputStream);
                        soneBucket.free();
@@ -232,7 +232,7 @@ public class SoneDownloader extends AbstractService {
                }
                if (document == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Could not parse XML for Sone %s!", new Object[] { originalSone });
+                       logger.log(Level.WARNING, String.format("Could not parse XML for Sone %s!", originalSone));
                        return null;
                }
 
@@ -243,7 +243,7 @@ public class SoneDownloader extends AbstractService {
                        soneXml = SimpleXML.fromDocument(document);
                } catch (NullPointerException npe1) {
                        /* for some reason, invalid XML can cause NPEs. */
-                       logger.log(Level.WARNING, "XML for Sone " + sone + " can not be parsed!", npe1);
+                       logger.log(Level.WARNING, String.format("XML for Sone %s can not be parsed!", sone), npe1);
                        return null;
                }
 
@@ -258,27 +258,27 @@ public class SoneDownloader extends AbstractService {
                }
 
                if (protocolVersion < 0) {
-                       logger.log(Level.WARNING, "Invalid protocol version: " + protocolVersion + "! Not parsing Sone.");
+                       logger.log(Level.WARNING, String.format("Invalid protocol version: %d! Not parsing Sone.", protocolVersion));
                        return null;
                }
 
                /* check for valid versions. */
                if (protocolVersion > MAX_PROTOCOL_VERSION) {
-                       logger.log(Level.WARNING, "Unknown protocol version: " + protocolVersion + "! Not parsing Sone.");
+                       logger.log(Level.WARNING, String.format("Unknown protocol version: %d! Not parsing Sone.", protocolVersion));
                        return null;
                }
 
                String soneTime = soneXml.getValue("time", null);
                if (soneTime == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded time for Sone %s was null!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded time for Sone %s was null!", sone));
                        return null;
                }
                try {
                        sone.setTime(Long.parseLong(soneTime));
                } catch (NumberFormatException nfe1) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s with invalid time: %s", new Object[] { sone, soneTime });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s with invalid time: %s", sone, soneTime));
                        return null;
                }
 
@@ -287,7 +287,7 @@ public class SoneDownloader extends AbstractService {
                        String clientName = clientXml.getValue("name", null);
                        String clientVersion = clientXml.getValue("version", null);
                        if ((clientName == null) || (clientVersion == null)) {
-                               logger.log(Level.WARNING, "Download Sone %s with client XML but missing name or version!", sone);
+                               logger.log(Level.WARNING, String.format("Download Sone %s with client XML but missing name or version!", sone));
                                return null;
                        }
                        sone.setClient(new Client(clientName, clientVersion));
@@ -299,7 +299,7 @@ public class SoneDownloader extends AbstractService {
                                sone.setRequestUri(new FreenetURI(soneRequestUri));
                        } catch (MalformedURLException mue1) {
                                /* TODO - mark Sone as bad. */
-                               logger.log(Level.WARNING, "Downloaded Sone " + sone + " has invalid request URI: " + soneRequestUri, mue1);
+                               logger.log(Level.WARNING, String.format("Downloaded Sone %s has invalid request URI: %s", sone, soneRequestUri), mue1);
                                return null;
                        }
                }
@@ -311,7 +311,7 @@ public class SoneDownloader extends AbstractService {
                                sone.setLatestEdition(Math.max(sone.getRequestUri().getEdition(), sone.getInsertUri().getEdition()));
                        } catch (MalformedURLException mue1) {
                                /* TODO - mark Sone as bad. */
-                               logger.log(Level.WARNING, "Downloaded Sone " + sone + " has invalid insert URI: " + soneInsertUri, mue1);
+                               logger.log(Level.WARNING, String.format("Downloaded Sone %s has invalid insert URI: %s", sone, soneInsertUri), mue1);
                                return null;
                        }
                }
@@ -319,7 +319,7 @@ public class SoneDownloader extends AbstractService {
                SimpleXML profileXml = soneXml.getNode("profile");
                if (profileXml == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s has no profile!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s has no profile!", sone));
                        return null;
                }
 
@@ -342,13 +342,13 @@ public class SoneDownloader extends AbstractService {
                                String fieldName = fieldXml.getValue("field-name", null);
                                String fieldValue = fieldXml.getValue("field-value", "");
                                if (fieldName == null) {
-                                       logger.log(Level.WARNING, "Downloaded profile field for Sone %s with missing data! Name: %s, Value: %s", new Object[] { sone, fieldName, fieldValue });
+                                       logger.log(Level.WARNING, String.format("Downloaded profile field for Sone %s with missing data! Name: %s, Value: %s", sone, fieldName, fieldValue));
                                        return null;
                                }
                                try {
                                        profile.addField(fieldName).setValue(fieldValue);
                                } catch (IllegalArgumentException iae1) {
-                                       logger.log(Level.WARNING, "Duplicate field: " + fieldName, iae1);
+                                       logger.log(Level.WARNING, String.format("Duplicate field: %s", fieldName), iae1);
                                        return null;
                                }
                        }
@@ -359,7 +359,7 @@ public class SoneDownloader extends AbstractService {
                Set<Post> posts = new HashSet<Post>();
                if (postsXml == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s has no posts!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s has no posts!", sone));
                } else {
                        for (SimpleXML postXml : postsXml.getNodes("post")) {
                                String postId = postXml.getValue("id", null);
@@ -368,7 +368,7 @@ public class SoneDownloader extends AbstractService {
                                String postText = postXml.getValue("text", null);
                                if ((postId == null) || (postTime == null) || (postText == null)) {
                                        /* TODO - mark Sone as bad. */
-                                       logger.log(Level.WARNING, "Downloaded post for Sone %s with missing data! ID: %s, Time: %s, Text: %s", new Object[] { sone, postId, postTime, postText });
+                                       logger.log(Level.WARNING, String.format("Downloaded post for Sone %s with missing data! ID: %s, Time: %s, Text: %s", sone, postId, postTime, postText));
                                        return null;
                                }
                                try {
@@ -379,7 +379,7 @@ public class SoneDownloader extends AbstractService {
                                        posts.add(post);
                                } catch (NumberFormatException nfe1) {
                                        /* TODO - mark Sone as bad. */
-                                       logger.log(Level.WARNING, "Downloaded post for Sone %s with invalid time: %s", new Object[] { sone, postTime });
+                                       logger.log(Level.WARNING, String.format("Downloaded post for Sone %s with invalid time: %s", sone, postTime));
                                        return null;
                                }
                        }
@@ -390,7 +390,7 @@ public class SoneDownloader extends AbstractService {
                Set<PostReply> replies = new HashSet<PostReply>();
                if (repliesXml == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s has no replies!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s has no replies!", sone));
                } else {
                        for (SimpleXML replyXml : repliesXml.getNodes("reply")) {
                                String replyId = replyXml.getValue("id", null);
@@ -399,14 +399,14 @@ public class SoneDownloader extends AbstractService {
                                String replyText = replyXml.getValue("text", null);
                                if ((replyId == null) || (replyPostId == null) || (replyTime == null) || (replyText == null)) {
                                        /* TODO - mark Sone as bad. */
-                                       logger.log(Level.WARNING, "Downloaded reply for Sone %s with missing data! ID: %s, Post: %s, Time: %s, Text: %s", new Object[] { sone, replyId, replyPostId, replyTime, replyText });
+                                       logger.log(Level.WARNING, String.format("Downloaded reply for Sone %s with missing data! ID: %s, Post: %s, Time: %s, Text: %s", sone, replyId, replyPostId, replyTime, replyText));
                                        return null;
                                }
                                try {
                                        replies.add(core.getReply(replyId).setSone(sone).setPost(core.getPost(replyPostId)).setTime(Long.parseLong(replyTime)).setText(replyText));
                                } catch (NumberFormatException nfe1) {
                                        /* TODO - mark Sone as bad. */
-                                       logger.log(Level.WARNING, "Downloaded reply for Sone %s with invalid time: %s", new Object[] { sone, replyTime });
+                                       logger.log(Level.WARNING, String.format("Downloaded reply for Sone %s with invalid time: %s", sone, replyTime));
                                        return null;
                                }
                        }
@@ -417,7 +417,7 @@ public class SoneDownloader extends AbstractService {
                Set<String> likedPostIds = new HashSet<String>();
                if (likePostIdsXml == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s has no post likes!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s has no post likes!", sone));
                } else {
                        for (SimpleXML likedPostIdXml : likePostIdsXml.getNodes("post-like")) {
                                String postId = likedPostIdXml.getValue();
@@ -430,7 +430,7 @@ public class SoneDownloader extends AbstractService {
                Set<String> likedReplyIds = new HashSet<String>();
                if (likeReplyIdsXml == null) {
                        /* TODO - mark Sone as bad. */
-                       logger.log(Level.WARNING, "Downloaded Sone %s has no reply likes!", new Object[] { sone });
+                       logger.log(Level.WARNING, String.format("Downloaded Sone %s has no reply likes!", sone));
                } else {
                        for (SimpleXML likedReplyIdXml : likeReplyIdsXml.getNodes("reply-like")) {
                                String replyId = likedReplyIdXml.getValue();
@@ -449,14 +449,14 @@ public class SoneDownloader extends AbstractService {
                                String description = albumXml.getValue("description", "");
                                String albumImageId = albumXml.getValue("album-image", null);
                                if ((id == null) || (title == null) || (description == null)) {
-                                       logger.log(Level.WARNING, "Downloaded Sone %s contains invalid album!", new Object[] { sone });
+                                       logger.log(Level.WARNING, String.format("Downloaded Sone %s contains invalid album!", sone));
                                        return null;
                                }
                                Album parent = null;
                                if (parentId != null) {
                                        parent = core.getAlbum(parentId, false);
                                        if (parent == null) {
-                                               logger.log(Level.WARNING, "Downloaded Sone %s has album with invalid parent!", new Object[] { sone });
+                                               logger.log(Level.WARNING, String.format("Downloaded Sone %s has album with invalid parent!", sone));
                                                return null;
                                        }
                                }
@@ -477,14 +477,14 @@ public class SoneDownloader extends AbstractService {
                                                String imageWidthString = imageXml.getValue("width", null);
                                                String imageHeightString = imageXml.getValue("height", null);
                                                if ((imageId == null) || (imageCreationTimeString == null) || (imageKey == null) || (imageTitle == null) || (imageWidthString == null) || (imageHeightString == null)) {
-                                                       logger.log(Level.WARNING, "Downloaded Sone %s contains invalid images!", new Object[] { sone });
+                                                       logger.log(Level.WARNING, String.format("Downloaded Sone %s contains invalid images!", sone));
                                                        return null;
                                                }
                                                long creationTime = Numbers.safeParseLong(imageCreationTimeString, 0L);
                                                int imageWidth = Numbers.safeParseInteger(imageWidthString, 0);
                                                int imageHeight = Numbers.safeParseInteger(imageHeightString, 0);
                                                if ((imageWidth < 1) || (imageHeight < 1)) {
-                                                       logger.log(Level.WARNING, "Downloaded Sone %s contains image %s with invalid dimensions (%s, %s)!", new Object[] { sone, imageId, imageWidthString, imageHeightString });
+                                                       logger.log(Level.WARNING, String.format("Downloaded Sone %s contains image %s with invalid dimensions (%s, %s)!", sone, imageId, imageWidthString, imageHeightString));
                                                        return null;
                                                }
                                                Image image = core.getImage(imageId).setSone(sone).setKey(imageKey).setCreationTime(creationTime);
index ccf8a21..9f45e2e 100644 (file)
@@ -214,11 +214,11 @@ public class SoneInserter extends AbstractService {
                                        if (fingerprint.equals(lastInsertedFingerprint)) {
                                                modified = false;
                                                lastModificationTime = 0;
-                                               logger.log(Level.FINE, "Sone %s has been reverted to last insert state.", sone);
+                                               logger.log(Level.FINE, String.format("Sone %s has been reverted to last insert state.", sone));
                                        } else {
                                                lastModificationTime = System.currentTimeMillis();
                                                modified = true;
-                                               logger.log(Level.FINE, "Sone %s has been modified, waiting %d seconds before inserting.", new Object[] { sone.getName(), insertionDelay });
+                                               logger.log(Level.FINE, String.format("Sone %s has been modified, waiting %d seconds before inserting.", sone.getName(), insertionDelay));
                                        }
                                        lastFingerprint = fingerprint;
                                }
@@ -229,7 +229,7 @@ public class SoneInserter extends AbstractService {
                        }
 
                        if (insertInformation != null) {
-                               logger.log(Level.INFO, "Inserting Sone “%s”…", new Object[] { sone.getName() });
+                               logger.log(Level.INFO, String.format("Inserting Sone “%s”…", sone.getName()));
 
                                boolean success = false;
                                try {
@@ -248,10 +248,10 @@ public class SoneInserter extends AbstractService {
                                        sone.setLatestEdition(finalUri.getEdition());
                                        core.touchConfiguration();
                                        success = true;
-                                       logger.log(Level.INFO, "Inserted Sone “%s” at %s.", new Object[] { sone.getName(), finalUri });
+                                       logger.log(Level.INFO, String.format("Inserted Sone “%s” at %s.", sone.getName(), finalUri));
                                } catch (SoneException se1) {
                                        soneInsertListenerManager.fireInsertAborted(se1);
-                                       logger.log(Level.WARNING, "Could not insert Sone “" + sone.getName() + "”!", se1);
+                                       logger.log(Level.WARNING, String.format("Could not insert Sone “%s”!", sone.getName()), se1);
                                } finally {
                                        sone.setStatus(SoneStatus.idle);
                                }
@@ -263,7 +263,7 @@ public class SoneInserter extends AbstractService {
                                if (success) {
                                        synchronized (sone) {
                                                if (lastInsertedFingerprint.equals(sone.getFingerprint())) {
-                                                       logger.log(Level.FINE, "Sone “%s” was not modified further, resetting counter…", new Object[] { sone });
+                                                       logger.log(Level.FINE, String.format("Sone “%s” was not modified further, resetting counter…", sone));
                                                        lastModificationTime = 0;
                                                        lastInsertFingerprint = lastInsertedFingerprint;
                                                        core.touchConfiguration();
@@ -376,7 +376,7 @@ public class SoneInserter extends AbstractService {
                                templateInputStreamReader = new InputStreamReader(getClass().getResourceAsStream(templateName), utf8Charset);
                                template = TemplateParser.parse(templateInputStreamReader);
                        } catch (TemplateException te1) {
-                               logger.log(Level.SEVERE, "Could not parse template “" + templateName + "”!", te1);
+                               logger.log(Level.SEVERE, String.format("Could not parse template “%s”!", templateName), te1);
                                return null;
                        } finally {
                                Closer.close(templateInputStreamReader);
@@ -394,7 +394,7 @@ public class SoneInserter extends AbstractService {
                                bucket = new StringBucket(writer.toString(), utf8Charset);
                                return new ManifestElement(name, bucket, contentType, bucket.size());
                        } catch (TemplateException te1) {
-                               logger.log(Level.SEVERE, "Could not render template “" + templateName + "”!", te1);
+                               logger.log(Level.SEVERE, String.format("Could not render template “%s”!", templateName), te1);
                                return null;
                        } finally {
                                Closer.close(writer);
index a6f7a21..511f4e1 100644 (file)
@@ -166,11 +166,11 @@ public class UpdateChecker {
                        @Override
                        @SuppressWarnings("synthetic-access")
                        public void editionFound(FreenetURI uri, long edition, boolean newKnownGood, boolean newSlot) {
-                               logger.log(Level.FINEST, "Found update for %s: %d, %s, %s", new Object[] { uri, edition, newKnownGood, newSlot });
+                               logger.log(Level.FINEST, String.format("Found update for %s: %d, %s, %s", uri, edition, newKnownGood, newSlot));
                                if (newKnownGood || newSlot) {
                                        Pair<FreenetURI, FetchResult> uriResult = freenetInterface.fetchUri(uri.setMetaString(new String[] { "sone.properties" }));
                                        if (uriResult == null) {
-                                               logger.log(Level.WARNING, "Could not fetch properties of latest homepage: %s", uri);
+                                               logger.log(Level.WARNING, String.format("Could not fetch properties of latest homepage: %s", uri));
                                                return;
                                        }
                                        Bucket resultBucket = uriResult.getRight().asBucket();
@@ -178,7 +178,7 @@ public class UpdateChecker {
                                                parseProperties(resultBucket.getInputStream(), edition);
                                                latestEdition = edition;
                                        } catch (IOException ioe1) {
-                                               logger.log(Level.WARNING, "Could not parse sone.properties of " + uri, ioe1);
+                                               logger.log(Level.WARNING, String.format("Could not parse sone.properties of %s!", uri), ioe1);
                                        } finally {
                                                resultBucket.free();
                                        }
@@ -240,7 +240,7 @@ public class UpdateChecker {
                if (version.compareTo(currentLatestVersion) > 0) {
                        currentLatestVersion = version;
                        latestVersionDate = releaseTime;
-                       logger.log(Level.INFO, "Found new version: %s (%tc)", new Object[] { version, new Date(releaseTime) });
+                       logger.log(Level.INFO, String.format("Found new version: %s (%tc)", version, new Date(releaseTime)));
                        updateListenerManager.fireUpdateFound(version, releaseTime, edition);
                }
        }
index c2f9ae1..e5ebcf1 100644 (file)
@@ -305,7 +305,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
                        return this;
                }
                if (!this.requestUri.equalsKeypair(requestUri)) {
-                       logger.log(Level.WARNING, "Request URI %s tried to overwrite %s!", new Object[] { requestUri, this.requestUri });
+                       logger.log(Level.WARNING, String.format("Request URI %s tried to overwrite %s!", requestUri, this.requestUri));
                        return this;
                }
                return this;
@@ -333,7 +333,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
                        return this;
                }
                if (!this.insertUri.equalsKeypair(insertUri)) {
-                       logger.log(Level.WARNING, "Request URI %s tried to overwrite %s!", new Object[] { insertUri, this.insertUri });
+                       logger.log(Level.WARNING, String.format("Request URI %s tried to overwrite %s!", insertUri, this.insertUri));
                        return this;
                }
                return this;
@@ -358,7 +358,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
         */
        public void setLatestEdition(long latestEdition) {
                if (!(latestEdition > this.latestEdition)) {
-                       logger.log(Level.FINE, "New latest edition %d is not greater than current latest edition %d!", new Object[] { latestEdition, this.latestEdition });
+                       logger.log(Level.FINE, String.format("New latest edition %d is not greater than current latest edition %d!", latestEdition, this.latestEdition));
                        return;
                }
                this.latestEdition = latestEdition;
@@ -560,7 +560,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
         */
        public void addPost(Post post) {
                if (post.getSone().equals(this) && posts.add(post)) {
-                       logger.log(Level.FINEST, "Adding %s to “%s”.", new Object[] { post, getName() });
+                       logger.log(Level.FINEST, String.format("Adding %s to “%s”.", post, getName()));
                }
        }
 
index 46f81d6..6a16cc5 100644 (file)
@@ -254,7 +254,7 @@ public class DefaultIdentity implements Identity {
                                return trustCache.get(ownIdentity);
                        }
                } catch (CacheException ce1) {
-                       logger.log(Level.WARNING, "Could not get trust for OwnIdentity: " + ownIdentity, ce1);
+                       logger.log(Level.WARNING, String.format("Could not get trust for OwnIdentity: %s", ownIdentity), ce1);
                        return null;
                }
        }
index 019cdb2..5cacb68 100644 (file)
@@ -382,16 +382,16 @@ public class WebOfTrustConnector implements ConnectorListener {
         */
        private synchronized Reply performRequest(SimpleFieldSet fields, Bucket data) throws PluginException {
                reply = new Reply();
-               logger.log(Level.FINE, "Sending FCP Request: " + fields.get("Message"));
+               logger.log(Level.FINE, String.format("Sending FCP Request: %s", fields.get("Message")));
                synchronized (reply) {
                        pluginConnector.sendRequest(WOT_PLUGIN_NAME, PLUGIN_CONNECTION_IDENTIFIER, fields, data);
                        try {
                                reply.wait();
                        } catch (InterruptedException ie1) {
-                               logger.log(Level.WARNING, "Got interrupted while waiting for reply on " + fields.get("Message") + ".", ie1);
+                               logger.log(Level.WARNING, String.format("Got interrupted while waiting for reply on %s.", fields.get("Message")), ie1);
                        }
                }
-               logger.log(Level.FINEST, "Received FCP Response for %s: %s", new Object[] { fields.get("Message"), (reply.getFields() != null) ? reply.getFields().get("Message") : null });
+               logger.log(Level.FINEST, String.format("Received FCP Response for %s: %s", fields.get("Message"), (reply.getFields() != null) ? reply.getFields().get("Message") : null));
                if ((reply.getFields() == null) || "Error".equals(reply.getFields().get("Message"))) {
                        throw new PluginException("Could not perform request for " + fields.get("Message"));
                }
@@ -408,7 +408,7 @@ public class WebOfTrustConnector implements ConnectorListener {
        @Override
        public void receivedReply(PluginConnector pluginConnector, SimpleFieldSet fields, Bucket data) {
                String messageName = fields.get("Message");
-               logger.log(Level.FINEST, "Received Reply from Plugin: " + messageName);
+               logger.log(Level.FINEST, String.format("Received Reply from Plugin: %s", messageName));
                synchronized (reply) {
                        reply.setFields(fields);
                        reply.setData(data);
index ffd5d92..951b54f 100644 (file)
@@ -68,15 +68,15 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr
                                Class<?> loggerClass = Logging.getLoggerClass(logRecord.getLoggerName());
                                int recordLevel = logRecord.getLevel().intValue();
                                if (recordLevel < Level.FINE.intValue()) {
-                                       freenet.support.Logger.debug(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
+                                       freenet.support.Logger.debug(loggerClass, logRecord.getMessage(), logRecord.getThrown());
                                } else if (recordLevel < Level.INFO.intValue()) {
-                                       freenet.support.Logger.minor(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
+                                       freenet.support.Logger.minor(loggerClass, logRecord.getMessage(), logRecord.getThrown());
                                } else if (recordLevel < Level.WARNING.intValue()) {
-                                       freenet.support.Logger.normal(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
+                                       freenet.support.Logger.normal(loggerClass, logRecord.getMessage(), logRecord.getThrown());
                                } else if (recordLevel < Level.SEVERE.intValue()) {
-                                       freenet.support.Logger.warning(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
+                                       freenet.support.Logger.warning(loggerClass, logRecord.getMessage(), logRecord.getThrown());
                                } else {
-                                       freenet.support.Logger.error(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
+                                       freenet.support.Logger.error(loggerClass, logRecord.getMessage(), logRecord.getThrown());
                                }
                        }
                });
index c134fc0..f6d3d2d 100644 (file)
@@ -107,7 +107,7 @@ public class SoneAccessor extends ReflectionAccessor {
                                return null;
                        }
                        Trust trust = core.getTrust(currentSone, sone);
-                       logger.log(Level.FINEST, "Trust for %s by %s: %s", new Object[] { sone, currentSone, trust });
+                       logger.log(Level.FINEST, String.format("Trust for %s by %s: %s", sone, currentSone, trust));
                        if (trust == null) {
                                return new Trust(null, null, null);
                        }
index 5c12831..3362132 100644 (file)
@@ -237,8 +237,8 @@ public class SoneTextParser implements Parser<SoneTextParserContext> {
                                int nextSpace = matcher.find(0) ? matcher.start() : line.length();
                                String link = line.substring(0, nextSpace);
                                String name = link;
-                               logger.log(Level.FINER, "Found link: %s", link);
-                               logger.log(Level.FINEST, "CHK: %d, SSK: %d, USK: %d", new Object[] { nextChk, nextSsk, nextUsk });
+                               logger.log(Level.FINER, String.format("Found link: %s", link));
+                               logger.log(Level.FINEST, String.format("CHK: %d, SSK: %d, USK: %d", nextChk, nextSsk, nextUsk));
 
                                if ((linkType == LinkType.KSK) || (linkType == LinkType.CHK) || (linkType == LinkType.SSK) || (linkType == LinkType.USK)) {
                                        FreenetURI uri;
index 9878358..fc9f0d1 100644 (file)
@@ -115,7 +115,7 @@ public class CreateSonePage extends SoneTemplatePage {
                        /* create Sone. */
                        Sone sone = webInterface.getCore().createSone(selectedIdentity);
                        if (sone == null) {
-                               logger.log(Level.SEVERE, "Could not create Sone for OwnIdentity: %s", selectedIdentity);
+                               logger.log(Level.SEVERE, String.format("Could not create Sone for OwnIdentity: %s", selectedIdentity));
                                /* TODO - go somewhere else */
                        }
 
index 6e10b24..54b6f49 100644 (file)
@@ -230,7 +230,7 @@ public class SearchPage extends SoneTemplatePage {
         * @return The score of the expression
         */
        private double calculateScore(List<Phrase> phrases, String expression) {
-               logger.log(Level.FINEST, "Calculating Score for “%s”…", expression);
+               logger.log(Level.FINEST, String.format("Calculating Score for “%s”…", expression));
                double optionalHits = 0;
                double requiredHits = 0;
                int forbiddenHits = 0;
@@ -250,10 +250,10 @@ public class SearchPage extends SoneTemplatePage {
                                }
                                score += Math.pow(1 - position / (double) expression.length(), 2);
                                index = position + phraseString.length();
-                               logger.log(Level.FINEST, "Got hit at position %d.", position);
+                               logger.log(Level.FINEST, String.format("Got hit at position %d.", position));
                                ++matches;
                        }
-                       logger.log(Level.FINEST, "Score: %f", score);
+                       logger.log(Level.FINEST, String.format("Score: %f", score));
                        if (matches == 0) {
                                continue;
                        }
index b1c61bb..f8b9c5a 100644 (file)
@@ -749,7 +749,7 @@ public class WebInterface implements CoreListener {
                                }
                        }
                } catch (IOException ioe1) {
-                       logger.log(Level.WARNING, "Could not parse post text: " + text, ioe1);
+                       logger.log(Level.WARNING, String.format("Could not parse post text: %s", text), ioe1);
                }
                return Filters.filteredSet(mentionedSones, Sone.LOCAL_SONE_FILTER);
        }
@@ -1043,7 +1043,7 @@ public class WebInterface implements CoreListener {
                        try {
                                return templateCache.get(templateName);
                        } catch (CacheException ce1) {
-                               logger.log(Level.WARNING, "Could not get template for " + templateName + "!", ce1);
+                               logger.log(Level.WARNING, String.format("Could not get template for %s!", templateName), ce1);
                                return null;
                        }
                }
@@ -1066,7 +1066,7 @@ public class WebInterface implements CoreListener {
                        try {
                                template = TemplateParser.parse(templateReader);
                        } catch (TemplateException te1) {
-                               logger.log(Level.WARNING, "Could not parse template “" + templateName + "” for inclusion!", te1);
+                               logger.log(Level.WARNING, String.format("Could not parse template “%s” for inclusion!", templateName), te1);
                        }
                        return template;
                }
index e7d6e28..cd15cbf 100644 (file)
@@ -155,7 +155,7 @@ public class FreenetTemplatePage implements FreenetPage, LinkEnabledCallback {
                        long start = System.nanoTime();
                        processTemplate(request, templateContext);
                        long finish = System.nanoTime();
-                       logger.log(Level.FINEST, "Template was rendered in " + ((finish - start) / 1000) / 1000.0 + "ms.");
+                       logger.log(Level.FINEST, "Template was rendered in %dms.", ((finish - start) / 1000) / 1000.0);
                } catch (RedirectException re1) {
                        return new RedirectResponse(re1.getTarget());
                }