You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Jeff Yu <je...@iona.com> on 2007/10/18 13:15:39 UTC

Re: svn commit: r585445 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Hi,

See one comment inline.

Thanks
Jeff

ulhasbhole@apache.org wrote:
> Author: ulhasbhole
> Date: Wed Oct 17 03:57:01 2007
> New Revision: 585445
>
> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
> Log:
> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
>
> Modified:
>     incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
>     incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java
>
> Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&r2=585445&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
> +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
> @@ -358,7 +358,7 @@
>              baseURI = url.getPath();
>              int idx = baseURI.lastIndexOf('/');
>              if (idx != -1) {
> -                baseURI = baseURI.substring(0, idx + 1);
> +                baseURI = baseURI.substring(0, idx);
>              }
>          }        
>          return baseURI;
>
> Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=585445&r1=585444&r2=585445&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java (original)
> +++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01 2007
> @@ -173,13 +173,21 @@
>          }
>      }
>  
> -    private synchronized void updateEndpointAddress(String addr) {
> +    private String removeTrailingSeparator(String addr) {
> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
> +            return addr.substring(0, addr.length() - 1);
> +        } else {
> +            return addr;
> +        }
> +    }
>   
I am not sure should the "addr" always be not null and not an empty 
string, but in the jca inbound case, the addr is an *Empty String*, and 
then I will get the below exception:

 java.lang.StringIndexOutOfBoundsException: String index out of range: -1

So I add a null check here * if (addr != null && !"".equals(addr) && 
addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we 
need a null check here?



> +    private synchronized String updateEndpointAddress(String addr) {
>          // only update the EndpointAddress if the base path is equal
>          // make sure we don't broke the get operation?parament query 
> -        String address = endpointInfo.getAddress();
> -        if (getBasePath(address).equals(getStem(getBasePath(addr)))) {
> +        String address = removeTrailingSeparator(endpointInfo.getAddress());
> +        if (getBasePath(address).equals(removeTrailingSeparator(getStem(getBasePath(addr))))) {
>              endpointInfo.setAddress(addr);
>          }
> +        return address;
>      }
>     
>      protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException {
> @@ -194,8 +202,9 @@
>          }
>          QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
>          
> -        if (null != req.getQueryString() && queryHandlerRegistry != null) {        
> -            String requestURL = req.getRequestURL() + "?" + req.getQueryString();
> +        if (null != req.getQueryString() && queryHandlerRegistry != null) {   
> +            String reqAddr = req.getRequestURL().toString();
> +            String requestURL =  reqAddr + "?" + req.getQueryString();
>              String pathInfo = req.getPathInfo();                     
>              for (QueryHandler qh : queryHandlerRegistry.getHandlers()) {
>                  boolean recognized =
> @@ -206,17 +215,21 @@
>                                                                         contextMatchOnExact())
>                      : qh.isRecognizedQuery(requestURL, pathInfo, endpointInfo);
>                  if (recognized) {
> -                    //replace the endpointInfo address with request url only for get wsdl           
> -                    updateEndpointAddress(req.getRequestURL().toString());   
> -                    resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> -                    try {
> -                        qh.writeResponse(requestURL, pathInfo, endpointInfo, resp.getOutputStream());
> -                    } catch (Exception ex) {
> -                        LOG.log(Level.WARNING, "writeResponse failed: ", ex);
> +                    //replace the endpointInfo address with request url only for get wsdl   
> +                    synchronized (endpointInfo) {
> +                        String oldAddress = updateEndpointAddress(reqAddr);   
> +                        resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> +                        try {
> +                            qh.writeResponse(requestURL, pathInfo, endpointInfo, resp.getOutputStream());
> +                        } catch (Exception ex) {
> +                            LOG.log(Level.WARNING, "writeResponse failed: ", ex);
> +                        }
> +                        endpointInfo.setAddress(oldAddress);
> +                        resp.getOutputStream().flush();                     
> +                        baseRequest.setHandled(true);
> +                        return;    
>                      }
> -                    resp.getOutputStream().flush();                     
> -                    baseRequest.setHandled(true);
> -                    return;
> +                    
>                  }
>              }
>          }
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java?rev=585445&r1=585444&r2=585445&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java Wed Oct 17 03:57:01 2007
> @@ -20,9 +20,12 @@
>  package org.apache.cxf.systest.factory_pattern;
>  
>  
> +import java.io.BufferedReader;
> +import java.io.InputStreamReader;
>  import java.lang.reflect.InvocationHandler;
>  import java.lang.reflect.Proxy;
>  import java.net.URL;
> +import java.net.URLConnection;
>  import java.util.HashMap;
>  import java.util.Map;
>  
> @@ -75,7 +78,7 @@
>          Map<String, String> props = new HashMap<String, String>();    
>          props.put("cxf.config.file", "org/apache/cxf/systest/factory_pattern/cxf.xml");
>          assertTrue("server did not launch correctly",
> -                   launchServer(Server.class, props, null));
> +                   launchServer(Server.class, props, null, false));
>      }
>  
>      
> @@ -124,5 +127,44 @@
>          firstChar = new URL(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT 
>                                  + "103?wsdl").openStream().read();
>          assertTrue("firstChar :" + String.valueOf(firstChar), firstChar == '<');
> +    }
> +    
> +    @Test
> +    public void testSoapAddressLocation() throws Exception {
> +        
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +                   checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20", 
> +                   checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "22", 
> +                   checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "22"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20", 
> +                   checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT + "20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +                   checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT));
> +    }
> +    
> +    private boolean checkSoapAddressLocation(String address) 
> +        throws Exception {
> +        URL url = new URL(address + "?wsdl");
> +        
> +        URLConnection urlConn = url.openConnection();
> +        BufferedReader br = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
> +        
> +        while (br.ready()) {
> +            String str = br.readLine();
> +//            System.out.println(str);
> +            if (str.contains("soap:address") 
> +                && str.contains("location=" + "\"" + address + "\"")) {
> +                System.out.println(str);
> +                return  true;
> +            }
> +        }
> +        return false;
>      }
>  }
>
>
>   

