castor
  1. castor
  2. CASTOR-1875

When SourceGenerator doesn't omit warnings, it hangs build waiting for confirmation

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: XML code generator
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      If you set SourceGenerator to NOT omit warnings (using the odd notion of setting "warnings" to "true"), and it's used in a normal build situation where the castor process is forked, the SourceGenerator will wait for input confirming whether to continue or not, even BEFORE printing the warning. In this situation, the build is hung, and will not complete. If the build is run from the command line on a console, and the user pressed ^C at this point, the forked process spins away, creating even more confusion.

      In general, I'd say there's not much point in prompting for whether to continue or not. A warning is a warning. It should always continue on. If the generated code is broken, it won't compile. At least printing the warning gives me more information about what's wrong.

      if there's a desire to not change existing behavior, then add another command-line option, like "-continue", to indicate to always continue on warnings. The doc for this should recommend using that flag in anything but a pure direct command-line execution of the SourceGenerator (just about the only situation where prompting can be of any use).

      Just in case, I'll attach a zip file containing my Ant build file, properties file, and the xsd I'm trying to process.

      1. patch.c1875.20070221.txt
        2 kB
        Werner Guttmann

        Activity

        Hide
        Werner Guttmann added a comment -

        Change committed, changing the usage message to ...

        "Sets name conflict strategy to use (possible values are "'informViaLog', 'warnViaConsoleDialog')"

        Show
        Werner Guttmann added a comment - Change committed, changing the usage message to ... "Sets name conflict strategy to use (possible values are "'informViaLog', 'warnViaConsoleDialog')"
        Hide
        Werner Guttmann added a comment -

        Just made a new snapshot release available at

        http://snapshots.repository.codehaus.org/org/codehaus/castor/

        Please note that the JAR for the Ant tasks has been renamed castor-anttasks-1.1.1-SNAPSHOT.jar, and can be found at

        http://snapshots.repository.codehaus.org/org/codehaus/castor/castor-anttasks/

        I hope you'll find everything you'll need.

        Show
        Werner Guttmann added a comment - Just made a new snapshot release available at http://snapshots.repository.codehaus.org/org/codehaus/castor/ Please note that the JAR for the Ant tasks has been renamed castor-anttasks-1.1.1-SNAPSHOT.jar, and can be found at http://snapshots.repository.codehaus.org/org/codehaus/castor/castor-anttasks/ I hope you'll find everything you'll need.
        Hide
        David M. Karr added a comment -

        I'm not sure if I did something wrong, but I'm getting this:

        [java] java.lang.IllegalArgumentException: The ClassNameConflictResolutionStrategy ' informViaLog' does not exist in the Castor builder properties file and is therefore not supported.

        Note that it's printing ' informViaLog' (an initial space).

        Am I supposed to be adding something else to the castorbuilder.properties file?

        Show
        David M. Karr added a comment - I'm not sure if I did something wrong, but I'm getting this: [java] java.lang.IllegalArgumentException: The ClassNameConflictResolutionStrategy ' informViaLog' does not exist in the Castor builder properties file and is therefore not supported. Note that it's printing ' informViaLog' (an initial space). Am I supposed to be adding something else to the castorbuilder.properties file?
        Hide
        David M. Karr added a comment -

        I figured it out. I really expected I'd have to add "-nameConflictStrategy informViaLog" to the command line, not "-nameConflictStrategyinformViaLog". That's just odd. It'll work, though.

        Show
        David M. Karr added a comment - I figured it out. I really expected I'd have to add "-nameConflictStrategy informViaLog" to the command line, not "-nameConflictStrategyinformViaLog". That's just odd. It'll work, though.
        Hide
        David M. Karr added a comment -

        I would appreciate it if you could look at my generator console output here. There are a couple of unexpected things that happened here. Note that I'm sending "-Dlog4j.rootLogger=DEBUG,console" to the SourceGeneratorMain command line, as a workaround for not being able to send the warnings directly to the console. I'm also sending "-verbose", and not sending "-f".

        The first minor issue is the substring ".informViaLog" appearing at the end of some messages. I imagine that is not intended.

        The second minor issue (I think) is the warning about no appenders found, on one call to the SourceGenerator, which is odd, since I'm setting the rootLogger on the command line (perhaps I'm just misunderstanding log4j configuration).

        The next issue is that I think I would have expected to see a warning for the situation that produced this compile error:

        .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/Message.java:22: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.Message
        public class Message extends Message

        The (paraphrased) output follows this.

        ---------------------------------
        [echo] Generating sources for .../LoanRiskRating.xsd
        [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog
        [java] Creating classes for: loanRiskRatingRequest
        [java] Creating classes for: message
        [java] Creating classes for: messages
        [java] Creating classes for: property
        [java] Creating classes for: loanRiskRatingResponse
        [java] Creating classes for: loanProperties
        [touch] Creating ...\target\castor\tstamp\LoanRiskRating.xsd
        [echo] Generating sources for .../QuestionData.xsd
        [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog
        [java] Creating classes for: choiceIndices
        [deleted]
        [java] Creating classes for: questionSection
        [touch] Creating ...\target\castor\tstamp\QuestionData.xsd
        [echo] Generating sources for .../QuestionWeights.xsd
        [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog
        [java] Creating classes for: questionWeights
        [java] Creating classes for: questionWeight
        [touch] Creating ...\target\castor\tstamp\QuestionWeights.xsd
        [echo] Generating sources for .../CompassCREServiceTypes.xsd
        [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog
        [java] log4j:WARN No appenders could be found for logger (org.exolab.castor.xml.ValidationContext).
        [java] log4j:WARN Please initialize the log4j system properly.
        [java] Creating classes for: PortfolioLoanResultsRequest
        [deleted]
        [java] Creating classes for: Portfolio
        [java] Creating classes for: Portfolio
        [deleted]
        [java] Creating classes for: Portfolio
        [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio
        [java] Creating classes for: ReportResponse
        [java] Creating classes for: Warnings
        [java] Creating classes for: Messages
        [java] Creating classes for: Message
        [java] Creating classes for: Message
        [java] Creating classes for: Errors
        [java] Creating classes for: LoanLossDetailRequest
        [java] Creating classes for: Portfolio
        [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio
        [java] Creating classes for: PortfolioTimeSeriesRequest
        [java] Creating classes for: Scenarios
        [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Scenarios -> com.wamu.xmlbinding.compass.v1_2.Scenarios -> com.wamu.xmlbinding.compass.v1_2.Scenarios
        [java] Creating classes for: Portfolio
        [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio
        [java] Creating classes for: LeaseRollTimeSeries
        [java] Creating classes for: leaseRollTimeSeriesType
        [touch] Creating ...\target\castor\tstamp\CompassCREServiceTypes.xsd
        [echo] Compiling to .../target/classes
        [echo]
        ==========================================================

        NOTE: Targetting JVM 1.4, classes
        will not run on earlier JVMs

        ==========================================================

        [javac] Compiling 171 source files to ...\target\classes
        .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/Message.java:22: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.Message
        public class Message extends Message
        ^
        .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/descriptors/MessageDescriptor.java:21: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.descriptors.MessageDescriptor
        public class MessageDescriptor extends com.wamu.xmlbinding.compass.v1_2.descriptors.MessageDescriptor {
        ^
        -----------------------------------

        Note that the last generator call used the following binding file (the others do not use one):
        ----------------------------------
        <binding xmlns="http://www.castor.org/SourceGenerator/Binding"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tns="http://ws.ppr.info/CompassCREService/1.2"
        >
        <complexTypeBinding name="Portfolio">
        <java-class name="PortfolioType"/>
        </complexTypeBinding>
        <complexTypeBinding name="Scenarios">
        <java-class name="ScenariosType"/>
        </complexTypeBinding>
        </binding>
        ----------------------------------

        Show
        David M. Karr added a comment - I would appreciate it if you could look at my generator console output here. There are a couple of unexpected things that happened here. Note that I'm sending "-Dlog4j.rootLogger=DEBUG,console" to the SourceGeneratorMain command line, as a workaround for not being able to send the warnings directly to the console. I'm also sending "-verbose", and not sending "-f". The first minor issue is the substring ".informViaLog" appearing at the end of some messages. I imagine that is not intended. The second minor issue (I think) is the warning about no appenders found, on one call to the SourceGenerator, which is odd, since I'm setting the rootLogger on the command line (perhaps I'm just misunderstanding log4j configuration). The next issue is that I think I would have expected to see a warning for the situation that produced this compile error: .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/Message.java:22: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.Message public class Message extends Message The (paraphrased) output follows this. --------------------------------- [echo] Generating sources for .../LoanRiskRating.xsd [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog [java] Creating classes for: loanRiskRatingRequest [java] Creating classes for: message [java] Creating classes for: messages [java] Creating classes for: property [java] Creating classes for: loanRiskRatingResponse [java] Creating classes for: loanProperties [touch] Creating ...\target\castor\tstamp\LoanRiskRating.xsd [echo] Generating sources for .../QuestionData.xsd [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog [java] Creating classes for: choiceIndices [deleted] [java] Creating classes for: questionSection [touch] Creating ...\target\castor\tstamp\QuestionData.xsd [echo] Generating sources for .../QuestionWeights.xsd [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog [java] Creating classes for: questionWeights [java] Creating classes for: questionWeight [touch] Creating ...\target\castor\tstamp\QuestionWeights.xsd [echo] Generating sources for .../CompassCREServiceTypes.xsd [java] – The generated classes will use a case insensitive method for looking up enumerated type values.informViaLog [java] log4j:WARN No appenders could be found for logger (org.exolab.castor.xml.ValidationContext). [java] log4j:WARN Please initialize the log4j system properly. [java] Creating classes for: PortfolioLoanResultsRequest [deleted] [java] Creating classes for: Portfolio [java] Creating classes for: Portfolio [deleted] [java] Creating classes for: Portfolio [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio [java] Creating classes for: ReportResponse [java] Creating classes for: Warnings [java] Creating classes for: Messages [java] Creating classes for: Message [java] Creating classes for: Message [java] Creating classes for: Errors [java] Creating classes for: LoanLossDetailRequest [java] Creating classes for: Portfolio [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio [java] Creating classes for: PortfolioTimeSeriesRequest [java] Creating classes for: Scenarios [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Scenarios -> com.wamu.xmlbinding.compass.v1_2.Scenarios -> com.wamu.xmlbinding.compass.v1_2.Scenarios [java] Creating classes for: Portfolio [java] Loop found in class hierarchy: com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio -> com.wamu.xmlbinding.compass.v1_2.Portfolio [java] Creating classes for: LeaseRollTimeSeries [java] Creating classes for: leaseRollTimeSeriesType [touch] Creating ...\target\castor\tstamp\CompassCREServiceTypes.xsd [echo] Compiling to .../target/classes [echo] ========================================================== NOTE: Targetting JVM 1.4, classes will not run on earlier JVMs ========================================================== [javac] Compiling 171 source files to ...\target\classes .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/Message.java:22: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.Message public class Message extends Message ^ .../target/castor/src/com/wamu/xmlbinding/compass/v1_2/descriptors/MessageDescriptor.java:21: cyclic inheritance involving com.wamu.xmlbinding.compass.v1_2.descriptors.MessageDescriptor public class MessageDescriptor extends com.wamu.xmlbinding.compass.v1_2.descriptors.MessageDescriptor { ^ ----------------------------------- Note that the last generator call used the following binding file (the others do not use one): ---------------------------------- <binding xmlns="http://www.castor.org/SourceGenerator/Binding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://ws.ppr.info/CompassCREService/1.2" > <complexTypeBinding name="Portfolio"> <java-class name="PortfolioType"/> </complexTypeBinding> <complexTypeBinding name="Scenarios"> <java-class name="ScenariosType"/> </complexTypeBinding> </binding> ----------------------------------

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            David M. Karr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: