Compare commits

...

4 Commits

Author SHA1 Message Date
Robinson 23b9a4f7ff
version 1.48 2023-11-22 22:09:01 +01:00
Robinson bc5c28ef08
Fixed cacheName errors when null. 2023-11-22 12:28:40 +01:00
Robinson 81588e2a8e
Updated build deps 2023-10-09 12:27:09 +02:00
Robinson da9c34b538
updated build deps, kotlin 1.9.0 2023-10-02 16:15:04 +02:00
4 changed files with 21 additions and 30 deletions

View File

@ -17,7 +17,7 @@ Maven Info
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>Utilities</artifactId>
<version>1.47</version>
<version>1.48</version>
</dependency>
</dependencies>
```
@ -27,7 +27,7 @@ Gradle Info
```
dependencies {
...
compile "com.dorkbox:Utilities:1.47"
compile "com.dorkbox:Utilities:1.48"
}
```

View File

@ -23,19 +23,19 @@
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace!
plugins {
id("com.dorkbox.GradleUtils") version "3.17"
id("com.dorkbox.Licensing") version "2.26"
id("com.dorkbox.GradleUtils") version "3.18"
id("com.dorkbox.Licensing") version "2.28"
id("com.dorkbox.VersionUpdate") version "2.8"
id("com.dorkbox.GradlePublish") version "1.18"
id("com.dorkbox.GradlePublish") version "1.20"
kotlin("jvm") version "1.8.0"
kotlin("jvm") version "1.9.0"
}
object Extras {
// set for the project
const val description = "Utilities for use within Java projects"
const val group = "com.dorkbox"
const val version = "1.47"
const val version = "1.48"
// set as project.ext
const val name = "Utilities"

View File

@ -138,11 +138,10 @@ class CacheUtil(private val tempDir: String = "cache") {
@Throws(IOException::class)
fun save(cacheName: String?, fileName: String): File {
// if we already have this fileName, reuse it
val newFile = if (cacheName == null) {
makeCacheFile(fileName)
} else {
makeCacheFile(cacheName)
}
@Suppress("NAME_SHADOWING")
val cacheName = cacheName ?: fileName
val newFile = makeCacheFile(cacheName)
// if this file already exists (via HASH), we just reuse what is saved on disk.
if (newFile.canRead() && newFile.isFile) {
@ -184,11 +183,10 @@ class CacheUtil(private val tempDir: String = "cache") {
@Throws(IOException::class)
fun save(cacheName: String?, fileResource: URL): File {
// if we already have this fileName, reuse it
val newFile = if (cacheName == null) {
makeCacheFile(fileResource.path)
} else {
makeCacheFile(cacheName)
}
@Suppress("NAME_SHADOWING")
val cacheName = cacheName ?: fileResource.path
val newFile = makeCacheFile(cacheName)
// if this file already exists (via HASH), we just reuse what is saved on disk.
if (newFile.canRead() && newFile.isFile) {
@ -218,11 +216,10 @@ class CacheUtil(private val tempDir: String = "cache") {
@Throws(IOException::class)
fun save(cacheName: String?, fileStream: InputStream): File {
// if we already have this fileName, reuse it
val newFile = if (cacheName == null) {
makeCacheFile(createNameAsHash(fileStream))
} else {
makeCacheFile(cacheName)
}
@Suppress("NAME_SHADOWING")
val cacheName = cacheName ?: createNameAsHash(fileStream)
val newFile = makeCacheFile(cacheName)
// if this file already exists (via HASH), we just reuse what is saved on disk.
return if (newFile.canRead() && newFile.isFile) {
@ -239,13 +236,7 @@ class CacheUtil(private val tempDir: String = "cache") {
* @return the full path of the resource copied to disk, or NULL if invalid
*/
@Throws(IOException::class)
private fun makeFileViaStream(cacheName: String?, resourceStream: InputStream?): File {
if (resourceStream == null) {
throw NullPointerException("resourceStream")
}
if (cacheName == null) {
throw NullPointerException("cacheName")
}
private fun makeFileViaStream(cacheName: String, resourceStream: InputStream): File {
val newFile = makeCacheFile(cacheName)
// if this file already exists (via HASH), we just reuse what is saved on disk.

View File

@ -26,7 +26,7 @@ object Sys {
/**
* Gets the version number.
*/
val version = "1.47"
val version = "1.48"
init {
// Add this project to the updates system, which verifies this class + UUID + version information