auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void readDictIds(int[] docIds, int length, int[] dictIdBuffer, ForwardIndexReaderContext context) { int firstDocId = docIds[0]; int lastDocId = docIds[length - 1]; int index = 0; if (lastDocId - firstDocId + 1 == length && length >= 64) { <START> int[] buffer = new int[32]; <END> int bulkStartIndex = (firstDocId + 31) & 0xffffffe0; int bulkEndIndex = lastDocId & 0xffffffe0; for (int i = firstDocId; i < bulkStartIndex; i++) { dictIdBuffer[index++] = _reader.readUnchecked(i); } for (int i = bulkStartIndex; i < bulkEndIndex; i += 32) { _reader.read32(i, buffer); System.arraycopy(buffer, 0, dictIdBuffer, index, 32); index += 32; } } if (lastDocId < _numDocs - 2) { for (int i = index; i < length; i++) { dictIdBuffer[i] = _reader.readUnchecked(docIds[i]); } } else { dictIdBuffer[length - 1] = _reader.read(lastDocId); int uncheckedEndIndex = length - 2; if (uncheckedEndIndex >= index) { dictIdBuffer[uncheckedEndIndex] = _reader.read(docIds[uncheckedEndIndex]); for (int i = index; i < uncheckedEndIndex; i++) { dictIdBuffer[i] = _reader.readUnchecked(docIds[i]); } } } }</code><technical_language>some cached int arrays here</technical_language>

