Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions persistit/core/src/main/java/com/persistit/BufferPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ public class BufferPool {
// Note: written this way to try to avoid another OOME.
// Do not use String.format here.
//
// Release the reserved block to free memory for the diagnostic
// path below.
reserve = null;
System.err.print("Out of memory with ");
System.err.print(Runtime.getRuntime().freeMemory());
Expand Down
3 changes: 1 addition & 2 deletions persistit/core/src/main/java/com/persistit/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,7 @@ Task source(final @Arg("file|string|Read commands from file") String fileName) t
@Override
public void runTask() throws Exception {
if (!fileName.isEmpty()) {
final FileReader in = new FileReader(fileName);
_sourceStack.push(new BufferedReader(new BufferedReader(in)));
_sourceStack.push(new BufferedReader(new FileReader(fileName)));
Comment thread
vharseko marked this conversation as resolved.
Dismissed
postMessage(String.format("Source is %s", fileName), LOG_NORMAL);
return;
} else {
Expand Down
9 changes: 7 additions & 2 deletions persistit/core/src/main/java/com/persistit/Exchange.java
Original file line number Diff line number Diff line change
Expand Up @@ -4456,18 +4456,23 @@
* @param level
* The tree level, starting at zero for the data page.
* @return copy of page on the key's index tree at that level.
* @throws IllegalArgumentException
* if <code>level</code> does not identify a valid tree level
* (for example when the tree depth exceeds
* {@link #MAX_TREE_DEPTH})
*/
public Buffer fetchBufferCopy(final int level) throws PersistitException {
assertCorrectThread(true);
if (level >= _tree.getDepth() || level <= -_tree.getDepth()) {
throw new IllegalArgumentException("Tree depth is " + _tree.getDepth());
}
final int lvl = level >= 0 ? level : _tree.getDepth() + level;
if (lvl < 0 || lvl >= _levelCache.length) {
final LevelCache[] levelCache = _levelCache;
if (lvl < 0 || lvl >= levelCache.length) {

Check failure

Code scanning / CodeQL

Improper validation of user-provided array index High

This index depends on a
user-provided value
which can cause an ArrayIndexOutOfBoundsException.
throw new IllegalArgumentException("Tree depth is " + _tree.getDepth());
}
final int foundAt = searchTree(_key, lvl, false);
final Buffer buffer = _levelCache[lvl]._buffer;
final Buffer buffer = levelCache[lvl]._buffer;
Comment thread
vharseko marked this conversation as resolved.
Dismissed
try {
if (foundAt == -1) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion persistit/core/src/main/java/com/persistit/GetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ private GetVersion(final String jarResource) throws IOException {

@Override
public String toString() {
return _version.toString();
return _version;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static JoinPolicy forName(final String name) {
return policy;
}
}
throw new IllegalArgumentException("No such SplitPolicy " + name);
throw new IllegalArgumentException("No such JoinPolicy " + name);
}

String _name;
Expand Down Expand Up @@ -141,4 +141,9 @@ public String getName() {
return _name;
}

@Override
public String toString() {
return _name;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
* @author peter
*
*/
public class ThreadSequencer implements SequencerConstants {
public class ThreadSequencer {

private final static DisabledSequencer DISABLED_SEQUENCER = new DisabledSequencer();

Expand Down
40 changes: 40 additions & 0 deletions persistit/core/src/test/java/com/persistit/JoinPolicyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2026 3A Systems, LLC.
*/

package com.persistit;

import com.persistit.policy.JoinPolicy;
import org.junit.Test;

import static org.junit.Assert.assertSame;

public class JoinPolicyTest {

@Test
public void forNameResolvesPoliciesCaseInsensitively() {
assertSame(JoinPolicy.EVEN_BIAS, JoinPolicy.forName("even"));
assertSame(JoinPolicy.EVEN_BIAS, JoinPolicy.forName("EVEN"));
assertSame(JoinPolicy.LEFT_BIAS, JoinPolicy.forName("LEFT"));
assertSame(JoinPolicy.LEFT_BIAS, JoinPolicy.forName("left"));
assertSame(JoinPolicy.RIGHT_BIAS, JoinPolicy.forName("Right"));
}

@Test(expected = IllegalArgumentException.class)
public void forNameRejectsUnknown() {
JoinPolicy.forName("NOPE");
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Copyright 2005-2012 Akiban Technologies, Inc.
*
* Portions Copyrighted 2026 3A Systems, LLC
*
* Licensed 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
Expand Down Expand Up @@ -264,8 +265,7 @@ private void updateDetailedTaskStatus(final TaskStatus taskStatus) {
_startTimeField.setText(_adminUI.formatDate(taskStatus.getStartTime()));
_endTimeField.setText(_adminUI.formatDate(taskStatus.getFinishTime()));
_expirationTimeField.setText(_adminUI.formatDate(taskStatus.getExpirationTime()));
_lastExceptionField.setText(taskStatus.getLastException() == null ? "" : taskStatus.getLastException()
.toString());
_lastExceptionField.setText(taskStatus.getLastException() == null ? "" : taskStatus.getLastException());
_statusDetailArea.setText(taskStatus.getStatusDetail());

final StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ public void run() {
final Management management = _adminUI.getManagement();
if (management == null)
return;
// Defensive: refresh() already returns early on a null record, but
// keep this guard so the dereference below is provably safe.
final Management.LogicalRecord logicalRecord = _logicalRecord;
if (logicalRecord == null)
return;
try {
final Management.LogicalRecord[] results = management.getLogicalRecordArray(getVolumeName(),
getTreeName(), null, _logicalRecord.getKeyState(), Key.EQ, 1, Integer.MAX_VALUE, true
getTreeName(), null, logicalRecord.getKeyState(), Key.EQ, 1, Integer.MAX_VALUE, true

);
if (results == null || results.length == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ private synchronized void receiveData(final Fetcher fetcher) {

final int oldOffset = _offset;
int newOffset = oldOffset;
int firstUpdatedRow;

int lost = 0; // rows lost from row cache
int kept = _valid; // rows kept from row cache
Expand Down Expand Up @@ -260,8 +259,6 @@ private synchronized void receiveData(final Fetcher fetcher) {
}
System.arraycopy(fetcher._resultRows, cut, _infoArray, kept, count - cut);

firstUpdatedRow = newOffset + kept;

if (count < fetcher._requestedCount) {
changeRowCount(newOffset + newValid, true);
}
Expand All @@ -287,8 +284,6 @@ private synchronized void receiveData(final Fetcher fetcher) {
}
System.arraycopy(fetcher._resultRows, 0, _infoArray, 0, count - cut);

firstUpdatedRow = newOffset;

if (count < fetcher._requestedCount) {
_definite = false;
_currentRowCount = DEFAULT_INITIAL_SIZE_ESTIMATE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ protected void setup(final Class clazz, final String[] columnSpecs) throws NoSuc
final String flags = st.nextToken();
final String header = st.nextToken();
String rendererName = null;
int minWidth = width / 2;
if (st.hasMoreTokens()) {
try {
minWidth = Integer.parseInt(st.nextToken());
// Consume the optional 5th (minimum-width) token so a
// following renderer-name token is not shifted into its
// slot; parsing also validates it. The effective minimum
// width comes from the width token (_widths[i] / 10000),
// so the parsed value itself is intentionally unused.
Integer.parseInt(st.nextToken());
} catch (final NumberFormatException e) {
throw new IllegalArgumentException(
"Invalid minimum width in column specification: " + columnSpecs[index], e);
Expand Down
97 changes: 0 additions & 97 deletions persistit/ui/src/main/java/com/persistit/ui/VTComboBoxModel.java

This file was deleted.

Loading