commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E-J (JIRA)" <>
Subject [jira] Commented: (SANSELAN-36) Sanselan tests fail on Windows
Date Fri, 12 Mar 2010 01:19:28 GMT


James E-J commented on SANSELAN-36:

Easy fix- created in Test packages under org.apache.sanselan :
package org.apache.sanselan;

public class Replacer {
    public static String replaceSlashes(String input){
            String seperator = System.getProperty("file.separator");
                    return input.replaceAll("\\\\",seperator);
                else return input;

And then changed following three lines of code: line 38 becomes-
String imagesFolderPath = Replacer.replaceSlashes("src\\test\\data\\images\\png\\3");
instead of: String imagesFolderPath = "src\\test\\data\\images\\png\\3".replaceAll("\\\\",
and needs a new import: "import org.apache.sanselan.Replacer;" line 25/26 becomes:
instead of: 
"src\\test\\data\\images\\exif\\philHarvey\\".replaceAll("\\\\", System
					.getProperty("file.separator"))); line 66/67 becomes:
imagePath = Replacer.replaceSlashes(imagePath);
instead of:
imagePath = imagePath.replaceAll("\\\\", System

Now passes tests with following results:
Results :

Tests run: 47, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: D:\Users\Student\Documents\NetBeansProjects\commons-sansela
[INFO] [install:install {execution: default-install}]
[INFO] Installing D:\Users\Student\Documents\NetBeansProjects\commons-sanselan\t
arget\commons-sanselan-0.98-SNAPSHOT.jar to D:\Users\Student\.m2\repository\org\

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 13 seconds
[INFO] Finished at: Fri Mar 12 01:08:05 GMT 2010
[INFO] Final Memory: 26M/63M
[INFO] ------------------------------------------------------------------------

> Sanselan tests fail on Windows
> ------------------------------
>                 Key: SANSELAN-36
>                 URL:
>             Project: Commons Sanselan
>          Issue Type: Test
>            Reporter: Niall Pemberton
>            Priority: Minor
> A number of the Sanselan tests fail on windows - all related to the use of the following
code with file paths:
> {code}
>        "...".replaceAll("\\\\", System.getProperty("file.separator")
> {code}
> The problem is on windows the file separator is a "back slash" character which needs
to be escaped in regular expressions.
> This affects:
>     * SanselanTestConstants (causes ExceptionIntializedError  because the static PHIL_HARVEY_TEST_IMAGE_FOLDER
fails when its being initialized with a StringIndexOutOfBoundsException)
>     * SanselanGuessFormatTest fails in testGuess_all() and testGuess_unknown() throwing
>     * PngMultipleRoundtripTest  fails in test() throwing StringIndexOutOfBoundsException

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message