Target:
public void readDictIds(int[] docIds, int length, int[] dictIdBuffer, ForwardIndexReaderContext context) { int firstDocId = docIds[0]; int lastDocId = docIds[length - 1]; int index = 0; if (lastDocId - firstDocId + 1 == length && length >= 64) { int bulkStartIndex = (firstDocId + 31) & 0xffffffe0; int bulkEndIndex = lastDocId & 0xffffffe0; for (int i = firstDocId; i < bulkStartIndex; i++) { dictIdBuffer[index++] = _reader.readUnchecked(i); } for (int i = bulkStartIndex; i < bulkEndIndex; i += 32) { _reader.read32(i, dictIdBuffer, index); index += 32; } } if (lastDocId < _numDocs - 2) { for (int i = index; i < length; i++) { dictIdBuffer[i] = _reader.readUnchecked(docIds[i]); } } else { dictIdBuffer[length - 1] = _reader.read(lastDocId); int uncheckedEndIndex = length - 2; if (uncheckedEndIndex >= index) { dictIdBuffer[uncheckedEndIndex] = _reader.read(docIds[uncheckedEndIndex]); for (int i = index; i < uncheckedEndIndex; i++) { dictIdBuffer[i] = _reader.readUnchecked(docIds[i]); } } } }
Source:
<code>private static boolean hasDynamicExceptionMessageUsage(MethodInvocationTree mit) { Arguments arguments = mit.arguments(); int argumentsCount = arguments.size(); ExpressionTree firstArg = arguments.get(0); if (mit.symbol().owner().type().is(SLF4J_LOGGER)) { if (argumentsCount == 1) { return !isSimpleExceptionMessage(firstArg); } else if (argumentsCount == 2 && firstArg.symbolType().is("org.slf4j.Marker")) { return !isSimpleExceptionMessage(arguments.get(1)); } else { return true; } } else { if (JAVA_UTIL_LOG_METHOD.matches(mit) && argumentsCount == 2) { return !isSimpleExceptionMessage(arguments.get(1)); } else if (JAVA_UTIL_LOGP_METHOD.matches(mit) && argumentsCount == 4) { return !isSimpleExceptionMessage(arguments.get(3)); } else if (JAVA_UTIL_LOGRB_METHOD.matches(mit) && argumentsCount == 5) { return !isSimpleExceptionMessage(arguments.get(4)); } else { <START> return !isSimpleExceptionMessage(firstArg); <END> } } }</code><technical_language>for readability I big else if fugring out is expression tree want test a single return. (and return true if required</technical_language>

Target:
private static boolean hasDynamicExceptionMessageUsage(MethodInvocationTree mit) { Arguments arguments = mit.arguments(); int argumentsCount = arguments.size(); ExpressionTree firstArg = arguments.get(0); ExpressionTree argumentToCheck; if (mit.symbol().owner().type().is(SLF4J_LOGGER)) { if (argumentsCount == 1) { argumentToCheck = firstArg; } else if (argumentsCount == 2 && firstArg.symbolType().is("org.slf4j.Marker")) { argumentToCheck = arguments.get(1); } else { argumentToCheck = null; } } else if (JAVA_UTIL_LOG_METHOD.matches(mit) && argumentsCount == 2) { argumentToCheck = arguments.get(1); } else if (JAVA_UTIL_LOGP_METHOD.matches(mit) && argumentsCount == 4) { argumentToCheck = arguments.get(3); } else if (JAVA_UTIL_LOGRB_METHOD.matches(mit) && argumentsCount == 5) { argumentToCheck = arguments.get(4); } else { argumentToCheck = firstArg; } return argumentToCheck == null || !isSimpleExceptionMessage(argumentToCheck); }
Source:
<code>public void resume(AbstractProducer producer, Replicator replicator) throws Exception { try ( Connection connection = context.getMaxwellConnection() ) { <START> String clientid = ((BinlogConnectorReplicator)replicator).getClientID(); <END> String sql = "update `bootstrap` set started_at = NULL where is_complete = 0 and started_at is not NULL and client_id = '" + clientid + "'"; connection.prepareStatement(sql).execute(); } }</code><technical_language>extract clientID context</technical_language>

Target:
public void resume(AbstractProducer producer, Replicator replicator) throws Exception { try ( Connection connection = context.getMaxwellConnection() ) { String clientID = this.context.getConfig().clientID; String sql = "update `bootstrap` set started_at = NULL where is_complete = 0 and started_at is not NULL and client_id = ?"; PreparedStatement s = connection.prepareStatement(sql); s.setString(1, clientID); s.execute(); } }
Source:
<code>public void call(Pipeline pipeline) { if (enabled) { log.warn("Triggering due to {}", pipeline, pipeline.getTrigger()); counter.increment("orca.requests"); createTriggerObservable(pipeline) .retry((count, error) -> { if (count <= 2 && isRetryable(error)) { <START> log.error("Retrying pipeline trigger, attempt {}/3: {}", count + 1, pipeline); <END> return true; } return false; }) .subscribe(this::onOrcaResponse, throwable -> onOrcaError(pipeline, throwable)); } else { log.info("Would trigger due to but triggering is disabled", pipeline, pipeline.getTrigger()); } }</code><technical_language>Planning making number of retries configurable</technical_language>

Target:
public void call(Pipeline pipeline) { if (enabled) { log.warn("Triggering due to {}", pipeline, pipeline.getTrigger()); counter.increment("orca.requests"); createTriggerObservable(pipeline) .retryWhen(new RetryWithDelay(retryCount, retryDelayMillis)) .subscribe(this::onOrcaResponse, throwable -> onOrcaError(pipeline, throwable)); } else { log.info("Would trigger due to but triggering is disabled", pipeline, pipeline.getTrigger()); } }
Source:
<code>public void init() { Assert.notNull(refreshTokenResultFactory, "refreshTokenResultFactory cannot be null."); Assert.notNull(refreshTokenAuthenticationRequestFactory, "refreshTokenAuthenticationRequestFactory cannot be null."); Assert.notNull(requestAuthorizer, "requestAuthorizer cannot be null."); Assert.notNull(authenticationRequestFactory, "accessTokenAuthenticationRequestFactory cannot be null."); Assert.notNull(resultFactory, "accessTokenResultFactory cannot be null."); Assert.notNull(accountSaver, "accountSaver cannot be null."); Assert.notNull(eventPublisher, "eventPublisher cannot be null."); <START> Assert.notNull(grantTypeValidator, "grantTypeStatusValidator cannot be null."); <END> }</code><technical_language>message be: grantTypeValidator null</technical_language>

Target:
public void init() { Assert.notNull(refreshTokenResultFactory, "refreshTokenResultFactory cannot be null."); Assert.notNull(refreshTokenAuthenticationRequestFactory, "refreshTokenAuthenticationRequestFactory cannot be null."); Assert.notNull(requestAuthorizer, "requestAuthorizer cannot be null."); Assert.notNull(authenticationRequestFactory, "accessTokenAuthenticationRequestFactory cannot be null."); Assert.notNull(resultFactory, "accessTokenResultFactory cannot be null."); Assert.notNull(accountSaver, "accountSaver cannot be null."); Assert.notNull(eventPublisher, "eventPublisher cannot be null."); Assert.notNull(grantTypeValidator, "grantTypeValidator cannot be null."); }
Source:
<code>public void init() { view.init(this); if (organizationalUnitController.canReadOrgUnits()) { libraryService.call((List<OrganizationalUnit> allOrganizationalUnits) -> { organizationalUnits = allOrganizationalUnits.stream() .filter(ou -> organizationalUnitController.canReadOrgUnit(ou)) .collect(Collectors.toList()); <START> view.setup(organizationalUnits); <END> }).getOrganizationalUnits(); } }</code><technical_language>Is filter OUs in server side? list is visible OU names leak client</technical_language>

Target:
public void init() { setupView(); setupOrganizationalUnits(); }
Source:
<code>protected Object nativeToJava(TransferData transferData) { byte[] bytes = (byte[]) super.nativeToJava(transferData); if (bytes == null) { return null; } DataInputStream in = new DataInputStream( new ByteArrayInputStream(bytes)); try { int count = in.readInt(); if (count > MAX_RESOURCES_TO_TRANSFER) { String message = "Transfer aborted, too many resources: " + count + "."; <START> message += "\nIf you are running in x11vnc environment please consider to switch to vncserver " + END> "+ vncviewer or to run x11vnc without clipboard support " + "(use '-noclipboard' and '-nosetclipboard' arguments)."; IDEWorkbenchPlugin.log(message, new IllegalArgumentException( "Maximum limit of resources to transfer is: " + MAX_RESOURCES_TO_TRANSFER)); return null; } IResource[] results = new IResource[count]; for (int i = 0; i < count; i++) { results[i] = readResource(in); } return results; } catch (IOException e) { return null; } }</code><technical_language>This conditional running GTK, right? sense Windows OS X users</technical_language>

Target:
protected Object nativeToJava(TransferData transferData) { byte[] bytes = (byte[]) super.nativeToJava(transferData); if (bytes == null) { return null; } DataInputStream in = new DataInputStream( new ByteArrayInputStream(bytes)); try { int count = in.readInt(); if (count > MAX_RESOURCES_TO_TRANSFER) { String message = "Transfer aborted, too many resources: " + count + "."; if (Util.isLinux()) { message += "\nIf you are running in x11vnc environment please consider to switch to vncserver " + "+ vncviewer or to run x11vnc without clipboard support " + "(use '-noclipboard' and '-nosetclipboard' arguments)."; } IDEWorkbenchPlugin.log(message, new IllegalArgumentException( "Maximum limit of resources to transfer is: " + MAX_RESOURCES_TO_TRANSFER)); return null; } IResource[] results = new IResource[count]; for (int i = 0; i < count; i++) { results[i] = readResource(in); } return results; } catch (IOException e) { return null; } }
Source:
<code>private String getFunctionFromOriginalLocation(String origLocation) { if (origLocation.isEmpty()) { GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); return ""; } if (origLocation.startsWith("*")) return ""; int index = origLocation.lastIndexOf(':'); <START> String function = (index >= 0) ? origLocation.substring(index + 1, origLocation.length()) : origLocation; <END> try { Integer.valueOf(function); return ""; } catch(NumberFormatException e) { } return function; }</code><technical_language>I need origLocation.length(). is a substring(beginIndex) method, I simpler use</technical_language>

