Skip to content
Permalink
Browse files

APPNG-2235 use @slf4j and parameter placeholders (#52)

APPNG-2235 use Slf4j and parameter placeholders
  • Loading branch information...
madness-inc committed Jan 29, 2019
1 parent 3cca98c commit b8b6050ea1203f047261f0d34f074ed5890bb810
Showing with 1,387 additions and 1,337 deletions.
  1. +8 −7 appng-api/src/main/java/org/appng/api/RequestUtil.java
  2. +4 −4 appng-api/src/main/java/org/appng/api/XPathProcessor.java
  3. +4 −4 appng-api/src/main/java/org/appng/api/auth/AuthTools.java
  4. +4 −5 appng-api/src/main/java/org/appng/api/messaging/Messaging.java
  5. +3 −3 appng-api/src/main/java/org/appng/api/messaging/Serializer.java
  6. +7 −8 appng-api/src/main/java/org/appng/api/model/SimpleProperty.java
  7. +20 −21 appng-api/src/main/java/org/appng/api/support/ApplicationConfigProviderImpl.java
  8. +4 −6 appng-api/src/main/java/org/appng/api/support/ApplicationResourceHolder.java
  9. +30 −29 appng-api/src/main/java/org/appng/api/support/CallableAction.java
  10. +13 −13 appng-api/src/main/java/org/appng/api/support/CallableDataSource.java
  11. +14 −14 appng-api/src/main/java/org/appng/api/support/ConfigValidator.java
  12. +20 −21 appng-api/src/main/java/org/appng/api/support/DatasourceInheritanceHelper.java
  13. +19 −21 appng-api/src/main/java/org/appng/api/support/DefaultPermissionProcessor.java
  14. +5 −6 appng-api/src/main/java/org/appng/api/support/DummyPermissionProcessor.java
  15. +3 −4 appng-api/src/main/java/org/appng/api/support/ElementHelper.java
  16. +12 −13 appng-api/src/main/java/org/appng/api/support/HttpHeaderUtils.java
  17. +4 −4 appng-api/src/main/java/org/appng/api/support/RequestFactoryBean.java
  18. +13 −12 appng-api/src/main/java/org/appng/api/support/RequestSupportImpl.java
  19. +3 −3 appng-api/src/main/java/org/appng/api/support/SiteClassLoader.java
  20. +16 −16 appng-api/src/main/java/org/appng/api/support/environment/DefaultEnvironment.java
  21. +4 −4 appng-api/src/main/java/org/appng/api/support/field/CoordinateFieldConverter.java
  22. +4 −3 appng-api/src/main/java/org/appng/api/support/field/DateFieldConverter.java
  23. +4 −3 appng-api/src/main/java/org/appng/api/support/field/DecimalFieldConverter.java
  24. +4 −4 appng-api/src/main/java/org/appng/api/support/field/DefaultFieldConverter.java
  25. +7 −7 appng-api/src/main/java/org/appng/api/support/field/FieldConversionFactory.java
  26. +4 −4 appng-api/src/main/java/org/appng/api/support/field/FileFieldConverter.java
  27. +4 −3 appng-api/src/main/java/org/appng/api/support/field/IntegerFieldConverter.java
  28. +4 −3 appng-api/src/main/java/org/appng/api/support/field/LinkPanelFieldHandler.java
  29. +6 −6 appng-api/src/main/java/org/appng/api/support/field/ListFieldConverter.java
  30. +6 −6 appng-api/src/main/java/org/appng/api/support/field/ObjectFieldConverter.java
  31. +12 −12 appng-api/src/main/java/org/appng/api/support/validation/DefaultValidationProvider.java
  32. +7 −7 appng-api/src/main/java/org/appng/api/support/validation/LocalizedMessageInterpolator.java
  33. +3 −3 appng-appngizer/src/main/java/org/appng/appngizer/controller/AppNGizer.java
  34. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/ApplicationController.java
  35. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/DatabaseController.java
  36. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/GroupController.java
  37. +3 −3 appng-appngizer/src/main/java/org/appng/appngizer/controller/Home.java
  38. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/PermissionController.java
  39. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/PlatformController.java
  40. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/PlatformPropertyController.java
  41. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/RepositoryController.java
  42. +2 −2 appng-appngizer/src/main/java/org/appng/appngizer/controller/RoleController.java
  43. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/SessionFilter.java
  44. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/SiteApplicationController.java
  45. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/SiteApplicationPropertyController.java
  46. +3 −3 appng-appngizer/src/main/java/org/appng/appngizer/controller/SiteController.java
  47. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/SitePropertyController.java
  48. +1 −1 appng-appngizer/src/main/java/org/appng/appngizer/controller/SubjectController.java
  49. +7 −7 appng-cli/src/main/java/org/appng/cli/CliBootstrap.java
  50. +5 −5 appng-cli/src/main/java/org/appng/cli/CliCore.java
  51. +3 −3 appng-cli/src/main/java/org/appng/cli/commands/FileOwner.java
  52. +7 −8 appng-cli/src/main/java/org/appng/cli/commands/heartbeat/HeartBeat.java
  53. +6 −6 appng-cli/src/main/java/org/appng/cli/servlet/InstallListener.java
  54. +4 −6 appng-core/src/main/java/org/appng/core/JMXUtils.java
  55. +5 −6 appng-core/src/main/java/org/appng/core/Redirect.java
  56. +2 −2 appng-core/src/main/java/org/appng/core/controller/AppngCache.java
  57. +11 −12 appng-core/src/main/java/org/appng/core/controller/Controller.java
  58. +21 −31 appng-core/src/main/java/org/appng/core/controller/PlatformStartup.java
  59. +12 −13 appng-core/src/main/java/org/appng/core/controller/RepositoryWatcher.java
  60. +3 −3 appng-core/src/main/java/org/appng/core/controller/SessionListener.java
  61. +8 −8 appng-core/src/main/java/org/appng/core/controller/filter/CsrfSetupFilter.java
  62. +11 −11 appng-core/src/main/java/org/appng/core/controller/filter/JspExtensionFilter.java
  63. +4 −5 appng-core/src/main/java/org/appng/core/controller/filter/MSOfficeUserAgentFilter.java
  64. +8 −9 appng-core/src/main/java/org/appng/core/controller/filter/PageCacheFilter.java
  65. +6 −7 appng-core/src/main/java/org/appng/core/controller/filter/RedirectFilter.java
  66. +5 −5 appng-core/src/main/java/org/appng/core/controller/filter/XSSFilter.java
  67. +5 −5 appng-core/src/main/java/org/appng/core/controller/handler/ErrorPageHandler.java
  68. +7 −8 appng-core/src/main/java/org/appng/core/controller/handler/GuiHandler.java
  69. +6 −7 appng-core/src/main/java/org/appng/core/controller/handler/JspHandler.java
  70. +3 −3 appng-core/src/main/java/org/appng/core/controller/handler/RestService.java
  71. +4 −4 appng-core/src/main/java/org/appng/core/controller/handler/ServiceRequestHandler.java
  72. +3 −4 appng-core/src/main/java/org/appng/core/controller/handler/SoapService.java
  73. +4 −5 appng-core/src/main/java/org/appng/core/controller/handler/StaticContentHandler.java
  74. +3 −4 appng-core/src/main/java/org/appng/core/controller/messaging/JedisReceiver.java
  75. +3 −6 appng-core/src/main/java/org/appng/core/controller/messaging/JedisSender.java
  76. +4 −5 appng-core/src/main/java/org/appng/core/controller/messaging/MulticastReceiver.java
  77. +5 −5 appng-core/src/main/java/org/appng/core/controller/messaging/MulticastSender.java
  78. +4 −3 appng-core/src/main/java/org/appng/core/controller/messaging/RabbitMQReceiver.java
  79. +4 −3 appng-core/src/main/java/org/appng/core/controller/messaging/RabbitMQSender.java
  80. +4 −4 appng-core/src/main/java/org/appng/core/controller/messaging/TribesReceiver.java
  81. +4 −4 appng-core/src/main/java/org/appng/core/controller/messaging/TribesSender.java
  82. +23 −23 appng-core/src/main/java/org/appng/core/controller/rest/RestActionBase.java
  83. +8 −8 appng-core/src/main/java/org/appng/core/controller/rest/RestDataSourceBase.java
  84. +5 −6 appng-core/src/main/java/org/appng/core/controller/rest/RestOperation.java
  85. +4 −4 appng-core/src/main/java/org/appng/core/domain/ApplicationImpl.java
  86. +3 −4 appng-core/src/main/java/org/appng/core/domain/DatabaseConnection.java
  87. +4 −4 appng-core/src/main/java/org/appng/core/domain/PackageArchiveImpl.java
  88. +5 −5 appng-core/src/main/java/org/appng/core/domain/PlatformEventListener.java
  89. +7 −7 appng-core/src/main/java/org/appng/core/domain/SiteImpl.java
  90. +4 −5 appng-core/src/main/java/org/appng/core/model/ApplicationContext.java
  91. +22 −23 appng-core/src/main/java/org/appng/core/model/ApplicationProvider.java
  92. +5 −5 appng-core/src/main/java/org/appng/core/model/CacheProvider.java
  93. +3 −5 appng-core/src/main/java/org/appng/core/model/JarInfo.java
  94. +6 −7 appng-core/src/main/java/org/appng/core/model/NavigationBuilder.java
  95. +9 −10 appng-core/src/main/java/org/appng/core/model/PageParameterProcessor.java
  96. +6 −5 appng-core/src/main/java/org/appng/core/model/PlatformProcessor.java
  97. +8 −8 appng-core/src/main/java/org/appng/core/model/PlatformTransformer.java
  98. +3 −3 appng-core/src/main/java/org/appng/core/model/RepositoryCacheFactory.java
  99. +8 −8 appng-core/src/main/java/org/appng/core/model/RepositoryCacheFilesystem.java
  100. +4 −5 appng-core/src/main/java/org/appng/core/model/RepositoryCacheSoap.java
  101. +99 −0 appng-core/src/main/java/org/appng/core/model/TemplateProcessor.java
  102. +7 −6 appng-core/src/main/java/org/appng/core/model/ThymeleafProcessor.java
  103. +1 −0 appng-core/src/main/java/org/appng/core/repository/.gitignore
  104. +3 −3 appng-core/src/main/java/org/appng/core/repository/config/ApplicationPostProcessor.java
  105. +4 −4 appng-core/src/main/java/org/appng/core/repository/config/DataSourceFactory.java
  106. +2 −3 appng-core/src/main/java/org/appng/core/repository/config/HikariCPConfigurer.java
  107. +5 −5 appng-core/src/main/java/org/appng/core/repository/config/TomcatJdbcConfigurer.java
  108. +9 −9 appng-core/src/main/java/org/appng/core/security/DigestValidator.java
  109. +5 −5 appng-core/src/main/java/org/appng/core/security/SaltedDigestSha1.java
  110. +3 −3 appng-core/src/main/java/org/appng/core/security/signing/CertChainValidator.java
  111. +9 −13 appng-core/src/main/java/org/appng/core/security/signing/Signer.java
  112. +5 −5 appng-core/src/main/java/org/appng/core/service/ApplicationArchiveProcessor.java
  113. +10 −11 appng-core/src/main/java/org/appng/core/service/CacheService.java
  114. +76 −76 appng-core/src/main/java/org/appng/core/service/CoreService.java
  115. +23 −20 appng-core/src/main/java/org/appng/core/service/DatabaseService.java
  116. +3 −4 appng-core/src/main/java/org/appng/core/service/HsqlStarter.java
  117. +14 −16 appng-core/src/main/java/org/appng/core/service/InitializerService.java
  118. +14 −14 appng-core/src/main/java/org/appng/core/service/LdapService.java
  119. +11 −12 appng-core/src/main/java/org/appng/core/service/MigrationService.java
  120. +7 −7 appng-core/src/main/java/org/appng/core/service/PropertySupport.java
  121. +13 −14 appng-core/src/main/java/org/appng/core/service/TemplateService.java
  122. +4 −4 appng-core/src/main/java/org/appng/core/templating/ReplaceTagProcessor.java
  123. +14 −0 appng-core/src/main/resources/org/appng/core/controller/logo.txt
  124. +3 −4 appng-core/src/test/java/org/appng/api/messaging/TestReceiver.java
  125. +4 −4 appng-core/src/test/java/org/appng/core/controller/ControllerTest.java
  126. +8 −10 appng-forms/src/main/java/org/appng/el/ExpressionEvaluator.java
  127. +7 −8 appng-forms/src/main/java/org/appng/forms/XSSUtil.java
  128. +5 −6 appng-forms/src/main/java/org/appng/forms/impl/FormUploadBean.java
  129. +20 −20 appng-forms/src/main/java/org/appng/forms/impl/RequestBean.java
  130. +4 −5 appng-formtags/src/main/java/org/appng/formtags/Form.java
  131. +8 −8 appng-formtags/src/main/java/org/appng/formtags/providers/EmailProvider.java
  132. +5 −5 appng-mail/src/main/java/org/appng/mail/impl/DefaultTransport.java
  133. +8 −8 appng-rest-api/src/main/java/org/appng/api/rest/RestClient.java
  134. +21 −22 appng-search/src/main/java/org/appng/search/indexer/DocumentIndexer.java
  135. +12 −12 appng-search/src/main/java/org/appng/search/indexer/FileSystemProvider.java
  136. +12 −15 appng-search/src/main/java/org/appng/search/indexer/GlobalIndexer.java
  137. +16 −13 appng-search/src/main/java/org/appng/search/indexer/IndexConfig.java
  138. +6 −6 appng-search/src/main/java/org/appng/search/indexer/ParseTags.java
  139. +5 −5 appng-search/src/main/java/org/appng/search/indexer/SimpleDocument.java
  140. +4 −4 appng-search/src/main/java/org/appng/search/searcher/GermanSearchTermProcessor.java
  141. +3 −3 appng-search/src/main/java/org/appng/search/searcher/StandardSearcher.java
  142. +8 −8 appng-taglib/src/main/java/org/appng/taglib/ApplicationAdapter.java
  143. +4 −4 appng-taglib/src/main/java/org/appng/taglib/Attribute.java
  144. +5 −5 appng-taglib/src/main/java/org/appng/taglib/If.java
  145. +4 −3 appng-taglib/src/main/java/org/appng/taglib/MultiSiteSupport.java
  146. +5 −5 appng-taglib/src/main/java/org/appng/taglib/Parameter.java
  147. +6 −6 appng-taglib/src/main/java/org/appng/taglib/Permission.java
  148. +6 −6 appng-taglib/src/main/java/org/appng/taglib/TagletAdapter.java
  149. +24 −22 appng-taglib/src/main/java/org/appng/taglib/TagletProcessor.java
  150. +0 −3 appng-taglib/src/main/java/org/appng/taglib/form/Form.java
  151. +4 −4 appng-taglib/src/main/java/org/appng/taglib/form/FormData.java
  152. +3 −4 appng-taglib/src/main/java/org/appng/taglib/form/FormElement.java
  153. +13 −13 appng-taglib/src/main/java/org/appng/taglib/search/Search.java
  154. +5 −5 appng-taglib/src/main/java/org/appng/taglib/search/SearchPart.java
  155. +3 −4 appng-taglib/src/main/java/org/appng/taglib/search/Searchable.java
  156. +41 −40 appng-testsupport/src/main/java/org/appng/testsupport/persistence/DatabaseUtil.java
  157. +8 −9 appng-testsupport/src/main/java/org/appng/testsupport/persistence/HsqlServer.java
  158. +6 −7 appng-testsupport/src/main/java/org/appng/testsupport/persistence/HsqlServerFactoryBean.java
  159. +4 −5 appng-testsupport/src/main/java/org/appng/testsupport/validation/WritingJsonValidator.java
  160. +4 −5 appng-testsupport/src/main/java/org/appng/testsupport/validation/WritingXmlValidator.java
  161. +5 −6 appng-tools/src/main/java/org/appng/tools/file/MagicByteCheck.java
  162. +6 −7 appng-tools/src/main/java/org/appng/tools/image/Captcha.java
  163. +5 −6 appng-tools/src/main/java/org/appng/tools/image/ImageProcessor.java
  164. +15 −19 appng-tools/src/main/java/org/appng/tools/locator/GMapGeoLocator.java
  165. +5 −7 appng-tools/src/main/java/org/appng/tools/markup/XML.java
  166. +3 −4 appng-tools/src/main/java/org/appng/tools/os/Command.java
  167. +3 −5 appng-tools/src/main/java/org/appng/tools/zipcode/ZipCodeValidatorFactory.java
  168. +1 −1 appng-upngizr/src/main/java/org/appng/upngizr/controller/UpNGizr.java
  169. +28 −28 appng-upngizr/src/main/java/org/appng/upngizr/controller/Updater.java
  170. +5 −6 appng-xmlapi/src/main/java/org/appng/xml/ApplicationPropertyConstantCreator.java
  171. +11 −12 appng-xmlapi/src/main/java/org/appng/xml/MarshallService.java
  172. +14 −16 appng-xmlapi/src/main/java/org/appng/xml/transformation/StyleSheetProvider.java
  173. +8 −9 appng-xmlapi/src/main/java/org/appng/xml/transformation/Transformer.java
  174. +1 −0 lombok.config
  175. +9 −0 pom.xml
@@ -24,8 +24,8 @@

import org.appng.api.model.Properties;
import org.appng.api.model.Site;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
*
@@ -35,9 +35,9 @@
* @author Matthias Müller
*
*/
@Slf4j
public class RequestUtil {

private static Logger logger = LoggerFactory.getLogger(RequestUtil.class);
private static final String SERVER_LOCAL_NAME = "SERVER_LOCAL_NAME";

/**
@@ -138,7 +138,7 @@ public static PathInfo getPathInfo(Environment env, Site site, String servletPat
Properties platformProperties = env.getAttribute(Scope.PLATFORM, Platform.Environment.PLATFORM_CONFIG);
Properties activeSiteProperties = site.getProperties();

logger.trace("found site '" + site.getName() + "' for request '" + servletPath + "'");
LOGGER.trace("found site '{}' for request '{}'", site.getName(), servletPath);

String repoPath = platformProperties.getString(Platform.Property.REPOSITORY_PATH);
String extension = platformProperties.getString(Platform.Property.JSP_FILE_TYPE);
@@ -168,7 +168,8 @@ public static PathInfo getPathInfo(Environment env, Site site, String servletPat
* the {@link ServletRequest}
* @param env
* an {@link Environment}
* @return <ul>
* @return
* <ul>
* <li>the IP-address, if {@link VHostMode#IP_BASED} is used (see {@link ServletRequest#getLocalAddr()})
* <li>the value of the request-header {@code SERVER_LOCAL_NAME}, if present. This header has to be added by
* the webserver of choice (usually <a href="http://httpd.apache.org/">Apache httpd</a>), in case a
@@ -181,7 +182,7 @@ public static String getHostIdentifier(ServletRequest request, Environment env)
Properties platformProperties = env.getAttribute(Scope.PLATFORM, Platform.Environment.PLATFORM_CONFIG);
VHostMode vHostMode = VHostMode.valueOf(platformProperties.getString(Platform.Property.VHOST_MODE));
String hostIdentifier;
logger.trace("hostmode: " + vHostMode);
LOGGER.trace("hostmode: {}", vHostMode);
if (vHostMode.equals(VHostMode.IP_BASED)) {
hostIdentifier = request.getLocalAddr();
} else {
@@ -193,7 +194,7 @@ public static String getHostIdentifier(ServletRequest request, Environment env)
hostIdentifier = request.getServerName().toLowerCase();
}
}
logger.trace("hostIdentifier: " + hostIdentifier);
LOGGER.trace("hostIdentifier: {}", hostIdentifier);
return hostIdentifier;
}

@@ -40,8 +40,6 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
@@ -51,6 +49,8 @@
import org.w3c.dom.Text;
import org.xml.sax.SAXException;

import lombok.extern.slf4j.Slf4j;

/**
*
* An {@code XPathProcessor} is used the create a {@link Document} from an {@link URL} or {@link InputStream} and then
@@ -60,9 +60,9 @@
* @author Matthias Müller
*
*/
@Slf4j
public class XPathProcessor {

private static final Logger LOG = LoggerFactory.getLogger(XPathProcessor.class);
private final Document document;
private final XPath xpath;
private Transformer transformer;
@@ -185,7 +185,7 @@ public void getXml(Node node, OutputStream outputStream) {
try {
transformer.transform(new DOMSource(node), new StreamResult(outputStream));
} catch (TransformerException e) {
LOG.error("error during transformation", e);
LOGGER.error("error during transformation", e);
}
}

@@ -24,17 +24,17 @@

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
* This class is used to get different types of digests.
*
* @author Matthias Herlitzius
*/
@Slf4j
public final class AuthTools {

private static final Logger log = LoggerFactory.getLogger(AuthTools.class);
private static final String STRING_FORMAT = "%1$032X";
private static final String SHA1PRNG = "SHA1PRNG";

@@ -85,7 +85,7 @@ public static String getRandomSalt(int length) {
salt = new byte[length];
random.nextBytes(salt);
} catch (NoSuchAlgorithmException e) {
log.error("error while generting random string.", e);
LOGGER.error("error while generting random string.", e);
}
return salt;
}
@@ -25,8 +25,8 @@
import org.appng.api.Platform;
import org.appng.api.Scope;
import org.appng.api.model.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
* A utility class offering static helper methods to create and retrieve a {@link Sender} and to shutdown
@@ -37,10 +37,9 @@
* @see Sender
* @see Receiver
*/
@Slf4j
public class Messaging {

private static final Logger LOGGER = LoggerFactory.getLogger(Messaging.class);

/**
* Name of a system property used to identify the node
*/
@@ -97,7 +96,7 @@ public static String getNodeId(Environment env) {
nodeId);
System.setProperty(APPNG_NODE_ID, nodeId);
} catch (UnknownHostException e) {
LOGGER.warn("error setting system property " + APPNG_NODE_ID, e);
LOGGER.warn(String.format("error setting system property %s", APPNG_NODE_ID), e);
}
}
return nodeId;
@@ -29,8 +29,8 @@
import org.appng.api.model.Site;
import org.appng.api.support.SiteAwareObjectInputStream;
import org.appng.api.support.SiteClassLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
* Utility class helping to serialize/deserialize {@link Event}s to an {@link OutputStream}/ from an {@link InputStream}
@@ -41,9 +41,9 @@
*
* @see Event
*/
@Slf4j
public class Serializer {

private static final Logger LOGGER = LoggerFactory.getLogger(Serializer.class);
private Environment environment;
private String nodeId;

@@ -22,19 +22,18 @@

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
* Default {@link Property}-implementation
*
* @author Matthias Müller
*
*/
@Slf4j
public class SimpleProperty implements Property, Identifiable<String>, Comparable<Property> {

private static final Logger log = LoggerFactory.getLogger(SimpleProperty.class);

private String value;
private String defaultValue;
private String description;
@@ -153,7 +152,7 @@ public Integer getInteger() {
try {
return Integer.parseInt(getString());
} catch (NumberFormatException e) {
log.warn("could not convert property '" + getName() + "' to an Integer");
LOGGER.warn("could not convert property '{}' to an Integer", getName());
}
}
return null;
@@ -164,7 +163,7 @@ public Float getFloat() {
try {
return Float.parseFloat(getString());
} catch (NumberFormatException e) {
log.warn("could not convert property '" + getName() + "' to a Float");
LOGGER.warn("could not convert property '{}' to a Float", getName());
}
}
return null;
@@ -175,7 +174,7 @@ public Double getDouble() {
try {
return Double.parseDouble(getString());
} catch (NumberFormatException e) {
log.warn("could not convert property '" + getName() + "' to a Double");
LOGGER.warn("could not convert property '{}' to a Double", getName());
}
}
return null;
@@ -186,7 +185,7 @@ public Boolean getBoolean() {
try {
return "true".equalsIgnoreCase(getString()) || "1".equals(getString());
} catch (Exception e) {
log.warn("could not convert property '" + getName() + "' to a Boolean");
LOGGER.warn("could not convert property '{}' to a Boolean", getName());
}
}
return null;
@@ -57,24 +57,23 @@
import org.appng.xml.platform.Pages;
import org.appng.xml.platform.Param;
import org.appng.xml.platform.Platform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
*
* Default {@link ApplicationConfigProvider}-implementation.
*
* @author Matthias Müller
*/
@Slf4j
public class ApplicationConfigProviderImpl implements ApplicationConfigProvider {

private static final String RESOURCE_MAP_KEY_EVENT = "event:";
private static final String RESOURCE_MAP_KEY_PAGE = "page:";
private static final String RESOURCE_MAP_KEY_DATASOURCE = "datasource:";
private static final String RESOURCE_MAP_KEY_APPLICATION_ROOT_CONFIG = "applicationRootConfig";

private static final Logger log = LoggerFactory.getLogger(ApplicationConfigProviderImpl.class);

protected ActionMap actionMap;
protected DataSourceMap datasourceMap;
protected PageMap pageMap;
@@ -152,10 +151,10 @@ private synchronized void loadConfig(MarshallService marshallService) throws Inv
readData();
}
} catch (Exception e) {
log.error("error while reading configuration", e);
LOGGER.error("error while reading configuration", e);
}
long end = System.currentTimeMillis() - start;
log.debug("loading config for application " + applicationName + " took " + end + "ms");
long duration = System.currentTimeMillis() - start;
LOGGER.debug("loading config for application {} took {}ms", applicationName, duration);
}

private void readResources(MarshallService marshallService) throws IOException, InvalidConfigurationException {
@@ -171,7 +170,7 @@ private void readResources(MarshallService marshallService) throws IOException,
Object object = marshallService.unmarshall(inputStream);
readConfig(name, object);
} catch (JAXBException e) {
log.error("error while unmarshalling " + name, e);
LOGGER.error(String.format("error while unmarshalling %s", name), e);
} finally {
if (null != inputStream) {
inputStream.close();
@@ -220,7 +219,7 @@ private void processInheritance(MarshallService marshallService) {
if (null != descendant) {
addDataSource(descendant, (String) descendantDef[1]);
} else {
log.error("inheritance did not create an new datasource instance");
LOGGER.error("inheritance did not create an new datasource instance");
}
} else {
// This can happen if the ancestor also inherits from another datasource. As long as this
@@ -239,8 +238,8 @@ private void processInheritance(MarshallService marshallService) {
// log-file
if (actualSize <= descendantDatasources.size()) {
for (Object[] ds : descendantDatasources) {
log.error("Cannot process inheritance for " + ((Datasource) ds[0]).getId()
+ " maybe the ancestor is not defined.");
LOGGER.error("Cannot process inheritance for {} maybe the ancestor is not defined.",
((Datasource) ds[0]).getId());
}
descendantDatasources.clear();
return;
@@ -300,7 +299,7 @@ private void writeData() throws IOException {
out.close();
outputStream.close();
data = out.toByteArray();
log.debug("wrote " + data.length + " bytes of data for application " + applicationName);
LOGGER.debug("wrote {} bytes of data for application {}", data.length, applicationName);
} catch (IOException e) {
throw e;
}
@@ -310,9 +309,9 @@ private void addDataSource(Datasource ds, String resourceName) {
Datasource oldVal = datasourceMap.put(ds.getId(), ds);
resourceMap.put(RESOURCE_MAP_KEY_DATASOURCE + ds.getId(), resourceName);
if (null != oldVal) {
log.warn("overriding previously defined datasource '" + ds.getId() + "'");
LOGGER.warn("overriding previously defined datasource '{}'", ds.getId());
}
log.trace("added datasource '" + ds.getId() + "'");
LOGGER.trace("added datasource '{}'", ds.getId());
}

// there should be only one application root config. Therefore no ID is needed.
@@ -329,22 +328,22 @@ private void addEvent(Event e, String resourceName) {
}
actionMap.put(e.getId(), actions);
if (null != oldVal) {
log.warn("overriding previously defined event '" + e.getId() + "'");
LOGGER.warn("overriding previously defined event '{}'", e.getId());
}
log.trace("added event '" + e.getId() + "'");
LOGGER.trace("added event '{}'", e.getId());
}

private void addPage(PageDefinition p, String resourceName) {
PageDefinition oldVal = pageMap.put(p.getId(), p);
resourceMap.put(RESOURCE_MAP_KEY_PAGE + p.getId(), resourceName);
if (null != oldVal) {
log.warn("overriding previously defined page '" + p.getId() + "'");
LOGGER.warn("overriding previously defined page '{}'", p.getId());
}
if ("index".equals(p.getType())) {
this.defaultPage = p.getId();
log.trace("added default page '" + p.getId() + "'");
LOGGER.trace("added default page '{}'", p.getId());
} else {
log.trace("added page '" + p.getId() + "'");
LOGGER.trace("added page '{}'", p.getId());
}
}

@@ -431,7 +430,7 @@ public ApplicationRootConfig getApplicationRootConfig() {
}

private boolean readConfig(String resourceName, Object object) throws InvalidConfigurationException {
log.trace("reading " + resourceName + ", found " + object.getClass().getSimpleName());
LOGGER.trace("reading {}, found {}", resourceName, object.getClass().getSimpleName());
if (object instanceof ApplicationRootConfig) {
if (null != rootConfig) {
throw new InvalidConfigurationException(applicationName,
@@ -481,7 +480,7 @@ private boolean readConfig(String resourceName, Object object) throws InvalidCon
} else if (object instanceof Platform) {
return true;
} else {
log.error("ignoring unsupported type: " + object.getClass());
LOGGER.error("ignoring unsupported type: {}", object.getClass());
}
return false;
}
Oops, something went wrong.

0 comments on commit b8b6050

Please sign in to comment.
You can’t perform that action at this time.