<commit_before>/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.rest.dmn.service.api.management;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
import org.flowable.dmn.engine.DmnEngine;
import org.flowable.dmn.engine.DmnEngines;
import org.flowable.engine.common.EngineInfo;
import org.flowable.engine.common.api.FlowableException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author <NAME>
 */
@RestController
@Api(tags = { "Engine" }, description = "Manage DMN Engine", authorizations = {@Authorization(value="basicAuth")})
public class DmnEngineResource {

  @ApiOperation(value = "Get DMN engine info", tags = {"Engine"})
  @ApiResponses(value = {
      @ApiResponse(code = 200, message =  "Indicates the engine info is returned."),
  })
  @RequestMapping(value = "/dmn-management/engine", method = RequestMethod.GET, produces = "application/json")
  public DmnEngineInfoResponse getEngineInfo() {
    DmnEngineInfoResponse response = new DmnEngineInfoResponse();

    try {
      EngineInfo dmnEngineInfo = DmnEngines.getDmnEngineInfo(DmnEngines.getDefaultDmnEngine().getName());
      if (dmnEngineInfo != null) {
        response.setName(dmnEngineInfo.getName());
        response.setResourceUrl(dmnEngineInfo.getResourceUrl());
        response.setException(dmnEngineInfo.getException());
      }
      
    } catch (Exception e) {
      throw new FlowableException("Error retrieving DMN engine info", e);
    }

    response.setVersion(DmnEngine.VERSION);

    return response;
  }

}<commit_msg>Fix DMN engine name response<commit_after>/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.rest.dmn.service.api.management;

import org.flowable.dmn.engine.DmnEngine;
import org.flowable.dmn.engine.DmnEngines;
import org.flowable.engine.common.EngineInfo;
import org.flowable.engine.common.api.FlowableException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;

/**
 * @author <NAME>
 */
@RestController
@Api(tags = { "Engine" }, description = "Manage DMN Engine", authorizations = {@Authorization(value="basicAuth")})
public class DmnEngineResource {

  @ApiOperation(value = "Get DMN engine info", tags = {"Engine"})
  @ApiResponses(value = {
      @ApiResponse(code = 200, message =  "Indicates the engine info is returned."),
  })
  @RequestMapping(value = "/dmn-management/engine", method = RequestMethod.GET, produces = "application/json")
  public DmnEngineInfoResponse getEngineInfo() {
    DmnEngineInfoResponse response = new DmnEngineInfoResponse();

    try {
      EngineInfo dmnEngineInfo = DmnEngines.getDmnEngineInfo(DmnEngines.getDefaultDmnEngine().getName());
      if (dmnEngineInfo != null) {
        response.setName(dmnEngineInfo.getName());
        response.setResourceUrl(dmnEngineInfo.getResourceUrl());
        response.setException(dmnEngineInfo.getException());
      } else {
        response.setName(DmnEngines.getDefaultDmnEngine().getName());
      }
      
    } catch (Exception e) {
      throw new FlowableException("Error retrieving DMN engine info", e);
    }

    response.setVersion(DmnEngine.VERSION);

    return response;
  }

}
{'fraction_non_alphanumeric': 0.10646704096485755, 'fraction_numerical': 0.002911208151382824, 'mean_word_length': 4.509736540664376, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3756973', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1336, 'n_words': 352}