Target:
private String getFunctionFromOriginalLocation(String origLocation) { if (origLocation.isEmpty()) { GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); return ""; } if (origLocation.startsWith("*")) return ""; int index = origLocation.lastIndexOf(':'); String function = (index >= 0) ? origLocation.substring(index + 1) : origLocation; try { Integer.valueOf(function); return ""; } catch(NumberFormatException e) { } return function; }
Source:
<code>private void updateBoundMember(final Object instance, final AccessibleObject element, final ConfigBinding binding) { if (!element.isAccessible()) { element.setAccessible(true); } final Object value = getValue(binding, getTargetClass(element)); if (element instanceof Field) { try { ((Field) element).set(instance, value); } catch (IllegalAccessException | IllegalArgumentException ex) { } } if (element instanceof Method) { try { ((Method) element).invoke(instance, value); } catch (IllegalAccessException | IllegalArgumentException ex) { } catch (InvocationTargetException ex) { <START> eventBus.publish(new UserErrorEvent(ErrorLevel.HIGH, ex, <END> "Exception when updating bound setting", "")); } } }</code><technical_language>app error</technical_language>

Target:
private void updateBoundMember(final Object instance, final AccessibleObject element, final ConfigBinding binding) { if (!element.isAccessible()) { element.setAccessible(true); } final Object value = getValue(binding, getTargetClass(element)); if (element instanceof Field) { try { ((Field) element).set(instance, value); } catch (IllegalAccessException | IllegalArgumentException ex) { } } if (element instanceof Method) { try { ((Method) element).invoke(instance, value); } catch (IllegalAccessException | IllegalArgumentException ex) { } catch (InvocationTargetException ex) { eventBus.publish(new AppErrorEvent(ErrorLevel.HIGH, ex, "Exception when updating bound setting", "")); } } }
Source:
<code>public WrappedHttpClient( ClientSecurityConfig config, HttpClientTransport transport, SslContextFactory sslContextFactory) { super(transport, sslContextFactory); <START> authenticationStore = new ExpiringAuthenticationStore(new SpnegoAuthentication( <END> config.getKrb5ConfPath(), config.getServiceName())); }</code><technical_language>I need wrap</technical_language>

Target:
public WrappedHttpClient(ClientSecurityConfig config, HttpClientTransport transport, SslContextFactory sslContextFactory) { super(transport, sslContextFactory); authenticationStore = new ExpiringAuthenticationStore(new SpnegoAuthentication( config.getKrb5Keytab(), config.getKrb5Config(), config.getKrb5CredentialCache(), config.getKrb5Principal(), config.getKrb5RemoteServiceName())); }
Source:
<code>public void addTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.addTraverseListener(listener); if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.addTraverseListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void addTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.addTraverseListener(listener); if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addTraverseListener(listener); }
Source:
<code>void activateMode(ApplicationMode mode) { if (!ApplicationMode.values(app).contains(mode)) { <START> StringBuilder s = new StringBuilder(ApplicationMode.DEFAULT.getStringKey() + ","); <END> for (ApplicationMode am : ApplicationMode.values(app)) { s.append(am.getStringKey()).append(","); } s.append(mode.getStringKey()).append(","); if (getSettings() != null) { getSettings().AVAILABLE_APP_MODES.set(s.toString()); } } }</code><technical_language>? serialization</technical_language>

Target:
void activateMode(ApplicationMode mode) { if (!ApplicationMode.values(app).contains(mode)) { ApplicationMode.changeProfileStatus(mode, true, getMyApplication()); } }
Source:
<code>public TransformWork(Work<I> work, Function<I, O> transformation) { <START> this.work = requireNonNull(work, "prerequisite is null"); <END> this.transformation = requireNonNull(transformation, "transformation is null"); }</code><technical_language>prerequisite is null -> work is null</technical_language>

Target:
public TransformWork(Work<I> work, Function<I, O> transformation) { this.work = requireNonNull(work, "work is null"); this.transformation = requireNonNull(transformation, "transformation is null"); }
Source:
<code>public UriAuthority(String authority) { MatchResult matcher = AUTHORITY_REGEXP.exec(authority == null ? EMPTY_STRING : authority); <START> if (matcher == null) { <END> this.host = null; this.port = null; valid = false; } else { String group1 = matcher.getGroup(1); this.host = (group1 == null) ? EMPTY_STRING : group1; String group2 = matcher.getGroup(2); this.port = (group2 == null) ? EMPTY_STRING : group2; valid = validatePort(); } }</code><technical_language>This if/else confusing, some code AuthorityInfo info = getInfo(authority); this.host = info.host; // getter if wish this.port = info.port; // getter if wish this.valid = validatePort(); private static class AuthorityInfo { private final String host; private final String port; private UriAuthorityInfo(String host, String port) { this.host = host; this.port = port; } } private AuthorityInfo getInfo(String authority) { MatchResult matcher = AUTHORITY_REGEXP.exec(authority == null ? EMPTY_STRING : authority); String host, port; if (matcher != null) { // extract host port } return new AuthorityInfo(host, port); } basically constructor simple possible</technical_language>

Target:
public UriAuthority(String authority) { AuthorityInfo authorityInfo = getInfo(authority); this.host = authorityInfo.host; this.port = authorityInfo.port; this.valid = authorityInfo.valid; }
Source:
<code>public String getUnmodifiedInstance() { <START> return m_inst.toString(); <END> }</code><technical_language>suggestion return getInstance();</technical_language>

Target:
public String getUnmodifiedInstance() { return getInstance(); }
Source:
<code>int getExitCode() { int size = initial.length() - 1; int value = 0; <START> for (int i = size; i >= 0; i--) { <END> int prefix = 0; if (initial.get(i)) { prefix = 1; } value += Math.pow(2, i) * prefix; } if (value == 1) { return 0; } return value; }</code><technical_language>this implementation easier: <LINK_0></technical_language>

