You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "michael d'angelo (JIRA)" <ji...@apache.org> on 2015/03/28 04:01:52 UTC

[jira] [Updated] (AVRO-1652) Java - Schema.Field prints out System.err [WARNING] even though validateDefaults is set to false.

     [ https://issues.apache.org/jira/browse/AVRO-1652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

michael d'angelo updated AVRO-1652:
-----------------------------------
    Description: 
Inside of Schema.Field we see the following chunk of code:


{code:title=Schema.java|borderStyle=solid}
  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;
  }
{code}

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.

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


  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.


> Java - Schema.Field prints out System.err [WARNING] even though validateDefaults is set to false.
> -------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-1652
>                 URL: https://issues.apache.org/jira/browse/AVRO-1652
>             Project: Avro
>          Issue Type: Bug
>    Affects Versions: 1.7.7
>         Environment: Java
>            Reporter: michael d'angelo
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Inside of Schema.Field we see the following chunk of code:
> {code:title=Schema.java|borderStyle=solid}
>   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;
>   }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)