auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public Observable<Connectivity> observeNetworkConnectivity(final Context context) { final IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); return Observable.create(new ObservableOnSubscribe<Connectivity>() { <START> @Override public void subscribe(final ObservableEmitter<Connectivity> subscriber) <END> throws Exception { final BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { subscriber.onNext(Connectivity.create(context)); } }; context.registerReceiver(receiver, filter); unsubscribeInUiThread(new Action() { @Override public void run() { tryToUnregisterReceiver(context, receiver); } }); } }).defaultIfEmpty(Connectivity.create()); }</code><technical_language>Please change subscriber name emmiter. Type changed, in this case, change variable name well</technical_language>

Target:
@Override public Observable<Connectivity> observeNetworkConnectivity(final Context context) { final IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); return Observable.create(new ObservableOnSubscribe<Connectivity>() { @Override public void subscribe(final ObservableEmitter<Connectivity> emitter) throws Exception { final BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { emitter.onNext(Connectivity.create(context)); } }; context.registerReceiver(receiver, filter); unsubscribeInUiThread(new Action() { @Override public void run() { tryToUnregisterReceiver(context, receiver); } }); } }).defaultIfEmpty(Connectivity.create()); }
Source:
<code>public void onResume() { if (DEBUG) { Log.d(TAG, "onResume() called"); } super.onResume(); try { service = NewPipe.getService(serviceId); } catch (Exception e) { ErrorActivity.reportError(getActivity(), e, getActivity().getClass(), getActivity().findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, "", "", R.string.general_error)); } if (!TextUtils.isEmpty(searchString)) { if (wasLoading.getAndSet(false)) { search(searchString, contentFilter, sortFilter); } else if (infoListAdapter.getItemsList().size() == 0) { if (savedState == null) { search(searchString, contentFilter, sortFilter); } else if (!isLoading.get() && !wasSearchFocused) { infoListAdapter.clearStreamItemList(); showEmptyState(); } } } if (!TextUtils.isEmpty(searchSuggestionString)) { <START> handleSearchSuggestion(searchSuggestionString, isCorrectedSearch); <END> } if (suggestionDisposable == null || suggestionDisposable.isDisposed()) { initSuggestionObserver(); } if (TextUtils.isEmpty(searchString) || wasSearchFocused) { showKeyboardSearch(); showSuggestionsPanel(); } else { hideKeyboardSearch(); hideSuggestionsPanel(); } wasSearchFocused = false; }</code><technical_language>handleSearchSuggestion checks if (!TextUtils.isEmpty(searchSuggestionString))</technical_language>

Target:
public void onResume() { if (DEBUG) { Log.d(TAG, "onResume() called"); } super.onResume(); try { service = NewPipe.getService(serviceId); } catch (Exception e) { ErrorActivity.reportError(getActivity(), e, getActivity().getClass(), getActivity().findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR, "", "", R.string.general_error)); } if (!TextUtils.isEmpty(searchString)) { if (wasLoading.getAndSet(false)) { search(searchString, contentFilter, sortFilter); } else if (infoListAdapter.getItemsList().size() == 0) { if (savedState == null) { search(searchString, contentFilter, sortFilter); } else if (!isLoading.get() && !wasSearchFocused) { infoListAdapter.clearStreamItemList(); showEmptyState(); } } } handleSearchSuggestion(); if (suggestionDisposable == null || suggestionDisposable.isDisposed()) { initSuggestionObserver(); } if (TextUtils.isEmpty(searchString) || wasSearchFocused) { showKeyboardSearch(); showSuggestionsPanel(); } else { hideKeyboardSearch(); hideSuggestionsPanel(); } wasSearchFocused = false; }
Source:
<code>public InboundSseEvent build() { byte[] result = dataStream.toByteArray(); if (result.length > 0 && '\n' == result[result.length-1]) { result = Arrays.copyOfRange(result, 0, result.length-1); <START> } <END> return new InboundSseEventImpl(name, id, commentBuilder.length() > 0 ? commentBuilder.substring(0, commentBuilder.length() - 1) : null, reconnectDelay, result, annotations, mediaType, headers); }</code><technical_language>worth it, a subclass of ByteArrayOutputStream ByteArrayOutputStream.buf decide copy of buf byte, saving copy</technical_language>

Target:
public InboundSseEvent build() { return new InboundSseEventImpl(name, id, commentBuilder.length() > 0 ? commentBuilder.substring(0, commentBuilder.length() - 1) : null, reconnectDelay, dataStream.getEventData(), annotations, mediaType, headers); }
Source:
<code>public KasperResponse(final KasperResponse response) { this.status = response.status; <START> this.reason = response.reason; <END> }</code><technical_language>call this(response.status, response.reason) do checks throws IllegalStateException</technical_language>

Target:
public KasperResponse(final KasperResponse response) { this(response.status, response.reason); }
Source:
<code><START> public Group updateGroup(PerunSession sess, Group group) throws GroupNotExistsException, GroupExistsException, InternalErrorException, PrivilegeException { <END> Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); Utils.notNull(group, "group"); Utils.notNull(group.getName(), "group.name"); if (!group.getShortName().matches(GroupsManager.GROUP_SHORT_NAME_REGEXP)) { throw new IllegalArgumentException("Wrong group shortName, group shortName must matches " + GroupsManager.GROUP_SHORT_NAME_REGEXP); } Vo groupVo = getGroupsManagerBl().getVo(sess, group); try { Group groupWithSameName = getGroupsManagerBl().getGroupByName(sess, groupVo, group.getName()); if(groupWithSameName.getId() != group.getId()) { throw new GroupExistsException("Name is already used by other Group in this Vo."); } } catch (GroupNotExistsException ex) { } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "updateGroup"); } return getGroupsManagerBl().updateGroup(sess, group); }</code><technical_language>check this SQL constraint in impl/dao layer, update name description separately. catch DataIntegrityViolationException updating name throw GroupExistsException current InternalErrorException. example in FacilitiesManagerImpl method updateFacility()</technical_language>