Target:
public int getExitCode() { int exitCode = 0; for (int i = 0; i < exitCodeBits.length(); i++) { if (exitCodeBits.get(i)) { exitCode = exitCode | (1 << i); } } return exitCode; }
Source:
<code>public APIResult submitAndSchedulableExtensionJob(String extensionName, String jobName, InputStream configStream, SortedMap<EntityType, List<Entity>> entityMap) throws FalconException, IOException { List<String> feedNames = new ArrayList<>(); List<String> processNames = new ArrayList<>(); for(Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()){ for(Entity entity : entry.getValue()){ submitInternal(entity, "falconUser"); } } for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (Entity entity : entry.getValue()) { scheduleInternal(entry.getKey().name(), entity.getName(), null, null); } } byte[] configBytes = null; if (configStream != null) { configBytes = IOUtils.toByteArray(configStream); } for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (final Entity entity : entry.getValue()) { if (entity.getEntityType().equals(EntityType.FEED)) { feedNames.add(entity.getName()); } else { processNames.add(entity.getName()); } } } ExtensionStore.getMetaStore().storeExtensionJob(jobName, extensionName, feedNames, processNames, configBytes); <START> return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully" + jobName); <END> }</code><technical_language>change returned message "scheduled successfully"</technical_language>

Target:
APIResult submitAndSchedulableExtensionJob(String extensionName, String jobName, InputStream configStream, SortedMap<EntityType, List<Entity>> entityMap) throws FalconException, IOException { for(Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()){ for(Entity entity : entry.getValue()){ submitInternal(entity, "falconUser"); } } storeExtension(extensionName, jobName, configStream, entityMap); for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (Entity entity : entry.getValue()) { scheduleInternal(entry.getKey().name(), entity.getName(), null, null); } } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted and scheduled successfully" + jobName); }
Source:
<code>private void recoverSortMenuFormPreferences(Menu menu) { if(menu != null && mDescendingMenuItem != null) { <START> mDescendingMenuItem = menu.findItem(R.id.action_sort_descending); <END> mDescendingMenuItem.setChecked(!PreferenceManager.getSortAscending(this)); switch (getSortOrder(this)) { case FileStorageUtils.SORT_NAME: menu.findItem(R.id.action_sort_by_name).setChecked(true); break; case FileStorageUtils.SORT_DATE: menu.findItem(R.id.action_sort_by_date).setChecked(true); break; case FileStorageUtils.SORT_SIZE: menu.findItem(R.id.action_sort_by_size).setChecked(true); default: } } }</code><technical_language>I need this initialization done [here](<LINK_0></technical_language>

Target:
private void recoverSortMenuFormPreferences(Menu menu) { if(menu != null) { mDescendingMenuItem.setChecked(!PreferenceManager.getSortAscending(this)); switch (getSortOrder(this)) { case FileStorageUtils.SORT_NAME: menu.findItem(R.id.action_sort_by_name).setChecked(true); break; case FileStorageUtils.SORT_DATE: menu.findItem(R.id.action_sort_by_date).setChecked(true); break; case FileStorageUtils.SORT_SIZE: menu.findItem(R.id.action_sort_by_size).setChecked(true); default: } } }
Source:
<code>RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final DepthWalk.Commit c = (DepthWalk.Commit) pending.next(); if (c == null) return null; if ((c.flags & RevWalk.PARSED) == 0) c.parseHeaders(walk); int newDepth = c.depth + 1; for (RevCommit p : c.parents) { DepthWalk.Commit dp = (DepthWalk.Commit) p; if (dp.depth == -1) { boolean failsDeepenSince = false; if (deepenSince != 0) { if ((p.flags & RevWalk.PARSED) == 0) { p.parseHeaders(walk); } failsDeepenSince = p.getCommitTime() < deepenSince; } dp.depth = newDepth; if (newDepth <= depth && !failsDeepenSince) { pending.add(p); } else { c.isBoundary = true; } } if(c.has(UNSHALLOW) || c.has(REINTERESTING)) { p.add(REINTERESTING); p.flags &= ~RevWalk.UNINTERESTING; } } boolean produce = true; if ((c.flags & RevWalk.UNINTERESTING) != 0 && !c.has(UNSHALLOW)) produce = false; <START> if (c.getCommitTime() < deepenSince) { <END> produce = false; } if (produce) return c; } }</code><technical_language>sense check this for loop save visit parents</technical_language>

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final DepthWalk.Commit c = (DepthWalk.Commit) pending.next(); if (c == null) return null; if ((c.flags & RevWalk.PARSED) == 0) c.parseHeaders(walk); if (c.getCommitTime() < deepenSince) { continue; } int newDepth = c.depth + 1; for (RevCommit p : c.parents) { DepthWalk.Commit dp = (DepthWalk.Commit) p; if (dp.depth == -1) { boolean failsDeepenSince = false; if (deepenSince != 0) { if ((p.flags & RevWalk.PARSED) == 0) { p.parseHeaders(walk); } failsDeepenSince = p.getCommitTime() < deepenSince; } dp.depth = newDepth; if (newDepth <= depth && !failsDeepenSince) { pending.add(p); } else { c.isBoundary = true; } } if(c.has(UNSHALLOW) || c.has(REINTERESTING)) { p.add(REINTERESTING); p.flags &= ~RevWalk.UNINTERESTING; } } boolean produce = true; if ((c.flags & RevWalk.UNINTERESTING) != 0 && !c.has(UNSHALLOW)) produce = false; if (produce) return c; } }
Source:
<code>private Layout updateLayoutAndGet() { return getCorfuRuntime() .invalidateLayout() .thenApply(serverContext::saveManagementLayout) .join(); <START> } <END></code><technical_language>motivation, need update layout? FD is in charge of it, if safe update layout</technical_language>

