Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1218

can not filter the string with "_"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • V2 2.0.10
    • None
    • odata2-jpa
    • None
    • Important

    Description

      Hello,

      when I read all entityset, the result is

      The result without filter

      <feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/">
      <id>
      https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet
      </id>
      <title type="text">CustomizedCardEntitySet</title>
      <updated>2017-12-26T07:34:05.261Z</updated>
      <author>
      <name/>
      </author>
      <link href="CustomizedCardEntitySet" rel="self" title="CustomizedCardEntitySet"/>
      <entry>
      <id>
      https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet(519L)
      </id>
      <title type="text">CustomizedCardEntitySet</title>
      <updated>2017-12-26T07:34:05.261Z</updated>
      <category term="CardAdminService.CustomizedCardEntity" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
      <link href="CustomizedCardEntitySet(519L)" rel="edit" title="CustomizedCardEntity"/>
      <content type="application/xml">
      <m:properties>
      <d:CardName>tttt</d:CardName>
      <d:CardSubtitle>Card Subtitle</d:CardSubtitle>
      <d:CardTitle>tttt</d:CardTitle>
      <d:CardType>table</d:CardType>
      <d:CreateOn>2017-12-22T06:44:24.54</d:CreateOn>
      <d:CreatorId>I036207</d:CreatorId>
      <d:CreatorName>null null</d:CreatorName>
      <d:Destination>northwind_CLONING_1</d:Destination>
      <d:Id>519</d:Id>
      <d:Metadata>
      {"serviceUri":"/","entityType":"NorthwindModel.Category","entitySet":"Categories","columns":[

      Unknown macro: {"column"}

      ,

      Unknown macro: {"column"}

      ,

      Unknown macro: {"column"}

      ],"url":"","keys":[],"primarySort":

      Unknown macro: {"key"}

      ,"secondarySort":{"key":"","order":""}}
      </d:Metadata>
      <d:ModifierId>I036207</d:ModifierId>
      <d:ModifierName>null null</d:ModifierName>
      <d:UpdateOn>2017-12-22T06:44:24.54</d:UpdateOn>
      </m:properties>
      </content>
      </entry>
      </feed>

      but when I add ?$filter=(Destination%20eq%20%27northwind_CLONING_1%27), the result is empty

      The result with filter

      <feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/">
      <id>
      https://cpescockpitwebwswd3aeaa50.int.sap.hana.ondemand.com:443/cpes-cockpit-web/odata/CardAdminService.svc/CustomizedCardEntitySet
      </id>
      <title type="text">CustomizedCardEntitySet</title>
      <updated>2017-12-26T07:36:54.253Z</updated>
      <author>
      <name/>
      </author>
      <link href="CustomizedCardEntitySet" rel="self" title="CustomizedCardEntitySet"/>
      </feed>

      I have extend ODataJPAServiceFactory, in the class

      public ODataSingleProcessor createCustomODataProcessor(ODataJPAContext oDataJPAContext)

      { return new CardAdminODataJPAProcessor(oDataJPAContext); }

      the CardAdminODataJPAProcessor is extend ODataJPADefaultProcessor, and I have not override readEntitySet.

      in the debug, I found the query becomes northwind\\_CLONING
      _1, instead of northwind_CLONING_1. I do not why we encode it.

      I found it is changed in class ODataExpressionParser
      private static String updateValueIfWildcards(String value) {
      if (value != null)

      { value = value.replace("\\", "\\\\"); value = value.replace("%", "\\%"); value = value.replace("_", "\\_"); }

      return value;
      }
      but in my case _ is not wildcard.

      I have tested that this issue is not exist in version 2.0.8
      Thank you very much for help!

      Attachments

        1. diff.patch
          8 kB
          Archana Rai

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ddduck Shumin Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: