| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,48 @@ | |||
| 1 | + # For more information see: | ||
| 2 | + # * https://docs.github.com/en/actions/learn-github-actions | ||
| 3 | + # * https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
| 4 | + # * https://github.com/actions/setup-java/blob/v3.13.0/docs/advanced-usage.md#Publishing-using-Apache-Maven | ||
| 5 | + # | ||
| 6 | + | ||
| 7 | + name: Deployment workflow | ||
| 8 | + | ||
| 9 | + on: | ||
| 10 | + release: | ||
| 11 | + types: [published] | ||
| 12 | + | ||
| 13 | + jobs: | ||
| 14 | + publish: | ||
| 15 | + runs-on: ubuntu-latest | ||
| 16 | + permissions: | ||
| 17 | + contents: read | ||
| 18 | + packages: write | ||
| 19 | + steps: | ||
| 20 | + - uses: actions/checkout@v4 | ||
| 21 | + - name: Set up Java for publishing to Maven Central Repository | ||
| 22 | + uses: actions/setup-java@v3 | ||
| 23 | + with: | ||
| 24 | + # Use lowest supported LTS Java version | ||
| 25 | + java-version: '8' | ||
| 26 | + distribution: 'temurin' | ||
| 27 | + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | ||
| 28 | + server-username: MAVEN_USERNAME # env variable for username in deploy | ||
| 29 | + server-password: MAVEN_PASSWORD # env variable for token in deploy | ||
| 30 | + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import | ||
| 31 | + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
| 32 | + | ||
| 33 | + - name: Publish to the Maven Central Repository | ||
| 34 | + run: mvn --batch-mode deploy | ||
| 35 | + env: | ||
| 36 | + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
| 37 | + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
| 38 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
| 39 | + # - name: Set up Java for publishing to GitHub Packages | ||
| 40 | + # uses: actions/setup-java@v3 | ||
| 41 | + # with: | ||
| 42 | + # # Use lowest supported LTS Java version | ||
| 43 | + # java-version: '8' | ||
| 44 | + # distribution: 'temurin' | ||
| 45 | + # - name: Publish to GitHub Packages | ||
| 46 | + # run: mvn --batch-mode deploy | ||
| 47 | + # env: | ||
| 48 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | # This workflow will build a Java project with Maven | |
| 2 | - # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
| 2 | + # For more information see: https://docs.github.com/en/actions/learn-github-actions or https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
| 3 | 3 | ||
| 4 | 4 | name: Java CI with Maven | |
| 5 | 5 | ||
@@ -37,13 +37,21 @@ jobs: | |||
| 37 | 37 | mvn site -DgenerateReports=false -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }} | |
| 38 | 38 | - name: Upload Test Results ${{ matrix.java }} | |
| 39 | 39 | if: ${{ always() }} | |
| 40 | - uses: actions/upload-artifact@v1 | ||
| 40 | + uses: actions/upload-artifact@v3 | ||
| 41 | 41 | with: | |
| 42 | 42 | name: Test Results ${{ matrix.java }} | |
| 43 | 43 | path: target/surefire-reports/ | |
| 44 | 44 | - name: Upload Test Report ${{ matrix.java }} | |
| 45 | 45 | if: ${{ always() }} | |
| 46 | - uses: actions/upload-artifact@v1 | ||
| 46 | + uses: actions/upload-artifact@v3 | ||
| 47 | 47 | with: | |
| 48 | 48 | name: Test Report ${{ matrix.java }} | |
| 49 | 49 | path: target/site/ | |
| 50 | + - name: Package Jar ${{ matrix.java }} | ||
| 51 | + run: mvn clean package -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }} -Dmaven.test.skip=true -Dmaven.site.skip=true | ||
| 52 | + - name: Upload Package Results ${{ matrix.java }} | ||
| 53 | + if: ${{ always() }} | ||
| 54 | + uses: actions/upload-artifact@v3 | ||
| 55 | + with: | ||
| 56 | + name: Package Jar ${{ matrix.java }} | ||
| 57 | + path: target/*.jar | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,8 @@ | |||
| 1 | 1 | # ignore eclipse project files | |
| 2 | 2 | .project | |
| 3 | 3 | .classpath | |
| 4 | + # ignore vscode files | ||
| 5 | + .vscode | ||
| 4 | 6 | # ignore Intellij Idea project files | |
| 5 | 7 | .idea | |
| 6 | 8 | *.iml | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,8 @@ JSON in Java [package org.json] | |||
| 7 | 7 | =============================== | |
| 8 | 8 | ||
| 9 | 9 | [](https://mvnrepository.com/artifact/org.json/json) | |
| 10 | + [](https://github.com/stleary/JSON-java/actions/workflows/pipeline.yml) | ||
| 11 | + [](https://github.com/stleary/JSON-java/actions/workflows/codeql-analysis.yml) | ||
| 10 | 12 | ||
| 11 | 13 | **[Click here if you just want the latest release jar file.](https://search.maven.org/remotecontent?filepath=org/json/json/20231013/json-20231013.jar)** | |
| 12 | 14 | ||
@@ -26,6 +28,7 @@ Project goals include: | |||
| 26 | 28 | * Maintain backward compatibility | |
| 27 | 29 | * Designed and tested to use on Java versions 1.8 - 21 | |
| 28 | 30 | ||
| 31 | + | ||
| 29 | 32 | The files in this package implement JSON encoders and decoders. The package can also convert between JSON and XML, HTTP headers, Cookies, and CDL. | |
| 30 | 33 | ||
| 31 | 34 | # If you would like to contribute to this project | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,12 +21,6 @@ | |||
| 21 | 21 | </description> | |
| 22 | 22 | <url>https://github.com/douglascrockford/JSON-java</url> | |
| 23 | 23 | ||
| 24 | - <parent> | ||
| 25 | - <groupId>org.sonatype.oss</groupId> | ||
| 26 | - <artifactId>oss-parent</artifactId> | ||
| 27 | - <version>9</version> | ||
| 28 | - </parent> | ||
| 29 | - | ||
| 30 | 24 | <scm> | |
| 31 | 25 | <url>https://github.com/douglascrockford/JSON-java.git</url> | |
| 32 | 26 | <connection>scm:git:git://github.com/douglascrockford/JSON-java.git</connection> | |
@@ -53,6 +47,19 @@ | |||
| 53 | 47 | </properties> | |
| 54 | 48 | ||
| 55 | 49 | ||
| 50 | + <distributionManagement> | ||
| 51 | + <repository> | ||
| 52 | + <id>ossrh</id> | ||
| 53 | + <name>Central Repository OSSRH</name> | ||
| 54 | + <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
| 55 | + </repository> | ||
| 56 | + <snapshotRepository> | ||
| 57 | + <id>ossrh</id> | ||
| 58 | + <url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
| 59 | + </snapshotRepository> | ||
| 60 | + </distributionManagement> | ||
| 61 | + | ||
| 62 | + | ||
| 56 | 63 | <dependencies> | |
| 57 | 64 | <dependency> | |
| 58 | 65 | <groupId>junit</groupId> | |
@@ -159,17 +166,34 @@ | |||
| 159 | 166 | <autoReleaseAfterClose>false</autoReleaseAfterClose> | |
| 160 | 167 | </configuration> | |
| 161 | 168 | </plugin> | |
| 169 | + <plugin> | ||
| 170 | + <groupId>org.moditect</groupId> | ||
| 171 | + <artifactId>moditect-maven-plugin</artifactId> | ||
| 172 | + <version>1.0.0.Final</version> | ||
| 173 | + <executions> | ||
| 174 | + <execution> | ||
| 175 | + <id>add-module-infos</id> | ||
| 176 | + <phase>package</phase> | ||
| 177 | + <goals> | ||
| 178 | + <goal>add-module-info</goal> | ||
| 179 | + </goals> | ||
| 180 | + <configuration> | ||
| 181 | + <jvmVersion>9</jvmVersion> | ||
| 182 | + <module> | ||
| 183 | + <moduleInfoSource> | ||
| 184 | + module org.json { | ||
| 185 | + exports org.json; | ||
| 186 | + } | ||
| 187 | + </moduleInfoSource> | ||
| 188 | + </module> | ||
| 189 | + </configuration> | ||
| 190 | + </execution> | ||
| 191 | + </executions> | ||
| 192 | + </plugin> | ||
| 162 | 193 | <plugin> | |
| 163 | 194 | <groupId>org.apache.maven.plugins</groupId> | |
| 164 | 195 | <artifactId>maven-jar-plugin</artifactId> | |
| 165 | 196 | <version>3.3.0</version> | |
| 166 | - <configuration> | ||
| 167 | - <archive> | ||
| 168 | - <manifestEntries> | ||
| 169 | - <Automatic-Module-Name>org.json</Automatic-Module-Name> | ||
| 170 | - </manifestEntries> | ||
| 171 | - </archive> | ||
| 172 | - </configuration> | ||
| 173 | 197 | </plugin> | |
| 174 | 198 | </plugins> | |
| 175 | 199 | </build> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,7 +71,8 @@ public boolean isKeepStrings() { | |||
| 71 | 71 | * | |
| 72 | 72 | * @param newVal | |
| 73 | 73 | * new value to use for the <code>keepStrings</code> configuration option. | |
| 74 | - * | ||
| 74 | + * @param <T> the type of the configuration object | ||
| 75 | + * | ||
| 75 | 76 | * @return The existing configuration will not be modified. A new configuration is returned. | |
| 76 | 77 | */ | |
| 77 | 78 | public <T extends ParserConfiguration> T withKeepStrings(final boolean newVal) { | |
@@ -96,6 +97,8 @@ public int getMaxNestingDepth() { | |||
| 96 | 97 | * Using any negative value as a parameter is equivalent to setting no limit to the nesting depth, | |
| 97 | 98 | * which means the parses will go as deep as the maximum call stack size allows. | |
| 98 | 99 | * @param maxNestingDepth the maximum nesting depth allowed to the XML parser | |
| 100 | + * @param <T> the type of the configuration object | ||
| 101 | + * | ||
| 99 | 102 | * @return The existing configuration will not be modified. A new configuration is returned. | |
| 100 | 103 | */ | |
| 101 | 104 | public <T extends ParserConfiguration> T withMaxNestingDepth(int maxNestingDepth) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -762,8 +762,8 @@ public void testToJSONObject_reversibility() { | |||
| 762 | 762 | final String xml = JSONML.toString(originalObject); | |
| 763 | 763 | final JSONObject revertedObject = JSONML.toJSONObject(xml, false); | |
| 764 | 764 | final String newJson = revertedObject.toString(); | |
| 765 | - assertTrue("JSON Objects are not similar",originalObject.similar(revertedObject)); | ||
| 766 | - assertEquals("original JSON does not equal the new JSON",originalJson, newJson); | ||
| 765 | + assertTrue("JSON Objects are not similar", originalObject.similar(revertedObject)); | ||
| 766 | + assertTrue("JSON Strings are not similar", new JSONObject(originalJson).similar(new JSONObject(newJson))); | ||
| 767 | 767 | } | |
| 768 | 768 | ||
| 769 | 769 | // these tests do not pass for the following reasons: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2095,7 +2095,9 @@ public void valueToString() { | |||
| 2095 | 2095 | "}"; | |
| 2096 | 2096 | JSONObject jsonObject = new JSONObject(jsonObjectStr); | |
| 2097 | 2097 | assertTrue("jsonObject valueToString() incorrect", | |
| 2098 | - JSONObject.valueToString(jsonObject).equals(jsonObject.toString())); | ||
| 2098 | + new JSONObject(JSONObject.valueToString(jsonObject)) | ||
| 2099 | + .similar(new JSONObject(jsonObject.toString())) | ||
| 2100 | + ); | ||
| 2099 | 2101 | String jsonArrayStr = | |
| 2100 | 2102 | "[1,2,3]"; | |
| 2101 | 2103 | JSONArray jsonArray = new JSONArray(jsonArrayStr); | |
@@ -2106,7 +2108,8 @@ public void valueToString() { | |||
| 2106 | 2108 | map.put("key2", "val2"); | |
| 2107 | 2109 | map.put("key3", "val3"); | |
| 2108 | 2110 | assertTrue("map valueToString() incorrect", | |
| 2109 | - jsonObject.toString().equals(JSONObject.valueToString(map))); | ||
| 2111 | + new JSONObject(jsonObject.toString()) | ||
| 2112 | + .similar(new JSONObject(JSONObject.valueToString(map)))); | ||
| 2110 | 2113 | Collection<Integer> collection = new ArrayList<Integer>(); | |
| 2111 | 2114 | collection.add(Integer.valueOf(1)); | |
| 2112 | 2115 | collection.add(Integer.valueOf(2)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1234,7 +1234,7 @@ public void testIndentComplicatedJsonObjectWithArrayAndWithConfig(){ | |||
| 1234 | 1234 | for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) { | |
| 1235 | 1235 | expected.append(buffer, 0, numRead); | |
| 1236 | 1236 | } | |
| 1237 | - assertEquals(expected.toString(), actualString); | ||
| 1237 | + assertTrue(XML.toJSONObject(expected.toString()).similar(XML.toJSONObject(actualString))); | ||
| 1238 | 1238 | } | |
| 1239 | 1239 | } catch (IOException e) { | |
| 1240 | 1240 | fail("file writer error: " +e.getMessage()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments