You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by ma...@apache.org on 2007/06/14 19:36:47 UTC

svn commit: r547374 - in /incubator/ivy/core/trunk: ./ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/plugins/latest/ src/java/org/apache/ivy/plugins/repository/ssh/ src/java/org/apache/ivy/util/ src/java/org/apache/ivy/util/url/ test/java/org/ap...

Author: maartenc
Date: Thu Jun 14 12:36:46 2007
New Revision: 547374

URL: http://svn.apache.org/viewvc?view=rev&rev=547374
Log:
FIX: Ivy does not work on Turkish machines (IVY-65)

Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/build.xml
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntBuildTriggerTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Thu Jun 14 12:36:46 2007
@@ -57,6 +57,7 @@
 - IMPROVEMENT: Remove @author tags (thanks to Stephane Bailliez)
 - IMPROVEMENT: Remove use of deprecated elements in ivysettings.xml (IVY-505) (with contribution from Jan Materne)
 
+- FIX: Ivy does not work on Turkish machines (IVY-65)
 - FIX: Ivy does not handle multiple version dependencies in maven2 poms correctly (IVY-494)
 - FIX: pom parser doesn't necessarily processes all important information (IVY-524)
 - FIX: <info> element of Ivy file in cache is not updated when using namespaces (IVY-516)

Modified: incubator/ivy/core/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/build.xml?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/build.xml (original)
+++ incubator/ivy/core/trunk/build.xml Thu Jun 14 12:36:46 2007
@@ -380,6 +380,11 @@
         	</classpath>
             <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" />
             <jvmarg value="-Demma.coverage.out.merge=true" />