Target:
private Layout updateLayoutAndGet() { return getCorfuRuntime() .invalidateLayout() .join(); }
Source:
<code>public void handleAction(final ActionParameters params) throws ActionException { final JSONArray data = new JSONArray(); OskariLayerService mapLayerService = new OskariLayerServiceIbatisImpl(); OskariLayer oskariLayer = mapLayerService.find(params.getHttpParam(PARAM_URL)); if(oskariLayer != null){ FINAL_WMS_URL = oskariLayer.getUrl(); } String wmsUrl = Helpers.getGetFeatureInfoUrlForProxy(FINAL_WMS_URL, params.getHttpParam(PARAM_SRS).toString(), params.getHttpParam(PARAM_BBOX).toString(), params.getHttpParam(PARAM_WIDTH).toString(), params.getHttpParam(PARAM_HEIGHT).toString(), params.getHttpParam(PARAM_X).toString(), params.getHttpParam(PARAM_Y).toString(), params.getHttpParam(PARAM_LAYERS).toString()); System.out.println(wmsUrl); URL wms; try { wms = new URL(wmsUrl); URLConnection wmsConn = wms.openConnection(); wmsConn.setRequestProperty("Accept-Charset", "UTF-8"); BufferedReader in = new BufferedReader( new InputStreamReader( wmsConn.getInputStream(), "UTF-8" ) ); String inputLine; String html = ""; while ((inputLine = in.readLine()) != null) { html += inputLine; } in.close(); <START> JSONObject jsoni = new JSONObject(html); <END> ResponseHelper.writeResponse(params, jsoni); } catch (JSONException e) { throw new ActionException("Could not populate Response JSON: " + LOGGER.getAsString(data), e); } catch (MalformedURLException e) { throw new ActionException("Could not populate Response JSON: " + LOGGER.getAsString(data), e); } catch (IOException e) { throw new ActionException("Could not populate Response JSON: " + LOGGER.getAsString(data), e); } }</code><technical_language>Is variable name describing content? html in JSON</technical_language>

Target:
public void handleAction(final ActionParameters params) throws ActionException { final int id = params.getRequiredParamInt(PARAM_ID); final OskariLayer oskariLayer = mapLayerService.find(id); if (oskariLayer == null) { throw new ActionParamsException("Layer not found, id: " + id); } String url = oskariLayer.getUrl(); String wmsUrl = Helpers.getGetFeatureInfoUrlForProxy(url, params.getHttpParam(PARAM_SRS), params.getHttpParam(PARAM_BBOX), params.getHttpParam(PARAM_WIDTH), params.getHttpParam(PARAM_HEIGHT), params.getHttpParam(PARAM_X), params.getHttpParam(PARAM_Y), params.getHttpParam(PARAM_LAYERS)); LOGGER.debug("Details of the data cropping feature"); try { HttpURLConnection con = IOHelper.getConnection(wmsUrl); con.setRequestProperty("Accept-Charset", "UTF-8"); final String data = IOHelper.readString(con, "UTF-8"); JSONObject json = new JSONObject(data); ResponseHelper.writeResponse(params, json); } catch (JSONException e) { throw new ActionException("Could not get cropping:", e); } catch (MalformedURLException e) { throw new ActionException("Could not get cropping:", e); } catch (IOException e) { throw new ActionException("Could not get cropping:", e); } }
Source:
<code>void submitGetBlobOperation(String blobIdStr, GetBlobOptionsInternal options, Callback<GetBlobResultInternal> callback) throws RouterException { GetOperation getOperation; BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); boolean isEncrypted = BlobId.isEncrypted(blobIdStr); <START> if (blobId.getDatacenterId() != ClusterMapUtils.UNKNOWN_DATACENTER_ID <END> && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.getBlobNotOriginateLocalOperationRate.mark(); } trackGetBlobRateMetrics(options.getBlobOptions, isEncrypted); routerMetrics.operationQueuingRate.mark(); if (options.getBlobOptions.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { getOperation = new GetBlobInfoOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, options, callback, routerCallback, kms, cryptoService, cryptoJobHandler, time, isEncrypted); } else { getOperation = new GetBlobOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, options, callback, routerCallback, blobIdFactory, kms, cryptoService, cryptoJobHandler, time, isEncrypted); } getOperations.add(getOperation); }</code><technical_language>if move this GetOperation, I signature of GetBlobOperation GetBlobInfoOperation largely remain unchanged (with BlobId replaced String). need pass in isEncrypted, computed in constructor of GetOperation. want drag this patch further, do if feel is cleaner</technical_language>

Target:
void submitGetBlobOperation(String blobIdStr, GetBlobOptionsInternal options, Callback<GetBlobResultInternal> callback) throws RouterException { GetOperation getOperation; BlobId blobId = RouterUtils.getBlobIdFromString(blobIdStr, clusterMap); boolean isEncrypted = false; try { BlobId.isEncrypted(blobIdStr); } catch (IOException e) { logger.warn( "This shouldn't happen because getBlobIdFromString() should have thrown RouterException for this case.", e); } if (blobId.getDatacenterId() != ClusterMapUtils.UNKNOWN_DATACENTER_ID && blobId.getDatacenterId() != clusterMap.getLocalDatacenterId()) { routerMetrics.getBlobNotOriginateLocalOperationRate.mark(); } trackGetBlobRateMetrics(options.getBlobOptions, isEncrypted); if (options.getBlobOptions.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { getOperation = new GetBlobInfoOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, options, callback, routerCallback, kms, cryptoService, cryptoJobHandler, time, isEncrypted); } else { getOperation = new GetBlobOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobId, options, callback, routerCallback, blobIdFactory, kms, cryptoService, cryptoJobHandler, time, isEncrypted); } getOperations.add(getOperation); }
Source:
<code>private void lockEntities() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(getSnapshot(), getSnapshot().getStatus()); getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.LOCKED); lockVmWithCompensationIfNeeded(); getCompensationContext().stateChanged(); return null; } <START> }); <END> }</code><technical_language>freeLock transaction is committed</technical_language>

