db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1291657 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Date Tue, 21 Feb 2012 08:39:18 GMT
Author: kristwaa
Date: Tue Feb 21 08:39:18 2012
New Revision: 1291657

URL: http://svn.apache.org/viewvc?rev=1291657&view=rev
Log:
DERBY-5620: Replace illegal characters from test name when creating the failure folder

Replace all non-alphanumeric, except '-' and '_', with '_'. TestCase.getName
returning null is not dealt with, as all test cases should be given a name.

Patch file: derby-5620-2a-alphanum.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1291657&r1=1291656&r2=1291657&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Tue Feb 21 08:39:18 2012
@@ -1914,7 +1914,20 @@ public final class TestConfiguration {
         
         sb.append(className);
         sb.append(File.separatorChar);
-        sb.append(test.getName());
+        // DERBY-5620: Ensure valid file name.
+        char[] tmpName = test.getName().toCharArray();
+        for (int i=0; i < tmpName.length; i++) {
+            switch (tmpName[i]) {
+                case '-':
+                case '_':
+                    continue;
+                default:
+                    if (!Character.isLetterOrDigit(tmpName[i])) {
+                        tmpName[i] = '_';
+                    }
+            }
+        }
+        sb.append(tmpName);
         
         String base = sb.toString().intern();
         final File folder = new File(base);



Mime
View raw message