You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Bill Wigger (JIRA)" <ji...@apache.org> on 2010/01/18 17:14:54 UTC

[jira] Created: (OWB-238) Problem: Inner class Producer Method Injection fails

Problem: Inner class Producer Method Injection fails
----------------------------------------------------

                 Key: OWB-238
                 URL: https://issues.apache.org/jira/browse/OWB-238
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Injection and Lookup
    Affects Versions: M3
         Environment: Windows.  Eclipse running Jetty.
            Reporter: Bill Wigger
            Assignee: Gurkan Erdogdu
            Priority: Minor
             Fix For: M3


Problem: Inner class Producer Method Injection fails:

Injection:

Class Z:

	@Produces @Named("ProMethodNamed1") String methodN1() {
		return "Sucess from ProMethodNamed1";
	}


Inject Point in class Y, using an inner class of Xsimple:

	class Xsimple {
		public @Inject @Named("ProMethodNamed1") String sInject;
		public String getInner() {
			String s = sInject;
			return s;
		}
	}
	public String getTestParameterized4() {
		Xsimple inner = new Xsimple();
		String y = inner.getInner();
		
		if (y == null) {
			return ("Error: Injected String was null");
		}
		if (y.length() < 1) {
			return ("Error: Injected String was empty");
		}
		
		return y;
	}




Actual Result when "getTestParameterized4" is called from a JSP:
"Error: Injected String was null"

Desired Result:
"Sucess from ProMethodNamed1"


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OWB-238) Problem: Inner class Producer Method Injection fails

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gurkan Erdogdu resolved OWB-238.
--------------------------------

    Resolution: Invalid

1* JSR-299 does not support non-static inner classes (Look at specification 3.1.1)
2* You example is wrong! You are instantiating the Xsimple yourself. Container must instantiate instance instead of you therefore it injects fields.

I have committed example code.

https://svn.apache.org/repos/asf/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/InnerClassInjectStringProducerTest.java

> Problem: Inner class Producer Method Injection fails
> ----------------------------------------------------
>
>                 Key: OWB-238
>                 URL: https://issues.apache.org/jira/browse/OWB-238
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: M3
>         Environment: Windows.  Eclipse running Jetty.
>            Reporter: Bill Wigger
>            Assignee: Gurkan Erdogdu
>            Priority: Minor
>             Fix For: M3
>
>
> Problem: Inner class Producer Method Injection fails:
> Injection:
> Class Z:
> 	@Produces @Named("ProMethodNamed1") String methodN1() {
> 		return "Sucess from ProMethodNamed1";
> 	}
> Inject Point in class Y, using an inner class of Xsimple:
> 	class Xsimple {
> 		public @Inject @Named("ProMethodNamed1") String sInject;
> 		public String getInner() {
> 			String s = sInject;
> 			return s;
> 		}
> 	}
> 	public String getTestParameterized4() {
> 		Xsimple inner = new Xsimple();
> 		String y = inner.getInner();
> 		
> 		if (y == null) {
> 			return ("Error: Injected String was null");
> 		}
> 		if (y.length() < 1) {
> 			return ("Error: Injected String was empty");
> 		}
> 		
> 		return y;
> 	}
> Actual Result when "getTestParameterized4" is called from a JSP:
> "Error: Injected String was null"
> Desired Result:
> "Sucess from ProMethodNamed1"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OWB-238) Problem: Inner class Producer Method Injection fails

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gurkan Erdogdu closed OWB-238.
------------------------------


> Problem: Inner class Producer Method Injection fails
> ----------------------------------------------------
>
>                 Key: OWB-238
>                 URL: https://issues.apache.org/jira/browse/OWB-238
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: M3
>         Environment: Windows.  Eclipse running Jetty.
>            Reporter: Bill Wigger
>            Assignee: Gurkan Erdogdu
>            Priority: Minor
>             Fix For: M3
>
>
> Problem: Inner class Producer Method Injection fails:
> Injection:
> Class Z:
> 	@Produces @Named("ProMethodNamed1") String methodN1() {
> 		return "Sucess from ProMethodNamed1";
> 	}
> Inject Point in class Y, using an inner class of Xsimple:
> 	class Xsimple {
> 		public @Inject @Named("ProMethodNamed1") String sInject;
> 		public String getInner() {
> 			String s = sInject;
> 			return s;
> 		}
> 	}
> 	public String getTestParameterized4() {
> 		Xsimple inner = new Xsimple();
> 		String y = inner.getInner();
> 		
> 		if (y == null) {
> 			return ("Error: Injected String was null");
> 		}
> 		if (y.length() < 1) {
> 			return ("Error: Injected String was empty");
> 		}
> 		
> 		return y;
> 	}
> Actual Result when "getTestParameterized4" is called from a JSP:
> "Error: Injected String was null"
> Desired Result:
> "Sucess from ProMethodNamed1"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.