Target:
private void lockEntities() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(getSnapshot(), getSnapshot().getStatus()); getSnapshotDao().updateStatus(sourceSnapshotId, SnapshotStatus.LOCKED); lockVmWithCompensationIfNeeded(); getCompensationContext().stateChanged(); return null; } }); freeLock(); }
Source:
<code>protected Path toPath(String key, boolean actionResult) { <START> String cacheFolder = actionResult ? "ac" : "cas"; <END> return root.getChild(cacheFolder).getChild(key.substring(0, 2)).getChild(key); }</code><technical_language>AC_DIRECTORY CAS_DIRECTORY respectively</technical_language>

Target:
protected Path toPath(String key, boolean actionResult) { String cacheFolder = actionResult ? AC_DIRECTORY : CAS_DIRECTORY; return root.getChild(cacheFolder).getChild(key.substring(0, 2)).getChild(key); }
Source:
<code>public LockingResult acquireLockWait(EngineLock lock, long timeoutMillis) { log.debug("Before acquiring wait or timeout lock '{}'", lock); validateLockForAcquireAndWait(lock); if (timeoutMillis <= 0) { throw new IllegalArgumentException("timeout must be positive"); } long timeoutNanos = TimeUnit.MILLISECONDS.toNanos(timeoutMillis); LockingResult lockAcquired = <START> LockingResult.fail(Set.of()); <END> globalLock.lock(); try { do { lockAcquired = acquireLockInternal(lock); if (!lockAcquired.isAcquired()) { if (timeoutNanos <= 0L) { log.info("Failed to acquire lock because timeout was reached. lock {}", lock); break; } log.info("Failed to acquire lock, will try again until timeout. lock '{}'", lock); timeoutNanos = releasedLock.awaitNanos(timeoutNanos); } } while (!lockAcquired.isAcquired()); } catch (InterruptedException ignore) { log.info("Acquire lock operation was interrupted. lock '{}'", lock); } finally { globalLock.unlock(); } return lockAcquired; }</code><technical_language>LockingResult.FAILED</technical_language>

Target:
public LockingResult acquireLockWait(EngineLock lock, long timeoutMillis) { log.debug("Before acquiring wait or timeout lock '{}'", lock); validateLockForAcquireAndWait(lock); if (timeoutMillis <= 0) { throw new IllegalArgumentException("timeout must be positive"); } long timeoutNanos = TimeUnit.MILLISECONDS.toNanos(timeoutMillis); LockingResult lockAcquired = LockingResult.fail(); globalLock.lock(); try { do { lockAcquired = acquireLockInternal(lock); if (!lockAcquired.isAcquired()) { if (timeoutNanos <= 0L) { log.info("Failed to acquire lock because timeout was reached. lock {}", lock); break; } log.info("Failed to acquire lock, will try again until timeout. lock '{}'", lock); timeoutNanos = releasedLock.awaitNanos(timeoutNanos); } } while (!lockAcquired.isAcquired()); } catch (InterruptedException ignore) { log.info("Acquire lock operation was interrupted. lock '{}'", lock); } finally { globalLock.unlock(); } return lockAcquired; }
Source:
<code>public void testGetVersion() throws Exception { <START> Assert.assertEquals(carbonConfiguration.getVersion(), "5.0.0-SNAPSHOT"); <END> }</code><technical_language>this this value</technical_language>

Target:
public void testGetVersion() throws Exception { Assert.assertEquals(carbonConfiguration.getVersion(), "1.2.3"); }
Source:
<code>private void validateOCLocation() { if( selectedConnection != null ) { String ocValString = OCBinary.getInstance().getLocation(selectedConnection); <START> if( ocValString == null || ocValString.isEmpty()) { <END> ocLocationDecorator.show(); ocLocationDecorator.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()); ocLocationDecorator.setDescriptionText("The selected connection does not have an 'oc' command associated with it. Please edit the connection or modify your workspace settings to add one."); } else { ocLocationDecorator.hide(); } } }</code><technical_language>more expressive if (StringUtils.isEmpty())</technical_language>

Target:
private void validateOCLocation() { if (selectedConnection != null) { String ocValString = OCBinary.getInstance().getLocation(selectedConnection); if (StringUtils.isEmpty(ocValString)) { ocLocationDecorator.show(); ocLocationDecorator.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()); ocLocationDecorator.setDescriptionText( "The selected connection does not have an 'oc' command associated with it. Please edit the connection or modify your workspace settings to add one."); } else { ocLocationDecorator.hide(); } } }
Source:
<code>public void testGenerate(Path path) throws Exception { Path rootPath = getResourcePath(""); Path relativePath = rootPath.relativize(path); String testPath = relativePath.toString().replace( relativePath.getFileSystem().getSeparator(), "_"); File outputFolder = new File(outputFolderRoot, testPath); final SwiftGeneratorConfig config = SwiftGeneratorConfig.builder() .inputBase(Resources.getResource(TestSwiftGenerator.class, "/").toURI()) .outputFolder(outputFolder) .generateIncludedCode(true) .codeFlavor("java-immutable") .defaultPackage("com.facebook.swift") .addTweak(SwiftGeneratorTweak.ADD_CLOSEABLE_INTERFACE) .addTweak(SwiftGeneratorTweak.EXTEND_RUNTIME_EXCEPTION) .addTweak(SwiftGeneratorTweak.ADD_THRIFT_EXCEPTION) .addTweak(SwiftGeneratorTweak.USE_PLAIN_JAVA_NAMESPACE) .build(); final SwiftGenerator generator = new SwiftGenerator(config); <START> generator.parse(Collections.singletonList(path.toUri())); <END> }</code><technical_language>verify understanding -- this test checks generator parse IDLs barfing, right</technical_language>

