You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2009/06/21 12:07:16 UTC
svn commit: r786982 -
/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
Author: ltheussl
Date: Sun Jun 21 10:07:16 2009
New Revision: 786982
URL: http://svn.apache.org/viewvc?rev=786982&view=rev
Log:
add note about merging models
Modified:
maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=786982&r1=786981&r2=786982&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java Sun Jun 21 10:07:16 2009
@@ -305,31 +305,8 @@
{
if ( docDescriptor.exists() )
{
- DocumentModel doc = null;
-
- try
- {
- doc = new DocumentDescriptorReader( project, getLog() )
- .readAndFilterDocumentDescriptor( docDescriptor );
- }
- catch ( XmlPullParserException ex )
- {
- throw new MojoExecutionException( "Error reading DocumentDescriptor!", ex );
- }
- catch ( IOException io )
- {
- throw new MojoExecutionException( "Error opening DocumentDescriptor!", io );
- }
-
- if ( StringUtils.isEmpty( doc.getMeta().getLanguage() ) )
- {
- doc.getMeta().setLanguage( locale.getLanguage() );
- }
-
- if ( StringUtils.isEmpty( doc.getMeta().getGenerator() ) )
- {
- doc.getMeta().setGenerator( getDefaultGenerator() );
- }
+ DocumentModel doc = getDocumentModelFromDescriptor( locale );
+ // TODO: descriptor model should get merged into default model, see MODELLO-63
return doc;
}
@@ -346,6 +323,37 @@
return model;
}
+ private DocumentModel getDocumentModelFromDescriptor( Locale locale )
+ throws MojoExecutionException
+ {
+ DocumentModel model = null;
+
+ try
+ {
+ model = new DocumentDescriptorReader( project, getLog() ).readAndFilterDocumentDescriptor( docDescriptor );
+ }
+ catch ( XmlPullParserException ex )
+ {
+ throw new MojoExecutionException( "Error reading DocumentDescriptor!", ex );
+ }
+ catch ( IOException io )
+ {
+ throw new MojoExecutionException( "Error opening DocumentDescriptor!", io );
+ }
+
+ if ( StringUtils.isEmpty( model.getMeta().getLanguage() ) )
+ {
+ model.getMeta().setLanguage( locale.getLanguage() );
+ }
+
+ if ( StringUtils.isEmpty( model.getMeta().getGenerator() ) )
+ {
+ model.getMeta().setGenerator( getDefaultGenerator() );
+ }
+
+ return model;
+ }
+
/**
* Return the working directory for a given Locale and the current default Locale.
*