auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void initOAuthClient() { authenticatedClient = JerseyClientHelper.clientBuilder() .setRedirectsEnabled(false) .setCredentials("Administrator", "Administrator") .build(); client = JerseyClientHelper.clientBuilder() .setRedirectsEnabled(false) .setConnectionRequestTimeout(500000) .setSocketTimeout(500000) <START> .setConnectTimeout(500000) <END> .build(); transientStore = (TransientStoreProvider) transientStoreService.getStore(AuthorizationRequest.STORE_NAME); tokenStore = new OAuth2TokenStore(TOKEN_SERVICE); }</code><technical_language>I setting timeouts required in this test, especially default is 60 seconds</technical_language>

Target:
public void initOAuthClient() { authenticatedClient = JerseyClientHelper.clientBuilder() .setRedirectsEnabled(false) .setCredentials("Administrator", "Administrator") .build(); client = JerseyClientHelper.clientBuilder().setRedirectsEnabled(false).build(); transientStore = (TransientStoreProvider) transientStoreService.getStore(AuthorizationRequest.STORE_NAME); tokenStore = new OAuth2TokenStore(TOKEN_SERVICE); }
Source:
<code>private void detectIndexChanges() { if (isBare()) { return; } File indexFile = getIndexFile(); boolean notify = false; <START> synchronized (this) { <END> if (snapshot == null) { snapshot = FileSnapshot.save(indexFile); } else if (snapshot.isModified(indexFile)) { notify = true; } } if (notify) { notifyIndexChanged(false); } }</code><technical_language>explicit ReentrantLock for this? way, mutual exclusion conflict else a 'synchronized (repo)' block for reason</technical_language>

Target:
private void detectIndexChanges() { if (isBare()) { return; } File indexFile = getIndexFile(); lock.lock(); try { if (snapshot == null) { snapshot = FileSnapshot.save(indexFile); } else if (snapshot.isModified(indexFile)) { notifyIndexChanged(false); } } finally { if (lock.isHeldByCurrentThread()) { lock.unlock(); } } }
Source:
<code>public boolean isTriggerExpired() { <START> isExpired = isExpired || expireCondition.isMet(); <END> return isExpired; }</code><technical_language>This is counterintuitive. do need reassign isExpired? expireCondition.isMet() false returning true</technical_language>

Target:
public boolean isTriggerExpired() { return expireCondition.isMet(); }
Source:
<code>public ConfigXml(Context context) { mConfigFile = getConfigFile(context); boolean isFirstStart = !mConfigFile.exists(); if (isFirstStart) { Log.i(TAG, "App started for the first time. Generating keys and config."); generateKeysConfig(context); } <START> for (int i = 0; i < 10; i++) { <END> try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); mConfig = db.parse(mConfigFile); } catch (SAXException | ParserConfigurationException | IOException e) { Log.w(TAG, "Failed to open config, moving to " + INVALID_CONFIG_FILE + " and creating blank config"); File dest = new File(mConfigFile.getParent(), INVALID_CONFIG_FILE); if (dest.exists()) dest.delete(); mConfigFile.renameTo(dest); generateKeysConfig(context); isFirstStart = true; mConfigFile = getConfigFile(context); } if (mConfig != null) break; } if (mConfig == null) { Log.i(TAG, "Failed to set up config file"); Toast.makeText(context, "Failed to set up config file", Toast.LENGTH_LONG).show(); return; } if (isFirstStart) { changeDefaultFolder(); } updateIfNeeded(); }</code><technical_language>This sense, a seperate commit/pr</technical_language>

Target:
public ConfigXml(Context context) { mConfigFile = getConfigFile(context); boolean isFirstStart = !mConfigFile.exists(); if (isFirstStart) { Log.i(TAG, "App started for the first time. Generating keys and config."); generateKeysConfig(context); } do { try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); mConfig = db.parse(mConfigFile); } catch (SAXException | ParserConfigurationException | IOException e) { Log.w(TAG, "Failed to open config, moving to " + INVALID_CONFIG_FILE + " and creating blank config"); File dest = new File(mConfigFile.getParent(), INVALID_CONFIG_FILE); if (dest.exists()) dest.delete(); mConfigFile.renameTo(dest); generateKeysConfig(context); isFirstStart = true; mConfigFile = getConfigFile(context); } } while (mConfig == null); if (isFirstStart) { changeDefaultFolder(); } updateIfNeeded(); }
Source:
<code>public int getBaseTime() { int time = 0; if (campaign.getCampaignOptions().useAeroSystemHits()) { time = 120; if (unit != null && unit.getEntity().hasNavalC3()) { time *= 2; } if (hits == 1) { <START> time *= 1; <END> } if (hits == 2) { time *= 2; } return time; } if(isSalvaging()) { time = 4320; } else { time = 120; } return time; }</code><technical_language>is this needed</technical_language>

Target:
public int getBaseTime() { int time = 0; if (campaign.getCampaignOptions().useAeroSystemHits()) { time = 120; if (unit != null && unit.getEntity().hasNavalC3()) { time *= 2; } if (hits == 2) { time *= 2; } return time; } if(isSalvaging()) { time = 4320; } else { time = 120; } return time; }
Source:
<code>public void loadDimensionIterable(Iterable<String> oldDimensionOrder) { int i = 0; for (String dim : oldDimensionOrder) { dimensionOrder.put(dim, i); <START> dimensions.add(dim); <END> dimValues.add(dim); } }</code><technical_language>do need check id dimension is present in dimValues</technical_language>

