cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Fix build on JDK 1.7
Date Fri, 12 Jan 2018 14:50:05 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 21d7d4dff -> 0db617625


Fix build on JDK 1.7


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/0db61762
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/0db61762
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/0db61762

Branch: refs/heads/STABLE-4.0
Commit: 0db61762578efddf4c2d726acf7804c2c4e9dbca
Parents: 21d7d4d
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Jan 12 17:49:56 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Jan 12 17:49:56 2018 +0300

----------------------------------------------------------------------
 .../cayenne/asciidoc/CayennePostProcessor.java   | 19 +++++++++++++++----
 docs/asciidoc/pom.xml                            |  8 --------
 2 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/0db61762/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
b/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
index 1502429..1469e0e 100644
--- a/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
+++ b/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
@@ -21,8 +21,12 @@ package org.apache.cayenne.asciidoc;
 
 import java.io.BufferedWriter;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
-import java.nio.file.Files;
+import java.nio.file.OpenOption;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
 import java.util.Collections;
@@ -33,6 +37,7 @@ import org.asciidoctor.ast.Document;
 import org.asciidoctor.ast.DocumentRuby;
 import org.asciidoctor.extension.Postprocessor;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Element;
 
 /**
  * <p>
@@ -84,12 +89,12 @@ public class CayennePostProcessor extends Postprocessor {
                 .addClass("fa-lightbulb-o")
                 .addClass("fa-2x");
 
-        jsoupDoc.select("code").forEach(el -> {
+        for(Element el : jsoupDoc.select("code")) {
             String codeClass = el.attr("data-lang");
             if(!codeClass.isEmpty()) {
                 el.addClass(codeClass);
             }
-        });
+        }
 
         jsoupDoc.select("div#preamble").remove();
 
@@ -122,7 +127,7 @@ public class CayennePostProcessor extends Postprocessor {
         Object docname = ((Map)document.getOptions().get(Options.ATTRIBUTES)).get("docname");
 
         Path path = FileSystems.getDefault().getPath((String) destDir, docname + ".toc.html");
-        try(BufferedWriter br = Files.newBufferedWriter(path, StandardOpenOption.CREATE_NEW,
StandardOpenOption.WRITE)) {
+        try(BufferedWriter br = newBufferedWriter(path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE))
{
             br.write(toc, 0, toc.length());
             br.flush();
         } catch (IOException ex) {
@@ -136,6 +141,12 @@ public class CayennePostProcessor extends Postprocessor {
         return output.substring(0, start) + output.substring(end);
     }
 
+    static BufferedWriter newBufferedWriter(Path path, OpenOption... options) throws IOException
{
+        CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
+        Writer writer = new OutputStreamWriter(path.getFileSystem().provider().newOutputStream(path,
options), encoder);
+        return new BufferedWriter(writer);
+    }
+
     protected String processHeader(Document document, String output) {
         String headerFile = (String) document.getAttr("cayenne-header", "");
         String headerPosition = (String)document.getAttr("cayenne-header-position", POSITION_TOP);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/0db61762/docs/asciidoc/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/pom.xml b/docs/asciidoc/pom.xml
index 2cf01b5..965f52e 100644
--- a/docs/asciidoc/pom.xml
+++ b/docs/asciidoc/pom.xml
@@ -118,14 +118,6 @@
                     </dependency>
                 </dependencies>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 


Mime
View raw message