+        	
+        	<!-- Added this to test IVY-65 -->
+            <jvmarg value="-Duser.region=TR" />
+            <jvmarg value="-Duser.language=tr" />
+        	
 			<formatter type="xml"/>
 			<batchtest todir="${test.xml.dir}">
     		    <fileset refid="test.fileset" />

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java Thu Jun 14 12:36:46 2007
@@ -20,6 +20,7 @@
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Locale;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.IvyContext;
@@ -194,7 +195,7 @@
 
     protected Date getPubDate(String date, Date def) {
         if (date != null) {
-            if ("now".equalsIgnoreCase(date)) {
+            if ("now".equals(date.toLowerCase(Locale.US))) {
                 return new Date();
             }
             try {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java Thu Jun 14 12:36:46 2007
@@ -19,6 +19,7 @@
 
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.ivy.core.IvyContext;
@@ -100,8 +101,8 @@
                 }
                 // both are strings, we compare them taking into account special meaning
                 Map specialMeanings = getSpecialMeanings();
-                Integer sm1 = (Integer) specialMeanings.get(parts1[i].toLowerCase());
-                Integer sm2 = (Integer) specialMeanings.get(parts2[i].toLowerCase());
+                Integer sm1 = (Integer) specialMeanings.get(parts1[i].toLowerCase(Locale.US));
+                Integer sm2 = (Integer) specialMeanings.get(parts2[i].toLowerCase(Locale.US));
                 if (sm1 != null) {
                     sm2 = sm2 == null ? new Integer(0) : sm2;
                     return sm1.compareTo(sm2);
@@ -171,7 +172,7 @@
 
     public void addConfiguredSpecialMeaning(SpecialMeaning meaning) {
         meaning.validate();
-        getSpecialMeanings().put(meaning.getName().toLowerCase(), meaning.getValue());
+        getSpecialMeanings().put(meaning.getName().toLowerCase(Locale.US), meaning.getValue());
     }
 
     public synchronized Map getSpecialMeanings() {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java Thu Jun 14 12:36:46 2007
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Locale;
 
 import org.apache.ivy.plugins.repository.AbstractRepository;
 import org.apache.ivy.util.Message;
@@ -91,7 +92,7 @@
     private URI parseURI(String source) {
         try {
             URI uri = new URI(source);
-            if (uri.getScheme() != null && !uri.getScheme().equalsIgnoreCase(getRepositoryScheme()))
+            if (uri.getScheme() != null && !uri.getScheme().toLowerCase(Locale.US).equals(getRepositoryScheme().toLowerCase(Locale.US)))
                 throw new URISyntaxException(source, "Wrong scheme in URI. Expected "
                         + getRepositoryScheme() + " as scheme!");
             if (uri.getHost() == null && getHost() == null)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java Thu Jun 14 12:36:46 2007
@@ -20,6 +20,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.ivy.core.IvyContext;
@@ -176,7 +177,7 @@
         String portToUse = "22";
         if (port != -1 && port != 22)
             portToUse = Integer.toString(port);
-        return user.toLowerCase().trim() + "@" + host.toLowerCase().trim() + ":" + portToUse;
+        return user.toLowerCase(Locale.US).trim() + "@" + host.toLowerCase(Locale.US).trim() + ":" + portToUse;
     }
 
     /**

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java Thu Jun 14 12:36:46 2007
@@ -26,6 +26,7 @@
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 public class ChecksumHelper {
@@ -51,7 +52,7 @@
      */
     public static void check(File dest, File checksumFile, String algorithm) throws IOException {
         String csFileContent = FileUtil.readEntirely(
-            new BufferedReader(new FileReader(checksumFile))).trim().toLowerCase();
+            new BufferedReader(new FileReader(checksumFile))).trim().toLowerCase(Locale.US);
         String expected;
         int spaceIndex = csFileContent.indexOf(' ');
         if (spaceIndex != -1) {
@@ -60,7 +61,7 @@
             expected = csFileContent;
         }
 
-        String computed = computeAsString(dest, algorithm).trim().toLowerCase();
+        String computed = computeAsString(dest, algorithm).trim().toLowerCase(Locale.US);
         if (!expected.equals(computed)) {
             throw new IOException("invalid " + algorithm + ": expected=" + expected + " computed="
                     + computed);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java Thu Jun 14 12:36:46 2007
@@ -17,6 +17,8 @@
  */
 package org.apache.ivy.util;
 
+import java.util.Locale;
+
 /**
  * Convenient class used only for uncapitalization Usually use commons lang but here we do not want
  * to have such a dependency for only one feature
@@ -27,9 +29,9 @@
             return string;
         }
         if (string.length() == 1) {
-            return string.toLowerCase();
+            return string.toLowerCase(Locale.US);
         }
-        return string.substring(0, 1).toLowerCase() + string.substring(1);
+        return string.substring(0, 1).toLowerCase(Locale.US) + string.substring(1);
     }
 
     /**

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java Thu Jun 14 12:36:46 2007
@@ -23,6 +23,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -137,7 +138,7 @@
             int dotIndex = text.indexOf('.');
 
             if (((dotIndex != -1) && !href.startsWith(text.substring(0, dotIndex)))
-                    || ((dotIndex == -1) && !href.equalsIgnoreCase(text))) {
+                    || ((dotIndex == -1) && !href.toLowerCase(Locale.US).equals(text.toLowerCase(Locale.US)))) {
                 // the href and the text do not "match"
                 continue;
             }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntBuildTriggerTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntBuildTriggerTest.java?view=diff&rev=547374&r1=547373&r2=547374
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntBuildTriggerTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntBuildTriggerTest.java Thu Jun 14 12:36:46 2007
@@ -18,6 +18,7 @@
 package org.apache.ivy.ant;
 
 import java.io.File;
+import java.util.Locale;
 
 import junit.framework.TestCase;
 
@@ -26,6 +27,9 @@
 import org.apache.ivy.util.FileUtil;
 
 public class AntBuildTriggerTest extends TestCase {
+    public void testLocale() {
+        assertEquals(Locale.getDefault().getCountry(), "TR");
+    }
     public void test() throws Exception {
         assertFalse(new File("test/triggers/ant-build/A/A.jar").exists());