diff options
author | Per-Åke Minborg <minborg@speedment.com> | 2016-10-28 08:34:28 -0700 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-11-02 15:07:20 +0000 |
commit | 26557c4fca92ace4a7a35b7f055777a442632fc2 (patch) | |
tree | 7768be7f03ae7f1f57bbd06272700121b4f99130 | |
parent | 9bef3d136c63d3eded2dec1ffdb0af6b69b9c011 (diff) | |
download | vaadin-framework-26557c4fca92ace4a7a35b7f055777a442632fc2.tar.gz vaadin-framework-26557c4fca92ace4a7a35b7f055777a442632fc2.zip |
Replace single character Strings with character literals
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721a
6 files changed, 14 insertions, 14 deletions
diff --git a/server/src/main/java/com/vaadin/server/LocaleService.java b/server/src/main/java/com/vaadin/server/LocaleService.java index 457f014dc5..98bbc8275a 100644 --- a/server/src/main/java/com/vaadin/server/LocaleService.java +++ b/server/src/main/java/com/vaadin/server/LocaleService.java @@ -168,11 +168,11 @@ public class LocaleService implements Serializable { } final String df = ((SimpleDateFormat) dateFormat).toPattern(); - int timeStart = df.indexOf("H"); + int timeStart = df.indexOf('H'); if (timeStart < 0) { - timeStart = df.indexOf("h"); + timeStart = df.indexOf('h'); } - final int ampm_first = df.indexOf("a"); + final int ampm_first = df.indexOf('a'); // E.g. in Korean locale AM/PM is before h:mm // TODO should take that into consideration on client-side as well, // now always h:mm a diff --git a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index fe950b4318..92684a689e 100644 --- a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -152,7 +152,7 @@ public class SASSAddonImportFileCreator { // Convention is to name the mixin after the stylesheet. Strip // .scss from filename - String mixin = file.substring(file.lastIndexOf("/") + 1, + String mixin = file.substring(file.lastIndexOf('/') + 1, file.length() - ".scss".length()); foundMixins.add(mixin); @@ -170,11 +170,11 @@ public class SASSAddonImportFileCreator { try { // Try to parse path for better readability - path = path.substring(path.lastIndexOf(":") + 1, - path.lastIndexOf("!")); + path = path.substring(path.lastIndexOf(':') + 1, + path.lastIndexOf('!')); // Extract jar archive filename - path = path.substring(path.lastIndexOf("/") + 1); + path = path.substring(path.lastIndexOf('/') + 1); } catch (Exception e) { // Parsing failed but no worries, we then use whatever diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index 42320cb02f..9bc01e7ce2 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -211,7 +211,7 @@ public class ClassPathExplorer { // remove the .gwt.xml extension String classname = file.substring(0, file.length() - 8); String packageName = locationString - .substring(locationString.lastIndexOf("/") + 1); + .substring(locationString.lastIndexOf('/') + 1); classname = packageName + "." + classname; if (!WidgetSetBuilder.isWidgetset(classname)) { // Only return widgetsets and not GWT modules to avoid diff --git a/server/src/main/java/com/vaadin/ui/Embedded.java b/server/src/main/java/com/vaadin/ui/Embedded.java index e4dcee096f..4d4c3472b5 100644 --- a/server/src/main/java/com/vaadin/ui/Embedded.java +++ b/server/src/main/java/com/vaadin/ui/Embedded.java @@ -451,7 +451,7 @@ public class Embedded extends AbstractComponent implements LegacyComponent { if (mt.equals("image/svg+xml")) { type = TYPE_OBJECT; - } else if ((mt.substring(0, mt.indexOf("/")) + } else if ((mt.substring(0, mt.indexOf('/')) .equalsIgnoreCase("image"))) { type = TYPE_IMAGE; } else { diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java index 023d54c7f4..41b2e851f3 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java @@ -134,7 +134,7 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { } else if (value.startsWith("rgb")) { // RGB color format rgb/rgba(255,255,255,0.1) - String[] colors = value.substring(value.indexOf("(") + 1, + String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(","); int red = Integer.parseInt(colors[0]); @@ -150,7 +150,7 @@ public class ColorPickerPreview extends CssLayout implements HasValue<Color> { } else if (value.startsWith("hsl")) { // HSL color format hsl/hsla(100,50%,50%,1.0) - String[] colors = value.substring(value.indexOf("(") + 1, + String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(","); int hue = Integer.parseInt(colors[0]); diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java index da0d3df853..39da3da890 100644 --- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java +++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java @@ -254,9 +254,9 @@ public class FileTypeResolver implements Serializable { } // Calculates the extension of the file - int dotIndex = fileName.indexOf("."); - while (dotIndex >= 0 && fileName.indexOf(".", dotIndex + 1) >= 0) { - dotIndex = fileName.indexOf(".", dotIndex + 1); + int dotIndex = fileName.indexOf('.'); + while (dotIndex >= 0 && fileName.indexOf('.', dotIndex + 1) >= 0) { + dotIndex = fileName.indexOf('.', dotIndex + 1); } dotIndex++; |