From a224943f3053f5997b990e7b4fb2b56c09ec29f3 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 26 Nov 2015 11:56:27 +0100 Subject: [PATCH] DATAMONGO-1337 - Reverted making some of the loggers static. The logger instance in AbstractMonitor is supposed to pick up the type of the actual implementation class and thus cannot be static. Related pull request: #336. --- .../data/mongodb/crossstore/MongoChangeSetPersister.java | 8 ++++---- .../data/mongodb/monitor/AbstractMonitor.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java index 19b071068..2c7a00d2d 100644 --- a/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java +++ b/spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2014 the original author or authors. + * Copyright 2011-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class MongoChangeSetPersister implements ChangeSetPersister { private static final String ENTITY_FIELD_NAME = "_entity_field_name"; private static final String ENTITY_FIELD_CLASS = "_entity_field_class"; - private static final Logger log = LoggerFactory.getLogger(getClass()); + private final Logger log = LoggerFactory.getLogger(getClass()); private MongoTemplate mongoTemplate; private EntityManagerFactory entityManagerFactory; @@ -88,8 +88,8 @@ public class MongoChangeSetPersister implements ChangeSetPersister { if (!changeSet.getValues().containsKey(key)) { String className = (String) dbo.get(ENTITY_FIELD_CLASS); if (className == null) { - throw new DataIntegrityViolationException("Unble to convert property " + key + ": Invalid metadata, " - + ENTITY_FIELD_CLASS + " not available"); + throw new DataIntegrityViolationException( + "Unble to convert property " + key + ": Invalid metadata, " + ENTITY_FIELD_CLASS + " not available"); } Class clazz = ClassUtils.resolveClassName(className, ClassUtils.getDefaultClassLoader()); Object value = mongoTemplate.getConverter().read(clazz, dbo); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java index c6af3ef1d..9498fcfb9 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +29,11 @@ import com.mongodb.MongoException; * Base class to encapsulate common configuration settings when connecting to a database * * @author Mark Pollack + * @author Oliver Gierke */ public abstract class AbstractMonitor { - private static final Logger logger = LoggerFactory.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); protected Mongo mongo; private String username;