Skip to content
Open
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: 1 addition & 1 deletion core/src/main/java/org/apache/hop/core/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.text.StrBuilder;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.util.EnvUtil;
Expand Down
37 changes: 21 additions & 16 deletions core/src/main/java/org/apache/hop/core/row/ValueDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ public static String charToHexEncode(IValueMeta meta, Object data) throws HopVal
* always in the range 0-65535.
*
* @return A hex-to-char decoded String
* @throws HopValueException
* @throws HopValueException ex
*/
public static String hexToCharDecode(IValueMeta meta, Object data) throws HopValueException {
if (meta.isNull(data)) {
Expand Down Expand Up @@ -1679,21 +1679,26 @@ public static String hexToCharDecode(IValueMeta meta, Object data) throws HopVal
throw new HopValueException("invalid hex digit '" + c + "'.");
}

if (charNr == 4) {
nextChar = (nibble << 12);
charNr--;
} else if (charNr == 3) {
nextChar += (nibble << 8);
charNr--;
} else if (charNr == 2) {
nextChar += (nibble << 4);
charNr--;
} else {
// charNr == 1
nextChar += nibble;
chArray[j] = (char) nextChar;
charNr = 4;
j++;
switch (charNr) {
case 4 -> {
nextChar = (nibble << 12);
charNr--;
}
case 3 -> {
nextChar += (nibble << 8);
charNr--;
}
case 2 -> {
nextChar += (nibble << 4);
charNr--;
}
default -> {
// charNr == 1
nextChar += nibble;
chArray[j] = (char) nextChar;
charNr = 4;
j++;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/org/apache/hop/core/CounterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class CounterTest {
/** Constructor test 1. */
@Test
public void testConstructor1() {
void testConstructor1() {
Counter cnt1 = new Counter();
assertEquals(1L, cnt1.getCounter());
assertEquals(1L, cnt1.getIncrement());
Expand Down Expand Up @@ -59,7 +59,7 @@ public void testConstructor1() {

/** Test the setting of stuff. */
@Test
public void testSets() {
void testSets() {
Counter cnt1 = new Counter();
cnt1.setCounter(5L);
assertEquals(5L, cnt1.getCounter());
Expand All @@ -76,7 +76,7 @@ public void testSets() {

/** Test next(). */
@Test
public void testNext() {
void testNext() {
Counter cnt1 = new Counter();
cnt1.setCounter(2L);
assertEquals(2L, cnt1.getAndNext());
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/org/apache/hop/core/CountersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class CountersTest {
/** Test about all. Class is not too big. */
@Test
public void testGeneralFunctionality() {
void testGeneralFunctionality() {
Counters cntrs = Counters.getInstance();
assertNull(cntrs.getCounter("counter1"));
cntrs.setCounter("counter1", new Counter());
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/java/org/apache/hop/core/row/RowDataUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public boolean arrayCompare(Object[] arr1, int start1, Object[] arr2, int start2
}

@Test
public void testResizeArray() {
void testResizeArray() {
Object[] arr1 = new Object[] {"test", Boolean.TRUE, 100L, 101L, new String("test1")};
Object[] nullArr =
new Object[] {
Expand Down Expand Up @@ -72,7 +72,7 @@ public void testResizeArray() {
}

@Test
public void testRemoveItem() {
void testRemoveItem() {
Object[] arr = new Object[] {1L, 2L, 3L, 4L, 5L};

// Remove the first item
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testRemoveItem() {
}

@Test
public void testAddRowData() {
void testAddRowData() {
Object[] arr = new Object[] {1L, 2L, 3L};

// Do all different combinations of adding rows to
Expand All @@ -129,7 +129,7 @@ public void testAddRowData() {
}

@Test
public void testAddValueData() {
void testAddValueData() {
Object[] arr1 = new Object[] {1L};
Object[] arr2 = new Object[] {1L, 2L};

Expand All @@ -143,7 +143,7 @@ public void testAddValueData() {
}

@Test
public void testRemoveItems() {
void testRemoveItems() {
Object[] arr1 = new Object[] {1L, 2L, 3L, 4L, 5L};
Object[] comp1 = new Object[] {2L, 4L};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@
class MultiMetadataProviderTest extends MetadataTestBase {

@Test
public void testGetDescription() {
void testGetDescription() {
String description = multiMetadataProvider.getDescription();
assertNotNull(description);
assertEquals(
"Multi Metadata Provider with 3 providers: Provider1, Provider2, Provider3", description);
}

@Test
public void testGetMetadataClasses() {
void testGetMetadataClasses() {
List<Class<IHopMetadata>> list = multiMetadataProvider.getMetadataClasses();
assertEquals(2, list.size());
assertTrue(list.contains(MetadataType1.class));
assertTrue(list.contains(MetadataType2.class));
}

@Test
public void testGetMetadataClassForKey() throws HopException {
void testGetMetadataClassForKey() throws HopException {
assertEquals(MetadataType1.class, multiMetadataProvider.getMetadataClassForKey("type-1"));
assertEquals(MetadataType2.class, multiMetadataProvider.getMetadataClassForKey("type-2"));
}

@Test
public void testFindProvider() {
void testFindProvider() {
IHopMetadataProvider look1 = multiMetadataProvider.findProvider("Provider1");
assertNotNull(look1);
assertEquals(provider1, look1);
Expand All @@ -69,13 +69,13 @@ public void testFindProvider() {
}

@Test
public void testGetProviders() {
void testGetProviders() {
List<IHopMetadataProvider> list = multiMetadataProvider.getProviders();
assertEquals(3, list.size());
}

@Test
public void testSetProviders() {
void testSetProviders() {
List<IHopMetadataProvider> list = multiMetadataProvider.getProviders();
MemoryMetadataProvider provider4 =
new MemoryMetadataProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void setUp() throws Exception {
}

@Test
public void testLoad() throws HopException {
void testLoad() throws HopException {
IHopMetadataSerializer<MetadataType1> s1 =
multiMetadataProvider.getSerializer(MetadataType1.class);
IHopMetadataSerializer<MetadataType2> s2 =
Expand Down Expand Up @@ -90,7 +90,7 @@ public void testLoad() throws HopException {
}

@Test
public void testSave() throws HopException {
void testSave() throws HopException {

MetadataType1 m6 = new MetadataType1("t1o6", "d6", "v6");
multiMetadataProvider.getSerializer(MetadataType1.class).save(m6);
Expand Down Expand Up @@ -122,7 +122,7 @@ public void testSave() throws HopException {
}

@Test
public void testListObjectNames() throws HopException {
void testListObjectNames() throws HopException {
IHopMetadataSerializer<MetadataType1> s1 =
multiMetadataProvider.getSerializer(MetadataType1.class);
IHopMetadataSerializer<MetadataType2> s2 =
Expand All @@ -139,7 +139,7 @@ public void testListObjectNames() throws HopException {
}

@Test
public void testExists() throws HopException {
void testExists() throws HopException {
IHopMetadataSerializer<MetadataType1> s1 =
multiMetadataProvider.getSerializer(MetadataType1.class);
IHopMetadataSerializer<MetadataType2> s2 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public AppConfigurationEntry[] getAppConfigurationEntry(String ignored) {
public static final String PENTAHO_JAAS_DEBUG = "PENTAHO_JAAS_DEBUG";

/** Base properties to be inherited by all other LOGIN_CONFIG* configuration maps. */
public static final Map<String, String> LOGIN_CONFIG_BASE = createLoginConfigBaseMap();
protected static final Map<String, String> LOGIN_CONFIG_BASE = createLoginConfigBaseMap();

/** Login Configuration options for KERBEROS_USER mode. */
private static final Map<String, String> LOGIN_CONFIG_OPTS_KERBEROS_USER =
Expand Down Expand Up @@ -99,7 +99,7 @@ private static Map<String, String> getLoginConfigOptsKerberosNoPassword() {
}

/** Login Configuration options for KERBEROS_KEYTAB mode. */
public static final Map<String, String> LOGIN_CONFIG_OPTS_KERBEROS_KEYTAB =
protected static final Map<String, String> LOGIN_CONFIG_OPTS_KERBEROS_KEYTAB =
createLoginConfigOptsKerberosKeytabMap();

private static Map<String, String> createLoginConfigOptsKerberosKeytabMap() {
Expand Down Expand Up @@ -145,12 +145,10 @@ public LoginContext getLoginContextFromUsernamePassword(
new Subject(),
callbacks -> {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback nameCallback) {
nameCallback.setName(principal);
} else if (callback instanceof PasswordCallback passwordCallback) {
passwordCallback.setPassword(password.toCharArray());
} else {
throw new UnsupportedCallbackException(callback);
switch (callback) {
case NameCallback nc -> nc.setName(principal);
case PasswordCallback pc -> pc.setPassword(password.toCharArray());
default -> throw new UnsupportedCallbackException(callback);
}
}
},
Expand Down
19 changes: 9 additions & 10 deletions engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@Getter
@Setter
public abstract class BasePainter<Hop extends BaseHopMeta<?>, Part extends IBaseMeta> {
public abstract class BasePainter<H extends BaseHopMeta<?>, P extends IBaseMeta> {

private static final Class<?> PKG = BasePainter.class;

Expand Down Expand Up @@ -72,7 +72,7 @@ public abstract class BasePainter<Hop extends BaseHopMeta<?>, Part extends IBase

private int noteFontHeight;

protected Hop candidate;
protected H candidate;

protected Point maximum;
protected boolean showingNavigationView;
Expand Down Expand Up @@ -445,7 +445,7 @@ protected int calcArrowLength() {
return 19 + (lineWidth - 1) * 5; // arrowhead length
}

protected int[] getLine(Part fs, Part ts) {
protected int[] getLine(P fs, P ts) {
if (fs == null || ts == null) {
return null;
}
Expand All @@ -462,7 +462,7 @@ protected int[] getLine(Part fs, Part ts) {
return new int[] {x1, y1, x2, y2};
}

protected void drawArrow(EImage arrow, int[] line, Hop hop, Object startObject, Object endObject)
protected void drawArrow(EImage arrow, int[] line, H hop, Object startObject, Object endObject)
throws HopException {
Point screenFrom = real2screen(line[0], line[1]);
Point screenTo = real2screen(line[2], line[3]);
Expand Down Expand Up @@ -490,7 +490,7 @@ protected abstract void drawArrow(
double theta,
int size,
double factor,
Hop jobHop,
H jobHop,
Object startObject,
Object endObject)
throws HopException;
Expand Down Expand Up @@ -536,9 +536,8 @@ protected void drawNavigationView() {
// 3) Fixed width; height follows content aspect ratio (capped) so the minimap fits the graph.
//
int viewportHeight =
Math.min(
VIEWPORT_HEIGHT_MAX,
Math.max(20, (int) Math.round(VIEWPORT_WIDTH * graphRangeY / graphRangeX)));
Math.clamp(
(int) Math.round(VIEWPORT_WIDTH * graphRangeY / graphRangeX), 20, VIEWPORT_HEIGHT_MAX);
double scale = Math.min(VIEWPORT_WIDTH / graphRangeX, viewportHeight / graphRangeY);
double contentWidth = graphRangeX * scale;
double contentHeight = graphRangeY * scale;
Expand Down Expand Up @@ -566,8 +565,8 @@ protected void drawNavigationView() {
double viewHeight = visibleHeightGraph * scale;

// Clamp overlay to the drawn content area (avoid drawing outside the light blue)
viewX = Math.max(contentLeft, Math.min(contentLeft + contentWidth - 1, viewX));
viewY = Math.max(contentTop, Math.min(contentTop + contentHeight - 1, viewY));
viewX = Math.clamp(viewX, contentLeft, contentLeft + contentWidth - 1);
viewY = Math.clamp(viewY, contentTop, contentTop + contentHeight - 1);
viewWidth = Math.min(viewWidth, contentLeft + contentWidth - viewX);
viewHeight = Math.min(viewHeight, contentTop + contentHeight - viewY);
viewWidth = Math.max(0, viewWidth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ public List<String> getExecutionIds(boolean includeChildren, int limit) throws H
// Reverse sort the IDs by date
//
List<DatedId> datedIds = new ArrayList<>(ids);
datedIds.sort(Comparator.comparing(DatedId::getDate));
Collections.reverse(datedIds); // Newest first
datedIds.sort(Comparator.comparing(DatedId::getDate).reversed());

// Take only the first from the list
//
Expand Down Expand Up @@ -277,8 +276,8 @@ public List<String> findExecutionIDs(IExecutionSelector selector) throws HopExce
// Reverse sort the IDs by date
//
List<DatedId> datedIds = new ArrayList<>(dateIds);
datedIds.sort(Comparator.comparing(DatedId::getDate));
Collections.reverse(datedIds); // Newest first
// Newest first
datedIds.sort(Comparator.comparing(DatedId::getDate).reversed());

// Take only the first from the list
//
Expand Down
12 changes: 6 additions & 6 deletions engine/src/main/java/org/apache/hop/history/AuditState.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,24 @@ public int hashCode() {

public boolean extractBoolean(String key, boolean defaultValue) {
Object only = getStateMap().get(key);
if (only instanceof Boolean) {
return (Boolean) only;
if (only instanceof Boolean b) {
return b;
}
return defaultValue;
}

public String extractString(String key, String defaultValue) {
Object object = getStateMap().get(key);
if (object instanceof String) {
return (String) object;
if (object instanceof String s) {
return s;
}
return defaultValue;
}

public int extractInteger(String key, int defaultValue) {
Object object = getStateMap().get(key);
if (object instanceof Integer) {
return (Integer) object;
if (object instanceof Integer i) {
return i;
}
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.PrintWriter;
import java.io.Serial;
import java.util.UUID;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.commons.vfs2.FileObject;
import org.apache.hop.core.annotations.HopServerServlet;
import org.apache.hop.core.logging.LoggingObjectType;
Expand Down
Loading
Loading