Target:
public Group updateGroup(PerunSession sess, Group group) throws GroupNotExistsException, GroupExistsException, InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); Utils.notNull(group, "group"); Utils.notNull(group.getName(), "group.name"); if (!group.getShortName().matches(GroupsManager.GROUP_SHORT_NAME_REGEXP)) { throw new IllegalArgumentException("Wrong group shortName, group shortName must matches " + GroupsManager.GROUP_SHORT_NAME_REGEXP); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "updateGroup"); } return getGroupsManagerBl().updateGroup(sess, group); }
Source:
<code>private void attemptRecovery() { appManagerBt.setVisibility(View.INVISIBLE); loadingIndicator.setVisibility(View.VISIBLE); AndroidCommCarePlatform platform = CommCareApplication.instance().getCommCarePlatform(); ResourceTable global = platform.getGlobalResourceTable(); if (!global.getMissingResources().isEmpty()) { int total = global.getMissingResources().size(); ResourceRecoveryTask<RecoveryActivity> task = new ResourceRecoveryTask<RecoveryActivity>(RECOVERY_TASK) { @Override protected void deliverResult(RecoveryActivity recoveryActivity, Boolean success) { if (success) { CommCareApplication.instance().initializeAppResources(CommCareApplication.instance().getCurrentApp()); attemptRecovery(); loadingIndicator.setVisibility(View.INVISIBLE); } else { <START> onRecoveryFailure(); <END> } } @Override protected void deliverUpdate(RecoveryActivity recoveryActivity, Integer... update) { int done = update[0]; updateStatus( StringUtils.getStringRobust(recoveryActivity, R.string.recovery_resource_progress, new String[]{String.valueOf(done), String.valueOf(total)})); } @Override protected void deliverError(RecoveryActivity recoveryActivity, Exception e) { Logger.exception("Error while recovering missing resources " + ForceCloseLogger.getStackTrace(e), e); onRecoveryFailure(); } }; task.connect(this); task.executeParallel(); } else { if (isAppCorrupt()) { onRecoveryFailure(); } else { updateStatus(R.string.recovery_success); loadingIndicator.setVisibility(View.INVISIBLE); } } }</code><technical_language>recovery is, well, a "real" process, I useful bubble more information this if can. If else, knowing recovery is failing due network issues super useful</technical_language>

Target:
public void attemptRecovery() { appManagerBt.setVisibility(View.INVISIBLE); loadingIndicator.setVisibility(View.VISIBLE); CommCareApplication commCareApplication = CommCareApplication.instance(); commCareApplication.initializeAppResources(commCareApplication.getCurrentApp()); AndroidCommCarePlatform platform = commCareApplication.getCommCarePlatform(); ResourceTable global = platform.getGlobalResourceTable(); if (!global.getMissingResources().isEmpty()) { startRecoveryTask(); } else { if (isAppCorrupt()) { onRecoveryFailure(getLocalizedString(R.string.recovery_error_unknown)); } else { updateStatus(R.string.recovery_success); loadingIndicator.setVisibility(View.INVISIBLE); } } }
Source:
<code><START> private static Result addPublicationType(Result result, String publicationType) { <END> if (result.getInstance()==null) { result.setInstance(new ArrayList<>()); } Instance instance = new Instance(); Qualifier instancetype = new Qualifier(); instancetype.setClassid(publicationType); instance.setInstancetype(instancetype); result.getInstance().add(instance); return result; }</code><technical_language>return void</technical_language>

Target:
private static void addPublicationType(Result result, String publicationType) { if (result.getInstance()==null) { result.setInstance(new ArrayList<>()); } Instance instance = new Instance(); Qualifier instancetype = new Qualifier(); instancetype.setClassid(publicationType); instance.setInstancetype(instancetype); result.getInstance().add(instance); }
Source:
<code>protected AbstractRngDeviceCommand(T parameters) { super(parameters); if (parameters.getRngDevice() == null) { <START> throw new IllegalArgumentException("RNG Device must be specified."); <END> } Guid vmId = parameters.getRngDevice().getVmId(); setVmId(vmId); cachedEntity = getParameters().isVm() ? getVmStaticDAO().get(vmId) : getVmTemplateDAO().get(vmId); if (cachedEntity != null) { setVdsGroupId(cachedEntity.getVdsGroupId()); } cachedRngDevices = new ArrayList<>(); List<VmDevice> rngDevs = getVmDeviceDao().getVmDeviceByVmIdAndType(vmId, VmDeviceGeneralType.RNG); if (rngDevs != null) { cachedRngDevices.addAll(rngDevs); } }</code><technical_language>is need throw exceptions in constructor, 2 infrastructures use: 1. bean validation in parameters class (see AddBondParameters for example) 2. canDoAction method return a nice translate-able message user problem</technical_language>

Target:
protected AbstractRngDeviceCommand(T parameters) { super(parameters); if (parameters.getRngDevice() == null) { cachedEntity = null; cachedRngDevices = null; return; } Guid vmId = parameters.getRngDevice().getVmId(); setVmId(vmId); cachedEntity = getParameters().isVm() ? getVmStaticDAO().get(vmId) : getVmTemplateDAO().get(vmId); if (cachedEntity != null) { setVdsGroupId(cachedEntity.getVdsGroupId()); } cachedRngDevices = new ArrayList<>(); List<VmDevice> rngDevs = getVmDeviceDao().getVmDeviceByVmIdAndType(vmId, VmDeviceGeneralType.RNG); if (rngDevs != null) { cachedRngDevices.addAll(rngDevs); } }
Source:
<code>public String getOriginalFileName() { String idArray[] = this.id.split("/"); int idLen = idArray.length; String originalFileName = ""; <START> if(idArray != null && idArray.length>0) { <END> originalFileName = idArray[idLen-1]; } return originalFileName; }</code><technical_language>If pulling out idLen variable consistently code. need for null check code thrown a NPE line 4483 if idArray null</technical_language>

