From f3a6476a66cfa4576301f7eb98890ad502034d7a Mon Sep 17 00:00:00 2001 From: Lukasz Antoniak Date: Sun, 12 Jun 2011 14:15:10 +0200 Subject: [PATCH] HHH-5580 - Refactoring --- .../org/hibernate/envers/reader/AuditReaderImpl.java | 12 +++++++----- .../revisioninfo/ModifiedEntityNamesReader.java | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java b/hibernate-envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java index 60de24205c..05aafba24a 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java @@ -304,12 +304,14 @@ public class AuditReaderImpl implements AuditReaderImplementor { if (revisionInfo != null) { // If revision exists. Set entityNames = verCfg.getModifiedEntityNamesReader().getModifiedEntityNames(revisionInfo); - // Generate result that contains entity names and corresponding Java classes. - Set> result = new HashSet>(); - for (String entityName : entityNames) { - result.add(Pair.make(entityName, Tools.getEntityClass(sessionImplementor, session, entityName))); + if (entityNames != null) { + // Generate result that contains entity names and corresponding Java classes. + Set> result = new HashSet>(); + for (String entityName : entityNames) { + result.add(Pair.make(entityName, Tools.getEntityClass(sessionImplementor, session, entityName))); + } + return result; } - return result; } return Collections.EMPTY_SET; } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/revisioninfo/ModifiedEntityNamesReader.java b/hibernate-envers/src/main/java/org/hibernate/envers/revisioninfo/ModifiedEntityNamesReader.java index 7d7bb8b5a1..d140be6095 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/revisioninfo/ModifiedEntityNamesReader.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/revisioninfo/ModifiedEntityNamesReader.java @@ -21,7 +21,6 @@ public class ModifiedEntityNamesReader { @SuppressWarnings({"unchecked"}) public Set getModifiedEntityNames(Object revisionEntity) { - Set modifiedEntityNames = (Set) modifiedEntityNamesGetter.get(revisionEntity); - return modifiedEntityNames != null ? modifiedEntityNames : Collections.EMPTY_SET; + return (Set) modifiedEntityNamesGetter.get(revisionEntity); } }