+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>jSite</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
--- /dev/null
+# jSite
+
+jSite is a tool that uploads websites from a local directory into Freenet.
+
+## Compiling
+
+Gradle’s build process is handled by [Gradle](https://gradle.org/). Just use the Gradle wrapper that comes with jSite:
+
+ # ./gradlew clean build fatJar
+
+This will resolve jSite’s dependencies, compile jSite, run all the tests (of which there are only a few, unfortunately), and put the file `jSite-`*<version>*`-jar-with-dependencies.jar` into the `build/libs` directory. This is the file that you can simply run, either by double-clicking it in a file manager of your choice, or by using the command line:
+
+ # java -jar build/libs/jSite-0.13-jar-with-dependencies.jar
+
+## Using
+
+jSite is built on a “wizard dialog” concept: it consists of several different dialogs that can be navigated to by using “previous” and “next” buttons. This allows jSite to check that all necessary input for a following dialog has been given in the current dialog.
+
+### The Node Manager
+
+This dialog lets you configure the connection to your node. jSite’s default setup should match the default setup of Freenet, i.e. a default node is added which can be reached on port 9481 on localhost.
+
+In the logical order of the dialogs this is the first dialog; however, jSite starts with showing the second dialog: the project dialog.
+
+### The Project Dialog
+
+In this dialog you can manage your projects, i.e. the websites you have inserted or are planning to insert into Freenet.
+
+Adding a project will create a new key pair; a connection to the Freenet node is required for this. If you want to use an already existing keypair you can do so by using the “Manage Keys” function. Here you can also copy keys from existing Web of Trust identities.
+
+Pressing the “next” button will take you to a more detailed view of the project you selected.
+
+### The Project Files
+
+The Project Files dialog lets you adjust settings for the files in your project. The most important functionality this dialog offers is the selection of an “index,” or default, file, i.e., the file that is served when the URI of your freesite is navigated to without a file in the URL path.
+
+Pressing “next” here will take you to where the action finally happens.
+
+### The Project Insert
+
+This dialog shows the progress of the insert. There’s not really much happening here. You have the possibility to cancel the insert using the “cancel” button.
+
+As soon as the Freenet node has generated the final URI of the freesite, the “copy URI to clipboard” button will be activated, letting you paste the final URI wherever you want. For security reasons (e.g., the “mobile attacker source tracing” attack) you should not publish the URI until the insert has finished completely.
+
+## Preferences
+
+In this dialog you can configure a couple of settings of your local jSite instance.
+
+If you have specific requirements for where jSite should store temporary files (i.e., a directory on an encrypted volume), you can configure this directory here.
+
+jSite can read its configuration file from a number of different locations. In case you are using jSite for long-living projects it is recommended to keep the configuration in your user’s home directory. However, this might not be an option for when you want to run jSite from an external drive (e.g., a thumb drive) and don’t want to leave permanent traces on the computer you are using. In this case the option “next to the JAR file” might be just for you which will cause jSite to store the configuration file in the directory the JAR file is stored in.
+
+There is also a third option that tells jSite to store the configuration in a custom location. For this option to be active you have to specify the location when starting jSite with a command-line parameter (`--config-file=`*<config file>*).
+
+The third section in the dialog configures jSite’s insert behaviour.
--- /dev/null
+apply plugin: 'java'
+
+group = 'net.pterodactylus'
+version = '0.14'
+
+repositories {
+ maven { url "http://maven.pterodactylus.net/" }
+ maven { url "http://repo.maven.apache.org/maven2" }
+}
+
+dependencies {
+ compile group: 'net.pterodactylus', name: 'utils', version: '0.13'
+
+ testCompile group: 'junit', name: 'junit', version: '4.12'
+ testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
+ testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
+}
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
+apply plugin: 'application'
+
+mainClassName = 'de.todesbaum.jsite.main.Main'
+
+task fatJar(type: Jar) {
+ archiveName = "${project.name}-${project.version}-jar-with-dependencies.jar"
+ from {
+ configurations.runtime.collect {
+ it.isDirectory() ? it : zipTree(it)
+ }
+ }
+ manifest {
+ attributes('Main-Class': 'de.todesbaum.jsite.main.Main')
+ }
+ with jar
+}
+
+apply plugin: 'jacoco'
+
+jacoco {
+ toolVersion = '0.7.7.201606060606'
+}
+
+jacocoTestReport.dependsOn test
+
--- /dev/null
+#Thu Nov 03 20:03:47 CET 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
--- /dev/null
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
--- /dev/null
+@if "%DEBUG%" == "" @echo off\r
+@rem ##########################################################################\r
+@rem\r
+@rem Gradle startup script for Windows\r
+@rem\r
+@rem ##########################################################################\r
+\r
+@rem Set local scope for the variables with windows NT shell\r
+if "%OS%"=="Windows_NT" setlocal\r
+\r
+set DIRNAME=%~dp0\r
+if "%DIRNAME%" == "" set DIRNAME=.\r
+set APP_BASE_NAME=%~n0\r
+set APP_HOME=%DIRNAME%\r
+\r
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
+set DEFAULT_JVM_OPTS=\r
+\r
+@rem Find java.exe\r
+if defined JAVA_HOME goto findJavaFromJavaHome\r
+\r
+set JAVA_EXE=java.exe\r
+%JAVA_EXE% -version >NUL 2>&1\r
+if "%ERRORLEVEL%" == "0" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:findJavaFromJavaHome\r
+set JAVA_HOME=%JAVA_HOME:"=%\r
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
+\r
+if exist "%JAVA_EXE%" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:init\r
+@rem Get command-line arguments, handling Windows variants\r
+\r
+if not "%OS%" == "Windows_NT" goto win9xME_args\r
+if "%@eval[2+2]" == "4" goto 4NT_args\r
+\r
+:win9xME_args\r
+@rem Slurp the command line arguments.\r
+set CMD_LINE_ARGS=\r
+set _SKIP=2\r
+\r
+:win9xME_args_slurp\r
+if "x%~1" == "x" goto execute\r
+\r
+set CMD_LINE_ARGS=%*\r
+goto execute\r
+\r
+:4NT_args\r
+@rem Get arguments from the 4NT Shell from JP Software\r
+set CMD_LINE_ARGS=%$\r
+\r
+:execute\r
+@rem Setup the command line\r
+\r
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
+\r
+@rem Execute Gradle\r
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
+\r
+:end\r
+@rem End local scope for the variables with windows NT shell\r
+if "%ERRORLEVEL%"=="0" goto mainEnd\r
+\r
+:fail\r
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
+rem the _cmd.exe /c_ return code!\r
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
+exit /b 1\r
+\r
+:mainEnd\r
+if "%OS%"=="Windows_NT" endlocal\r
+\r
+:omega\r
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>net.pterodactylus</groupId>
- <artifactId>jSite</artifactId>
- <version>${version}</version>
- <properties>
- <version>0.13</version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>net.pterodactylus</groupId>
- <artifactId>utils</artifactId>
- <version>0.13</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>pterodactylus</id>
- <url>http://maven.pterodactylus.net/</url>
- </repository>
- </repositories>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>de.todesbaum.jsite.main.Main</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-5</version>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archiverConfig>
- <duplicateBehavior>skip</duplicateBehavior>
- </archiverConfig>
- <archive>
- <manifest>
- <mainClass>de.todesbaum.jsite.main.Main</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- <configuration>
- <mainClass>de.todesbaum.jsite.main.Main</mainClass>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.5.201505241946</version>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- <execution>
- <id>default-check</id>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <rules>
- <!-- implmentation is needed only for Maven 2 -->
- <rule implementation="org.jacoco.maven.RuleConfiguration">
- <element>BUNDLE</element>
- <limits>
- <!-- implmentation is needed only for Maven 2 -->
- <limit implementation="org.jacoco.report.check.Limit">
- <counter>COMPLEXITY</counter>
- <value>COVEREDRATIO</value>
- <minimum>0.60</minimum>
- </limit>
- </limits>
- </rule>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <links>
- <link>http://download.oracle.com/javase/6/docs/api/</link>
- <link>http://java.pterodactylus.net/utils/apidocs/</link>
- <link>http://java.pterodactylus.net/utils.json/apidocs/</link>
- </links>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
--- /dev/null
+rootProject.name = 'jSite'
/*
- * jSite - AbortedException.java - Copyright © 2010–2014 David Roden
+ * jSite - AbortedException.java - Copyright © 2010–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - FileOption.java - Copyright © 2006–2014 David Roden
+ * jSite - FileOption.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
/*
- * jSite - Freenet7Interface.java - Copyright © 2006–2014 David Roden
+ * jSite - Freenet7Interface.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - InsertListener.java - Copyright © 2006–2014 David Roden
+ * jSite - InsertListener.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Node.java - Copyright © 2006–2014 David Roden
+ * jSite - Node.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Project.java - Copyright © 2006–2014 David Roden
+ * jSite - Project.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
/*
- * jSite - ProjectInsertListeners.java - Copyright © 2013–2014 David Roden
+ * jSite - ProjectInsertListeners.java - Copyright © 2013–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ProjectInserter.java - Copyright © 2006–2014 David Roden
+ * jSite - ProjectInserter.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
}
/**
- * Validates the given project. The project will be checked for any invalid
- * conditions, such as invalid insert or request keys, missing path names,
- * missing default file, and so on.
- *
- * @param project
- * The project to check
- * @return The encountered warnings and errors
- */
- public static CheckReport validateProject(Project project) {
- CheckReport checkReport = new CheckReport();
- if ((project.getLocalPath() == null) || (project.getLocalPath().trim().length() == 0)) {
- checkReport.addIssue("error.no-local-path", true);
- }
- if ((project.getPath() == null) || (project.getPath().trim().length() == 0)) {
- checkReport.addIssue("error.no-path", true);
- }
- if ((project.getIndexFile() == null) || (project.getIndexFile().length() == 0)) {
- checkReport.addIssue("warning.empty-index", false);
- } else {
- File indexFile = new File(project.getLocalPath(), project.getIndexFile());
- if (!indexFile.exists()) {
- checkReport.addIssue("error.index-missing", true);
- }
- }
- String indexFile = project.getIndexFile();
- boolean hasIndexFile = (indexFile != null) && (indexFile.length() > 0);
- List<String> allowedIndexContentTypes = Arrays.asList("text/html", "application/xhtml+xml");
- if (hasIndexFile && !allowedIndexContentTypes.contains(project.getFileOption(indexFile).getMimeType())) {
- checkReport.addIssue("warning.index-not-html", false);
- }
- Map<String, FileOption> fileOptions = project.getFileOptions();
- Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
- boolean insert = fileOptionEntries.isEmpty();
- for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
- String fileName = fileOptionEntry.getKey();
- FileOption fileOption = fileOptionEntry.getValue();
- insert |= fileOption.isInsert() || fileOption.isInsertRedirect();
- if (fileName.equals(project.getIndexFile()) && !fileOption.isInsert() && !fileOption.isInsertRedirect()) {
- checkReport.addIssue("error.index-not-inserted", true);
- }
- if (!fileOption.isInsert() && fileOption.isInsertRedirect() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
- checkReport.addIssue("error.no-custom-key", true, fileName);
- }
- }
- if (!insert) {
- checkReport.addIssue("error.no-files-to-insert", true);
- }
- Set<String> fileNames = new HashSet<String>();
- for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
- FileOption fileOption = fileOptionEntry.getValue();
- if (!fileOption.isInsert() && !fileOption.isInsertRedirect()) {
- logger.log(Level.FINEST, "Ignoring {0}.", fileOptionEntry.getKey());
- continue;
- }
- String fileName = fileOption.getChangedName().orElse(fileOptionEntry.getKey());
- logger.log(Level.FINEST, "Adding “{0}” for {1}.", new Object[] { fileName, fileOptionEntry.getKey() });
- if (!fileNames.add(fileName)) {
- checkReport.addIssue("error.duplicate-file", true, fileName);
- }
- }
- long totalSize = 0;
- final CountDownLatch completionLatch = new CountDownLatch(1);
- FileScanner fileScanner = new FileScanner(project, (error, files) -> completionLatch.countDown());
- fileScanner.startInBackground();
- while (completionLatch.getCount() > 0) {
- try {
- completionLatch.await();
- } catch (InterruptedException ie1) {
- /* TODO: logging */
- }
- }
- for (ScannedFile scannedFile : fileScanner.getFiles()) {
- String fileName = scannedFile.getFilename();
- FileOption fileOption = project.getFileOption(fileName);
- if ((fileOption != null) && !fileOption.isInsert()) {
- continue;
- }
- totalSize += new File(project.getLocalPath(), fileName).length();
- }
- if (totalSize > 2 * 1024 * 1024) {
- checkReport.addIssue("warning.site-larger-than-2-mib", false);
- }
- return checkReport;
- }
-
- /**
* {@inheritDoc}
*/
@Override
}
}
- /**
- * Container class that collects all warnings and errors that occured during
- * {@link ProjectInserter#validateProject(Project) project validation}.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
- public static class CheckReport implements Iterable<Issue> {
-
- /** The issures that occured. */
- private final List<Issue> issues = new ArrayList<Issue>();
-
- /**
- * Adds an issue.
- *
- * @param issue
- * The issue to add
- */
- public void addIssue(Issue issue) {
- issues.add(issue);
- }
-
- /**
- * Creates an {@link Issue} from the given error key and fatality flag
- * and {@link #addIssue(Issue) adds} it.
- *
- * @param errorKey
- * The error key
- * @param fatal
- * {@code true} if the error is fatal, {@code false} if only
- * a warning should be generated
- * @param parameters
- * Any additional parameters
- */
- public void addIssue(String errorKey, boolean fatal, String... parameters) {
- addIssue(new Issue(errorKey, fatal, parameters));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterator<Issue> iterator() {
- return issues.iterator();
- }
-
- /**
- * Returns whether this check report does not contain any errors.
- *
- * @return {@code true} if this check report does not contain any
- * errors, {@code false} if this check report does contain
- * errors
- */
- public boolean isEmpty() {
- return issues.isEmpty();
- }
-
- /**
- * Returns the number of issues in this check report.
- *
- * @return The number of issues
- */
- public int size() {
- return issues.size();
- }
-
- }
-
- /**
- * Container class for a single issue. An issue contains an error key
- * that describes the error, and a fatality flag that determines whether
- * the insert has to be aborted (if the flag is {@code true}) or if it
- * can still be performed and only a warning should be generated (if the
- * flag is {@code false}).
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’
- * Roden</a>
- */
- public static class Issue {
-
- /** The error key. */
- private final String errorKey;
-
- /** The fatality flag. */
- private final boolean fatal;
-
- /** Additional parameters. */
- private String[] parameters;
-
- /**
- * Creates a new issue.
- *
- * @param errorKey
- * The error key
- * @param fatal
- * The fatality flag
- * @param parameters
- * Any additional parameters
- */
- protected Issue(String errorKey, boolean fatal, String... parameters) {
- this.errorKey = errorKey;
- this.fatal = fatal;
- this.parameters = parameters;
- }
-
- /**
- * Returns the key of the encountered error.
- *
- * @return The error key
- */
- public String getErrorKey() {
- return errorKey;
- }
-
- /**
- * Returns whether the issue is fatal and the insert has to be
- * aborted. Otherwise only a warning should be shown.
- *
- * @return {@code true} if the insert needs to be aborted, {@code
- * false} otherwise
- */
- public boolean isFatal() {
- return fatal;
- }
-
- /**
- * Returns any additional parameters.
- *
- * @return The additional parameters
- */
- public String[] getParameters() {
- return parameters;
- }
-
- }
-
}
/*
- * jSite - UpdateChecker.java - Copyright © 2008–2014 David Roden
+ * jSite - UpdateChecker.java - Copyright © 2008–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
private static int counter = 0;
/** The edition for the update check URL. */
- private static final int UPDATE_EDITION = 11;
+ private static final int UPDATE_EDITION = 12;
/** The URL for update checks. */
private static final String UPDATE_KEY = "USK@1waTsw46L9-JEQ8yX1khjkfHcn--g0MlMsTlYHax9zQ,oYyxr5jyFnaTsVGDQWk9e3ddOWGKnqEASxAk08MHT2Y,AQACAAE";
/*
- * jSite - UpdateListener.java - Copyright © 2008–2014 David Roden
+ * jSite - UpdateListener.java - Copyright © 2008–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - WebOfTrustInterface.java - Copyright © 2012–2014 David Roden
+ * jSite - WebOfTrustInterface.java - Copyright © 2012–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
--- /dev/null
+package de.todesbaum.jsite.application.validation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import de.todesbaum.jsite.application.Project;
+
+/**
+ * Container class that collects all warnings and errors that occured during
+ * {@link ProjectValidator#validateProject(Project) project validation}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class CheckReport implements Iterable<Issue> {
+
+ private final List<Issue> issues = new ArrayList<>();
+
+ void addIssue(String errorKey, boolean fatal, String... parameters) {
+ issues.add(new Issue(errorKey, fatal, parameters));
+ }
+
+ public Collection<Issue> getIssues() {
+ return issues;
+ }
+
+ @Override
+ public Iterator<Issue> iterator() {
+ return issues.iterator();
+ }
+
+ public boolean isEmpty() {
+ return issues.isEmpty();
+ }
+
+}
--- /dev/null
+package de.todesbaum.jsite.application.validation;
+
+import static java.lang.String.format;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * Container class for a single issue. An issue contains an error key that describes the error,
+ * and a fatality flag that determines whether the insert has to be aborted (if the flag is
+ * {@code true}) or if it can still be performed and only a warning should be generated (if the
+ * flag is {@code false}).
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class Issue {
+
+ private final String errorKey;
+ private final boolean fatal;
+ private final String[] parameters;
+
+ Issue(String errorKey, boolean fatal, String... parameters) {
+ this.errorKey = errorKey;
+ this.fatal = fatal;
+ this.parameters = parameters;
+ }
+
+ public String getErrorKey() {
+ return errorKey;
+ }
+
+ public boolean isFatal() {
+ return fatal;
+ }
+
+ public String[] getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Issue issue = (Issue) o;
+ return fatal == issue.fatal &&
+ Objects.equals(errorKey, issue.errorKey) &&
+ Arrays.equals(parameters, issue.parameters);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(errorKey, fatal, parameters);
+ }
+
+ @Override
+ public String toString() {
+ return format("Issue{errorKey=\"%s\", fatal=%s, parameters=%s}", errorKey, fatal, Arrays.toString(parameters));
+ }
+
+}
--- /dev/null
+package de.todesbaum.jsite.application.validation;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.stream.Stream;
+
+import de.todesbaum.jsite.application.FileOption;
+import de.todesbaum.jsite.application.Project;
+import de.todesbaum.jsite.gui.FileScanner;
+import de.todesbaum.jsite.gui.ScannedFile;
+
+/**
+ * Validates a project and returns a number of {@link Issue}s in a {@link CheckReport}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class ProjectValidator {
+
+ private static final Logger logger = Logger.getLogger(ProjectValidator.class.getName());
+
+ public static CheckReport validateProject(Project project) {
+ CheckReport checkReport = new CheckReport();
+ if ((project.getLocalPath() == null) || (project.getLocalPath().trim().length() == 0)) {
+ checkReport.addIssue("error.no-local-path", true);
+ return checkReport;
+ }
+ if ((project.getPath() == null) || (project.getPath().trim().length() == 0)) {
+ checkReport.addIssue("error.no-path", true);
+ }
+ if ((project.getIndexFile() == null) || (project.getIndexFile().length() == 0)) {
+ checkReport.addIssue("warning.empty-index", false);
+ } else {
+ File indexFile = new File(project.getLocalPath(), project.getIndexFile());
+ if (!indexFile.exists()) {
+ checkReport.addIssue("error.index-missing", true);
+ }
+ }
+ String indexFile = project.getIndexFile();
+ boolean hasIndexFile = (indexFile != null) && (indexFile.length() > 0);
+ if (hasIndexFile && indexFileIsNotHtml(project, indexFile)) {
+ checkReport.addIssue("warning.index-not-html", false);
+ }
+ Map<String, FileOption> fileOptions = project.getFileOptions();
+ Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
+ boolean insert = fileOptionEntries.isEmpty();
+ for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
+ String fileName = fileOptionEntry.getKey();
+ FileOption fileOption = fileOptionEntry.getValue();
+ insert |= fileOption.isInsert() || fileOption.isInsertRedirect();
+ if (fileName.equals(project.getIndexFile()) && !fileOption.isInsert() && !fileOption.isInsertRedirect()) {
+ checkReport.addIssue("error.index-not-inserted", true);
+ }
+ if (!fileOption.isInsert() && fileOption.isInsertRedirect() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(
+ fileOption.getCustomKey()))) {
+ checkReport.addIssue("error.no-custom-key", true, fileName);
+ }
+ }
+ if (!insert) {
+ checkReport.addIssue("error.no-files-to-insert", true);
+ }
+ Set<String> fileNames = new HashSet<>();
+ for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
+ FileOption fileOption = fileOptionEntry.getValue();
+ if (!fileOption.isInsert() && !fileOption.isInsertRedirect()) {
+ logger.log(Level.FINEST, "Ignoring {0}.", fileOptionEntry.getKey());
+ continue;
+ }
+ String fileName = fileOption.getChangedName().orElse(fileOptionEntry.getKey());
+ logger.log(Level.FINEST, "Adding “{0}” for {1}.", new Object[] { fileName, fileOptionEntry.getKey() });
+ if (!fileNames.add(fileName)) {
+ checkReport.addIssue("error.duplicate-file", true, fileName);
+ }
+ }
+ long totalSize = 0;
+ final CountDownLatch completionLatch = new CountDownLatch(1);
+ FileScanner fileScanner = new FileScanner(project, (error, files) -> completionLatch.countDown());
+ fileScanner.startInBackground();
+ while (completionLatch.getCount() > 0) {
+ try {
+ completionLatch.await();
+ } catch (InterruptedException ie1) {
+ /* TODO: logging */
+ }
+ }
+ for (ScannedFile scannedFile : fileScanner.getFiles()) {
+ String fileName = scannedFile.getFilename();
+ FileOption fileOption = project.getFileOption(fileName);
+ if ((fileOption != null) && !fileOption.isInsert()) {
+ continue;
+ }
+ totalSize += new File(project.getLocalPath(), fileName).length();
+ }
+ if (totalSize > 2 * 1024 * 1024) {
+ checkReport.addIssue("warning.site-larger-than-2-mib", false);
+ }
+ return checkReport;
+ }
+
+ private static boolean indexFileIsNotHtml(Project project, String indexFile) {
+ return Stream.of("text/html", "application/xhtml+xml")
+ .noneMatch(mimeType -> project.getFileOption(indexFile).getMimeType().startsWith(mimeType));
+ }
+
+}
/*
- * jSite - FileScanner.java - Copyright © 2006–2014 David Roden
+ * jSite - FileScanner.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - FileScannerListener.java - Copyright © 2006–2014 David Roden
+ * jSite - FileScannerListener.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - KeyDialog.java - Copyright © 2010–2014 David Roden
+ * jSite - KeyDialog.java - Copyright © 2010–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - NodeManagerListener.java - Copyright © 2006–2014 David Roden
+ * jSite - NodeManagerListener.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - NodeManagerPage.java - Copyright © 2006–2014 David Roden
+ * jSite - NodeManagerPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - PreferencesPage.java - Copyright © 2009–2014 David Roden
+ * jSite - PreferencesPage.java - Copyright © 2009–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ProjectFilesPage.java - Copyright © 2006–2014 David Roden
+ * jSite - ProjectFilesPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package de.todesbaum.jsite.gui;
+import static java.util.Optional.ofNullable;
+
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Optional;
import java.util.Set;
-
+import java.util.function.Consumer;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.event.ListSelectionListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
import net.pterodactylus.util.io.MimeTypes;
import net.pterodactylus.util.swing.SwingUtils;
import net.pterodactylus.util.thread.StoppableDelay;
+
import de.todesbaum.jsite.application.FileOption;
import de.todesbaum.jsite.application.Project;
import de.todesbaum.jsite.i18n.I18n;
fileOptionsRenameTextField = new JTextField();
fileOptionsRenameTextField.setEnabled(false);
- fileOptionsRenameTextField.getDocument().addDocumentListener(new DocumentListener() {
-
- @SuppressWarnings("synthetic-access")
- private void storeText(DocumentEvent documentEvent) {
- FileOption fileOption = getSelectedFile();
- if (fileOption == null) {
- /* no file selected. */
- return;
- }
- Document document = documentEvent.getDocument();
- int documentLength = document.getLength();
- try {
- fileOption.setChangedName(document.getText(0, documentLength).trim());
- } catch (BadLocationException ble1) {
- /* ignore, it should never happen. */
- }
- }
-
- @Override
- public void changedUpdate(DocumentEvent documentEvent) {
- storeText(documentEvent);
- }
-
- @Override
- public void insertUpdate(DocumentEvent documentEvent) {
- storeText(documentEvent);
- }
-
- @Override
- public void removeUpdate(DocumentEvent documentEvent) {
- storeText(documentEvent);
- }
-
- });
+ fileOptionsRenameTextField.getDocument().addDocumentListener(new StoreDocument(this::updateChangedName));
fileOptionsPanel.add(fileOptionsRenameCheckBox, new GridBagConstraints(0, 8, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
fileOptionsPanel.add(fileOptionsRenameTextField, new GridBagConstraints(2, 8, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
fileOptionsMIMETypeComboBox.addActionListener(this);
fileOptionsMIMETypeComboBox.setEditable(true);
fileOptionsMIMETypeComboBox.setEnabled(false);
+ ((JTextComponent) fileOptionsMIMETypeComboBox.getEditor().getEditorComponent())
+ .getDocument()
+ .addDocumentListener(new StoreDocument(this::updateMimeType));
final TLabel mimeTypeLabel = new TLabel(I18n.getMessage("jsite.project-files.mime-type") + ":", KeyEvent.VK_M, fileOptionsMIMETypeComboBox);
fileOptionsPanel.add(mimeTypeLabel, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
});
}
- /**
- * Returns the {@link FileOption file options} for the currently selected
- * file.
- *
- * @return The {@link FileOption}s for the selected file, or {@code null} if
- * no file is selected
- */
- private FileOption getSelectedFile() {
- ScannedFile scannedFile = (ScannedFile) projectFileList.getSelectedValue();
- if (scannedFile == null) {
- return null;
- }
- return project.getFileOption(scannedFile.getFilename());
+ private Optional<FileOption> getSelectedFile() {
+ return ofNullable(((ScannedFile) projectFileList.getSelectedValue()))
+ .map(scannedFile -> project.getFileOption(scannedFile.getFilename()));
}
//
} else if (source instanceof JComboBox) {
JComboBox comboBox = (JComboBox) source;
if ("project-files.mime-type".equals(comboBox.getName())) {
- fileOption.setMimeType((String) comboBox.getSelectedItem());
+ updateMimeType((String) comboBox.getSelectedItem());
}
}
}
+ private void updateMimeType(String mimeType) {
+ getSelectedFile().ifPresent(fileOption -> fileOption.setMimeType(mimeType));
+ }
+
+ private void updateChangedName(String changedName) {
+ getSelectedFile().ifPresent(fileOption -> fileOption.setChangedName(changedName));
+ }
+
//
// INTERFACE ListSelectionListener
//
processDocumentUpdate(documentEvent);
}
+ private static class StoreDocument implements DocumentListener {
+
+ private final Consumer<String> consumer;
+
+ public StoreDocument(Consumer<String> consumer) {
+ this.consumer = consumer;
+ }
+
+ private void storeDocument(DocumentEvent e) {
+ try {
+ consumer.accept(e.getDocument().getText(0, e.getDocument().getLength()));
+ } catch (BadLocationException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ storeDocument(e);
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ storeDocument(e);
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ storeDocument(e);
+ }
+
+ }
+
}
/*
- * jSite - ProjectInsertPage.java - Copyright © 2006–2014 David Roden
+ * jSite - ProjectInsertPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ProjectPage.java - Copyright © 2006–2014 David Roden
+ * jSite - ProjectPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - I18n.java - Copyright © 2006–2014 David Roden
+ * jSite - I18n.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - I18nContainer.java - Copyright © 2007–2014 David Roden
+ * jSite - I18nContainer.java - Copyright © 2007–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
/*
- * jSite - CLI.java - Copyright © 2006–2014 David Roden
+ * jSite - CLI.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import de.todesbaum.jsite.application.Node;
import de.todesbaum.jsite.application.Project;
import de.todesbaum.jsite.application.ProjectInserter;
+import de.todesbaum.jsite.main.JarFileLocator.DefaultJarFileLocator;
/**
* Command-line interface for jSite.
}
}
- ConfigurationLocator configurationLocator = new ConfigurationLocator();
+ ConfigurationLocator configurationLocator = new ConfigurationLocator(new DefaultJarFileLocator(getClass().getClassLoader()));
if (configFile != null) {
configurationLocator.setCustomLocation(configFile);
}
/*
- * jSite - Configuration.java - Copyright © 2006–2014 David Roden
+ * jSite - Configuration.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ConfigurationLocator.java - Copyright © 2011–2014 David Roden
+ * jSite - ConfigurationLocator.java - Copyright © 2011–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import java.util.Optional;
/**
* Locator for configuration files in different places.
* list, {@link ConfigurationLocation#CUSTOM} has to be enabled by calling
* {@link #setCustomLocation(String)}.
*/
- public ConfigurationLocator() {
+ public ConfigurationLocator(JarFileLocator jarFileLocator) {
/* are we executed from a JAR file? */
- String resource = getClass().getResource("/" + getClass().getName().replace(".", "/") + ".class").toString();
- if (resource.startsWith("jar:")) {
- String jarFileLocation = resource.substring(9, resource.indexOf(".jar!") + 4);
- String jarFileDirectory = new File(jarFileLocation).getParent();
- File configurationFile = new File(jarFileDirectory, "jSite.conf");
+ Optional<File> jarFile = jarFileLocator.locateJarFile();
+ if (jarFile.isPresent()) {
+ File configurationFile = new File(jarFile.get().getParent(), "jSite.conf");
configurationFiles.put(ConfigurationLocation.NEXT_TO_JAR_FILE, configurationFile.getPath());
}
File homeDirectoryFile = new File(System.getProperty("user.home"), ".jSite/config7");
--- /dev/null
+package de.todesbaum.jsite.main;
+
+import static java.util.Optional.empty;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.Optional;
+
+/**
+ * Locates the JAR file used to load jSite in the filesystem.
+ */
+public interface JarFileLocator {
+
+ Optional<File> locateJarFile();
+
+ class DefaultJarFileLocator implements JarFileLocator {
+
+ private final ClassLoader classLoader;
+
+ public DefaultJarFileLocator(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ @Override
+ public Optional<File> locateJarFile() {
+ URL resourceUrl = classLoader.getResource(Main.class.getName().replace(".", "/") + ".class");
+ if (resourceUrl == null) {
+ return empty();
+ }
+ String resource = resourceUrl.toString();
+ if (resource.startsWith("jar:")) {
+ try {
+ String jarFileLocation = URLDecoder.decode(resource.substring(9, resource.indexOf(".jar!") + 4), "UTF-8");
+ return Optional.of(new File(jarFileLocation));
+ } catch (UnsupportedEncodingException e) {
+ /* location is not available, ignore. */
+ }
+ }
+ return empty();
+ }
+ }
+
+}
/*
- * jSite - Main.java - Copyright © 2006–2014 David Roden
+ * jSite - Main.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import javax.swing.event.ListSelectionListener;
import net.pterodactylus.util.image.IconLoader;
+
import de.todesbaum.jsite.application.Freenet7Interface;
import de.todesbaum.jsite.application.Node;
import de.todesbaum.jsite.application.Project;
-import de.todesbaum.jsite.application.ProjectInserter;
-import de.todesbaum.jsite.application.ProjectInserter.CheckReport;
-import de.todesbaum.jsite.application.ProjectInserter.Issue;
import de.todesbaum.jsite.application.UpdateChecker;
import de.todesbaum.jsite.application.UpdateListener;
import de.todesbaum.jsite.application.WebOfTrustInterface;
+import de.todesbaum.jsite.application.validation.CheckReport;
+import de.todesbaum.jsite.application.validation.Issue;
+import de.todesbaum.jsite.application.validation.ProjectValidator;
import de.todesbaum.jsite.gui.NodeManagerListener;
import de.todesbaum.jsite.gui.NodeManagerPage;
import de.todesbaum.jsite.gui.PreferencesPage;
import de.todesbaum.jsite.i18n.I18n;
import de.todesbaum.jsite.i18n.I18nContainer;
import de.todesbaum.jsite.main.ConfigurationLocator.ConfigurationLocation;
+import de.todesbaum.jsite.main.JarFileLocator.DefaultJarFileLocator;
import de.todesbaum.util.swing.TWizard;
import de.todesbaum.util.swing.TWizardPage;
import de.todesbaum.util.swing.WizardListener;
private static final Logger logger = Logger.getLogger(Main.class.getName());
/** The version. */
- private static final Version VERSION = new Version(0, 13);
+ private static final Version VERSION = new Version(0, 14);
/** The configuration. */
private Configuration configuration;
Locale.GERMAN,
Locale.FRENCH,
Locale.ITALIAN,
+ new Locale("es"),
new Locale("pl"),
new Locale("fi")
};
*/
private Main(String configFilename) {
/* collect all possible configuration file locations. */
- ConfigurationLocator configurationLocator = new ConfigurationLocator();
+ ConfigurationLocator configurationLocator = new ConfigurationLocator(new DefaultJarFileLocator(getClass().getClassLoader()));
if (configFilename != null) {
configurationLocator.setCustomLocation(configFilename);
}
JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.error.no-node-selected"), null, JOptionPane.ERROR_MESSAGE);
return;
}
- CheckReport checkReport = ProjectInserter.validateProject(project);
+ CheckReport checkReport = ProjectValidator.validateProject(project);
for (Issue issue : checkReport) {
if (issue.isFatal()) {
JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite." + issue.getErrorKey()), (Object[]) issue.getParameters()), null, JOptionPane.ERROR_MESSAGE);
/*
- * jSite - Version.java - Copyright © 2006–2014 David Roden
+ * jSite - Version.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Client.java - Copyright © 2006–2012 David Roden
+ * jSite - Client.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ClientGet.java - Copyright © 2008–2012 David Roden
+ * jSite - ClientGet.java - Copyright © 2008–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ClientHello.java - Copyright © 2006–2012 David Roden
+ * jSite - ClientHello.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ClientPut.java - Copyright © 2006–2012 David Roden
+ * jSite - ClientPut.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ClientPutComplexDir.java - Copyright © 2006–2012 David Roden
+ * jSite - ClientPutComplexDir.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ClientPutDir.java - Copyright © 2006–2012 David Roden
+ * jSite - ClientPutDir.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Command.java - Copyright © 2006–2012 David Roden
+ * jSite - Command.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Connection.java - Copyright © 2006–2012 David Roden
+ * jSite - Connection.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - ConnectionListener.java - Copyright © 2006–2012 David Roden
+ * jSite - ConnectionListener.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - DirectFileEntry.java - Copyright © 2006–2012 David Roden
+ * jSite - DirectFileEntry.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return dataLength;
}
-}
\ No newline at end of file
+}
/*
- * jSite - DiskFileEntry.java - Copyright © 2006–2012 David Roden
+ * jSite - DiskFileEntry.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return localFilename;
}
-}
\ No newline at end of file
+}
/*
- * jSite - FcpPluginMessage.java - Copyright © 2012 David Roden
+ * jSite - FcpPluginMessage.java - Copyright © 2012–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - FileEntry.java - Copyright © 2006–2012 David Roden
+ * jSite - FileEntry.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return filename;
}
-}
\ No newline at end of file
+}
/*
- * jSite - GenerateSSK.java - Copyright © 2006–2012 David Roden
+ * jSite - GenerateSSK.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Message.java - Copyright © 2006–2012 David Roden
+ * jSite - Message.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Node.java - Copyright © 2006–2012 David Roden
+ * jSite - Node.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Persistence.java - Copyright © 2006–2012 David Roden
+ * jSite - Persistence.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - PriorityClass.java - Copyright © 2006–2012 David Roden
+ * jSite - PriorityClass.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - RedirectFileEntry.java - Copyright © 2006–2012 David Roden
+ * jSite - RedirectFileEntry.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
public String getTargetURI() {
return targetURI;
}
-}
\ No newline at end of file
+}
/*
- * jSite - ReturnType.java - Copyright © 2008–2012 David Roden
+ * jSite - ReturnType.java - Copyright © 2008–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - Verbosity.java - Copyright © 2006–2012 David Roden
+ * jSite - Verbosity.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Sone - DefaultIdentity.java - Copyright © 2010–2012 David Roden
+ * jSite - DefaultIdentity.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Sone - DefaultOwnIdentity.java - Copyright © 2010–2012 David Roden
+ * jSite - DefaultOwnIdentity.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Sone - Identity.java - Copyright © 2010–2012 David Roden
+ * jSite - Identity.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Sone - OwnIdentity.java - Copyright © 2010–2012 David Roden
+ * jSite - OwnIdentity.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Sone - Trust.java - Copyright © 2010–2012 David Roden
+ * jSite - Trust.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - LineInputStream.java - Copyright © 2006–2012 David Roden
+ * jSite - LineInputStream.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - TeeOutputStream.java - Copyright © 2010 David Roden
+ * jSite - TeeOutputStream.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - TempFileInputStream.java - Copyright © 2006–2012 David Roden
+ * jSite - TempFileInputStream.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - TLabel.java - Copyright © 2006–2012 David Roden
+ * jSite - TLabel.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - TWizard.java - Copyright © 2006–2012 David Roden
+ * jSite - TWizard.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - TWizardPage.java - Copyright © 2006–2012 David Roden
+ * jSite - TWizardPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * jSite - WizardListener.java - Copyright © 2006–2012 David Roden
+ * jSite - WizardListener.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=Nodes
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=Nodes
--- /dev/null
+#
+# jSite - jSite.properties - Copyright © 2006–2014 David Roden
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Spanish language file by JlXip <jlxip@jlxip.net>
+
+# Attention, translators! Most of the strings here are used directly.
+# However, some of them are parsed by MessageFormat
+# (http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html)
+# and thus have to adhere to some rules (check the URL above). This is the
+# case when a line contains placeholders like {0} or {0,number}! In these
+# lines single quotes (ASCII 39) needs to be escaped by entering them twice,
+# otherwise the placeholder will not be replaced!
+
+jsite.general.ok=OK
+jsite.general.cancel=Cancelar
+
+jsite.wizard.previous=Anterior
+jsite.wizard.next=Siguiente
+jsite.wizard.quit=Salir
+
+jsite.quit.question=\u00bfRealmente desea salir?
+jsite.quit.question.title=\u00bfSalir?
+jsite.quit.overwrite-configuration=<html><b>\u00bfSobreescribir configuraci\u00f3n?</b><br><br>Un archivo de configuraci\u00f3n ya existe:<br><code>{0}</code><br><br>\u00bfDeber\u00eda de ser sobreescrito?</html>
+jsite.quit.overwrite-configuration.title=\u00bfSobreescribir configuraci\u00f3n?
+jsite.quit.config-not-saved=<html><b>Configuraci\u00f3n no guardada</b><br><br>El archivo de configuraci\u00f3n no pudo ser guardado.<br>\u00bfDesea salir de todos modos?</html>
+
+jsite.menu.languages=Idiomas
+jsite.menu.language.en=English
+jsite.menu.language.de=Deutsch
+jsite.menu.language.fr=Fran\u00e7ais
+jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
+jsite.menu.language.pl=Polski
+jsite.menu.language.fi=Suomi
+jsite.menu.nodes=Nodos
+jsite.menu.nodes.manage-nodes=Gestionar nodos
+jsite.menu.options=Opciones
+jsite.menu.options.preferences=Preferencias
+jsite.menu.help=Ayuda
+jsite.menu.help.check-for-updates=Comprobar actualizaciones
+jsite.menu.help.about=Acerca
+
+jsite.about.message=<html><big><b>jSite {0}</b></big><br><br>Copyright \u00a9 2006\u20132012 David Roden<br>Released under the GNU General Public License</html>
+
+jsite.node-manager.heading=Gestor de Nodos
+jsite.node-manager.description=Gestiona tus nodos aqu\u00ed.
+jsite.node-manager.node-information=Informaci\u00f3n sobre el Nodo
+jsite.node-manager.add-node=A\u00f1adir Nodo
+jsite.node-manager.new-node=Nuevo Nodo
+jsite.node-manager.delete-node=Eliminar Nodo
+jsite.node-manager.delete-node.warning=<html><b>Confirmar borrado del nodo</b><br><br>\u00bfEliminar este nodo?</html>
+jsite.node-manager.name=Nombre
+jsite.node-manager.hostname=Nombre de host
+jsite.node-manager.port=Puerto
+
+jsite.preferences.heading=Preferencias
+jsite.preferences.description=Use esta p\u00e1gina para gestionar algunos ajustes globales.
+jsite.preferences.temp-directory=Directorio para archivos temporales
+jsite.preferences.temp-directory.default=Por defecto (elegido por el sistema)
+jsite.preferences.temp-directory.custom=Personalizado
+jsite.preferences.temp-directory.choose=Seleccionar
+jsite.preferences.temp-directory.choose.approve=Seleccionar
+jsite.preferences.config-directory=Localizaci\u00f3n del archivo de configuraci\u00f3n
+jsite.preferences.config-directory.jar=Junto al archivo JAR
+jsite.preferences.config-directory.home=Directorio del usuario
+jsite.preferences.config-directory.custom=Otro directorio
+jsite.preferences.insert-options=Insertar opciones
+jsite.preferences.insert-options.use-early-encode=Generar la URI final precipitada
+jsite.preferences.insert-options.priority=Prioridad
+jsite.preferences.insert-options.manifest-putter=Actualizador de Manifiesto
+
+jsite.insert.heading=Inserci\u00f3n del proyecto
+jsite.insert.description=Por favor, espere mientras el proyecto est\u00e1 siendo insertado.
+jsite.insert.project-information=Informaci\u00f3n del proyecto
+jsite.insert.request-uri=Freesite
+jsite.insert.start-time=Tiempo de inicio
+jsite.insert.starting=Iniciando\u2026
+jsite.insert.done=Hecho.
+jsite.insert.done.title=Inserci\u00f3n terminada
+jsite.insert.insert-aborted=La inserci\u00f3n ha sido cancelada.
+jsite.insert.insert-aborted.title=Inserci\u00f3n Cancelada
+jsite.insert.progress=Progreso
+jsite.insert.k-per-s=KB/s
+jsite.insert.insert-failed=<html><b>Inserci\u00f3n Fallida</b><br><br>La inserci\u00f3n del proyecto ha fallado.<br>Algunos archivos no pudieron ser insertados.</html>
+jsite.insert.insert-failed-with-cause=<html><b>Inserci\u00f3n Fallida</b><br><br>La inserci\u00f3n del proyecto ha fallado.<br>Algunos archivos no pudieron ser insertados.<br>Ha ocurrido el siguiente error:<br><br><code>{0}</code></html>
+jsite.insert.insert-failed.title=Inserci\u00f3n Fallida
+jsite.insert.inserted=<html><b>Proyecto insertado</b><br><br>Su proyecto ha sido insertado correctamente.</html>
+jsite.insert.okay-copy-uri=Copiar URI al portapapeles
+jsite.insert.reinserted-edition=<html><b>Edici\u00f3n Reinsertada</b><br><br>La edici\u00f3n que est\u00e1 insertando<br>ya ha sido insertada.</html>
+jsite.insert.reinserted-edition.title=Edici\u00f3n Reinsertada
+
+jsite.file-scanner.can-not-read-directory=No se pudo leer el directorio
+
+jsite.project.heading=Seleccionar un Proyecto
+jsite.project.description=Seleccionar un proyecto para procesar de la lista de abajo, o cree un nuevo proyecto.
+jsite.project.action.browse=Examinar
+jsite.project.action.browse.choose=Seleccionar
+jsite.project.action.browse.tooltip=Examinar directorio
+jsite.project.action.add-project=A\u00f1adir proyecto
+jsite.project.action.add-project.tooltip=A\u00f1adir un nuevo proyecto
+jsite.project.new-project.name=Nuevo Proyecto
+jsite.project.action.delete-project=Eliminar proyecto
+jsite.project.action.delete-project.tooltip=Eliminar un proyecto
+jsite.project.action.delete-project.confirm=<html><b>Confirmar borrado</b><br><br>El proyecto \u201c{0}\u201d ser\u00e1 eliminado.<br>\u00bfQuiere continuar?</html>
+jsite.project.action.clone-project=Clonar proyecto
+jsite.project.action.clone-project.copy=Copia de {0}
+jsite.project.action.clone-project.tooltip=Clonar el proyecto seleccionado
+jsite.project.action.copy-uri=Copiar URI al portapapeles
+jsite.project.action.copy-uri.tooltip=Copiar la URI del proyecto al portapapeles
+jsite.project.action.manage-keys=Gestionar Claves
+jsite.project.action.manage-keys.tooltip=Gestiona las claves de este proyecto
+jsite.project.action.reset-edition=Reestablecer Edici\u00f3n
+jsite.project.action.reset-edition.tooltip=Reestablecer el n\u00famero de edici\u00f3n del proyecto
+jsite.project.project.information=Informaci\u00f3n del Proyecto
+jsite.project.project.name=Nombre
+jsite.project.project.description=Descripci\u00f3n
+jsite.project.project.local-path=Ruta local
+jsite.project.project.address=Direcci\u00f3n
+jsite.project.project.path=Ruta del Freesite
+jsite.project.project.edition=Edici\u00f3n
+jsite.project.project.uri=URI
+jsite.project.keygen.io-error=<html><b>Comunicaci\u00f3n con el nodo fallida</b><br><br>La comunicaci\u00f3n con el nodo ha fallado<br>con el siguiente mensaje de error:<br><br><code>{0}</code><br><br>Por favor, aseg\u00farese de que ha introducido<br>el nombre de host y puerto correctos<br>en la p\u00e1gina "Ajustes del Nodo".</html>
+jsite.project.warning.generate-new-key=<html><b>\u00bfGenerar una nueva llave?</b><br><br>Si genera una nueva clave, su sitio ser\u00e1 publicado<br>bajo esa nueva clave. Cualquier uso que otros usuarios le den<br>a la vieja clave se habr\u00e1 ido.<br>Tambi\u00e9n, la edici\u00f3n ser\u00e1 reestablecida.</html>
+jsite.project.warning.reset-edition=<html><b>\u00bfReestablecer edici\u00f3n?</b><br><br>Reestablecer la edici\u00f3n puede conllevar fallos<br>y mucha confusi\u00f3n si no ha cambiado<br>la ruta o las claves del proyecto.</html>
+jsite.project.warning.use-clipboard-now=<html><b>URI copiada</b><br><br>Tenga en cuenta que es posible que al salir de jSite<br>ahora su portapapeles se vac\u00ede. Por favor, use la<br>URI copiada inmediatamente en otra ventana.</html>
+
+jsite.project-files.heading=Archivos del Proyecto
+jsite.project-files.description=<html>En esta p\u00e1gina puedes especificar los par\u00e1metros para los archivos de este proyecto, como<br>llaves generadas externamente o tipos de MIME, si la detecci\u00f3n autom\u00e1tica ha fallado.</html>
+jsite.project-files.action.rescan=Reescanear
+jsite.project-files.action.rescan.tooltip=Reescanear el directorio del proyecto para encontrar nuevos archivos
+jsite.project-files.always-force-insert=Siempre forzar la inserci\u00f3n
+jsite.project-files.always-force-insert.tooltip=Cuando se selecciona, todos los archivos de este proyecto son insertados aunque no hayan cambiado
+jsite.project-files.ignore-hidden-files=Ignorar archivos ocultos
+jsite.project-files.ignore-hidden-files.tooltip=Cuando se selecciona, los archivos ocultos no son insertados
+jsite.project-files.file-options=Opciones de Archivo
+jsite.project-files.default=Archivo por defecto
+jsite.project-files.default.tooltip=Especifica que este archivo es el archivo principal del proyecto
+jsite.project-files.insert=Insertar
+jsite.project-files.insert.tooltip=Desmarcar en caso de no querer insertar este archivo
+jsite.project-files.force-insert=Forzar inserci\u00f3n
+jsite.project-files.force-insert.tooltip=Fuerza la inserci\u00f3n de este archivo incluso si no ha sido modificado
+jsite.project-files.insert-redirect=Redireccionar
+jsite.project-files.insert-redirect.tooltip=Comprueba si quieres insertar una redirecci\u00f3n para este archivo
+jsite.project-files.custom-key=Otra llave
+jsite.project-files.custom-key.tooltip=La llave externamente creada para el archivo
+jsite.project-files.rename=Renombrar
+jsite.project-files.rename.tooltip=Renombra el archivo en el sitio subido
+jsite.project-files.mime-type=Tipo de MIME
+jsite.project-files.mime-type.tooltip=Selecciona el tipo de MIME correcto aqu\u00ed si la detecci\u00f3n fall\u00f3.
+jsite.project-files.container=Contenedor
+jsite.project-files.container.tooltip=Selecciona un contenedor para el archivo actual
+jsite.project-files.scan-error=<html><b>Error escaneando los archivos</b><br><br>El directorio del proyecto no existe<br>o bien algunos archivos/directorios en \u00e9l no son accesibles.<br>Por favor, retroceda y seleccione el directorio correcto.</html>
+jsite.project-files.insert-now=Insertar ahora
+jsite.project-files.invalid-default-file=Solo los archivos del directorio ra\u00edz ser\u00e1n seleccionados como archivos por defecto.
+jsite.project-files.scanning=Escaneando\u2026
+
+jsite.update-checker.found-version.title=Nueva Versi\u00f3n Encontrada
+jsite.update-checker.found-version.message=<html>Se ha encontrado una nueva versi\u00f3n.<br><br>Versi\u00f3n {0} (liberada {1,date})</html>
+jsite.update-checker.latest-version.title=Comprobaci\u00f3n de Actualizaciones
+jsite.update-checker.latest-version.newer.message=<html>Est\u00e1s ejecutando la versi\u00f3n {0} pero otra<br>m\u00e1s nueva ({1}) ha sido encontrada.</html>
+jsite.update-checker.latest-version.older.message=<html>Est\u00e1s ejecutando la versi\u00f3n {0} pero<br>la m\u00e1s reciente parece ser {1}.</html>
+jsite.update-checker.latest-version.okay.message=<html>Est\u00e1s ejecutando la versi\u00f3n {0}<br>la cual es la \u00faltima.</html>
+
+jsite.key-dialog.title=Gestionar Llaves del Proyecto
+jsite.key-dialog.button.ok.tooltip=Acepta los cambios
+jsite.key-dialog.button.cancel.tooltip=Descarta los cambios
+jsite.key-dialog.button.copy-from-project=Copiar desde un Proyecto
+jsite.key-dialog.button.copy-from-project.tooltip=Copia las claves p\u00fablica y privada del proyecto seleccionado
+jsite.key-dialog.button.copy-from-identity=Copiar desde una Identidad
+jsite.key-dialog.button.copy-from-identity.tooltip=Copia las claves p\u00fablica y privada de la identidad seleccionada
+jsite.key-dialog.button.generate=Regenerar Llaves
+jsite.key-dialog.button.generate.tooltip=Crea un nuevo par de llaves
+jsite.key-dialog.label.keys=<html><b>Llaves</b></html>
+jsite.key-dialog.label.private-key=Llave Privada
+jsite.key-dialog.label.public-key=Llave P\u00fablica
+jsite.key-dialog.label.copy-keys=<html><b>Copiar Llaves</b></html>
+jsite.key-dialog.label.project=Proyecto
+jsite.key-dialog.label.identity=Identidad
+jsite.key-dialog.label.actions=<html><b>Acciones</b></html>
+
+jsite.warning.empty-index=<html><b>No hay un archivo principal</b><br><br>No ha especificado un archivo principal para este proyecto.<br>Aunque es posible insertar un proyecto sin un archivo<br>principal, deber\u00edas de especificar uno para facilitar la navegaci\u00f3n.</html>
+jsite.warning.index-not-html=<html><b>El archivo principal no est\u00e1 en HTML</b><br><br>Su archivo principal no tiene el tipo de MIME "text/html".<br>Cargar su Freesite en un navegador puede dar resultados inesperados.</html>
+jsite.warning.site-larger-than-2-mib=<html><b>El sitio es mayor a 2MiB.</b><br><br>Su sitio contiene m\u00e1s de 2 megabytes de datos.<br>Debido a errores en Freenet, probablemente no se cargar\u00e1 correctamente.<br>Intente reducir el tama\u00f1o de su sitio, o continue bajo su responsabilidad.</html>
+
+jsite.error.no-node-selected=<html><b>No se ha seleccionado un nodo</b><br><br>Por favor, seleccione un nodo del men\u00fa.</html>
+jsite.error.no-node-running=<html><b>El nodo no est\u00e1 siendo ejecutado</b><br><br>No puede insertar un proyecto si su nodo no est\u00e1 siendo ejecutado.<br>Por favor, inicie su nodo y pruebe otra vez.</html>
+jsite.error.no-local-path=<html><b>No hay ruta local</b><br><br>No ha especificado una ruta local para los archivos que ser\u00e1n insertados.<br>No es posible continuar sin una.</html>
+jsite.error.no-path=<html><b>No hay ruta del Freesite</b><br><br>No ha especificado una ruta para el Freesite.<br>No es posible continuar sin una.</html>
+jsite.error.index-missing=<html>No se encuentra su archivo principal</b><br><br>Un archivo principal fue especificado anteriormente pero<br>ya no existe. Por favor, seleccione<br>un nuevo archivo principal en la lista de archivos.</html>
+jsite.error.index-not-inserted=<html><b>El archivo principal sin insertar</b><br><br>Ha elegido no insertar un archivo principal.<br>Necesita elegir insertarlo, o bien seleccionar<br>otro archivo principal.</html>
+jsite.error.no-custom-key=<html><b>No hay una llave personalizada para el archivo</b><br><br>Ha especificado no insertar <code>{0}</code><br>pero fall\u00f3 al introducir una llave a la que redireccionar.</html>
+jsite.error.no-files-to-insert=<html><b>No hay archivos para insertar</b><br><br>No ha seleccionado ning\u00fan archivo para la inserci\u00f3n.<br>Por favor, seleccione al menos un archivo para ser insertado.</html>
+jsite.error.duplicate-file=<html><b>Archivo duplicado</b><br><br>El archivo <code>{0}</code> est\u00e1 insertado dos veces.<br>Por favor, compruebe los nombres de sus archivos y redirecciones.</html>
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=Solmut
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=Noeud
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=Nodi
jsite.menu.language.de=Deutsch
jsite.menu.language.fr=Fran\u00e7ais
jsite.menu.language.it=Italiano
+jsite.menu.language.es=Espa\u00f1ol
jsite.menu.language.pl=Polski
jsite.menu.language.fi=Suomi
jsite.menu.nodes=W\u0119z\u0142y
--- /dev/null
+package de.todesbaum.jsite.application.validation;
+
+import static de.todesbaum.jsite.application.validation.ProjectValidator.validateProject;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.not;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+
+import de.todesbaum.jsite.application.Project;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * Unit test for {@link ProjectValidator}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class ProjectValidatorTest {
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ private Project project = new Project();
+
+ @Before
+ public void setupProject() throws Exception {
+ project.setLocalPath(temporaryFolder.getRoot().getPath());
+ project.setPath("temp");
+ project.setIndexFile("index.html");
+ temporaryFolder.newFile("index.html").createNewFile();
+ }
+
+ @Test
+ public void completelyValidProjectDoesNotGenerateAnyIssues() {
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), empty());
+ }
+
+ @Test
+ public void missingLocalPathResultsInError() {
+ project.setLocalPath(null);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-local-path", true)));
+ }
+
+ @Test
+ public void emptyLocalPathResultsInError() {
+ project.setLocalPath(" ");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-local-path", true)));
+ }
+
+ @Test
+ public void missingPathResultsInError() {
+ project.setPath(null);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-path", true)));
+ }
+
+ @Test
+ public void emptyPathResultsInError() {
+ project.setPath(" ");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-path", true)));
+ }
+
+ @Test
+ public void missingIndexFileResultsInWarning() {
+ project.setIndexFile(null);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("warning.empty-index", false)));
+ }
+
+ @Test
+ public void emptyIndexFileResultsInWarning() {
+ project.setIndexFile("");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("warning.empty-index", false)));
+ }
+
+ @Test
+ public void settingIndexFileWithoutExistingFileResultsInWarning() {
+ project.setIndexFile("test.html");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.index-missing", true)));
+ }
+
+ @Test
+ public void usingNonHtmlMimeTypeForIndexFileResultsInWarning() {
+ project.getFileOption("index.html").setMimeType("text/plain");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("warning.index-not-html", false)));
+ }
+
+ @Test
+ public void usingHtmlMimeTypeWithCharsetForIndexFileDoesNotResultInWarning() {
+ project.getFileOption("index.html").setMimeType("text/html; charset=UTF-8");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), not(hasItem(new Issue("warning.index-not-html", false))));
+ }
+
+ @Test
+ public void notInsertingTheIndexFileAnyFileResultsInError() {
+ project.getFileOption("index.html").setInsert(false);
+ project.getFileOption("index.html").setInsertRedirect(false);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.index-not-inserted", true)));
+ }
+
+ @Test
+ public void insertingARedirectWithRedirectUrlResultsInError() {
+ project.getFileOption("index.html").setInsert(false);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-custom-key", true, "index.html")));
+ }
+
+ @Test
+ public void insertingARedirectEmptyKeyUrlResultsInError() {
+ project.getFileOption("index.html").setInsert(false);
+ project.getFileOption("index.html").setCustomKey(null);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-custom-key", true, "index.html")));
+ }
+
+ @Test
+ public void insertingARedirectToCHKUrlResultsInError() {
+ project.getFileOption("index.html").setInsert(false);
+ project.getFileOption("index.html").setCustomKey("CHK@");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-custom-key", true, "index.html")));
+ }
+
+ @Test
+ public void notInsertingAnyFileResultsInError() {
+ project.getFileOption("index.html").setInsert(false);
+ project.getFileOption("index.html").setInsertRedirect(false);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.no-files-to-insert", true)));
+ }
+
+ @Test
+ public void filesWithDuplicateTargetNamesResultInAnError() {
+ project.getFileOption("second.html").setChangedName("index.html");
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("error.duplicate-file", true, "index.html")));
+ }
+
+ @Test
+ public void filesWithLessThenOrEqualTo2MegabytesDoNotResultInWarning() throws Exception {
+ File largeFile = new File(temporaryFolder.getRoot(), "large.html");
+ Files.write(largeFile.toPath(), new byte[2 * 1048576], StandardOpenOption.CREATE_NEW);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), not(hasItem(new Issue("warning.site-larger-than-2-mib", false))));
+ }
+
+ @Test
+ public void filesWithSizeOfMoreThan2MegabytesDoNotResultInWarning() throws Exception {
+ File largeFile = new File(temporaryFolder.getRoot(), "large.html");
+ Files.write(largeFile.toPath(), new byte[2 * 1048576 + 1], StandardOpenOption.CREATE_NEW);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), hasItem(new Issue("warning.site-larger-than-2-mib", false)));
+ }
+
+ @Test
+ public void filesAreCorrectlyIgnoreForSizeCheckIfNotInserted() throws Exception {
+ File largeFile = new File(temporaryFolder.getRoot(), "large.html");
+ Files.write(largeFile.toPath(), new byte[2 * 1048576 + 1], StandardOpenOption.CREATE_NEW);
+ project.getFileOption("large.html").setInsert(false);
+ CheckReport checkReport = validateProject(project);
+ assertThat(checkReport.getIssues(), not(hasItem(new Issue("warning.site-larger-than-2-mib", false))));
+ }
+
+}
--- /dev/null
+package de.todesbaum.jsite.main;
+
+import static de.todesbaum.jsite.main.ConfigurationLocator.ConfigurationLocation.CUSTOM;
+import static de.todesbaum.jsite.main.ConfigurationLocator.ConfigurationLocation.HOME_DIRECTORY;
+import static de.todesbaum.jsite.main.ConfigurationLocator.ConfigurationLocation.NEXT_TO_JAR_FILE;
+import static java.util.Optional.empty;
+import static java.util.Optional.of;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * Unit test for {@link ConfigurationLocator}.
+ */
+public class ConfigurationLocatorTest {
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Test
+ public void configurationLocatorPrefersHomeDirectoryIfJarFileCanNotBeFound() {
+ JarFileLocator jarFileLocator = mock(JarFileLocator.class);
+ when(jarFileLocator.locateJarFile()).thenReturn(empty());
+ ConfigurationLocator locator = new ConfigurationLocator(jarFileLocator);
+ assertThat(locator.findPreferredLocation(), is(HOME_DIRECTORY));
+ assertThat(locator.getFile(HOME_DIRECTORY), endsWith("/config7"));
+ assertThat(locator.isValidLocation(HOME_DIRECTORY), is(true));
+ }
+
+ @Test
+ public void configurationLocatorUsesFileNextToJarFileIfJarFileIsFound() throws Exception {
+ File jarFile = temporaryFolder.newFile("test.jar");
+ temporaryFolder.newFile("jSite.conf");
+ JarFileLocator jarFileLocator = mock(JarFileLocator.class);
+ when(jarFileLocator.locateJarFile()).thenReturn(of(jarFile));
+ ConfigurationLocator locator = new ConfigurationLocator(jarFileLocator);
+ assertThat(locator.findPreferredLocation(), is(NEXT_TO_JAR_FILE));
+ assertThat(locator.getFile(NEXT_TO_JAR_FILE), endsWith("/jSite.conf"));
+ assertThat(locator.isValidLocation(NEXT_TO_JAR_FILE), is(true));
+ }
+
+ @Test
+ public void customLocationCanBeSet() throws Exception {
+ File configFile = temporaryFolder.newFile("jSite.conf");
+ JarFileLocator jarFileLocator = mock(JarFileLocator.class);
+ when(jarFileLocator.locateJarFile()).thenReturn(empty());
+ ConfigurationLocator locator = new ConfigurationLocator(jarFileLocator);
+ locator.setCustomLocation(configFile.getPath());
+ assertThat(locator.findPreferredLocation(), is(CUSTOM));
+ assertThat(locator.getFile(CUSTOM), is(configFile.getPath()));
+ assertThat(locator.isValidLocation(CUSTOM), is(true));
+ }
+
+}
--- /dev/null
+package de.todesbaum.jsite.main;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Optional;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import net.pterodactylus.util.io.StreamCopier;
+
+import de.todesbaum.jsite.main.JarFileLocator.DefaultJarFileLocator;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * Unit test for {@link JarFileLocator}.
+ */
+public class JarFileLocatorTest {
+
+ @Rule
+ public final TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ private static final Class<?> CLASS_TO_LOAD = Main.class;
+ private static final String RESOURCE_TO_COPY = CLASS_TO_LOAD.getName().replace('.', '/') + ".class";
+ private static final String PACKAGE_NAME = CLASS_TO_LOAD.getPackage().getName();
+ private static final String CLASS_FILENAME = CLASS_TO_LOAD.getSimpleName() + ".class";
+
+ @Test
+ public void jarFileCanBeLocatedOnPathWithNonUsAsciiCharacters() throws Exception {
+ File jarFilePath = temporaryFolder.newFolder("Фото café");
+ File jarFile = createJarFile(jarFilePath);
+ URLClassLoader urlClassLoader = createClassLoader(jarFile.toURI().toURL());
+ JarFileLocator jarFileLocator = new DefaultJarFileLocator(urlClassLoader);
+ File locatedJarFile = jarFileLocator.locateJarFile().get();
+ assertThat(locatedJarFile, is(jarFile));
+ }
+
+ private File createJarFile(File folder) throws Exception {
+ File jarFile = new File(folder, "test.jar");
+ copyClassFileToStream(RESOURCE_TO_COPY, new FileOutputStream(jarFile));
+ return jarFile;
+ }
+
+ private void copyClassFileToStream(String fileToCopy, FileOutputStream outputStream) throws IOException {
+ try (JarOutputStream jarOutputStream = new JarOutputStream(outputStream);
+ InputStream inputStream = getClass().getResourceAsStream("/" + fileToCopy)) {
+ jarOutputStream.putNextEntry(new JarEntry(fileToCopy));
+ StreamCopier.copy(inputStream, jarOutputStream);
+ jarOutputStream.closeEntry();
+ }
+ }
+
+ private URLClassLoader createClassLoader(URL url) throws MalformedURLException {
+ return new URLClassLoader(new URL[] { url }) {
+ @Override
+ public URL getResource(String name) {
+ /* ignore parent class loader here. */
+ return findResource(name);
+ }
+ };
+ }
+
+ @Test
+ public void jarFileCanNotBeLocatedWhenLoadedFromFile() throws Exception {
+ File folder = temporaryFolder.newFolder(PACKAGE_NAME.split("\\."));
+ createClassFile(folder);
+ ClassLoader classLoader = createClassLoader(temporaryFolder.getRoot().toURI().toURL());
+ JarFileLocator jarFileLocator = new DefaultJarFileLocator(classLoader);
+ Optional<File> locatedJarFile = jarFileLocator.locateJarFile();
+ assertThat(locatedJarFile.isPresent(), is(false));
+ }
+
+ private void createClassFile(File folder) throws IOException {
+ File classFile = new File(folder, CLASS_FILENAME);
+ try (FileOutputStream outputStream = new FileOutputStream(classFile)) {
+ copyClassFileToStream(RESOURCE_TO_COPY, outputStream);
+ }
+ }
+
+ @Test
+ public void jarFileCanNotBeLoadedIfClasspathIsSuperWeirdAndClassDoesNotExist() throws Exception {
+ ClassLoader classLoader = createClassLoader(temporaryFolder.getRoot().toURI().toURL());
+ JarFileLocator jarFileLocator = new DefaultJarFileLocator(classLoader);
+ Optional<File> locatedJarFile = jarFileLocator.locateJarFile();
+ assertThat(locatedJarFile.isPresent(), is(false));
+ }
+
+}