DO NOT REPLY [Bug 48414] Use of Class.forName may not work well in osgi environment

2010-01-16 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48414

--- Comment #6 from david jencks  2010-01-16 00:28:28 UTC 
---
IIRC there were two objections to the patch on the dev list:
1. it doesn't cover all uses of Class.forName()
2. it uses the per-web-app InstanceManager to create the system listeners for a
web app rather than a system-wide object
and it was suggested that injecting a system-wide classloader for reflective
class loading would be a good solution.

I'm willing to work on solving (1) and (2) through something like a system-wide
instance manager, but not through direct use of a classloader.  If the
developers insist on a classloader I'd suggest closing this as "wont' fix"

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899916 - /tomcat/trunk/java/org/apache/el/lang/ELSupport.java

2010-01-16 Thread markt
Author: markt
Date: Sat Jan 16 10:37:31 2010
New Revision: 899916

URL: http://svn.apache.org/viewvc?rev=899916&view=rev
Log:
TCK failure. Wrong exception on failure.

Modified:
tomcat/trunk/java/org/apache/el/lang/ELSupport.java

Modified: tomcat/trunk/java/org/apache/el/lang/ELSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELSupport.java?rev=899916&r1=899915&r2=899916&view=diff
==
--- tomcat/trunk/java/org/apache/el/lang/ELSupport.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ELSupport.java Sat Jan 16 10:37:31 2010
@@ -185,7 +185,14 @@
 if (obj.getClass().isEnum()) {
 return (Enum) obj;
 }
-return Enum.valueOf(type, obj.toString());
+Enum result;
+try {
+ result = Enum.valueOf(type, obj.toString());
+} catch (IllegalArgumentException iae) {
+throw new ELException(MessageFactory.get("error.convert",
+obj, obj.getClass(), type));
+}
+return result;
 }
 
 /**



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899918 - /tomcat/trunk/test/org/apache/el/lang/TestELSupport.java

2010-01-16 Thread markt
Author: markt
Date: Sat Jan 16 10:49:25 2010
New Revision: 899918

URL: http://svn.apache.org/viewvc?rev=899918&view=rev
Log:
Add some test cases for Enum to Enum coercion

Modified:
tomcat/trunk/test/org/apache/el/lang/TestELSupport.java

Modified: tomcat/trunk/test/org/apache/el/lang/TestELSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/lang/TestELSupport.java?rev=899918&r1=899917&r2=899918&view=diff
==
--- tomcat/trunk/test/org/apache/el/lang/TestELSupport.java (original)
+++ tomcat/trunk/test/org/apache/el/lang/TestELSupport.java Sat Jan 16 10:49:25 
2010
@@ -19,6 +19,8 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
+import javax.el.ELException;
+
 import junit.framework.TestCase;
 
 public class TestELSupport extends TestCase {
@@ -66,8 +68,51 @@
 Object output = ELSupport.coerceToType(null, Number.class);
 assertEquals(Long.valueOf(0), output);
 }
+
+public void testCoerceEnumAToEnumA() {
+Object output = null;
+try {
+output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumA.class);
+} finally {
+assertEquals(TestEnumA.VALA1, output);
+}
+}
+
+public void testCoerceEnumAToEnumB() {
+Object output = null;
+try {
+output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumB.class);
+} catch (ELException ele) {
+// Ignore
+}
+assertNull(output);
+}
+
+public void testCoerceEnumAToEnumC() {
+Object output = null;
+try {
+output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumC.class);
+} finally {
+assertEquals(TestEnumC.VALA1, output);
+}
+}
 
 private static void testIsSame(Object value) {
 assertEquals(value, ELSupport.coerceToNumber(value, value.getClass()));
 }
+
+private static enum TestEnumA {
+VALA1,
+VALA2
+}
+private static enum TestEnumB {
+VALB1,
+VALB2
+}
+private static enum TestEnumC {
+VALA1,
+VALA2,
+VALB1,
+VALB2
+}
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899919 - /tomcat/trunk/java/org/apache/el/lang/ELSupport.java

2010-01-16 Thread markt
Author: markt
Date: Sat Jan 16 10:50:12 2010
New Revision: 899919

URL: http://svn.apache.org/viewvc?rev=899919&view=rev
Log:
Fix bug in Enum to Enum coercion spotted during code review

Modified:
tomcat/trunk/java/org/apache/el/lang/ELSupport.java

Modified: tomcat/trunk/java/org/apache/el/lang/ELSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELSupport.java?rev=899919&r1=899918&r2=899919&view=diff
==
--- tomcat/trunk/java/org/apache/el/lang/ELSupport.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ELSupport.java Sat Jan 16 10:50:12 2010
@@ -178,11 +178,11 @@
  * @param type
  * @return
  */
