diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000..d5b6095 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (C) 2019, Stasis Software Systems, Inc. All rights reserved. + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Please see the LICENSE file included in the top-level directory of this + * project for additional information. + */ diff --git a/NOTES b/NOTES index 79710fa..d8e19b6 100644 --- a/NOTES +++ b/NOTES @@ -10,4 +10,14 @@ * Jepsen * Nested transactions + * Scalagen + * <> -> typed + * exceptions multi-catch, separate + * try with resources, use finally + * //, /*- and /* comment don't migrate + * enum classes + * multiple private constructors + * @BeanProperty + * copyright + * http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html diff --git a/stasis-core/src/main/java/com/sleepycat/je/log/RestoreMarker.java b/stasis-core/src/main/java/com/sleepycat/je/log/RestoreMarker.java index 2393a57..044581e 100644 --- a/stasis-core/src/main/java/com/sleepycat/je/log/RestoreMarker.java +++ b/stasis-core/src/main/java/com/sleepycat/je/log/RestoreMarker.java @@ -139,13 +139,16 @@ public class RestoreMarker { SingleItemEntry.create(LogEntryType.LOG_RESTORE_REQUIRED, rr); ByteBuffer buf2 = logManager.putIntoBuffer(marker, 0); - try (FileOutputStream stream = new FileOutputStream(lastFile); - FileChannel channel = stream.getChannel()) { + FileOutputStream stream = new FileOutputStream(lastFile); + FileChannel channel = stream.getChannel(); + try { channel.write(buf1); channel.write(buf2); } catch (IOException e) { /* the stream and channel will be closed */ throw e; + } finally { + channel.close(); } } catch (IOException ioe) { throw new FileCreationException( diff --git a/stasis-core/src/main/java/com/sleepycat/je/log/entry/BaseEntry.java b/stasis-core/src/main/java/com/sleepycat/je/log/entry/BaseEntry.java index d0ce8f8..8619f02 100644 --- a/stasis-core/src/main/java/com/sleepycat/je/log/entry/BaseEntry.java +++ b/stasis-core/src/main/java/com/sleepycat/je/log/entry/BaseEntry.java @@ -86,8 +86,13 @@ abstract class BaseEntry implements LogEntry { final Constructor noArgsConstructor) { try { return noArgsConstructor.newInstance((Object[]) null); - } catch (IllegalAccessException | InstantiationException | - IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException e) { + throw EnvironmentFailureException.unexpectedException(e); + } catch (InstantiationException e) { + throw EnvironmentFailureException.unexpectedException(e); + } catch (IllegalArgumentException e) { + throw EnvironmentFailureException.unexpectedException(e); + } catch (InvocationTargetException e) { throw EnvironmentFailureException.unexpectedException(e); } } diff --git a/stasis-core/src/main/java/com/sleepycat/je/log/entry/LNLogEntry.java b/stasis-core/src/main/java/com/sleepycat/je/log/entry/LNLogEntry.java index f1a6f23..22ae596 100644 --- a/stasis-core/src/main/java/com/sleepycat/je/log/entry/LNLogEntry.java +++ b/stasis-core/src/main/java/com/sleepycat/je/log/entry/LNLogEntry.java @@ -284,7 +284,7 @@ public class LNLogEntry extends BaseReplicableEntry { * @return the log entry */ public static LNLogEntry create(final Class cls) { - return new LNLogEntry<>(cls); + return new LNLogEntry(cls); } /* Constructor to read an entry. */ diff --git a/stasis-core/src/main/java/com/sleepycat/je/log/entry/NameLNLogEntry.java b/stasis-core/src/main/java/com/sleepycat/je/log/entry/NameLNLogEntry.java index 6a9ec3d..6a919d8 100644 --- a/stasis-core/src/main/java/com/sleepycat/je/log/entry/NameLNLogEntry.java +++ b/stasis-core/src/main/java/com/sleepycat/je/log/entry/NameLNLogEntry.java @@ -206,7 +206,7 @@ public class NameLNLogEntry extends LNLogEntry { @Override public Collection getEmbeddedLoggables() { final Collection list = - new ArrayList<>(super.getEmbeddedLoggables()); + new ArrayList(super.getEmbeddedLoggables()); list.addAll(Arrays.asList( new NameLN(), DbOperationType.NONE, new ReplicatedDatabaseConfig()));