Skip to content

Commit

Permalink
Cleaned up all warning messages reported by Eclipse.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbywalters authored and asimarslan committed Jun 12, 2013
1 parent e3b66a4 commit ec280ab
Show file tree
Hide file tree
Showing 31 changed files with 119 additions and 16 deletions.
29 changes: 29 additions & 0 deletions batoo-common/src/main/java/org/batoo/common/BatooVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2012 - Batoo Software ve Consultancy Ltd.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/

package org.batoo.common;

/**
* Common serial version throughout Batoo.
*
* @since 2.0.1.2
*/
public final class BatooVersion {
public static final long SERIAL_VERSION_UID = 1L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.NoSuchElementException;
import java.util.Queue;

import org.batoo.common.BatooVersion;

/**
* Doubly-linked list implementation that avoids interfaces.
* <p>
Expand All @@ -41,6 +43,7 @@
* @author hceylan
*/
public class FastLinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, Serializable {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

static class FastLinkedListNode<E> {
E item;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.Properties;
import java.util.Set;

import org.batoo.common.BatooVersion;

/**
* Miscellaneous collection utility methods. Mainly for internal use within the framework.
*
Expand Down Expand Up @@ -74,6 +76,7 @@ public void remove() throws UnsupportedOperationException {
* Adapts a Map to the MultiValueMap contract.
*/
private static class MultiValueMapAdapter<K, V> implements MultiValueMap<K, V>, Serializable {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private final Map<K, List<V>> map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

import javax.persistence.PersistenceException;

import org.batoo.common.BatooVersion;

/**
* The exception thrown when the optimistic lock fails.
*
* @author hceylan
* @since 2.0.1
*/
public class OptimisticLockFailedException extends PersistenceException {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

/**
*
Expand Down
1 change: 1 addition & 0 deletions batoo-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Map;

import org.apache.commons.lang.mutable.MutableBoolean;
import org.batoo.common.BatooVersion;
import org.batoo.common.util.BatooUtils;
import org.batoo.jpa.core.impl.criteria.EntryImpl;
import org.batoo.jpa.core.impl.instance.ManagedInstance;
Expand All @@ -52,6 +53,7 @@
* @since 2.0.0
*/
public abstract class ManagedCollection<E> implements Serializable {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private transient boolean changed;
private final transient ManagedInstance<?> managedInstance;
Expand Down Expand Up @@ -265,7 +267,7 @@ public void mergeWith(EntityManagerImpl entityManager, Object instance, MutableB
&& (this.inverse.getAttribute() instanceof PluralAttributeImpl) ? //
(PluralAssociationMappingImpl<?, ?, ?>) this.inverse : null;

// TODO needs to be overriden by ManagedMap
// TODO needs to be overridden by ManagedMap
// add the new children
for (int i = 0; i < mergedChildren.size(); i++) {
final E child = mergedChildren.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.persistence.PersistenceException;

import org.apache.commons.lang.ObjectUtils;
import org.batoo.common.BatooVersion;
import org.batoo.common.util.BatooUtils;
import org.batoo.jpa.core.impl.criteria.EntryImpl;
import org.batoo.jpa.core.impl.instance.ManagedInstance;
Expand All @@ -50,6 +51,7 @@
* @since 2.0.0
*/
public class ManagedList<X, E> extends ManagedCollection<E> implements List<E> {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import javax.persistence.PersistenceException;

import org.batoo.common.BatooVersion;
import org.batoo.common.util.BatooUtils;
import org.batoo.jpa.core.impl.criteria.EntryImpl;
import org.batoo.jpa.core.impl.instance.ManagedInstance;
Expand All @@ -51,6 +52,7 @@
* @since 2.0.0
*/
public class ManagedMap<X, K, V> extends ManagedCollection<V> implements Map<K, V> {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private HashMap<K, V> delegate;
private HashMap<K, V> snapshot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import javax.persistence.PersistenceException;

import org.batoo.common.BatooVersion;
import org.batoo.common.util.BatooUtils;
import org.batoo.jpa.core.impl.criteria.EntryImpl;
import org.batoo.jpa.core.impl.instance.ManagedInstance;
Expand All @@ -46,6 +47,7 @@
* @since 2.0.0
*/
public class ManagedSet<X, E> extends ManagedCollection<E> implements Set<E> {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private HashSet<E> delegate;
private transient HashSet<E> snapshot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ public EntryImpl<Object, X> handleElementFetch(ResultSet row, MapSelectType sele

if (this.keyColumnAlias != null) {
if (this.keyColumn == null) {
@SuppressWarnings("unchecked")
final ElementCollectionMappingImpl<? super X, ?, ?> _mapping = (ElementCollectionMappingImpl<? super X, ?, ?>) this.mapping;
if (_mapping.getCollectionTable() != null) {
this.keyColumn = _mapping.getCollectionTable().getKeyColumn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

import org.apache.commons.lang.StringUtils;
import org.batoo.common.BatooException;
import org.batoo.common.BatooVersion;
import org.batoo.common.log.BLogger;
import org.batoo.common.log.BLoggerFactory;
import org.batoo.jpa.BJPASettings;
Expand Down Expand Up @@ -81,6 +82,7 @@
* @since 2.0.0
*/
public class EntityManagerFactoryImpl implements EntityManagerFactory, Serializable {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private static final BLogger LOG = BLoggerFactory.getLogger(EntityManagerFactoryImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.persistence.PersistenceException;
import javax.transaction.TransactionManager;

import org.batoo.common.BatooVersion;
import org.batoo.common.log.BLogger;
import org.batoo.common.log.BLoggerFactory;
import org.batoo.jpa.parser.PersistenceParser;
Expand All @@ -43,6 +44,7 @@
* @since 2.0.0
*/
public class JtaEntityManagerFactoryImpl extends EntityManagerFactoryImpl {
private static final long serialVersionUID = BatooVersion.SERIAL_VERSION_UID;

private static final BLogger LOG = BLoggerFactory.getLogger(JtaEntityManagerFactoryImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ public abstract class AbstractMapping<Z, X, Y> implements Mapping<Z, X, Y> {
*
* @since 2.0.0
*/
@SuppressWarnings("unchecked")
public AbstractMapping(AbstractParentMapping<?, Z> parent, AttributeImpl<? super Z, X> attribute, Class<X> javaType, String name) {
super();

this.javaType = attribute instanceof Bindable ? ((Bindable) attribute).getBindableJavaType() : javaType;
this.javaType = attribute instanceof Bindable ? ((Bindable<X>) attribute).getBindableJavaType() : javaType;
this.parent = parent;
this.attribute = attribute;
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
*/
@SuppressWarnings("rawtypes")
public class PersistenceActivator implements BundleActivator {

private static BundleContext context = null;
private static ServiceRegistration serviceReg = null;
private ServiceRegistration serviceReg;

public PersistenceActivator() {
super();
Expand All @@ -46,14 +44,12 @@ public PersistenceActivator() {
*/
@Override
public void start(BundleContext context) throws Exception {
PersistenceActivator.context = context;

final Hashtable<String, String> props = new Hashtable<String, String>();
props.put("javax.persistence.provider", org.batoo.jpa.core.BatooPersistenceProvider.class.getName());
props.put("javax.persistence.spi.PersistenceProvider", org.batoo.jpa.core.BatooPersistenceProvider.class.getName());
props.put("javax.persistence.PersistenceProvider", org.batoo.jpa.core.BatooPersistenceProvider.class.getName());

PersistenceActivator.serviceReg = context.registerService("javax.persistence.spi.PersistenceProvider",
serviceReg = context.registerService("javax.persistence.spi.PersistenceProvider",
new org.batoo.jpa.core.BatooPersistenceProvider(), props);
}

Expand All @@ -63,11 +59,9 @@ public void start(BundleContext context) throws Exception {
*/
@Override
public void stop(BundleContext context) throws Exception {
if (PersistenceActivator.serviceReg != null) {
PersistenceActivator.serviceReg.unregister();
PersistenceActivator.serviceReg = null;
if (null != serviceReg) {
serviceReg.unregister();
serviceReg = null;
}

PersistenceActivator.context = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/
@Entity
public class Address implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
@Entity
public class Country implements Serializable {
private static final long serialVersionUID = 1L;

@Id
private Integer id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/
@Entity
public class HomePhone extends Phone {
private static final long serialVersionUID = 1L;

@ManyToOne(fetch = FetchType.LAZY)
private Person person;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*/
@Entity
public class Person implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
@MappedSuperclass
public class Phone implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
@Entity
public class WorkPhone extends Phone {
private static final long serialVersionUID = 1L;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
@Entity
public class Foo extends AbstractPersistable<Long> {
private static final long serialVersionUID = 1L;

private String fooValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
@Entity
@SuppressWarnings("javadoc")
public abstract class AbstractEntity extends TopMappedSuperClass {
private static final long serialVersionUID = 1L;

@Basic
@Column(nullable = false)
private String myAbstractProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@Table
@SuppressWarnings("javadoc")
public class CompositeEntity extends TopMappedSuperClass {
private static final long serialVersionUID = 1L;

@Basic
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@Table
@SuppressWarnings("javadoc")
public class ConcreteEntity extends AbstractEntity {
private static final long serialVersionUID = 1L;

@Basic
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@Table
@SuppressWarnings("javadoc")
public class EntityB extends TopMappedSuperClass {
private static final long serialVersionUID = 1L;

@Basic
@Column(nullable = false)
private String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ public void testSerialization() throws IOException, ClassNotFoundException {
final ObjectInputStream ois = new ObjectInputStream(pis);

oos.writeObject(entity);
oos.close();

final CompositeEntity transportedEntity = (CompositeEntity) ois.readObject();
ois.close();

Assert.assertEquals(entity.getId(), transportedEntity.getId());
Assert.assertEquals(entity.getTimeStamp(), transportedEntity.getTimeStamp());
Expand Down
2 changes: 1 addition & 1 deletion parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.3.1</version>
<version>1.5</version>
<configuration>
<bindingFiles>spec.xjb</bindingFiles>
<schemaFiles>persistence_2_0.xsd</schemaFiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private DataSource createDatasource(String jndiName) {
}

private boolean createExcludeUnlistedProperties(final PersistenceUnit pu) {
return pu.getExcludeUnlistedClasses() != null ? pu.getExcludeUnlistedClasses() : !this.managedClassNames.isEmpty();
return pu.isExcludeUnlistedClasses() != null ? pu.isExcludeUnlistedClasses() : !this.managedClassNames.isEmpty();
}

private List<URL> createJarFiles(PersistenceUnit pu) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ private Set<Class<?>> findClasses(PersistenceUnitInfo persistenceUnitInfo, URL u
classes.add(clazz);
}
}

}

jarFile.close();

return classes;
}
Expand Down
Loading

0 comments on commit ec280ab

Please sign in to comment.