commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: svn commit: r1686260 [1/5] - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/ main/java/org/apache/commons/io/input/ main/java/org/apache/commons/io/monitor/ test/java/org/apache/commons/io/ test/java/org/apache/commons/io/filefilter/ ...
Date Thu, 18 Jun 2015 16:16:25 GMT
On Thu, Jun 18, 2015 at 8:57 AM, <krosenvold@apache.org> wrote:

> Author: krosenvold
> Date: Thu Jun 18 15:57:56 2015
> New Revision: 1686260
>
> URL: http://svn.apache.org/r1686260
> Log:
> Language level code changes
>
>
> ...


>
> Modified:
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java?rev=1686260&r1=1686259&r2=1686260&view=diff
>
> ==============================================================================
> ---
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
> (original)
> +++
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
> Thu Jun 18 15:57:56 2015
> @@ -75,23 +75,23 @@ public class FileSystemUtils {
>              }
>              osName = osName.toLowerCase(Locale.ENGLISH);
>              // match
> -            if (osName.indexOf("windows") != -1) {
> +            if (osName.contains("windows")) {
>                  os = WINDOWS;
> -            } else if (osName.indexOf("linux") != -1 ||
> -                osName.indexOf("mpe/ix") != -1 ||
> -                osName.indexOf("freebsd") != -1 ||
> -                osName.indexOf("irix") != -1 ||
> -                osName.indexOf("digital unix") != -1 ||
> -                osName.indexOf("unix") != -1 ||
> -                osName.indexOf("mac os x") != -1) {
> +            } else if (osName.contains("linux") ||
> +                    osName.contains("mpe/ix") ||
> +                    osName.contains("freebsd") ||
> +                    osName.contains("irix") ||
> +                    osName.contains("digital unix") ||
> +                    osName.contains("unix") ||
> +                    osName.contains("mac os x")) {
>                  os = UNIX;
> -            } else if (osName.indexOf("sun os") != -1 ||
> -                osName.indexOf("sunos") != -1 ||
> -                osName.indexOf("solaris") != -1) {
> +            } else if (osName.contains("sun os") ||
> +                    osName.contains("sunos") ||
> +                    osName.contains("solaris")) {
>                  os = POSIX_UNIX;
>                  dfPath = "/usr/xpg4/bin/df";
> -            } else if (osName.indexOf("hp-ux") != -1 ||
> -                osName.indexOf("aix") != -1) {
> +            } else if (osName.contains("hp-ux") ||
> +                    osName.contains("aix")) {
>                  os = POSIX_UNIX;
>              } else {
>                  os = OTHER;
>
>
>
How about finally updating [io] to Java 7 and using a switch?

Gary


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message