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

Daniel Stieglitz updated NIFI-16021:
------------------------------------
    Description: 
JoltTransformJSON allows for multi-line Java comment anywhere in the Jolt spec 
except for the leading line when the Jolt Spec is specified as text (not with a 
file path). The error message is not really helpful as to what the issue is, as 
seen with the following error message
{code:java}
'Jolt Specification' is invalid because Specification not valid for the 
selected transformation: Read JOLT Transform failed{code}
but ultimately the cause of error is a java.io.FileNotFoundException.

On the other hand, ValidateJson does not allow for any type of comments, as the 
com.fasterxml.jackson.databind.ObjectMapper it uses for creating Json schemas 
object uses strict parsing and does not allow for Java comments.  There should 
be a com.fasterxml.jackson.core.JsonParseException thrown if a comment is used 
before the actual schema
{code:java}
 // Single line Java comment
 {
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
 }

/*
  Multi-line Java comment
*/
{
    
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
 } {code}
or inside the schema
{code:java}
{
    // Single line Java comment
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
}

{
    // Multi-line Java comment
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
} {code}
yet when there is leading multi-line Java comment the error thrown is 
java.io.FileNotFoundException.

 

  was:
JoltTransformJSON allows for multi-line Java comment anywhere in the Jolt spec 
except for the leading line when the Jolt Spec is specified as text (not with a 
file path). The error message is not really helpful as to what the issue is as 
seen with the following error message
{code:java}
'Jolt Specification' is invalid because Specification not valid for the 
selected transformation: Read JOLT Transform failed{code}
but ultimately the cause of error is a java.io.FileNotFoundException.

On the other hand, ValidateJson does not allow for any type of comments, as the 
com.fasterxml.jackson.databind.ObjectMapper it uses for creating Json schemas 
object uses strict parsing and does not allow for Java comments.  There should 
be a com.fasterxml.jackson.core.JsonParseException thrown if a comment is used 
before the actual schema
{code:java}
 // Single line Java comment
 {
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
 }

/*
  Multi-line Java comment
*/
{
    
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
 } {code}
or inside the schema
{code:java}
{
    // Single line Java comment
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
}

{
    // Multi-line Java comment
    "$schema": "https://json-schema.org";,
    "type": "object",
    "additionalProperties": true
} {code}
yet when there is leading multi-line Java comment the error thrown is 
java.io.FileNotFoundException.

 


> JoltTransformJSON and ValidateJson do not allow for leading multi-line Java 
> comment in Jolt spec and validation schema
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-16021
>                 URL: https://issues.apache.org/jira/browse/NIFI-16021
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Major
>
> JoltTransformJSON allows for multi-line Java comment anywhere in the Jolt 
> spec except for the leading line when the Jolt Spec is specified as text (not 
> with a file path). The error message is not really helpful as to what the 
> issue is, as seen with the following error message
> {code:java}
> 'Jolt Specification' is invalid because Specification not valid for the 
> selected transformation: Read JOLT Transform failed{code}
> but ultimately the cause of error is a java.io.FileNotFoundException.
> On the other hand, ValidateJson does not allow for any type of comments, as 
> the com.fasterxml.jackson.databind.ObjectMapper it uses for creating Json 
> schemas object uses strict parsing and does not allow for Java comments.  
> There should be a com.fasterxml.jackson.core.JsonParseException thrown if a 
> comment is used before the actual schema
> {code:java}
>  // Single line Java comment
>  {
>     "$schema": "https://json-schema.org";,
>     "type": "object",
>     "additionalProperties": true
>  }
> /*
>   Multi-line Java comment
> */
> {
>     
>     "$schema": "https://json-schema.org";,
>     "type": "object",
>     "additionalProperties": true
>  } {code}
> or inside the schema
> {code:java}
> {
>     // Single line Java comment
>     "$schema": "https://json-schema.org";,
>     "type": "object",
>     "additionalProperties": true
> }
> {
>     // Multi-line Java comment
>     "$schema": "https://json-schema.org";,
>     "type": "object",
>     "additionalProperties": true
> } {code}
> yet when there is leading multi-line Java comment the error thrown is 
> java.io.FileNotFoundException.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to