Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1652

Java - Schema.Field prints out System.err [WARNING] even though validateDefaults is set to false.

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.7
    • 1.8.0
    • None
    • None
    • Java

    Description

      Inside of Schema.Field we see the following chunk of code:

      Schema.java
        private static JsonNode validateDefault(String fieldName, Schema schema,
                                                JsonNode defaultValue) {
          if ((defaultValue != null)
              && !isValidDefault(schema, defaultValue)) { // invalid default
            String message = "Invalid default for field "+fieldName
              +": "+defaultValue+" not a "+schema;
            if (VALIDATE_DEFAULTS.get())
              throw new AvroTypeException(message);     // throw exception
            System.err.println("[WARNING] Avro: "+message); // or log warning
          }
          return defaultValue;
        }
      

      The code checks to see if we should be validating the defaults and will only print the Exception if we are. The code always prints the WARNING out to System.err, though.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mdang Michael D'Angelo Assign to me
            mdang Michael D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

              Slack

                Issue deployment