Target:
public String getOriginalFileName() { String idArray[] = this.id.split("/"); String originalFileName = ""; if(idArray != null && idArray.length>0) { originalFileName = idArray[idArray.length-1]; } return originalFileName; }
Source:
<code>public Map<String, IndicatorValue> get(StatisticalIndicatorDataModel selectors, String indicator, String regionCategoryId) { Map<Integer, IndicatorValue> allValues = fetchData(selectors, indicator); Map<String, IndicatorValue> filteredValues = new HashMap<>(); for (Entry<Integer, IndicatorValue> entry : allValues.entrySet()) { Integer regionId = entry.getKey(); if (regionId == null) { continue; } IndicatorValue value = entry.getValue(); String category = regionParser.getCategoryById(regionId); <START> if (category != null && category.equalsIgnoreCase(regionCategoryId)) { <END> String code = regionParser.getCode(regionId); if (code != null) { filteredValues.put(code, value); } } } return filteredValues; }</code><technical_language>avoid null check swapping order, e.g. if (regionCategoryId.equalsIgnoreCase(category))</technical_language>

Target:
public Map<String, IndicatorValue> get(StatisticalIndicatorDataModel selectors, String indicator, String regionCategoryId) { if(regionCategoryId == null) { throw new ServiceRuntimeException("Unknown regionset"); } Map<Integer, IndicatorValue> allValues = fetchDataForAllRegionsets(selectors, indicator); Map<String, IndicatorValue> filteredValues = new HashMap<>(); for (Entry<Integer, IndicatorValue> entry : allValues.entrySet()) { Integer sotkaRegionId = entry.getKey(); String category = regionParser.getCategoryById(sotkaRegionId); if (!regionCategoryId.equalsIgnoreCase(category)) { continue; } String oskariRegionId = regionParser.getCode(sotkaRegionId); if (oskariRegionId != null) { filteredValues.put(oskariRegionId, entry.getValue()); } } return filteredValues; }
Source:
<code>private void handleHttpHeaders(AssertionType assertion, WebServiceContext context) { try { if (getPropertyAccessor().getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.READ_HTTP_HEADERS)) { MessageContext messageContext = getMessageContext(context); <START> if (messageContext != null && (messageContext instanceof WrappedMessageContext)) { <END> readHttpHeaders(messageContext, assertion); } } } catch (PropertyAccessException ex) { LOG.warn("Unable to access property for reading HTTP headers.", ex); } }</code><technical_language>remove !=null null instanceof WrappedMessageContext return false</technical_language>

Target:
private void handleHttpHeaders(AssertionType assertion, WebServiceContext context) { try { if (getPropertyAccessor().getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.READ_HTTP_HEADERS)) { MessageContext messageContext = getMessageContext(context); if (messageContext instanceof WrappedMessageContext) { readHttpHeaders(messageContext, assertion); } } } catch (PropertyAccessException ex) { LOG.warn("Unable to access property for reading HTTP headers.", ex); } }
Source:
<code>public ActionResponse execute() throws QueryStoreException { final String cacheKeyValue = cacheKey(); if (isCacheable()) { if (cache.has(cacheKeyValue)) { logger.info("Cache hit for key: " + cacheKeyValue); return cache.get(cacheKey()); } } logger.info("Cache miss for key: " + cacheKeyValue); parameter.setFilters(checkAndAddTemporalBoundary(parameter.getFilters())); <START> if (!parameterTableExists(parameter)) { <END> throw new QueryStoreException(QueryStoreException.ErrorCode.NO_SUCH_TABLE, "Table/s not found"); } ActionResponse result = execute(parameter); if (isCacheable()) { logger.info("Cache load for key: " + cacheKeyValue); return cache.put(cacheKey(), result); } return result; }</code><technical_language>Move this beginning of method</technical_language>

Target:
public ActionResponse execute() throws QueryStoreException { if (!parameterTableExists(parameter)) { throw new QueryStoreException(QueryStoreException.ErrorCode.NO_SUCH_TABLE, "Table/s not found"); } final String cacheKeyValue = cacheKey(); if (isCacheable()) { if (cache.has(cacheKeyValue)) { logger.info("Cache hit for key: " + cacheKeyValue); return cache.get(cacheKey()); } } logger.info("Cache miss for key: " + cacheKeyValue); parameter.setFilters(checkAndAddTemporalBoundary(parameter.getFilters())); ActionResponse result = execute(parameter); if (isCacheable()) { logger.info("Cache load for key: " + cacheKeyValue); return cache.put(cacheKey(), result); } return result; }
Source:
<code>public static int publish( final byte[] data, final String path, final AuthenticationData loginData ) throws IOException { <START> return publish( data, path, loginData, Optional.empty() ); <END> }</code><technical_language>Pass a new Properties() file here</technical_language>

Target:
public static int publish( final byte[] data, final String path, final AuthenticationData loginData ) throws IOException { return publish( data, path, loginData, new Properties() ); }
Source:
<code>public void onGoogleSignupFinished(String name, String email, String photoUrl, String username) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_SUCCESS); <START> mLoginAnalyticsListener.trackAnalyticsSignIn(false); <END> if (mIsJetpackConnect) { ActivityLauncher.showSignupEpilogueForResult(this, name, email, photoUrl, username, false); } else { ActivityLauncher.showMainActivityAndSignupEpilogue(this, name, email, photoUrl, username); } setResult(Activity.RESULT_OK); finish(); }</code><technical_language>this trackAnalyticsSignIn(true)? I flag is meant identify self-hosted WP.com logins, WP.com signups count latter</technical_language>

