DATACMNS-201 - Fixed critical FindBugs warnings.

This commit is contained in:
Oliver Gierke
2012-07-18 20:53:24 +02:00
parent 96795f2980
commit d7df08f6b7
2 changed files with 12 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2011 the original author or authors. * Copyright 2011-2012 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -48,8 +48,10 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
* @param properties must not be {@literal null}. * @param properties must not be {@literal null}.
*/ */
public DefaultPersistentPropertyPath(List<T> properties) { public DefaultPersistentPropertyPath(List<T> properties) {
Assert.notNull(properties); Assert.notNull(properties);
Assert.isTrue(!properties.isEmpty()); Assert.isTrue(!properties.isEmpty());
this.properties = properties; this.properties = properties;
} }
@@ -141,7 +143,8 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
return true; return true;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
* @see org.springframework.data.mapping.context.PersistentPropertyPath#getExtensionForBaseOf(org.springframework.data.mapping.context.PersistentPropertyPath) * @see org.springframework.data.mapping.context.PersistentPropertyPath#getExtensionForBaseOf(org.springframework.data.mapping.context.PersistentPropertyPath)
*/ */
public PersistentPropertyPath<T> getExtensionForBaseOf(PersistentPropertyPath<T> base) { public PersistentPropertyPath<T> getExtensionForBaseOf(PersistentPropertyPath<T> base) {
@@ -153,8 +156,7 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
List<T> properties = new ArrayList<T>(); List<T> properties = new ArrayList<T>();
Iterator<T> iterator = iterator(); Iterator<T> iterator = iterator();
for (@SuppressWarnings("unused") for (int i = 0; i < base.getLength(); i++) {
T candidate : base) {
iterator.next(); iterator.next();
} }
@@ -222,6 +224,10 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
return properties.hashCode(); return properties.hashCode();
} }
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
return toDotPath(); return toDotPath();

View File

@@ -39,7 +39,7 @@ public abstract class AbstractRepositoryPopulatorFactoryBean extends
* @param resources the resources to set * @param resources the resources to set
*/ */
public void setResources(Resource[] resources) { public void setResources(Resource[] resources) {
this.resources = resources; this.resources = resources.clone();
} }
/* /*
@@ -72,7 +72,7 @@ public abstract class AbstractRepositoryPopulatorFactoryBean extends
*/ */
public void onApplicationEvent(ContextRefreshedEvent event) { public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.equals(getBeanFactory())) { if (event.getApplicationContext().equals(getBeanFactory())) {
Repositories repositories = new Repositories(event.getApplicationContext()); Repositories repositories = new Repositories(event.getApplicationContext());
populator.populate(repositories); populator.populate(repositories);
} }