Is Java 2 version 1.4 beta compatable with C2 .
Nael Mohammad
Neomar, Inc.
[EMAIL PROTECTED]
415-403-7300 x314 (Work)
415-793-0609 (Mobile)
"When Wireless Means Business"
CONFIDENTIALITY NOTICE: This e-mail may contain confidential information
that is legally privileged. Do not read this e-mail if you are not the
intended recipient.
This e-mail transmission, and any documents, files or previous e-mail
messages attached to it may contain confidential information that is legally
privileged. If you are not the intended recipient, or a person responsible
for delivering it to the intended recipient, you are hereby notified that
any disclosure, copying, distribution or use of any of the information
contained in or attached to this transmission is STRICTLY PROHIBITED. If you
have received this transmission in error, please immediately notify us by
reply e-mail or by telephone at (415) 403-7300, and destroy the original
transmission and its attachments without reading or saving in any manner.
Thank you.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 7:16 AM
To: [EMAIL PROTECTED]
Subject: cvs commit: xml-cocoon2/src/org/apache/cocoon/components/source
URLSource.java
dims 01/07/13 07:16:27
Modified: src/org/apache/cocoon/components/source URLSource.java
Log:
Use Reflection to call getUserInfo - still keep compatability with
JDK1.2.2
Carsten,
Can you check if this works for you.
Thanks,
dims
Revision Changes Path
1.6 +21 -7
xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java
Index: URLSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java
,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- URLSource.java 2001/07/13 11:24:48 1.5
+++ URLSource.java 2001/07/13 14:16:21 1.6
@@ -15,6 +15,7 @@
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
+import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
import org.apache.avalon.framework.component.ComponentException;
@@ -31,7 +32,7 @@
* Description of a source which is described by an URL.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/07/13 11:24:48 $
+ * @version CVS $Revision: 1.6 $ $Date: 2001/07/13 14:16:21 $
*/
public final class URLSource
@@ -90,12 +91,11 @@
try {
if (this.connection == null) {
this.connection = this.url.openConnection();
- /* The following requires a jdk 1.3
- String userInfo = this.url.getUserInfo();
+ /* The following requires a jdk 1.3
*/
+ String userInfo = this.url.getUserInfo();
if (this.url.getProtocol().startsWith("http") ==
true && userInfo != null) {
this.connection.setRequestProperty("Authorization","Basic
"+this.encodeBASE64(userInfo));
}
- */
}
this.lastModificationDate =
this.connection.getLastModified();
this.contentLength =
this.connection.getContentLength();
@@ -136,15 +136,29 @@
} else {
if (this.connection == null) {
this.connection = this.url.openConnection();
- /* The following requires a jdk 1.3
- String userInfo = this.url.getUserInfo();
+ /* The following requires a jdk 1.3 */
+ String userInfo = getUserInfo(url);
if (this.url.getProtocol().startsWith("http") == true &&
userInfo != null) {
this.connection.setRequestProperty("Authorization","Basic
"+encodeBASE64(userInfo));
}
- */
}
return this.connection.getInputStream();
}
+ }
+
+ private String getUserInfo(URL url)
+ {
+ try {
+ //System.out.println(">>>> getUserInfo: " + url);
+ Class paramTypes[] = new Class[0];
+ Object params[] = new Object[0];
+ Method method =
URL.class.getMethod("getUserInfo",paramTypes);
+ return (String) method.invoke(url,params);
+ } catch (Exception e){
+ //System.out.println("Exception in getUserInfo (likely to
happen on JDK-1.2.2 and below):" + e);
+ //e.printStackTrace();
+ }
+ return null;
}
/**
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]