db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r547983 - in /db/derby/code/branches/10.3/java/build/org/apache/derbyBuild: ReleaseNoteReader.java ReleaseNotesGenerator.java
Date Sat, 16 Jun 2007 21:11:38 GMT
Author: rhillegas
Date: Sat Jun 16 14:11:38 2007
New Revision: 547983

URL: http://svn.apache.org/viewvc?view=rev&rev=547983
Log:
DERBY-2570: Port 547982 from main to the 10.3 branch.

Added:
    db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNoteReader.java
      - copied unchanged from r547982, db/derby/code/trunk/java/build/org/apache/derbyBuild/ReleaseNoteReader.java
Modified:
    db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNotesGenerator.java

Modified: db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNotesGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNotesGenerator.java?view=diff&rev=547983&r1=547982&r2=547983
==============================================================================
--- db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNotesGenerator.java
(original)
+++ db/derby/code/branches/10.3/java/build/org/apache/derbyBuild/ReleaseNotesGenerator.java
Sat Jun 16 14:11:38 2007
@@ -214,6 +214,7 @@
         private Document    _summary;
         private Document    _bugList;
         private Document    _releaseNotesList;
+        private ReleaseNoteReader   _releaseNoteReader;
 
         private ArrayList       _missingReleaseNotes;
         private ArrayList       _errors;
@@ -235,6 +236,8 @@
 
             _missingReleaseNotes = new ArrayList();
             _errors = new ArrayList();
+
+            _releaseNoteReader = new ReleaseNoteReader( documentBuilder );
         }
 
         public  void    addMissingReleaseNote( JiraIssue issue )
@@ -252,6 +255,7 @@
         public  Document    getSummary() { return _summary; }
         public  Document    getBugList() { return _bugList; }
         public  Document    getReleaseNotesList() { return _releaseNotesList; }
+        public  ReleaseNoteReader   getReleaseNoteReader() { return _releaseNoteReader; }
         
         public  JiraIssue[]     getMissingReleaseNotes()
         {
@@ -621,6 +625,7 @@
         Document    pamphlet = gs.getPamphlet();
         Element     issuesSection = getSection( pamphlet, MAIN_SECTION_LEVEL, ISSUES_SECTION
);
         Document    issuesList = gs.getReleaseNotesList();
+        ReleaseNoteReader   releaseNoteReader = gs.getReleaseNoteReader();
         JiraIssue[]    bugs = getJiraIssues( issuesList );
         int                 count = bugs.length;
         String          releaseID = getReleaseID( gs );
@@ -638,7 +643,15 @@
         {
             JiraIssue       issue = bugs[ i ];
             
-            Document    releaseNote = getReleaseNote( gs, issue );
+            Document    releaseNote = null;
+
+            try {
+                releaseNote = getReleaseNote( gs, issue );
+            }
+            catch (Throwable t)
+            {
+                gs.addError( formatError( "Unable to read or parse release note for " + issue.getKey(),
t ) );
+            }
 
             // skip this note if we were unable to read it
             if ( releaseNote == null )
@@ -648,7 +661,17 @@
             }
             
             String          key = "Note for " + issue.getKey();
-            String          summary = getReleaseNoteSummary( gs, issue, releaseNote );
+            String          summary = null;
+
+            try {
+                summary = releaseNoteReader.getReleaseNoteSummary( releaseNote );
+            }
+            catch (Throwable t)
+            {
+                gs.addError( formatError( "Badly formatted summary for " + issue.getKey(),
t ) );
+                summary = "Unreadable summary line";
+            }
+            
             String          tocEntry = key + ": " + summary;
 
             insertLine( issuesSection );
@@ -656,8 +679,7 @@
             Element     issueSection = createSection( issuesSection, ISSUE_DETAIL_LEVEL,
toc, key, tocEntry );
 
             try {
-                Element     root = releaseNote.getDocumentElement();
-                Element     details = getFirstChild( root, BODY );
+                Element     details = releaseNoteReader.getReleaseNoteDetails( releaseNote
);
 
                 // copy the details out of the release note into this section of the
                 // pamphlet
@@ -671,6 +693,7 @@
         }
     }
     
+    
     /**
      * <p>
      * Get the release note for an issue.
@@ -681,60 +704,24 @@
     {
         if ( issue.hasReleaseNote() )
         {
-            URL                                 url = new URL( issue.getReleaseNoteAddress()
);
-
+            URL             url = null;
+            InputStream is = null;
+            
             try {
-                InputStream                     is = url.openStream();
-                Document        doc = gs.getDocumentBuilder().parse( is );
-
-                is.close();
-
-                return doc;
+                url = new URL( issue.getReleaseNoteAddress() );
+                is = url.openStream();
             }
-            catch (Exception e)
+            catch (Throwable t)
             {
-                processThrowable( e );
-
-                gs.addError( formatError( "Unable to read or parse release note for " + issue.getKey(),
e ) );
-
+                processThrowable( t );
                 return null;
             }
-        }
-        else { return null; }
-    }
 
-    /**
-     * <p>
-     * Get the summary for a release note
-     * </p>
-     */
-    private String   getReleaseNoteSummary( GeneratorState gs, JiraIssue issue, Document
releaseNote )
-        throws Exception
-    {
-        if ( releaseNote != null )
-        {
-            //
-            // The release note has the following structure:
-            //
-            // <h4>Summary of Change</h4>
-            // <p>
-            //  Summary text
-            // </p>
-            //
-            try {
-                Element     root = releaseNote.getDocumentElement();
-                Element     summaryParagraph = getFirstChild( root, PARAGRAPH );
-                String          summaryText = squeezeText( summaryParagraph );
+            Document        doc = gs.getReleaseNoteReader().getReleaseNote( is );
 
-                return summaryText;
-            }
-            catch (Throwable t)
-            {
-                gs.addError( formatError( "Badly formatted summary for " + issue.getKey(),
t ) );
-                return "Unreadable summary line";
-            }
+            return doc;
         }
-        else { return "???"; }
+        else { return null; }
     }
 
     //////////////////////////////////



Mime
View raw message