Target:
public void loadDimensionIterable(Iterable<String> oldDimensionOrder) { synchronized (dimensionDescs) { if (!dimensionDescs.isEmpty()) { throw new ISE("Cannot load dimension order when existing order[%s] is not empty.", dimensionDescs.keySet()); } for (String dim : oldDimensionOrder) { if (dimensionDescs.get(dim) == null) { ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl(); capabilities.setType(ValueType.STRING); columnCapabilities.put(dim, capabilities); DimensionDesc desc = new DimensionDesc(dimensionDescs.size(), dim, newDimDim(dim), capabilities); dimensionDescs.put(dim, desc); } } } }
Source:
<code>private String renderPopoverJs() { StringBuilder builder = new StringBuilder(); builder.append("var popup = " + getJsId() + ";"); builder.append("var element = popup.getElement();"); builder.append("$(element).popover('destroy');"); builder.append("popup.setPosition(" + position.renderJs() + ");"); builder.append("$(element).popover({"); if (titleModel != null) { builder.append("'title': '" + Strings.escapeMarkup(titleModel.getObject()) + "',"); } if (placement != null) { builder.append("'placement': '" + placement + "',"); } if (html != null) { builder.append("'html': '" + html + "',"); } <START> if (html != null) { <END> builder.append("'content': '" + Strings.escapeMarkup(model.getObject()) + "',"); } builder.append("});"); return builder.toString(); }</code><technical_language>copy/paste error this model</technical_language>

Target:
private String renderPopoverJs() { StringBuilder builder = new StringBuilder(); builder.append("var popup = " + getJsId() + ";"); builder.append("var element = popup.getElement();"); builder.append("$(element).popover('destroy');"); builder.append("popup.setPosition(" + position.renderJs() + ");"); builder.append("$(element).popover({"); if (titleModel != null) { builder.append("'title': '" + escapeQuoteJs(titleModel.getObject()) + "',"); } if (placement != null) { builder.append("'placement': '" + placement + "',"); } builder.append("'html': '" + html + "',"); if (html) { builder.append("'content': '" + escapeQuoteJs(model.getObject()) + "',"); } else { builder.append("'content': '" + Strings.escapeMarkup(model.getObject()) + "',"); } builder.append("});"); return builder.toString(); }
Source:
<code>public List<UserLotteryPrizeView> findUserLotteryPrizeViewsByHeadlinesToday(String mobile,LotteryPrize selectPrize,ActivityCategory prizeType,Date startTime,Date endTime,Integer index,Integer pageSize, String authenticationType){ List<UserLotteryPrizeView> lotteryPrizeViewList = userLotteryPrizeMapper.findUserLotteryPrizeViews(mobile, selectPrize, prizeType, startTime, endTime, index, pageSize); if(authenticationType.equals("0")){ return lotteryPrizeViewList.stream() .filter(userLotteryPrizeView -> Strings.isNullOrEmpty(userLotteryPrizeView.getUserName())) .collect(Collectors.toList()); } else if(authenticationType.equals("1")){ return lotteryPrizeViewList.stream() .filter(userLotteryPrizeView -> !Strings.isNullOrEmpty(userLotteryPrizeView.getUserName())) .collect(Collectors.toList()); } <START> lotteryPrizeViewList = Lists.transform(lotteryPrizeViewList, userLotteryPrizeView -> { <END> userLotteryPrizeView.setInvestFlag(investMapper.sumSuccessInvestCountByLoginName(userLotteryPrizeView.getLoginName()) > 0 ? "是" : "否"); return userLotteryPrizeView; }); return lotteryPrizeViewList; }</code><technical_language>check</technical_language>

Target:
public List<UserLotteryPrizeView> findUserLotteryPrizeViewsByHeadlinesToday(String mobile, LotteryPrize selectPrize, ActivityCategory prizeType, Date startTime, Date endTime, Integer index, Integer pageSize, String authenticationType) { List<UserLotteryPrizeView> lotteryPrizeViewList = userLotteryPrizeMapper.findUserLotteryPrizeViews(mobile, selectPrize, prizeType, startTime, endTime, index, pageSize); return lotteryPrizeViewList.stream() .filter((UserLotteryPrizeView userLotteryPrizeView) -> isSpecialAuthType(authenticationType, userLotteryPrizeView)) .map(userLotteryPrizeView -> { userLotteryPrizeView.setInvestFlag(investMapper.sumSuccessInvestCountByLoginName(userLotteryPrizeView.getLoginName()) > 0 ? "是" : "否"); return userLotteryPrizeView; }).collect(Collectors.toList()); }
Source:
<code><START> public static String encode(String s, Charset enc) { <END> try { return encode(s, enc.displayName()); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }</code><technical_language>This approach implement this method is wrong. primary logic in this method, while (that takes charset name) delegate this method</technical_language>

Target:
public static String encode(String s, Charset enc) { Objects.requireNonNull(s); Objects.requireNonNull(enc); StringBuffer buf = new StringBuffer(s.length() + 16); int start = -1; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9' || " .-*_".indexOf(ch) > -1) { if (start >= 0) { convert(s.substring(start, i), buf, enc); start = -1; } if (ch != ' ') { buf.append(ch); } else { buf.append('+'); } } else { if (start < 0) { start = i; } } } if (start >= 0) { convert(s.substring(start), buf, enc); } return buf.toString(); }
Source:
<code>private boolean areChangesSubmittable(List<ChangeData> changes, IdentifiedUser identifiedUser) { for (ChangeData c : changes) { try { ChangeControl changeControl = c.changeControl().forUser( identifiedUser); if (!changeControl.canSubmit()) { return false; } } catch (OrmException e) { log.error("Failed to get a ChangeControl for Change.Id " + String.valueOf(c.getId()), e); return false; } } for (ChangeData c : changes) { try { checkSubmitRule(c, c.currentPatchSet(), false); <START> } catch (OrmException | ResourceConflictException e) { <END> return false; } } return true; }</code><technical_language>Merge this loop above. return false a ResourceConflictException. OrmException logged, change log message a more generic</technical_language>

Target:
private String areChangesSubmittable(List<ChangeData> changes, IdentifiedUser identifiedUser) { for (ChangeData c : changes) { try { ChangeControl changeControl = c.changeControl().forUser( identifiedUser); if (!changeControl.isVisible(dbProvider.get())) { return submitTopicTooltipHiddenBlocked; } if (!changeControl.canSubmit()) { return submitTopicTooltipBlocked; } checkSubmitRule(c, c.currentPatchSet(), false); } catch (OrmException e) { log.error(String.valueOf(e)); throw new OrmRuntimeException(e); } catch (ResourceConflictException e) { return submitTopicTooltipBlocked; } } return null; }
Source:
<code>public <Q, R> Stream<QueryResponseMessage<R>> scatterGather(QueryMessage<Q, R> query, long timeout, TimeUnit unit) { MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query); QueryMessage<Q, R> interceptedQuery = intercept(query); List<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery); if (handlers.isEmpty()) { monitorCallback.reportIgnored(); return Stream.empty(); } long deadline = System.currentTimeMillis() + unit.toMillis(timeout); return handlers.stream() .map(handler -> { try { long leftTimeout = deadline - System.currentTimeMillis(); <START> leftTimeout = leftTimeout < 0 ? 0 : leftTimeout; <END> QueryResponseMessage<R> response = interceptAndInvoke(DefaultUnitOfWork.startAndGet(interceptedQuery), handler) .get(leftTimeout, TimeUnit.MILLISECONDS); monitorCallback.reportSuccess(); return response; } catch (Exception e) { monitorCallback.reportFailure(e); errorHandler.onError(e, interceptedQuery, handler); return null; } }).filter(Objects::nonNull); }</code><technical_language>Nit: move this timeout check a separate function, in ObjectUtils similar? Checking operation sense for, I a cleaner if is wrapped in a descriptive function</technical_language>