Target:
public void onGoogleSignupFinished(String name, String email, String photoUrl, String username) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_SUCCESS); if (mIsJetpackConnect) { ActivityLauncher.showSignupEpilogueForResult(this, name, email, photoUrl, username, false); } else { ActivityLauncher.showMainActivityAndSignupEpilogue(this, name, email, photoUrl, username); } setResult(Activity.RESULT_OK); finish(); }
Source:
<code>public alluxio.grpc.JobWorkerHealth toProto() { alluxio.grpc.JobWorkerHealth.Builder builder = alluxio.grpc.JobWorkerHealth.newBuilder() <START> .setWorkerId(mWorkerId).addAllLoadAverage(mLoadAverage).setTaskPoolSize(mTaskPoolSize) <END> .setLastUpdated(mLastUpdated); if (mHostname != null) { builder.setHostname(mHostname); } return builder.build(); }</code><technical_language>is a unittest for this method</technical_language>

Target:
public alluxio.grpc.JobWorkerHealth toProto() { alluxio.grpc.JobWorkerHealth.Builder builder = alluxio.grpc.JobWorkerHealth.newBuilder() .setWorkerId(mWorkerId).addAllLoadAverage(mLoadAverage).setTaskPoolSize(mTaskPoolSize) .setNumActiveTasks(mNumActiveTasks).setLastUpdated(mLastUpdated); if (mHostname != null) { builder.setHostname(mHostname); } return builder.build(); }
Source:
<code>public void addItem(Object key, Object value, CompletableFuture<?> future) { future.whenComplete((result, exception) -> { if (exception != null) { notifier.notifyEntityIndexingFailure(value.getClass(), key, exception); } else { notifier.notifyDocumentsAdded(1); } }).thenCombine(lastFuture, (ignored1, ignored2) -> null); <START> } <END></code><technical_language>forgot update lastFuture</technical_language>

Target:
public void addItem(Object key, Object value, CompletableFuture<?> future) { lastFuture = future.whenComplete((result, exception) -> { if (exception != null) { notifier.notifyEntityIndexingFailure(value.getClass(), key, exception); } else { notifier.notifyDocumentsAdded(1); } }).thenCombine(lastFuture, (ignored1, ignored2) -> null); }
Source:
<code>public OwnerEnvContentAccess getContentAccess(String ownerId, String environmentId) { OwnerEnvContentAccess result = null; if (environmentId != null) { <START> result = (OwnerEnvContentAccess) this.createSecureCriteria() <END> .add(Restrictions.eq("owner.id", ownerId)) .add(Restrictions.eq("environment.id", environmentId)) .uniqueResult(); } else { result = (OwnerEnvContentAccess) this.createSecureCriteria() .add(Restrictions.eq("owner.id", ownerId)) .add(Restrictions.isNull("environment.id")) .uniqueResult(); } return result; }</code><technical_language>Please JPQL</technical_language>

Target:
public OwnerEnvContentAccess getContentAccess(String ownerId, String environmentId) { OwnerEnvContentAccess result = null; String hql = ""; List<OwnerEnvContentAccess> resultList = null; if (environmentId != null) { hql = "SELECT oeca" + " FROM OwnerEnvContentAccess oeca" + " JOIN oeca.owner o" + " JOIN oeca.environment e" + " WHERE" + " o.id=:ownerId" + " AND" + " e.id=:enviromentId"; Query query = this.getEntityManager().createQuery(hql); resultList = (List<OwnerEnvContentAccess>) query .setParameter("ownerId", ownerId) .setParameter("enviromentId", environmentId) .getResultList(); } else { hql = "SELECT oeca" + " FROM OwnerEnvContentAccess oeca" + " JOIN oeca.owner o" + " WHERE" + " o.id=:ownerId" + " AND" + " oeca.environment is null"; Query query = this.getEntityManager().createQuery(hql); resultList = (List<OwnerEnvContentAccess>) query .setParameter("ownerId", ownerId) .getResultList(); if (resultList.isEmpty()) { result = null; } else { result = resultList.get(0); } } if (resultList.isEmpty()) { result = null; } else { result = resultList.get(0); } return result; }
Source:
<code>public static Throwable exceptionMapper(Throwable throwable) { if (!(throwable instanceof SearchErrorException)) { return throwable; } SearchErrorException exception = (SearchErrorException) throwable; <START> if (EMPTY_BODY_404.equalsIgnoreCase(throwable.getMessage())) { return new ResourceNotFoundException(DOCUMENT_NOT_FOUND, exception.getResponse()); } <END> return new HttpResponseException(exception.getMessage(), exception.getResponse()); }</code><technical_language>is exception message determine if a 404 error? check if status code in response is 404 instead. exception.getResponse().getStatusCode() == 404</technical_language>

