[
https://issues.apache.org/jira/browse/AVRO-3375?focusedWorklogId=722960&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-722960
]
ASF GitHub Bot logged work on AVRO-3375:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Feb/22 16:22
Start Date: 08/Feb/22 16:22
Worklog Time Spent: 10m
Work Description: radai-rosenblatt commented on a change in pull request
#1526:
URL: https://github.com/apache/avro/pull/1526#discussion_r801817666
##########
File path:
lang/java/avro/src/main/java/org/apache/avro/generic/TracingNullPointException.java
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro.generic;
+
+import org.apache.avro.Schema;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * a {@link NullPointerException} with extra fields used to trace back the path
+ * to a null value through an object graph
+ */
+public class TracingNullPointException extends NullPointerException {
+ private final NullPointerException cause;
+ private final Schema expected;
+ private final List<PathStep> reversePath;
+
+ public TracingNullPointException(NullPointerException cause, Schema
expected) {
+ this.cause = cause;
+ this.expected = expected;
+ this.reversePath = new ArrayList<>(1); //assume short
+ }
+
+ public void tracePath(PathStep step) {
+ reversePath.add(step);
+ }
+
+ @Override
+ public synchronized NullPointerException getCause() {
+ return cause;
+ }
+
+ /**
+ * @return a hopefully helpful error message
+ */
+ public NullPointerException summarize() {
+ StringBuilder sb = new StringBuilder();
+ PathStep lastStep = reversePath.get(0);
Review comment:
will fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 722960)
Time Spent: 0.5h (was: 20m)
> add union branch, array index and map key "path" information to serialization
> errors
> ------------------------------------------------------------------------------------
>
> Key: AVRO-3375
> URL: https://issues.apache.org/jira/browse/AVRO-3375
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.11.0
> Reporter: radai rosenblatt
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> https://issues.apache.org/jira/browse/AVRO-2514 improved serialization error
> messages greatly by providing more information about the "location" of a
> piece of erroneous data in the object graph handed to a serializer.
>
> however, a few more things can be improved:
> * no info printed about which union branches were selected/used
> * no info printed about array indexes or map keys
> * (subjective) text could be made more concise.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)