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
62 changes: 62 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release and Publish to Maven Central

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --dearmor > ~/.gnupg/secring.gpg
gpg --import ~/.gnupg/secring.gpg

- name: Release accessors-smart
run: |
cd accessors-smart
./mvnw clean deploy -P release-sign-artifacts
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Release json-smart
run: |
cd json-smart
./mvnw clean deploy -P release-sign-artifacts
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Release json-smart-action
run: |
cd json-smart-action
./mvnw clean deploy -P release-sign-artifacts
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ So I do not use my json-smart anymore. I had fun with this project. If you want

* JSONObject merge support overwrite as parameter. [PR 238](https://github.com/netplex/json-smart-v2/pull/238)
* Add `JSONParser.ACCEPT_INCOMPLETE` to allow parsing partial and incomplete JSON without error [PR 254](https://github.com/netplex/json-smart-v2/pull/254)
* Add multiple JSON syntax blocks in a single input [PR 272](https://github.com/netplex/json-smart-v2/pull/272)

### *V 2.5.2* (2025-02-12)

Expand Down
12 changes: 11 additions & 1 deletion accessors-smart/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2011-2024 JSON-SMART authors
Copyright 2011-2025 JSON-SMART authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -278,6 +278,16 @@ limitations under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.minidev.asm;

/*
* Copyright 2011-2024 JSON-SMART authors
* Copyright 2011-2025 JSON-SMART authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.minidev.asm;

/*
* Copyright 2011-2024 JSON-SMART authors
* Copyright 2011-2025 JSON-SMART authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.minidev.asm;

/*
* Copyright 2011-2024 JSON-SMART authors
* Copyright 2011-2025 JSON-SMART authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.minidev.asm;

/*
* Copyright 2011-2024 JSON-SMART authors
* Copyright 2011-2025 JSON-SMART authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion accessors-smart/src/test/java/net/minidev/asm/ASMTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public void testGet() throws Exception {
// T1 = System.currentTimeMillis() - T1;
}

@Test
private void subtext(BeansAccess<BTest> acc) {
BTest t = new BTest();
acc.set(t, "pubBoolValue", true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.minidev.asm.ex;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

public class ConvertExceptionTest {

@Test
public void testDefaultConstructor() {
ConvertException exception = new ConvertException();
assertNotNull(exception);
assertNull(exception.getMessage());
assertTrue(exception instanceof RuntimeException);
}

@Test
public void testConstructorWithMessage() {
String message = "Test conversion error";
ConvertException exception = new ConvertException(message);
assertNotNull(exception);
assertEquals(message, exception.getMessage());
assertTrue(exception instanceof RuntimeException);
}

@Test
public void testConstructorWithNullMessage() {
ConvertException exception = new ConvertException(null);
assertNotNull(exception);
assertNull(exception.getMessage());
}

@Test
public void testConstructorWithEmptyMessage() {
String message = "";
ConvertException exception = new ConvertException(message);
assertNotNull(exception);
assertEquals(message, exception.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.minidev.asm.ex;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

public class NoSuchFieldExceptionTest {

@Test
public void testDefaultConstructor() {
NoSuchFieldException exception = new NoSuchFieldException();
assertNotNull(exception);
assertNull(exception.getMessage());
assertTrue(exception instanceof RuntimeException);
}

@Test
public void testConstructorWithMessage() {
String message = "Test field not found error";
NoSuchFieldException exception = new NoSuchFieldException(message);
assertNotNull(exception);
assertEquals(message, exception.getMessage());
assertTrue(exception instanceof RuntimeException);
}

@Test
public void testConstructorWithNullMessage() {
NoSuchFieldException exception = new NoSuchFieldException(null);
assertNotNull(exception);
assertNull(exception.getMessage());
}

@Test
public void testConstructorWithEmptyMessage() {
String message = "";
NoSuchFieldException exception = new NoSuchFieldException(message);
assertNotNull(exception);
assertEquals(message, exception.getMessage());
}
}
10 changes: 10 additions & 0 deletions json-smart-action/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@
</java>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@
public class ElementRemover {
private Map<String, Object> elementsToRemove;

/** Creates an element remover with the specified elements to remove */
public ElementRemover(Map<String, Object> elementsToRemove) {
this.elementsToRemove =
elementsToRemove == null ? Collections.<String, Object>emptyMap() : elementsToRemove;
}

/** Creates an element remover with the specified JSON object elements to remove */
public ElementRemover(JSONObject elementsToRemove) {
this.elementsToRemove =
elementsToRemove == null ? Collections.<String, Object>emptyMap() : elementsToRemove;
}

/** Removes the specified elements from the given JSON object */
public JSONObject remove(JSONObject objectToClean) {
JSONTraverseAction strategy = new RemoveElementsJsonAction(this.elementsToRemove);
JSONTraverser traversal = new JSONTraverser(strategy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* A key to the right of a dot is a direct child of a key to the left of a dot. Keys with a dot in
* their name are not supported.
*
* <p>
*
* @author [email protected]
*/
public class PathLocator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
* @since 15 March 2016.
*/
public class CopyPathsAction implements JSONNavigateAction {
/** The destination tree for copied paths */
protected JSONObject destTree;

/** The current destination branch */
protected JSONObject destBranch;

/** Stack for tracking destination nodes */
protected Stack<Object> destNodeStack;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
import net.minidev.json.JSONObject;

/**
* A navigator that operates on JSON objects and arrays for path-based navigation.
*
* @author [email protected]
* @since 15 June 2016.
*/
public class JSONNavigator extends TreeNavigator<JSONObject, JSONArray> {

/** Creates a navigator with the specified action and paths */
public JSONNavigator(JSONNavigateAction action, List<String> pathsToNavigate) {
super(action, pathsToNavigate);
}

/** Creates a navigator with the specified action and paths */
public JSONNavigator(JSONNavigateAction action, String... pathsToNavigate) {
super(action, pathsToNavigate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*
* <p>See package-info for more details
*
* @param <M> the map type that extends Map&lt;String, Object&gt;
* @param <L> the list type that extends List&lt;Object&gt;
* @author [email protected]
* @since 15 June 2016
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@
* <p>To navigate the branch k1.k2 of the object {"k1":{"k2":"v1"}, "k3":{"k4":"v2"}} instantiate
* the navigator like so: new JSONNavigator("k1.k2")
*
* @param <M> the map type that extends Map&lt;String, Object&gt;
* @param <L> the list type that extends List&lt;Object&gt;
* @author [email protected]
* @since 15 June 2016.
*/
public class TreeNavigator<M extends Map<String, Object>, L extends List<Object>> {
/** The list of paths to navigate */
protected List<String> pathsToNavigate;

/** The navigation action to execute */
protected NavigateAction<M, L> action;

/** The path prefix to use */
protected String pathPrefix = "";

/** Creates a tree navigator with the specified action and paths */
public TreeNavigator(NavigateAction<M, L> action, List<String> pathsToNavigate) {
if (action == null) {
throw new IllegalArgumentException("NavigateAction cannot be null");
Expand All @@ -39,15 +47,18 @@ public TreeNavigator(NavigateAction<M, L> action, List<String> pathsToNavigate)
this.pathsToNavigate = pathsToNavigate;
}

/** Sets a path prefix for this navigator */
public TreeNavigator<M, L> with(String pathPrefix) {
this.pathPrefix = pathPrefix;
return this;
}

/** Creates a tree navigator with the specified action and paths */
public TreeNavigator(NavigateAction<M, L> action, String... pathsToNavigate) {
this(action, Arrays.asList(pathsToNavigate));
}

/** Navigates the specified object using the configured paths */
public void nav(M object) throws Exception {
if (action.start(object, pathsToNavigate)) {
for (String path : pathsToNavigate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* @since 31 May2016
*/
public class DotDelimiter extends PathDelimiter {
/** The dot delimiter character */
protected static final char DELIM_CHAR = '.';

/** Creates a new dot delimiter */
public DotDelimiter() {
super(DELIM_CHAR);
}
Expand Down
Loading
Loading