Re: Failure on trunk build

Posted by Ulhas Bhole <ul...@iona.com>.
Thanks Dan,

--Ulhas

Daniel Kulp wrote:
> I just committed a temporary fix for this.   Willem will need to look 
> into it more later, but it at least builds.
>
> Also, cruisecontrol was "stuck" due the svn checkout directory being 
> locked since Friday sometime.   I just ran a "svn cleanup" in there so 
> it should continue, but any builds since Friday would not have been on 
> the latest code despite it saying it was.
>
> Dan
>
>
>
> On Monday 22 October 2007, Ulhas Bhole wrote:
>   
>> Hi,
>>
>> Does anyone see the build failure[1] on new checkout?
>>
>> I have done a fresh checkout and run mvn install and getting following
>> build failure.
>> Here is the svn info output on trunk.
>>
>> Path: .
>> URL: http://svn.apache.org/repos/asf/incubator/cxf/trunk
>> Repository Root: http://svn.apache.org/repos/asf
>> Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
>> Revision: 587093
>> Node Kind: directory
>> Schedule: normal
>> Last Changed Author: ema
>> Last Changed Rev: 587024
>> Last Changed Date: 2007-10-22 08:52:27 +0100 (Mon, 22 Oct 2007)
>>
>>
>> Regards,
>>
>> Ulhas Bhole
>>
>> [1]
>>
>> [INFO]
>> ----------------------------------------------------------------------
>> ------ [INFO] Building Apache CXF Command Line Tools JavaTo WS
>> [INFO]    task-segment: [install]
>> [INFO]
>> ----------------------------------------------------------------------
>> ------ [INFO] [remote-resources:process {execution: default}]
>> [INFO] [resources:resources]
>> [INFO] Using default encoding to copy filtered resources.
>> [INFO] [compiler:compile]
>> [INFO] Compiling 33 source files to
>> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/target/class
>> es [INFO]
>> ----------------------------------------------------------------------
>> -- [ERROR] BUILD FAILURE
>> [INFO]
>> ----------------------------------------------------------------------
>> -- [INFO] Compilation failure
>>
>> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/jav
>> a/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/Si
>> mpleClientGenerator.java:[61,33] cannot find symbol
>> symbol  : variable CLIENT_CLASS
>> location: class org.apache.cxf.tools.common.ToolConstants
>>
>> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/jav
>> a/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/Si
>> mpleServerGenerator.java:[65,33] cannot find symbol
>> symbol  : variable SERVER_CLASS
>> location: class org.apache.cxf.tools.common.ToolConstants
>>
>> Jeff Yu wrote:
>>     
>>> Hi Ulhas,
>>>
>>> As I talked to Willem, it turns out that the "addr" is not the
>>> absoulte path url, it is the relative url.
>>> that's why we might have the "addr" as an empty string.
>>>
>>> Say I published an endpoint at the http://localhost:9999/GreeterBean
>>> address.
>>> at this scenario, the addr is an empty string. and if I execute the
>>> "http://localhost:9999/GreeterBean?wsdl" in the browser, I will get
>>> an exception.
>>> but if I execute the "http://localhost:9999/GreeterBean/?wsdl", I
>>> will get the correct wsdl.
>>>
>>> Thanks
>>> Jeff
>>>
>>> Bhole, Ulhas wrote:
>>>       
>>>> Hi Jeff,
>>>>
>>>> Thanks for pointing out the null check requirement. Can you please
>>>> explain how the wsdl or xsd will be queried in the scenario you
>>>> expecting the address to be null? In normal scenario the WSDL
>>>> query is <http-address>?wsdl how would it look like in case of
>>>> jca?
>>>>
>>>> Regards,
>>>>
>>>> Ulhas Bhole
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Jeff Yu [mailto:jeff.yu@iona.com]
>>>> Sent: 18 October 2007 12:16
>>>> To: cxf-dev@incubator.apache.org
>>>> Cc: cxf-commits@incubator.apache.org
>>>> Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
>>>> rt/core/src/main/java/org/apache/cxf/transport/http/
>>>> rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/ht
>>>> tp_jet ty/
>>>> systests/src/test/java/org/apache/cxf/systest/factory_pattern/
>>>>
>>>> Hi,
>>>>
>>>> See one comment inline.
>>>>
>>>> Thanks
>>>> Jeff
>>>>
>>>> ulhasbhole@apache.org wrote:
>>>>         
>>>>> Author: ulhasbhole
>>>>> Date: Wed Oct 17 03:57:01 2007
>>>>> New Revision: 585445
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
>>>>>           
>>> <http://svn.apache.org/viewvc?rev=585445&view=rev>
>>>
>>>       
>>>>> Log:
>>>>> * Fix for JIRA CXF-1113 related to WSDLPublish and Default
>>>>> Servant.
>>>>>
>>>>> Modified:
>>>>>           
>>>> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
>>>> /http/ WSDLQueryHandler.java
>>>>
>>>> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
>>>> che/cx f/transport/http_jetty/JettyHTTPDestination.java
>>>>
>>>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/
>>>> factor y_pattern/MultiplexHttpAddressClientServerTest.java
>>>>
>>>>         
>>>>> Modified:
>>>>>           
>>>> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
>>>> /http/ WSDLQueryHandler.java
>>>>
>>>>         
>>>>> URL:
>>>>>           
>>>> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/
>>>> java/o
>>>> rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=5
>>>> 85444& r2=585445&view=diff
>>>>
>>>> ==================================================================
>>>> ====== ======
>>>>
>>>>         
>>>>> ---
>>>>>           
>>>> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
>>>> /http/ WSDLQueryHandler.java (original)
>>>>
>>>>         
>>>>> +++
>>>>>           
>>>> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
>>>> /http/ WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
>>>>
>>>>         
>>>>> @@ -358,7 +358,7 @@
>>>>>              baseURI = url.getPath();
>>>>>              int idx = baseURI.lastIndexOf('/');
>>>>>              if (idx != -1) {
>>>>> -                baseURI = baseURI.substring(0, idx + 1);
>>>>> +                baseURI = baseURI.substring(0, idx);
>>>>>              }
>>>>>          }
>>>>>          return baseURI;
>>>>>
>>>>> Modified:
>>>>>           
>>>> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
>>>> che/cx f/transport/http_jetty/JettyHTTPDestination.java
>>>>
>>>>         
>>>>> URL:
>>>>>           
>>>> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/htt
>>>> p-jett
>>>> y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDesti
>>>> nation .java?rev=585445&r1=585444&r2=585445&view=diff
>>>>
>>>> ==================================================================
>>>> ====== ======
>>>>
>>>>         
>>>>> ---
>>>>>           
>>>> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
>>>> che/cx f/transport/http_jetty/JettyHTTPDestination.java (original)
>>>>
>>>>         
>>>>> +++
>>>>>           
>>>> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
>>>> che/cx f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17
>>>> 03:57:01 2007
>>>>
>>>>         
>>>>> @@ -173,13 +173,21 @@
>>>>>          }
>>>>>      }
>>>>>
>>>>> -    private synchronized void updateEndpointAddress(String addr)
>>>>> { +    private String removeTrailingSeparator(String addr) { +   
>>>>>     if (addr.lastIndexOf('/') == addr.length() - 1) { +          
>>>>>  return addr.substring(0, addr.length() - 1); +        } else {
>>>>> +            return addr;
>>>>> +        }
>>>>> +    }
>>>>>           
>>>> I am not sure should the "addr" always be not null and not an
>>>> empty string, but in the jca inbound case, the addr is an *Empty
>>>> String*, and then I will get the below exception:
>>>>
>>>>  java.lang.StringIndexOutOfBoundsException: String index out of
>>>> range: -1
>>>>
>>>> So I add a null check here * if (addr != null && !"".equals(addr)
>>>> && addr.lastIndexOf("/" == addr.length() - 1) * as a work
>>>> around... Do we need a null check here?
>>>>         
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
>> Ireland
>>     
>
>
>
>   

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Failure on trunk build

Posted by Daniel Kulp <dk...@apache.org>.

I just committed a temporary fix for this.   Willem will need to look 
into it more later, but it at least builds.

Also, cruisecontrol was "stuck" due the svn checkout directory being 
locked since Friday sometime.   I just ran a "svn cleanup" in there so 
it should continue, but any builds since Friday would not have been on 
the latest code despite it saying it was.

Dan



On Monday 22 October 2007, Ulhas Bhole wrote:
> Hi,
>
> Does anyone see the build failure[1] on new checkout?
>
> I have done a fresh checkout and run mvn install and getting following
> build failure.
> Here is the svn info output on trunk.
>
> Path: .
> URL: http://svn.apache.org/repos/asf/incubator/cxf/trunk
> Repository Root: http://svn.apache.org/repos/asf
> Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> Revision: 587093
> Node Kind: directory
> Schedule: normal
> Last Changed Author: ema
> Last Changed Rev: 587024
> Last Changed Date: 2007-10-22 08:52:27 +0100 (Mon, 22 Oct 2007)
>
>
> Regards,
>
> Ulhas Bhole
>
> [1]
>
> [INFO]
> ----------------------------------------------------------------------
>------ [INFO] Building Apache CXF Command Line Tools JavaTo WS
> [INFO]    task-segment: [install]
> [INFO]
> ----------------------------------------------------------------------
>------ [INFO] [remote-resources:process {execution: default}]
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 33 source files to
> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/target/class
>es [INFO]
> ----------------------------------------------------------------------
>-- [ERROR] BUILD FAILURE
> [INFO]
> ----------------------------------------------------------------------
>-- [INFO] Compilation failure
>
> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/jav
>a/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/Si
>mpleClientGenerator.java:[61,33] cannot find symbol
> symbol  : variable CLIENT_CLASS
> location: class org.apache.cxf.tools.common.ToolConstants
>
> /local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/jav
>a/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/Si
>mpleServerGenerator.java:[65,33] cannot find symbol
> symbol  : variable SERVER_CLASS
> location: class org.apache.cxf.tools.common.ToolConstants
>
> Jeff Yu wrote:
> > Hi Ulhas,
> >
> > As I talked to Willem, it turns out that the "addr" is not the
> > absoulte path url, it is the relative url.
> > that's why we might have the "addr" as an empty string.
> >
> > Say I published an endpoint at the http://localhost:9999/GreeterBean
> > address.
> > at this scenario, the addr is an empty string. and if I execute the
> > "http://localhost:9999/GreeterBean?wsdl" in the browser, I will get
> > an exception.
> > but if I execute the "http://localhost:9999/GreeterBean/?wsdl", I
> > will get the correct wsdl.
> >
> > Thanks
> > Jeff
> >
> > Bhole, Ulhas wrote:
> > > Hi Jeff,
> > >
> > > Thanks for pointing out the null check requirement. Can you please
> > > explain how the wsdl or xsd will be queried in the scenario you
> > > expecting the address to be null? In normal scenario the WSDL
> > > query is <http-address>?wsdl how would it look like in case of
> > > jca?
> > >
> > > Regards,
> > >
> > > Ulhas Bhole
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Jeff Yu [mailto:jeff.yu@iona.com]
> > > Sent: 18 October 2007 12:16
> > > To: cxf-dev@incubator.apache.org
> > > Cc: cxf-commits@incubator.apache.org
> > > Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
> > > rt/core/src/main/java/org/apache/cxf/transport/http/
> > > rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/ht
> > >tp_jet ty/
> > > systests/src/test/java/org/apache/cxf/systest/factory_pattern/
> > >
> > > Hi,
> > >
> > > See one comment inline.
> > >
> > > Thanks
> > > Jeff
> > >
> > > ulhasbhole@apache.org wrote:
> > >> Author: ulhasbhole
> > >> Date: Wed Oct 17 03:57:01 2007
> > >> New Revision: 585445
> > >>
> > >> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
> >
> > <http://svn.apache.org/viewvc?rev=585445&view=rev>
> >
> > >> Log:
> > >> * Fix for JIRA CXF-1113 related to WSDLPublish and Default
> > >> Servant.
> > >>
> > >> Modified:
> > >
> > > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
> > >/http/ WSDLQueryHandler.java
> > >
> > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
> > >che/cx f/transport/http_jetty/JettyHTTPDestination.java
> > >
> > > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/
> > >factor y_pattern/MultiplexHttpAddressClientServerTest.java
> > >
> > >> Modified:
> > >
> > > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
> > >/http/ WSDLQueryHandler.java
> > >
> > >> URL:
> > >
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/
> > >java/o
> > > rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=5
> > >85444& r2=585445&view=diff
> > >
> > > ==================================================================
> > >====== ======
> > >
> > >> ---
> > >
> > > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
> > >/http/ WSDLQueryHandler.java (original)
> > >
> > >> +++
> > >
> > > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport
> > >/http/ WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
> > >
> > >> @@ -358,7 +358,7 @@
> > >>              baseURI = url.getPath();
> > >>              int idx = baseURI.lastIndexOf('/');
> > >>              if (idx != -1) {
> > >> -                baseURI = baseURI.substring(0, idx + 1);
> > >> +                baseURI = baseURI.substring(0, idx);
> > >>              }
> > >>          }
> > >>          return baseURI;
> > >>
> > >> Modified:
> > >
> > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
> > >che/cx f/transport/http_jetty/JettyHTTPDestination.java
> > >
> > >> URL:
> > >
> > > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/htt
> > >p-jett
> > > y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDesti
> > >nation .java?rev=585445&r1=585444&r2=585445&view=diff
> > >
> > > ==================================================================
> > >====== ======
> > >
> > >> ---
> > >
> > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
> > >che/cx f/transport/http_jetty/JettyHTTPDestination.java (original)
> > >
> > >> +++
> > >
> > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apa
> > >che/cx f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17
> > > 03:57:01 2007
> > >
> > >> @@ -173,13 +173,21 @@
> > >>          }
> > >>      }
> > >>
> > >> -    private synchronized void updateEndpointAddress(String addr)
> > >> { +    private String removeTrailingSeparator(String addr) { +   
> > >>     if (addr.lastIndexOf('/') == addr.length() - 1) { +          
> > >>  return addr.substring(0, addr.length() - 1); +        } else {
> > >> +            return addr;
> > >> +        }
> > >> +    }
> > >
> > > I am not sure should the "addr" always be not null and not an
> > > empty string, but in the jca inbound case, the addr is an *Empty
> > > String*, and then I will get the below exception:
> > >
> > >  java.lang.StringIndexOutOfBoundsException: String index out of
> > > range: -1
> > >
> > > So I add a null check here * if (addr != null && !"".equals(addr)
> > > && addr.lastIndexOf("/" == addr.length() - 1) * as a work
> > > around... Do we need a null check here?
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Failure on trunk build

Posted by Ulhas Bhole <ul...@iona.com>.
Hi,

Does anyone see the build failure[1] on new checkout?

I have done a fresh checkout and run mvn install and getting following 
build failure.
Here is the svn info output on trunk.

Path: .
URL: http://svn.apache.org/repos/asf/incubator/cxf/trunk
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 587093
Node Kind: directory
Schedule: normal
Last Changed Author: ema
Last Changed Rev: 587024
Last Changed Date: 2007-10-22 08:52:27 +0100 (Mon, 22 Oct 2007)


Regards,

Ulhas Bhole

[1]

[INFO] 
----------------------------------------------------------------------------
[INFO] Building Apache CXF Command Line Tools JavaTo WS
[INFO]    task-segment: [install]
[INFO] 
----------------------------------------------------------------------------
[INFO] [remote-resources:process {execution: default}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 33 source files to 
/local1/work/celtix/apache/mainline/trunk/tools/javato/ws/target/classes
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Compilation failure

/local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleClientGenerator.java:[61,33] 
cannot find symbol
symbol  : variable CLIENT_CLASS
location: class org.apache.cxf.tools.common.ToolConstants

/local1/work/celtix/apache/mainline/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleServerGenerator.java:[65,33] 
cannot find symbol
symbol  : variable SERVER_CLASS
location: class org.apache.cxf.tools.common.ToolConstants


Jeff Yu wrote:
>
> Hi Ulhas,
>
> As I talked to Willem, it turns out that the "addr" is not the absoulte
> path url, it is the relative url.
> that's why we might have the "addr" as an empty string.
>
> Say I published an endpoint at the http://localhost:9999/GreeterBean
> address.
> at this scenario, the addr is an empty string. and if I execute the
> "http://localhost:9999/GreeterBean?wsdl" in the browser, I will get an
> exception.
> but if I execute the "http://localhost:9999/GreeterBean/?wsdl", I will
> get the correct wsdl.
>
> Thanks
> Jeff
>
> Bhole, Ulhas wrote:
> > Hi Jeff,
> >
> > Thanks for pointing out the null check requirement. Can you please
> > explain how the wsdl or xsd will be queried in the scenario you
> > expecting the address to be null? In normal scenario the WSDL query is
> > <http-address>?wsdl how would it look like in case of jca?
> >
> > Regards,
> >
> > Ulhas Bhole
> >
> > 
> >
> > -----Original Message-----
> > From: Jeff Yu [mailto:jeff.yu@iona.com]
> > Sent: 18 October 2007 12:16
> > To: cxf-dev@incubator.apache.org
> > Cc: cxf-commits@incubator.apache.org
> > Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
> > rt/core/src/main/java/org/apache/cxf/transport/http/
> > rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jet
> > ty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/
> >
> > Hi,
> >
> > See one comment inline.
> >
> > Thanks
> > Jeff
> >
> > ulhasbhole@apache.org wrote:
> >  
> >> Author: ulhasbhole
> >> Date: Wed Oct 17 03:57:01 2007
> >> New Revision: 585445
> >>
> >> URL: http://svn.apache.org/viewvc?rev=585445&view=rev 
> <http://svn.apache.org/viewvc?rev=585445&view=rev>
> >> Log:
> >> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
> >>
> >> Modified:
> >>
> >>    
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> > WSDLQueryHandler.java
> >  
> > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> > f/transport/http_jetty/JettyHTTPDestination.java
> >  
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
> > y_pattern/MultiplexHttpAddressClientServerTest.java
> >  
> >> Modified:
> >>    
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> > WSDLQueryHandler.java
> >  
> >> URL:
> >>    
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
> > rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&
> > r2=585445&view=diff
> >  
> > ========================================================================
> > ======
> >  
> >> ---
> >>    
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> > WSDLQueryHandler.java (original)
> >  
> >> +++
> >>    
> > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> > WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
> >  
> >> @@ -358,7 +358,7 @@
> >>              baseURI = url.getPath();
> >>              int idx = baseURI.lastIndexOf('/');
> >>              if (idx != -1) {
> >> -                baseURI = baseURI.substring(0, idx + 1);
> >> +                baseURI = baseURI.substring(0, idx);
> >>              }
> >>          }       
> >>          return baseURI;
> >>
> >> Modified:
> >>    
> > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> > f/transport/http_jetty/JettyHTTPDestination.java
> >  
> >> URL:
> >>    
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jett
> > y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination
> > .java?rev=585445&r1=585444&r2=585445&view=diff
> >  
> > ========================================================================
> > ======
> >  
> >> ---
> >>    
> > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> > f/transport/http_jetty/JettyHTTPDestination.java (original)
> >  
> >> +++
> >>    
> > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> > f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01
> > 2007
> >  
> >> @@ -173,13 +173,21 @@
> >>          }
> >>      }
> >> 
> >> -    private synchronized void updateEndpointAddress(String addr) {
> >> +    private String removeTrailingSeparator(String addr) {
> >> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
> >> +            return addr.substring(0, addr.length() - 1);
> >> +        } else {
> >> +            return addr;
> >> +        }
> >> +    }
> >>  
> >>    
> > I am not sure should the "addr" always be not null and not an empty
> > string, but in the jca inbound case, the addr is an *Empty String*, and
> > then I will get the below exception:
> >
> >  java.lang.StringIndexOutOfBoundsException: String index out of range:
> > -1
> >
> > So I add a null check here * if (addr != null && !"".equals(addr) &&
> > addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we
> > need a null check here?
> >
> >
> >
> >  
>

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: svn commit: r585445 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Posted by Jeff Yu <je...@iona.com>.
Hi Ulhas,

As I talked to Willem, it turns out that the "addr" is not the absoulte 
path url, it is the relative url.
that's why we might have the "addr" as an empty string.

Say I published an endpoint at the http://localhost:9999/GreeterBean 
address.
at this scenario, the addr is an empty string. and if I execute the 
"http://localhost:9999/GreeterBean?wsdl" in the browser, I will get an 
exception.
but if I execute the "http://localhost:9999/GreeterBean/?wsdl", I will 
get the correct wsdl.

Thanks
Jeff

Bhole, Ulhas wrote:
> Hi Jeff,
>
> Thanks for pointing out the null check requirement. Can you please
> explain how the wsdl or xsd will be queried in the scenario you
> expecting the address to be null? In normal scenario the WSDL query is
> <http-address>?wsdl how would it look like in case of jca? 
>
> Regards,
>
> Ulhas Bhole
>
>  
>
> -----Original Message-----
> From: Jeff Yu [mailto:jeff.yu@iona.com] 
> Sent: 18 October 2007 12:16
> To: cxf-dev@incubator.apache.org
> Cc: cxf-commits@incubator.apache.org
> Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
> rt/core/src/main/java/org/apache/cxf/transport/http/
> rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jet
> ty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/
>
> Hi,
>
> See one comment inline.
>
> Thanks
> Jeff
>
> ulhasbhole@apache.org wrote:
>   
>> Author: ulhasbhole
>> Date: Wed Oct 17 03:57:01 2007
>> New Revision: 585445
>>
>> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
>> Log:
>> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
>>
>> Modified:
>>
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java
>   
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java
>   
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
> y_pattern/MultiplexHttpAddressClientServerTest.java
>   
>> Modified:
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java
>   
>> URL:
>>     
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
> rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&
> r2=585445&view=diff
>   
> ========================================================================
> ======
>   
>> ---
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java (original)
>   
>> +++
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
>   
>> @@ -358,7 +358,7 @@
>>              baseURI = url.getPath();
>>              int idx = baseURI.lastIndexOf('/');
>>              if (idx != -1) {
>> -                baseURI = baseURI.substring(0, idx + 1);
>> +                baseURI = baseURI.substring(0, idx);
>>              }
>>          }        
>>          return baseURI;
>>
>> Modified:
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java
>   
>> URL:
>>     
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jett
> y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination
> .java?rev=585445&r1=585444&r2=585445&view=diff
>   
> ========================================================================
> ======
>   
>> ---
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java (original)
>   
>> +++
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01
> 2007
>   
>> @@ -173,13 +173,21 @@
>>          }
>>      }
>>  
>> -    private synchronized void updateEndpointAddress(String addr) {
>> +    private String removeTrailingSeparator(String addr) {
>> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
>> +            return addr.substring(0, addr.length() - 1);
>> +        } else {
>> +            return addr;
>> +        }
>> +    }
>>   
>>     
> I am not sure should the "addr" always be not null and not an empty 
> string, but in the jca inbound case, the addr is an *Empty String*, and 
> then I will get the below exception:
>
>  java.lang.StringIndexOutOfBoundsException: String index out of range:
> -1
>
> So I add a null check here * if (addr != null && !"".equals(addr) && 
> addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we 
> need a null check here?
>
>
>
>   

Re: svn commit: r585445 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Posted by Jeff Yu <je...@iona.com>.
Hi Ulhas,

As I talked to Willem, it turns out that the "addr" is not the absoulte 
path url, it is the relative url.
that's why we might have the "addr" as an empty string.

Say I published an endpoint at the http://localhost:9999/GreeterBean 
address.
at this scenario, the addr is an empty string. and if I execute the 
"http://localhost:9999/GreeterBean?wsdl" in the browser, I will get an 
exception.
but if I execute the "http://localhost:9999/GreeterBean/?wsdl", I will 
get the correct wsdl.

Thanks
Jeff

Bhole, Ulhas wrote:
> Hi Jeff,
>
> Thanks for pointing out the null check requirement. Can you please
> explain how the wsdl or xsd will be queried in the scenario you
> expecting the address to be null? In normal scenario the WSDL query is
> <http-address>?wsdl how would it look like in case of jca? 
>
> Regards,
>
> Ulhas Bhole
>
>  
>
> -----Original Message-----
> From: Jeff Yu [mailto:jeff.yu@iona.com] 
> Sent: 18 October 2007 12:16
> To: cxf-dev@incubator.apache.org
> Cc: cxf-commits@incubator.apache.org
> Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
> rt/core/src/main/java/org/apache/cxf/transport/http/
> rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jet
> ty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/
>
> Hi,
>
> See one comment inline.
>
> Thanks
> Jeff
>
> ulhasbhole@apache.org wrote:
>   
>> Author: ulhasbhole
>> Date: Wed Oct 17 03:57:01 2007
>> New Revision: 585445
>>
>> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
>> Log:
>> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
>>
>> Modified:
>>
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java
>   
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java
>   
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
> y_pattern/MultiplexHttpAddressClientServerTest.java
>   
>> Modified:
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java
>   
>> URL:
>>     
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
> rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&
> r2=585445&view=diff
>   
> ========================================================================
> ======
>   
>> ---
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java (original)
>   
>> +++
>>     
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
> WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
>   
>> @@ -358,7 +358,7 @@
>>              baseURI = url.getPath();
>>              int idx = baseURI.lastIndexOf('/');
>>              if (idx != -1) {
>> -                baseURI = baseURI.substring(0, idx + 1);
>> +                baseURI = baseURI.substring(0, idx);
>>              }
>>          }        
>>          return baseURI;
>>
>> Modified:
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java
>   
>> URL:
>>     
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jett
> y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination
> .java?rev=585445&r1=585444&r2=585445&view=diff
>   
> ========================================================================
> ======
>   
>> ---
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java (original)
>   
>> +++
>>     
> incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
> f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01
> 2007
>   
>> @@ -173,13 +173,21 @@
>>          }
>>      }
>>  
>> -    private synchronized void updateEndpointAddress(String addr) {
>> +    private String removeTrailingSeparator(String addr) {
>> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
>> +            return addr.substring(0, addr.length() - 1);
>> +        } else {
>> +            return addr;
>> +        }
>> +    }
>>   
>>     
> I am not sure should the "addr" always be not null and not an empty 
> string, but in the jca inbound case, the addr is an *Empty String*, and 
> then I will get the below exception:
>
>  java.lang.StringIndexOutOfBoundsException: String index out of range:
> -1
>
> So I add a null check here * if (addr != null && !"".equals(addr) && 
> addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we 
> need a null check here?
>
>
>
>   

RE: svn commit: r585445 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Posted by "Bhole, Ulhas" <ul...@iona.com>.
Hi Jeff,

Thanks for pointing out the null check requirement. Can you please
explain how the wsdl or xsd will be queried in the scenario you
expecting the address to be null? In normal scenario the WSDL query is
<http-address>?wsdl how would it look like in case of jca? 

Regards,

Ulhas Bhole

 

-----Original Message-----
From: Jeff Yu [mailto:jeff.yu@iona.com] 
Sent: 18 October 2007 12:16
To: cxf-dev@incubator.apache.org
Cc: cxf-commits@incubator.apache.org
Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
rt/core/src/main/java/org/apache/cxf/transport/http/
rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jet
ty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Hi,

See one comment inline.

Thanks
Jeff

ulhasbhole@apache.org wrote:
> Author: ulhasbhole
> Date: Wed Oct 17 03:57:01 2007
> New Revision: 585445
>
> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
> Log:
> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
>
> Modified:
>
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java
>
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java
>
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java
>
> Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&
r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java (original)
> +++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
> @@ -358,7 +358,7 @@
>              baseURI = url.getPath();
>              int idx = baseURI.lastIndexOf('/');
>              if (idx != -1) {
> -                baseURI = baseURI.substring(0, idx + 1);
> +                baseURI = baseURI.substring(0, idx);
>              }
>          }        
>          return baseURI;
>
> Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jett
y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination
.java?rev=585445&r1=585444&r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java (original)
> +++
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01
2007
> @@ -173,13 +173,21 @@
>          }
>      }
>  
> -    private synchronized void updateEndpointAddress(String addr) {
> +    private String removeTrailingSeparator(String addr) {
> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
> +            return addr.substring(0, addr.length() - 1);
> +        } else {
> +            return addr;
> +        }
> +    }
>   
I am not sure should the "addr" always be not null and not an empty 
string, but in the jca inbound case, the addr is an *Empty String*, and 
then I will get the below exception:

 java.lang.StringIndexOutOfBoundsException: String index out of range:
