From: David ‘Bombe’ Roden Date: Mon, 2 Jun 2008 11:20:13 +0000 (+0200) Subject: fix parsing of overrides X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f15dbb6a29e2d4332399624b4158aa657095b746;p=jSite2.git fix parsing of overrides --- 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;