[
https://issues.apache.org/jira/browse/AVRO-3486?focusedWorklogId=789020&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-789020
]
ASF GitHub Bot logged work on AVRO-3486:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Jul/22 14:31
Start Date: 08/Jul/22 14:31
Worklog Time Spent: 10m
Work Description: opwvhk commented on code in PR #1637:
URL: https://github.com/apache/avro/pull/1637#discussion_r916875707
##########
lang/java/avro/src/main/java/org/apache/avro/Protocol.java:
##########
@@ -275,15 +274,29 @@ public Protocol(Protocol p) {
public Protocol(String name, String doc, String namespace) {
super(PROTOCOL_RESERVED);
- this.name = name;
+ setName(name, namespace);
this.doc = doc;
- this.namespace = namespace;
}
public Protocol(String name, String namespace) {
this(name, null, namespace);
}
+ private void setName(String name, String namespace) {
+ int lastDot = name.lastIndexOf('.');
+ if (lastDot < 0) {
+ this.name = name;
+ this.namespace = namespace;
+ } else {
Review Comment:
The intent is to use the same namespace the the definition itself, and any
enclosed definitions that don't specify one themselves. This is a lot easier to
comprehend than using different namespaces.
Issue Time Tracking
-------------------
Worklog Id: (was: 789020)
Time Spent: 40m (was: 0.5h)
> Protocol namespace not parsed correctly if protocol is defined by full name
> ---------------------------------------------------------------------------
>
> Key: AVRO-3486
> URL: https://issues.apache.org/jira/browse/AVRO-3486
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.11.1
> Reporter: Oscar Westra van Holthe - Kind
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.12.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> When parsing a protocol with a full name (but no namespace), the namespace is
> not parsed correctly.
> The spec for [Protocol
> Declaration|https://avro.apache.org/docs/current/spec.html#Protocol+Declaration]
> says:
> {quote}The name and namespace qualification rules defined for schema objects
> apply to protocols as well.
> {quote}
> However, a protocol namespace can only be specified using the {{namespace}}
> attribute, not by using a full name like {{qualified.Name}} as protocol name.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)