Target:
public static Throwable exceptionMapper(Throwable throwable) { if (!(throwable instanceof SearchErrorException)) { return throwable; } SearchErrorException exception = (SearchErrorException) throwable; if (exception.getResponse().getStatusCode() == 404) { return new ResourceNotFoundException(DOCUMENT_NOT_FOUND, exception.getResponse()); } return new HttpResponseException(exception.getMessage(), exception.getResponse()); }
Source:
<code>public static BeanPostProcessor messageHandlerHeaderPropagationBeanPostProcessor( final SpringIntegrationProperties springIntegrationProperties) { return new BeanPostProcessor() { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { <START> if (bean instanceof AbstractReplyProducingMessageHandler) { <END> AbstractReplyProducingMessageHandler messageHandler = (AbstractReplyProducingMessageHandler) bean; messageHandler.addNotPropagatedHeaders( springIntegrationProperties.getMessageHandlerNotPropagatedHeaders()); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } }; }</code><technical_language>if is critical right TODO, bean proxy coming this BPP, instanceof for class. interfaces here. this: Class<?> targetClass = bean.getClass(); if (AopUtils.isAopProxy(bean) { targetClass = AopUtils.getTargetClass(this.handler); } boolean replyMessageHandler = AbstractReplyProducingMessageHandler.class.isAssignableFrom(targetClass);</technical_language>

Target:
public static BeanPostProcessor messageHandlerHeaderPropagationBeanPostProcessor( final SpringIntegrationProperties springIntegrationProperties) { return new BeanPostProcessor() { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { Class<?> beanClass = AopUtils.isAopProxy(bean) ? AopUtils.getTargetClass(bean) : bean.getClass(); if (AbstractReplyProducingMessageHandler.class.isAssignableFrom(beanClass)) { AbstractReplyProducingMessageHandler messageHandler = (AbstractReplyProducingMessageHandler) bean; messageHandler.addNotPropagatedHeaders( springIntegrationProperties.getMessageHandlerNotPropagatedHeaders()); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } }; }
Source:
<code>public String getSessionName() { return server.getSessionByID(getSessionID()).getName(); <START> } <END></code><technical_language>access session in ServerConsumerImpl</technical_language>

Target:
public String getSessionName() { return this.session.getName(); }
Source:
<code>protected ClientRequest buildRefreshAccessTokenClientRequest() { ClientRequest.Builder builder = new ClientRequest.Builder(); builder.accept(MediaType.APPLICATION_XML); builder.header(ConcurConstants.AUTHORIZATION_PROPERTY,ConcurConstants.OAUTH_AUTHENTICATION_SCHEME + getConcurAccessToken()); URI uri; try { uri = new URI(getConcurRefreshAccessTokenURL() + ConcurConstants.REFRESH_TOKEN_URL_PARAM + getConcurRefreshToken() + ConcurConstants.CLIENT_ID_URL_PARAM + getConcurConsumerKey() + ConcurConstants.CLIENT_SECRET_URL_PARAM + getConcurSecretKey()); } catch (URISyntaxException e) { <START> throw new RuntimeException(e); <END> } ClientRequest request = builder.build(uri, HttpMethod.GET); return request; }</code><technical_language>helpful include a message exception creating this new RuntimeException add context troubleshooting</technical_language>

Target:
protected ClientRequest buildRefreshAccessTokenClientRequest() { ClientRequest.Builder builder = new ClientRequest.Builder(); builder.accept(MediaType.APPLICATION_XML); builder.header(ConcurConstants.AUTHORIZATION_PROPERTY,ConcurConstants.OAUTH_AUTHENTICATION_SCHEME + KFSConstants.BLANK_SPACE + getAccessToken()); URI uri; try { uri = new URI(getConcurRefreshAccessTokenURL() + ConcurConstants.REFRESH_TOKEN_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getRefreshToken() + CUKFSConstants.AMPERSAND + ConcurConstants.CLIENT_ID_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getConsumerKey() + CUKFSConstants.AMPERSAND + ConcurConstants.CLIENT_SECRET_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getSecretKey()); } catch (URISyntaxException e) { throw new RuntimeException("An error occured while building the refresh access token URI: ", e); } return builder.build(uri, HttpMethod.GET); }
Source:
<code>public void immutableTimestampIsGreaterThanFreshTimestampWhenNotLocked() { String randomNamespace = randomNamespace(); long freshTs = cluster.client(randomNamespace).getFreshTimestamp(); <START> long immutableTs = cluster.client(randomNamespace).timelockService().getImmutableTimestamp(); <END> assertThat(immutableTs).isGreaterThan(freshTs); }</code><technical_language>I namespace constant here? imagine for test specific interactions namespaces. concerned other tests shady immutable timestamp</technical_language>

Target:
public void immutableTimestampIsGreaterThanFreshTimestampWhenNotLocked() { long freshTs = namespace.getFreshTimestamp(); long immutableTs = namespace.timelockService().getImmutableTimestamp(); assertThat(immutableTs).isGreaterThan(freshTs); }
Source:
<code>private BoolQueryBuilder createUserTaskQuery(User user) throws DataException { BoolQueryBuilder subquery = new BoolQueryBuilder(); subquery.should(createSimpleQuery("processingUser", user.getId(), true)); subquery.should(createSimpleQuery("users.id", user.getId(), true)); for (UserGroup userGroup : user.getUserGroups()) { subquery.should(createSimpleQuery("userGroups.id", userGroup.getId(), true)); } BoolQueryBuilder query = new BoolQueryBuilder(); query.must(subquery); query.must(createSimpleQuery("processingStatus", TaskStatus.LOCKED.getValue(), false)); query.must(createSimpleQuery("processingStatus", TaskStatus.DONE.getValue(), false)); <START> List<JSONObject> templateProcesses = serviceManager.getTemplateService().findByTemplate(true, null); <END> if (templateProcesses.size() > 0) { Set<Integer> templates = new HashSet<>(); for (JSONObject jsonObject : templateProcesses) { templates.add(getIdFromJSONObject(jsonObject)); } query.mustNot(createSetQuery("processForTask.id", templates, true)); } AktuelleSchritteForm form = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); if (Objects.equals(form, null)) { form = new AktuelleSchritteForm(); } if (form.getHideCorrectionTasks()) { query.must(createSimpleQuery("priority", 10, true)); } if (!form.getShowAutomaticTasks()) { query.must(createSimpleQuery("typeAutomatic", "false", true)); } return query; }</code><technical_language>code is existing in method getAmountOfCurrentTasks. Instead of duplicating code, code moved in a separate method called methods</technical_language>

Target:
private BoolQueryBuilder createUserTaskQuery(User user) throws DataException { BoolQueryBuilder subquery = new BoolQueryBuilder(); subquery.should(createSimpleQuery("processingUser", user.getId(), true)); subquery.should(createSimpleQuery("users.id", user.getId(), true)); for (UserGroup userGroup : user.getUserGroups()) { subquery.should(createSimpleQuery("userGroups.id", userGroup.getId(), true)); } BoolQueryBuilder query = new BoolQueryBuilder(); query.must(subquery); query.must(createSimpleQuery("processingStatus", TaskStatus.LOCKED.getValue(), false)); query.must(createSimpleQuery("processingStatus", TaskStatus.DONE.getValue(), false)); query.must(createOnlyTasksInProcessQuery()); AktuelleSchritteForm form = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); if (Objects.equals(form, null)) { form = new AktuelleSchritteForm(); } if (form.getHideCorrectionTasks()) { query.must(createSimpleQuery("priority", 10, true)); } if (!form.getShowAutomaticTasks()) { query.must(createSimpleQuery("typeAutomatic", "false", true)); } return query; }
Source:
<code>public ICrop getCropAt(World world, BlockPos pos, BlockState blockState) { Block block = blockState.getBlock(); <START> if (!block.getTags().contains(BlockTags.LOGS.getId())) { <END> return null; } return new CropDestroy(world, blockState, pos, null); }</code><technical_language>!block.isIn(BlockTags.LOGS)</technical_language>

Target:
public ICrop getCropAt(World world, BlockPos pos, BlockState blockState) { Block block = blockState.getBlock(); if (!block.isIn(BlockTags.LOGS)) { return null; } return new CropDestroy(world, blockState, pos, null); }
Source:
<code>public static List<URL> getURLsForClasspath(String cp) { try { String[] paths = cp.split(File.pathSeparator); List<URL> urls = new ArrayList<>(); for (int i = 0; i < paths.length; i++) { File f = new File(paths[i]); if ("*".equals(f.getName())) { File parentDir = f.getParentFile(); <START> if (parentDir.exists() && parentDir.isDirectory()) { <END> File[] jars = parentDir.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name != null && (name.endsWith(".jar") || name.endsWith(".JAR")); } } ); for (File jar : jars) { urls.add(jar.toURI().toURL()); } } } else { urls.add(new File(paths[i]).toURI().toURL()); } } return urls; } catch (IOException ex) { throw Throwables.propagate(ex); } }</code><technical_language>isDirectory() checks exists iirc</technical_language>

