[
https://issues.apache.org/jira/browse/AVRO-3486?focusedWorklogId=789022&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-789022
]
ASF GitHub Bot logged work on AVRO-3486:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Jul/22 14:37
Start Date: 08/Jul/22 14:37
Worklog Time Spent: 10m
Work Description: opwvhk commented on code in PR #1637:
URL: https://github.com/apache/avro/pull/1637#discussion_r916880917
##########
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 {
+ this.name = name.substring(lastDot) + 1;
+ this.namespace = name.substring(0, lastDot);
+ }
+ if ("".equals(this.namespace)) {
Review Comment:
Changed.
Issue Time Tracking
-------------------
Worklog Id: (was: 789022)
Time Spent: 50m (was: 40m)
> 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: 50m
> 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)