Vinod Kannur created OLINGO-1127:
------------------------------------

             Summary: SAP 1q and 2q are not supported in Apache Olingo
                 Key: OLINGO-1127
                 URL: https://issues.apache.org/jira/browse/OLINGO-1127
             Project: Olingo
          Issue Type: Bug
          Components: odata2-core
    Affects Versions: V2 2.0.7, V2 2.0.6
         Environment: OS- Windows 10, Java J2EE, Eclipse
            Reporter: Vinod Kannur


The accept language for 1q and 2q is not supported in Olingo.
Please refer SAP documentation
https://help.sap.com/saphelp_nw74/helpdata/en/91/f21f176f4d1014b6dd926db0e91070/content.htm
 

The batch request contains Accept Language <b> en-US-x-sappsd </b>

Content-Type: application/http
Content-Transfer-Encoding: binary

GET UserSettingsSet HTTP/1.1
sap-contextid-accept: header
Accept: application/json
Accept-Language: en-US-x-sappsd
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
sap-cancel-on-close: true

I debugged and found that AcceptParser class would  check the language against 
the REGEX which fails and throws an exception.

  public List<String> parseAcceptableLanguages() throws BatchException {
    return parseQualifiedHeader(acceptLanguageHeaderValues,
        REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR,
        BatchException.INVALID_ACCEPT_LANGUAGE_HEADER);
  }

We use pom version 2.0.6 for Olingo in our productive code and I also tried in 
2.0.7 version, which gives the same error.

package org.apache.olingo.odata2.core.batch;

import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.olingo.odata2.api.batch.BatchException;
import org.apache.olingo.odata2.api.exception.MessageReference;

/**
*
*/
public class AcceptParser
private static final Pattern REG_EX_ACCEPT_LANGUAGES = Pattern
      .compile("((?:(?:[a-z]{1,8})|(?:\\*))\\-?(?:[a-zA-Z]{1,8})?)");


Since 1q and 2q are valid intermediate SAP languages which is used for 
translation, batch request should accept those languages. 

Thanks,
Vinod.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to