Target:
public <Q, R> Stream<QueryResponseMessage<R>> scatterGather(QueryMessage<Q, R> query, long timeout, TimeUnit unit) { MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query); QueryMessage<Q, R> interceptedQuery = intercept(query); List<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery); if (handlers.isEmpty()) { monitorCallback.reportIgnored(); return Stream.empty(); } long deadline = System.currentTimeMillis() + unit.toMillis(timeout); return handlers.stream() .map(handler -> { try { long leftTimeout = getRemainingOfDeadline(deadline); QueryResponseMessage<R> response = interceptAndInvoke(DefaultUnitOfWork.startAndGet(interceptedQuery), handler) .get(leftTimeout, TimeUnit.MILLISECONDS); monitorCallback.reportSuccess(); return response; } catch (Exception e) { monitorCallback.reportFailure(e); errorHandler.onError(e, interceptedQuery, handler); return null; } }).filter(Objects::nonNull); }
Source:
<code>public ProxyUtil(Class<O> interfaceClazz, ClassLoader parentClassLoader) { this.interfaceClazz = interfaceClazz; this.parentClassLoader = parentClassLoader; <START> this.cachedClassLoaders = new HashMap<>(); <END> }</code><technical_language>want ConcurrentHashMap for thread safety adding classloaders this map</technical_language>

Target:
public ProxyUtil(Class<O> interfaceClazz, ClassLoader parentClassLoader) { this.interfaceClazz = interfaceClazz; this.parentClassLoader = parentClassLoader; this.cachedClassLoaders = new ConcurrentHashMap<>(); }
Source:
<code>private SearchParameters getSearchParameters(SearchType searchType, String constraint) { SearchParameters searchParams = new SearchParameters(constraint, searchType); HashMap<String, String> queryConstraints = QueryHelper.getQueryConstraints(getUriInfo(), FROM_CONSTRAINT_PARAMETER); HashMap<String, String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), CASE_SENSITIVE_CONSTRAINT_PARAMETER); if (queryConstraints.containsKey(FROM_CONSTRAINT_PARAMETER)) { try { searchParams.setSearchFrom(Long.parseLong(queryConstraints.get(FROM_CONSTRAINT_PARAMETER))); } catch (Exception ex) { LOG.error("Unwrapping of '"+FROM_CONSTRAINT_PARAMETER+"' search parameter failed.", ex); } } if (matrixConstraints.containsKey(CASE_SENSITIVE_CONSTRAINT_PARAMETER)) { try { searchParams.setCaseSensitive(Boolean.parseBoolean(matrixConstraints.get(CASE_SENSITIVE_CONSTRAINT_PARAMETER))); } catch (Exception ex) { LOG.error("Unwrapping of '"+CASE_SENSITIVE_CONSTRAINT_PARAMETER+"' search parameter failed.", ex); } } if (QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { <START> searchParams.setMaxCount(getMaxResults()); <END> } return searchParams; }</code><technical_language>this handle Integer.MAX_VALUE convertible int</technical_language>

Target:
private SearchParameters getSearchParameters(SearchType searchType, String constraint) { SearchParameters searchParams = new SearchParameters(constraint, searchType); HashMap<String, String> queryConstraints = QueryHelper.getQueryConstraints(getUriInfo(), FROM_CONSTRAINT_PARAMETER); HashMap<String, String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), CASE_SENSITIVE_CONSTRAINT_PARAMETER); if (queryConstraints.containsKey(FROM_CONSTRAINT_PARAMETER)) { try { searchParams.setSearchFrom(Long.parseLong(queryConstraints.get(FROM_CONSTRAINT_PARAMETER))); } catch (Exception ex) { LOG.error("Unwrapping of '"+FROM_CONSTRAINT_PARAMETER+"' search parameter failed.", ex); } } if (matrixConstraints.containsKey(CASE_SENSITIVE_CONSTRAINT_PARAMETER)) { try { searchParams.setCaseSensitive(Boolean.parseBoolean(matrixConstraints.get(CASE_SENSITIVE_CONSTRAINT_PARAMETER))); } catch (Exception ex) { LOG.error("Unwrapping of '"+CASE_SENSITIVE_CONSTRAINT_PARAMETER+"' search parameter failed.", ex); } } if (QueryHelper.hasMatrixParam(getUriInfo(), MAX) && getMaxResults()!=NO_LIMIT) { searchParams.setMaxCount(getMaxResults()); } return searchParams; }
Source:
<code>public Block copyPositions(int[] positions, int offset, int length) { checkValidPositions(positions, offset, length, positionCount); <START> int finalLength = 0; <END> for (int i = offset; i < offset + length; ++i) { finalLength += getSliceLength(positions[i]); } SliceOutput newSlice = Slices.allocate(finalLength).getOutput(); int[] newOffsets = new int[length + 1]; boolean[] newValueIsNull = new boolean[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isEntryNull(position)) { newValueIsNull[i] = true; } else { newSlice.appendBytes(slice.getBytes(getPositionOffset(position), getSliceLength(position))); } newOffsets[i + 1] = newSlice.size(); } return new VariableWidthBlock(length, newSlice.slice(), newOffsets, newValueIsNull); }</code><technical_language>nit: do: int finalLength = stream(positions, offset, offset+length).sum();</technical_language>