Target:
public static List<URL> getURLsForClasspath(String cp) { try { String[] paths = cp.split(File.pathSeparator); List<URL> urls = new ArrayList<>(); for (int i = 0; i < paths.length; i++) { File f = new File(paths[i]); if ("*".equals(f.getName())) { File parentDir = f.getParentFile(); if (parentDir.isDirectory()) { File[] jars = parentDir.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name != null && (name.endsWith(".jar") || name.endsWith(".JAR")); } } ); for (File jar : jars) { urls.add(jar.toURI().toURL()); } } } else { urls.add(new File(paths[i]).toURI().toURL()); } } return urls; } catch (IOException ex) { throw Throwables.propagate(ex); } }
Source:
<code>public void testAuditInvoker() throws Exception { IPluginManager pluginManager = Mockito.mock( IPluginManager.class ); PowerMockito.mockStatic( PentahoSystem.class ); BDDMockito.given( PentahoSystem.get( IPluginManager.class ) ).willReturn( pluginManager ); final IActionInvoker actionInvoker = Mockito.spy( MyDefaultActionInvoker.class ); final WorkerNodeActionInvokerAuditor wnActionInvokerAuditer = new WorkerNodeActionInvokerAuditor( actionInvoker ); WorkerNodeActionInvokerAuditor wnaiu = Mockito.spy( wnActionInvokerAuditer ); wnaiu.invokeAction( actionMock, actionUser, actionMapMock ); Mockito.verify( actionInvoker, Mockito.times( 1 ) ).invokeAction( Mockito.eq( actionMock ), Mockito.eq( actionUser ), Mockito.eq( actionMapMock ) ); Mockito.verify( wnaiu, Mockito.times( 2 ) ).makeAuditRecord( Mockito.anyLong() ,Mockito.anyString(), Mockito.anyMap() , Mockito.anyString() ); <START> }} <END></code><technical_language>Is this closing bracket in right place</technical_language>

Target:
public void testAuditInvoker() throws Exception { IPluginManager pluginManager = Mockito.mock( IPluginManager.class ); PowerMockito.mockStatic( PentahoSystem.class ); BDDMockito.given( PentahoSystem.get( IPluginManager.class ) ).willReturn( pluginManager ); final IActionInvoker actionInvoker = Mockito.spy( MyDefaultActionInvoker.class ); final WorkerNodeActionInvokerAuditor wnActionInvokerAuditer = new WorkerNodeActionInvokerAuditor( actionInvoker ); WorkerNodeActionInvokerAuditor wnaiu = Mockito.spy( wnActionInvokerAuditer ); wnaiu.invokeAction( actionMock, actionUser, actionMapMock ); Mockito.verify( actionInvoker, Mockito.times( 1 ) ).invokeAction( Mockito.eq( actionMock ), Mockito.eq( actionUser ), Mockito.eq( actionMapMock ) ); Mockito.verify( wnaiu, Mockito.times( 2 ) ).makeAuditRecord( Mockito.anyLong(), Mockito.anyString(), Mockito.anyMap(), Mockito.anyString() ); }
Source:
<code>public static String timeConvertRound(final int minuteOfDay) { <START> final int minutes = (minuteOfDay + DAY_MINUTES) % 60; <END> final int minutesRound; final int hourAdd; if (minutes < 15) { minutesRound = 0; hourAdd = 0; } else if (minutes < 45) { minutesRound = 30; hourAdd = 0; } else { minutesRound = 0; hourAdd = 1; } final int hours = ((minuteOfDay + DAY_MINUTES) % DAY_MINUTES) / 60; final int hoursRound = hours + hourAdd; final String timeString = DateTimeFormat.forPattern("h:mm aa").print(new DateTime(0).withHourOfDay(hoursRound).withMinuteOfHour(minutesRound)); return timeString; }</code><technical_language>DAY_MINUTES ---> DateTimeConstants.MINUTES_PER_DAY</technical_language>

