/hg/release/icedtea-web-1.7: 2 new changesets

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Fri Dec 15 13:53:44 UTC 2017


changeset 61be09286bf6 in /hg/release/icedtea-web-1.7
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.7?cmd=changeset;node=61be09286bf6
author: Jiri Vanek <jvanek at redhat.com>
date: Fri Dec 15 14:30:07 2017 +0100

	backported: Set source language version for javadoc generation for jdk9, Get rid of X509Factory class usage, Plugin made work again with jdk9

	* Makefile.am: (JAVADOC_OPTS) if HAVE_JAVA9 then -source is appended with  correct IT_LANGUAGE_SOURCE_VERSION number
	* netx/net/sourceforge/jnlp/security/CertificateUtils.java: removed import and usage of X509Factory (replaced by hardcoded string). Still better then reflection.
	* configure.ac: removed check for sun.security.provider.X509Factory
	* launcher/launchers.in: added exports for sun.applet
	* plugin/icedteanp/IcedTeaNPPlugin.cc: same


changeset fc7e8272a30e in /hg/release/icedtea-web-1.7
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.7?cmd=changeset;node=fc7e8272a30e
author: Jiri Vanek <jvanek at redhat.com>
date: Fri Dec 15 14:53:03 2017 +0100

	Backported work with author file: Authors made as links in html docs, PR3426 - ITW Docs do not have correct 'AUTHOR' field
	* netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: isntanceof replaced by correct interface method
	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java: added getAdressLink and replaceLtGtCharacters methods
	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java: implemented newmethods. Added dummy antispam protection
	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java: dummy impl of new methods
	* tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java: adapted
	* AUTHORS: removed invalid space after one lt mark
	* Makefile: (generate-docs.stamp) added and used (where appropriate) path to src AUTHORS file.
	* netx/net/sourceforge/jnlp/resources/Messages.properties: added message for case, when no authors file specified on input.
	* netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: implemented possibility to include authors file to documentation.
	* tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java: tests for generator


diffstat:

 AUTHORS                                                                                      |    3 +-
 ChangeLog                                                                                    |   30 +
 Makefile.am                                                                                  |   10 +-
 configure.ac                                                                                 |    1 -
 launcher/launchers.in                                                                        |    4 +
 netx/net/sourceforge/jnlp/resources/Messages.properties                                      |    1 +
 netx/net/sourceforge/jnlp/security/CertificateUtils.java                                     |    5 +-
 netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java                                |  134 ++++++-
 netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java              |    4 +
 netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java          |   37 +-
 netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java |   10 +-
 plugin/icedteanp/IcedTeaNPPlugin.cc                                                          |    3 +-
 tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java                    |  168 ++++++++++
 13 files changed, 360 insertions(+), 50 deletions(-)

diffs (truncated from 713 to 500 lines):

diff -r a33238cd2d00 -r fc7e8272a30e AUTHORS
--- a/AUTHORS	Tue Dec 12 15:13:04 2017 +0100
+++ b/AUTHORS	Fri Dec 15 14:53:03 2017 +0100
@@ -11,7 +11,7 @@
 Adam Domurad <adomurad at redhat.com>
 Lukasz Dracz <ldracz at redhat.com>
 Thomas Fitzsimmons <fitzsim at redhat.com>
-Michał Górny < mgorny at gentoo.org >
+Michał Górny <mgorny at gentoo.org>
 Mark Greenwood <mark at dcs.shef.ac.uk>
 Tereza Hlavackova <hlavackova.tereza at gmail.com>
 Peter Hatina <phatina at redhat.com>
@@ -43,6 +43,5 @@
 Man Lung Wong <mwong at redhat.com>
 
 This project also includes code from the following projects:
-
 OpenJDK <http://openjdk.java.net/>
 Netx <http://jnlp.sourceforge.net/netx/>