Target:
public void testGenerate(Path path) throws Exception { Path rootPath = getResourcePath(""); Path relativePath = rootPath.relativize(path); String testPath = relativePath.toString().replace( relativePath.getFileSystem().getSeparator(), "_"); File outputDirectory = new File(outputFolderRoot, testPath); File sourceDirectory = new File(outputDirectory, "source"); File classesDirectory = new File(outputDirectory, "classes"); final SwiftGeneratorConfig config = SwiftGeneratorConfig.builder() .inputBase(Resources.getResource(getClass(), "/").toURI()) .outputFolder(sourceDirectory) .generateIncludedCode(true) .codeFlavor("java-immutable") .defaultPackage("com.facebook.swift") .addTweak(SwiftGeneratorTweak.ADD_CLOSEABLE_INTERFACE) .addTweak(SwiftGeneratorTweak.EXTEND_RUNTIME_EXCEPTION) .addTweak(SwiftGeneratorTweak.ADD_THRIFT_EXCEPTION) .addTweak(SwiftGeneratorTweak.USE_PLAIN_JAVA_NAMESPACE) .build(); final SwiftGenerator generator = new SwiftGenerator(config); generator.parse(Collections.singletonList(path.toUri())); assertCompilation( sourceDirectory.toPath(), classesDirectory.toPath()); }
Source:
<code><START> protected void createServerTemplateWithContainer() { <END> serverTemplate = new ServerTemplate(); serverTemplate.setName("test server"); serverTemplate.setId(UUID.randomUUID().toString()); Map<Capability, ContainerConfig> configs = new HashMap<Capability, ContainerConfig>(); ruleConfig = new RuleConfig(); ruleConfig.setPollInterval(1000l); ruleConfig.setScannerStatus(KieScannerStatus.STARTED); configs.put(Capability.RULE, ruleConfig); processConfig = new ProcessConfig(); processConfig.setKBase("defaultKieBase"); processConfig.setKSession("defaultKieSession"); processConfig.setMergeMode("MERGE_COLLECTION"); processConfig.setRuntimeStrategy("PER_PROCESS_INSTANCE"); configs.put(Capability.PROCESS, processConfig); containerSpec = new ContainerSpec(); containerSpec.setId("test container"); containerSpec.setServerTemplateKey(new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName())); containerSpec.setReleasedId(new ReleaseId("org.kie", "kie-server-kjar", "1.0")); containerSpec.setStatus(KieContainerStatus.STOPPED); containerSpec.setConfigs(configs); serverTemplate.addContainerSpec(containerSpec); container = new Container(); container.setServerInstanceId(serverTemplate.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setResolvedReleasedId(containerSpec.getReleasedId()); container.setContainerName(containerSpec.getContainerName()); container.setContainerSpecId(containerSpec.getId()); container.setUrl("<LINK_0>"); }</code><technical_language>Is reason this method is called in implementation classes in @Before method</technical_language>

Target:
protected void createServerTemplateWithContainer() { serverTemplate = new ServerTemplate(); serverTemplate.setName("test server"); setServerTemplateId(); Map<Capability, ContainerConfig> configs = new HashMap<Capability, ContainerConfig>(); ruleConfig = new RuleConfig(); ruleConfig.setPollInterval(1000l); ruleConfig.setScannerStatus(KieScannerStatus.STARTED); configs.put(Capability.RULE, ruleConfig); processConfig = new ProcessConfig(); processConfig.setKBase("defaultKieBase"); processConfig.setKSession("defaultKieSession"); processConfig.setMergeMode("MERGE_COLLECTION"); processConfig.setRuntimeStrategy("PER_PROCESS_INSTANCE"); configs.put(Capability.PROCESS, processConfig); containerSpec = new ContainerSpec(); containerSpec.setId("test container"); containerSpec.setServerTemplateKey(new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName())); containerSpec.setReleasedId(new ReleaseId("org.kie", "kie-server-kjar", "1.0")); containerSpec.setStatus(KieContainerStatus.STOPPED); containerSpec.setConfigs(configs); serverTemplate.addContainerSpec(containerSpec); container = new Container(); container.setServerInstanceId(serverTemplate.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setResolvedReleasedId(containerSpec.getReleasedId()); container.setContainerName(containerSpec.getContainerName()); container.setContainerSpecId(containerSpec.getId()); container.setUrl("<LINK_0>"); }
Source:
<code>public WordsInDocumentByDirectory(String directory, String[] exceptions, <START> boolean shuffle, long seed) { <END> File d = new File(directory); if (!d.exists() || !d.isDirectory()) { logger.error( "Error: '" + directory + "' does not exist or is not a directory."); new Exception().printStackTrace(); System.exit(1); } final String[] e = exceptions == null ? new String[0] : exceptions; Arrays.sort(e); File[] ds = d.listFiles( new FileFilter() { public boolean accept(File f) { return f.isDirectory() && Arrays.binarySearch(e, f.getName()) < 0; } }); files = new ArrayList<>(); for (File d1 : ds) { File[] fs = d1.listFiles( new FileFilter() { public boolean accept(File f) { return f.isFile(); } }); Collections.addAll(files, fs); } if (shuffle) { Random random = seed < 0 ? new Random() : new Random(seed); Collections.shuffle(files, random); } }</code><technical_language>exiting, STDERR</technical_language>

Target:
public WordsInDocumentByDirectory(String directory, String[] exceptions, boolean shuffle, long seed) { File d = new File(directory); if (!d.exists() || !d.isDirectory()) { System.err.println( "Error: '" + directory + "' does not exist or is not a directory."); new Exception().printStackTrace(); System.exit(1); } final String[] e = exceptions == null ? new String[0] : exceptions; Arrays.sort(e); File[] ds = d.listFiles( new FileFilter() { public boolean accept(File f) { return f.isDirectory() && Arrays.binarySearch(e, f.getName()) < 0; } }); files = new ArrayList<>(); for (File d1 : ds) { File[] fs = d1.listFiles( new FileFilter() { public boolean accept(File f) { return f.isFile(); } }); Collections.addAll(files, fs); } if (shuffle) { Random random = seed < 0 ? new Random() : new Random(seed); Collections.shuffle(files, random); } }
Source:
<code>public void init() throws Exception { <START> queryRunner = queryRunner != null ? queryRunner : queryRunnerSupplier.get(); <END> h2QueryRunner = new H2QueryRunner(); sqlParser = new SqlParser(); costCalculator = new CoefficientBasedCostCalculator(queryRunner.getMetadata()); }</code><technical_language>This wrong. @BeforeClass method called more once</technical_language>

