Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 71302188C4 for ; Fri, 25 Sep 2015 11:02:24 +0000 (UTC) Received: (qmail 9947 invoked by uid 500); 25 Sep 2015 11:02:21 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 9890 invoked by uid 500); 25 Sep 2015 11:02:21 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 9850 invoked by uid 99); 25 Sep 2015 11:02:21 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Sep 2015 11:02:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 46CDEC287F for ; Fri, 25 Sep 2015 11:02:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.801 X-Spam-Level: * X-Spam-Status: No, score=1.801 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 4cm9u4CVJodq for ; Fri, 25 Sep 2015 11:02:19 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 1880E206F0 for ; Fri, 25 Sep 2015 11:02:19 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4DC4AE043F for ; Fri, 25 Sep 2015 11:02:18 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 42E883A0046 for ; Fri, 25 Sep 2015 11:02:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1705272 - in /sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book: Assembler.java BookException.java Date: Fri, 25 Sep 2015 11:02:17 -0000 To: commits@sis.apache.org From: desruisseaux@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150925110218.42E883A0046@svn01-us-west.apache.org> Author: desruisseaux Date: Fri Sep 25 11:02:12 2015 New Revision: 1705272 URL: http://svn.apache.org/viewvc?rev=1705272&view=rev Log: Use a separated exception for problems related to the content of the files used for building the book (e.g. missing identifier for a chapter). Added: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/BookException.java (with props) Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1705272&r1=1705271&r2=1705272&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java [UTF-8] Fri Sep 25 11:02:12 2015 @@ -83,7 +83,7 @@ public final class Assembler { private final Document document; /** - * The node where to write the table of content. + * The node where to write the table of content for the whole document. */ private final Element tableOfContent; @@ -210,17 +210,17 @@ public final class Assembler { * @param filename the source XML file in the same directory than the input file given to the constructor. * @param toReplace the target XML node to be replaced by the content of the given file. */ - private Node replaceByBody(final String filename, final Node toReplace) throws IOException, SAXException { + private Node replaceByBody(final String filename, final Node toReplace) throws IOException, SAXException, BookException { final NodeList nodes = load(filename).getElementsByTagName("body"); if (nodes.getLength() != 1) { - throw new IOException(filename + ": expected exactly one element."); + throw new BookException(filename + ": expected exactly one element."); } final Node element = document.createElement("section"); toReplace.getParentNode().replaceChild(element, toReplace); for (Node child : toArray(nodes.item(0).getChildNodes())) { child = document.importNode(child, true); // document.adoptNode(child) would have been more efficient but does not seem to work. if (child == null) { - throw new IOException("Failed to copy subtree."); + throw new BookException("Failed to copy subtree."); } element.appendChild(child); } @@ -264,7 +264,7 @@ public final class Assembler { * @param index {@code true} for including the {@code

}, etc. texts in the Table Of Content (TOC). * This is set to {@code false} when parsing the content of {@code