[ 
https://issues.apache.org/jira/browse/NIFI-740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14605501#comment-14605501
 ] 

Toivo Adams commented on NIFI-740:
----------------------------------

I did some experiments.
I let JAXB generate model classes from XML.
Next I used JAXB to parse and validate "/conf/all-flow.xml"

Validation result is:

EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comment}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 
16; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{comment}' is expected.
LOCATOR
    LINE NUMBER:  22
    COLUMN NUMBER:  16
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"style"). Expected elements are 
<{}id>,<{}outputPort>,<{}position>,<{}connection>,<{}funnel>,<{}name>,<{}processGroup>,<{}label>,<{}processor>,<{}comment>,<{}inputPort>,<{}remoteProcessGroup>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  22
    COLUMN NUMBER:  16
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{styles}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{styles}' is expected.
LOCATOR
    LINE NUMBER:  28
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"style"). Expected elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  28
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"schedulingPeriodSeconds"). 
Expected elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  32
    COLUMN NUMBER:  38
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"maxWorkQueueSize"). Expected 
elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  33
    COLUMN NUMBER:  31
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"running"). Expected elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  35
    COLUMN NUMBER:  22
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"flowFileExpirationMinutes"). 
Expected elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  36
    COLUMN NUMBER:  40
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"queuePrioritizerClass"). Expected 
elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  37
    COLUMN NUMBER:  36
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"inputFilterClass"). Expected 
elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  38
    COLUMN NUMBER:  31
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"outputFilterClass"). Expected 
elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  39
    COLUMN NUMBER:  32
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{styles}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 46; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{styles}' is expected.
LOCATOR
    LINE NUMBER:  46
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  0
MESSAGE:  Errors limit exceeded. To receive all errors set com.sun.xml.bind 
logger to FINEST level.
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  46
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  1
MESSAGE:  unexpected element (uri:"", local:"style"). Expected elements are 
<{}position>,<{}isolated>,<{}annotationData>,<{}lossTolerant>,<{}styles>,<{}class>,<{}runDurationNanos>,<{}autoTerminatedRelationship>,<{}property>,<{}yieldPeriod>,<{}scheduledState>,<{}penalizationPeriod>,<{}schedulingStrategy>,<{}maxConcurrentTasks>,<{}schedulingPeriod>,<{}id>,<{}name>,<{}bulletinLevel>,<{}comment>
LINKED EXCEPTION:  null
LOCATOR
    LINE NUMBER:  46
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comments}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 69; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{comments}' is expected.
LOCATOR
    LINE NUMBER:  69
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comments}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 75; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{comments}' is expected.
LOCATOR
    LINE NUMBER:  75
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{size}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 80; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{size}' is expected.
LOCATOR
    LINE NUMBER:  80
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comment}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 87; columnNumber: 
20; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{comment}' is expected.
LOCATOR
    LINE NUMBER:  87
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{styles}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 93; columnNumber: 
24; cvc-complex-type.2.4.a: Invalid content was found starting with element 
'style'. One of '{styles}' is expected.
LOCATOR
    LINE NUMBER:  93
    COLUMN NUMBER:  24
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comments}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 112; 
columnNumber: 24; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{comments}' is expected.
LOCATOR
    LINE NUMBER:  112
    COLUMN NUMBER:  24
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comments}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 118; 
columnNumber: 24; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{comments}' is expected.
LOCATOR
    LINE NUMBER:  118
    COLUMN NUMBER:  24
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{sourceId}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 126; 
columnNumber: 25; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{sourceId}' is expected.
LOCATOR
    LINE NUMBER:  126
    COLUMN NUMBER:  25
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{comment}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 142; 
columnNumber: 20; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{comment}' is expected.
LOCATOR
    LINE NUMBER:  142
    COLUMN NUMBER:  20
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{sourceId}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 152; 
columnNumber: 21; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{sourceId}' is expected.
LOCATOR
    LINE NUMBER:  152
    COLUMN NUMBER:  21
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{sourceId}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 169; 
columnNumber: 21; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{sourceId}' is expected.
LOCATOR
    LINE NUMBER:  169
    COLUMN NUMBER:  21
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null