-public final static Enum coerceToEnum(final Object obj, Class type) {
+public final static Enum coerceToEnum(final Object obj, Class type) {
 if (obj == null || "".equals(obj)) {
 return null;
 }
-if (obj.getClass().isEnum()) {
+if (type.isAssignableFrom(obj.getClass())) {
 return (Enum) obj;
 }
 Enum result;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899935 - in /tomcat/trunk/java/org/apache/el/parser: AstIdentifier.java AstValue.java

2010-01-16 Thread markt
Author: markt
Date: Sat Jan 16 12:57:55 2010
New Revision: 899935

URL: http://svn.apache.org/viewvc?rev=899935&view=rev
Log:
TCK failure: Must check to see if property is resolved and throw exception if 
not.

Modified:
tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java
tomcat/trunk/java/org/apache/el/parser/AstValue.java

Modified: tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java?rev=899935&r1=899934&r2=899935&view=diff
==
--- tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstIdentifier.java Sat Jan 16 
12:57:55 2010
@@ -22,10 +22,12 @@
 import javax.el.MethodExpression;
 import javax.el.MethodInfo;
 import javax.el.MethodNotFoundException;
+import javax.el.PropertyNotFoundException;
 import javax.el.ValueExpression;
 import javax.el.VariableMapper;
 
 import org.apache.el.lang.EvaluationContext;
+import org.apache.el.util.MessageFactory;
 
 
 /**
@@ -47,7 +49,12 @@
 }
 }
 ctx.setPropertyResolved(false);
-return ctx.getELResolver().getType(ctx, null, this.image);
+Class result = ctx.getELResolver().getType(ctx, null, this.image);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled.null", this.image));
+}
+return result;
 }
 
 @Override
@@ -60,7 +67,12 @@
 }
 }
 ctx.setPropertyResolved(false);
-return ctx.getELResolver().getValue(ctx, null, this.image);
+Object result = ctx.getELResolver().getValue(ctx, null, this.image);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled.null", this.image));
+}
+return result;
 }
 
 @Override
@@ -73,7 +85,12 @@
 }
 }
 ctx.setPropertyResolved(false);
-return ctx.getELResolver().isReadOnly(ctx, null, this.image);
+boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled.null", this.image));
+}
+return result;
 }
 
 @Override
@@ -89,6 +106,10 @@
 }
 ctx.setPropertyResolved(false);
 ctx.getELResolver().setValue(ctx, null, this.image, value);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled.null", this.image));
+}
 }
 
 @Override

Modified: tomcat/trunk/java/org/apache/el/parser/AstValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstValue.java?rev=899935&r1=899934&r2=899935&view=diff
==
--- tomcat/trunk/java/org/apache/el/parser/AstValue.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstValue.java Sat Jan 16 12:57:55 
2010
@@ -57,7 +57,12 @@
 public Class getType(EvaluationContext ctx) throws ELException {
 Target t = getTarget(ctx);
 ctx.setPropertyResolved(false);
-return ctx.getELResolver().getType(ctx, t.base, t.property);
+Class result = ctx.getELResolver().getType(ctx, t.base, t.property);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled", t.base, t.property));  
  
+}
+return result;
 }
 
 private final Target getTarget(EvaluationContext ctx) throws ELException {
@@ -141,6 +146,10 @@
 i++;
 }
 }
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled", base, suffix));
+}
 return base;
 }
 
@@ -148,7 +157,13 @@
 public boolean isReadOnly(EvaluationContext ctx) throws ELException {
 Target t = getTarget(ctx);
 ctx.setPropertyResolved(false);
-return ctx.getELResolver().isReadOnly(ctx, t.base, t.property);
+boolean result =
+ctx.getELResolver().isReadOnly(ctx, t.base, t.property);
+if (!ctx.isPropertyResolved()) {
+throw new PropertyNotFoundException(MessageFactory.get(
+"error.resolver.unhandled", t.base, t.property));  
  
+}
+return result;
 }
 
 @Override
@@ -167,6 +182,10 @@
 } else {
 resolver.setValue(ctx, t.base, t.property, value);
 }
+if (!ctx.isPropertyResolved()) {
+ 

svn commit: r899942 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-01-16 Thread kkolinko
Author: kkolinko
Date: Sat Jan 16 13:09:44 2010
New Revision: 899942

URL: http://svn.apache.org/viewvc?rev=899942&view=rev
Log:
votes

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=899942&r1=899941&r2=899942&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Jan 16 13:09:44 2010
@@ -120,18 +120,25 @@
  
  
 +++ 
- +1: jfclere, markt
+ +1: jfclere, markt, kkolinko
  -1:
 
 * Add missing file extension to line-ending conversions for src distros
   http://svn.apache.org/viewvc?rev=899284&view=rev
-  +1: markt,jfclere
+  +1: markt,jfclere,kkolinko
   -1: 
 
 * distributions should have windows line endings
   http://svn.apache.org/viewvc?rev=899348&view=rev
-  +1: markt, jfclere
+  +1: markt, jfclere, kkolinko
   -1: 
+   kkolinko:
+ 1. "installer" target has to be fixed as well to use windows EOLs. 
+   e.g. conf/ files installed by apache-tomcat-6.0.23.exe all have LF EOLs.
+   Maybe create a patternset, e.g. "dist.files".
+ 2. "package-deployer-zip" target would better have EOLs conversion,
+   like "package-deployer-tgz" has.
+ Neither of those is a show-stopper.
 
 * Fix TCK failures with security manager due to fix for 47774
   http://svn.apache.org/viewvc?rev=899420&view=rev



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Suggestion for handling LF/CRLF EOL conversions.

2010-01-16 Thread sebb
Suggestion for handling LF/CRLF EOL conversions.

Some files always need to have the same EOL, for example Windows .BAT
and .CMD  files always need CRLF. AFAIK, shell scripts always need LF.

For such files, set the appropriate svn:eol-style property, so
checkouts will always have the correct EOL. Yes, this may make
editting the files a bit awkward for some - tough.

For files that need to vary between releases - for example README.txt
- you can use an Ant patternset to process them. You can even check
whether the target archive is for the same EOL-style as the host, and
skip conversion for such cases.

Just a thought.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899949 - in /tomcat/trunk/java/org/apache/el: ValueExpressionImpl.java parser/SimpleNode.java

2010-01-16 Thread markt
Author: markt
Date: Sat Jan 16 13:54:04 2010
New Revision: 899949

URL: http://svn.apache.org/viewvc?rev=899949&view=rev
Log:
TCK failure: Can't use the string representation to test for equality as 
whitespace must be ignored. Use the parsed nodes instead.

Modified:
tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
tomcat/trunk/java/org/apache/el/parser/SimpleNode.java

Modified: tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java?rev=899949&r1=899948&r2=899949&view=diff
==
--- tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java Sat Jan 16 
13:54:04 2010
@@ -203,7 +203,7 @@
  */
 @Override
 public int hashCode() {
-return this.expr.hashCode();
+return this.getNode().hashCode();
 }
 
 /*

Modified: tomcat/trunk/java/org/apache/el/parser/SimpleNode.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/SimpleNode.java?rev=899949&r1=899948&r2=899949&view=diff
==
--- tomcat/trunk/java/org/apache/el/parser/SimpleNode.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/SimpleNode.java Sat Jan 16 13:54:04 
2010
@@ -18,6 +18,8 @@
 
 package org.apache.el.parser;
 
+import java.util.Arrays;
+
 import javax.el.ELException;
 import javax.el.MethodInfo;
 import javax.el.PropertyNotWritableException;
@@ -164,6 +166,45 @@
 throw new UnsupportedOperationException();
 }
 
+
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + Arrays.hashCode(children);
+result = prime * result + id;
+result = prime * result + ((image == null) ? 0 : image.hashCode());
+return result;
+}
+
+@Override
+public boolean equals(Object obj) {
+if (this == obj) {
+return true;
+}
+if (obj == null) {
+return false;
+}
+if (!(obj instanceof SimpleNode)) {
+return false;
+}
+SimpleNode other = (SimpleNode) obj;
+if (!Arrays.equals(children, other.children)) {
+return false;
+}
+if (id != other.id) {
+return false;
+}
+if (image == null) {
+if (other.image != null) {
+return false;
+}
+} else if (!image.equals(other.image)) {
+return false;
+}
+return true;
+}
+
 /**
  * @since EL 2.2
  */



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r899949 - in /tomcat/trunk/java/org/apache/el: ValueExpressionImpl.java parser/SimpleNode.java

2010-01-16 Thread Mark Thomas
On 16/01/2010 13:54, ma...@apache.org wrote:
> Author: markt
> Date: Sat Jan 16 13:54:04 2010
> New Revision: 899949
> 
> URL: http://svn.apache.org/viewvc?rev=899949&view=rev
> Log:
> TCK failure:...

And with that commit the EL 2.2 TCK passes as well.

"Just" the remainder of the Servlet 3.0 changes to implement and the
Servlet 3.0 TCK to pass :)

Mark



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r899959 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-01-16 Thread kkolinko
Author: kkolinko
Date: Sat Jan 16 14:15:21 2010
New Revision: 899959

URL: http://svn.apache.org/viewvc?rev=899959&view=rev
Log:
vote

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=899959&r1=899958&r2=899959&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Jan 16 14:15:21 2010
@@ -142,5 +142,5 @@
 
 * Fix TCK failures with security manager due to fix for 47774
   http://svn.apache.org/viewvc?rev=899420&view=rev
-  +1: markt, jfclere
+  +1: markt, jfclere, kkolinko
   -1: 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r899380 - /tomcat/trunk/dist.xml

2010-01-16 Thread Konstantin Kolinko
2010/1/14  :
> Author: markt
> Date: Thu Jan 14 19:48:41 2010
> New Revision: 899380
>
> URL: http://svn.apache.org/viewvc?rev=899380&view=rev
> Log:
> Skipping installer shouldn't break package-winzip target
>
> Modified:
>    tomcat/trunk/dist.xml
>

I think that all content of the new "win-prepare" target (added in
this rev) belongs to the existing "dist-static" target.

I wonder, why none of the "package-" targets have explicit
dependencies on "dist-" targets.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r900017 - /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java

2010-01-16 Thread kkolinko
Author: kkolinko
Date: Sat Jan 16 20:10:58 2010
New Revision: 900017

URL: http://svn.apache.org/viewvc?rev=900017&view=rev
Log:
Followup to r899796
Removed TODO markers, copied JavaDoc from the parent class

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java?rev=900017&r1=900016&r2=900017&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/XADataSource.java
 Sat Jan 16 20:10:58 2010
@@ -19,14 +19,19 @@
 
 public class XADataSource extends DataSource implements javax.sql.XADataSource 
{
 
+/**
+ * Constructor for reflection only. A default set of pool properties will 
be created.
+ */
 public XADataSource() {
 super();
-// TODO Auto-generated constructor stub
 }
 
+/**
+ * Constructs a DataSource object wrapping a connection
+ * @param poolProperties
+ */
 public XADataSource(PoolConfiguration poolProperties) {
 super(poolProperties);
-// TODO Auto-generated constructor stub
 }
 
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r900025 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-01-16 Thread kkolinko
Author: kkolinko
Date: Sat Jan 16 21:07:51 2010
New Revision: 900025

URL: http://svn.apache.org/viewvc?rev=900025&view=rev
Log:
proposal

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=900025&r1=900024&r2=900025&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Jan 16 21:07:51 2010
@@ -144,3 +144,9 @@
   http://svn.apache.org/viewvc?rev=899420&view=rev
   +1: markt, jfclere, kkolinko
   -1: 
+
+* Remove @Deprecated annotations from javax.servlet.jsp.JspContext
+  Part of http://svn.apache.org/viewvc?rev=899635&view=rev
+  
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/JspContext.java?view=diff&r1=899634&r2=899635&pathrev=899635
+  +1: kkolinko
+  -1:



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org