harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r438345 [2/2] - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/
Date Wed, 30 Aug 2006 04:10:38 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java
Tue Aug 29 21:10:37 2006
@@ -111,7 +111,8 @@
 	 * @return a String containing information about the exception.
 	 * @see java.lang.Throwable#getMessage()
 	 */
-	public String getMessage() {
+	@Override
+    public String getMessage() {
 		String reason = super.getMessage();
 
 		if (index != -1) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
Tue Aug 29 21:10:37 2006
@@ -30,7 +30,6 @@
  * wide web as specified by RFC 1738.
  * 
  */
-
 public final class URL implements java.io.Serializable {
 	private static final long serialVersionUID = -7627629688361524110L;
 
@@ -510,7 +509,8 @@
 	 * 
 	 * @see #hashCode
 	 */
-	public boolean equals(Object o) {
+	@Override
+    public boolean equals(Object o) {
 		if (o == null) {
             return false;
         }
@@ -540,7 +540,8 @@
 	 * 
 	 * @return the hashcode for hashtable indexing
 	 */
-	public int hashCode() {
+	@Override
+    public int hashCode() {
 		if (hashCode == 0) {
             hashCode = strmHandler.hashCode(this);
         }
@@ -700,7 +701,8 @@
 	 * 
 	 * @return a printable representation for the receiver.
 	 */
-	public String toString() {
+	@Override
+    public String toString() {
 		return toExternalForm();
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
Tue Aug 29 21:10:37 2006
@@ -43,7 +43,7 @@
 
 	private String contentType;
 
-	private static boolean defaultAllowUserInteraction = false;
+	private static boolean defaultAllowUserInteraction;
 
 	private static boolean defaultUseCaches = true;
 
@@ -55,9 +55,9 @@
 
 	protected boolean useCaches = defaultUseCaches;
 
-	protected boolean connected = false;
+	protected boolean connected;
 
-	protected boolean doOutput = false;
+	protected boolean doOutput;
 
 	protected boolean doInput = true;
 
@@ -329,7 +329,8 @@
 	 * 
 	 * @deprecated Use getRequestProperty().
 	 */
-	public static String getDefaultRequestProperty(String field) {
+	@Deprecated
+    public static String getDefaultRequestProperty(String field) {
 		return null;
 	}
 
@@ -819,7 +820,8 @@
 	 * 
 	 * @deprecated Use getRequestProperty().
 	 */
-	public static void setDefaultRequestProperty(String field, String value) {
+	@Deprecated
+    public static void setDefaultRequestProperty(String field, String value) {
 	}
 
 	/**
@@ -1020,7 +1022,8 @@
 	 * @see #getURL
 	 * @see #URLConnection(URL)
 	 */
-	public String toString() {
+	@Override
+    public String toString() {
 		return getClass().getName() + ":" + url.toString();
 	}
 
@@ -1032,7 +1035,8 @@
 		 * 
 		 * @see java.net.ContentHandler#getContent(java.net.URLConnection)
 		 */
-		public Object getContent(URLConnection u) throws IOException {
+		@Override
+        public Object getContent(URLConnection u) throws IOException {
 			return u.getInputStream();
 		}
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLDecoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLDecoder.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLDecoder.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLDecoder.java
Tue Aug 29 21:10:37 2006
@@ -44,7 +44,8 @@
 	 * 
 	 * @deprecated use URLDecoder#decode(String, String) instead
 	 */
-	public static String decode(String s) {
+	@Deprecated
+    public static String decode(String s) {
 		return Util.decode(s, true);
 	}
 
@@ -83,27 +84,30 @@
 		ByteArrayOutputStream out = new ByteArrayOutputStream();
 		for (int i = 0; i < s.length();) {
 			char c = s.charAt(i);
-			if (c == '+')
-				result.append(' ');
-			else if (c == '%') {
+			if (c == '+') {
+                result.append(' ');
+            } else if (c == '%') {
 				out.reset();
 				do {
-					if (i + 2 >= s.length())
-						throw new IllegalArgumentException(Msg.getString(
+					if (i + 2 >= s.length()) {
+                        throw new IllegalArgumentException(Msg.getString(
 								"K01fe", i));
+                    }
 					int d1 = Character.digit(s.charAt(i + 1), 16);
 					int d2 = Character.digit(s.charAt(i + 2), 16);
-					if (d1 == -1 || d2 == -1)
-						throw new IllegalArgumentException(Msg.getString(
+					if (d1 == -1 || d2 == -1) {
+                        throw new IllegalArgumentException(Msg.getString(
 								"K01ff", s.substring(i, i + 3), String
 										.valueOf(i)));
+                    }
 					out.write((byte) ((d1 << 4) + d2));
 					i += 3;
 				} while (i < s.length() && s.charAt(i) == '%');
 				result.append(out.toString(enc));
 				continue;
-			} else
-				result.append(c);
+			} else {
+                result.append(c);
+            }
 			i++;
 		}
 		return result.toString();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
Tue Aug 29 21:10:37 2006
@@ -51,16 +51,17 @@
 	 * 
 	 * @deprecated use URLEncoder#encode(String, String) instead
 	 */
-	public static String encode(String s) {
+	@Deprecated
+    public static String encode(String s) {
 		StringBuffer buf = new StringBuffer();
 		for (int i = 0; i < s.length(); i++) {
 			char ch = s.charAt(i);
 			if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
-					|| (ch >= '0' && ch <= '9') || ".-*_".indexOf(ch) > -1)
-				buf.append(ch);
-			else if (ch == ' ')
-				buf.append('+');
-			else {
+					|| (ch >= '0' && ch <= '9') || ".-*_".indexOf(ch) > -1) {
+                buf.append(ch);
+            } else if (ch == ' ') {
+                buf.append('+');
+            } else {
 				byte[] bytes = new String(new char[] { ch }).getBytes();
 				for (int j = 0; j < bytes.length; j++) {
 					buf.append('%');

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=438345&r1=438344&r2=438345&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLStreamHandler.java
Tue Aug 29 21:10:37 2006
@@ -83,11 +83,13 @@
 	 * @see URL
 	 */
 	protected void parseURL(URL u, String str, int start, int end) {
-		if (end < start)
-			return;
+		if (end < start) {
+            return;
+        }
 		String parseString = "";
-		if (start < end)
-			parseString = str.substring(start, end);
+		if (start < end) {
+            parseString = str.substring(start, end);
+        }
 		end -= start;
 		int fileIdx = 0;
 
@@ -111,8 +113,9 @@
 				file = "";
 			}
 			int hostEnd = fileIdx;
-			if (refIdx != -1 && refIdx < fileIdx)
-				hostEnd = refIdx;
+			if (refIdx != -1 && refIdx < fileIdx) {
+                hostEnd = refIdx;
+            }
 			int userIdx = parseString.lastIndexOf('@', hostEnd);
 			authority = parseString.substring(hostIdx, hostEnd);
 			if (userIdx > -1) {
@@ -141,78 +144,90 @@
 				}
 			}
 
-			if (portIdx == -1 || portIdx > fileIdx)
-				host = parseString.substring(hostIdx, hostEnd);
-			else {
+			if (portIdx == -1 || portIdx > fileIdx) {
+                host = parseString.substring(hostIdx, hostEnd);
+            } else {
 				host = parseString.substring(hostIdx, portIdx);
 				String portString = parseString.substring(portIdx + 1, hostEnd);
-				if (portString.length() == 0)
-					port = -1;
-				else
-					port = Integer.parseInt(portString);
+				if (portString.length() == 0) {
+                    port = -1;
+                } else {
+                    port = Integer.parseInt(portString);
+                }
 			}
 		}
 
-		if (refIdx > -1)
-			ref = parseString.substring(refIdx + 1, end);
+		if (refIdx > -1) {
+            ref = parseString.substring(refIdx + 1, end);
+        }
 		int fileEnd = (refIdx == -1 ? end : refIdx);
 
 		int queryIdx = parseString.lastIndexOf('?', fileEnd);
 		if (queryIdx > -1) {
 			query = parseString.substring(queryIdx + 1, fileEnd);
 			// Don't inherit file if query is changed
-			if (queryIdx == 0 && file != null)
-				file = "/";
+			if (queryIdx == 0 && file != null) {
+                file = "/";
+            }
 			fileEnd = queryIdx;
 		} else
 		// Don't inherit query unless only the ref is changed
-		if (refIdx != 0)
-			query = null;
+		if (refIdx != 0) {
+            query = null;
+        }
 
 		boolean canonicalize = false;
 		if (fileIdx > -1) {
-			if (fileIdx < end && parseString.charAt(fileIdx) == '/')
-				file = parseString.substring(fileIdx, fileEnd);
-			else if (fileEnd > fileIdx) {
-				if (file == null)
-					file = "";
-				else if (file.equals(""))
-					file = "/";
-				else if (file.startsWith("/"))
-					canonicalize = true;
+			if (fileIdx < end && parseString.charAt(fileIdx) == '/') {
+                file = parseString.substring(fileIdx, fileEnd);
+            } else if (fileEnd > fileIdx) {
+				if (file == null) {
+                    file = "";
+                } else if (file.equals("")) {
+                    file = "/";
+                } else if (file.startsWith("/")) {
+                    canonicalize = true;
+                }
 				int last = file.lastIndexOf('/') + 1;
-				if (last == 0)
-					file = parseString.substring(fileIdx, fileEnd);
-				else
-					file = file.substring(0, last)
+				if (last == 0) {
+                    file = parseString.substring(fileIdx, fileEnd);
+                } else {
+                    file = file.substring(0, last)
 							+ parseString.substring(fileIdx, fileEnd);
+                }
 			}
 		}
-		if (file == null)
-			file = "";
+		if (file == null) {
+            file = "";
+        }
 
-		if (host == null)
-			host = "";
+		if (host == null) {
+            host = "";
+        }
 
 		if (canonicalize) {
 			// modify file if there's any relative referencing
 			int dirIndex;
-			while ((dirIndex = file.indexOf("/./")) >= 0)
-				file = file.substring(0, dirIndex + 1)
+			while ((dirIndex = file.indexOf("/./")) >= 0) {
+                file = file.substring(0, dirIndex + 1)
 						+ file.substring(dirIndex + 3);
-			if (file.endsWith("/."))
-				file = file.substring(0, file.length() - 1);
+            }
+			if (file.endsWith("/.")) {
+                file = file.substring(0, file.length() - 1);
+            }
 			while ((dirIndex = file.indexOf("/../")) >= 0) {
 				if (dirIndex != 0) {
 					file = file.substring(0, file
 							.lastIndexOf('/', dirIndex - 1))
 							+ file.substring(dirIndex + 3);
-				} else
-					file = file.substring(dirIndex + 3);
+				} else {
+                    file = file.substring(dirIndex + 3);
+                }
 			}
-			if (file.endsWith("/..") && file.length() > 3)
-				file = file.substring(0, file.lastIndexOf('/',
+			if (file.endsWith("/..") && file.length() > 3) {
+                file = file.substring(0, file.lastIndexOf('/',
 						file.length() - 4) + 1);
+            }
 		}
 
 		setURL(u, u.getProtocol(), host, port, authority, userInfo, file,
@@ -240,10 +255,12 @@
 	 * @deprecated use setURL(URL, String String, int, String, String, String,
 	 *             String, String)
 	 */
-	protected void setURL(URL u, String protocol, String host, int port,
+	@Deprecated
+    protected void setURL(URL u, String protocol, String host, int port,
 			String file, String ref) {
-		if (this != u.strmHandler)
-			throw new SecurityException();
+		if (this != u.strmHandler) {
+            throw new SecurityException();
+        }
 		u.set(protocol, host, port, file, ref);
 	}
 
@@ -274,8 +291,9 @@
 	protected void setURL(URL u, String protocol, String host, int port,
 			String authority, String userInfo, String file, String query,
 			String ref) {
-		if (this != u.strmHandler)
-			throw new SecurityException();
+		if (this != u.strmHandler) {
+            throw new SecurityException();
+        }
 		u.set(protocol, host, port, authority, userInfo, file, query, ref);
 	}
 
@@ -326,11 +344,13 @@
 	 * @see #hashCode
 	 */
 	protected boolean equals(URL url1, URL url2) {
-		if (!sameFile(url1, url2))
-			return false;
+		if (!sameFile(url1, url2)) {
+            return false;
+        }
 		String s1 = url1.getRef(), s2 = url2.getRef();
-		if (s1 != s2 && (s1 == null || !s1.equals(s2)))
-			return false;
+		if (s1 != s2 && (s1 == null || !s1.equals(s2))) {
+            return false;
+        }
 		s1 = url1.getQuery();
 		s2 = url2.getQuery();
 		return s1 == s2 || (s1 != null && s1.equals(s2));
@@ -349,8 +369,9 @@
 	protected InetAddress getHostAddress(URL url) {
 		try {
 			String host = url.getHost();
-			if (host == null || host.length() == 0)
-				return null;
+			if (host == null || host.length() == 0) {
+                return null;
+            }
 			return InetAddress.getByName(host);
 		} catch (UnknownHostException e) {
 			return null;
@@ -396,21 +417,26 @@
 	protected boolean sameFile(URL url1, URL url2) {
 		String s1 = url1.getProtocol();
 		String s2 = url2.getProtocol();
-		if (s1 != s2 && (s1 == null || !s1.equals(s2)))
-			return false;
+		if (s1 != s2 && (s1 == null || !s1.equals(s2))) {
+            return false;
+        }
 
 		s1 = url1.getFile();
 		s2 = url2.getFile();
-		if (s1 != s2 && (s1 == null || !s1.equals(s2)))
-			return false;
-		if (!hostsEqual(url1, url2))
-			return false;
+		if (s1 != s2 && (s1 == null || !s1.equals(s2))) {
+            return false;
+        }
+		if (!hostsEqual(url1, url2)) {
+            return false;
+        }
 		int p1 = url1.getPort();
-		if (p1 == -1)
-			p1 = getDefaultPort();
+		if (p1 == -1) {
+            p1 = getDefaultPort();
+        }
 		int p2 = url2.getPort();
-		if (p2 == -1)
-			p2 = getDefaultPort();
+		if (p2 == -1) {
+            p2 = getDefaultPort();
+        }
 		return p1 == p2;
 	}
 }



Mime
View raw message