From a9f220d1541455abee041321fb26ba6b71388019 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sat, 29 Aug 2015 18:01:26 +0000 Subject: [PATCH] forbidden apis fixes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700063 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/sl/draw/DrawShape.java | 3 ++- .../apache/poi/sl/usermodel/AutoNumberingScheme.java | 12 +++++++----- src/java/org/apache/poi/util/JvmBugs.java | 4 +++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/poi/sl/draw/DrawShape.java b/src/java/org/apache/poi/sl/draw/DrawShape.java index deca5d7a32..d036e52733 100644 --- a/src/java/org/apache/poi/sl/draw/DrawShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawShape.java @@ -20,6 +20,7 @@ package org.apache.poi.sl.draw; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; +import java.util.Locale; import org.apache.poi.sl.usermodel.PlaceableShape; import org.apache.poi.sl.usermodel.Shape; @@ -72,7 +73,7 @@ public class DrawShape implements Drawable { // and later on, turn it around again to compare it with its original size ... AffineTransform txs; - if (ps.getClass().getCanonicalName().toLowerCase().contains("hslf")) { + if (ps.getClass().getCanonicalName().toLowerCase(Locale.ROOT).contains("hslf")) { txs = new AffineTransform(tx); } else { // this handling is only based on try and error ... not sure why xslf is handled differently. diff --git a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java index 3a68313499..1ba4f13e25 100644 --- a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java +++ b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java @@ -17,6 +17,8 @@ package org.apache.poi.sl.usermodel; +import java.util.Locale; + public enum AutoNumberingScheme { /** Lowercase alphabetic character enclosed in parentheses. Example: (a), (b), (c), ... */ alphaLcParenBoth(0x0008, 1), @@ -177,7 +179,7 @@ public enum AutoNumberingScheme { } private String formatSeperator(String cased) { - String name = name().toLowerCase(); + String name = name().toLowerCase(Locale.ROOT); if (name.contains("plain")) return cased; if (name.contains("parenright")) return cased+")"; if (name.contains("parenboth")) return "("+cased+")"; @@ -187,9 +189,9 @@ public enum AutoNumberingScheme { } private String formatCase(String index) { - String name = name().toLowerCase(); - if (name.contains("lc")) return index.toLowerCase(); - if (name.contains("uc")) return index.toUpperCase(); + String name = name().toLowerCase(Locale.ROOT); + if (name.contains("lc")) return index.toLowerCase(Locale.ROOT); + if (name.contains("uc")) return index.toUpperCase(Locale.ROOT); return index; } @@ -203,7 +205,7 @@ public enum AutoNumberingScheme { "\u2776\u2777\u2778\u2779\u277A\u277B\u277C\u277D\u277E"; private String formatIndex(int value) { - String name = name().toLowerCase(); + String name = name().toLowerCase(Locale.ROOT); if (name.startsWith("roman")) { return formatRomanIndex(value); } else if (name.startsWith("arabic") && !name.contains("db")) { diff --git a/src/java/org/apache/poi/util/JvmBugs.java b/src/java/org/apache/poi/util/JvmBugs.java index 11db293fc4..66e8468e49 100644 --- a/src/java/org/apache/poi/util/JvmBugs.java +++ b/src/java/org/apache/poi/util/JvmBugs.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.util; +import java.util.Locale; + public class JvmBugs { private static final POILogger LOG = POILogFactory.getLogger(JvmBugs.class); @@ -42,7 +44,7 @@ public class JvmBugs { */ public static boolean hasLineBreakMeasurerBug() { String version = System.getProperty("java.version"); - String os = System.getProperty("os.name").toLowerCase(); + String os = System.getProperty("os.name").toLowerCase(Locale.ROOT); boolean ignore = Boolean.getBoolean("org.apache.poi.JvmBugs.LineBreakMeasurer.ignore"); boolean hasBug = (!ignore && (os.contains("win") && ("1.6.0_45".equals(version) || "1.7.0_21".equals(version)))); if (hasBug) {