Skip to content

Commit

Permalink
Merge pull request #1285 from adoptium/main
Browse files Browse the repository at this point in the history
Merge main to prod
  • Loading branch information
johnoliver authored Nov 29, 2024
2 parents 1eef5d3 + 0ab288c commit 4334642
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/actions/docker-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
using: composite
steps:
- name: Build container image and push to Azure
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: ${{ inputs.DOCKER_FILE }}
tags: ${{ inputs.DOCKER_REPO }}:latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package net.adoptium.api.v3.dataSources.persitence.mongo

import java.math.BigInteger
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import java.time.ZoneId
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.*

@JsonIgnoreProperties(ignoreUnknown = true)
data class UpdatedInfo(
val time: ZonedDateTime,
val checksum: String,
val hashCode: Int,
val hexChecksum: String? = BigInteger(1, Base64.getDecoder().decode(checksum)).toString(16),
val lastModified: Date? = Date.from(time.toInstant()),
val lastModifiedFormatted: String? = lastModified
?.toInstant()
Expand Down
6 changes: 3 additions & 3 deletions adoptium-api-versions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<properties>
<coroutine.version>1.9.0</coroutine.version>
<jackson.version>2.18.1</jackson.version>
<jackson.version>2.18.2</jackson.version>
<jdk.version>17</jdk.version>
<mongo.version>5.1.2</mongo.version>
<kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
Expand All @@ -20,7 +20,7 @@
<maven.project-info-reports-plugin.version>3.8.0</maven.project-info-reports-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.17.0</quarkus.version>
<quarkus.version>3.17.2</quarkus.version>
<rest-assured.version>5.5.0</rest-assured.version>
</properties>

Expand Down Expand Up @@ -177,7 +177,7 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>4.18.0</version>
<version>4.18.1</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ class CacheControlService @Inject constructor(private var apiDataStore: APIDataS

private fun calculateEtag(requestContext: ContainerRequestContext): String {
val md = MessageDigest.getInstance("SHA1")
if (apiDataStore.getUpdateInfo().hexChecksum != null) {
md.update(HexFormat.of().parseHex(apiDataStore.getUpdateInfo().hexChecksum))
try {
md.update(Base64.getDecoder().decode(apiDataStore.getUpdateInfo().checksum))
} catch (e: Exception) {
// Should not happen as the hex checksum should always be a valid Base64 string
md.update(apiDataStore.getUpdateInfo().checksum.toByteArray())
}
md.update(requestContext.uriInfo.requestUri.toString().toByteArray())
return BigInteger(1, md.digest()).toString(16)
Expand All @@ -46,12 +49,12 @@ class CacheControlService @Inject constructor(private var apiDataStore: APIDataS

val lastModified = apiDataStore.getUpdateInfo().lastModified

if (lastModified == null || etag == null) {
if (lastModified == null) {
return
}

val builder =
requestContext!!
requestContext
.request
.evaluatePreconditions(lastModified, EntityTag(etag))

Expand All @@ -70,8 +73,7 @@ class CacheControlService @Inject constructor(private var apiDataStore: APIDataS
ecc.maxAge = MAX_CACHE_AGE_IN_SEC
ecc.sMaxAge = MAX_CACHE_AGE_IN_SEC

if (apiDataStore.getUpdateInfo().hexChecksum == null ||
apiDataStore.getUpdateInfo().lastModifiedFormatted == null) {
if (apiDataStore.getUpdateInfo().lastModifiedFormatted == null) {
return
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<spotbugs.version>4.7.3</spotbugs.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.17.0</quarkus.version>
<quarkus.version>3.17.2</quarkus.version>
</properties>

<modules>
Expand Down

0 comments on commit 4334642

Please sign in to comment.