diff -r a33238cd2d00 -r fc7e8272a30e ChangeLog
--- a/ChangeLog	Tue Dec 12 15:13:04 2017 +0100
+++ b/ChangeLog	Fri Dec 15 14:53:03 2017 +0100
@@ -1,3 +1,33 @@
+2017-15-12  Jiri Vanek <jvanek at redhat.com>
+            Tomáš Votava <tomcacolca at gmail.com>
+
+	Authors made as links in html docs, PR3426 - ITW Docs do not have correct 'AUTHOR' field 
+	* netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: isntanceof replaced by correct interface method
+	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java: added getAdressLink and replaceLtGtCharacters methods
+	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java: implemented newmethods. Added dummy antispam protection
+	* netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java: dummy impl of new methods
+	* tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java: adapted
+	* AUTHORS: removed invalid space after one lt mark
+	* Makefile: (generate-docs.stamp) added and used (where appropriate)
+	path to src AUTHORS file.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: added message for
+	case, when no authors file specified on input.
+	* netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: implemented
+	possibility to include authors file to documentation.
+	* tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java:
+	tests for generator
+
+2017-15-12  Fridrich Strba  <fridrich.strba at suse.com>
+
+	Set source language version for javadoc generation for jdk9, Get rid of X509Factory class usage, Plugin made work again with jdk9
+	* Makefile.am: (JAVADOC_OPTS) if HAVE_JAVA9 then -source is appended with 
+	correct IT_LANGUAGE_SOURCE_VERSION number
+	* netx/net/sourceforge/jnlp/security/CertificateUtils.java: removed import and usage of
+	X509Factory (replaced by hardcoded string). Still better then reflection.
+	* configure.ac: removed check for sun.security.provider.X509Factory
+	* launcher/launchers.in: added exports for sun.applet
+	* plugin/icedteanp/IcedTeaNPPlugin.cc: same
+
 2017-12-08  Jiri Vanek <jvanek at redhat.com>
 
 	Added possibility to turn off https preference via deployment properties
diff -r a33238cd2d00 -r fc7e8272a30e Makefile.am
--- a/Makefile.am	Tue Dec 12 15:13:04 2017 +0100
+++ b/Makefile.am	Fri Dec 15 14:53:03 2017 +0100
@@ -218,6 +218,9 @@
 if ENABLE_DOCS
 JAVADOC_OPTS=-use -keywords -encoding UTF-8 -splitIndex \
  -bottom '<font size="-1"> <a href="http://icedtea.classpath.org/bugzilla">Submit a bug or feature</a></font>'
+if HAVE_JAVA9
+JAVADOC_OPTS+=-source $(IT_LANGUAGE_SOURCE_VERSION)
+endif
 if JAVADOC_SUPPORTS_J_OPTIONS
 JAVADOC_MEM_OPTS=-J-Xmx1024m -J-Xms128m
 endif
@@ -727,6 +730,7 @@
 	HTML_DOCS_TARGET_DIR="$(DOCS_DIR)/html"  ; \
 	PLAIN_DOCS_TARGET_DIR="$(DOCS_DIR)/plain" ; \
 	MAN_DOCS_TARGET_DIR="$(DOCS_DIR)/man"  ; \
+	AUTHORS_FILE_TARGET="$(TOP_SRC_DIR)/AUTHORS" ; \
 	mkdir "$$HTML_DOCS_TARGET_DIR" ; \
 	mkdir "$$PLAIN_DOCS_TARGET_DIR" ; \
 	mkdir "$$MAN_DOCS_TARGET_DIR" ; \
@@ -742,16 +746,16 @@
 	  export LANG=$$LANG_ID; \
 	  mkdir "$$HTML_DOCS_TARGET_DIR/$$ID" ; \
 	  echo "<li><a href='$$ID/icedtea-web.html'>$$LANG_ID</a></li>"  >> "$$HTML_DOCS_INDEX" ; \