EVENT
SEVERITY:  2
MESSAGE:  cvc-complex-type.2.4.a: Invalid content was found starting with 
element 'style'. One of '{sourceId}' is expected.
LINKED EXCEPTION:  org.xml.sax.SAXParseException; lineNumber: 186; 
columnNumber: 21; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'style'. One of '{sourceId}' is expected.
LOCATOR
    LINE NUMBER:  186
    COLUMN NUMBER:  21
    OFFSET:  -1
    OBJECT:  null
    NODE:  null
    URL:  null

So, should we start using JAXB (at least for validation) 
and stop processing XML flow file when validation fails?


> StandardFlowServiceTest need to be updated.
> -------------------------------------------
>
>                 Key: NIFI-740
>                 URL: https://issues.apache.org/jira/browse/NIFI-740
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Toivo Adams
>            Assignee: Toivo Adams
>            Priority: Minor
>             Fix For: 0.3.0
>
>
> Currently 
> /nifi-framework-core/src/test/java/org/apache/nifi/controller/StandardFlowServiceTest.java
>  :
> [Error] :22:16: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comment}' is expected. 
> [Error] :28:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{styles}' is expected. 
> [Error] :46:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{styles}' is expected. 
> [Error] :69:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comments}' is expected. 
> [Error] :75:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comments}' is expected. 
> [Error] :80:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{size}' is expected. 
> [Error] :87:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comment}' is expected. 
> [Error] :93:24: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{styles}' is expected. 
> [Error] :112:24: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comments}' is expected. 
> [Error] :118:24: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comments}' is expected. 
> [Error] :126:25: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{sourceId}' is expected. 
> [Error] :142:20: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{comment}' is expected. 
> [Error] :152:21: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{sourceId}' is expected. 
> [Error] :169:21: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{sourceId}' is expected. 
> [Error] :186:21: cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'style'. One of '{sourceId}' is expected. 
> And finally public void testLoadExistingFlow() test fails: 
> org.apache.nifi.controller.FlowSynchronizationException: 
> java.lang.NullPointerException: Name is null 
>         at 
> org.apache.nifi.controller.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:317)
>  
>         at 
> org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1154)
>  
>         at 
> org.apache.nifi.persistence.StandardXMLFlowConfigurationDAO.load(StandardXMLFlowConfigurationDAO.java:72)
>  
>         at 
> org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:608)
>  
>         at 
> org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:458)
>  
>         at 
> org.apache.nifi.controller.StandardFlowServiceTest.testLoadExistingFlow(StandardFlowServiceTest.java:98)
>  
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
>         at java.lang.reflect.Method.invoke(Method.java:606) 
>         at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>  
>         at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  
>         at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>  
>         at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  
>         at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
>         at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>  
>         at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>  
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
>         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
>         at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
>         at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>  
>         at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>  
>         at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>  
>         at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>  
>         at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>  
>         at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
>  
> Caused by: java.lang.NullPointerException: Name is null 
>         at java.lang.Enum.valueOf(Enum.java:235) 
>         at 
> org.apache.nifi.controller.ScheduledState.valueOf(ScheduledState.java:1) 
>         at 
> org.apache.nifi.controller.FlowFromDOMFactory.getScheduledState(FlowFromDOMFactory.java:444)
>  
>         at 
> org.apache.nifi.controller.FlowFromDOMFactory.getProcessor(FlowFromDOMFactory.java:356)
>  
>         at 
> org.apache.nifi.controller.FlowFromDOMFactory.getProcessGroup(FlowFromDOMFactory.java:147)
>  
>         at 
> org.apache.nifi.controller.StandardFlowSynchronizer.addProcessGroup(StandardFlowSynchronizer.java:758)
>  
>         at 
> org.apache.nifi.controller.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:271)
>  
>         ... 30 more 
> Possibly flow files used for testing 
> "/conf/all-flow.xml" 
> "/conf/all-flow-inheritable.xml"
> etc
> need to be updated to comply with newer FlowConfiguration.xsd requirements. 



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

Reply via email to