-1

So I add a null check here * if (addr != null && !"".equals(addr) && 
addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we 
need a null check here?



> +    private synchronized String updateEndpointAddress(String addr) {
>          // only update the EndpointAddress if the base path is equal
>          // make sure we don't broke the get operation?parament query 
> -        String address = endpointInfo.getAddress();
> -        if (getBasePath(address).equals(getStem(getBasePath(addr))))
{
> +        String address =
removeTrailingSeparator(endpointInfo.getAddress());
> +        if
(getBasePath(address).equals(removeTrailingSeparator(getStem(getBasePath
(addr))))) {
>              endpointInfo.setAddress(addr);
>          }
> +        return address;
>      }
>     
>      protected void doService(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
> @@ -194,8 +202,9 @@
>          }
>          QueryHandlerRegistry queryHandlerRegistry =
bus.getExtension(QueryHandlerRegistry.class);
>          
> -        if (null != req.getQueryString() && queryHandlerRegistry !=
null) {        
> -            String requestURL = req.getRequestURL() + "?" +
req.getQueryString();
> +        if (null != req.getQueryString() && queryHandlerRegistry !=
null) {   
> +            String reqAddr = req.getRequestURL().toString();
> +            String requestURL =  reqAddr + "?" +
req.getQueryString();
>              String pathInfo = req.getPathInfo();                     
>              for (QueryHandler qh :
queryHandlerRegistry.getHandlers()) {
>                  boolean recognized =
> @@ -206,17 +215,21 @@
>
contextMatchOnExact())
>                      : qh.isRecognizedQuery(requestURL, pathInfo,
endpointInfo);
>                  if (recognized) {
> -                    //replace the endpointInfo address with request
url only for get wsdl           
> -
updateEndpointAddress(req.getRequestURL().toString());   
> -
resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> -                    try {
> -                        qh.writeResponse(requestURL, pathInfo,
endpointInfo, resp.getOutputStream());
> -                    } catch (Exception ex) {
> -                        LOG.log(Level.WARNING, "writeResponse failed:
", ex);
> +                    //replace the endpointInfo address with request
url only for get wsdl   
> +                    synchronized (endpointInfo) {
> +                        String oldAddress =
updateEndpointAddress(reqAddr);   
> +
resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> +                        try {
> +                            qh.writeResponse(requestURL, pathInfo,
endpointInfo, resp.getOutputStream());
> +                        } catch (Exception ex) {
> +                            LOG.log(Level.WARNING, "writeResponse
failed: ", ex);
> +                        }
> +                        endpointInfo.setAddress(oldAddress);
> +                        resp.getOutputStream().flush();

> +                        baseRequest.setHandled(true);
> +                        return;    
>                      }
> -                    resp.getOutputStream().flush();

> -                    baseRequest.setHandled(true);
> -                    return;
> +                    
>                  }
>              }
>          }
>
> Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/
org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerT
est.java?rev=585445&r1=585444&r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java (original)
> +++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java Wed Oct 17 03:57:01
2007
> @@ -20,9 +20,12 @@
>  package org.apache.cxf.systest.factory_pattern;
>  
>  
> +import java.io.BufferedReader;
> +import java.io.InputStreamReader;
>  import java.lang.reflect.InvocationHandler;
>  import java.lang.reflect.Proxy;
>  import java.net.URL;
> +import java.net.URLConnection;
>  import java.util.HashMap;
>  import java.util.Map;
>  
> @@ -75,7 +78,7 @@
>          Map<String, String> props = new HashMap<String, String>();

>          props.put("cxf.config.file",
"org/apache/cxf/systest/factory_pattern/cxf.xml");
>          assertTrue("server did not launch correctly",
> -                   launchServer(Server.class, props, null));
> +                   launchServer(Server.class, props, null, false));
>      }
>  
>      
> @@ -124,5 +127,44 @@
>          firstChar = new
URL(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT 
>                                  + "103?wsdl").openStream().read();
>          assertTrue("firstChar :" + String.valueOf(firstChar),
firstChar == '<');
> +    }
> +    
> +    @Test
> +    public void testSoapAddressLocation() throws Exception {
> +        
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT))
;
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"22", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"22"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT))
;
> +    }
> +    
> +    private boolean checkSoapAddressLocation(String address) 
> +        throws Exception {
> +        URL url = new URL(address + "?wsdl");
> +        
> +        URLConnection urlConn = url.openConnection();
> +        BufferedReader br = new BufferedReader(new
InputStreamReader(urlConn.getInputStream()));
> +        
> +        while (br.ready()) {
> +            String str = br.readLine();
> +//            System.out.println(str);
> +            if (str.contains("soap:address") 
> +                && str.contains("location=" + "\"" + address + "\""))
{
> +                System.out.println(str);
> +                return  true;
> +            }
> +        }
> +        return false;
>      }
>  }
>
>
>   

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