Target:
public void init() throws Exception { queryRunner = queryRunnerSupplier.get(); h2QueryRunner = new H2QueryRunner(); sqlParser = new SqlParser(); costCalculator = new CoefficientBasedCostCalculator(queryRunner.getMetadata()); }
Source:
<code>public static Collection<SourceUnit> findAllSourceUnits(String repoURI) throws IOException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Retrieving source units"); } Set<Path> gradleFiles = new LinkedHashSet<>(); File rootGradleFile = new File("build.gradle"); if (rootGradleFile.exists() && !rootGradleFile.isDirectory()) { gradleFiles.add(rootGradleFile.toPath().toAbsolutePath().normalize()); <START> }else { <END> rootGradleFile = new File("settings.gradle"); if (rootGradleFile.exists() && !rootGradleFile.isDirectory()) { gradleFiles.add(rootGradleFile.toPath().toAbsolutePath().normalize()); } } gradleFiles.addAll(ScanUtil.findMatchingFiles("build.gradle")); Set<SourceUnit> units = new LinkedHashSet<>(); Set<Path> visited = new HashSet<>(); for (Path gradleFile : gradleFiles) { gradleFile = gradleFile.toAbsolutePath().normalize(); if (visited.contains(gradleFile)) { continue; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Processing Gradle file {}", gradleFile); } visited.add(gradleFile); try { units.addAll(createSourceUnits(gradleFile, repoURI, visited)); } catch (Exception e) { LOGGER.warn("An error occurred while processing Gradle file {}", gradleFile, e); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Resolving source unit dependencies"); } try { collectSourceUnitsDependencies(units); } catch (Exception e) { LOGGER.warn("An error occurred while resolving source unit dependencies", e); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Resolved source unit dependencies"); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Retrieved source units"); } return units; }</code><technical_language>formatting: } else {</technical_language>

Target:
public static Collection<SourceUnit> findAllSourceUnits(String repoURI) throws IOException { LOGGER.debug("Retrieving source units"); Set<Path> gradleFiles = new LinkedHashSet<>(); File rootGradleFile = new File("build.gradle"); if (rootGradleFile.exists() && !rootGradleFile.isDirectory()) { gradleFiles.add(rootGradleFile.toPath().toAbsolutePath().normalize()); } else { rootGradleFile = new File("settings.gradle"); if (rootGradleFile.exists() && !rootGradleFile.isDirectory()) { gradleFiles.add(rootGradleFile.toPath().toAbsolutePath().normalize()); } } gradleFiles.addAll(ScanUtil.findMatchingFiles("build.gradle")); Set<SourceUnit> units = new LinkedHashSet<>(); Set<Path> visited = new HashSet<>(); for (Path gradleFile : gradleFiles) { gradleFile = gradleFile.toAbsolutePath().normalize(); if (visited.contains(gradleFile)) { continue; } LOGGER.debug("Processing Gradle file {}", gradleFile); visited.add(gradleFile); try { units.addAll(createSourceUnits(gradleFile, repoURI, visited)); } catch (Exception e) { LOGGER.warn("An error occurred while processing Gradle file {}", gradleFile, e); } } LOGGER.debug("Resolving source unit dependencies"); try { collectSourceUnitsDependencies(units); } catch (Exception e) { LOGGER.warn("An error occurred while resolving source unit dependencies", e); } LOGGER.debug("Resolved source unit dependencies"); LOGGER.debug("Retrieved source units"); return units; }
Source:
<code>public static KFunction<?> findKotlinFunction(Method method) { KFunction<?> kotlinFunction = ReflectJvmMapping.getKotlinFunction(method); <START> if (kotlinFunction == null) { <END> return findKFunction(method).orElse(null); } return kotlinFunction; }</code><technical_language>Ternary if</technical_language>

Target:
public static KFunction<?> findKotlinFunction(Method method) { KFunction<?> kotlinFunction = ReflectJvmMapping.getKotlinFunction(method); return kotlinFunction == null ? findKFunction(method).orElse(null) : kotlinFunction; }
Source:
<code>void validatePersistentResult(QueryResult resultset, QueryHandle handle, boolean isDir) throws IOException { <START> if (resultset instanceof InMemoryQueryResult) { <END> validateInmemoryResult((InMemoryQueryResult) resultset); } }</code><technical_language>persistent result set is for JDBC driver well. casting resultset InMemoryQueryResult</technical_language>

Target:
void validatePersistentResult(QueryResult resultset, QueryHandle handle, boolean isDir) throws IOException { if (resultset instanceof InMemoryQueryResult) { validateInmemoryResult((InMemoryQueryResult) resultset); } else if (resultset instanceof PersistentQueryResult) { LOG.info(">> Validating persistent query result " + ((PersistentQueryResult) resultset).getPersistedURI()); List<String> rows = readResultSet((PersistentQueryResult) resultset, handle, isDir); assertEquals(rows.size(), NUM_RECORDS); } }
Source:
<code>public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { <START> return createBucketNodeMap( <END> nodeManager.getRequiredWorkerNodes().size(), value -> { throw new PrestoException(NOT_SUPPORTED, "Black hole connector does not supported distributed reads"); }); }</code><technical_language>consider making this change in commit introduced ConnectorBucketNodeMap</technical_language>

Target:
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { return createBucketNodeMap(nodeManager.getRequiredWorkerNodes().size()); }