Target:
public static String timeConvertRound(final int minuteOfDay) { final int minutes = (minuteOfDay + DateTimeConstants.MINUTES_PER_DAY) % 60; final int minutesRound; final int hourAdd; if (minutes < 15) { minutesRound = 0; hourAdd = 0; } else if (minutes < 45) { minutesRound = 30; hourAdd = 0; } else { minutesRound = 0; hourAdd = 1; } final int hours = ((minuteOfDay + DateTimeConstants.MINUTES_PER_DAY) % DateTimeConstants.MINUTES_PER_DAY) / 60; final int hoursRound = hours + hourAdd; final String timeString = DateTimeFormat.forPattern("h:mm aa").print(new DateTime(0).withHourOfDay(hoursRound).withMinuteOfHour(minutesRound)); return timeString; }
Source:
<code>public final <T> Callable<T> wrap(final Callable<T> callable) { final Thread caller = Thread.currentThread(); final Callable<T> wrapped = wrapImpl(context(local.getContext(), cleanup(callable))); return new Callable<T>() { @Override public T call() throws Exception { <START> if (caller == Thread.currentThread()) { <END> return callable.call(); } else { return wrapped.call(); } } @Override public String toString() { return callable.toString(); } }; }</code><technical_language>this fail is if scheduling multiple tasks in a single thread executor, single thread executor. I if check this save callerContext: final RequestContext callerContext = checkNotNull(local.getContext()); in callable: if (callerContext == local.getContext()) { return callable.call(); } else { return wrapped.call(); } detecting thread is context is (both conditions needed execute callable safely)</technical_language>

Target:
public final <T> Callable<T> wrap(final Callable<T> callable) { final RequestContext callerContext = checkNotNull(local.getContext()); final Callable<T> wrapped = wrapImpl(context(callerContext, cleanup(callable))); return new Callable<T>() { @Override public T call() throws Exception { if (callerContext == local.getContext()) { return callable.call(); } else { return wrapped.call(); } } @Override public String toString() { return callable.toString(); } }; }
Source:
<code>public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) { <START> if (CryptoCurrency.SMART.getCode().equalsIgnoreCase(cryptoCurrency)) { <END> return new AquanowAddressValidator(); } return null; }</code><technical_language>SMART? Fix this</technical_language>

Target:
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) { if (CryptoCurrency.BTC.getCode().equalsIgnoreCase(cryptoCurrency)) { return new AquanowAddressValidator(); } return null; }
Source:
<code>public void handleMessage(Message message) throws Fault { if (shouldHandleMessage(message)) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(channel)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), channel); LOGGER.debug("Interceptor handles message!"); if (message instanceof SoapMessage) { final SoapMessage soapMessage = (SoapMessage) message; addSoapHeader(filteredParams, soapMessage); } else { Map<String, List<String>> responseHeaders = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS)); if (responseHeaders == null) { responseHeaders = new HashMap<String, List<String>>(); message.put(Message.PROTOCOL_HEADERS, responseHeaders); } final String contextAsHeader = httpSerializer.render(filteredParams); responseHeaders.put(TraceeConstants.HTTP_HEADER_NAME, Arrays.asList(contextAsHeader)); } } if (channel == TraceeFilterConfiguration.Channel.OutgoingResponse) { backend.clear(); <START> } <END> } }</code><technical_language>I this part in generalisation class TraceeResponseOutInterceptor</technical_language>

