Skip to content

Commit

Permalink
Fix updateCopyrights Gradle task to read in UTF-8
Browse files Browse the repository at this point in the history
It looks like `file.text` in Groovy relies on a default charset from operating system.
It causes non-ASCII (e.g. in the `@author`) symbols to be broken

* Make some modification to the `KafkaTemplate` to ensure that copyright is updated, but `Thomas Strauß`
name is not broken
  • Loading branch information
artembilan committed Jan 11, 2024
1 parent c683f31 commit 769da20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ configure(javaProjects) { subproject ->
def beginningYear = matcher[0][1]
if (now != beginningYear && now != matcher[0][2]) {
def years = "$beginningYear-$now"
def sourceCode = file.text
def sourceCode = file.getText('UTF-8')
sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years)
file.write(sourceCode)
println "Copyright updated for file: $file"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,6 +79,7 @@
import org.springframework.messaging.converter.SmartMessageConverter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
Expand All @@ -102,7 +103,6 @@
* @author Soby Chacko
* @author Gurps Bassi
*/
@SuppressWarnings("deprecation")
public class KafkaTemplate<K, V> implements KafkaOperations<K, V>, ApplicationContextAware, BeanNameAware,
ApplicationListener<ContextStoppedEvent>, DisposableBean, SmartInitializingSingleton {

Expand Down Expand Up @@ -226,7 +226,7 @@ public KafkaTemplate(ProducerFactory<K, V> producerFactory, boolean autoFlush,
Assert.notNull(producerFactory, "'producerFactory' cannot be null");
this.autoFlush = autoFlush;
this.micrometerEnabled = KafkaUtils.MICROMETER_PRESENT;
this.customProducerFactory = configOverrides != null && configOverrides.size() > 0;
this.customProducerFactory = !CollectionUtils.isEmpty(configOverrides);
if (this.customProducerFactory) {
this.producerFactory = producerFactory.copyWithConfigurationOverride(configOverrides);
}
Expand Down Expand Up @@ -352,7 +352,7 @@ public boolean isAllowNonTransactional() {
}

/**
* Set to false to disable micrometer timers, if micrometer is on the class path.
* Set to {@code false} to disable micrometer timers, if micrometer is on the class path.
* @param micrometerEnabled false to disable.
* @since 2.5
*/
Expand All @@ -365,7 +365,7 @@ public void setMicrometerEnabled(boolean micrometerEnabled) {
* @param tags the tags.
* @since 2.5
*/
public void setMicrometerTags(Map<String, String> tags) {
public void setMicrometerTags(@Nullable Map<String, String> tags) {
if (tags != null) {
this.micrometerTags.putAll(tags);
}
Expand Down

0 comments on commit 769da20

Please sign in to comment.