Target:
public Block copyPositions(int[] positions, int offset, int length) { checkValidPositions(positions, offset, length, positionCount); int finalLength = stream(positions, offset, offset + length) .map(this::getSliceLength) .sum(); SliceOutput newSlice = Slices.allocate(finalLength).getOutput(); int[] newOffsets = new int[length + 1]; boolean[] newValueIsNull = new boolean[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isEntryNull(position)) { newValueIsNull[i] = true; } else { newSlice.appendBytes(slice.getBytes(getPositionOffset(position), getSliceLength(position))); } newOffsets[i + 1] = newSlice.size(); } return new VariableWidthBlock(length, newSlice.slice(), newOffsets, newValueIsNull); }
Source:
<code>private boolean basePosUpdated(TpeContext oldCtx, TpeContext newCtx) { SPTarget oldBasePos = oldCtx.targets().baseOrNull(); SPTarget newBasePos = newCtx.targets().baseOrNull(); if (newBasePos == null) return oldBasePos != null; if (oldBasePos == null) return true; ITarget oldBase = oldBasePos.getTarget(); ITarget newBase = newBasePos.getTarget(); Option<Long> oldWhen = oldCtx.schedulingBlockJava().map(SchedulingBlock::start); Option<Long> newWhen = oldCtx.schedulingBlockJava().map(SchedulingBlock::start); <START> return (oldBase.getRaDegrees(oldWhen) != newBase.getRaDegrees(newWhen) || <END> oldBase.getDecDegrees(oldWhen) != newBase.getDecDegrees(newWhen)); }</code><technical_language>equals</technical_language>

Target:
private boolean basePosUpdated(TpeContext oldCtx, TpeContext newCtx) { SPTarget oldBasePos = oldCtx.targets().baseOrNull(); SPTarget newBasePos = newCtx.targets().baseOrNull(); if (newBasePos == null) return oldBasePos != null; if (oldBasePos == null) return true; ITarget oldBase = oldBasePos.getTarget(); ITarget newBase = newBasePos.getTarget(); Option<Long> oldWhen = oldCtx.schedulingBlockJava().map(SchedulingBlock::start); Option<Long> newWhen = newCtx.schedulingBlockJava().map(SchedulingBlock::start); return (!(oldBase.getRaDegrees(oldWhen).equals(newBase.getRaDegrees(newWhen)) && oldBase.getDecDegrees(oldWhen).equals(newBase.getDecDegrees(newWhen))); }
Source:
<code>public boolean conforms() { <START> return in().numDimensions() == 2; <END> }</code><technical_language>check for Integer.MAX_VALUE entries</technical_language>

Target:
public boolean conforms() { if (in().numDimensions() == 2) { long max_dist = in().dimension(0) * in().dimension(0) + in().dimension(1) * in().dimension(1); return ((in().numDimensions() == 2) && (max_dist <= Integer.MAX_VALUE)); } return false; }
Source:
<code>private void handleInetSockLocalOut(ITmfEvent event) { <START> Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); <END> if (cpuObj == null) { throw new NullPointerException(); } Integer cpu = (Integer) cpuObj; String host = event.getTrace().getHostId(); LttngInterruptContext intCtx = fSystem.peekContextStack(host, cpu); Context context = intCtx.getContext(); LttngWorker sender = null; if (context == Context.NONE) { sender = fSystem.getWorkerOnCpu(event.getTrace().getHostId(), cpu); } else if (context == Context.SOFTIRQ) { sender = getOrCreateKernelWorker(event, cpu); } if (sender == null) { return; } TmfVertex endpoint = stateExtend(sender, event.getTimestamp().getValue()); fTcpNodes.put(event, endpoint); fTcpMatching.matchEvent(event, event.getTrace(), new NullProgressMonitor()); }</code><technical_language>checkNotNull</technical_language>

Target:
private void handleInetSockLocalOut(ITmfEvent event) { Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpuObj == null) { throw new NullPointerException(); } Integer cpu = (Integer) cpuObj; String host = event.getTrace().getHostId(); LttngSystemModel system = getProvider().getSystem(); LttngInterruptContext intCtx = system.peekContextStack(host, cpu); Context context = intCtx.getContext(); LttngWorker sender = null; if (context == Context.NONE) { sender = system.getWorkerOnCpu(event.getTrace().getHostId(), cpu); } else if (context == Context.SOFTIRQ) { sender = getOrCreateKernelWorker(event, cpu); } if (sender == null) { return; } TmfVertex endpoint = stateExtend(sender, event.getTimestamp().getValue()); fTcpNodes.put(event, endpoint); fTcpMatching.matchEvent(event, event.getTrace(), new NullProgressMonitor()); }
Source:
<code>protected void mergeOptions(FieldMapper other, List<String> conflicts) { if (this.enablePositionIncrements != ((TokenCountFieldMapper)other).enablePositionIncrements) { conflicts.add("mapper [" + name() + "] has a different [enable_position_increments] setting"); } if (Objects.equals(this.nullValue, ((TokenCountFieldMapper)other).nullValue) == false) { conflicts.add("mapper [" + name() + "] has a different [null_value] setting"); <START> } <END> this.analyzer = ((TokenCountFieldMapper)other).analyzer; }</code><technical_language>for info, newly introduced checks moved</technical_language>

Target:
protected void mergeOptions(FieldMapper other, List<String> conflicts) { if (this.enablePositionIncrements != ((TokenCountFieldMapper)other).enablePositionIncrements) { conflicts.add("mapper [" + name() + "] has a different [enable_position_increments] setting"); } this.analyzer = ((TokenCountFieldMapper)other).analyzer; }
Source:
<code>public void setMaxPerRepository(String repository, int max) { if (max > 0) { HttpRoute httpRoute = getHttpRouteFromRepository(repository); poolingHttpClientConnectionManager.setMaxPerRoute(httpRoute, max); } else { <START> LOGGER.warn("Not setting max repository connections to as it is no positive value", max); <END> } }</code><technical_language>loggers lowercase. mind checking rest of code aross pull request for similar ones? Thanks! :) suggestion LOGGER.warn("Not setting max repository connections is positive value", max);</technical_language>

