From f15dbb6a29e2d4332399624b4158aa657095b746 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 2 Jun 2008 13:20:13 +0200 Subject: [PATCH] fix parsing of overrides --- src/net/pterodactylus/jsite/project/FileOverride.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/net/pterodactylus/jsite/project/FileOverride.java b/src/net/pterodactylus/jsite/project/FileOverride.java index 94bde40..f9b44ab 100644 --- a/src/net/pterodactylus/jsite/project/FileOverride.java +++ b/src/net/pterodactylus/jsite/project/FileOverride.java @@ -19,6 +19,11 @@ package net.pterodactylus.jsite.project; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.pterodactylus.util.logging.Logging; + /** * An override is used to enter other information about a file than the defaults * would have yielded. It is also used to add redirects to a project. @@ -28,6 +33,9 @@ package net.pterodactylus.jsite.project; */ public class FileOverride { + /** The logger. */ + private static final Logger logger = Logging.getLogger(FileOverride.class.getName()); + /** The insert override. */ private Boolean insert; @@ -132,16 +140,14 @@ public class FileOverride { public static FileOverride valueOf(String overrideString) { FileOverride override = new FileOverride(); String[] parts = overrideString.split("\\|"); - if (parts.length < 3) { - return null; - } - if (parts[0].length() > 0) { + logger.log(Level.FINEST, "parts.length: " + parts.length); + if ((parts.length > 0) && (parts[0].length() > 0)) { override.insert = Boolean.valueOf(parts[0]); } - if (parts[1].length() > 0) { + if ((parts.length > 1) && (parts[1].length() > 0)) { override.contentType = parts[1]; } - if (parts[2].length() > 0) { + if ((parts.length > 2) && (parts[2].length() > 0)) { override.redirectTarget = parts[2]; } return override; -- 2.7.4