-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from coinse/dev_feb
dev_feb
- Loading branch information
Showing
44 changed files
with
2,195 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java | ||
index 3cf164fa79..7710adbc63 100644 | ||
--- a/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java | ||
+++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java | ||
@@ -47,6 +47,13 @@ public class UntypedObjectDeserializer | ||
|
||
protected JsonDeserializer<Object> _numberDeserializer; | ||
|
||
+ /** | ||
+ * Object.class may also have custom key deserializer | ||
+ * | ||
+ * @since 2.19 | ||
+ */ | ||
+ private KeyDeserializer _customKeyDeserializer; | ||
+ | ||
/** | ||
* If {@link java.util.List} has been mapped to non-default implementation, | ||
* we'll store type here | ||
@@ -73,7 +80,7 @@ public class UntypedObjectDeserializer | ||
*/ | ||
@Deprecated | ||
public UntypedObjectDeserializer() { | ||
- this(null, null); | ||
+ this(null, (JavaType) null); | ||
} | ||
|
||
public UntypedObjectDeserializer(JavaType listType, JavaType mapType) { | ||
@@ -95,6 +102,7 @@ public class UntypedObjectDeserializer | ||
_numberDeserializer = (JsonDeserializer<Object>) numberDeser; | ||
_listType = base._listType; | ||
_mapType = base._mapType; | ||
+ _customKeyDeserializer = base._customKeyDeserializer; | ||
_nonMerging = base._nonMerging; | ||
} | ||
|
||
@@ -111,9 +119,27 @@ public class UntypedObjectDeserializer | ||
_numberDeserializer = base._numberDeserializer; | ||
_listType = base._listType; | ||
_mapType = base._mapType; | ||
+ _customKeyDeserializer = base._customKeyDeserializer; | ||
_nonMerging = nonMerging; | ||
} | ||
|
||
+ /** | ||
+ * @since 2.19 | ||
+ */ | ||
+ protected UntypedObjectDeserializer(UntypedObjectDeserializer base, | ||
+ KeyDeserializer keyDeser) | ||
+ { | ||
+ super(Object.class); | ||
+ _mapDeserializer = base._mapDeserializer; | ||
+ _listDeserializer = base._listDeserializer; | ||
+ _stringDeserializer = base._stringDeserializer; | ||
+ _numberDeserializer = base._numberDeserializer; | ||
+ _listType = base._listType; | ||
+ _mapType = base._mapType; | ||
+ _nonMerging = base._nonMerging; | ||
+ _customKeyDeserializer = keyDeser; | ||
+ } | ||
+ | ||
/* | ||
/********************************************************** | ||
/* Initialization | ||
@@ -190,19 +216,32 @@ public class UntypedObjectDeserializer | ||
// 14-Jun-2017, tatu: [databind#1625]: may want to block merging, for root value | ||
boolean preventMerge = (property == null) | ||
&& Boolean.FALSE.equals(ctxt.getConfig().getDefaultMergeable(Object.class)); | ||
+ // Since 2.19, 31-Aug-2024: [databind#4680] Allow custom key deserializer for Object.class | ||
+ KeyDeserializer customKeyDeser = ctxt.findKeyDeserializer(ctxt.constructType(Object.class), property); | ||
+ // but make sure to ignore standard/default key deserializer (perf optimization) | ||
+ if (customKeyDeser != null) { | ||
+ if (ClassUtil.isJacksonStdImpl(customKeyDeser)) { | ||
+ customKeyDeser = null; | ||
+ } | ||
+ } | ||
// 20-Apr-2014, tatu: If nothing custom, let's use "vanilla" instance, | ||
// simpler and can avoid some of delegation | ||
if ((_stringDeserializer == null) && (_numberDeserializer == null) | ||
&& (_mapDeserializer == null) && (_listDeserializer == null) | ||
+ && (customKeyDeser == null) // [databind#4680] Since 2.19 : Allow custom key deserializer for Object.class | ||
&& getClass() == UntypedObjectDeserializer.class) { | ||
return UntypedObjectDeserializerNR.instance(preventMerge); | ||
} | ||
|
||
+ UntypedObjectDeserializer deser = this; | ||
if (preventMerge != _nonMerging) { | ||
- return new UntypedObjectDeserializer(this, preventMerge); | ||
+ deser = new UntypedObjectDeserializer(deser, preventMerge); | ||
} | ||
- | ||
- return this; | ||
+ // [databind#4680] Since 2.19 : Allow custom key deserializer for Object.class | ||
+ if (customKeyDeser != null) { | ||
+ deser = new UntypedObjectDeserializer(deser, customKeyDeser); | ||
+ } | ||
+ return deser; | ||
} | ||
|
||
/* | ||
@@ -496,6 +535,7 @@ public class UntypedObjectDeserializer | ||
// empty map might work; but caller may want to modify... so better just give small modifiable | ||
return new LinkedHashMap<>(2); | ||
} | ||
+ key1 = _customDeserializeKey(key1, ctxt); | ||
// minor optimization; let's handle 1 and 2 entry cases separately | ||
// 24-Mar-2015, tatu: Ideally, could use one of 'nextXxx()' methods, but for | ||
// that we'd need new method(s) in JsonDeserializer. So not quite yet. | ||
@@ -508,6 +548,8 @@ public class UntypedObjectDeserializer | ||
result.put(key1, value1); | ||
return result; | ||
} | ||
+ key2 = _customDeserializeKey(key2, ctxt); | ||
+ | ||
p.nextToken(); | ||
Object value2 = deserialize(p, ctxt); | ||
|
||
@@ -521,6 +563,8 @@ public class UntypedObjectDeserializer | ||
} | ||
return result; | ||
} | ||
+ key = _customDeserializeKey(key, ctxt); | ||
+ | ||
// And then the general case; default map size is 16 | ||
LinkedHashMap<String, Object> result = new LinkedHashMap<>(); | ||
result.put(key1, value1); | ||
@@ -535,9 +579,9 @@ public class UntypedObjectDeserializer | ||
final Object oldValue = result.put(key, newValue); | ||
if (oldValue != null) { | ||
return _mapObjectWithDups(p, ctxt, result, key, oldValue, newValue, | ||
- p.nextFieldName()); | ||
+ _customDeserializeNullableKey(p.nextFieldName(), ctxt)); | ||
} | ||
- } while ((key = p.nextFieldName()) != null); | ||
+ } while ((key = _customDeserializeNullableKey(p.nextFieldName(), ctxt)) != null); | ||
return result; | ||
} | ||
|
||
@@ -559,12 +603,44 @@ public class UntypedObjectDeserializer | ||
if ((oldValue != null) && squashDups) { | ||
_squashDups(result, key, oldValue, newValue); | ||
} | ||
- nextKey = p.nextFieldName(); | ||
+ nextKey = _customDeserializeNullableKey(p.nextFieldName(), ctxt); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
+ /** | ||
+ * Helper function to allow custom key deserialization without null handling. | ||
+ * Similar to {@link #_customDeserializeNullableKey(String, DeserializationContext)}, but | ||
+ * null handling is done by the caller. | ||
+ * | ||
+ * @returns Custom-deserialized key if both custom key deserializer is set. | ||
+ * Otherwise the original key. | ||
+ */ | ||
+ private final String _customDeserializeKey(String key, DeserializationContext ctxt) throws IOException { | ||
+ if (_customKeyDeserializer != null) { | ||
+ return (String) _customKeyDeserializer.deserializeKey(key, ctxt); | ||
+ } | ||
+ return key; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Helper function to allow custom key deserialization with null handling. | ||
+ * Similar to {@link #_customDeserializeKey(String, DeserializationContext)}, but instead | ||
+ * only returns custom-deserialized key if key is not null. | ||
+ * | ||
+ * @returns Custom-deserialized key if both custom key deserializer is set and key is not null. | ||
+ * Otherwise the original key. | ||
+ */ | ||
+ private final String _customDeserializeNullableKey(String key, DeserializationContext ctxt) throws IOException { | ||
+ if (_customKeyDeserializer != null) { | ||
+ if (key != null) { | ||
+ return (String) _customKeyDeserializer.deserializeKey(key, ctxt); | ||
+ } | ||
+ } | ||
+ return key; | ||
+ } | ||
+ | ||
@SuppressWarnings("unchecked") | ||
private void _squashDups(final Map<String, Object> result, String key, | ||
Object oldValue, Object newValue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java | ||
index 875c881a3970..69a0f3e80317 100644 | ||
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java | ||
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java | ||
@@ -477,7 +477,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege | ||
HashMap<String, String> tsImport = new HashMap<>(); | ||
// TVG: This is used as class name in the import statements of the model file | ||
tsImport.put("classname", im); | ||
- tsImport.put("filename", toModelFilename(im)); | ||
+ tsImport.put("filename", convertUsingFileNamingConvention(im)); | ||
tsImports.add(tsImport); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java | ||
index a015dee2a21b..f1308e2b7e7d 100644 | ||
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java | ||
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java | ||
@@ -6524,6 +6524,9 @@ public class DefaultCodegen implements CodegenConfig { | ||
// input.name => input_name | ||
modifiable = this.sanitizeValue(modifiable, "\\.", "_", exceptions); | ||
|
||
+ // input:name => input_name | ||
+ modifiable = this.sanitizeValue(modifiable, ":", "_", exceptions); | ||
+ | ||
// input-name => input_name | ||
modifiable = this.sanitizeValue(modifiable, "-", "_", exceptions); | ||
|
||
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java | ||
index 684df587ffb5..422866c16b23 100644 | ||
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java | ||
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java | ||
@@ -405,7 +405,7 @@ public class CrystalClientCodegen extends DefaultCodegen { | ||
String[] parts = modelName.split("::"); | ||
ArrayList<String> new_parts = new ArrayList<String>(); | ||
for (String part : parts) { | ||
- new_parts.add(sanitizeName(part)); | ||
+ new_parts.add(sanitizeName(part, "\\W", new ArrayList<>(List.of(":")))); | ||
} | ||
return String.join("::", new_parts); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java b/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java | ||
index 9f838b5154..b1057e2a8d 100644 | ||
--- a/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java | ||
+++ b/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java | ||
@@ -145,8 +145,9 @@ public class ConsumerManager { | ||
callConsumerIdsChangeListener(ConsumerGroupEvent.UNREGISTER, next.getKey()); | ||
} | ||
} | ||
- | ||
- callConsumerIdsChangeListener(ConsumerGroupEvent.CHANGE, next.getKey(), info.getAllChannel()); | ||
+ if (!isBroadcastMode(info.getMessageModel())) { | ||
+ callConsumerIdsChangeListener(ConsumerGroupEvent.CHANGE, next.getKey(), info.getAllChannel()); | ||
+ } | ||
} | ||
} | ||
return removed; | ||
@@ -196,7 +197,7 @@ public class ConsumerManager { | ||
} | ||
|
||
if (r1 || r2) { | ||
- if (isNotifyConsumerIdsChangedEnable) { | ||
+ if (isNotifyConsumerIdsChangedEnable && !isBroadcastMode(consumerGroupInfo.getMessageModel())) { | ||
callConsumerIdsChangeListener(ConsumerGroupEvent.CHANGE, group, consumerGroupInfo.getAllChannel()); | ||
} | ||
} | ||
@@ -219,7 +220,7 @@ public class ConsumerManager { | ||
consumerGroupInfo = prev != null ? prev : tmp; | ||
} | ||
boolean updateChannelRst = consumerGroupInfo.updateChannel(clientChannelInfo, consumeType, messageModel, consumeFromWhere); | ||
- if (updateChannelRst && isNotifyConsumerIdsChangedEnable) { | ||
+ if (updateChannelRst && isNotifyConsumerIdsChangedEnable && !isBroadcastMode(consumerGroupInfo.getMessageModel())) { | ||
callConsumerIdsChangeListener(ConsumerGroupEvent.CHANGE, group, consumerGroupInfo.getAllChannel()); | ||
} | ||
if (null != this.brokerStatsManager) { | ||
@@ -244,7 +245,7 @@ public class ConsumerManager { | ||
callConsumerIdsChangeListener(ConsumerGroupEvent.UNREGISTER, group); | ||
} | ||
} | ||
- if (isNotifyConsumerIdsChangedEnable) { | ||
+ if (isNotifyConsumerIdsChangedEnable && !isBroadcastMode(consumerGroupInfo.getMessageModel())) { | ||
callConsumerIdsChangeListener(ConsumerGroupEvent.CHANGE, group, consumerGroupInfo.getAllChannel()); | ||
} | ||
} | ||
@@ -334,4 +335,8 @@ public class ConsumerManager { | ||
} | ||
} | ||
} | ||
+ | ||
+ private boolean isBroadcastMode(final MessageModel messageModel) { | ||
+ return MessageModel.BROADCASTING.equals(messageModel); | ||
+ } | ||
} |
Oops, something went wrong.