Target:
public void setMaxPerRepository(String repository, int max) { if (max > 0) { HttpRoute httpRoute = getHttpRouteFromRepository(repository); poolingHttpClientConnectionManager.setMaxPerRoute(httpRoute, max); } else { logger.warn("Not setting max repository connections to as it is no positive value", max); } }
Source:
<code>static long calculateRocksDBDefaultArenaBlockSize(long writeBufferSize) { long arenaBlockSize = writeBufferSize / 8; <START> long align = 4 * 1024; return ((arenaBlockSize + align - 1) / align) * align; <END> }</code><technical_language>suggestion // Align 4k final long align = 4 * 1024; return ((arenaBlockSize + align - 1) / align) * align; Marking primitive variable final a constant variable compiler do optimization, please check [here](<LINK_0> for more details. a class-level static final field, keeping maps RocksDB code</technical_language>

Target:
static long calculateRocksDBDefaultArenaBlockSize(long writeBufferSize) { long arenaBlockSize = writeBufferSize / 8; final long align = 4 * 1024; return ((arenaBlockSize + align - 1) / align) * align; }
Source:
<code><START> OpenVRState() { <END> for (int c = 0; c < 2; c++) { lastControllerState[c] = new VRControllerState_t(); controllerPose[c] = new Matrix4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); eyePoses[c] = new Matrix4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); projectionMatrices[c] = new Matrix4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); for (int i = 0; i < 5; i++) { lastControllerState[c].rAxis[i] = new VRControllerAxis_t(); } } }</code><technical_language>Package private constructor, public</technical_language>

Target:
public OpenVRState() { for (int handIndex = 0; handIndex < 2; handIndex++) { lastControllerState[handIndex] = new VRControllerState_t(); controllerPose[handIndex] = OpenVRUtil.createIdentityMatrix4f(); eyePoses[handIndex] = OpenVRUtil.createIdentityMatrix4f(); projectionMatrices[handIndex] = OpenVRUtil.createIdentityMatrix4f(); for (int i = 0; i < 5; i++) { lastControllerState[handIndex].rAxis[i] = new VRControllerAxis_t(); } } }
Source:
<code>public Object execute(final ExecutionEvent event) { final ImageBuild wizard = new ImageBuild(); final WizardDialog wizardDialog = new NonModalWizardDialog(HandlerUtil.getActiveShell(event), wizard); wizardDialog.create(); IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage activePage = null; IWorkbenchPart activePart = null; if (window != null) activePage = window.getActivePage(); if (activePage != null) activePart = activePage.getActivePart(); connection = CommandUtils.getCurrentConnection(activePart); if (connection == null) { IDockerConnection[] connections = DockerConnectionManager .getInstance().getConnections(); if (connections.length > 0) connection = connections[0]; } if (connection == null || <START> connection.isOpen()) <END> { Display.getDefault().syncExec(() -> MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(), WizardMessages.getString("ErrorNoActiveConnection.msg"), WizardMessages.getString("ErrorNoActiveConnection.desc"))); return null; } final boolean buildImage = wizardDialog.open() == Window.OK; if (buildImage) { performBuildImage(wizard); } return null; }</code><technical_language>wrong here. Initially this, 'connection.getState() != EnumDockerConnectionState.ESTABLISHED', I suggested '! connection.isOpen()'. connection.isOpen() negation is missing. Is this a typo is a reason for change in logic.</technical_language>

Target:
public Object execute(final ExecutionEvent event) { final ImageBuild wizard = new ImageBuild(); final WizardDialog wizardDialog = new NonModalWizardDialog(HandlerUtil.getActiveShell(event), wizard); wizardDialog.create(); IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage activePage = null; IWorkbenchPart activePart = null; if (window != null) activePage = window.getActivePage(); if (activePage != null) activePart = activePage.getActivePart(); connection = CommandUtils.getCurrentConnection(activePart); if (connection == null) { IDockerConnection[] connections = DockerConnectionManager .getInstance().getConnections(); if (connections.length > 0) connection = connections[0]; } if (connection == null || !connection.isOpen()) { Display.getDefault().syncExec(() -> MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(), WizardMessages.getString("ErrorNoActiveConnection.msg"), WizardMessages.getString("ErrorNoActiveConnection.desc"))); return null; } final boolean buildImage = wizardDialog.open() == Window.OK; if (buildImage) { performBuildImage(wizard); } return null; }
Source:
<code>public void executeCommand(CommandSender sender, List<String> arguments) { Set<OfflinePlayer> bannedPlayers = bukkitService.getBannedPlayers(); Set<String> namedBanned = new HashSet<>(bannedPlayers.size()); for (OfflinePlayer offlinePlayer : bannedPlayers) { namedBanned.add(offlinePlayer.getName()); } <START> purgeService.purgePlayers(sender, namedBanned, bannedPlayers.toArray(new OfflinePlayer[0])); <END> }</code><technical_language>Please revert. I IntelliJ warning Java create array generically reflection literally size beforehand</technical_language>

Target:
public void executeCommand(CommandSender sender, List<String> arguments) { Set<OfflinePlayer> bannedPlayers = bukkitService.getBannedPlayers(); Set<String> namedBanned = new HashSet<>(bannedPlayers.size()); for (OfflinePlayer offlinePlayer : bannedPlayers) { namedBanned.add(offlinePlayer.getName()); } purgeService.purgePlayers(sender, namedBanned, bannedPlayers.toArray(new OfflinePlayer[bannedPlayers.size()])); }
Source:
<code>public void run() { <START> ch.qos.logback.core.rolling.RollingFileAppender appender = null; <END> ch.qos.logback.classic.Logger logger = initLogger("metricsLogger"); try { createDirs(stateDirPath); createFile(stateDirPath + "/" + metricsFileName); appender = initAppender(stateDirPath.getAbsolutePath(), metricsFileName); writeMetricsHeader(logger, appender); while (isRunning()) { Thread.sleep(metricsSleepInterval); String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()); writeMetrics(logger, appender, currentDate); resetMetrics(); } } catch (InterruptedException e) { LOG.debug("Metric Processor was interrupted"); } finally { if (appender != null) { String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()); writeMetrics(logger, appender, currentDate); appender.stop(); } } LOG.info("Metrics Processor stopped"); }</code><technical_language>need full class name? in import</technical_language>

