Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 91413 invoked from network); 3 Nov 2005 14:04:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Nov 2005 14:04:58 -0000 Received: (qmail 75081 invoked by uid 500); 3 Nov 2005 14:04:55 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 74936 invoked by uid 500); 3 Nov 2005 14:04:54 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 74925 invoked by uid 99); 3 Nov 2005 14:04:54 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 03 Nov 2005 06:04:54 -0800 Received: (qmail 91184 invoked by uid 65534); 3 Nov 2005 14:04:33 -0000 Message-ID: <20051103140433.91183.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r330552 - /cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java Date: Thu, 03 Nov 2005 14:04:33 -0000 To: cvs@cocoon.apache.org From: ugo@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ugo Date: Thu Nov 3 06:04:30 2005 New Revision: 330552 URL: http://svn.apache.org/viewcvs?rev=330552&view=rev Log: Fix for COCOON-1192 Modified: cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java Modified: cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java?rev=330552&r1=330551&r2=330552&view=diff ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/generation/CalendarGenerator.java Thu Nov 3 06:04:30 2005 @@ -31,6 +31,7 @@ import org.apache.cocoon.ProcessingException; import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.cocoon.environment.SourceResolver; +import org.apache.commons.lang.BooleanUtils; import org.apache.excalibur.source.SourceValidity; import org.apache.excalibur.source.impl.validity.NOPValidity; import org.xml.sax.SAXException; @@ -44,8 +45,8 @@ * @cocoon.sitemap.component.name calendar * @cocoon.sitemap.component.label content * @cocoon.sitemap.component.logger sitemap.generator.calendar - * - * + * + * *

* Here is a sample output: *

@@ -140,7 +141,7 @@ /** Do we need to pad out the first and last weeks? */ protected boolean padWeeks; - + /* Add the day of the week * * since SUNDAY=1, we start with a dummy @@ -165,7 +166,7 @@ this.cacheKeyParList = new ArrayList(); this.cacheKeyParList.add(src); - + // Determine the locale String langString = par.getParameter("lang", null); locale = Locale.getDefault(); @@ -193,8 +194,8 @@ this.dateFormatter = DateFormat.getDateInstance(DateFormat.LONG, locale); } this.padWeeks = par.getParameterAsBoolean("padWeeks", false); - this.cacheKeyParList.add(new Boolean(this.padWeeks)); - this.monthFormatter = new SimpleDateFormat("MMMM", locale); + this.cacheKeyParList.add(BooleanUtils.toBooleanObject(this.padWeeks)); + this.monthFormatter = new SimpleDateFormat("MMMM", locale); this.attributes = new AttributesImpl(); } @@ -204,14 +205,14 @@ * @throws SAXException if an error occurs while outputting the document */ public void generate() throws SAXException, ProcessingException { - Calendar start = Calendar.getInstance(TimeZone.getTimeZone("UTC"), locale); + Calendar start = Calendar.getInstance(locale); start.clear(); start.set(Calendar.YEAR, this.year); start.set(Calendar.MONTH, this.month); start.set(Calendar.DAY_OF_MONTH, 1); Calendar end = (Calendar) start.clone(); end.add(Calendar.MONTH, 1); - + // Determine previous and next months Calendar prevMonth = (Calendar) start.clone(); prevMonth.add(Calendar.MONTH, -1); @@ -232,7 +233,7 @@ String.valueOf(end.get(Calendar.YEAR))); attributes.addAttribute("", NEXT_MONTH_ATTR_NAME, NEXT_MONTH_ATTR_NAME, "CDATA", monthNumberFormatter.format(end.get(Calendar.MONTH) + 1)); - + this.contentHandler.startElement(URI, CALENDAR_NODE_NAME, PREFIX + ':' + CALENDAR_NODE_NAME, attributes); int weekNo = start.get(Calendar.WEEK_OF_MONTH); @@ -308,8 +309,8 @@ PREFIX + ':' + DAY_NODE_NAME); end.add(Calendar.DAY_OF_MONTH, 1); if (firstDay == end.get(Calendar.DAY_OF_WEEK)) { - this.contentHandler.endElement(URI, WEEK_NODE_NAME, - PREFIX + ':' + WEEK_NODE_NAME); + this.contentHandler.endElement(URI, WEEK_NODE_NAME, + PREFIX + ':' + WEEK_NODE_NAME); } } } @@ -328,7 +329,7 @@ * @throws SAXException if an error occurs while outputting the document */ protected void addContent(Calendar date, Locale locale) throws SAXException {} - + /* (non-Javadoc) * @see org.apache.cocoon.caching.CacheableProcessingComponent#getKey() */ @@ -360,5 +361,5 @@ this.locale = null; super.recycle(); } - + }