RE: svn commit: r585445 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Posted by "Bhole, Ulhas" <ul...@iona.com>.
Hi Jeff,

Thanks for pointing out the null check requirement. Can you please
explain how the wsdl or xsd will be queried in the scenario you
expecting the address to be null? In normal scenario the WSDL query is
<http-address>?wsdl how would it look like in case of jca? 

Regards,

Ulhas Bhole

 

-----Original Message-----
From: Jeff Yu [mailto:jeff.yu@iona.com] 
Sent: 18 October 2007 12:16
To: cxf-dev@incubator.apache.org
Cc: cxf-commits@incubator.apache.org
Subject: Re: svn commit: r585445 - in /incubator/cxf/trunk:
rt/core/src/main/java/org/apache/cxf/transport/http/
rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jet
ty/ systests/src/test/java/org/apache/cxf/systest/factory_pattern/

Hi,

See one comment inline.

Thanks
Jeff

ulhasbhole@apache.org wrote:
> Author: ulhasbhole
> Date: Wed Oct 17 03:57:01 2007
> New Revision: 585445
>
> URL: http://svn.apache.org/viewvc?rev=585445&view=rev
> Log:
> * Fix for JIRA CXF-1113 related to WSDLPublish and Default Servant.
>
> Modified:
>
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java
>
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java
>
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java
>
> Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/transport/http/WSDLQueryHandler.java?rev=585445&r1=585444&
r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java (original)
> +++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
WSDLQueryHandler.java Wed Oct 17 03:57:01 2007
> @@ -358,7 +358,7 @@
>              baseURI = url.getPath();
>              int idx = baseURI.lastIndexOf('/');
>              if (idx != -1) {
> -                baseURI = baseURI.substring(0, idx + 1);
> +                baseURI = baseURI.substring(0, idx);
>              }
>          }        
>          return baseURI;
>
> Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jett
y/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination
.java?rev=585445&r1=585444&r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java (original)
> +++
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cx
f/transport/http_jetty/JettyHTTPDestination.java Wed Oct 17 03:57:01
2007
> @@ -173,13 +173,21 @@
>          }
>      }
>  
> -    private synchronized void updateEndpointAddress(String addr) {
> +    private String removeTrailingSeparator(String addr) {
> +        if (addr.lastIndexOf('/') == addr.length() - 1) {
> +            return addr.substring(0, addr.length() - 1);
> +        } else {
> +            return addr;
> +        }
> +    }
>   
I am not sure should the "addr" always be not null and not an empty 
string, but in the jca inbound case, the addr is an *Empty String*, and 
then I will get the below exception:

 java.lang.StringIndexOutOfBoundsException: String index out of range:
-1

So I add a null check here * if (addr != null && !"".equals(addr) && 
addr.lastIndexOf("/" == addr.length() - 1) * as a work around... Do we 
need a null check here?



> +    private synchronized String updateEndpointAddress(String addr) {
>          // only update the EndpointAddress if the base path is equal
>          // make sure we don't broke the get operation?parament query 
> -        String address = endpointInfo.getAddress();
> -        if (getBasePath(address).equals(getStem(getBasePath(addr))))
{
> +        String address =
removeTrailingSeparator(endpointInfo.getAddress());
> +        if
(getBasePath(address).equals(removeTrailingSeparator(getStem(getBasePath
(addr))))) {
>              endpointInfo.setAddress(addr);
>          }
> +        return address;
>      }
>     
>      protected void doService(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
> @@ -194,8 +202,9 @@
>          }
>          QueryHandlerRegistry queryHandlerRegistry =
bus.getExtension(QueryHandlerRegistry.class);
>          
> -        if (null != req.getQueryString() && queryHandlerRegistry !=
null) {        
> -            String requestURL = req.getRequestURL() + "?" +
req.getQueryString();
> +        if (null != req.getQueryString() && queryHandlerRegistry !=
null) {   
> +            String reqAddr = req.getRequestURL().toString();
> +            String requestURL =  reqAddr + "?" +
req.getQueryString();
>              String pathInfo = req.getPathInfo();                     
>              for (QueryHandler qh :
queryHandlerRegistry.getHandlers()) {
>                  boolean recognized =
> @@ -206,17 +215,21 @@
>
contextMatchOnExact())
>                      : qh.isRecognizedQuery(requestURL, pathInfo,
endpointInfo);
>                  if (recognized) {
> -                    //replace the endpointInfo address with request
url only for get wsdl           
> -
updateEndpointAddress(req.getRequestURL().toString());   
> -
resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> -                    try {
> -                        qh.writeResponse(requestURL, pathInfo,
endpointInfo, resp.getOutputStream());
> -                    } catch (Exception ex) {
> -                        LOG.log(Level.WARNING, "writeResponse failed:
", ex);
> +                    //replace the endpointInfo address with request
url only for get wsdl   
> +                    synchronized (endpointInfo) {
> +                        String oldAddress =
updateEndpointAddress(reqAddr);   
> +
resp.setContentType(qh.getResponseContentType(requestURL, pathInfo));
> +                        try {
> +                            qh.writeResponse(requestURL, pathInfo,
endpointInfo, resp.getOutputStream());
> +                        } catch (Exception ex) {
> +                            LOG.log(Level.WARNING, "writeResponse
failed: ", ex);
> +                        }
> +                        endpointInfo.setAddress(oldAddress);
> +                        resp.getOutputStream().flush();

> +                        baseRequest.setHandled(true);
> +                        return;    
>                      }
> -                    resp.getOutputStream().flush();

> -                    baseRequest.setHandled(true);
> -                    return;
> +                    
>                  }
>              }
>          }
>
> Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/
org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerT
est.java?rev=585445&r1=585444&r2=585445&view=diff
>
========================================================================
======
> ---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java (original)
> +++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factor
y_pattern/MultiplexHttpAddressClientServerTest.java Wed Oct 17 03:57:01
2007
> @@ -20,9 +20,12 @@
>  package org.apache.cxf.systest.factory_pattern;
>  
>  
> +import java.io.BufferedReader;
> +import java.io.InputStreamReader;
>  import java.lang.reflect.InvocationHandler;
>  import java.lang.reflect.Proxy;
>  import java.net.URL;
> +import java.net.URLConnection;
>  import java.util.HashMap;
>  import java.util.Map;
>  
> @@ -75,7 +78,7 @@
>          Map<String, String> props = new HashMap<String, String>();

>          props.put("cxf.config.file",
"org/apache/cxf/systest/factory_pattern/cxf.xml");
>          assertTrue("server did not launch correctly",
> -                   launchServer(Server.class, props, null));
> +                   launchServer(Server.class, props, null, false));
>      }
>  
>      
> @@ -124,5 +127,44 @@
>          firstChar = new
URL(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT 
>                                  + "103?wsdl").openStream().read();
>          assertTrue("firstChar :" + String.valueOf(firstChar),
firstChar == '<');
> +    }
> +    
> +    @Test
> +    public void testSoapAddressLocation() throws Exception {
> +        
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT))
;
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"22", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"22"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20", 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT +
"20"));
> +        assertTrue("Should have received the soap:address location " 
> +                   + NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT, 
> +
checkSoapAddressLocation(NumberFactoryImpl.NUMBER_SERVANT_ADDRESS_ROOT))
;
> +    }
> +    
> +    private boolean checkSoapAddressLocation(String address) 
> +        throws Exception {
> +        URL url = new URL(address + "?wsdl");
> +        
> +        URLConnection urlConn = url.openConnection();
> +        BufferedReader br = new BufferedReader(new
InputStreamReader(urlConn.getInputStream()));
> +        
> +        while (br.ready()) {
> +            String str = br.readLine();
> +//            System.out.println(str);
> +            if (str.contains("soap:address") 
> +                && str.contains("location=" + "\"" + address + "\""))
{
> +                System.out.println(str);
> +                return  true;
> +            }
> +        }
> +        return false;
>      }
>  }
>
>
>   

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland