Minor cleanup

This commit is contained in:
Erik C. Thauvin 2022-12-30 20:14:10 -08:00
parent a3645937ca
commit 8e92ab430d
3 changed files with 59 additions and 56 deletions

View file

@ -16,12 +16,12 @@ plugins {
id("signing") id("signing")
} }
description = "URL parameters encoding and decoding" description = "Encode and decode URL parameters"
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/$name" val gitHub = "ethauvin/${rootProject.name}"
val mavenUrl = "https://github.com/$gitHub" val mavenUrl = "https://github.com/$gitHub"
val publicationName = "mavenJava" val publicationName = "mavenJava"
@ -42,7 +42,8 @@ java {
sonarqube { sonarqube {
properties { properties {
property("sonar.projectKey", "ethauvin_$name") property("sonar.projectName", rootProject.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")
@ -142,8 +143,8 @@ publishing {
} }
} }
scm { scm {
connection.set("scm:git:git://github.com/$gitHub.git") connection.set("scm:git://github.com/$gitHub.git")
developerConnection.set("scm:git:git@github.com:$gitHub.git") developerConnection.set("scm:git@github.com:$gitHub.git")
url.set(mavenUrl) url.set(mavenUrl)
} }
issueManagement { issueManagement {

View file

@ -1,51 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<!-- This module was also published with a richer model, Gradle metadata, --> xmlns="http://maven.apache.org/POM/4.0.0"
<!-- which should be used instead. Do not delete the following line which --> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- is to indicate to Gradle or any Gradle module metadata file consumer --> <!-- This module was also published with a richer model, Gradle metadata, -->
<!-- that they should prefer consuming it instead. --> <!-- which should be used instead. Do not delete the following line which -->
<!-- do_not_remove: published-with-gradle-metadata --> <!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<modelVersion>4.0.0</modelVersion> <!-- that they should prefer consuming it instead. -->
<groupId>net.thauvin.erik</groupId> <!-- do_not_remove: published-with-gradle-metadata -->
<artifactId>urlencoder</artifactId> <modelVersion>4.0.0</modelVersion>
<version>0.9-SNAPSHOT</version> <groupId>net.thauvin.erik</groupId>
<name>urlencoder</name> <artifactId>urlencoder</artifactId>
<description>URL parameters encoding and decoding</description> <version>0.9-SNAPSHOT</version>
<url>https://github.com/ethauvin/lib</url> <name>urlencoder</name>
<licenses> <description>Encode and decode URL parameters</description>
<license> <url>https://github.com/ethauvin/urlencoder</url>
<name>The Apache License, Version 2.0</name> <licenses>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <license>
</license> <name>The Apache License, Version 2.0</name>
</licenses> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<developers> </license>
<developer> </licenses>
<id>gbevin</id> <developers>
<name>Geert Bevin</name> <developer>
<email>gbevin@uwyn.com</email> <id>gbevin</id>
</developer> <name>Geert Bevin</name>
<developer> <email>gbevin@uwyn.com</email>
<id>ethauvin</id> </developer>
<name>Erik C. Thauvin</name> <developer>
<email>erik@thauvin.net</email> <id>ethauvin</id>
<url>https://erik.thauvin.net/</url> <name>Erik C. Thauvin</name>
</developer> <email>erik@thauvin.net</email>
</developers> <url>https://erik.thauvin.net/</url>
<scm> </developer>
<connection>scm:git:git://github.com/ethauvin/lib.git</connection> </developers>
<developerConnection>scm:git:git@github.com:ethauvin/lib.git</developerConnection> <scm>
<url>https://github.com/ethauvin/lib</url> <connection>scm:git://github.com/ethauvin/urlencoder.git</connection>
</scm> <developerConnection>scm:git@github.com:ethauvin/urlencoder.git</developerConnection>
<issueManagement> <url>https://github.com/ethauvin/urlencoder</url>
<system>GitHub</system> </scm>
<url>https://github.com/ethauvin/lib/issues</url> <issueManagement>
</issueManagement> <system>GitHub</system>
<dependencies> <url>https://github.com/ethauvin/urlencoder/issues</url>
<dependency> </issueManagement>
<groupId>org.jetbrains.kotlin</groupId> <dependencies>
<artifactId>kotlin-stdlib-jdk8</artifactId> <dependency>
<version>1.8.0</version> <groupId>org.jetbrains.kotlin</groupId>
<scope>compile</scope> <artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency> <version>1.8.0</version>
</dependencies> <scope>compile</scope>
</dependency>
</dependencies>
</project> </project>

View file

@ -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 if (this > '~') false else unreservedChars.get(this.code) return this <= '~' && unreservedChars.get(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 (<code>"_-!.~'()*"</code>) and allowed characters are left intact. * encoding. Letters, numbers, unreserved (`_-!.~'()*`) and allowed characters are left intact.
*/ */
@JvmStatic @JvmStatic
fun encode(source: String, vararg allow: Char): String { fun encode(source: String, vararg allow: Char): String {