Compare commits
No commits in common. "af92d86a2e82bc592cae62276f65aaf5de4edebd" and "a3645937ca5d1d9dd75d98699feb1192910d9b77" have entirely different histories.
af92d86a2e
...
a3645937ca
4 changed files with 56 additions and 120 deletions
61
.github/workflows/gradle.yml
vendored
61
.github/workflows/gradle.yml
vendored
|
@ -1,61 +0,0 @@
|
||||||
name: gradle-ci
|
|
||||||
|
|
||||||
on: [push, pull_request, workflow_dispatch]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
|
||||||
SONAR_JDK: "11"
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
java-version: [ 11, 17, 19 ]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: ${{ matrix.java-version }}
|
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
|
|
||||||
- name: Cache SonarCloud packages
|
|
||||||
if: matrix.java-version == env.SONAR_JDK
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.sonar/cache
|
|
||||||
key: ${{ runner.os }}-sonar
|
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
|
||||||
|
|
||||||
- name: Cache Gradle packages
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches
|
|
||||||
~/.gradle/wrapper
|
|
||||||
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-${{ matrix.java-version }}-
|
|
||||||
|
|
||||||
- name: Test with Gradle
|
|
||||||
run: ./gradlew build check --stacktrace
|
|
||||||
|
|
||||||
- name: SonarCloud
|
|
||||||
if: success() && matrix.java-version == env.SONAR_JDK
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
run: ./gradlew sonarqube
|
|
||||||
|
|
||||||
- name: Cleanup Gradle Cache
|
|
||||||
run: |
|
|
||||||
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
|
||||||
rm -f ~/.gradle/caches/modules-2/gc.properties
|
|
|
@ -16,12 +16,12 @@ plugins {
|
||||||
id("signing")
|
id("signing")
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Encode and decode URL parameters"
|
description = "URL parameters encoding and decoding"
|
||||||
group = "net.thauvin.erik"
|
group = "net.thauvin.erik"
|
||||||
version = "0.9-SNAPSHOT"
|
version = "0.9-SNAPSHOT"
|
||||||
|
|
||||||
val deployDir = "deploy"
|
val deployDir = "deploy"
|
||||||
val gitHub = "ethauvin/${rootProject.name}"
|
val gitHub = "ethauvin/$name"
|
||||||
val mavenUrl = "https://github.com/$gitHub"
|
val mavenUrl = "https://github.com/$gitHub"
|
||||||
val publicationName = "mavenJava"
|
val publicationName = "mavenJava"
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ java {
|
||||||
|
|
||||||
sonarqube {
|
sonarqube {
|
||||||
properties {
|
properties {
|
||||||
property("sonar.projectName", rootProject.name)
|
property("sonar.projectKey", "ethauvin_$name")
|
||||||
property("sonar.projectKey", "ethauvin_${rootProject.name}")
|
|
||||||
property("sonar.organization", "ethauvin-github")
|
property("sonar.organization", "ethauvin-github")
|
||||||
property("sonar.host.url", "https://sonarcloud.io")
|
property("sonar.host.url", "https://sonarcloud.io")
|
||||||
property("sonar.sourceEncoding", "UTF-8")
|
property("sonar.sourceEncoding", "UTF-8")
|
||||||
|
@ -143,8 +142,8 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scm {
|
scm {
|
||||||
connection.set("scm:git://github.com/$gitHub.git")
|
connection.set("scm:git:git://github.com/$gitHub.git")
|
||||||
developerConnection.set("scm:git@github.com:$gitHub.git")
|
developerConnection.set("scm:git:git@github.com:$gitHub.git")
|
||||||
url.set(mavenUrl)
|
url.set(mavenUrl)
|
||||||
}
|
}
|
||||||
issueManagement {
|
issueManagement {
|
||||||
|
|
100
lib/pom.xml
100
lib/pom.xml
|
@ -1,53 +1,51 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
<!-- This module was also published with a richer model, Gradle metadata, -->
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<!-- which should be used instead. Do not delete the following line which -->
|
||||||
<!-- This module was also published with a richer model, Gradle metadata, -->
|
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
||||||
<!-- which should be used instead. Do not delete the following line which -->
|
<!-- that they should prefer consuming it instead. -->
|
||||||
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
<!-- do_not_remove: published-with-gradle-metadata -->
|
||||||
<!-- that they should prefer consuming it instead. -->
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<!-- do_not_remove: published-with-gradle-metadata -->
|
<groupId>net.thauvin.erik</groupId>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<artifactId>urlencoder</artifactId>
|
||||||
<groupId>net.thauvin.erik</groupId>
|
<version>0.9-SNAPSHOT</version>
|
||||||
<artifactId>urlencoder</artifactId>
|
<name>urlencoder</name>
|
||||||
<version>0.9-SNAPSHOT</version>
|
<description>URL parameters encoding and decoding</description>
|
||||||
<name>urlencoder</name>
|
<url>https://github.com/ethauvin/lib</url>
|
||||||
<description>Encode and decode URL parameters</description>
|
<licenses>
|
||||||
<url>https://github.com/ethauvin/urlencoder</url>
|
<license>
|
||||||
<licenses>
|
<name>The Apache License, Version 2.0</name>
|
||||||
<license>
|
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||||
<name>The Apache License, Version 2.0</name>
|
</license>
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
</licenses>
|
||||||
</license>
|
<developers>
|
||||||
</licenses>
|
<developer>
|
||||||
<developers>
|
<id>gbevin</id>
|
||||||
<developer>
|
<name>Geert Bevin</name>
|
||||||
<id>gbevin</id>
|
<email>gbevin@uwyn.com</email>
|
||||||
<name>Geert Bevin</name>
|
</developer>
|
||||||
<email>gbevin@uwyn.com</email>
|
<developer>
|
||||||
</developer>
|
<id>ethauvin</id>
|
||||||
<developer>
|
<name>Erik C. Thauvin</name>
|
||||||
<id>ethauvin</id>
|
<email>erik@thauvin.net</email>
|
||||||
<name>Erik C. Thauvin</name>
|
<url>https://erik.thauvin.net/</url>
|
||||||
<email>erik@thauvin.net</email>
|
</developer>
|
||||||
<url>https://erik.thauvin.net/</url>
|
</developers>
|
||||||
</developer>
|
<scm>
|
||||||
</developers>
|
<connection>scm:git:git://github.com/ethauvin/lib.git</connection>
|
||||||
<scm>
|
<developerConnection>scm:git:git@github.com:ethauvin/lib.git</developerConnection>
|
||||||
<connection>scm:git://github.com/ethauvin/urlencoder.git</connection>
|
<url>https://github.com/ethauvin/lib</url>
|
||||||
<developerConnection>scm:git@github.com:ethauvin/urlencoder.git</developerConnection>
|
</scm>
|
||||||
<url>https://github.com/ethauvin/urlencoder</url>
|
<issueManagement>
|
||||||
</scm>
|
<system>GitHub</system>
|
||||||
<issueManagement>
|
<url>https://github.com/ethauvin/lib/issues</url>
|
||||||
<system>GitHub</system>
|
</issueManagement>
|
||||||
<url>https://github.com/ethauvin/urlencoder/issues</url>
|
<dependencies>
|
||||||
</issueManagement>
|
<dependency>
|
||||||
<dependencies>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<dependency>
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<version>1.8.0</version>
|
||||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
<scope>compile</scope>
|
||||||
<version>1.8.0</version>
|
</dependency>
|
||||||
<scope>compile</scope>
|
</dependencies>
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -50,7 +50,7 @@ object UrlEncoder {
|
||||||
|
|
||||||
// see https://www.rfc-editor.org/rfc/rfc3986#page-13
|
// see https://www.rfc-editor.org/rfc/rfc3986#page-13
|
||||||
private fun Char.isUnreserved(): Boolean {
|
private fun Char.isUnreserved(): Boolean {
|
||||||
return this <= '~' && unreservedChars.get(code)
|
return if (this > '~') false else unreservedChars.get(this.code)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun StringBuilder.appendEncodedDigit(digit: Int) {
|
private fun StringBuilder.appendEncodedDigit(digit: Int) {
|
||||||
|
@ -122,7 +122,7 @@ object UrlEncoder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms a provided [String] object into a new string, containing only valid URL characters in the UTF-8
|
* Transforms a provided [String] object into a new string, containing only valid URL characters in the UTF-8
|
||||||
* encoding. Letters, numbers, unreserved (`_-!.~'()*`) and allowed characters are left intact.
|
* encoding. Letters, numbers, unreserved (<code>"_-!.~'()*"</code>) and allowed characters are left intact.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun encode(source: String, vararg allow: Char): String {
|
fun encode(source: String, vararg allow: Char): String {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue