Skip to content

Commit

Permalink
Merge pull request #41636 from gsmet/3.12.1-backports-3
Browse files Browse the repository at this point in the history
[3.12] 3.12.1 backports 3
  • Loading branch information
gsmet authored Jul 3, 2024
2 parents 31f58dc + 61c62fc commit 08f02f0
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.1</awaitility.version>
<jboss-logmanager.version>3.0.6.Final</jboss-logmanager.version>
<flyway.version>10.15.0</flyway.version>
<flyway.version>10.15.2</flyway.version>
<yasson.version>3.0.3</yasson.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
<liquibase.version>4.27.0</liquibase.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.quarkus.runner.bootstrap;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -32,6 +31,7 @@
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.classloading.ClassLoaderEventListener;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.bootstrap.util.PropertyUtils;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.builder.BuildResult;
import io.quarkus.builder.item.BuildItem;
Expand Down Expand Up @@ -235,8 +235,8 @@ private void writeArtifactResultMetadataFile(BuildSystemTargetBuildItem outputTa
properties.put("metadata." + entry.getKey(), entry.getValue());
}
}
try (FileOutputStream fos = new FileOutputStream(quarkusArtifactMetadataPath.toFile())) {
properties.store(fos, "Generated by Quarkus - Do not edit manually");
try {
PropertyUtils.store(properties, quarkusArtifactMetadataPath, "Generated by Quarkus - Do not edit manually");
} catch (IOException e) {
log.debug("Unable to write artifact result metadata file", e);
}
Expand Down
5 changes: 5 additions & 0 deletions devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ public Optional<String> checkMissingCommand(CommandLine root, String[] args) {
return Optional.empty();
} catch (UnmatchedArgumentException e) {
return Optional.of(args[0]);
} catch (Exception e) {
// For any other exceptions (e.g. MissingParameterException), we should just ignore.
// The problem is not that the command is missing but that the options might not be adequate.
// This will be handled by Picocli at a later step.
return Optional.empty();
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/security-jwt-build.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ As mentioned above, `iat` (issued at), `exp` (expires at), `jti` (token identifi

[source,properties]
----
smallrye.jwt.sign.key=privateKey.pem
smallrye.jwt.encrypt.key=publicKey.pem
smallrye.jwt.sign.key.location=privateKey.pem
smallrye.jwt.encrypt.key.location=publicKey.pem
----

You can also use MicroProfile `ConfigSource` to fetch the keys from the external services such as link:{vault-guide}[HashiCorp Vault] or other secret managers and use `smallrye.jwt.sign.key` and `smallrye.jwt.encrypt.key` properties instead:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ public static final boolean getBoolean(String name, boolean notFoundValue) {
* {@link Properties#store(Writer, String)} format but skipping the timestamp and comments.
*
* @param properties properties to store
* @param leadingComment a leading comment, it will be prepended by an hash
* @param file target file
* @throws IOException in case of a failure
*/
public static void store(Properties properties, Path file) throws IOException {
public static void store(Properties properties, Path file, String leadingComment) throws IOException {
try (BufferedWriter writer = Files.newBufferedWriter(file)) {
store(properties, writer);
store(properties, writer, leadingComment);
}
}

Expand All @@ -75,11 +76,19 @@ public static void store(Properties properties, Path file) throws IOException {
* {@link Properties#store(Writer, String)} format but skipping the timestamp and comments.
*
* @param properties properties to store
* @param leadingComment a leading comment, it will be prepended by an hash
* @param writer target writer
* @throws IOException in case of a failure
*/
public static void store(Properties properties, Writer writer) throws IOException {
public static void store(Properties properties, Writer writer, String leadingComment) throws IOException {
final List<String> names = new ArrayList<>(properties.size());

if (leadingComment != null && !leadingComment.isBlank()) {
writer.write("# ");
writer.write(leadingComment);
writer.write(System.lineSeparator());
}

for (var name : properties.keySet()) {
names.add(name == null ? null : name.toString());
}
Expand All @@ -97,16 +106,58 @@ public static void store(Properties properties, Writer writer) throws IOExceptio
* @param file target file
* @throws IOException in case of a failure
*/
public static void store(Map<String, String> properties, Path file) throws IOException {
public static void store(Map<String, String> properties, Path file, String leadingComment) throws IOException {
final List<String> names = new ArrayList<>(properties.keySet());
Collections.sort(names);
try (BufferedWriter writer = Files.newBufferedWriter(file)) {
if (leadingComment != null && !leadingComment.isBlank()) {
writer.write("# ");
writer.write(leadingComment);
writer.write(System.lineSeparator());
}

for (String name : names) {
store(writer, name, properties.get(name));
}
}
}

/**
* Stores properties into a file sorting the keys alphabetically and following
* {@link Properties#store(Writer, String)} format but skipping the timestamp and comments.
*
* @param properties properties to store
* @param file target file
* @throws IOException in case of a failure
*/
public static void store(Properties properties, Path file) throws IOException {
store(properties, file, null);
}

/**
* Stores properties into a file sorting the keys alphabetically and following
* {@link Properties#store(Writer, String)} format but skipping the timestamp and comments.
*
* @param properties properties to store
* @param writer target writer
* @throws IOException in case of a failure
*/
public static void store(Properties properties, Writer writer) throws IOException {
store(properties, writer, null);
}

/**
* Stores a map of strings into a file sorting the keys alphabetically and following
* {@link Properties#store(Writer, String)} format but skipping the timestamp and comments.
*
* @param properties properties to store
* @param file target file
* @throws IOException in case of a failure
*/
public static void store(Map<String, String> properties, Path file) throws IOException {
store(properties, file, null);
}

/**
* Writes a config option with its value to the target writer,
* possibly applying some transformations, such as character escaping
Expand Down

0 comments on commit 08f02f0

Please sign in to comment.