Target:
public void run() { RollingFileAppender appender = null; ch.qos.logback.classic.Logger logger = initLogger("metricsLogger"); try { createDirs(stateDirPath); createFile(stateDirPath + "/" + metricsFileName); appender = initAppender(stateDirPath.getAbsolutePath(), metricsFileName); writeMetricsHeader(logger, appender); while (isRunning()) { Thread.sleep(metricsSleepInterval); String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()); writeMetrics(logger, appender, currentDate); resetMetrics(); } } catch (InterruptedException e) { LOG.debug("Metric Processor was interrupted"); } finally { if (appender != null) { String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()); writeMetrics(logger, appender, currentDate); appender.stop(); } } LOG.info("Metrics Processor stopped"); }
Source:
<code>public void execute() throws TranslatorException { String path = this.visitor.getParquetPath(); <START> if(this.visitor.getTable().getProperty(ParquetMetadataProcessor.PARTITIONING_SCHEME) != null && this.visitor.getTable().getProperty(ParquetMetadataProcessor.PARTITIONING_SCHEME).equals("directory")){ <END> path += getDirectoryPath(this.visitor.getColumnPredicates(), this.visitor.getTable().getProperty(ParquetMetadataProcessor.PARTITIONED_COLUMNS)); } this.parquetFiles = VirtualFileConnection.Util.getFiles(path, this.connection, true); VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile != null) { this.rowIterator = readParquetFile(nextParquetFile); } }</code><technical_language>For partitioning scheme default assuming current directory scheme. if partitioning columns specified, require partitioning scheme</technical_language>

Target:
public void execute() throws TranslatorException { String path = this.visitor.getParquetPath(); if(this.visitor.getTable().getProperty(ParquetMetadataProcessor.PARTITIONED_COLUMNS) != null) { path += getDirectoryPath(this.visitor.getColumnPredicates(), this.visitor.getTable().getProperty(ParquetMetadataProcessor.PARTITIONED_COLUMNS)); } this.parquetFiles = VirtualFileConnection.Util.getFiles(path, this.connection, true, false); VirtualFile nextParquetFile = getNextParquetFile(); if (nextParquetFile != null) { this.rowIterator = readParquetFile(nextParquetFile); } }
Source:
<code>public InterpreterResult internalInterpret(String cmd, InterpreterContext context) { this.intpContext = context; TerminalManager.getInstance().setInterpreterContext(context); if (null == terminalThread) { try { terminalPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); terminalThread = new TerminalThread(terminalPort); terminalThread.start(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); return new InterpreterResult(Code.ERROR, e.getMessage()); } for (int i = 0; i < 10 && !terminalThread.isRunning(); i++) { try { LOGGER.info("loop = " + i); Thread.sleep(500); } catch (InterruptedException e) { LOGGER.error(e.getMessage(), e); } } if (!terminalThread.isRunning()) { LOGGER.error("Terminal interpreter can not running!"); } } setParagraphConfig(); Properties properties = getProperties(); String strIpMapping = properties.getProperty("zeppelin.terminal.ip.mapping"); if (!StringUtils.isEmpty(strIpMapping)) { <START> Gson gson = new Gson(); <END> mapIpMapping = gson.fromJson(strIpMapping, new TypeToken<Map<String, String>>(){}.getType()); } createTerminalDashboard(context.getNoteId(), context.getParagraphId(), terminalPort); return new InterpreterResult(Code.SUCCESS); }</code><technical_language>gson a static variable need create for call</technical_language>

Target:
public InterpreterResult internalInterpret(String cmd, InterpreterContext context) { this.intpContext = context; TerminalManager.getInstance().setInterpreterContext(context); if (null == terminalThread) { try { terminalPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces(); terminalThread = new TerminalThread(terminalPort); terminalThread.start(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); return new InterpreterResult(Code.ERROR, e.getMessage()); } for (int i = 0; i < 10 && !terminalThread.isRunning(); i++) { try { LOGGER.info("loop = " + i); Thread.sleep(500); } catch (InterruptedException e) { LOGGER.error(e.getMessage(), e); } } if (!terminalThread.isRunning()) { LOGGER.error("Terminal interpreter can not running!"); } } setParagraphConfig(); Properties properties = getProperties(); String strIpMapping = properties.getProperty("zeppelin.terminal.ip.mapping"); if (!StringUtils.isEmpty(strIpMapping)) { mapIpMapping = gson.fromJson(strIpMapping, new TypeToken<Map<String, String>>(){}.getType()); } createTerminalDashboard(context.getNoteId(), context.getParagraphId(), terminalPort); return new InterpreterResult(Code.SUCCESS); }
Source:
<code>public void replacesTypeWithJson() throws Exception { MatcherAssert.assertThat( new RsPrint( <START> new RsWithType.JSON(new RsWithType(new RsEmpty(), TYPE_XML)) <END> ).print(), Matchers.equalTo( Joiner.on(CRLF).join( HTTP_OK, String.format(CONTENT_TYPE, TYPE_JSON), "", "" ) ) ); MatcherAssert.assertThat( new RsPrint( new RsWithType.JSON( new RsWithType(new RsEmpty(), TYPE_XML), StandardCharsets.ISO_8859_1 ) ).print(), Matchers.equalTo( Joiner.on(CRLF).join( HTTP_OK, String.format( CONTENT_TYPE_WITH_CHARSET, TYPE_JSON, StandardCharsets.ISO_8859_1 ), "", "" ) ) ); }</code><technical_language>@essobedo TYPE_XML in JSON test</technical_language>