-	  $$TP_COMMAND html "$$HTML_DOCS_TARGET_DIR/$$ID" $$TP_TAIL ; \
+	  $$TP_COMMAND html "$$HTML_DOCS_TARGET_DIR/$$ID" $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  mkdir "$$PLAIN_DOCS_TARGET_DIR/$$ID" ; \
-	  $$TP_COMMAND plain "$$PLAIN_DOCS_TARGET_DIR/$$ID" 160 $$TP_TAIL; \
+	  $$TP_COMMAND plain "$$PLAIN_DOCS_TARGET_DIR/$$ID" 160 $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  if [ $$ID = "en" ] ; then \
 	    MAN_DESC="$$MAN_DOCS_TARGET_DIR/man1" ; \
 	  else \
 	    MAN_DESC="$$MAN_DOCS_TARGET_DIR/$$ID/man1" ; \
 	  fi ; \
 	  mkdir -p "$$MAN_DESC" ; \
-	  $$TP_COMMAND man $$ENCOD "$$MAN_DESC" $$TP_TAIL ; \
+	  $$TP_COMMAND man $$ENCOD "$$MAN_DESC" $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  $$TP_COMMAND htmlIntro "$(NETX_DIR)/net/sourceforge/jnlp/resources/about_$$ID.html" $$TP_TAIL; \
 	done ; \
 	export LANG=$$LANG_BACKUP ; \
diff -r a33238cd2d00 -r fc7e8272a30e configure.ac
--- a/configure.ac	Tue Dec 12 15:13:04 2017 +0100
+++ b/configure.ac	Fri Dec 15 14:53:03 2017 +0100
@@ -95,7 +95,6 @@
 IT_CHECK_FOR_CLASS(JAVA_NET_HTTPCOOKIE, [java.net.HttpCookie], [some.pkg], [])
 IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEHANDLER, [java.net.CookieHandler], [some.pkg], [])
 # in jdk9, those classes are using internal apis, must be enabled via module cheats
-IT_CHECK_FOR_CLASS(SUN_SECURITY_PROVIDER_X509FACTORY, [sun.security.provider.X509Factory], [some.pkg], [$JAVA_BASE])
 IT_CHECK_FOR_CLASS(SUN_SECURITY_UTIL_SECURITYCONSTANTS, [sun.security.util.SecurityConstants], [some.pkg], [$JAVA_BASE])
 IT_CHECK_FOR_CLASS(SUN_SECURITY_UTIL_HOSTNAMECHECKER, [sun.security.util.HostnameChecker], [some.pkg], [$JAVA_BASE])
 IT_CHECK_FOR_CLASS(SUN_SECURITY_X509_X500NAME, [sun.security.x509.X500Name], [some.pkg], [$JAVA_BASE])
diff -r a33238cd2d00 -r fc7e8272a30e launcher/launchers.in
--- a/launcher/launchers.in	Tue Dec 12 15:13:04 2017 +0100
+++ b/launcher/launchers.in	Fri Dec 15 14:53:03 2017 +0100
@@ -167,6 +167,10 @@
 k=$((k+1))
 COMMAND[k]="java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop"
 k=$((k+1))
+COMMAND[k]="--add-exports"
+k=$((k+1))
+COMMAND[k]="java.desktop/sun.applet=ALL-UNNAMED,jdk.jsobject"
+k=$((k+1))
 fi
 
 
diff -r a33238cd2d00 -r fc7e8272a30e netx/net/sourceforge/jnlp/resources/Messages.properties
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Tue Dec 12 15:13:04 2017 +0100
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Fri Dec 15 14:53:03 2017 +0100
@@ -30,6 +30,7 @@
 BUTback=Back
 BUTforward=Forward
 BUTreload=Reload
+ITWdocsMissingAuthors=See authors file
 
 HEADLESS_MISSCONFIGURED=Headless check failed. You are forced to run without any graphics. IcedTea-Web can run like this, but your app probably not. This is likely bug in your system.
 
