From commits-return-2743-apmail-poi-commits-archive=poi.apache.org@poi.apache.org Wed Jun 15 11:16:03 2011 Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0DA6548D8 for ; Wed, 15 Jun 2011 11:16:03 +0000 (UTC) Received: (qmail 27239 invoked by uid 500); 15 Jun 2011 11:16:03 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 27203 invoked by uid 500); 15 Jun 2011 11:16:02 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 27196 invoked by uid 99); 15 Jun 2011 11:16:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2011 11:16:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2011 11:16:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 43A9923888CB; Wed, 15 Jun 2011 11:15:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1135997 - in /poi/trunk/src: documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java Date: Wed, 15 Jun 2011 11:15:41 -0000 To: commits@poi.apache.org From: yegor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110615111541.43A9923888CB@eris.apache.org> Author: yegor Date: Wed Jun 15 11:15:40 2011 New Revision: 1135997 URL: http://svn.apache.org/viewvc?rev=1135997&view=rev Log: Bug 51374 - Fixed incorrect setting of lastPrinted OOXML core property Modified: poi/trunk/src/documentation/content/xdocs/status.xml poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java Modified: poi/trunk/src/documentation/content/xdocs/status.xml URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1135997&r1=1135996&r2=1135997&view=diff ============================================================================== --- poi/trunk/src/documentation/content/xdocs/status.xml (original) +++ poi/trunk/src/documentation/content/xdocs/status.xml Wed Jun 15 11:15:40 2011 @@ -34,6 +34,7 @@ + 51374 - Fixed incorrect setting of lastPrinted OOXML core property 51351 - Word to XSL-FO converter 50458 - Fixed missing shapeId in XSSF drawings 51339 - Fixed arithmetic rounding in formula evaluation Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java?rev=1135997&r1=1135996&r2=1135997&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java Wed Jun 15 11:15:40 2011 @@ -292,7 +292,7 @@ public final class PackagePropertiesPart * @return A string representation of the last printed date. */ public String getLastPrintedPropertyString() { - return getDateValue(created); + return getDateValue(lastPrinted); } /** Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java?rev=1135997&r1=1135996&r2=1135997&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java Wed Jun 15 11:15:40 2011 @@ -29,6 +29,7 @@ import junit.framework.TestCase; import org.apache.poi.openxml4j.OpenXML4JTestDataSamples; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; +import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart; import org.apache.poi.openxml4j.util.Nullable; import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogFactory; @@ -123,4 +124,60 @@ public final class TestPackageCoreProper assertEquals("MyTitle", props.getTitleProperty().getValue()); assertEquals("2", props.getVersionProperty().getValue()); } + + public void testCoreProperties_bug51374() throws Exception { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + String strDate = "2007-05-12T08:00:00Z"; + Date date = df.parse(strDate); + + OPCPackage pkg = new ZipPackage(); + PackagePropertiesPart props = (PackagePropertiesPart)pkg.getPackageProperties(); + + // created + assertEquals("", props.getCreatedPropertyString()); + assertNull(props.getCreatedProperty().getValue()); + props.setCreatedProperty((String)null); + assertEquals("", props.getCreatedPropertyString()); + assertNull(props.getCreatedProperty().getValue()); + props.setCreatedProperty(new Nullable()); + assertEquals("", props.getCreatedPropertyString()); + assertNull(props.getCreatedProperty().getValue()); + props.setCreatedProperty(new Nullable(date)); + assertEquals(strDate, props.getCreatedPropertyString()); + assertEquals(date, props.getCreatedProperty().getValue()); + props.setCreatedProperty(strDate); + assertEquals(strDate, props.getCreatedPropertyString()); + assertEquals(date, props.getCreatedProperty().getValue()); + + // lastPrinted + assertEquals("", props.getLastPrintedPropertyString()); + assertNull(props.getLastPrintedProperty().getValue()); + props.setLastPrintedProperty((String)null); + assertEquals("", props.getLastPrintedPropertyString()); + assertNull(props.getLastPrintedProperty().getValue()); + props.setLastPrintedProperty(new Nullable()); + assertEquals("", props.getLastPrintedPropertyString()); + assertNull(props.getLastPrintedProperty().getValue()); + props.setLastPrintedProperty(new Nullable(date)); + assertEquals(strDate, props.getLastPrintedPropertyString()); + assertEquals(date, props.getLastPrintedProperty().getValue()); + props.setLastPrintedProperty(strDate); + assertEquals(strDate, props.getLastPrintedPropertyString()); + assertEquals(date, props.getLastPrintedProperty().getValue()); + + // modified + assertNull(props.getModifiedProperty().getValue()); + props.setModifiedProperty((String)null); + assertNull(props.getModifiedProperty().getValue()); + props.setModifiedProperty(new Nullable()); + assertNull(props.getModifiedProperty().getValue()); + props.setModifiedProperty(new Nullable(date)); + assertEquals(strDate, props.getModifiedPropertyString()); + assertEquals(date, props.getModifiedProperty().getValue()); + props.setModifiedProperty(strDate); + assertEquals(strDate, props.getModifiedPropertyString()); + assertEquals(date, props.getModifiedProperty().getValue()); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org