Target:
public void replacesTypeWithJson() throws Exception { MatcherAssert.assertThat( new RsPrint( new RsWithType.JSON( new RsWithType(new RsEmpty(), RsWithTypeTest.TYPE_XML) ) ).print(), Matchers.equalTo( Joiner.on(RsWithTypeTest.CRLF).join( RsWithTypeTest.HTTP_OK, String.format( RsWithTypeTest.CONTENT_TYPE, RsWithTypeTest.TYPE_JSON ), "", "" ) ) ); MatcherAssert.assertThat( new RsPrint( new RsWithType.JSON( new RsWithType(new RsEmpty(), RsWithTypeTest.TYPE_XML), StandardCharsets.ISO_8859_1 ) ).print(), Matchers.equalTo( Joiner.on(RsWithTypeTest.CRLF).join( RsWithTypeTest.HTTP_OK, String.format( RsWithTypeTest.TYPE_WITH_CHARSET, RsWithTypeTest.TYPE_JSON, StandardCharsets.ISO_8859_1 ), "", "" ) ) ); }
Source:
<code>public boolean isUserCompaction() { <START> return userCompaction; <END> }</code><technical_language>A sanity check in isFullMajorCompaction() checks if scope is majc nice</technical_language>

Target:
public boolean isUserCompaction() { if (scope != IteratorScope.majc) throw new IllegalStateException( "Asked about user initiated compaction type when scope is " + scope); return userCompaction; }
Source:
<code>private static int computeRequiredBufferNum(int numChildNodes, int combineDegree) { final int numChildrenForLastNode = numChildNodes % combineDegree; <START> final int numCurLevelNodes = numChildNodes / combineDegree + (numChildrenForLastNode > 1 ? 1 : 0); <END> final int numChildOfParentNodes = numCurLevelNodes + (numChildrenForLastNode == 1 ? 1 : 0); if (numChildOfParentNodes == 1) { return numCurLevelNodes; } else { return numCurLevelNodes + computeRequiredBufferNum(numChildOfParentNodes, combineDegree); } }</code><technical_language>combineDegree - 1 instead of hard-coded 1 here</technical_language>

Target:
private int computeRequiredBufferNum(int numChildNodes, int combineDegree) { final int numChildrenForLastNode = numChildNodes % combineDegree; final int numCurLevelNodes = numChildNodes / combineDegree + (numChildrenForLastNode > 1 ? 1 : 0); final int numChildOfParentNodes = numCurLevelNodes + (numChildrenForLastNode == 1 ? 1 : 0); if (numChildOfParentNodes == 1) { return numCurLevelNodes; } else { return numCurLevelNodes + computeRequiredBufferNum(numChildOfParentNodes, intermediateCombineDegree); } }
Source:
<code>public void deleteObservation( final Integer studyId, final Integer datasetId, final Integer observationUnitId, final Integer observationId) { this.studyValidator.validate(studyId, true); this.datasetValidator.validateDataset(studyId, datasetId, false); this.observationValidator.validateObservation(studyId, datasetId, observationUnitId, observationId, null); final Integer observableId = this.middlewareDatasetService.getPhenotype(observationUnitId, observationId).getObservableId(); this.middlewareDatasetService.deletePhenotype(observationId); <START> this.middlewareDatasetService.updateDependentPhenotypesAsOutOfSync(observableId, observationUnitId); <END> }</code><technical_language>abstract updating of dependent phenotypes out of sync this service. is, part of Middleware API call</technical_language>

Target:
public void deleteObservation( final Integer studyId, final Integer datasetId, final Integer observationUnitId, final Integer observationId) { this.studyValidator.validate(studyId, true); this.datasetValidator.validateDataset(studyId, datasetId); this.observationValidator.validateObservation(studyId, datasetId, observationUnitId, observationId, null); this.middlewareDatasetService.deletePhenotype(observationId); }
Source:
<code>public Blob getBlobFromJSON(ObjectNode jsonObject) { Blob blob = null; if (!jsonObject.has("upload-batch")) { return null; } final String batchId = jsonObject.get("upload-batch").getTextValue(); String fileId = null; if (jsonObject.has("upload-fileId")) { fileId = jsonObject.get("upload-fileId").getTextValue(); } if (fileId != null) { BatchManager bm = Framework.getLocalService(BatchManager.class); blob = bm.getBlob(batchId, fileId); final boolean drop = !Boolean.parseBoolean( <START> RequestContext.getActiveContext().getRequest().getHeader(BatchManagerConstants.NO_DROP_FLAG)); <END> if (RequestContext.getActiveContext() != null && drop) { RequestContext.getActiveContext().addRequestCleanupHandler(new RequestCleanupHandler() { @Override public void cleanup(HttpServletRequest request) { BatchManager bm = Framework.getLocalService(BatchManager.class); bm.clean(batchId); } }); } } return blob; }</code><technical_language>introducing a new risk of NPE ? In previous code checking for NPE first, RequestContext.getActiveContext() do test for Null ..</technical_language>

Target:
public Blob getBlobFromJSON(ObjectNode jsonObject) { Blob blob = null; if (!jsonObject.has("upload-batch")) { return null; } final String batchId = jsonObject.get("upload-batch").getTextValue(); String fileId = null; if (jsonObject.has("upload-fileId")) { fileId = jsonObject.get("upload-fileId").getTextValue(); } if (fileId != null) { BatchManager bm = Framework.getLocalService(BatchManager.class); blob = bm.getBlob(batchId, fileId); if (RequestContext.getActiveContext() != null) { final boolean drop = !Boolean.parseBoolean( RequestContext.getActiveContext().getRequest().getHeader(BatchManagerConstants.NO_DROP_FLAG)); if (drop) { RequestContext.getActiveContext().addRequestCleanupHandler(new RequestCleanupHandler() { @Override public void cleanup(HttpServletRequest request) { BatchManager bm = Framework.getLocalService(BatchManager.class); bm.clean(batchId); } }); } } } return blob; }
Source:
<code>public void isNodeRegistered (String hostname, String token) throws CanNotCallChefException { String response = "RESPONSE"; int time = 10000; int check_time=10000; while (!response.contains(hostname)) { try { log.info("Checking node : " + hostname + " time:" + time); if (time > MAX_TIME) { <START> String errorMesg = "Node " + hostname + " is not registered in ChefServer"; <END> log.info(errorMesg); throw new CanNotCallChefException(errorMesg); } Thread.sleep(check_time); response = getNodes (token); time = time+ check_time; } catch (Exception e) { log.warn(e.getMessage()); String errorMesg = "Node " + hostname + " is not registered in ChefServer"; log.info(errorMesg); throw new CanNotCallChefException(errorMesg); } } log.debug ("Node " + hostname + " is registered in ChefServer"); }</code><technical_language>message "in puppet master"</technical_language>

