[ 
https://issues.apache.org/jira/browse/CXF-8052?focusedWorklogId=257782&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-257782
 ]

ASF GitHub Bot logged work on CXF-8052:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jun/19 14:19
            Start Date: 11/Jun/19 14:19
    Worklog Time Spent: 10m 
      Work Description: ffang commented on pull request #560:  CXF-8052: Cannot 
set JAXB schema compiler options
URL: https://github.com/apache/cxf/pull/560
 
 
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 257782)
    Time Spent: 20m  (was: 10m)

> Cannot set JAXB schema compiler options
> ---------------------------------------
>
>                 Key: CXF-8052
>                 URL: https://issues.apache.org/jira/browse/CXF-8052
>             Project: CXF
>          Issue Type: Bug
>          Components: Simple Frontend
>    Affects Versions: 3.3.2
>         Environment: OpenJDK 12
>            Reporter: Ranjit Vadakkan
>            Assignee: Freeman Fang
>            Priority: Blocker
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> JAXB generates an is-prefix getter for a boolean data type in my WSDL instead 
> of a get-prefix getter, see 
> [https://www.ibm.com/developerworks/community/blogs/Dougclectica/entry/JAXB_with_Java_7_and_xs_boolean?lang=en]
>  
> The workaround is simple - pass the "-enableIntrospection" argument to the 
> JAXB compiler. Unfortunately, CXF fails with this error -
> {quote}Caused by: com.sun.tools.xjc.BadCommandLineException: grammar is not 
> specified
>  at com.sun.tools.xjc.Options.parseArguments(Options.java:861)
>  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>  ...
> {quote}
>  
> The test code to reproduce this is very simple -
> {quote}JaxWsDynamicClientFactory factory = 
> JaxWsDynamicClientFactory.newInstance();
> String[] schemaCompilerOptions = new String[] \{"-enableIntrospection"};
> factory.setSchemaCompilerOptions(schemaCompilerOptions);
> Client client = factory.createClient(<wsdlUrl>);
> {quote}
>  
> The error occurs in 
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory#createSchemaCompiler
> {quote}if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) 
> {
>      compiler.getOptions().parseArguments(schemaCompilerOptions);
> }
> {quote}
>  
> parseArguments expects the XML Schemas to have already been added to the 
> compiler.getOptions() object, but in DynamicClientFactory, the schemas are 
> added after parseArguments is called, which is why parseArguments spits out 
> the "grammar is not specified" error.
> This can be fixed in a couple of ways -
>  # Add a dummy schema to the compiler.getOptions() object before invoking 
> parseArguments on it.
>  # Relocate the call to parseArguments after the schemas have been added to 
> the compiler.getOptions() object.
>  
> Option 1 is used by 
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding in its 
> initialize() method -
> {quote}// keep parseArguments happy, supply dummy required command-line opts
> opts.addGrammar(new InputSource("null"));
> opts.parseArguments(args.toArray(new String[0]));
> {quote}
>  
> Personally, I prefer relocating the call instead of adding a dummy schema.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to