<commit_before>package info.elexis.server.core.redmine.internal.jaxrs;

import java.io.IOException;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.osgi.service.component.annotations.Component;
import org.slf4j.LoggerFactory;

import com.taskadapter.redmineapi.RedmineException;
import com.taskadapter.redmineapi.RedmineSecurityException;

import info.elexis.server.core.redmine.internal.RedmineUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Api(tags = {
	"redmine"
})
@Path("redmine")
@Component(service = RedmineResource.class, immediate = true)
public class RedmineResource {
	
	@POST
	@Path("sendlogfile")
	@ApiOperation(nickname = "sendLogFile", value = "send log file to redmine")
	public Response sendLogFileToRedmine(
		@ApiParam(required = false, value = "sendlog configuration") SendLogConfiguration sendConfiguration){
		
		String appenderName = null;
		Integer issueId = null;
		Long sizeLimit = null;
		
		if (sendConfiguration != null) {
			appenderName = sendConfiguration.getAppender();
			issueId = sendConfiguration.getIssue();
			sizeLimit = sendConfiguration.getMaxsize();
		}
		
		try {
			String issueUrl =
				RedmineUtil.INSTANCE.sendLogToRedmine(appenderName, issueId, sizeLimit);
			return Response.ok(issueUrl, MediaType.TEXT_PLAIN_TYPE).build();
		} catch (RedmineException | IOException e) {
			if (e instanceof RedmineSecurityException) {
				return Response.status(Status.UNAUTHORIZED).entity(e.getMessage()).build();
			}
			LoggerFactory.getLogger(getClass()).error("Error sending log", e);
			return Response.serverError().build();
		}
		
	}
	
}<commit_msg>[18039] Refactor RedmineResource log output on exception<commit_after>package info.elexis.server.core.redmine.internal.jaxrs;

import java.io.IOException;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.osgi.service.component.annotations.Component;
import org.slf4j.LoggerFactory;

import com.taskadapter.redmineapi.RedmineException;
import com.taskadapter.redmineapi.RedmineSecurityException;

import info.elexis.server.core.redmine.internal.RedmineUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Api(tags = {
	"redmine"
})
@Path("redmine")
@Component(service = RedmineResource.class, immediate = true)
public class RedmineResource {
	
	@POST
	@Path("sendlogfile")
	@ApiOperation(nickname = "sendLogFile", value = "send log file to redmine")
	public Response sendLogFileToRedmine(
		@ApiParam(required = false, value = "sendlog configuration") SendLogConfiguration sendConfiguration){
		
		String appenderName = null;
		Integer issueId = null;
		Long sizeLimit = null;
		
		if (sendConfiguration != null) {
			appenderName = sendConfiguration.getAppender();
			issueId = sendConfiguration.getIssue();
			sizeLimit = sendConfiguration.getMaxsize();
		}
		
		try {
			String issueUrl =
				RedmineUtil.INSTANCE.sendLogToRedmine(appenderName, issueId, sizeLimit);
			return Response.ok(issueUrl, MediaType.TEXT_PLAIN_TYPE).build();
		} catch (RedmineException | IOException e) {
			LoggerFactory.getLogger(getClass()).warn("Error sending log", e);
			if (e instanceof RedmineSecurityException) {
				return Response.status(Status.UNAUTHORIZED).entity(e.getMessage()).build();
			}
			return Response.serverError().build();
		}
		
	}
	
}
{'fraction_non_alphanumeric': 0.11667583929554211, 'fraction_numerical': 0.001926252063841497, 'mean_word_length': 5.299826689774696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6652656', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1116, 'n_words': 212}