Target:
public void isNodeRegistered (String hostname, String token) throws CanNotCallPuppetException { String response = "RESPONSE"; int time = 10000; int check_time=10000; while (!response.contains(hostname)) { try { log.info("Checking node : " + hostname + " time:" + time); if (time > MAX_TIME) { String errorMesg = "Node " + hostname + " is not registered in puppet master"; log.info(errorMesg); throw new CanNotCallPuppetException(errorMesg); } Thread.sleep(check_time); response = getNodes (token); time = time+ check_time; } catch (Exception e) { log.warn(e.getMessage()); String errorMesg = "Node " + hostname + " is not registered the puppet master " + e.getMessage(); log.info(errorMesg); throw new CanNotCallPuppetException(errorMesg); } } log.debug ("Node " + hostname + " is registered in puppet master"); }
Source:
<code>public void addAlternativeSequenceName(final String name) { <START> if (!mSequenceName.equals(name) && ! mAlternativeSequenceName.contains(name) ) { <END> mAlternativeSequenceName.add(name); } }</code><technical_language>change store names in attributes map need special handling for places handle tags</technical_language>

Target:
public void addAlternativeSequenceName(final String name) { validateAltRegExp(name); final Set<String> altSequences = getAlternativeSequenceNames(); if (!mSequenceName.equals(name) && ! altSequences.contains(name) ) { altSequences.add(name); } encodeAltSequences(altSequences); }
Source:
<code>public String toString() { return "Actor{" + "name='" + name + '\'' + ", description='" + description + '\'' + ", users=" + users + ", groups=" + groups + ", roles=" + roles + ", memberships=" + memberships + '}'; <START> } <END></code><technical_language>If commons-lang3 in classpath, ToStringBuilder</technical_language>

Target:
public String toString() { return new ToStringBuilder(this) .append("name", name) .append("description", description) .append("users", users) .append("groups", groups) .append("roles", roles) .append("memberships", memberships) .toString(); }
Source:
<code><START> public ServiceCheck(String name, int status) { <END> this.name = name; this.status = status; }</code><technical_language>I commonly scenarios for service checks, if tags, hostnames message provided is worth creating overloaded constructors for scenarios easier create service checks instead of set methods</technical_language>

Target:
public ServiceCheck(String name, int status) { this(name, status, null, null, null); }
Source:
<code>public PinotExpression visitCall(CallExpression call, Map<VariableReferenceExpression, Selection> context) { String displayName = call.getDisplayName().toLowerCase(ENGLISH); if (PROSCRIBED_FUNCTIONS.contains(displayName)) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Unsupported function in pinot aggregation: " + call); } if (displayName.equals("cast")) { return handleCast(call, context); } FunctionMetadata functionMetadata = functionMetadataManager.getFunctionMetadata(call.getFunctionHandle()); Optional<OperatorType> operatorTypeOptional = functionMetadata.getOperatorType(); if (operatorTypeOptional.isPresent()) { OperatorType operatorType = operatorTypeOptional.get(); <START> if (operatorType.isArithmeticOperator()) { <END> return handleArithmeticExpression(call, operatorType, context); } else if (operatorType.isComparisonOperator()) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Comparison operator not supported: " + call); } } return handleFunction(call, context); }</code><technical_language>if statement</technical_language>

Target:
public PinotExpression visitCall(CallExpression call, Map<VariableReferenceExpression, Selection> context) { return basicCallHandling(call, context).orElseThrow(() -> new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Call not supported: " + call)); }
Source:
<code><START> public void startKieServer() { <END> if (server != null) { throw new RuntimeException("Kie execution server is already created!"); } System.setProperty(KieServerConstants.CFG_BYPASS_AUTH_USER, "true"); System.setProperty(KieServerConstants.CFG_HT_CALLBACK, "custom"); System.setProperty(KieServerConstants.CFG_HT_CALLBACK_CLASS, "org.kie.server.integrationtests.jbpm.util.FixedUserGroupCallbackImpl"); System.setProperty(KieServerConstants.CFG_PERSISTANCE_DS, "jdbc/jbpm-ds"); System.setProperty(KieServerConstants.CFG_PERSISTANCE_TM, "org.hibernate.service.jta.platform.internal.BitronixJtaPlatform"); System.setProperty(KieServerConstants.KIE_SERVER_CONTROLLER, TestConfig.getControllerHttpUrl()); System.setProperty(KieServerConstants.CFG_KIE_CONTROLLER_USER, TestConfig.getUsername()); System.setProperty(KieServerConstants.CFG_KIE_CONTROLLER_PASSWORD, TestConfig.getPassword()); System.setProperty(KieServerConstants.KIE_SERVER_LOCATION, TestConfig.getEmbeddedKieServerHttpUrl()); System.setProperty(KieServerConstants.KIE_SERVER_STATE_REPO, "./target"); if (KieServerEnvironment.getServerId() == null) { KieServerEnvironment.setServerId(KieServerBaseIntegrationTest.class.getSimpleName() + "@" + serverIdSuffixDateFormat.format(new Date())); KieServerEnvironment.setServerName("KieServer"); } server = new TJWSEmbeddedJaxrsServer(); server.setPort(TestConfig.getKieServerAllocatedPort()); server.start(); kieServer = new KieServerImpl(); server.getDeployment().getRegistry().addSingletonResource(new KieServerRestImpl(kieServer)); List<KieServerExtension> extensions = kieServer.getServerExtensions(); for (KieServerExtension extension : extensions) { List<Object> components = extension.getAppComponents(SupportedTransports.REST); for (Object component : components) { server.getDeployment().getRegistry().addSingletonResource(component); } } server.getDeployment().setProviderFactory(JacksonRestEasyTestConfig.createRestEasyProviderFactory()); }</code><technical_language>decompose method? start a Kie Server, configures things</technical_language>

Target:
public void startKieServer() { if (server != null) { throw new RuntimeException("Kie execution server is already created!"); } setKieServerProperties(); registerKieServerId(); server = new TJWSEmbeddedJaxrsServer(); server.setPort(TestConfig.getKieServerAllocatedPort()); server.start(); addServerSingltonResources(); }