NPanday
  1. NPanday
  2. NPANDAY-385

[regression introduced by 186] JavaBindings-Generator for .NET-Mojos is fragile (and not working for NPanday.Plugin.SettingsGenerator)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4-incubating
    • Fix Version/s: 1.4-incubating
    • Component/s: Maven Plugins
    • Labels:
      None

      Description

      When building plugins\netplugins\NPanday.Plugin.Settings

      [INFO] [mojo-generator:generate-bindings {execution: default-generate-bindings}]
      [INFO] NPANDAY-068-005: Choose executable path's parent as execution path: C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings\target
      NPanday: Start Process = 28.03.2011 09:32:20
      "targetAssemblyFile=C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings\target\NPanday.Plugin.Settings.dll" "outputDirectory=C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings" "groupId=npanday.plugin" "artifactId=NPanday.Plugin.Settings" "artifactVersion=2.0-SNAPSHOT" "startProcessAssembly=C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings\target\NPanday.Plugin.MojoGenerator.exe" "pluginArtifactPath=C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings\target\NPanday.Plugin.dll"
      Creating Plugin Domain Manager
      Loading Generator: C:\Workbench\NPanday\svn-trunk\plugins\netplugins\NPanday.Plugin.Settings\target
      Creating Plugin Domain Manager
      Assembly :mscorlib
      Assembly :NPanday.Plugin
      Assembly :NPanday.Plugin.Settings
      File Exists = True
      System.InvalidOperationException: There is an error in XML document (1, 1). ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
         at System.Xml.XmlTextReaderImpl.Throw(Exception e)
         at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
         at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
         at System.Xml.XmlReader.MoveToContent()
         at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderModel.Read50_project()
         --- End of inner exception stack trace ---
         at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
         at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
         at NPanday.Plugin.MojoGenerator.Generator.BuildPluginProject(AppDomain applicationDomain, FileInfo pluginArtifact, FileInfo outputDirectory, String groupId, String artifactId, String version)
      NPanday: End Process = 28.03.2011 09:32:20; exit code = 0
      [INFO] snapshot npanday:dotnet-repository:2.0-SNAPSHOT: checking for updates from apache.snapshots
      [INFO] [repository:convert-artifact {execution: default-convert-artifact}]
      28.03.2011 09:32:22 info.aduna.lang.service.ServiceRegistry <init>
      INFO: Registered service class org.openrdf.query.parser.serql.SeRQLParserFactory
      

      I just had a quick look into 'dotnet\assemblies\NPanday.Plugin.MojoGenerator\src\main\csharp\NPanday\Plugin\MojoGenerator\Generator.cs'. It's just taking the first embedded resource.

      TextReader reader = new StreamReader(Assembly.GetExecutingAssembly().
      GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]));
      XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
      

      This needs to be improved.

        Issue Links

          Activity

          Hide
          Lars Corneliussen added a comment -

          Part of the review on Mailing list:

          Am 12.04.11 04:45, schrieb Brett Porter:
          >> >>  >>  Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs
          >> >>  URL:http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs?rev=1025511&r1=1025510&r2=1025511&view=diff
          >> >>  ==============================================================================
          >> >>  --- incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs (original)
          >> >>  +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs Wed Oct 20 11:37:11 2010
          >> >>  @@ -100,11 +100,9 @@ namespace NPanday.Plugin.MojoGenerator
          >> >>                  jcuLocal.unmarshall(javaClass, fileInfo);
          >> >>              }
          >> >>             
          >> >>  -            ResourceManager resourceManager = new ResourceManager("NPanday.Plugin.MojoGenerator",
          >> >>  -                                                                  Assembly.GetExecutingAssembly());
          >> >>  -            String pomXml = (String) resourceManager.GetObject("pom-java.xml");
          >> >>  -            TextReader reader = new StringReader(pomXml);
          >> >>  -            XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
          >> >>  +            TextReader reader = new StreamReader(Assembly.GetExecutingAssembly().
          >> >>  +            GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]));
          >> >>  +            XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model));
          >> >>              NPanday.Model.Pom.Model model = (NPanday.Model.Pom.Model) serializer.Deserialize(reader);   
          >> >>              model.artifactId = artifactId + ".JavaBinding";
          >> >>              model.groupId = groupId;
          > >  >  I'm not sure I understand this change. Is it reading the POM as the first resource from an asembly?
          > >  
          
          Show
          Lars Corneliussen added a comment - Part of the review on Mailing list: Am 12.04.11 04:45, schrieb Brett Porter: >> >> >> Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs >> >> URL:http: //svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs?rev=1025511&r1=1025510&r2=1025511&view=diff >> >> ============================================================================== >> >> --- incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs (original) >> >> +++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Plugin.MojoGenerator/src/main/csharp/NPanday/Plugin/MojoGenerator/Generator.cs Wed Oct 20 11:37:11 2010 >> >> @@ -100,11 +100,9 @@ namespace NPanday.Plugin.MojoGenerator >> >> jcuLocal.unmarshall(javaClass, fileInfo); >> >> } >> >> >> >> - ResourceManager resourceManager = new ResourceManager( "NPanday.Plugin.MojoGenerator" , >> >> - Assembly.GetExecutingAssembly()); >> >> - String pomXml = ( String ) resourceManager.GetObject( "pom-java.xml" ); >> >> - TextReader reader = new StringReader(pomXml); >> >> - XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model)); >> >> + TextReader reader = new StreamReader(Assembly.GetExecutingAssembly(). >> >> + GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0])); >> >> + XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Pom.Model)); >> >> NPanday.Model.Pom.Model model = (NPanday.Model.Pom.Model) serializer.Deserialize(reader); >> >> model.artifactId = artifactId + ".JavaBinding" ; >> >> model.groupId = groupId; > > > I'm not sure I understand this change. Is it reading the POM as the first resource from an asembly? > >
          Hide
          Lars Corneliussen added a comment -

          Fixed in trunk.

          Show
          Lars Corneliussen added a comment - Fixed in trunk.

            People

            • Assignee:
              Lars Corneliussen
              Reporter:
              Lars Corneliussen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development