Skip to content

Commit

Permalink
Update a bunch of dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
archiecobbs committed Mar 30, 2018
1 parent 3f99dea commit e2e4e7e
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 86 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
@@ -1,3 +1,7 @@
Version 4.1.0

- Updated a bunch of dependencies

Version 4.0.3 Released January 20, 2018

- Removed CLI functions obsoleted by Java 8: apply(), filter(), foreach(), transform()
Expand Down
5 changes: 5 additions & 0 deletions permazen-coreapi/src/spotbugs/spotbugs-exclude.xml
Expand Up @@ -67,4 +67,9 @@
<Field name="versionChangeListeners"/>
<Bug pattern="IS_FIELD_NOT_GUARDED"/>
</Match>
<Match>
<Class name="io.permazen.core.type.StringConvertedType"/>
<Method name="write"/>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
</FindBugsFilter>
Expand Up @@ -10,6 +10,7 @@
import io.permazen.core.CoreAPITestSupport;
import io.permazen.core.FieldType;
import io.permazen.core.FieldTypeRegistry;
import io.permazen.test.TestSupport;
import io.permazen.util.ByteReader;
import io.permazen.util.ByteUtil;
import io.permazen.util.ByteWriter;
Expand Down Expand Up @@ -194,11 +195,11 @@ else if (actual instanceof short[])
else if (actual instanceof int[])
Assert.assertEquals((int[])expected, (int[])actual, message);
else if (actual instanceof float[])
Assert.assertEquals((float[])expected, (float[])actual, message);
TestSupport.assertEquals((float[])expected, (float[])actual, message);
else if (actual instanceof long[])
Assert.assertEquals((long[])expected, (long[])actual, message);
else if (actual instanceof double[])
Assert.assertEquals((double[])expected, (double[])actual, message);
TestSupport.assertEquals((double[])expected, (double[])actual, message);
else if (actual instanceof Object[])
Assert.assertTrue(Arrays.deepEquals((Object[])expected, (Object[])actual), message);
}
Expand Down
10 changes: 6 additions & 4 deletions permazen-demo/pom.xml
Expand Up @@ -134,7 +134,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<version>${maven.jar.plugin.version}</version>
<configuration>
<excludes>
<exclude>log4j.xml</exclude>
Expand All @@ -149,7 +149,8 @@
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.parent.artifactId}-cli</finalName>
<finalName>${project.parent.artifactId}</finalName>
<classifier>cli</classifier>
<excludes>
<exclude>**/*.class</exclude>
</excludes>
Expand All @@ -170,7 +171,8 @@
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.parent.artifactId}-gui</finalName>
<finalName>${project.parent.artifactId}</finalName>
<classifier>gui</classifier>
<excludes>
<exclude>**/*.class</exclude>
</excludes>
Expand All @@ -190,7 +192,7 @@
<!-- Build demo distribution -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven.assembly.plugin.version}</version>
<configuration>
<descriptors>
<descriptor>src/assembly/dist.xml</descriptor>
Expand Down
2 changes: 1 addition & 1 deletion permazen-guiapp/pom.xml
Expand Up @@ -106,7 +106,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
<version>${aspectj.maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
Expand Down
Expand Up @@ -8,7 +8,7 @@
import io.permazen.kv.KVDatabase;
import io.permazen.kv.test.KVDatabaseTest;

import org.postgresql.ds.PGPoolingDataSource;
import org.postgresql.ds.PGSimpleDataSource;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
Expand All @@ -21,7 +21,7 @@ public class CockroachKVDatabaseTest extends KVDatabaseTest {
@Parameters("cockroachURL")
public void setCockroachURL(@Optional String cockroachURL) {
if (cockroachURL != null) {
final PGPoolingDataSource dataSource = new PGPoolingDataSource();
final PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setUrl(cockroachURL);
this.cockroachKV = new CockroachKVDatabase();
this.cockroachKV.setDataSource(dataSource);
Expand Down
Expand Up @@ -10,6 +10,7 @@
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;

import io.permazen.kv.KVDatabase;
import io.permazen.kv.KVTransaction;
Expand Down Expand Up @@ -849,7 +850,7 @@ public void onFailure(Throwable t) {
public void onSuccess(Void value) {
FallbackFuture.this.notifyAsync(null);
}
});
}, MoreExecutors.directExecutor());
}