diff -r a33238cd2d00 -r fc7e8272a30e netx/net/sourceforge/jnlp/security/CertificateUtils.java
--- a/netx/net/sourceforge/jnlp/security/CertificateUtils.java	Tue Dec 12 15:13:04 2017 +0100
+++ b/netx/net/sourceforge/jnlp/security/CertificateUtils.java	Fri Dec 15 14:53:03 2017 +0100
@@ -58,7 +58,6 @@
 import net.sourceforge.jnlp.runtime.Translator;
 import net.sourceforge.jnlp.util.logging.OutputController;
 import net.sourceforge.jnlp.util.replacements.BASE64Encoder;
-import sun.security.provider.X509Factory;
 
 /**
  * Common utilities to manipulate certificates. Provides methods to add
@@ -193,9 +192,9 @@
             CertificateException {
 
         BASE64Encoder encoder = new BASE64Encoder();
-        out.println(X509Factory.BEGIN_CERT);
+        out.println("-----BEGIN CERTIFICATE-----");
         encoder.encodeBuffer(cert.getEncoded(), out);
-        out.println(X509Factory.END_CERT);
+        out.println("-----END CERTIFICATE-----");
     }
 
     public static void dumpPKCS12(String alias, File file, KeyStore ks, char[] password)
diff -r a33238cd2d00 -r fc7e8272a30e netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java
--- a/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java	Tue Dec 12 15:13:04 2017 +0100
+++ b/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java	Fri Dec 15 14:53:03 2017 +0100
@@ -33,18 +33,23 @@
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.
-*/
-
+ */
 package net.sourceforge.jnlp.util.docprovider;
 
