You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bo...@apache.org on 2014/03/02 17:48:20 UTC
git commit: Fixed TAP5-2294 (Wrong line endings in app startup
messages on Windows)
Repository: tapestry-5
Updated Branches:
refs/heads/master b385e77f8 -> c4c5c354f
Fixed TAP5-2294 (Wrong line endings in app startup messages on Windows)
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/c4c5c354
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/c4c5c354
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/c4c5c354
Branch: refs/heads/master
Commit: c4c5c354f254ba70f76ca21ca98b891c8038b5d3
Parents: b385e77
Author: Bob Harner <bo...@apache.org>
Authored: Sun Mar 2 11:48:08 2014 -0500
Committer: Bob Harner <bo...@apache.org>
Committed: Sun Mar 2 11:48:08 2014 -0500
----------------------------------------------------------------------
.../tapestry5/internal/TapestryAppInitializer.java | 15 ++++++++++++---
.../services/ComponentClassResolverImpl.java | 15 ++++++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4c5c354/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
index 74a63af..cfd02de 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
@@ -1,4 +1,4 @@
-// Copyright 2006-2013 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -201,8 +201,16 @@ public class TapestryAppInitializer
return registry;
}
+ /**
+ * Announce application startup, by logging (at INFO level) the names of all pages,
+ * components, mixins and services.
+ */
public void announceStartup()
{
+ if (!logger.isInfoEnabled()) // if info logging is off we can stop now
+ {
+ return;
+ }
long toFinish = System.currentTimeMillis();
SymbolSource source = registry.getService("SymbolSource", SymbolSource.class);
@@ -258,9 +266,10 @@ public class TapestryAppInitializer
buffer.append("/_ __/__ ____ ___ ___ / /_______ __ / __/\n");
buffer.append(" / / / _ `/ _ \\/ -_|_-</ __/ __/ // / /__ \\ \n");
buffer.append("/_/ \\_,_/ .__/\\__/___/\\__/_/ \\_, / /____/\n");
- f.format(" /_/ /___/ %s%s\n\n",
+ f.format (" /_/ /___/ %s%s\n\n",
version, productionMode ? "" : " (development mode)");
- logger.info(buffer.toString());
+ // log multi-line string with OS-specific line endings (TAP5-2294)
+ logger.info(buffer.toString().replaceAll("\\n", System.getProperty("line.separator")));
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4c5c354/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
index e8ff689..cad9404 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
@@ -1,4 +1,4 @@
-// Copyright 2006-2012 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -336,10 +336,18 @@ public class ComponentClassResolverImpl implements ComponentClassResolver, Inval
return CollectionFactory.newSet(map.values()).size();
}
+ /**
+ * Log (at INFO level) the changes between the two logical-name-to-class-name maps
+ * @param title the title of the things in the maps (e.g. "pages" or "components")
+ * @param savedMap the old map
+ * @param newMap the new map
+ */
private void showChanges(String title, Map<String, String> savedMap, Map<String, String> newMap)
{
- if (savedMap.equals(newMap))
+ if (savedMap.equals(newMap) || !logger.isInfoEnabled()) // nothing to log?
+ {
return;
+ }
Map<String, String> core = CollectionFactory.newMap();
Map<String, String> nonCore = CollectionFactory.newMap();
@@ -403,7 +411,8 @@ public class ComponentClassResolverImpl implements ComponentClassResolver, Inval
f.format(formatString, name, className);
}
- logger.info(builder.toString());
+ // log multi-line string with OS-specific line endings (TAP5-2294)
+ logger.info(builder.toString().replaceAll("\\n", System.getProperty("line.separator")));
}