@Override
Expand Down
Expand Up @@ -245,11 +245,11 @@ public synchronized void mutate(Mutations mutations, boolean sync) {
final byte[] min = range.getMin();
final byte[] max = range.getMax();
if (min != null && max != null && ByteUtil.isConsecutive(min, max))
batch.remove(min);
batch.delete(min);
else {
try (RocksDBKVStore.Iterator i = this.kv.createIterator(iteratorOptions, min, max, false)) {
while (i.hasNext())
batch.remove(i.next().getKey());
batch.delete(i.next().getKey());
}
}
}
Expand Down
Expand Up @@ -111,6 +111,7 @@ public byte[] get(byte[] key) {

@Override
public CloseableIterator<KVPair> getRange(byte[] minKey, byte[] maxKey, boolean reverse) {
Preconditions.checkState(!this.closed, "closed");
return this.createIterator(this.readOptions, minKey, maxKey, reverse);
}

Expand All @@ -123,7 +124,11 @@ public void put(byte[] key, byte[] value) {
if (this.writeBatch != null) {
assert RocksDBUtil.isInitialized(this.writeBatch);
synchronized (this.writeBatch) {
this.writeBatch.put(key, value);
try {
this.writeBatch.put(key, value);
} catch (RocksDBException e) {
throw new RuntimeException("RocksDB error", e);
}
}
} else {
assert RocksDBUtil.isInitialized(this.db);
Expand All @@ -143,12 +148,16 @@ public void remove(byte[] key) {
if (this.writeBatch != null) {
assert RocksDBUtil.isInitialized(this.writeBatch);
synchronized (this.writeBatch) {
this.writeBatch.remove(key);
try {
this.writeBatch.delete(key);
} catch (RocksDBException e) {
throw new RuntimeException("RocksDB error", e);
}
}
} else {
assert RocksDBUtil.isInitialized(this.db);
try {
this.db.remove(key);
this.db.delete(key);
} catch (RocksDBException e) {
throw new RuntimeException("RocksDB error", e);
}
Expand Down Expand Up @@ -194,7 +203,11 @@ public void adjustCounter(byte[] key, long amount) {
if (this.writeBatch != null) {
assert RocksDBUtil.isInitialized(this.writeBatch);
synchronized (this.writeBatch) {
this.writeBatch.merge(key, value);
try {
this.writeBatch.merge(key, value);
} catch (RocksDBException e) {
throw new RuntimeException("RocksDB error", e);
}
}
} else {
assert RocksDBUtil.isInitialized(this.db);
Expand Down Expand Up @@ -259,7 +272,7 @@ Iterator createIterator(ReadOptions readOptions, byte[] minKey, byte[] maxKey, b
this.cursorTracker.poll();
assert RocksDBUtil.isInitialized(this.db);
assert RocksDBUtil.isInitialized(readOptions);
assert readOptions.snapshot() == null || RocksDBUtil.isInitialized(readOptions.snapshot());
//assert readOptions.snapshot() == null || RocksDBUtil.isInitialized(readOptions.snapshot());
return new Iterator(this.db.newIterator(readOptions), minKey, maxKey, reverse);
}

Expand Down
2 changes: 1 addition & 1 deletion permazen-main/pom.xml
Expand Up @@ -97,7 +97,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>${maven.shade.plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
11 changes: 2 additions & 9 deletions permazen-maven-plugin/pom.xml
Expand Up @@ -20,9 +20,6 @@
<url>file://${project.basedir}/../site/${project.artifactId}/</url>
</site>
</distributionManagement>
<properties>
<plugin.tools.version>3.5</plugin.tools.version>
</properties>
<dependencies>

<!-- Siblings -->
Expand All @@ -46,22 +43,18 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${plugin-api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>3.0-alpha-2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>${plugin.tools.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand All @@ -70,7 +63,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${plugin.tools.version}</version>
<version>${maven.plugin.tools.version}</version>
<executions>
<execution>
<id>default-descriptor</id>
Expand All @@ -91,7 +84,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${plugin.tools.version}</version>
<version>${maven.plugin.tools.version}</version>
</plugin>
</plugins>
</reporting>
Expand Down
Expand Up @@ -495,7 +495,8 @@ public Stream<String> findCompletions(ParseSession session) {
final int npos = uri.lastIndexOf(this.prefix.replace('.', '/'));
name = uri.substring(npos).replace('/', '.');
} else {
name = resource.getFilename();
if ((name = resource.getFilename()) == null)
continue;
}
if (name.endsWith(".class")) // should always be the case
name = name.substring(0, name.length() - 6);
Expand Down
Expand Up @@ -122,6 +122,10 @@ protected JObject readInternal(Class<? extends JObject> type, HttpInputMessage i

// Get the root object's ID
final MediaType mediaType = input.getHeaders().getContentType();
if (mediaType == null) {
throw new HttpMessageNotReadableException("required parameter `" + ROOT_OBJECT_ID_PARAMETER_NAME
+ "' missing; no `Content-Type' header found");
}
final String objId = mediaType.getParameter(ROOT_OBJECT_ID_PARAMETER_NAME);
if (objId == null) {
throw new HttpMessageNotReadableException("required parameter `" + ROOT_OBJECT_ID_PARAMETER_NAME
Expand Down
Expand Up @@ -33,24 +33,27 @@ public class PermazenExceptionTranslator implements PersistenceExceptionTranslat

@Override
public DataAccessException translateExceptionIfPossible(RuntimeException e0) {
if (e0 == null)
return null;
final String message = e0.getMessage() != null ? e0.getMessage() : "wrapped exception";
if (e0 instanceof DeletedObjectException) {
final DeletedObjectException e = (DeletedObjectException)e0;
return new EmptyResultDataAccessException("object " + e.getId() + " not found", 1, e);
}
if (e0 instanceof InvalidSchemaException)
return new InvalidDataAccessResourceUsageException(null, e0);
return new InvalidDataAccessResourceUsageException(message, e0);
if (e0 instanceof ReferencedObjectException)
return new DataIntegrityViolationException(null, e0);
return new DataIntegrityViolationException(message, e0);
if (e0 instanceof RollbackOnlyTransactionException)
return new InvalidDataAccessApiUsageException(null, e0);
return new InvalidDataAccessApiUsageException(message, e0);
if (e0 instanceof SchemaMismatchException)
return new DataIntegrityViolationException(null, e0);
return new DataIntegrityViolationException(message, e0);
if (e0 instanceof StaleTransactionException || e0 instanceof io.permazen.kv.StaleTransactionException)
return new InvalidDataAccessApiUsageException(null, e0);
return new InvalidDataAccessApiUsageException(message, e0);
if (e0 instanceof RetryTransactionException)
return new ConcurrencyFailureException(null, e0);
return new ConcurrencyFailureException(message, e0);
if (e0 instanceof TransactionTimeoutException)
return new QueryTimeoutException(null, e0);
return new QueryTimeoutException(message, e0);
return null;
}
}
Expand Down
5 changes: 5 additions & 0 deletions permazen-spring/src/spotbugs/spotbugs-exclude.xml
Expand Up @@ -13,4 +13,9 @@
<Field name="initialContentResource"/>
<Bug pattern="SE_BAD_FIELD"/>
</Match>
<Match>
<Class name="io.permazen.spring.ScanClassPathBeanDefinitionParser"/>
<Method name="parse"/>
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>
</FindBugsFilter>
23 changes: 23 additions & 0 deletions permazen-test/src/main/java/io/permazen/test/TestSupport.java
Expand Up @@ -22,6 +22,7 @@
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -248,6 +249,28 @@ private static void checkMap(Map actual, Map expected, boolean recurse) {
TestSupport.checkMap(actual, ((NavigableMap)expected).descendingMap(), false);
}

// Workaround https://github.com/cbeust/testng/issues/1734
public static void assertEquals(float[] a1, float[] a2, String message) {
try {
Assert.assertEquals(a1, a2, message);
} catch (AssertionError e) {
if (a1 != null && a2 != null && Arrays.equals(a1, a2))
return;
throw e;
}
}

// Workaround https://github.com/cbeust/testng/issues/1734
public static void assertEquals(double[] a1, double[] a2, String message) {
try {
Assert.assertEquals(a1, a2, message);
} catch (AssertionError e) {
if (a1 != null && a2 != null && Arrays.equals(a1, a2))
return;
throw e;
}
}

@SuppressWarnings({ "unchecked", "rawtypes" })
public static Set buildSet(Object... items) {
return Stream.of(items).collect(Collectors.toSet());
Expand Down

0 comments on commit e2e4e7e

Please sign in to comment.