Author: remy.maucherat(a)jboss.com
Date: 2008-10-06 10:57:47 -0400 (Mon, 06 Oct 2008)
New Revision: 802
Modified:
trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/java/org/apache/coyote/ajp/AjpProcessor.java
trunk/java/org/apache/el/lang/ELSupport.java
trunk/webapps/docs/changelog.xml
Log:
- Nth ELSupport update ...
- Add cert chains support in AJP.
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2008-10-04 18:12:46 UTC (rev
801)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2008-10-06 14:57:47 UTC (rev
802)
@@ -542,19 +542,28 @@
new ByteArrayInputStream(certData.getBytes(),
certData.getStart(),
certData.getLength());
- // Fill the first element.
+ // Fill the elements.
try {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)
- cf.generateCertificate(bais);
- jsseCerts = new X509Certificate[1];
- jsseCerts[0] = cert;
- request.setAttribute(AprEndpoint.CERTIFICATE_KEY, jsseCerts);
+ while(bais.available() > 0) {
+ X509Certificate cert = (X509Certificate)
+ cf.generateCertificate(bais);
+ if(jsseCerts == null) {
+ jsseCerts = new X509Certificate[1];
+ jsseCerts[0] = cert;
+ } else {
+ X509Certificate [] temp = new
X509Certificate[jsseCerts.length+1];
+ System.arraycopy(jsseCerts,0,temp,0,jsseCerts.length);
+ temp[jsseCerts.length] = cert;
+ jsseCerts = temp;
+ }
+ }
} catch (java.security.cert.CertificateException e) {
log.error(sm.getString("ajpprocessor.certs.fail"), e);
return;
}
+ request.setAttribute(AprEndpoint.CERTIFICATE_KEY, jsseCerts);
}
} else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
Modified: trunk/java/org/apache/coyote/ajp/AjpProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2008-10-04 18:12:46 UTC (rev 801)
+++ trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2008-10-06 14:57:47 UTC (rev 802)
@@ -547,19 +547,28 @@
new ByteArrayInputStream(certData.getBytes(),
certData.getStart(),
certData.getLength());
- // Fill the first element.
+ // Fill the elements.
try {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)
- cf.generateCertificate(bais);
- jsseCerts = new X509Certificate[1];
- jsseCerts[0] = cert;
- request.setAttribute(JIoEndpoint.CERTIFICATE_KEY, jsseCerts);
+ while(bais.available() > 0) {
+ X509Certificate cert = (X509Certificate)
+ cf.generateCertificate(bais);
+ if(jsseCerts == null) {
+ jsseCerts = new X509Certificate[1];
+ jsseCerts[0] = cert;
+ } else {
+ X509Certificate [] temp = new
X509Certificate[jsseCerts.length+1];
+ System.arraycopy(jsseCerts,0,temp,0,jsseCerts.length);
+ temp[jsseCerts.length] = cert;
+ jsseCerts = temp;
+ }
+ }
} catch (java.security.cert.CertificateException e) {
log.error(sm.getString("ajpprocessor.certs.fail"), e);
return;
}
+ request.setAttribute(JIoEndpoint.CERTIFICATE_KEY, jsseCerts);
}
} else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
Modified: trunk/java/org/apache/el/lang/ELSupport.java
===================================================================
--- trunk/java/org/apache/el/lang/ELSupport.java 2008-10-04 18:12:46 UTC (rev 801)
+++ trunk/java/org/apache/el/lang/ELSupport.java 2008-10-06 14:57:47 UTC (rev 802)
@@ -137,7 +137,7 @@
return obj0.equals(obj1);
}
}
-
+
/**
* @param obj
* @param type
@@ -224,18 +224,18 @@
return ((BigDecimal) number).toBigInteger();
}
if (number instanceof BigInteger) {
- return new BigInteger(number.toString());
+ return number;
}
return BigInteger.valueOf(number.longValue());
}
if (BigDecimal.class.equals(type)) {
if (number instanceof BigDecimal) {
- return new BigDecimal(number.toString());
+ return number;
}
if (number instanceof BigInteger) {
return new BigDecimal((BigInteger) number);
}
- return new BigDecimal(number.doubleValue());
+ return new BigDecimal(number.toString());
}
if (Byte.TYPE == type || Byte.class.equals(type)) {
return new Byte(number.byteValue());
@@ -341,7 +341,7 @@
public final static Object coerceToType(final Object obj, final Class type)
throws IllegalArgumentException {
if (type == null || Object.class.equals(type) ||
- (obj != null && type.equals(obj.getClass()))) {
+ (obj != null && type.isAssignableFrom(obj.getClass()))) {
return obj;
}
if (String.class.equals(type)) {
@@ -356,9 +356,6 @@
if (Boolean.class.equals(type) || Boolean.TYPE == type) {
return coerceToBoolean(obj);
}
- if (obj != null && type.isAssignableFrom(obj.getClass())) {
- return obj;
- }
if (type.isEnum()) {
return coerceToEnum(obj, type);
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-10-04 18:12:46 UTC (rev 801)
+++ trunk/webapps/docs/changelog.xml 2008-10-06 14:57:47 UTC (rev 802)
@@ -73,6 +73,9 @@
<fix>
Remote date tool class, since it has sync issues. (markt, remm)
</fix>
+ <add>
+ Add AJP support for certificate chains. (billbarker)
+ </add>
</changelog>
</subsection>
<subsection name="Jasper">
@@ -97,6 +100,9 @@
<fix>
Ascii parsing bug. (markt)
</fix>
+ <fix>
+ Fix regression in Big* types handling. Patch provided by Nils Eckert. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Others">