+import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.io.Reader;
 import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -63,13 +68,16 @@
 import net.sourceforge.jnlp.util.docprovider.formatters.formatters.ReplacingTextFormatter;
 
 public abstract class TextsProvider {
+    
+    private static File authorFileFromUserInput = null;
 
     private final String encoding;
     private final Formatter formatter;
     private final boolean forceTitles;
     protected final boolean expandVariables;
     private boolean prepared = false;
-
+    private File authorFilePath = null;
+    
     private boolean introduction = true;
     private boolean synopsis = true;
     private boolean description = true;
@@ -184,7 +192,6 @@
             for (Map.Entry<String, Setting<String>> entry : defs) {
                 if (matchSttingsValueWithInfrastrucutreFile(entry.getValue(), f)) {
                     controlledBy = " " + Translator.R("BUTControlledBy", getFormatter().getBold(entry.getKey()));
-                    
                     break;
                 }
             }
@@ -271,13 +278,9 @@
     public String getAuthors() {
         if (forceTitles) {
             return getFormatter().getTitle(ManFormatter.KnownSections.AUTHOR)
-                    + getFormatter().wrapParagraph(
-                            getFormatter().process(Translator.R("ITWTBdebug"))
-                            + getFormatter().getNewLine());
+                    + generateAuthorsSection(authorFilePath);
         } else {
-            return getFormatter().wrapParagraph(
-                    getFormatter().process(Translator.R("ITWTBdebug"))
-                    + getFormatter().getNewLine());
+            return generateAuthorsSection(authorFilePath);
         }
     }
 
@@ -399,7 +402,7 @@
     public static void main(String[] args) throws IOException {
         // Shutdown hook from OutputController was causing hanging build on Windows. It's not used on headless.
         JNLPRuntime.setHeadless(true);
-
+        
         if (args.length == 0) {
             System.out.println(" * IcedTea-Web self documentation tool list of arguments *");
             System.out.println(" * argument version - last parameter of each command, is used when there is no internal versionknown *");
@@ -412,24 +415,38 @@
             System.out.println("man encoding targetDir expand version - will generate man documentation to target dir in desired encoding");
             System.out.println("plain targetDir maxLineWidth expand version - will generate plain text documentation to target dir in desired encoding");
             System.out.println("                                            - maxLineWidth is in <5," + Integer.MAX_VALUE + ">");
+            System.out.println("to generate informations about authors from a file, use argument '-authorFile' with path to AUTHORS file located in icedtea-web."
+                    + "\n eg. -authorFile=/home/user/icedtea-web/AUTHORS");
         } else {
-            ReplacingTextFormatter.backupVersion = args[args.length - 1];
-            boolean expand = Boolean.valueOf(args[args.length - 2]);
-            switch (args[0]) {
+            List<String> argsList = new ArrayList<>();
+            argsList.addAll(Arrays.asList(args));
+            for (String s : argsList) {
+                if (s.startsWith("-authorFile=")) {
+                    authorFileFromUserInput = new File(s.split("=")[1]);
+                    if (!authorFileFromUserInput.exists()) {
+                        throw new RuntimeException(authorFileFromUserInput.getAbsolutePath() + " does not exists");
+                    }
+                    argsList.remove(s);
+                    break;
+                }
+            }
+            ReplacingTextFormatter.backupVersion = argsList.get(argsList.size() - 1);
+            boolean expand = Boolean.valueOf(argsList.get(argsList.size() - 2));
+            switch (argsList.get(0)) {
                 case "all":
                     generateAll(new File(System.getProperty("user.dir")), expand);
                     break;
                 case "html":
-                    generateOnlineHtmlHelp(new File(args[1]), expand);
+                    generateOnlineHtmlHelp(new File(argsList.get(1)), expand);
                     break;
                 case "htmlIntro":
-                    generateItwIntro(new File(args[1]), expand);
+                    generateItwIntro(new File(argsList.get(1)), expand);
                     break;
                 case "man":
-                    generateManText(args[1], new File(args[2]), expand);
+                    generateManText(argsList.get(1), new File(argsList.get(2)), expand);
                     break;
                 case "plain":
-                    generatePlainTextDocs(new File(args[1]), Integer.valueOf(args[2]), expand);
+                    generatePlainTextDocs(new File(argsList.get(1)), Integer.valueOf(argsList.get(2)), expand);
                     break;
                 default:
                     System.out.println("unknown param");
@@ -441,6 +458,7 @@
 
     public static void generateItwIntro(File f, boolean expand) throws IOException {
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider("utf-8", new HtmlFormatter(false, true, false), false, expand);
+        //!!AUTHORS FILE IS NOT NEEDED IN THIS METHOD, AUTHORS ARE GENERATED SEPARATELY INTO ANOTHER TAB
         itw.setSeeAlso(false);
         itw.writeToFile(f);
     }
@@ -481,15 +499,15 @@
             }
         }
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for (TextsProvider provider : providers) {
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -499,15 +517,15 @@
 
     public static void generateManText(String encoding, File dir, boolean titles, boolean expand) throws IOException {
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new ManFormatter(), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new ManFormatter(), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new ManFormatter(), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new ManFormatter(), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new ManFormatter(), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for (TextsProvider provider : providers) {
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -517,15 +535,15 @@
 
     public static void generatePlainTextDocs(String encoding, File dir, String indent, int lineWidth, boolean titles, boolean expand) throws IOException {
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for(TextsProvider provider : providers){
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -671,6 +689,11 @@
         this.authors = authors;
     }
 
+    public void setAuthorFilePath(File authorFilePath) {
+        this.authorFilePath = authorFilePath;
+    }
+    
+
     /**
      * @return the seeAlso
      */
@@ -695,4 +718,49 @@
         return s;
     }
 
+    private String readAuthors(File authors) {
+        try {
+            return readAuthorsImpl(authors);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private String readAuthorsImpl(File authors) throws IOException {
+        return readAuthorsImpl(new InputStreamReader(new FileInputStream(authors), "UTF-8"));
+
+    }
+
+    String readAuthorsImpl(Reader authors) throws IOException {
+        StringBuilder sb = new StringBuilder();
+        boolean areAuthors = false;
+        BufferedReader reader = new BufferedReader(authors);
+        while (true) {
+            String line = reader.readLine();
+            if (line == null) {
+                break;
+            }
+            if (line.trim().isEmpty()) {
+                areAuthors = !areAuthors;
+            }
+            sb.append(getFormatter().process(getFormatter().getAdressLink(line)));
+            if (getFormatter() instanceof HtmlFormatter || areAuthors == false) {
+                sb.append(getFormatter().getNewLine());
+            }
+        }
+        return sb.toString();
+    }
+
+    private String generateAuthorsSection(File filePath) {
+        if (filePath == null) {
+            return getFormatter().wrapParagraph(
+                    getFormatter().process(Translator.R("ITWdocsMissingAuthors"))
+                    + getFormatter().getNewLine());
+        } else {
+            return getFormatter().wrapParagraph(
+                    getFormatter().process(readAuthors(filePath))
+                    + getFormatter().getNewLine());
+        }
+    }
 }
+
diff -r a33238cd2d00 -r fc7e8272a30e netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java
--- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java	Tue Dec 12 15:13:04 2017 +0100
+++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java	Fri Dec 15 14:53:03 2017 +0100
@@ -74,5 +74,9 @@
     public String getTail();
 
     public String getFileSuffix();
+    
+    public String getAdressLink(String s);
+    
+    public String replaceLtGtCharacters(String s);
 
 }
diff -r a33238cd2d00 -r fc7e8272a30e netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java
--- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java	Tue Dec 12 15:13:04 2017 +0100
+++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java	Fri Dec 15 14:53:03 2017 +0100
@@ -33,8 +33,7 @@
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.
-*/
-
+ */
 package net.sourceforge.jnlp.util.docprovider.formatters.formatters;
 
 import java.util.Date;
@@ -43,14 +42,15 @@
 import java.util.TreeMap;
 import net.sourceforge.jnlp.runtime.JNLPRuntime;
 
-
 public class HtmlFormatter extends ReplacingTextFormatter {
 
     private final Map<String, String> content = new TreeMap<>();
     private final boolean allowContext;
     private final boolean allowLogo;
     private final boolean includeXmlHeader;
-    public  static final String SUFFIX = "html";
+    private final String lT = "&#60";
+    private final String gT = "&#62";
+    public static final String SUFFIX = "html";
 
     @Override
     public String process(String s) {
@@ -58,7 +58,6 @@
         return s;
     }
 
-    
     public HtmlFormatter(boolean allowContext, boolean allowLogo, boolean includeXmlHeader) {
         this.allowContext = allowContext;
         this.allowLogo = allowLogo;
@@ -146,7 +145,7 @@
 
     @Override
     public String getFileSuffix() {
-        return "."+SUFFIX;
+        return "." + SUFFIX;
     }
 
     @Override
@@ -182,4 +181,30 @@
         return "<li><b>" + key + " </b> - " + process(value) + "</li>";
     }
 
+    @Override
+    public String getAdressLink(String s) {
+        String emailDelBracket = s.replaceAll(".*<", "");
+        String adress = emailDelBracket.replaceAll(">.*", "");
+        if (s.contains("@")) {
+            String name = s.replaceAll("<.*", "").trim();
+            return "<a href=\"mailto:" + antiSpam(adress) + "\" target=\"_top\">" + name + "</a>";
+        } else {
+            return s.replaceAll("<.*>", "<a href=\"" + adress + "\">" + adress + "</a>");
+        }
+    }
+
+    @Override
+    public String replaceLtGtCharacters(String s) {
+        String replaceLt = s.replaceAll("<", lT);
+        String replaceLtGt = replaceLt.replaceAll(">", gT);
+        return replaceLtGt;
+    }
+
+    private static String antiSpam(String adress) {


More information about the distro-pkg-dev mailing list