[OSM-dev] First JOSM patch

Sander Hoentjen sander at hoentjen.eu
Wed Apr 18 05:36:18 BST 2007


Hi,

in my attempt to compile JOSM with gcj I ran into the following. Every
time i had a combined username+:+password length of 2 mod 3
(2,5,8,11,14,..) I ran into an error, and the following seems to fix it
for me. Can this be applied or am I doing something terrible here?

Sander

P.S. this is my first java attempt made in 5 years or so, and the only
experience I have is from some simple school assignments. Please forgive
me my simple errors :)


Index: src/org/openstreetmap/josm/tools/Base64.java
===================================================================
--- src/org/openstreetmap/josm/tools/Base64.java        (revision 216)
+++ src/org/openstreetmap/josm/tools/Base64.java        (working copy)
@@ -11,7 +11,7 @@
                        String buf = s.substring(i*3, i*3+l);
             out.append(enc.charAt(buf.charAt(0)>>2));
             out.append(enc.charAt((buf.charAt(0) & 0x03) << 4 | (l==1?0:(buf.charAt(1) & 0xf0) >> 4)));
-            out.append(l>1?enc.charAt((buf.charAt(1) & 0x0f) << 2 | (buf.charAt(2) & 0xc0) >> 6):'=');
+            out.append(l>1?enc.charAt((buf.charAt(1) & 0x0f) << 2 | (l==2?0:(buf.charAt(2) & 0xc0) >> 6)):'=');
             out.append(l>2?enc.charAt(buf.charAt(2) & 0x3f):'=');
                }
                return out.toString();






More information about the dev mailing list