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 947A319C2C for ; Mon, 28 Mar 2016 20:22:11 +0000 (UTC) Received: (qmail 1027 invoked by uid 500); 28 Mar 2016 20:22:11 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 990 invoked by uid 500); 28 Mar 2016 20:22:11 -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 981 invoked by uid 99); 28 Mar 2016 20:22:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Mar 2016 20:22:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 1019A1A57A7 for ; Mon, 28 Mar 2016 20:22:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.799 X-Spam-Level: * X-Spam-Status: No, score=1.799 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8bY7Y0uSm6ko for ; Mon, 28 Mar 2016 20:22:09 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 7C8815FACE for ; Mon, 28 Mar 2016 20:22:09 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8AAFAE076F for ; Mon, 28 Mar 2016 20:22:08 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 8BB723A0046 for ; Mon, 28 Mar 2016 20:22:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1736924 - in /poi/trunk/src: java/org/apache/poi/ss/util/CellUtil.java ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Date: Mon, 28 Mar 2016 20:22:08 -0000 To: commits@poi.apache.org From: centic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160328202208.8BB723A0046@svn01-us-west.apache.org> Author: centic Date: Mon Mar 28 20:22:08 2016 New Revision: 1736924 URL: http://svn.apache.org/viewvc?rev=1736924&view=rev Log: Fix some compiler warnings, javadoc, ... Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java?rev=1736924&r1=1736923&r2=1736924&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java (original) +++ poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java Mon Mar 28 20:22:08 2016 @@ -332,11 +332,11 @@ public final class CellUtil { /** * Utility method that returns the named short value form the given map. - * @return zero if the property does not exist, or is not a {@link Short}. * * @param properties map of named properties (String -> Object) * @param name property name - * @return property value, or zero + * @return zero if the property does not exist, or is not a {@link Short} + * otherwise the property value */ private static short getShort(Map properties, String name) { Object value = properties.get(name); @@ -348,14 +348,15 @@ public final class CellUtil { /** * Utility method that returns the named boolean value form the given map. - * @return false if the property does not exist, or is not a {@link Boolean}. * * @param properties map of properties (String -> Object) * @param name property name - * @return property value, or false + * @return false if the property does not exist, or is not a {@link Boolean}, + * true otherwise */ private static boolean getBoolean(Map properties, String name) { Object value = properties.get(name); + //noinspection SimplifiableIfStatement if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } @@ -397,10 +398,9 @@ public final class CellUtil { boolean foundUnicode = false; String lowerCaseStr = s.toLowerCase(Locale.ROOT); - for (int i = 0; i < unicodeMappings.length; i++) { - UnicodeMapping entry = unicodeMappings[i]; + for (UnicodeMapping entry : unicodeMappings) { String key = entry.entityName; - if (lowerCaseStr.indexOf(key) != -1) { + if (lowerCaseStr.contains(key)) { s = s.replaceAll(key, entry.resolvedValue); foundUnicode = true; } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java?rev=1736924&r1=1736923&r2=1736924&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java Mon Mar 28 20:22:08 2016 @@ -409,7 +409,7 @@ public final class TestXSSFCell extends ((XSSFRow)row).onDocumentWrite(); for(Cell cell : row) { - cell.toString(); + assertNotNull(cell.toString()); } } @@ -453,8 +453,8 @@ public final class TestXSSFCell extends } @Test - public void testEncodingbeloAscii() throws IOException { - StringBuffer sb = new StringBuffer(); + public void testEncodingBelowAscii() throws IOException { + StringBuilder sb = new StringBuilder(); // test all possible characters for(int i = 0; i < Character.MAX_VALUE; i++) { sb.append((char)i); @@ -466,10 +466,10 @@ public final class TestXSSFCell extends int pos = 0; while(pos < strAll.length()) { String str = strAll.substring(pos, Math.min(strAll.length(), pos+SpreadsheetVersion.EXCEL2007.getMaxTextLength())); - + Workbook wb = HSSFITestDataProvider.instance.createWorkbook(); Cell cell = wb.createSheet().createRow(0).createCell(0); - + Workbook xwb = XSSFITestDataProvider.instance.createWorkbook(); Cell xCell = xwb.createSheet().createRow(0).createCell(0); @@ -482,19 +482,19 @@ public final class TestXSSFCell extends assertEquals(str, xCell.getStringCellValue()); sCell.setCellValue(str); assertEquals(str, sCell.getStringCellValue()); - + Workbook wbBack = HSSFITestDataProvider.instance.writeOutAndReadBack(wb); Workbook xwbBack = XSSFITestDataProvider.instance.writeOutAndReadBack(xwb); Workbook swbBack = SXSSFITestDataProvider.instance.writeOutAndReadBack(swb); cell = wbBack.getSheetAt(0).createRow(0).createCell(0); xCell = xwbBack.getSheetAt(0).createRow(0).createCell(0); sCell = swbBack.getSheetAt(0).createRow(0).createCell(0); - + assertEquals(cell.getStringCellValue(), xCell.getStringCellValue()); assertEquals(cell.getStringCellValue(), sCell.getStringCellValue()); - + pos += SpreadsheetVersion.EXCEL97.getMaxTextLength(); - + swbBack.close(); xwbBack.close(); wbBack.close(); @@ -647,7 +647,7 @@ public final class TestXSSFCell extends wb.close(); } - private final void setUp_testCopyCellFrom_CellCopyPolicy() { + private void setUp_testCopyCellFrom_CellCopyPolicy() { @SuppressWarnings("resource") final XSSFWorkbook wb = new XSSFWorkbook(); final XSSFRow row = wb.createSheet("Sheet1").createRow(0); Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java?rev=1736924&r1=1736923&r2=1736924&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java (original) +++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Mon Mar 28 20:22:08 2016 @@ -308,8 +308,8 @@ public final class TestHSSFCell extends // expected during successful test } - HSSFCell cellA = wbA.createSheet().createRow(0).createCell(0); - HSSFCell cellB = wbB.createSheet().createRow(0).createCell(0); + Cell cellA = wbA.createSheet().createRow(0).createCell(0); + Cell cellB = wbB.createSheet().createRow(0).createCell(0); cellA.setCellStyle(styA); cellB.setCellStyle(styB); @@ -378,7 +378,7 @@ public final class TestHSSFCell extends } else { assertFalse(StringRecord.class == recs[index].getClass()); } - Record dbcr = recs[index++]; + Record dbcr = recs[index]; assertEquals(DBCellRecord.class, dbcr.getClass()); } @@ -417,12 +417,14 @@ public final class TestHSSFCell extends cell.getCachedFormulaResultType(); fail("Should catch exception"); } catch (IllegalStateException e) { + // expected here } try { assertNotNull(new HSSFCell(wb, sheet, 0, (short)0, Cell.CELL_TYPE_ERROR+1 )); fail("Should catch exception"); } catch (RuntimeException e) { + // expected here } cell.removeCellComment(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org