From ddf047a9425514745c80462499e46be896f9d9b0 Mon Sep 17 00:00:00 2001 From: laa Date: Tue, 11 Aug 2015 12:38:43 +0300 Subject: [PATCH] Last batch of findbugs fixes. --- core/pom.xml | 12 ++ .../common/collection/OMultiValue.java | 16 +- .../orient/core/index/OCompositeCollate.java | 1 + .../orient/core/index/OCompositeKey.java | 4 + .../core/index/OIndexDefinitionFactory.java | 31 +-- .../orient/core/index/OIndexFullText.java | 7 +- .../core/index/OIndexManagerAbstract.java | 6 +- .../core/index/OIndexManagerShared.java | 11 +- .../orient/core/index/OIndexMultiValues.java | 10 +- .../orient/core/index/OIndexRemote.java | 48 ++--- .../index/OPropertyListIndexDefinition.java | 2 +- .../index/OPropertyMapIndexDefinition.java | 2 +- .../index/OPropertyRidBagIndexDefinition.java | 2 +- .../index/ORuntimeKeyIndexDefinition.java | 4 +- .../core/index/OSimpleKeyIndexDefinition.java | 6 +- .../index/engine/OHashTableIndexEngine.java | 44 +++-- .../core/index/engine/OSBTreeIndexEngine.java | 30 +-- .../hashindex/local/OHashTableDirectory.java | 5 +- .../hashindex/local/OLocalHashTable.java | 129 +++++++------ .../hashindex/local/OLocalHashTable20.java | 176 +++++++++--------- .../local/OMurmurHash3HashFunction.java | 2 + .../orient/core/index/mvrbtree/OMVRBTree.java | 52 +++--- .../index/mvrbtree/OMVRBTreeEntryMemory.java | 3 + .../core/index/mvrbtree/OMVRBTreeSet.java | 2 + .../index/sbtree/OSBTreeMapEntryIterator.java | 11 +- .../core/index/sbtree/local/OSBTree.java | 176 +++++++++--------- .../local/OSBTreeBonsaiLocal.java | 22 ++- pom.xml | 47 +---- 28 files changed, 443 insertions(+), 418 deletions(-) mode change 100644 => 100755 core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java mode change 100644 => 100755 core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeEntryMemory.java diff --git a/core/pom.xml b/core/pom.xml index 96b1b8c19ad..8fc90168658 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -128,6 +128,18 @@ false findbugs_filter.xml + + + + analyze-compile + compile + + check + + + org.codehaus.mojo diff --git a/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java b/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java index 5d8c6c2dbac..2ab24499796 100755 --- a/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java +++ b/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java @@ -23,6 +23,7 @@ import com.orientechnologies.common.util.OCallable; import com.orientechnologies.common.util.OResettable; import com.orientechnologies.common.util.OSizeable; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.lang.reflect.Array; import java.util.*; @@ -44,10 +45,9 @@ public class OMultiValue { * @return true if it's an array, a collection or a map, otherwise false */ public static boolean isMultiValue(final Class iType) { - return OCollection.class.isAssignableFrom(iType) - || Collection.class.isAssignableFrom(iType) - || (iType.isArray() || Map.class.isAssignableFrom(iType) || OMultiCollectionIterator.class.isAssignableFrom(iType) || OCollection.class - .isAssignableFrom(iType)); + return OCollection.class.isAssignableFrom(iType) || Collection.class.isAssignableFrom(iType) + || (iType.isArray() || Map.class.isAssignableFrom(iType) || OMultiCollectionIterator.class.isAssignableFrom(iType) + || OCollection.class.isAssignableFrom(iType)); } /** @@ -114,7 +114,7 @@ else if (iObject instanceof Map) return ((Map) iObject).values().iterator().next(); else if (iObject.getClass().isArray()) return Array.get(iObject, 0); - } catch (Exception e) { + } catch (RuntimeException e) { // IGNORE IT OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject); } @@ -151,7 +151,7 @@ else if (iObject instanceof Iterable) { return last; } else if (iObject.getClass().isArray()) return Array.get(iObject, Array.getLength(iObject) - 1); - } catch (Exception e) { + } catch (RuntimeException e) { // IGNORE IT OLogManager.instance().debug(iObject, "Error on reading the last item of the Multi-value field '%s'", iObject); } @@ -214,7 +214,7 @@ else if (iObject instanceof Iterator || iObject instanceof Iterable) { if (it instanceof OResettable) ((OResettable) it).reset(); } - } catch (Exception e) { + } catch (RuntimeException e) { // IGNORE IT OLogManager.instance().debug(iObject, "Error on reading the first item of the Multi-value field '%s'", iObject); } @@ -332,6 +332,7 @@ public static String toString(final Object iObject) { * Single value, array of values or collections of values. Map are not supported. * @return */ + @SuppressFBWarnings("BC_UNCONFIRMED_CAST") public static Object add(final Object iObject, final Object iToAdd) { if (iObject != null) { if (iObject instanceof Collection || iObject instanceof OCollection) { @@ -628,6 +629,7 @@ public static T[] array(final Object iValue, final Class iClass return array(iValue, iClass, null); } + @SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS") public static T[] array(final Object iValue, final Class iClass, final OCallable iCallback) { if (iValue == null) return null; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java old mode 100644 new mode 100755 index 47df30a5b7d..beb8d6a3843 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeCollate.java @@ -6,6 +6,7 @@ import com.orientechnologies.orient.core.collate.OCollate; public class OCompositeCollate implements OCollate { + private static final long serialVersionUID = 8683726773893639905L; /** * */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java index 9c9a8f5caa3..f5a1dc78981 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OCompositeKey.java @@ -19,12 +19,15 @@ */ package com.orientechnologies.orient.core.index; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.*; import com.orientechnologies.common.comparator.ODefaultComparator; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.serialization.ODocumentSerializable; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Container for the list of heterogeneous values that are going to be stored in in index as composite keys. @@ -32,6 +35,7 @@ * @author Andrey lomakin, Artem Orobets * @see com.orientechnologies.orient.core.index.mvrbtree.OMVRBTree.PartialSearchMode */ +@SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED") public class OCompositeKey implements Comparable, Serializable, ODocumentSerializable { private static final long serialVersionUID = 1L; /** diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java index cdc63a8f8a8..98aef0d4c7f 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java @@ -84,8 +84,8 @@ public static String extractFieldName(final String fieldDefinition) { if (fieldNameParts.length == 3 && "by".equalsIgnoreCase(fieldNameParts[1])) return fieldNameParts[0]; - throw new IllegalArgumentException("Illegal field name format, should be ' [by key|value]' but was '" - + fieldDefinition + '\''); + throw new IllegalArgumentException( + "Illegal field name format, should be ' [by key|value]' but was '" + fieldDefinition + '\''); } private static OIndexDefinition createMultipleFieldIndexDefinition(final OClass oClass, final List fieldsToIndex, @@ -99,8 +99,8 @@ private static OIndexDefinition createMultipleFieldIndexDefinition(final OClass if (collates != null) collate = collates.get(i); - compositeIndex.addIndex(createSingleFieldIndexDefinition(oClass, fieldsToIndex.get(i), types.get(i), collate, indexKind, - algorithm)); + compositeIndex + .addIndex(createSingleFieldIndexDefinition(oClass, fieldsToIndex.get(i), types.get(i), collate, indexKind, algorithm)); } return compositeIndex; @@ -177,27 +177,32 @@ else if (type.equals(OType.LINKLIST)) { } private static OPropertyMapIndexDefinition.INDEX_BY extractMapIndexSpecifier(final String fieldName) { + String[] fieldNameParts = FILED_NAME_PATTERN.split(fieldName); if (fieldNameParts.length == 1) return OPropertyMapIndexDefinition.INDEX_BY.KEY; if (fieldNameParts.length == 3) { - ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.get(); - OStorage storage = db.getStorage(); - OStorageConfiguration configuration = storage.getConfiguration(); - Locale locale = configuration.getLocaleInstance(); + Locale locale = getServerLocale(); if ("by".equals(fieldNameParts[1].toLowerCase(locale))) try { - return OPropertyMapIndexDefinition.INDEX_BY.valueOf(fieldNameParts[2].toUpperCase()); + return OPropertyMapIndexDefinition.INDEX_BY.valueOf(fieldNameParts[2].toUpperCase(locale)); } catch (IllegalArgumentException iae) { - throw new IllegalArgumentException("Illegal field name format, should be ' [by key|value]' but was '" - + fieldName + '\'', iae); + throw new IllegalArgumentException( + "Illegal field name format, should be ' [by key|value]' but was '" + fieldName + '\'', iae); } } - throw new IllegalArgumentException("Illegal field name format, should be ' [by key|value]' but was '" + fieldName - + '\''); + throw new IllegalArgumentException( + "Illegal field name format, should be ' [by key|value]' but was '" + fieldName + '\''); + } + + private static Locale getServerLocale() { + ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.get(); + OStorage storage = db.getStorage(); + OStorageConfiguration configuration = storage.getConfiguration(); + return configuration.getLocaleInstance(); } private static String adjustFieldName(final OClass clazz, final String fieldName) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFullText.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFullText.java index bd663c9d34e..ac2783f3123 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFullText.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexFullText.java @@ -51,14 +51,14 @@ public class OIndexFullText extends OIndexMultiValues { private static final String DEF_SEPARATOR_CHARS = " \r\n\t:;,.|+*/\\=!?[]()"; private static final String DEF_IGNORE_CHARS = "'\""; private static final String DEF_STOP_WORDS = "the in a at as and or for his her " + "him this that what which while " - + "up with be was were is"; + + "up with be was were is"; private static int DEF_MIN_WORD_LENGTH = 3; private boolean indexRadix; private String separatorChars; private String ignoreChars; private int minWordLength; - private Set stopWords; + private Set stopWords; public OIndexFullText(String name, String typeId, String algorithm, OIndexEngine> indexEngine, String valueContainerAlgorithm, ODocument metadata) { @@ -277,7 +277,8 @@ protected void config() { private Set splitIntoWords(final String iKey) { final Set result = new HashSet(); - final List words = (List) OStringSerializerHelper.split(new ArrayList(), iKey, 0, -1, separatorChars); + final List words = new ArrayList(); + OStringSerializerHelper.split(words, iKey, 0, -1, separatorChars); final StringBuilder buffer = new StringBuilder(64); // FOREACH WORD CREATE THE LINK TO THE CURRENT DOCUMENT diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerAbstract.java index 40d3781f3ad..2923c92e76d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerAbstract.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerAbstract.java @@ -361,7 +361,7 @@ public OIndex getClassIndex(String className, String indexName) { final OIndex index = indexes.get(indexName); if (index != null && index.getDefinition() != null && index.getDefinition().getClassName() != null - && className.equals(index.getDefinition().getClassName().toLowerCase())) + && className.equals(index.getDefinition().getClassName().toLowerCase(locale))) return preProcessBeforeReturn(index); return null; } @@ -425,7 +425,7 @@ protected void addIndexInternal(final OIndex index) { if (indexDefinition == null || indexDefinition.getClassName() == null) return; - Map>> propertyIndex = classPropertyIndex.get(indexDefinition.getClassName().toLowerCase()); + Map>> propertyIndex = classPropertyIndex.get(indexDefinition.getClassName().toLowerCase(locale)); if (propertyIndex == null) { propertyIndex = new HashMap>>(); @@ -449,7 +449,7 @@ protected void addIndexInternal(final OIndex index) { propertyIndex.put(multiKey, indexSet); } - classPropertyIndex.put(indexDefinition.getClassName().toLowerCase(), copyPropertyMap(propertyIndex)); + classPropertyIndex.put(indexDefinition.getClassName().toLowerCase(locale), copyPropertyMap(propertyIndex)); } finally { releaseExclusiveLock(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java index 07afe85353a..641ccbcec5d 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java @@ -40,6 +40,7 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.storage.OStorage; import com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.*; @@ -49,7 +50,8 @@ * @author Luca Garulli (l.garulli--at--orientechnologies.com) * @author Artem Orobets added composite index managemement */ -public class OIndexManagerShared extends OIndexManagerAbstract implements OIndexManager { +@SuppressFBWarnings("EQ_DOESNT_OVERRIDE_EQUALS") +public class OIndexManagerShared extends OIndexManagerAbstract { private static final long serialVersionUID = 1L; protected volatile transient Thread recreateIndexesThread = null; @@ -379,7 +381,7 @@ protected void fromStream() { configUpdated = true; } } - } catch (Exception e) { + } catch (RuntimeException e) { indexConfigurationIterator.remove(); configUpdated = true; OLogManager.instance().error(this, "Error on loading index by configuration: %s", e, d); @@ -413,7 +415,8 @@ public void removeClassPropertyIndex(final OIndex idx) { if (indexDefinition == null || indexDefinition.getClassName() == null) return; - Map>> map = classPropertyIndex.get(indexDefinition.getClassName().toLowerCase()); + final Locale locale = getServerLocale(); + Map>> map = classPropertyIndex.get(indexDefinition.getClassName().toLowerCase(locale)); if (map == null) { return; @@ -441,7 +444,7 @@ public void removeClassPropertyIndex(final OIndex idx) { } } - final Locale locale = getServerLocale(); + if (map.isEmpty()) classPropertyIndex.remove(indexDefinition.getClassName().toLowerCase(locale)); else diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java index f100ec9d8cc..c22358a2b97 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java @@ -149,7 +149,7 @@ public OIndexMultiValues put(Object key, final OIdentifiable iSingleValue) { } if (!iSingleValue.getIdentity().isValid()) - ((ORecord) iSingleValue).save(); + (iSingleValue.getRecord()).save(); values.add(iSingleValue.getIdentity()); indexEngine.put(key, values); @@ -238,8 +238,8 @@ public OIndexMultiValues create(final String name, final OIndexDefinition indexD protected OStreamSerializer determineValueSerializer() { if (ODefaultIndexFactory.SBTREEBONSAI_VALUE_CONTAINER.equals(valueContainerAlgorithm)) - return (OStreamSerializer) getDatabase().getSerializerFactory().getObjectSerializer( - OStreamSerializerSBTreeIndexRIDContainer.ID); + return (OStreamSerializer) getDatabase().getSerializerFactory() + .getObjectSerializer(OStreamSerializerSBTreeIndexRIDContainer.ID); else return OStreamSerializerListRID.INSTANCE; } @@ -304,10 +304,10 @@ public OIndexCursor iterateEntries(Collection keys, boolean ascSortOrder) { Collections.sort(sortedKeys, comparator); return new OIndexAbstractCursor() { - private Iterator keysIterator = sortedKeys.iterator(); + private Iterator keysIterator = sortedKeys.iterator(); private Iterator currentIterator = OEmptyIterator.IDENTIFIABLE_INSTANCE; - private Object currentKey; + private Object currentKey; @Override public Map.Entry nextEntry() { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexRemote.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexRemote.java index f7852164ac8..64b7419fde2 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexRemote.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexRemote.java @@ -56,29 +56,29 @@ public abstract class OIndexRemote implements OIndex { protected final static String QUERY_ENTRIES = "select key, rid from index:%s"; protected final static String QUERY_ENTRIES_DESC = "select key, rid from index:%s order by key desc"; - private final static String QUERY_GET_ENTRIES = "select from index:%s where key in [%s]"; - - private final static String QUERY_PUT = "insert into index:%s (key,rid) values (?,?)"; - private final static String QUERY_REMOVE = "delete from index:%s where key = ?"; - private final static String QUERY_REMOVE2 = "delete from index:%s where key = ? and rid = ?"; - private final static String QUERY_REMOVE3 = "delete from index:%s where rid = ?"; - private final static String QUERY_CONTAINS = "select count(*) as size from index:%s where key = ?"; - private final static String QUERY_COUNT = "select count(*) as size from index:%s where key = ?"; - private final static String QUERY_COUNT_RANGE = "select count(*) as size from index:%s where "; - private final static String QUERY_SIZE = "select count(*) as size from index:%s"; - private final static String QUERY_KEY_SIZE = "select count(distinct( key )) as size from index:%s"; - private final static String QUERY_KEYS = "select key from index:%s"; - private final static String QUERY_REBUILD = "rebuild index %s"; - private final static String QUERY_CLEAR = "delete from index:%s"; - private final static String QUERY_DROP = "drop index %s"; - protected final String databaseName; - private final String wrappedType; - private final String algorithm; - private final ORID rid; - protected OIndexDefinition indexDefinition; - protected String name; - protected ODocument configuration; - protected Set clustersToIndex; + private final static String QUERY_GET_ENTRIES = "select from index:%s where key in [%s]"; + + private final static String QUERY_PUT = "insert into index:%s (key,rid) values (?,?)"; + private final static String QUERY_REMOVE = "delete from index:%s where key = ?"; + private final static String QUERY_REMOVE2 = "delete from index:%s where key = ? and rid = ?"; + private final static String QUERY_REMOVE3 = "delete from index:%s where rid = ?"; + private final static String QUERY_CONTAINS = "select count(*) as size from index:%s where key = ?"; + private final static String QUERY_COUNT = "select count(*) as size from index:%s where key = ?"; + private final static String QUERY_COUNT_RANGE = "select count(*) as size from index:%s where "; + private final static String QUERY_SIZE = "select count(*) as size from index:%s"; + private final static String QUERY_KEY_SIZE = "select count(distinct( key )) as size from index:%s"; + private final static String QUERY_KEYS = "select key from index:%s"; + private final static String QUERY_REBUILD = "rebuild index %s"; + private final static String QUERY_CLEAR = "delete from index:%s"; + private final static String QUERY_DROP = "drop index %s"; + protected final String databaseName; + private final String wrappedType; + private final String algorithm; + private final ORID rid; + protected OIndexDefinition indexDefinition; + protected String name; + protected ODocument configuration; + protected Set clustersToIndex; public OIndexRemote(final String iName, final String iWrappedType, final String algorithm, final ORID iRid, final OIndexDefinition iIndexDefinition, final ODocument iConfiguration, final Set clustersToIndex) { @@ -263,7 +263,7 @@ public long rebuild(final OProgressListener iProgressListener) { public OType[] getKeyTypes() { if (indexDefinition != null) return indexDefinition.getTypes(); - return null; + return new OType[0]; } public Collection getEntries(final Collection iKeys) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyListIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyListIndexDefinition.java index 36feca14b0a..397fd9070f8 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyListIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyListIndexDefinition.java @@ -35,7 +35,7 @@ * {@link com.orientechnologies.orient.core.metadata.schema.OType#LINKSET} or * {@link com.orientechnologies.orient.core.metadata.schema.OType#EMBEDDEDSET} properties. */ -public class OPropertyListIndexDefinition extends OAbstractIndexDefinitionMultiValue implements OIndexDefinitionMultiValue { +public class OPropertyListIndexDefinition extends OAbstractIndexDefinitionMultiValue { private static final long serialVersionUID = -6499782365051906190L; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyMapIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyMapIndexDefinition.java index 74911f48e0f..1c14226bbc9 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyMapIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyMapIndexDefinition.java @@ -31,7 +31,7 @@ * * @link com.orientechnologies.orient.core.metadata.schema.OType#LINKMAP} property. */ -public class OPropertyMapIndexDefinition extends OAbstractIndexDefinitionMultiValue implements OIndexDefinitionMultiValue { +public class OPropertyMapIndexDefinition extends OAbstractIndexDefinitionMultiValue { private static final long serialVersionUID = 275241019910834466L; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyRidBagIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyRidBagIndexDefinition.java index c91f0fa7d3e..e4aaa302b1b 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyRidBagIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OPropertyRidBagIndexDefinition.java @@ -36,7 +36,7 @@ * @author Andrey Lomakin (a.lomakin-at-orientechnologies.com) * @since 1/30/14 */ -public class OPropertyRidBagIndexDefinition extends OAbstractIndexDefinitionMultiValue implements OIndexDefinitionMultiValue { +public class OPropertyRidBagIndexDefinition extends OAbstractIndexDefinitionMultiValue { private static final long serialVersionUID = -8315498456603024776L; public OPropertyRidBagIndexDefinition() { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/ORuntimeKeyIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/ORuntimeKeyIndexDefinition.java index ace5bd5eced..249035e2da3 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/ORuntimeKeyIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/ORuntimeKeyIndexDefinition.java @@ -26,6 +26,7 @@ import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.serialization.serializer.binary.OBinarySerializerFactory; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Arrays; import java.util.Collections; @@ -37,6 +38,7 @@ * * @author Luca Garulli (l.garulli--at--orientechnologies.com) */ +@SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED") public class ORuntimeKeyIndexDefinition extends OAbstractIndexDefinition { private static final long serialVersionUID = -8855918974071833818L; private transient OBinarySerializer serializer; @@ -79,7 +81,7 @@ public int getParamCount() { } public OType[] getTypes() { - return null; + return new OType[0]; } @Override diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OSimpleKeyIndexDefinition.java b/core/src/main/java/com/orientechnologies/orient/core/index/OSimpleKeyIndexDefinition.java index 2aa5be7f622..8cc9cb4fedc 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/OSimpleKeyIndexDefinition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/OSimpleKeyIndexDefinition.java @@ -57,8 +57,10 @@ public OSimpleKeyIndexDefinition(OType[] keyTypes2, List collatesList, collate.addCollate(oCollate); } } else { - for (OType type : keyTypes) { - collate.addCollate(OSQLEngine.getCollate(ODefaultCollate.NAME)); + final int typesSize = keyTypes.length; + final OCollate defCollate = OSQLEngine.getCollate(ODefaultCollate.NAME); + for (int i = 0; i < typesSize; i++) { + collate.addCollate(defCollate); } } this.collate = collate; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/engine/OHashTableIndexEngine.java b/core/src/main/java/com/orientechnologies/orient/core/index/engine/OHashTableIndexEngine.java index 3432825402c..0091ac20a23 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/engine/OHashTableIndexEngine.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/engine/OHashTableIndexEngine.java @@ -45,18 +45,18 @@ * @since 15.07.13 */ public final class OHashTableIndexEngine implements OIndexEngine { - public static final int VERSION = 2; + public static final int VERSION = 2; - public static final String METADATA_FILE_EXTENSION = ".him"; - public static final String TREE_FILE_EXTENSION = ".hit"; - public static final String BUCKET_FILE_EXTENSION = ".hib"; - public static final String NULL_BUCKET_FILE_EXTENSION = ".hnb"; + public static final String METADATA_FILE_EXTENSION = ".him"; + public static final String TREE_FILE_EXTENSION = ".hit"; + public static final String BUCKET_FILE_EXTENSION = ".hib"; + public static final String NULL_BUCKET_FILE_EXTENSION = ".hnb"; private final OHashTable hashTable; private final OMurmurHash3HashFunction hashFunction; - private volatile ORID identity; - private int version; + private volatile ORID identity; + private int version; public OHashTableIndexEngine(String name, Boolean durableInNonTxMode, OAbstractPaginatedStorage storage, int version) { hashFunction = new OMurmurHash3HashFunction(); @@ -105,8 +105,13 @@ public void create(OIndexDefinition indexDefinition, String clusterIndexName, OS identity = identityRecord.getIdentity(); hashFunction.setValueSerializer(keySerializer); - hashTable.create(keySerializer, (OBinarySerializer) valueSerializer, indexDefinition != null ? indexDefinition.getTypes() - : null, indexDefinition != null && !indexDefinition.isNullValuesIgnored()); + if (!(valueSerializer instanceof OBinarySerializer)) + throw new IllegalArgumentException( + "Value serializer should implement " + OBinarySerializer.class.getSimpleName() + " interface."); + + hashTable.create(keySerializer, (OBinarySerializer) valueSerializer, + indexDefinition != null ? indexDefinition.getTypes() : null, + indexDefinition != null && !indexDefinition.isNullValuesIgnored()); } @Override @@ -128,8 +133,8 @@ public void delete() { public void load(ORID indexRid, String indexName, OIndexDefinition indexDefinition, OStreamSerializer valueSerializer, boolean isAutomatic) { identity = indexRid; - hashTable.load(indexName, indexDefinition != null ? indexDefinition.getTypes() : null, indexDefinition != null - && !indexDefinition.isNullValuesIgnored()); + hashTable.load(indexName, indexDefinition != null ? indexDefinition.getTypes() : null, + indexDefinition != null && !indexDefinition.isNullValuesIgnored()); hashFunction.setValueSerializer(hashTable.getKeySerializer()); } @@ -214,7 +219,8 @@ public OIndexCursor iterateEntriesMajor(Object fromKey, boolean isInclusive, boo } @Override - public OIndexCursor iterateEntriesMinor(Object toKey, boolean isInclusive, boolean ascSortOrder, ValuesTransformer transformer) { + public OIndexCursor iterateEntriesMinor(Object toKey, boolean isInclusive, boolean ascSortOrder, + ValuesTransformer transformer) { throw new UnsupportedOperationException("iterateEntriesMinor"); } @@ -231,11 +237,11 @@ public Object getLastKey() { @Override public OIndexCursor cursor(final ValuesTransformer valuesTransformer) { return new OIndexAbstractCursor() { - private int nextEntriesIndex; + private int nextEntriesIndex; private OHashIndexBucket.Entry[] entries; - private Iterator currentIterator = new OEmptyIterator(); - private Object currentKey; + private Iterator currentIterator = new OEmptyIterator(); + private Object currentKey; { OHashIndexBucket.Entry firstEntry = hashTable.firstEntry(); @@ -314,11 +320,11 @@ public OIdentifiable setValue(OIdentifiable value) { @Override public OIndexCursor descCursor(final ValuesTransformer valuesTransformer) { return new OIndexAbstractCursor() { - private int nextEntriesIndex; + private int nextEntriesIndex; private OHashIndexBucket.Entry[] entries; - private Iterator currentIterator = new OEmptyIterator(); - private Object currentKey; + private Iterator currentIterator = new OEmptyIterator(); + private Object currentKey; { OHashIndexBucket.Entry lastEntry = hashTable.lastEntry(); @@ -397,7 +403,7 @@ public OIdentifiable setValue(OIdentifiable value) { @Override public OIndexKeyCursor keyCursor() { return new OIndexKeyCursor() { - private int nextEntriesIndex; + private int nextEntriesIndex; private OHashIndexBucket.Entry[] entries; { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/engine/OSBTreeIndexEngine.java b/core/src/main/java/com/orientechnologies/orient/core/index/engine/OSBTreeIndexEngine.java index d8a9a5ea400..a5cb5428938 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/engine/OSBTreeIndexEngine.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/engine/OSBTreeIndexEngine.java @@ -45,18 +45,18 @@ * @since 8/30/13 */ public class OSBTreeIndexEngine extends OSharedResourceAdaptiveExternal implements OIndexEngine { - public static final int VERSION = 1; + public static final int VERSION = 1; - public static final String DATA_FILE_EXTENSION = ".sbt"; - public static final String NULL_BUCKET_FILE_EXTENSION = ".nbt"; + public static final String DATA_FILE_EXTENSION = ".sbt"; + public static final String NULL_BUCKET_FILE_EXTENSION = ".nbt"; private ORID identity; private final OSBTree sbTree; private int version; public OSBTreeIndexEngine(String name, Boolean durableInNonTxMode, OAbstractPaginatedStorage storage, int version) { - super(OGlobalConfiguration.ENVIRONMENT_CONCURRENT.getValueAsBoolean(), OGlobalConfiguration.MVRBTREE_TIMEOUT - .getValueAsInteger(), true); + super(OGlobalConfiguration.ENVIRONMENT_CONCURRENT.getValueAsBoolean(), + OGlobalConfiguration.MVRBTREE_TIMEOUT.getValueAsInteger(), true); boolean durableInNonTx; @@ -99,8 +99,13 @@ public void create(OIndexDefinition indexDefinition, String clusterIndexName, OS database.save(identityRecord, clusterIndexName); identity = identityRecord.getIdentity(); - sbTree.create(keySerializer, (OBinarySerializer) valueSerializer, indexDefinition != null ? indexDefinition.getTypes() - : null, keySize, indexDefinition != null && !indexDefinition.isNullValuesIgnored()); + if (!(valueSerializer instanceof OBinarySerializer)) + throw new IllegalArgumentException( + "Value serializer should implement " + OBinarySerializer.class.getSimpleName() + " interface."); + + sbTree.create(keySerializer, (OBinarySerializer) valueSerializer, + indexDefinition != null ? indexDefinition.getTypes() : null, keySize, + indexDefinition != null && !indexDefinition.isNullValuesIgnored()); } finally { releaseExclusiveLock(); } @@ -157,8 +162,8 @@ public void load(ORID indexRid, String indexName, OIndexDefinition indexDefiniti acquireExclusiveLock(); try { sbTree.load(indexName, determineKeySerializer(indexDefinition), valueSerializer, - indexDefinition != null ? indexDefinition.getTypes() : null, determineKeySize(indexDefinition), indexDefinition != null - && !indexDefinition.isNullValuesIgnored()); + indexDefinition != null ? indexDefinition.getTypes() : null, determineKeySize(indexDefinition), + indexDefinition != null && !indexDefinition.isNullValuesIgnored()); } finally { releaseExclusiveLock(); } @@ -338,7 +343,8 @@ public OIndexCursor iterateEntriesMajor(Object fromKey, boolean isInclusive, boo } @Override - public OIndexCursor iterateEntriesMinor(Object toKey, boolean isInclusive, boolean ascSortOrder, ValuesTransformer transformer) { + public OIndexCursor iterateEntriesMinor(Object toKey, boolean isInclusive, boolean ascSortOrder, + ValuesTransformer transformer) { acquireSharedLock(); try { return new OSBTreeIndexCursor(sbTree.iterateEntriesMinor(toKey, isInclusive, ascSortOrder), transformer); @@ -391,8 +397,8 @@ private static final class OSBTreeIndexCursor extends OIndexAbstractCursor { private final OSBTree.OSBTreeCursor treeCursor; private final ValuesTransformer valuesTransformer; - private Iterator currentIterator = OEmptyIterator.IDENTIFIABLE_INSTANCE; - private Object currentKey = null; + private Iterator currentIterator = OEmptyIterator.IDENTIFIABLE_INSTANCE; + private Object currentKey = null; private OSBTreeIndexCursor(OSBTree.OSBTreeCursor treeCursor, ValuesTransformer valuesTransformer) { this.treeCursor = treeCursor; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OHashTableDirectory.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OHashTableDirectory.java index e1e1c9cbaac..740b9784fa1 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OHashTableDirectory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OHashTableDirectory.java @@ -48,12 +48,11 @@ public class OHashTableDirectory extends ODurableComponent { private final long firstEntryIndex; private final boolean durableInNonTxMode; - private final OAbstractPaginatedStorage storage; + public OHashTableDirectory(String defaultExtension, String name, boolean durableInNonTxMode, OAbstractPaginatedStorage storage) { super(storage, name, defaultExtension); this.durableInNonTxMode = durableInNonTxMode; - this.storage = storage; this.firstEntryIndex = 0; } @@ -252,7 +251,7 @@ public int addNewNode(byte maxLeftChildDepth, byte maxRightChildDepth, byte node } catch (IOException e) { endAtomicOperation(true, e); throw e; - } catch (Exception e) { + } catch (RuntimeException e) { endAtomicOperation(true, e); throw new OStorageException(null, e); } finally { diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable.java index 46dd206e1b7..ce688233b42 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable.java @@ -83,9 +83,9 @@ public class OLocalHashTable extends ODurableComponent implements OHashTab private final String metadataConfigurationFileExtension; private final String treeStateFileExtension; - public static final int HASH_CODE_SIZE = 64; + public static final int HASH_CODE_SIZE = 64; public static final int MAX_LEVEL_DEPTH = 8; - public static final int MAX_LEVEL_SIZE = 1 << MAX_LEVEL_DEPTH; + public static final int MAX_LEVEL_SIZE = 1 << MAX_LEVEL_DEPTH; public static final int LEVEL_MASK = Integer.MAX_VALUE >>> (31 - MAX_LEVEL_DEPTH); @@ -93,12 +93,12 @@ public class OLocalHashTable extends ODurableComponent implements OHashTab private OBinarySerializer keySerializer; private OBinarySerializer valueSerializer; - private OType[] keyTypes; + private OType[] keyTypes; private final OHashTable.KeyHashCodeComparator comparator; - private boolean nullKeyIsSupported; - private long nullBucketFileId = -1; + private boolean nullKeyIsSupported; + private long nullBucketFileId = -1; private final String nullBucketFileExtension; private long fileStateId; @@ -111,8 +111,8 @@ public class OLocalHashTable extends ODurableComponent implements OHashTab private final boolean durableInNonTxMode; public OLocalHashTable(String name, String metadataConfigurationFileExtension, String treeStateFileExtension, - String bucketFileExtension, String nullBucketFileExtension, OHashFunction keyHashFunction, boolean durableInNonTxMode, - OAbstractPaginatedStorage abstractPaginatedStorage) { + String bucketFileExtension, String nullBucketFileExtension, OHashFunction keyHashFunction, boolean durableInNonTxMode, + OAbstractPaginatedStorage abstractPaginatedStorage) { super(abstractPaginatedStorage, name, bucketFileExtension); this.metadataConfigurationFileExtension = metadataConfigurationFileExtension; @@ -127,7 +127,7 @@ public OLocalHashTable(String name, String metadataConfigurationFileExtension, S @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE") @Override public void create(OBinarySerializer keySerializer, OBinarySerializer valueSerializer, OType[] keyTypes, - boolean nullKeyIsSupported) { + boolean nullKeyIsSupported) { final OAtomicOperation atomicOperation; try { atomicOperation = startAtomicOperation(); @@ -157,8 +157,8 @@ public void create(OBinarySerializer keySerializer, OBinarySerializer valu hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), true); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), true); hashStateEntryIndex = hashStateEntry.getPageIndex(); } finally { @@ -222,8 +222,8 @@ public void setKeySerializer(OBinarySerializer keySerializer) { OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setKeySerializerId(keySerializer.getId()); } finally { @@ -278,8 +278,8 @@ public void setValueSerializer(OBinarySerializer valueSerializer) { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setValueSerializerId(valueSerializer.getId()); } finally { @@ -314,8 +314,8 @@ public V get(K key) { V result = null; OCacheEntry cacheEntry = loadPage(atomicOperation, nullBucketFileId, 0, false); try { - ONullBucket nullBucket = new ONullBucket(cacheEntry, getChangesTree(atomicOperation, cacheEntry), - valueSerializer, false); + ONullBucket nullBucket = new ONullBucket(cacheEntry, getChangesTree(atomicOperation, cacheEntry), valueSerializer, + false); result = nullBucket.getValue(); } finally { releasePage(atomicOperation, cacheEntry); @@ -328,8 +328,8 @@ public V get(K key) { final long hashCode = keyHashFunction.hashCode(key); OHashTable.BucketPath bucketPath = getBucket(hashCode); - final long bucketPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long bucketPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); if (bucketPointer == 0) return null; @@ -436,7 +436,8 @@ public V remove(K key) { if (nodePath.parent != null) { final int hashMapSize = 1 << nodePath.nodeLocalDepth; - final boolean allMapsContainSameBucket = checkAllMapsContainSameBucket(directory.getNode(nodePath.nodeIndex), hashMapSize); + final boolean allMapsContainSameBucket = checkAllMapsContainSameBucket(directory.getNode(nodePath.nodeIndex), + hashMapSize); if (allMapsContainSameBucket) mergeNodeToParent(nodePath); } @@ -493,8 +494,8 @@ private void changeSize(int sizeDiff, OAtomicOperation atomicOperation) throws I OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree(atomicOperation, - hashStateEntry), false); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); page.setRecordsCount(page.getRecordsCount() + sizeDiff); } finally { @@ -565,14 +566,14 @@ public OHashIndexBucket.Entry[] higherEntries(K key, int limit) { releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } final int index = bucket.getIndex(hashCode, key); @@ -625,12 +626,12 @@ public void load(String name, OType[] keyTypes, boolean nullKeyIsSupported) { pinPage(atomicOperation, hashStateEntry); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree(atomicOperation, - hashStateEntry), false); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); keySerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance() .getObjectSerializer(page.getKeySerializerId()); - valueSerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance().getObjectSerializer( - page.getValueSerializerId()); + valueSerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance() + .getObjectSerializer(page.getValueSerializerId()); } finally { releasePage(atomicOperation, hashStateEntry); } @@ -737,8 +738,7 @@ private OHashTable.BucketPath nextBucketToFind(final OHashTable.BucketPath bucke } private OHashTable.BucketPath nextNonEmptyNode(OHashTable.BucketPath bucketPath) throws IOException { - nextBucketLoop: - while (bucketPath != null) { + nextBucketLoop: while (bucketPath != null) { final long[] node = directory.getNode(bucketPath.nodeIndex); final int startIndex = bucketPath.itemIndex + bucketPath.hashMapOffset; final int endIndex = MAX_LEVEL_SIZE; @@ -831,14 +831,14 @@ public OHashIndexBucket.Entry[] ceilingEntries(K key) { return OCommonConst.EMPTY_BUCKET_ENTRY_ARRAY; releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } final int index = bucket.getIndex(hashCode, key); @@ -886,14 +886,14 @@ public OHashIndexBucket.Entry firstEntry() { return null; releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } return bucket.getEntry(0); @@ -934,14 +934,14 @@ public OHashIndexBucket.Entry lastEntry() { return null; releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -988,14 +988,14 @@ public OHashIndexBucket.Entry[] lowerEntries(K key) { releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -1050,15 +1050,15 @@ public OHashIndexBucket.Entry[] floorEntries(K key) { releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPage(atomicOperation, fileId, pageIndex, false); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -1120,8 +1120,7 @@ private OHashTable.BucketPath prevBucketToFind(final OHashTable.BucketPath bucke } private OHashTable.BucketPath prevNonEmptyNode(OHashTable.BucketPath nodePath) throws IOException { - prevBucketLoop: - while (nodePath != null) { + prevBucketLoop: while (nodePath != null) { final long[] node = directory.getNode(nodePath.nodeIndex); final int startIndex = 0; final int endIndex = nodePath.itemIndex + nodePath.hashMapOffset; @@ -1189,8 +1188,8 @@ public long size() { final OAtomicOperation atomicOperation = atomicOperationsManager.getCurrentOperation(); final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); return metadataPage.getRecordsCount(); } finally { releasePage(atomicOperation, hashStateEntry); @@ -1375,7 +1374,7 @@ private void doPut(K key, V value, OAtomicOperation atomicOperation) throws IOEx if (bucketPath.nodeLocalDepth < MAX_LEVEL_DEPTH) { final OHashTable.NodeSplitResult nodeSplitResult = splitNode(bucketPath); - assert !(nodeSplitResult.allLeftHashMapsEqual && nodeSplitResult.allRightHashMapsEqual); + assert!(nodeSplitResult.allLeftHashMapsEqual && nodeSplitResult.allRightHashMapsEqual); final long[] newNode = nodeSplitResult.newNode; @@ -1402,8 +1401,8 @@ private void doPut(K key, V value, OAtomicOperation atomicOperation) throws IOEx updateNodeAfterBucketSplit(updatedBucketPath, bucketDepth, newBucketPointer, updatedBucketPointer); } else { allRightHashMapsEqual = false; - final OHashTable.BucketPath newBucketPath = new OHashTable.BucketPath(bucketPath.parent, updatedOffset - - MAX_LEVEL_SIZE, updatedItemIndex, newNodeIndex, nodeLocalDepth, updatedGlobalDepth); + final OHashTable.BucketPath newBucketPath = new OHashTable.BucketPath(bucketPath.parent, + updatedOffset - MAX_LEVEL_SIZE, updatedItemIndex, newNodeIndex, nodeLocalDepth, updatedGlobalDepth); updateNodeAfterBucketSplit(newBucketPath, bucketDepth, newBucketPointer, updatedBucketPointer); } @@ -1433,7 +1432,7 @@ private void checkNullSupport(K key) { } private void updateNodesAfterSplit(OHashTable.BucketPath bucketPath, int nodeIndex, long[] newNode, int nodeLocalDepth, - int hashMapSize, boolean allLeftHashMapEquals, boolean allRightHashMapsEquals, int newNodeIndex) throws IOException { + int hashMapSize, boolean allLeftHashMapEquals, boolean allRightHashMapsEquals, int newNodeIndex) throws IOException { final int startIndex = findParentNodeStartIndex(bucketPath); @@ -1458,8 +1457,8 @@ private void updateNodesAfterSplit(OHashTable.BucketPath bucketPath, int nodeInd } } else { for (int i = 0; i < pointersSize; i++) - directory.setNodePointer(parentNodeIndex, startIndex + pointersSize + i, (newNodeIndex << 8) | (i * hashMapSize) - | Long.MIN_VALUE); + directory.setNodePointer(parentNodeIndex, startIndex + pointersSize + i, + (newNodeIndex << 8) | (i * hashMapSize) | Long.MIN_VALUE); } updateMaxChildDepth(bucketPath.parent, bucketPath.nodeLocalDepth + 1); @@ -1579,7 +1578,7 @@ private int getMaxLevelDepth(int nodeIndex, int start, int end) throws IOExcepti } private void updateNodeAfterBucketSplit(OHashTable.BucketPath bucketPath, int bucketDepth, long newBucketPointer, - long updatedBucketPointer) throws IOException { + long updatedBucketPointer) throws IOException { int offset = bucketPath.nodeGlobalDepth - (bucketDepth - 1); OHashTable.BucketPath currentNode = bucketPath; int nodeLocalDepth = bucketPath.nodeLocalDepth; @@ -1814,8 +1813,8 @@ private void initHashTreeState(OAtomicOperation atomicOperation) throws IOExcept OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setRecordsCount(0); } finally { hashStateEntry.releaseExclusiveLock(); @@ -1839,7 +1838,7 @@ private OHashTable.BucketPath getBucket(final long hashCode) throws IOException int offset = 0; int index = (int) ((hashCode >>> (HASH_CODE_SIZE - nodeDepth)) & (LEVEL_MASK >>> (MAX_LEVEL_DEPTH - localNodeDepth))); - OHashTable.BucketPath currentNode = new OHashTable.BucketPath(parentNode, 0, index, 0, localNodeDepth, nodeDepth); + OHashTable.BucketPath currentNode = new OHashTable.BucketPath(null, 0, index, 0, localNodeDepth, nodeDepth); do { final long position = directory.getNodePointer(nodeIndex, index + offset); if (position >= 0) diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable20.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable20.java index ae592e32f9d..08d72f31016 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable20.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OLocalHashTable20.java @@ -101,9 +101,9 @@ public class OLocalHashTable20 extends ODurableComponent implements OHashT private final String metadataConfigurationFileExtension; private final String treeStateFileExtension; - public static final int HASH_CODE_SIZE = 64; + public static final int HASH_CODE_SIZE = 64; public static final int MAX_LEVEL_DEPTH = 8; - public static final int MAX_LEVEL_SIZE = 1 << MAX_LEVEL_DEPTH; + public static final int MAX_LEVEL_SIZE = 1 << MAX_LEVEL_DEPTH; public static final int LEVEL_MASK = Integer.MAX_VALUE >>> (31 - MAX_LEVEL_DEPTH); @@ -111,12 +111,12 @@ public class OLocalHashTable20 extends ODurableComponent implements OHashT private OBinarySerializer keySerializer; private OBinarySerializer valueSerializer; - private OType[] keyTypes; + private OType[] keyTypes; private final KeyHashCodeComparator comparator; - private boolean nullKeyIsSupported; - private long nullBucketFileId = -1; + private boolean nullKeyIsSupported; + private long nullBucketFileId = -1; private final String nullBucketFileExtension; private long fileStateId; @@ -128,8 +128,8 @@ public class OLocalHashTable20 extends ODurableComponent implements OHashT private final boolean durableInNonTxMode; public OLocalHashTable20(String name, String metadataConfigurationFileExtension, String treeStateFileExtension, - String bucketFileExtension, String nullBucketFileExtension, OHashFunction keyHashFunction, boolean durableInNonTxMode, - OAbstractPaginatedStorage abstractPaginatedStorage) { + String bucketFileExtension, String nullBucketFileExtension, OHashFunction keyHashFunction, boolean durableInNonTxMode, + OAbstractPaginatedStorage abstractPaginatedStorage) { super(abstractPaginatedStorage, name, bucketFileExtension); this.metadataConfigurationFileExtension = metadataConfigurationFileExtension; @@ -143,7 +143,7 @@ public OLocalHashTable20(String name, String metadataConfigurationFileExtension, @Override public void create(OBinarySerializer keySerializer, OBinarySerializer valueSerializer, OType[] keyTypes, - boolean nullKeyIsSupported) { + boolean nullKeyIsSupported) { final OAtomicOperation atomicOperation; try { atomicOperation = startAtomicOperation(); @@ -173,8 +173,8 @@ public void create(OBinarySerializer keySerializer, OBinarySerializer valu hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), true); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), true); createFileMetadata(0, page, atomicOperation); hashStateEntryIndex = hashStateEntry.getPageIndex(); @@ -206,7 +206,6 @@ public void create(OBinarySerializer keySerializer, OBinarySerializer valu } } - @Override protected OAtomicOperation startAtomicOperation() throws IOException { return atomicOperationsManager.startAtomicOperation(this, !durableInNonTxMode); @@ -237,8 +236,8 @@ public void setKeySerializer(OBinarySerializer keySerializer) { OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setKeySerializerId(keySerializer.getId()); } finally { @@ -293,8 +292,8 @@ public void setValueSerializer(OBinarySerializer valueSerializer) { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setValueSerializerId(valueSerializer.getId()); } finally { @@ -338,8 +337,8 @@ public V get(K key) { V result = null; OCacheEntry cacheEntry = loadPage(atomicOperation, nullBucketFileId, 0, false); try { - ONullBucket nullBucket = new ONullBucket(cacheEntry, getChangesTree(atomicOperation, cacheEntry), - valueSerializer, false); + ONullBucket nullBucket = new ONullBucket(cacheEntry, getChangesTree(atomicOperation, cacheEntry), valueSerializer, + false); result = nullBucket.getValue(); } finally { releasePage(atomicOperation, cacheEntry); @@ -352,8 +351,8 @@ public V get(K key) { final long hashCode = keyHashFunction.hashCode(key); BucketPath bucketPath = getBucket(hashCode); - final long bucketPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long bucketPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); if (bucketPointer == 0) return null; @@ -463,7 +462,8 @@ public V remove(K key) { if (nodePath.parent != null) { final int hashMapSize = 1 << nodePath.nodeLocalDepth; - final boolean allMapsContainSameBucket = checkAllMapsContainSameBucket(directory.getNode(nodePath.nodeIndex), hashMapSize); + final boolean allMapsContainSameBucket = checkAllMapsContainSameBucket(directory.getNode(nodePath.nodeIndex), + hashMapSize); if (allMapsContainSameBucket) mergeNodeToParent(nodePath); } @@ -520,8 +520,8 @@ private void changeSize(int sizeDiff, OAtomicOperation atomicOperation) throws I OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree(atomicOperation, - hashStateEntry), false); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); page.setRecordsCount(page.getRecordsCount() + sizeDiff); } finally { @@ -545,8 +545,8 @@ public void clear() { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree(atomicOperation, - hashStateEntry), false); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); for (int i = 0; i < HASH_CODE_SIZE; i++) { if (!page.isRemoved(i)) { @@ -611,15 +611,15 @@ public OHashIndexBucket.Entry[] higherEntries(K key, int limit) { releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); fileLevel = getFileLevel(nextPointer); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } final int index = bucket.getIndex(hashCode, key); @@ -672,12 +672,12 @@ public void load(String name, OType[] keyTypes, boolean nullKeyIsSupported) { pinPage(atomicOperation, hashStateEntry); try { - OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree(atomicOperation, - hashStateEntry), false); + OHashIndexFileLevelMetadataPage page = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); keySerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance() .getObjectSerializer(page.getKeySerializerId()); - valueSerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance().getObjectSerializer( - page.getValueSerializerId()); + valueSerializer = (OBinarySerializer) OBinarySerializerFactory.getInstance() + .getObjectSerializer(page.getValueSerializerId()); for (int i = 0; i < HASH_CODE_SIZE; i++) if (!page.isRemoved(i)) @@ -711,8 +711,8 @@ public void deleteWithoutLoad(String name, OAbstractPaginatedStorage storageLoca OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, 0, true); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); for (int i = 0; i < HASH_CODE_SIZE; i++) { if (!metadataPage.isRemoved(i)) { final long fileId = metadataPage.getFileId(i); @@ -797,8 +797,7 @@ private BucketPath nextBucketToFind(final BucketPath bucketPath, int bucketDepth } private BucketPath nextNonEmptyNode(BucketPath bucketPath) throws IOException { - nextBucketLoop: - while (bucketPath != null) { + nextBucketLoop: while (bucketPath != null) { final long[] node = directory.getNode(bucketPath.nodeIndex); final int startIndex = bucketPath.itemIndex + bucketPath.hashMapOffset; final int endIndex = MAX_LEVEL_SIZE; @@ -823,8 +822,8 @@ private BucketPath nextNonEmptyNode(BucketPath bucketPath) throws IOException { bucketPath.nodeGlobalDepth); final int childLocalDepth = directory.getNodeLocalDepth(childNodeIndex); - bucketPath = new BucketPath(parent, childItemOffset, 0, childNodeIndex, childLocalDepth, bucketPath.nodeGlobalDepth - + childLocalDepth); + bucketPath = new BucketPath(parent, childItemOffset, 0, childNodeIndex, childLocalDepth, + bucketPath.nodeGlobalDepth + childLocalDepth); continue nextBucketLoop; } @@ -857,8 +856,8 @@ private BucketPath nextLevelUp(BucketPath bucketPath) throws IOException { if (nextParentIndex < MAX_LEVEL_SIZE) return new BucketPath(parent.parent, 0, nextParentIndex, parent.nodeIndex, parent.nodeLocalDepth, parent.nodeGlobalDepth); - return nextLevelUp(new BucketPath(parent.parent, 0, MAX_LEVEL_SIZE - 1, parent.nodeIndex, parent.nodeLocalDepth, - parent.nodeGlobalDepth)); + return nextLevelUp( + new BucketPath(parent.parent, 0, MAX_LEVEL_SIZE - 1, parent.nodeIndex, parent.nodeLocalDepth, parent.nodeGlobalDepth)); } @Override @@ -890,15 +889,15 @@ public OHashIndexBucket.Entry[] ceilingEntries(K key) { return OCommonConst.EMPTY_BUCKET_ENTRY_ARRAY; releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); fileLevel = getFileLevel(nextPointer); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } final int index = bucket.getIndex(hashCode, key); @@ -947,15 +946,15 @@ public OHashIndexBucket.Entry firstEntry() { return null; releasePage(atomicOperation, cacheEntry); - final long nextPointer = directory - .getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset); + final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, + bucketPath.itemIndex + bucketPath.hashMapOffset); fileLevel = getFileLevel(nextPointer); pageIndex = getPageIndex(nextPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); } return bucket.getEntry(0); @@ -997,15 +996,15 @@ public OHashIndexBucket.Entry lastEntry() { return null; releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); fileLevel = getFileLevel(prevPointer); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -1053,15 +1052,15 @@ public OHashIndexBucket.Entry[] lowerEntries(K key) { releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); fileLevel = getFileLevel(prevPointer); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -1117,16 +1116,16 @@ public OHashIndexBucket.Entry[] floorEntries(K key) { releasePage(atomicOperation, cacheEntry); - final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, prevBucketPath.itemIndex - + prevBucketPath.hashMapOffset); + final long prevPointer = directory.getNodePointer(prevBucketPath.nodeIndex, + prevBucketPath.itemIndex + prevBucketPath.hashMapOffset); fileLevel = getFileLevel(prevPointer); pageIndex = getPageIndex(prevPointer); cacheEntry = loadPageEntry(pageIndex, fileLevel, atomicOperation); - bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, cacheEntry)); + bucket = new OHashIndexBucket(cacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, cacheEntry)); bucketPath = prevBucketPath; } @@ -1188,8 +1187,7 @@ private BucketPath prevBucketToFind(final BucketPath bucketPath, int bucketDepth } private BucketPath prevNonEmptyNode(BucketPath nodePath) throws IOException { - prevBucketLoop: - while (nodePath != null) { + prevBucketLoop: while (nodePath != null) { final long[] node = directory.getNode(nodePath.nodeIndex); final int startIndex = 0; final int endIndex = nodePath.itemIndex + nodePath.hashMapOffset; @@ -1213,8 +1211,8 @@ private BucketPath prevNonEmptyNode(BucketPath nodePath) throws IOException { final BucketPath parent = new BucketPath(nodePath.parent, 0, i, nodePath.nodeIndex, nodePath.nodeLocalDepth, nodePath.nodeGlobalDepth); - nodePath = new BucketPath(parent, childItemOffset, endChildIndex, childNodeIndex, nodeLocalDepth, parent.nodeGlobalDepth - + nodeLocalDepth); + nodePath = new BucketPath(parent, childItemOffset, endChildIndex, childNodeIndex, nodeLocalDepth, + parent.nodeGlobalDepth + nodeLocalDepth); continue prevBucketLoop; } } @@ -1255,8 +1253,8 @@ public long size() { final OAtomicOperation atomicOperation = atomicOperationsManager.getCurrentOperation(); final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); return metadataPage.getRecordsCount(); } finally { releasePage(atomicOperation, hashStateEntry); @@ -1283,8 +1281,8 @@ public void close() { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { for (int i = 0; i < HASH_CODE_SIZE; i++) { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); if (!metadataPage.isRemoved(i)) { readCache.closeFile(metadataPage.getFileId(i), true, writeCache); } @@ -1315,8 +1313,8 @@ public void delete() { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { for (int i = 0; i < HASH_CODE_SIZE; i++) { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); if (!metadataPage.isRemoved(i)) { deleteFile(atomicOperation, metadataPage.getFileId(i)); } @@ -1440,8 +1438,8 @@ private void mergeBucketsAfterDeletion(BucketPath nodePath, OHashIndexBucket(buddyCacheEntry, keySerializer, valueSerializer, keyTypes, getChangesTree( - atomicOperation, buddyCacheEntry)); + buddyBucket = new OHashIndexBucket(buddyCacheEntry, keySerializer, valueSerializer, keyTypes, + getChangesTree(atomicOperation, buddyCacheEntry)); if (buddyBucket.getDepth() != bucketDepth) return; @@ -1449,8 +1447,8 @@ private void mergeBucketsAfterDeletion(BucketPath nodePath, OHashIndexBucket= OHashIndexBucket.MAX_BUCKET_SIZE_BYTES) return; - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setBucketsCount(buddyLevel, metadataPage.getBucketsCount(buddyLevel) - 2); int newBuddyLevel = buddyLevel - 1; @@ -1517,8 +1515,8 @@ public void flush() { final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { for (int i = 0; i < HASH_CODE_SIZE; i++) { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); if (!metadataPage.isRemoved(i)) writeCache.flush(metadataPage.getFileId(i)); } @@ -1622,7 +1620,7 @@ private void doPut(K key, V value, OAtomicOperation atomicOperation) throws IOEx if (bucketPath.nodeLocalDepth < MAX_LEVEL_DEPTH) { final NodeSplitResult nodeSplitResult = splitNode(bucketPath); - assert !(nodeSplitResult.allLeftHashMapsEqual && nodeSplitResult.allRightHashMapsEqual); + assert!(nodeSplitResult.allLeftHashMapsEqual && nodeSplitResult.allRightHashMapsEqual); final long[] newNode = nodeSplitResult.newNode; @@ -1680,7 +1678,7 @@ private void checkNullSupport(K key) { } private void updateNodesAfterSplit(BucketPath bucketPath, int nodeIndex, long[] newNode, int nodeLocalDepth, int hashMapSize, - boolean allLeftHashMapEquals, boolean allRightHashMapsEquals, int newNodeIndex) throws IOException { + boolean allLeftHashMapEquals, boolean allRightHashMapsEquals, int newNodeIndex) throws IOException { final int startIndex = findParentNodeStartIndex(bucketPath); @@ -1705,8 +1703,8 @@ private void updateNodesAfterSplit(BucketPath bucketPath, int nodeIndex, long[] } } else { for (int i = 0; i < pointersSize; i++) - directory.setNodePointer(parentNodeIndex, startIndex + pointersSize + i, (newNodeIndex << 8) | (i * hashMapSize) - | Long.MIN_VALUE); + directory.setNodePointer(parentNodeIndex, startIndex + pointersSize + i, + (newNodeIndex << 8) | (i * hashMapSize) | Long.MIN_VALUE); } updateMaxChildDepth(bucketPath.parent, bucketPath.nodeLocalDepth + 1); @@ -1955,7 +1953,7 @@ private NodeSplitResult splitNode(BucketPath bucketPath) throws IOException { } private void splitBucketContent(OHashIndexBucket bucket, OHashIndexBucket updatedBucket, - OHashIndexBucket newBucket, int newBucketDepth) throws IOException { + OHashIndexBucket newBucket, int newBucketDepth) throws IOException { assert checkBucketDepth(bucket); for (OHashIndexBucket.Entry entry : bucket) { @@ -1973,7 +1971,7 @@ private void splitBucketContent(OHashIndexBucket bucket, OHashIndexBucket< } private BucketSplitResult splitBucket(OHashIndexBucket bucket, int fileLevel, long pageIndex, - OAtomicOperation atomicOperation) throws IOException { + OAtomicOperation atomicOperation) throws IOException { int bucketDepth = bucket.getDepth(); int newBucketDepth = bucketDepth + 1; @@ -1982,8 +1980,8 @@ private BucketSplitResult splitBucket(OHashIndexBucket bucket, int fileLev hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); if (metadataPage.isRemoved(newFileLevel)) createFileMetadata(newFileLevel, metadataPage, atomicOperation); @@ -2108,8 +2106,8 @@ private void initHashTreeState(OAtomicOperation atomicOperation) throws IOExcept OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); hashStateEntry.acquireExclusiveLock(); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); metadataPage.setBucketsCount(0, MAX_LEVEL_SIZE); metadataPage.setRecordsCount(0); } finally { @@ -2134,8 +2132,8 @@ private OCacheEntry loadPageEntry(long pageIndex, int fileLevel, OAtomicOperatio final long fileId; final OCacheEntry hashStateEntry = loadPage(atomicOperation, fileStateId, hashStateEntryIndex, true); try { - OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, getChangesTree( - atomicOperation, hashStateEntry), false); + OHashIndexFileLevelMetadataPage metadataPage = new OHashIndexFileLevelMetadataPage(hashStateEntry, + getChangesTree(atomicOperation, hashStateEntry), false); fileId = metadataPage.getFileId(fileLevel); } finally { releasePage(atomicOperation, hashStateEntry); @@ -2156,7 +2154,7 @@ private BucketPath getBucket(final long hashCode) throws IOException { int offset = 0; int index = (int) ((hashCode >>> (HASH_CODE_SIZE - nodeDepth)) & (LEVEL_MASK >>> (MAX_LEVEL_DEPTH - localNodeDepth))); - BucketPath currentNode = new BucketPath(parentNode, 0, index, 0, localNodeDepth, nodeDepth); + BucketPath currentNode = new BucketPath(null, 0, index, 0, localNodeDepth, nodeDepth); do { final long position = directory.getNodePointer(nodeIndex, index + offset); if (position >= 0) diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OMurmurHash3HashFunction.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OMurmurHash3HashFunction.java index 43b9c80662a..1ef7452166e 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OMurmurHash3HashFunction.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/OMurmurHash3HashFunction.java @@ -21,11 +21,13 @@ import com.orientechnologies.common.hash.OMurmurHash3; import com.orientechnologies.common.serialization.types.OBinarySerializer; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * @author Andrey Lomakin * @since 12.03.13 */ +@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") public class OMurmurHash3HashFunction implements OHashFunction { private static final int SEED = 362498820; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTree.java b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTree.java index 357ea63302a..9863ef721a8 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTree.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTree.java @@ -47,7 +47,7 @@ */ @SuppressWarnings({ "unchecked", "serial" }) @SuppressFBWarnings(value = { "IT_NO_SUCH_ELEMENT", "SE_BAD_FIELD" }) -public abstract class OMVRBTree extends AbstractMap implements ONavigableMap, Cloneable, java.io.Serializable { +public abstract class OMVRBTree extends AbstractMapimplements ONavigableMap, Cloneable, java.io.Serializable { public static final boolean RED = false; public static final boolean BLACK = true; private static final OAlwaysLessKey ALWAYS_LESS_KEY = new OAlwaysLessKey(); @@ -93,10 +93,9 @@ public static enum PartialSearchMode { /** * Any partially matched key will be used as search result. */ - NONE, - /** - * The biggest partially matched key will be used as search result. - */ + NONE, /** + * The biggest partially matched key will be used as search result. + */ HIGHEST_BOUNDARY, /** @@ -106,7 +105,7 @@ public static enum PartialSearchMode { } @SuppressWarnings("rawtypes") - static final class KeySet extends AbstractSet implements ONavigableSet { + static final class KeySet extends AbstractSetimplements ONavigableSet { private final ONavigableMap m; KeySet(ONavigableMap map) { @@ -225,7 +224,7 @@ public ONavigableSet descendingSet() { /** * @serial include */ - static abstract class NavigableSubMap extends AbstractMap implements ONavigableMap, java.io.Serializable { + static abstract class NavigableSubMap extends AbstractMapimplements ONavigableMap, java.io.Serializable { /** * The backing map. */ @@ -519,14 +518,14 @@ final boolean inRange(final Object key, final boolean inclusive) { } final OMVRBTreeEntryPosition absLowest() { - OMVRBTreeEntry e = (fromStart ? m.getFirstEntry() : (loInclusive ? m.getCeilingEntry(lo, - PartialSearchMode.LOWEST_BOUNDARY) : m.getHigherEntry(lo))); + OMVRBTreeEntry e = (fromStart ? m.getFirstEntry() + : (loInclusive ? m.getCeilingEntry(lo, PartialSearchMode.LOWEST_BOUNDARY) : m.getHigherEntry(lo))); return (e == null || tooHigh(e.getKey())) ? null : new OMVRBTreeEntryPosition(e); } final OMVRBTreeEntryPosition absHighest() { - OMVRBTreeEntry e = (toEnd ? m.getLastEntry() : (hiInclusive ? m.getFloorEntry(hi, PartialSearchMode.HIGHEST_BOUNDARY) - : m.getLowerEntry(hi))); + OMVRBTreeEntry e = (toEnd ? m.getLastEntry() + : (hiInclusive ? m.getFloorEntry(hi, PartialSearchMode.HIGHEST_BOUNDARY) : m.getLowerEntry(hi))); return (e == null || tooLow(e.getKey())) ? null : new OMVRBTreeEntryPosition(e); } @@ -562,8 +561,9 @@ final OMVRBTreeEntryPosition absLower(K key) { * Returns the absolute high fence for ascending traversal */ final OMVRBTreeEntryPosition absHighFence() { - return (toEnd ? null : new OMVRBTreeEntryPosition(hiInclusive ? m.getHigherEntry(hi) : m.getCeilingEntry(hi, - PartialSearchMode.LOWEST_BOUNDARY))); + return (toEnd ? null + : new OMVRBTreeEntryPosition( + hiInclusive ? m.getHigherEntry(hi) : m.getCeilingEntry(hi, PartialSearchMode.LOWEST_BOUNDARY))); } // public methods @@ -572,8 +572,9 @@ final OMVRBTreeEntryPosition absHighFence() { * Return the absolute low fence for descending traversal */ final OMVRBTreeEntryPosition absLowFence() { - return (fromStart ? null : new OMVRBTreeEntryPosition(loInclusive ? m.getLowerEntry(lo) : m.getFloorEntry(lo, - PartialSearchMode.HIGHEST_BOUNDARY))); + return (fromStart ? null + : new OMVRBTreeEntryPosition( + loInclusive ? m.getLowerEntry(lo) : m.getFloorEntry(lo, PartialSearchMode.HIGHEST_BOUNDARY))); } abstract OMVRBTreeEntry subLowest(); @@ -768,8 +769,8 @@ public ONavigableMap tailMap(final K fromKey, final boolean inclusive) { public ONavigableMap descendingMap() { ONavigableMap mv = descendingMapView; - return (mv != null) ? mv : (descendingMapView = new DescendingSubMap(m, fromStart, lo, loInclusive, toEnd, hi, - hiInclusive)); + return (mv != null) ? mv + : (descendingMapView = new DescendingSubMap(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive)); } @Override @@ -865,8 +866,8 @@ public ONavigableMap tailMap(final K fromKey, final boolean inclusive) { public ONavigableMap descendingMap() { ONavigableMap mv = descendingMapView; - return (mv != null) ? mv : (descendingMapView = new AscendingSubMap(m, fromStart, lo, loInclusive, toEnd, hi, - hiInclusive)); + return (mv != null) ? mv + : (descendingMapView = new AscendingSubMap(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive)); } @Override @@ -954,6 +955,7 @@ public void clear() { } } + @SuppressFBWarnings("BC_UNCONFIRMED_CAST") public class EntrySet extends AbstractSet> { @Override public Iterator> iterator() { @@ -1516,7 +1518,7 @@ public final OMVRBTreeEntry getEntry(final Object key, final PartialSearch return getEntry(key, false, partialSearchMode); } - @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") + @SuppressFBWarnings({ "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", "UC_USELESS_CONDITION", "DLS_DEAD_LOCAL_STORE" }) final OMVRBTreeEntry getEntry(final Object key, final boolean iGetContainer, final PartialSearchMode partialSearchMode) { if (key == null) return setLastSearchNode(null, null); @@ -1728,9 +1730,10 @@ public OMVRBTreeEntry getHigherEntry(final K key) { if (pageItemFound) // MATCH, RETURN THE NEXT ONE return next(p); - else if (pageIndex < p.getSize()) - // NOT MATCHED, POSITION IS ALREADY TO THE NEXT ONE - return p; + else + if (pageIndex < p.getSize()) + // NOT MATCHED, POSITION IS ALREADY TO THE NEXT ONE + return p; return null; } @@ -2880,8 +2883,7 @@ private void buildFromSorted(final int size, final Iterator it, final java.io */ private final OMVRBTreeEntry buildFromSorted(final int level, final int lo, final int hi, final int redLevel, final Iterator it, final java.io.ObjectInputStream str, final V defaultVal) - throws java.io.IOException, - ClassNotFoundException { + throws java.io.IOException, ClassNotFoundException { /* * Strategy: The root is the middlemost element. To get to it, we have to first recursively construct the entire left subtree, * so as to grab all of its elements. We can then proceed with right subtree. diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeEntryMemory.java b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeEntryMemory.java old mode 100644 new mode 100755 index 37c65580a9d..340ba7f7697 --- a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeEntryMemory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeEntryMemory.java @@ -19,9 +19,12 @@ */ package com.orientechnologies.orient.core.index.mvrbtree; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import java.util.Arrays; @SuppressWarnings("unchecked") +@SuppressFBWarnings() public class OMVRBTreeEntryMemory extends OMVRBTreeEntry { protected int size = 1; diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeSet.java b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeSet.java index b74ec31c48d..98e1666e254 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeSet.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/mvrbtree/OMVRBTreeSet.java @@ -24,6 +24,7 @@ import com.orientechnologies.common.collection.ONavigableSet; import com.orientechnologies.common.exception.OException; import com.orientechnologies.orient.core.exception.ODatabaseException; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.AbstractSet; import java.util.Collection; @@ -34,6 +35,7 @@ import java.util.SortedSet; @SuppressWarnings("unchecked") +@SuppressFBWarnings("DMI_NONSERIALIZABLE_OBJECT_WRITTEN") public class OMVRBTreeSet extends AbstractSet implements ONavigableSet, Cloneable, java.io.Serializable { /** * The backing map. diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/OSBTreeMapEntryIterator.java b/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/OSBTreeMapEntryIterator.java index 4e7dece0a66..732068ca6b1 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/OSBTreeMapEntryIterator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/OSBTreeMapEntryIterator.java @@ -20,11 +20,7 @@ package com.orientechnologies.orient.core.index.sbtree; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; +import java.util.*; import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OIndexRIDContainer; @@ -38,7 +34,7 @@ public class OSBTreeMapEntryIterator implements Iterator> private K firstKey; private Map.Entry currentEntry; - private final int prefetchSize; + private final int prefetchSize; public OSBTreeMapEntryIterator(OTreeInternal sbTree) { this(sbTree, 8000); @@ -104,6 +100,9 @@ public boolean hasNext() { @Override public Map.Entry next() { + if (!hasNext()) + throw new NoSuchElementException(); + final Map.Entry entry = preFetchedValues.removeFirst(); if (preFetchedValues.isEmpty()) prefetchData(false); diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/local/OSBTree.java b/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/local/OSBTree.java index afa75644c35..59547666668 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/local/OSBTree.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/sbtree/local/OSBTree.java @@ -71,28 +71,28 @@ * @since 8/7/13 */ public class OSBTree extends ODurableComponent { - private static final int MAX_KEY_SIZE = OGlobalConfiguration.SBTREE_MAX_KEY_SIZE.getValueAsInteger(); - private static final int MAX_EMBEDDED_VALUE_SIZE = OGlobalConfiguration.SBTREE_MAX_EMBEDDED_VALUE_SIZE + private static final int MAX_KEY_SIZE = OGlobalConfiguration.SBTREE_MAX_KEY_SIZE.getValueAsInteger(); + private static final int MAX_EMBEDDED_VALUE_SIZE = OGlobalConfiguration.SBTREE_MAX_EMBEDDED_VALUE_SIZE .getValueAsInteger(); - private static final OAlwaysLessKey ALWAYS_LESS_KEY = new OAlwaysLessKey(); - private static final OAlwaysGreaterKey ALWAYS_GREATER_KEY = new OAlwaysGreaterKey(); + private static final OAlwaysLessKey ALWAYS_LESS_KEY = new OAlwaysLessKey(); + private static final OAlwaysGreaterKey ALWAYS_GREATER_KEY = new OAlwaysGreaterKey(); private static final int MAX_PATH_LENGTH = OGlobalConfiguration.SBTREE_MAX_DEPTH.getValueAsInteger(); - private final static long ROOT_INDEX = 0; - private final Comparator comparator = ODefaultComparator.INSTANCE; - private final String nullFileExtension; - private final boolean durableInNonTxMode; - private long fileId; - private long nullBucketFileId = -1; - private int keySize; - private OBinarySerializer keySerializer; - private OType[] keyTypes; - private OBinarySerializer valueSerializer; - private boolean nullPointerSupport; + private final static long ROOT_INDEX = 0; + private final Comparator comparator = ODefaultComparator.INSTANCE; + private final String nullFileExtension; + private final boolean durableInNonTxMode; + private long fileId; + private long nullBucketFileId = -1; + private int keySize; + private OBinarySerializer keySerializer; + private OType[] keyTypes; + private OBinarySerializer valueSerializer; + private boolean nullPointerSupport; public OSBTree(String name, String dataFileExtension, boolean durableInNonTxMode, String nullFileExtension, - OAbstractPaginatedStorage storage) { + OAbstractPaginatedStorage storage) { super(storage, name, dataFileExtension); acquireExclusiveLock(); try { @@ -104,7 +104,7 @@ public OSBTree(String name, String dataFileExtension, boolean durableInNonTxMode } public void create(OBinarySerializer keySerializer, OBinarySerializer valueSerializer, OType[] keyTypes, int keySize, - boolean nullPointerSupport) { + boolean nullPointerSupport) { assert keySerializer != null; final OAtomicOperation atomicOperation; try { @@ -146,13 +146,19 @@ public void create(OBinarySerializer keySerializer, OBinarySerializer valu } endAtomicOperation(false, null); - } catch (Exception e) { + } catch (IOException e) { try { endAtomicOperation(true, e); } catch (IOException e1) { OLogManager.instance().error(this, "Error during sbtree data rollback", e1); } throw new OSBTreeException("Error creation of sbtree with name" + getName(), e); + } catch (RuntimeException e) { + try { + endAtomicOperation(true, e); + } catch (IOException e1) { + OLogManager.instance().error(this, "Error during sbtree data rollback", e1); + } } finally { releaseExclusiveLock(); } @@ -190,8 +196,8 @@ public V get(K key) { final OCacheEntry nullBucketCacheEntry = loadPage(atomicOperation, nullBucketFileId, 0, false); try { - final ONullBucket nullBucket = new ONullBucket(nullBucketCacheEntry, getChangesTree(atomicOperation, - nullBucketCacheEntry), valueSerializer, false); + final ONullBucket nullBucket = new ONullBucket(nullBucketCacheEntry, + getChangesTree(atomicOperation, nullBucketCacheEntry), valueSerializer, false); final OSBTreeValue treeValue = nullBucket.getValue(); if (treeValue == null) return null; @@ -228,8 +234,8 @@ public void put(K key, V value) { final int valueSize = valueSerializer.getObjectSize(value); if (keySize > MAX_KEY_SIZE) - throw new OSBTreeException("Key size is more than allowed, operation was canceled. Current key size " + keySize - + ", allowed " + MAX_KEY_SIZE); + throw new OSBTreeException( + "Key size is more than allowed, operation was canceled. Current key size " + keySize + ", allowed " + MAX_KEY_SIZE); final boolean createLinkToTheValue = valueSize > MAX_EMBEDDED_VALUE_SIZE; @@ -283,8 +289,8 @@ public void put(K key, V value) { keyBucketCacheEntry = loadPage(atomicOperation, fileId, bucketSearchResult.getLastPathItem(), false); keyBucketCacheEntry.acquireExclusiveLock(); - keyBucket = new OSBTreeBucket(keyBucketCacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, keyBucketCacheEntry)); + keyBucket = new OSBTreeBucket(keyBucketCacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, keyBucketCacheEntry)); } keyBucketCacheEntry.releaseExclusiveLock(); @@ -336,7 +342,7 @@ public void put(K key, V value) { } catch (IOException e) { rollback(e); throw new OSBTreeException("Error during index update with key " + key + " and value " + value, e); - } catch (Exception e) { + } catch (RuntimeException e) { rollback(e); throw new OSBTreeException("Error during index update with key " + key + " and value " + value, e); } finally { @@ -400,7 +406,7 @@ public void clear() { rollback(e); throw new OSBTreeException("Error during clear of sbtree with name " + getName(), e); - } catch (Exception e) { + } catch (RuntimeException e) { rollback(e); throw new OSBTreeException(e); } finally { @@ -468,7 +474,7 @@ public void deleteWithoutLoad(String name) { } public void load(String name, OBinarySerializer keySerializer, OStreamSerializer valueSerializer, OType[] keyTypes, - int keySize, boolean nullPointerSupport) { + int keySize, boolean nullPointerSupport) { acquireExclusiveLock(); try { this.keySize = keySize; @@ -486,8 +492,10 @@ public void load(String name, OBinarySerializer keySerializer, OStreamSeriali nullBucketFileId = openFile(atomicOperation, name + nullFileExtension); this.keySerializer = keySerializer; - if (keySerializer == null) - System.out.println("sdf"); + + if (!(valueSerializer instanceof OBinarySerializer)) + throw new IllegalArgumentException( + "Value serializer should implement " + OBinarySerializer.class.getSimpleName() + " interface."); this.valueSerializer = (OBinarySerializer) valueSerializer; } catch (IOException e) { @@ -598,7 +606,7 @@ public V remove(K key) { rollback(e); throw new OSBTreeException("Error during removing key " + key + " from sbtree " + getName(), e); - } catch (Exception e) { + } catch (RuntimeException e) { rollback(e); throw new OSBTreeException("Error during removing key " + key + " from sbtree " + getName(), e); @@ -734,7 +742,7 @@ public K next(int prefetchSize) { } public OSBTreeCursor iterateEntriesBetween(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, - boolean ascSortOrder) { + boolean ascSortOrder) { atomicOperationsManager.acquireReadLock(this); try { acquireSharedLock(); @@ -748,8 +756,8 @@ public OSBTreeCursor iterateEntriesBetween(K keyFrom, boolean fromInclusiv releaseSharedLock(); } } catch (IOException ioe) { - throw new OSBTreeException("Error during fetch of values between key " + keyFrom + " and key " + keyTo + " in sbtree " - + getName(), ioe); + throw new OSBTreeException( + "Error during fetch of values between key " + keyFrom + " and key " + keyTo + " in sbtree " + getName(), ioe); } finally { atomicOperationsManager.releaseReadLock(this); } @@ -917,8 +925,8 @@ private long allocateValuePageFromFreeList(OAtomicOperation atomicOperation) thr rootCacheEntry = loadPage(atomicOperation, fileId, ROOT_INDEX, false); rootCacheEntry.acquireExclusiveLock(); - rootBucket = new OSBTreeBucket(rootCacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, rootCacheEntry)); + rootBucket = new OSBTreeBucket(rootCacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, rootCacheEntry)); try { rootBucket.setValuesFreeListFirstIndex(nextFreeListIndex); } finally { @@ -977,7 +985,8 @@ private OSBTreeCursor iterateEntriesMinorDesc(K key, boolean inclusive, OA return new OSBTreeCursorBackward(pageIndex, index, null, key, false, inclusive); } - private OSBTreeCursor iterateEntriesMinorAsc(K key, boolean inclusive, OAtomicOperation atomicOperation) throws IOException { + private OSBTreeCursor iterateEntriesMinorAsc(K key, boolean inclusive, OAtomicOperation atomicOperation) + throws IOException { acquireSharedLock(); try { key = keySerializer.preprocess(key, (Object[]) keyTypes); @@ -1024,7 +1033,8 @@ private K enhanceCompositeKeyMinorAsc(K key, boolean inclusive) { return key; } - private OSBTreeCursor iterateEntriesMajorAsc(K key, boolean inclusive, OAtomicOperation atomicOperation) throws IOException { + private OSBTreeCursor iterateEntriesMajorAsc(K key, boolean inclusive, OAtomicOperation atomicOperation) + throws IOException { key = keySerializer.preprocess(key, (Object[]) keyTypes); key = enhanceCompositeKeyMajorAsc(key, inclusive); @@ -1097,8 +1107,8 @@ private BucketSearchResult firstItem(OAtomicOperation atomicOperation) throws IO OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, bucketIndex, false); int itemIndex = 0; - OSBTreeBucket bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, cacheEntry)); + OSBTreeBucket bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, cacheEntry)); try { while (true) { if (!bucket.isLeaf()) { @@ -1145,8 +1155,8 @@ private BucketSearchResult firstItem(OAtomicOperation atomicOperation) throws IO releasePage(atomicOperation, cacheEntry); cacheEntry = loadPage(atomicOperation, fileId, bucketIndex, false); - bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree(atomicOperation, - cacheEntry)); + bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, cacheEntry)); } } finally { releasePage(atomicOperation, cacheEntry); @@ -1159,8 +1169,8 @@ private BucketSearchResult lastItem(OAtomicOperation atomicOperation) throws IOE long bucketIndex = ROOT_INDEX; OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, bucketIndex, false); - OSBTreeBucket bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, cacheEntry)); + OSBTreeBucket bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, cacheEntry)); int itemIndex = bucket.size() - 1; try { @@ -1210,8 +1220,8 @@ private BucketSearchResult lastItem(OAtomicOperation atomicOperation) throws IOE releasePage(atomicOperation, cacheEntry); cacheEntry = loadPage(atomicOperation, fileId, bucketIndex, false); - bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree(atomicOperation, - cacheEntry)); + bucket = new OSBTreeBucket(cacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, cacheEntry)); if (itemIndex == OSBTreeBucket.MAX_PAGE_SIZE_BYTES + 1) itemIndex = bucket.size() - 1; } @@ -1221,7 +1231,7 @@ private BucketSearchResult lastItem(OAtomicOperation atomicOperation) throws IOE } private OSBTreeCursor iterateEntriesBetweenAscOrder(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, - OAtomicOperation atomicOperation) throws IOException { + OAtomicOperation atomicOperation) throws IOException { keyFrom = keySerializer.preprocess(keyFrom, (Object[]) keyTypes); keyTo = keySerializer.preprocess(keyTo, (Object[]) keyTypes); @@ -1243,7 +1253,7 @@ private OSBTreeCursor iterateEntriesBetweenAscOrder(K keyFrom, boolean fro } private OSBTreeCursor iterateEntriesBetweenDescOrder(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, - OAtomicOperation atomicOperation) throws IOException { + OAtomicOperation atomicOperation) throws IOException { keyFrom = keySerializer.preprocess(keyFrom, (Object[]) keyTypes); keyTo = keySerializer.preprocess(keyTo, (Object[]) keyTypes); @@ -1345,8 +1355,8 @@ private BucketSearchResult splitBucket(List path, int keyIndex, K keyToIns } private BucketSearchResult splitNonRootBucket(List path, int keyIndex, K keyToInsert, long pageIndex, - OSBTreeBucket bucketToSplit, boolean splitLeaf, int indexToSplit, K separationKey, - List> rightEntries, OAtomicOperation atomicOperation) throws IOException { + OSBTreeBucket bucketToSplit, boolean splitLeaf, int indexToSplit, K separationKey, + List> rightEntries, OAtomicOperation atomicOperation) throws IOException { OCacheEntry rightBucketEntry = addPage(atomicOperation, fileId); rightBucketEntry.acquireExclusiveLock(); @@ -1405,8 +1415,8 @@ private BucketSearchResult splitNonRootBucket(List path, int keyIndex, K k insertionIndex = bucketSearchResult.itemIndex; - parentBucket = new OSBTreeBucket(parentCacheEntry, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, parentCacheEntry)); + parentBucket = new OSBTreeBucket(parentCacheEntry, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, parentCacheEntry)); } } finally { @@ -1436,8 +1446,8 @@ private BucketSearchResult splitNonRootBucket(List path, int keyIndex, K k } private BucketSearchResult splitRootBucket(List path, int keyIndex, K keyToInsert, long pageIndex, OCacheEntry bucketEntry, - OSBTreeBucket bucketToSplit, boolean splitLeaf, int indexToSplit, K separationKey, - List> rightEntries, OAtomicOperation atomicOperation) throws IOException { + OSBTreeBucket bucketToSplit, boolean splitLeaf, int indexToSplit, K separationKey, + List> rightEntries, OAtomicOperation atomicOperation) throws IOException { final long freeListPage = bucketToSplit.getValuesFreeListFirstIndex(); final long treeSize = bucketToSplit.getTreeSize(); @@ -1476,14 +1486,15 @@ private BucketSearchResult splitRootBucket(List path, int keyIndex, K keyT releasePage(atomicOperation, rightBucketEntry); } - bucketToSplit = new OSBTreeBucket(bucketEntry, false, keySerializer, keyTypes, valueSerializer, getChangesTree( - atomicOperation, bucketEntry)); + bucketToSplit = new OSBTreeBucket(bucketEntry, false, keySerializer, keyTypes, valueSerializer, + getChangesTree(atomicOperation, bucketEntry)); bucketToSplit.setTreeSize(treeSize); bucketToSplit.setValuesFreeListFirstIndex(freeListPage); - bucketToSplit.addEntry(0, new OSBTreeBucket.SBTreeEntry(leftBucketEntry.getPageIndex(), rightBucketEntry.getPageIndex(), - separationKey, null), true); + bucketToSplit.addEntry(0, + new OSBTreeBucket.SBTreeEntry(leftBucketEntry.getPageIndex(), rightBucketEntry.getPageIndex(), separationKey, null), + true); ArrayList resultPath = new ArrayList(path.subList(0, path.size() - 1)); @@ -1625,10 +1636,9 @@ private static enum PartialSearchMode { /** * Any partially matched key will be used as search result. */ - NONE, - /** - * The biggest partially matched key will be used as search result. - */ + NONE, /** + * The biggest partially matched key will be used as search result. + */ HIGHEST_BOUNDARY, /** @@ -1646,7 +1656,7 @@ public interface OSBTreeKeyCursor { } private static class BucketSearchResult { - private final int itemIndex; + private final int itemIndex; private final ArrayList path; private BucketSearchResult(int itemIndex, ArrayList path) { @@ -1661,7 +1671,7 @@ public long getLastPathItem() { private static final class PagePathItemUnit { private final long pageIndex; - private final int itemIndex; + private final int itemIndex; private PagePathItemUnit(long pageIndex, int itemIndex) { this.pageIndex = pageIndex; @@ -1671,9 +1681,9 @@ private PagePathItemUnit(long pageIndex, int itemIndex) { public class OSBTreeFullKeyCursor implements OSBTreeKeyCursor { private long pageIndex; - private int itemIndex; + private int itemIndex; - private List keysCache = new ArrayList(); + private List keysCache = new ArrayList(); private Iterator keysIterator = new OEmptyIterator(); public OSBTreeFullKeyCursor(long startPageIndex) { @@ -1751,19 +1761,19 @@ public K next(int prefetchSize) { } private final class OSBTreeCursorForward implements OSBTreeCursor { - private final K fromKey; - private final K toKey; + private final K fromKey; + private final K toKey; private final boolean fromKeyInclusive; private final boolean toKeyInclusive; private long pageIndex; - private int itemIndex; + private int itemIndex; - private List> dataCache = new ArrayList>(); + private List> dataCache = new ArrayList>(); private Iterator> dataCacheIterator = OEmptyMapEntryIterator.INSTANCE; private OSBTreeCursorForward(long startPageIndex, int startItemIndex, K fromKey, K toKey, boolean fromKeyInclusive, - boolean toKeyInclusive) { + boolean toKeyInclusive) { this.fromKey = fromKey; this.toKey = toKey; this.fromKeyInclusive = fromKeyInclusive; @@ -1817,13 +1827,11 @@ public Map.Entry next(int prefetchSize) { final Map.Entry entry = convertToMapEntry(bucket.getEntry(itemIndex), atomicOperation); itemIndex++; - if (fromKey != null - && (fromKeyInclusive ? comparator.compare(entry.getKey(), fromKey) < 0 : comparator.compare(entry.getKey(), - fromKey) <= 0)) + if (fromKey != null && (fromKeyInclusive ? comparator.compare(entry.getKey(), fromKey) < 0 + : comparator.compare(entry.getKey(), fromKey) <= 0)) continue; - if (toKey != null - && (toKeyInclusive ? comparator.compare(entry.getKey(), toKey) > 0 + if (toKey != null && (toKeyInclusive ? comparator.compare(entry.getKey(), toKey) > 0 : comparator.compare(entry.getKey(), toKey) >= 0)) { pageIndex = -1; break; @@ -1855,19 +1863,19 @@ public Map.Entry next(int prefetchSize) { } private final class OSBTreeCursorBackward implements OSBTreeCursor { - private final K fromKey; - private final K toKey; + private final K fromKey; + private final K toKey; private final boolean fromKeyInclusive; private final boolean toKeyInclusive; private long pageIndex; - private int itemIndex; + private int itemIndex; - private List> dataCache = new ArrayList>(); + private List> dataCache = new ArrayList>(); private Iterator> dataCacheIterator = OEmptyMapEntryIterator.INSTANCE; private OSBTreeCursorBackward(long endPageIndex, int endItemIndex, K fromKey, K toKey, boolean fromKeyInclusive, - boolean toKeyInclusive) { + boolean toKeyInclusive) { this.fromKey = fromKey; this.toKey = toKey; this.fromKeyInclusive = fromKeyInclusive; @@ -1919,14 +1927,12 @@ public Map.Entry next(int prefetchSize) { final Map.Entry entry = convertToMapEntry(bucket.getEntry(itemIndex), atomicOperation); itemIndex--; - if (toKey != null - && (toKeyInclusive ? comparator.compare(entry.getKey(), toKey) > 0 + if (toKey != null && (toKeyInclusive ? comparator.compare(entry.getKey(), toKey) > 0 : comparator.compare(entry.getKey(), toKey) >= 0)) continue; - if (fromKey != null - && (fromKeyInclusive ? comparator.compare(entry.getKey(), fromKey) < 0 : comparator.compare(entry.getKey(), - fromKey) <= 0)) { + if (fromKey != null && (fromKeyInclusive ? comparator.compare(entry.getKey(), fromKey) < 0 + : comparator.compare(entry.getKey(), fromKey) <= 0)) { pageIndex = -1; break; } diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/sbtreebonsai/local/OSBTreeBonsaiLocal.java b/core/src/main/java/com/orientechnologies/orient/core/index/sbtreebonsai/local/OSBTreeBonsaiLocal.java index b4591809889..46f3d54e1ad 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/index/sbtreebonsai/local/OSBTreeBonsaiLocal.java +++ b/core/src/main/java/com/orientechnologies/orient/core/index/sbtreebonsai/local/OSBTreeBonsaiLocal.java @@ -327,7 +327,11 @@ public void clear() { recycleSubTrees(subTreesToDelete, atomicOperation); endAtomicOperation(false, null); - } catch (Exception e) { + } catch (IOException e) { + rollback(e); + + throw new OSBTreeException("Error during clear of sbtree with name " + getName(), e); + } catch (RuntimeException e) { rollback(e); throw new OSBTreeException("Error during clear of sbtree with name " + getName(), e); @@ -542,7 +546,11 @@ public V remove(K key) { endAtomicOperation(false, null); return removed; - } catch (Exception e) { + } catch (IOException e) { + rollback(e); + + throw new OSBTreeException("Error during removing key " + key + " from sbtree " + getName(), e); + } catch (RuntimeException e) { rollback(e); throw new OSBTreeException("Error during removing key " + key + " from sbtree " + getName(), e); @@ -1235,13 +1243,13 @@ private AllocationResult allocateBucket(OAtomicOperation atomicOperation) throws final long pageIndex = cacheEntry.getPageIndex(); sysBucket.setFreeSpacePointer(new OBonsaiBucketPointer(pageIndex, OSBTreeBonsaiBucket.MAX_BUCKET_SIZE_BYTES)); - return new AllocationResult(new OBonsaiBucketPointer(pageIndex, 0), cacheEntry, true); + return new AllocationResult(new OBonsaiBucketPointer(pageIndex, 0), cacheEntry); } else { sysBucket.setFreeSpacePointer(new OBonsaiBucketPointer(freeSpacePointer.getPageIndex(), freeSpacePointer.getPageOffset() + OSBTreeBonsaiBucket.MAX_BUCKET_SIZE_BYTES)); final OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, freeSpacePointer.getPageIndex(), false); - return new AllocationResult(freeSpacePointer, cacheEntry, false); + return new AllocationResult(freeSpacePointer, cacheEntry); } } } finally { @@ -1265,7 +1273,7 @@ private AllocationResult reuseBucketFromFreeList(OSysBucket sysBucket, OAtomicOp } finally { cacheEntry.releaseExclusiveLock(); } - return new AllocationResult(oldFreeListHead, cacheEntry, false); + return new AllocationResult(oldFreeListHead, cacheEntry); } @Override @@ -1319,12 +1327,10 @@ public OBinarySerializer getValueSerializer() { private static class AllocationResult { private final OBonsaiBucketPointer pointer; private final OCacheEntry cacheEntry; - private final boolean newPage; - private AllocationResult(OBonsaiBucketPointer pointer, OCacheEntry cacheEntry, boolean newPage) { + private AllocationResult(OBonsaiBucketPointer pointer, OCacheEntry cacheEntry) { this.pointer = pointer; this.cacheEntry = cacheEntry; - this.newPage = newPage; } private OBonsaiBucketPointer getPointer() { diff --git a/pom.xml b/pom.xml index 1fee91b9fc2..09b6879da78 100755 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ language governing permissions and ~ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.orientechnologies @@ -139,11 +139,11 @@ yyyy-MM-dd HH:mm:ssZ ${scmBranch}@r${buildNumber} - + ${project.groupId}.*;version=${project.version};-noimport:=true * - - + + 2.17 https://oss.sonatype.org/content/repositories/snapshots/ @@ -189,18 +189,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.8 - - - - org.apache.maven.plugins - maven-pmd-plugin - 2.6 - - @@ -220,7 +208,7 @@ - + @@ -383,7 +371,7 @@ - + org.jacoco jacoco-maven-plugin @@ -404,29 +392,6 @@ 2.6 - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.8 - - - - org.apache.maven.plugins - maven-pmd-plugin - 2.6 - - 1.6 - - /rulesets/basic.xml - /rulesets/controversial.xml - - xml - true - utf-8 - 100 - - - org.apache.maven.plugins maven-javadoc-plugin