Target:
public void handleMessage(Message message) throws Fault { if (shouldHandleMessage(message)) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(channel)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), channel); logger.debug("Interceptor handles message!"); if (message instanceof SoapMessage) { final SoapMessage soapMessage = (SoapMessage) message; addSoapHeader(filteredParams, soapMessage); } else { Map<String, List<String>> responseHeaders = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS)); if (responseHeaders == null) { responseHeaders = new HashMap<String, List<String>>(); message.put(Message.PROTOCOL_HEADERS, responseHeaders); } final String contextAsHeader = httpSerializer.render(filteredParams); responseHeaders.put(TraceeConstants.HTTP_HEADER_NAME, Arrays.asList(contextAsHeader)); } } } }
Source:
<code>public void releasePersistenceSpaceIdentifier(PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException { ClusteredCacheIdentifier clusterCacheIdentifier = (ClusteredCacheIdentifier) identifier; <START> if (!knownPersistenceSpaces.containsKey(clusterCacheIdentifier)) { <END> throw new CachePersistenceException("Unknown identifier: " + identifier); } knownPersistenceSpaces.remove(clusterCacheIdentifier); }</code><technical_language>This replaced remove call directly: if (knownPersistenceSpaces.remove(clusterCacheIdentifier) == null)</technical_language>

Target:
public void releasePersistenceSpaceIdentifier(PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException { ClusteredCacheIdentifier clusterCacheIdentifier = (ClusteredCacheIdentifier) identifier; if (knownPersistenceSpaces.remove(clusterCacheIdentifier.getId()) == null) { throw new CachePersistenceException("Unknown identifier: " + clusterCacheIdentifier); } }
Source:
<code>protected byte[] safelyLoadFileBytes(String fileName) { InputStream fileContents; byte[] fileByteContent; try { fileContents = new FileInputStream(fileName); } catch (FileNotFoundException e1) { <START> LOG.error("Batch file not found [" + fileName + "]. " + e1.getMessage()); <END> throw new RuntimeException("Batch File not found [" + fileName + "]. " + e1.getMessage()); } try { fileByteContent = IOUtils.toByteArray(fileContents); } catch (IOException e1) { LOG.error("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); } finally { IOUtils.closeQuietly(fileContents); } return fileByteContent; }</code><technical_language>function name in log statements, I do error log statement adding actual error</technical_language>

Target:
protected byte[] safelyLoadFileBytes(String fileName) { InputStream fileContents; byte[] fileByteContent; try { fileContents = new FileInputStream(fileName); } catch (FileNotFoundException e1) { LOG.error("safelyLoadFileBytes: Batch file not found [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("Batch File not found [" + fileName + "]. " + e1.getMessage()); } try { fileByteContent = IOUtils.toByteArray(fileContents); } catch (IOException e1) { LOG.error("safelyLoadFileBytes: IO Exception loading: [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); } finally { IOUtils.closeQuietly(fileContents); } return fileByteContent; }
Source:
<code>protected File decodeBase64StringToFile( String base64String, String filePath ) { byte[] decodedBytes = Base64.getDecoder().decode( base64String ); File file = new File( filePath ); try ( FileOutputStream fos = new FileOutputStream( file ) ) { fos.write( decodedBytes ); } catch ( Exception e ) { <START> getLog().logError( " Exception writing decoded BASE64 string to file " + e.toString() ); <END> } return file; }</code><technical_language>of 2 occur here: - Opt A) throw exception ( add method signature ); generic Exception, IOException - Opt B) set file null, ends returned a null object, a corrupted If of occur, in a scenario some exception takes please, person leveraging this method of it, rely returned File object is a solid one</technical_language>

Target:
protected File decodeBase64StringToFile( String base64String, String filePath ) throws IOException { byte[] decodedBytes = Base64.getDecoder().decode( base64String ); File file = new File( filePath ); try ( FileOutputStream fos = new FileOutputStream( file ) ) { fos.write( decodedBytes ); } catch ( IOException e ) { throw e; } return file; }
Source:
<code>public int hashCode() { <START> return notificationsInfo.hashCode(); <END> }</code><technical_language>HashUtil.combineHashCodes</technical_language>

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(notificationsInfo)); }
Source:
<code>protected String createPassFile(String value) throws IOException { File temp = File.createTempFile("ovirt", ".tmp"); String filePath = temp.getAbsolutePath(); temp.setReadable(true, true); temp.setWritable(true, true); <START> temp.setExecutable(false); <END> BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(value); out.close(); return filePath; }</code><technical_language>This work. Java 6 enhancements if want *add* permissions file, if wan't remove them</technical_language>

Target:
protected String createPassFile(String value) throws IOException { File temp = File.createTempFile("ovirt", ".tmp"); String filePath = temp.getAbsolutePath(); temp.setReadable(true, true); temp.setWritable(true, true); BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(value); out.close(); return filePath; }
Source:
<code>private InstructorAttributes extractCompleteInstructor(String courseId) { InstructorCreateRequest instructorRequest = getAndValidateRequestBody(InstructorCreateRequest.class); String instructorName = instructorRequest.getName(); String instructorEmail = instructorRequest.getEmail(); <START> String instructorRole = instructorRequest.getRoleName(); <END> boolean isDisplayedToStudents = instructorRequest.getIsDisplayedToStudent(); String displayedName = instructorRequest.getDisplayName(); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToAdd = createInstructorWithBasicAttributes(courseId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToAdd); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToAdd); instructorToAdd.privileges.validatePrivileges(); return instructorToAdd; }</code><technical_language>inline of variables instructorRequest once</technical_language>

Target:
private InstructorAttributes extractCompleteInstructor(String courseId) { InstructorCreateRequest instructorRequest = getAndValidateRequestBody(InstructorCreateRequest.class); InstructorAttributes instructorToAdd = createInstructorWithBasicAttributes(courseId, instructorRequest.getName(), instructorRequest.getEmail(), instructorRequest.getRoleName(), instructorRequest.getIsDisplayedToStudent(), instructorRequest.getDisplayName()); if (instructorToAdd.getRole().equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToAdd); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToAdd); instructorToAdd.privileges.validatePrivileges(); return instructorToAdd; }
Source:
<code>public void renderFileReport(Report report) throws IOException { for (RuleViolation ruleViolation : report) { StringBuilder fullDescription = new StringBuilder(ruleViolation.getDescription()); String reason = ruleViolation.getRule().getDescription(); <START> if (!StringUtils.isEmpty(reason)) { <END> fullDescription.append("\n").append(reason); } String url = ruleViolation.getRule().getExternalInfoUrl(); if (!StringUtils.isEmpty(url)) { fullDescription.append("\n").append(url); } reviewResult.add(new Violation(ruleViolation.getFilename(), ruleViolation.getBeginLine(), fullDescription.toString(), convert(ruleViolation.getRule().getPriority()))); } }</code><technical_language>is a isNotEmpty - isNotBlank method</technical_language>

Target:
public void renderFileReport(Report report) throws IOException { boolean addDetails = Boolean.valueOf(ConfigurationHolder.instance(). getProperty(GeneralOption.VOLATIONS_WITH_DETAILS)); for (RuleViolation ruleViolation : report) { StringBuilder fullDescription = new StringBuilder(ruleViolation.getDescription()); if (addDetails) { fullDescription.append(extractDetailsFromViolation(ruleViolation)); } reviewResult.add(new Violation(ruleViolation.getFilename(), ruleViolation.getBeginLine(), fullDescription.toString(), convert(ruleViolation.getRule().getPriority()))); } }