auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onWorldLoad(WorldEvent.Load evt) { if (!(evt.getWorld().getWorldType() instanceof ICubicWorldType)) { return; } CubicChunks.LOGGER.info("Initializing world " + evt.getWorld() + " with type " + evt.getWorld().getWorldType()); ICubicWorld world = (ICubicWorld) evt.getWorld(); WorldType type = evt.getWorld().getWorldType(); if (type instanceof ICubicWorldType) { WorldProvider provider = ((ICubicWorldType) type).getReplacedProviderFor(world.getProvider()); ReflectionUtil.setFieldValueSrg(world, "field_73011_w", provider); } int minHeight = 0; int maxHeight = 255; WorldSavedDataHeightBounds heightBounds = null; if (!world.isRemote()) { heightBounds = (WorldSavedDataHeightBounds) evt.getWorld().getMapStorage().getOrLoadData(WorldSavedDataHeightBounds.class, "heightBounds"); if (heightBounds == null) { heightBounds = new WorldSavedDataHeightBounds("heightBounds"); } minHeight = heightBounds.minHeight; maxHeight = heightBounds.maxHeight; } else { <START> Iterator<IMessage> iIMessage = ClientHandler.getInstance().delayedPackets.iterator(); <END> while (iIMessage.hasNext()) { IMessage iMessage = iIMessage.next(); if (iMessage instanceof PacketWorldHeightBounds) { minHeight = ((PacketWorldHeightBounds) iMessage).getMinHeight(); maxHeight = ((PacketWorldHeightBounds) iMessage).getMaxHeight(); iIMessage.remove(); break; } } } world.initCubicWorld(minHeight, maxHeight); if (!world.isRemote()) { heightBounds.markDirty(); evt.getWorld().getMapStorage().setData("heightBounds", heightBounds); evt.getWorld().getMapStorage().saveAllData(); SpawnCubes.update(world); } }</code><technical_language>This in proxy. fail dedicated server. better: In client world subclass</technical_language>

Target:
public void onWorldLoad(WorldEvent.Load evt) { if (!(evt.getWorld().getWorldType() instanceof ICubicWorldType)) { return; } CubicChunks.LOGGER.info("Initializing world " + evt.getWorld() + " with type " + evt.getWorld().getWorldType()); ICubicWorld world = (ICubicWorld) evt.getWorld(); WorldType type = evt.getWorld().getWorldType(); if (type instanceof ICubicWorldType) { WorldProvider provider = ((ICubicWorldType) type).getReplacedProviderFor(world.getProvider()); ReflectionUtil.setFieldValueSrg(world, "field_73011_w", provider); } int minHeight = 0; int maxHeight = 255; WorldSavedDataHeightBounds heightBounds = null; if (!world.isRemote()) { heightBounds = (WorldSavedDataHeightBounds) evt.getWorld().getMapStorage().getOrLoadData(WorldSavedDataHeightBounds.class, "heightBounds"); if (heightBounds == null) { heightBounds = new WorldSavedDataHeightBounds("heightBounds"); } minHeight = heightBounds.minHeight; maxHeight = heightBounds.maxHeight; } world.initCubicWorld(minHeight, maxHeight); if (!world.isRemote()) { heightBounds.markDirty(); evt.getWorld().getMapStorage().setData("heightBounds", heightBounds); evt.getWorld().getMapStorage().saveAllData(); SpawnCubes.update(world); } }
Source:
<code>public CidrContainer(String cidr) { <START> super(); <END> this.cidr = cidr; }</code><technical_language>call for empty c'tor is redundant</technical_language>

Target:
public CidrContainer(String cidr) { this.cidr = cidr; }
Source:
<code>public void testUnmatchedVersionQuery() throws Exception { setupForTest(); String testVersionName = ""; <START> for (String versionName : expectedVersionMap.keySet()) { <END> testVersionName = testVersionName + expectedVersionMap.get(versionName).getVersion(); } Version returnedVersion = versionUtil.getVersion(testVersionName); fail("expected exception (InvalidVersionException) did not get thrown"); }</code><technical_language>this is appending versions long string? Is this hardcoding some a version name</technical_language>

Target:
public void testUnmatchedVersionQuery() throws Exception { String testVersionName = "THIS_STRING_IS_VERY_UNLIKELY_TO_EVER_BE_USED_FOR_THE_NAME_OF_AN_ACTUAL_ONCOTREE_VERSION"; Version returnedVersion = versionUtil.getVersion(testVersionName); fail("expected exception (InvalidVersionException) did not get thrown"); }
Source:
<code>public void should_define_data_table_parameter_type() { <START> DataTableType expected = new DataTableType(Date.class, (TableTransformer<Date>) dataTable -> null); <END> registry.defineDataTableType(expected); assertEquals(expected, registry.dataTableTypeRegistry().lookupTableTypeByType(Date.class)); }</code><technical_language>here. need cast</technical_language>

Target:
public void should_define_data_table_parameter_type() { DataTableType expected = new DataTableType(Date.class, (DataTable dataTable) -> null); registry.defineDataTableType(expected); assertEquals(expected, registry.dataTableTypeRegistry().lookupTableTypeByType(Date.class)); }
Source:
<code>public static boolean checkResponse(JsonObject jsonResponse) { if (jsonResponse == null) { return false; } else if (jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()) != null) { return jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()).toString() .equals(JSONApiResponseKeysEnum.RESPONSE_SUCCESSFUL.getKey()); } else { logger.error("JSONResponseHandler: error in json request. Error message : {}", <START> jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_MESSAGE.getKey()).toString()); <END> } return false; }</code><technical_language>remove toString()</technical_language>

Target:
public static boolean checkResponse(JsonObject jsonResponse) { if (jsonResponse == null) { return false; } else if (jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()) != null) { return jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()).toString() .equals(JSONApiResponseKeysEnum.RESPONSE_SUCCESSFUL.getKey()); } else { logger.error("JSONResponseHandler: error in json request. Error message : {}", jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_MESSAGE.getKey())); } return false; }
Source:
<code>public boolean isAdbEnabled(byte transportType) { if (transportType == AdbTransportType.USB) { return mAdbUsbEnabled; } else if (transportType == AdbTransportType.WIFI) { return mAdbWifiEnabled; } <START> Slog.e(TAG, "Unknown AdbTransportType (" + transportType + ")"); <END> return false; }</code><technical_language>throw IllegalArgumentException</technical_language>

Target:
public boolean isAdbEnabled(byte transportType) { if (transportType == AdbTransportType.USB) { return mAdbUsbEnabled; } else if (transportType == AdbTransportType.WIFI) { return mAdbWifiEnabled; } throw new IllegalArgumentException( "isAdbEnabled called with unimplemented transport type=" + transportType); }
Source:
<code>static <T> Attribute of(final NamedAttributeAccess<T> namedAttributeAccess, final T value) { final String name = namedAttributeAccess.getName(); <START> final ObjectMapper mapper = SphereJsonUtils.newObjectMapper(); <END> final SimpleModule module = new SimpleModule(); module.addSerializer(new ReferenceInternalSerializer()); mapper.registerModule(module); final JsonNode jsonNode = mapper.valueToTree(value); return of(name, jsonNode); }</code><technical_language>try store ObjectMapper in a static field - preferably in a package protected helper class. This avoid recreate again. I this thread safe too. do it</technical_language>

Target:
static <T> Attribute of(final NamedAttributeAccess<T> namedAttributeAccess, final T value) { final String name = namedAttributeAccess.getName(); final JsonNode jsonNode = ReferenceInternalObjectMapper.getInstance().valueToTree(value); return of(name, jsonNode); }
Source:
<code>private void deleteVolumeFromCinder(CinderDisk lastCinderVolume) { try { getCinderBroker().deleteVolumeByClassificationType(lastCinderVolume); } catch (Exception e) { if (!getParameters().isFaultTolerant()) { throw e; } else { <START> log.error("Failed to remove volume from Cinder provider. continue to delete the disk from the DB since the fault tollerant flag is true."); <END> } } }</code><technical_language>formatter</technical_language>

Target:
private void deleteVolumeFromCinder(CinderDisk lastCinderVolume) { try { getCinderBroker().deleteVolumeByClassificationType(lastCinderVolume); } catch (Exception e) { if (!getParameters().isFaultTolerant()) { throw e; } else { log.error("Failed to remove volume from Cinder provider. continue to delete the disk."); } } }
Source:
<code>private boolean contains(Collection<IRequirement> required, String iu) { for (IRequirement <START> iRequirement : <END> required) { IRequiredCapability req = (IRequiredCapability) iRequirement; if (req.getName().equalsIgnoreCase(iu)) return true; } return false; }</code><technical_language>rename requirement</technical_language>

Target:
private boolean contains(Collection<IRequirement> required, String iu) { for (IRequirement requirement : required) { IRequiredCapability req = (IRequiredCapability) requirement; if (req.getName().equalsIgnoreCase(iu)) return true; } return false; }
Source:
<code>final double truncate(double x) { <START> return Math.floor(x * scale + 0.5) / scale; <END> }</code><technical_language>a minutes understand +0.5 coming from. Basically decimal number right ? if want 8 decimals want truncate number 3.123456786: 3.123456786 * 10E8 + 05 = 312345678.6 + 0.5 = 312345679.1 Math.floor() get largest integer is equal argument</technical_language>

Target:
final double truncate(double x) { double scaled = x * scale; scaled += 0.5; scaled = Math.floor(scaled); return scaled / scale; }
Source:
<code>public boolean matches(ILoggingEvent actual) { actualMsg = actual.getMessage().split("(?s)[\\r\\n]+")[0]; if (actualMsg.matches(expected)) { return actual.getMessage().contains(NEWLINE) == shouldContainNewline; <START> } else { <END> return false; } }</code><technical_language>nit: remove else return in if block anyway</technical_language>

Target:
public boolean matches(ILoggingEvent actual) { actualMsg = actual.getMessage().split("(?s)[\\r\\n]+")[0]; if (actualMsg.matches(expected)) { return actual.getMessage().contains(NEWLINE) == shouldContainNewline; } return false; }
Source:
<code>private static String formatMessage(OrcDataSourceId orcDataSourceId, String messageFormat, Object[] args) { <START> return "Malformed ORC file " + orcDataSourceId + ". " + format(messageFormat, args); <END> }</code><technical_language>format brackets: Malformed ORC file [hdfs://abc/xyz]. Invalid file size: 1234 put end: Malformed ORC file. Invalid file size: 1234 (hdfs://abc/xyz) Malformed ORC file. Invalid file size: 1234 [hdfs://abc/xyz] Malformed ORC file. Invalid file size: 1234 (file: hdfs://abc/xyz) If current best, fine too</technical_language>

Target:
private static String formatMessage(OrcDataSourceId orcDataSourceId, String messageFormat, Object[] args) { return "Malformed ORC file. " + format(messageFormat, args) + " [" + orcDataSourceId + "]"; }
Source:
<code>protected void syncSearch() { if (getEntity() == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.setModel(getViewFilterType()); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(final Object model, Object ReturnValue) { if (model.equals(getViewFilterType())) { final Iterable returnList = (Iterable) ((VdcQueryReturnValue) ReturnValue).getReturnValue(); <START> final List<PairQueryable<VdsNetworkInterface, VDS>> items = <END> new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { for (Object obj : returnList) { items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj)); } setItems(items); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { initAttachedByLabelInterfaces((List<PairQueryable<VdsNetworkInterface, VDS>>) returnList); } } } }; IdQueryParameters params = new IdQueryParameters(getEntity().getId()); params.setRefresh(getIsQueryFirstTime()); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsWithoutNetwork, params, asyncQuery); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery); } setIsQueryFirstTime(false); }</code><technical_language>This is relevant unattached case, I put if clause</technical_language>

Target:
protected void syncSearch() { if (getEntity() == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.setModel(getViewFilterType()); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(final Object model, Object ReturnValue) { if (model.equals(getViewFilterType())) { final Iterable returnList = (Iterable) ((VdcQueryReturnValue) ReturnValue).getReturnValue(); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); for (Object obj : returnList) { items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj)); } setItems(items); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { initAttachedInterfaces((List<PairQueryable<VdsNetworkInterface, VDS>>) returnList); } } } }; IdQueryParameters params = new IdQueryParameters(getEntity().getId()); params.setRefresh(getIsQueryFirstTime()); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsWithoutNetwork, params, asyncQuery); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery); } setIsQueryFirstTime(false); }
Source:
<code>private static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) { if (chunkSize < 0) { throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?"); } <START> if (fileLength < chunkSize) { <END> return 1; } final long numChunks = (fileLength / chunkSize); if (numChunks > Integer.MAX_VALUE) { log.rescalingChunksize(fileName, fileLength, chunkSize); chunkSize = 32 * chunkSize; return figureChunksNumber(fileName, fileLength, chunkSize); } else { return (int)numChunks; } }</code><technical_language>I hope mind I extract this a separate JIRA: <LINK_0></technical_language>

Target:
public static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) { if (chunkSize < 0) { throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?"); } final long numChunks = (fileLength % chunkSize == 0) ? (fileLength / chunkSize) : (fileLength / chunkSize) + 1; if (numChunks > Integer.MAX_VALUE) { log.rescalingChunksize(fileName, fileLength, chunkSize); chunkSize = 32 * chunkSize; return figureChunksNumber(fileName, fileLength, chunkSize); } else { return (int)numChunks; } }
Source:
<code>protected VDSGroup lookupClusterById(String id) { GetVdsGroupByIdParameters params = new GetVdsGroupByIdParameters(Guid.createGuidFromString(id)); <START> params.setFiltered(SessionUtils.isFiltered()); <END> return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupById, params, id); }</code><technical_language>this is in getEntity()? solve this in generic way..</technical_language>

Target:
protected VDSGroup lookupClusterById(String id) { return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupById, new GetVdsGroupByIdParameters(Guid.createGuidFromString(id)), id); }
Source:
<code>void safeRun(final Runnable task) { if (task == null) return; final Thread currentThread = Thread.currentThread(); final ClassLoader oldCl = JBossExecutors.getContextClassLoader(currentThread); JBossExecutors.clearContextClassLoader(currentThread); try { task.run(); } catch (Throwable t) { try { exceptionHandler.uncaughtException(Thread.currentThread(), t); } catch (Throwable ignored) { } } finally { <START> JBossExecutors.setContextClassLoader(currentThread, oldCl); <END> Thread.interrupted(); } }</code><technical_language>I thought ContextClassLoaderSavingRunnable care of this, do need JBossExecutors.classLoaderPreservingTaskUnchecked(runnable); in execute custom handling here</technical_language>

Target:
void safeRun(final Runnable task) { if (task == null) return; try { task.run(); } catch (Throwable t) { try { exceptionHandler.uncaughtException(Thread.currentThread(), t); } catch (Throwable ignored) { } } }
Source:
<code>public List<State> queryKeyValueWithOperator(String key1, Object value1, String key2, DBSQueryOperator operator, Object value2, Set<String> ignored) { <START> Map<String, Object> comparatorAndValue = null; <END> if (DBSQueryOperator.IN == operator) { comparatorAndValue = Collections.singletonMap(QueryOperators.IN, value2); } else if (DBSQueryOperator.NOT_IN == operator) { comparatorAndValue = Collections.singletonMap(QueryOperators.NIN, value2); } else { throw new IllegalArgumentException(String.format("Unknown operator: %s", operator)); } Document filter = new Document(converter.keyToBson(key1), value1); filter.put(converter.keyToBson(key2), comparatorAndValue); addIgnoredIds(filter, ignored); return findAll(filter); }</code><technical_language>remove = null</technical_language>

Target:
public List<State> queryKeyValueWithOperator(String key1, Object value1, String key2, DBSQueryOperator operator, Object value2, Set<String> ignored) { Map<String, Object> comparatorAndValue; switch (operator) { case IN: comparatorAndValue = Collections.singletonMap(QueryOperators.IN, value2); break; case NOT_IN: comparatorAndValue = Collections.singletonMap(QueryOperators.NIN, value2); break; default: throw new IllegalArgumentException(String.format("Unknown operator: %s", operator)); } Document filter = new Document(converter.keyToBson(key1), value1); filter.put(converter.keyToBson(key2), comparatorAndValue); addIgnoredIds(filter, ignored); return findAll(filter); }
Source:
<code><START> public String getPushConfigName() { <END> return mPushConfigName; }</code><technical_language>expose this getter for now</technical_language>

Target:
private String getPushConfigName() { return mPushConfigName; }
Source:
<code>public void noRefLog() throws IOException { writeRef("refs/heads/master", A); Map<String, ReflogEntry> oldLogs = getLastReflogs("refs/heads/master", "refs/heads/branch"); assertEquals(Collections.singleton("refs/heads/master"), oldLogs.keySet()); List<ReceiveCommand> cmds = Arrays.asList( new ReceiveCommand(A, B, "refs/heads/master", UPDATE), new ReceiveCommand(zeroId(), B, "refs/heads/branch", CREATE)); execute(newBatchUpdate(cmds).setAllowNonFastForwards(true)); assertResults(cmds, OK, OK); assertRefs( "refs/heads/master", B, "refs/heads/branch", B); assertEquals((atomic || useReftable) <START> ?2 : <END> 3, refsChangedEvents); assertReflogUnchanged(oldLogs, "refs/heads/master"); assertReflogUnchanged(oldLogs, "refs/heads/branch"); }</code><technical_language>micronit: missing space (and for others)</technical_language>

Target:
public void noRefLog() throws IOException { writeRef("refs/heads/master", A); Map<String, ReflogEntry> oldLogs = getLastReflogs("refs/heads/master", "refs/heads/branch"); assertEquals(Collections.singleton("refs/heads/master"), oldLogs.keySet()); List<ReceiveCommand> cmds = Arrays.asList( new ReceiveCommand(A, B, "refs/heads/master", UPDATE), new ReceiveCommand(zeroId(), B, "refs/heads/branch", CREATE)); execute(newBatchUpdate(cmds).setAllowNonFastForwards(true)); assertResults(cmds, OK, OK); assertRefs( "refs/heads/master", B, "refs/heads/branch", B); assertEquals(batchesRefUpdates() ?2 : 3, refsChangedEvents); assertReflogUnchanged(oldLogs, "refs/heads/master"); assertReflogUnchanged(oldLogs, "refs/heads/branch"); }
Source:
<code>public List<KieServerState> retrieveAllKieServerStates() { return processKieServerState(client -> { return client.configMaps().list().getItems() <START> .stream() <END> .map(cfg -> (KieServerState) xs.fromXML(cfg.getData().get(CFG_MAP_DATA_KEY))) .collect(Collectors.toList()); }); }</code><technical_language>here, code count case config map is for other Kie server state</technical_language>

Target:
public List<KieServerState> retrieveAllKieServerStates() { return processKieServerStateByOpenShift(client -> { return client.configMaps().withLabel(CFG_MAP_LABEL_NAME, CFG_MAP_LABEL_VALUE).list().getItems() .stream() .map(cfg -> (KieServerState) xs.fromXML(cfg.getData().get(CFG_MAP_DATA_KEY))) .collect(Collectors.toList()); }); }
Source:
<code>public ListenableFuture<Set<String>> reload(final String key, Set<String> oldValue) throws Exception { LOG.debug("GroupCacheLoader - reload (async)."); if (!reloadGroupsInBackground) { return super.reload(key, oldValue); } backgroundRefreshQueued.incrementAndGet(); ListenableFuture<Set<String>> listenableFuture = <START> executorService.submit(new Callable<Set<String>>() { <END> @Override public Set<String> call() throws Exception { backgroundRefreshQueued.decrementAndGet(); backgroundRefreshRunning.incrementAndGet(); Set<String> results = load(key); return results; } }); Futures.addCallback(listenableFuture, new FutureCallback<Set<String>>() { @Override public void onSuccess(Set<String> result) { backgroundRefreshSuccess.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } @Override public void onFailure(Throwable t) { backgroundRefreshException.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } }, MoreExecutors.directExecutor()); return listenableFuture; }</code><technical_language>replace lambda statement</technical_language>

Target:
public ListenableFuture<Set<String>> reload(final String key, Set<String> oldValue) throws Exception { LOG.debug("GroupCacheLoader - reload (async)."); if (!reloadGroupsInBackground) { return super.reload(key, oldValue); } backgroundRefreshQueued.incrementAndGet(); ListenableFuture<Set<String>> listenableFuture = executorService.submit(() -> { backgroundRefreshQueued.decrementAndGet(); backgroundRefreshRunning.incrementAndGet(); Set<String> results = load(key); return results; }); Futures.addCallback(listenableFuture, new FutureCallback<Set<String>>() { @Override public void onSuccess(Set<String> result) { backgroundRefreshSuccess.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } @Override public void onFailure(Throwable t) { backgroundRefreshException.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } }, MoreExecutors.directExecutor()); return listenableFuture; }
Source:
<code>private void resortEquations() { final List<CalculatorVariable> resortedEquations = new ArrayList<>(); <START> String chars = ""; <END> if (currentFormat == Settings.CoordInputFormatEnum.Plain) { final String lat = ePlainLat.getText().toString(); final String lon = ePlainLon.getText().toString(); char first; if (lat.length() > 0) { first = lat.charAt(0); if (first == 'N' || first == 'S') { chars = chars.concat(lat.substring(1)); } else { chars = chars.concat(lat); } } if (lon.length() > 0) { first = lon.charAt(0); if (first == 'E' || first == 'W') { chars = chars.concat(lon.substring(1)); } else { chars = chars.concat(lon); } } } else { for (final EditButton b : coordButtons) { chars = chars.concat(String.valueOf(b.getLabel())); } } for (int i = 0; i<chars.length(); i++) { final char ch = chars.charAt(i); if ('A' <= ch && ch <= 'Z') { if (findVariable(ch, resortedEquations) != null) { continue; } CalculatorVariable thisEquation = findVariable(ch, equations); if (thisEquation == null) { thisEquation = new CalculatorVariable(getContext(), new CalculatorVariable.VariableData(ch), getString(R.string.equation_hint), new EquationWatcher()); } resortedEquations.add(thisEquation); } } equations = resortedEquations; updateGrid(equations, equationGrid, 0); resortFreeVariables(); }</code><technical_language>chars</technical_language>

Target:
private void resortEquations() { String coordinateChars = ""; if (currentFormat == Settings.CoordInputFormatEnum.Plain) { final String lat = ePlainLat.getText().toString(); final String lon = ePlainLon.getText().toString(); char first; if (lat.length() > 0) { first = lat.charAt(0); if (first == 'N' || first == 'S') { coordinateChars = coordinateChars.concat(lat.substring(1)); } else { coordinateChars = coordinateChars.concat(lat); } } if (lon.length() > 0) { first = lon.charAt(0); if (first == 'E' || first == 'W') { coordinateChars = coordinateChars.concat(lon.substring(1)); } else { coordinateChars = coordinateChars.concat(lon); } } } else { for (final EditButton b : coordButtons) { coordinateChars = coordinateChars.concat(String.valueOf(b.getLabel())); } } equations = sortVariables(equations, coordinateChars, new Range('A', 'Z'), getString(R.string.equation_hint), new EquationWatcher()); updateGrid(equations, equationGrid, 0); resortFreeVariables(); }
Source:
<code>public static <E extends VmDevice> Map<String, E> vmDevicesByDevice(Collection<E> deviceList) { if (deviceList != null) { <START> Map<String, E> map = new HashMap<String, E>(); <END> for (E device : deviceList) { if (device.getDevice() != null) { map.put(device.getDevice(), device); } } return map; } else { return Collections.emptyMap(); } }</code><technical_language>empty diamond? Map<String, E> map = new HashMap<>();</technical_language>

Target:
public static <E extends VmDevice> Map<String, E> vmDevicesByDevice(Collection<E> deviceList) { if (deviceList != null) { Map<String, E> map = new HashMap<>(); for (E device : deviceList) { if (device.getDevice() != null) { map.put(device.getDevice(), device); } } return map; } else { return Collections.emptyMap(); } }
Source:
<code>private void doTaskStart() { if(!started) { String executionId = UUID.randomUUID().toString(); this.taskExecution = new TaskExecution(); <START> this.taskExecution.setTaskName(applicationContext.getId()); <END> this.taskExecution.setStartTime(new Date()); this.taskExecution.setExecutionId(executionId); this.taskRepository.createTaskExecution(this.taskExecution); } else { logger.warn("Multiple start events have been received. The first one was " + "recorded."); } }</code><technical_language>spring.application.name boot property instead of applicationContext.getId</technical_language>

Target:
private void doTaskStart() { if(!started) { String executionId = UUID.randomUUID().toString(); this.taskExecution = new TaskExecution(); this.taskExecution.setTaskName(applicationContext.getId()); this.taskExecution.setStartTime(new Date()); this.taskExecution.setExecutionId(executionId); this.taskRepository.createTaskExecution(this.taskExecution); } else { logger.error("Multiple start events have been received. The first one was " + "recorded."); } }
Source:
<code>public boolean isNull() { <START> return getObject() == null; <END> }</code><technical_language>current methods implemented, return false</technical_language>

Target:
public boolean isNull() { return getObject().isNull(); }
Source:
<code><START> public Set<String> getBlacklist() { <END> return blacklistedIDs; }</code><technical_language>need return a copy of data, more appropriately in this case, unmodifyableSet() wrapper of set</technical_language>

Target:
public Set getBlacklist() { return Collections.unmodifiableSet(blacklistedIDs); }
Source:
<code>protected ElementGroup createQueryPattern(Template t){ ElementGroup elg = new ElementGroup(); List<Quad> quads = t.getQuads(); <START> HashMap<Node, BasicPattern> graphs = new HashMap<Node, BasicPattern>(); <END> for (Quad q: quads){ BasicPattern bgp = graphs.get(q.getGraph()); if (bgp == null){ bgp = new BasicPattern(); graphs.put(q.getGraph(), bgp); } bgp.add( q.asTriple() ); } for(Node n: graphs.keySet()){ Element el = new ElementPathBlock(graphs.get(n)); if(! Quad.defaultGraphIRI.equals(n) ){ el = new ElementNamedGraph(n, el); } elg.addElement(el); } return elg; }</code><technical_language>new HashMap<> is Java 7</technical_language>

Target:
protected ElementGroup createQueryPattern(Template t){ ElementGroup elg = new ElementGroup(); Map<Node, BasicPattern> graphs = t.getGraphPattern(); for(Node n: graphs.keySet()){ Element el = new ElementPathBlock(graphs.get(n)); if(! Quad.defaultGraphNodeGenerated.equals(n) ){ ElementGroup e = new ElementGroup(); e.addElement(el); el = new ElementNamedGraph(n, e); } elg.addElement(el); } return elg; }
Source:
<code>public BasicScoreBasedSnippetChooser(boolean scoreOrdered, SnippetWeigher snippetWeigher, int maxSnippetsChecked) { <START> super(); <END> this.scoreOrdered = scoreOrdered; this.maxSnippetsChecked = maxSnippetsChecked; this.snippetWeigher = snippetWeigher; }</code><technical_language>I write no-args super constructors implied. I figure read "obvious". for php developers for else</technical_language>

Target:
public BasicScoreBasedSnippetChooser(boolean scoreOrdered, SnippetWeigher snippetWeigher, int maxSnippetsChecked) { this.scoreOrdered = scoreOrdered; this.maxSnippetsChecked = maxSnippetsChecked; this.snippetWeigher = snippetWeigher; }
Source:
<code>public void waitForReady() throws InterruptedException { Thread t = Thread.currentThread(); String oldName = t.getName(); try { int retries = 0; while (true) { Thread.sleep(1000 * 10); try { URL url = toAgentListenerURL(first(jenkinsUrls)); if (url == null) { return; } retries++; t.setName(oldName + ": trying " + url + " for " + retries + " times"); HttpURLConnection con = (HttpURLConnection) openURLConnection(url, credentials, proxyCredentials, sslSocketFactory); con.setConnectTimeout(5000); con.setReadTimeout(5000); con.connect(); if (con.getResponseCode() == 200) { return; } LOGGER.log(Level.INFO, "Master isn't ready to talk to us on {0}. Will retry again: response code={1}", new Object[]{url, con.getResponseCode()}); } catch (SocketTimeoutException e) { <START> LOGGER.log(INFO, "Failed to connect to the master. Will retry again: {0} {1}", <END> new String[] { e.getClass().getName(), e.getMessage() }); } catch (IOException e) { LOGGER.log(INFO, "Failed to connect to the master. Will retry again", e); } } } finally { t.setName(oldName); } }</code><technical_language>I print "Failed connect master" then. "Socket Timeout while connecting master"</technical_language>

Target:
public void waitForReady() throws InterruptedException { Thread t = Thread.currentThread(); String oldName = t.getName(); try { int retries = 0; while (true) { Thread.sleep(1000 * 10); try { URL url = toAgentListenerURL(first(jenkinsUrls)); if (url == null) { return; } retries++; t.setName(oldName + ": trying " + url + " for " + retries + " times"); HttpURLConnection con = (HttpURLConnection) openURLConnection(url, credentials, proxyCredentials, sslSocketFactory); con.setConnectTimeout(5000); con.setReadTimeout(5000); con.connect(); if (con.getResponseCode() == 200) { return; } LOGGER.log(Level.INFO, "Master isn''t ready to talk to us on {0}. Will try again: response code={1}", new Object[]{url, con.getResponseCode()}); } catch (SocketTimeoutException | ConnectException | NoRouteToHostException e) { LOGGER.log(INFO, "Failed to connect to the master. Will try again: {0} {1}", new String[] { e.getClass().getName(), e.getMessage() }); } catch (IOException e) { LOGGER.log(INFO, "Failed to connect to the master. Will try again", e); } } } finally { t.setName(oldName); } }
Source:
<code>private boolean isPlatformExtern(CompilerInput symbolInput) { String name = symbolInput.getName(); name = name.replace("externs.zip <START> return name.startsWith("javascript/externs") || name.startsWith("es") || name.startsWith("w3c") <END> || name.startsWith("ie_") || name.startsWith("browser"); }</code><technical_language>nit: javascript/externs/ a slightly more precise match</technical_language>

Target:
private boolean isPlatformExtern(CompilerInput symbolInput) { String name = symbolInput.getName(); name = name.replace("externs.zip return name.startsWith("javascript/externs/") || name.startsWith("es") || name.startsWith("w3c") || name.startsWith("ie_") || name.startsWith("browser"); }
Source:
<code>private Iterator<?> createIteratorForCascadedValue(Type type, Object value, ValueContext<?, ?> valueContext) { Iterator<?> iter; if ( ReflectionHelper.isIterable( type ) ) { iter = ( (Iterable<?>) value ).iterator(); valueContext.markCurrentPropertyAsIterable(); } else if ( ReflectionHelper.isMap( type ) ) { Map<?, ?> map = (Map<?, ?>) value; iter = map.entrySet().iterator(); valueContext.markCurrentPropertyAsIterable(); } else if ( TypeHelper.isArray( type ) ) { List<?> arrayList = Arrays.asList( (Object[]) value ); iter = arrayList.iterator(); valueContext.markCurrentPropertyAsIterable(); } else { <START> List<Object> list = newArrayList(); <END> list.add( value ); iter = list.iterator(); } return iter; }</code><technical_language>Collections#singletonList() here</technical_language>

Target:
private Iterator<?> createIteratorForCascadedValue(Type type, Object value, ValueContext<?, ?> valueContext) { Iterator<?> iter; if ( ReflectionHelper.isIterable( type ) ) { iter = ( (Iterable<?>) value ).iterator(); valueContext.markCurrentPropertyAsIterable(); } else if ( ReflectionHelper.isMap( type ) ) { Map<?, ?> map = (Map<?, ?>) value; iter = map.entrySet().iterator(); valueContext.markCurrentPropertyAsIterable(); } else if ( TypeHelper.isArray( type ) ) { List<?> arrayList = Arrays.asList( (Object[]) value ); iter = arrayList.iterator(); valueContext.markCurrentPropertyAsIterable(); } else { iter = Collections.singletonList( value ).iterator(); } return iter; }
Source:
<code>public void verifyFixPositionOfSmartBanner(PerformTouchAction touchAction) { int firstPosition = smartBanner.getLocation().getY(); touchAction.swipeFromPointToPoint(50, 90, 50, 40, 500, 3000); int secondPosition = smartBanner.getLocation().getY(); <START> if (firstPosition == secondPosition) { <END> PageObjectLogging.log("verifyFixPositionOfSmartBanner", "Smart banner is fixed", true); } else { PageObjectLogging.log("verifyFixPositionOfSmartBanner", "Smart banner is floating", false); } }</code><technical_language>need for variables if once</technical_language>

Target:
public void verifyFixPositionOfSmartBanner(PerformTouchAction touchAction) { int lastPosition = smartBanner.getLocation().getY(); touchAction.swipeFromPointToPoint(50, 90, 50, 40, 500, 3000); if (lastPosition == smartBanner.getLocation().getY()) { PageObjectLogging.log("verifyFixPositionOfSmartBanner", "Smart banner is fixed", true); } else { PageObjectLogging.log("verifyFixPositionOfSmartBanner", "Smart banner is floating", false); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TexParserResult result = (TexParserResult) o; <START> return fileList.equals(result.fileList) <END> && nestedFiles.equals(result.nestedFiles) && citations.equals(result.citations); }</code><technical_language>above, if Object.equals(a,b) care of types</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TexParserResult that = (TexParserResult) o; return Objects.equals(fileList, that.fileList) && Objects.equals(nestedFiles, that.nestedFiles) && Objects.equals(citations, that.citations); }
Source:
<code>public static CommandContext getCommandContext(String address, int port, InputStream in, OutputStream out, int connectionTimeout) throws CliInitializationException { System.setProperty("aesh.terminal","org.jboss.aesh.terminal.TestTerminal"); setJBossCliConfig(); return CommandContextFactory.getInstance().newCommandContext(new CommandContextConfiguration.Builder() .setController(address + ":" + port) .setUsername(isRemote ? username : null) .setPassword(isRemote ? password.toCharArray() : null) .setConsoleInput(in) .setConsoleOutput(out) .setDisableLocalAuth(false) .setInitConsole(false) <START> .setConnectionTimeout(TimeoutUtil.adjust(connectionTimeout)) <END> .build()); }</code><technical_language>TimeoutUtil.adjust throw exception is passed is negative, no</technical_language>

Target:
public static CommandContext getCommandContext(String address, int port, InputStream in, OutputStream out, int connectionTimeout) throws CliInitializationException { System.setProperty("aesh.terminal","org.jboss.aesh.terminal.TestTerminal"); setJBossCliConfig(); return CommandContextFactory.getInstance().newCommandContext(new CommandContextConfiguration.Builder() .setController(address + ":" + port) .setUsername(isRemote ? username : null) .setPassword(isRemote ? password.toCharArray() : null) .setConsoleInput(in) .setConsoleOutput(out) .setDisableLocalAuth(false) .setInitConsole(false) .setConnectionTimeout(connectionTimeout) .build()); }
Source:
<code><START> public DecayTDigest(double compression, double alpha, Ticker ticker) <END> { digest = new TDigest(compression); this.alpha = alpha; this.ticker = ticker; landmarkInSeconds = TimeUnit.NANOSECONDS.toSeconds(ticker.read()); }</code><technical_language>this package protected</technical_language>

Target:
DecayTDigest(double compression, double alpha, Ticker ticker) { digest = new TDigest(compression); this.alpha = alpha; this.ticker = ticker; landmarkInSeconds = TimeUnit.NANOSECONDS.toSeconds(ticker.read()); }
Source:
<code>private String getAcbNamesAsCommaSeparatedList(JobExecutionContext jobContext) { if (Objects.nonNull(jobContext.getMergedJobDataMap().getString("acb"))) { <START> return Arrays.asList(jobContext.getMergedJobDataMap().getString("acb").split("\u263A")).stream() <END> .map(acbId -> { try { return certificationBodyDAO.getById(Long.parseLong(acbId)).getName(); } catch (NumberFormatException | EntityRetrievalException e) { LOGGER.error("Could not retreive ACB name based on value: " + acbId, e); return ""; } }) .collect(Collectors.joining(", ")); } else { return ""; } }</code><technical_language>I SPLIT_CHAR defined a constant in PendingChangeRequestEmailJob. sense move \u263A a constant well</technical_language>

Target:
private String getAcbNamesAsCommaSeparatedList(JobExecutionContext jobContext) { if (Objects.nonNull(jobContext.getMergedJobDataMap().getString("acb"))) { return Arrays.asList( jobContext.getMergedJobDataMap().getString("acb").split(SchedulerManager.DATA_DELIMITER)).stream() .map(acbId -> { try { return certificationBodyDAO.getById(Long.parseLong(acbId)).getName(); } catch (NumberFormatException | EntityRetrievalException e) { LOGGER.error("Could not retreive ACB name based on value: " + acbId, e); return ""; } }) .collect(Collectors.joining(", ")); } else { return ""; } }
Source:
<code><START> private List getTokenizedList(String value) { <END> List<Object> tokenizedList = new ArrayList<>(); char[] charArray = value.trim().toCharArray(); StringBuffer currentToken = new StringBuffer(""); boolean isCurrentTokenNumeric = false; for (int i = 0; i < charArray.length; i++) { char c = charArray[i]; boolean hasPrevChar = i > 0; boolean hasNextChar = i < charArray.length - 1; if (Character.isDigit(c) || (c == '.' && hasNextChar && Character.isDigit(charArray[i + 1])) || (c == ',' && hasNextChar && hasPrevChar && Character.isDigit(charArray[i - 1]) && Character.isDigit(charArray[i + 1])) || (c == '-' && !hasPrevChar && hasNextChar && Character.isDigit(charArray[i + 1]))) { if (!isCurrentTokenNumeric) { tokenizedList.add(currentToken.toString()); currentToken = new StringBuffer(""); } if (c != ',') { currentToken.append(c); } isCurrentTokenNumeric = true; } else { if (isCurrentTokenNumeric) { try { tokenizedList.add(new BigDecimal(currentToken.toString())); } catch (NumberFormatException nfe) { tokenizedList.add(currentToken.toString()); } currentToken = new StringBuffer(""); } currentToken.append(c); isCurrentTokenNumeric = false; } } if (isCurrentTokenNumeric) { try { tokenizedList.add(new BigDecimal(currentToken.toString())); } catch (NumberFormatException nfe) { tokenizedList.add(currentToken.toString()); } } else { tokenizedList.add(currentToken.toString()); } return tokenizedList; }</code><technical_language>Change return type include <Object></technical_language>

Target:
private List<Object> getTokenizedList(String value) { List<Object> tokenizedList = new ArrayList<>(); char[] charArray = value.trim().toCharArray(); StringBuffer currentToken = new StringBuffer(""); boolean isCurrentTokenNumeric = false; for (int i = 0; i < charArray.length; i++) { char c = charArray[i]; boolean hasPrevChar = i > 0; boolean hasNextChar = i < charArray.length - 1; if (Character.isDigit(c) || (c == '.' && hasNextChar && Character.isDigit(charArray[i + 1])) || (c == ',' && hasNextChar && hasPrevChar && Character.isDigit(charArray[i - 1]) && Character.isDigit(charArray[i + 1])) || (c == '-' && !hasPrevChar && hasNextChar && Character.isDigit(charArray[i + 1]))) { if (!isCurrentTokenNumeric) { tokenizedList.add(currentToken.toString()); currentToken = new StringBuffer(""); } if (c != ',') { currentToken.append(c); } isCurrentTokenNumeric = true; } else { if (isCurrentTokenNumeric) { try { tokenizedList.add(new BigDecimal(currentToken.toString())); } catch (NumberFormatException nfe) { tokenizedList.add(currentToken.toString()); } currentToken = new StringBuffer(""); } currentToken.append(c); isCurrentTokenNumeric = false; } } if (isCurrentTokenNumeric) { try { tokenizedList.add(new BigDecimal(currentToken.toString())); } catch (NumberFormatException nfe) { tokenizedList.add(currentToken.toString()); } } else { tokenizedList.add(currentToken.toString()); } return tokenizedList; }
Source:
<code>public RunConditionCheckResult() { mBlockReasons = Collections.emptyList(); <START> mShouldRun = true; <END> }</code><technical_language>this(Collections.emptyList())</technical_language>

Target:
private RunConditionCheckResult() { this(Collections.emptyList()); }
Source:
<code>private static Issue parseLine(String line) { if (line.length() > 0) { if (!isDetail(line)) { Matcher m = DEFAULT_PATTERN.matcher(line); if (m.matches()) { String filePath = m.group(1); int lineNumber = Integer.parseInt(m.group(2)); int columnNumber = Integer.parseInt(m.group(3)); String ruleKey = m.group(4); String message = m.group(5); return new Issue(filePath, ruleKey, message, lineNumber, columnNumber); } m = PYLINT_PATTERN.matcher(line); if (m.matches()) { String filePath = m.group(1); int lineNumber = Integer.parseInt(m.group(2)); String ruleKey = m.group(3); String message = m.group(4); return new Issue(filePath, ruleKey, message, lineNumber, 0); } LOG.debug("Cannot parse the line: {}", line); } else { <START> LOG.trace("Classifying as detail and ignoring line '{}'", line); <END> } } return null; }</code><technical_language>LOG.trace</technical_language>

Target:
private static Issue parseLine(String line) { if (line.length() > 0) { if (!startsWithWhitespace(line)) { Matcher m = DEFAULT_PATTERN.matcher(line); if (m.matches()) { String filePath = m.group(1); int lineNumber = Integer.parseInt(m.group(2)); int columnNumber = Integer.parseInt(m.group(3)); String ruleKey = m.group(4); String message = m.group(5); return new Issue(filePath, ruleKey, message, lineNumber, columnNumber); } m = PYLINT_PATTERN.matcher(line); if (m.matches()) { String filePath = m.group(1); int lineNumber = Integer.parseInt(m.group(2)); String ruleKey = m.group(3); String message = m.group(4); return new Issue(filePath, ruleKey, message, lineNumber, null); } LOG.debug("Cannot parse the line: {}", line); } else { LOG.debug("Classifying as detail and ignoring line '{}'", line); } } return null; }
Source:
<code><START> public FeatureVector[] classify(Object[] examples) { <END> if (!(examples instanceof Word[])) { String type = examples == null ? "null" : examples.getClass().getName(); logger.error("Classifier 'Forms(Word)' defined on line 20 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } return super.classify(examples); }</code><technical_language>exiting, STDERR</technical_language>

Target:
public FeatureVector[] classify(Object[] examples) { if (!(examples instanceof Word[])) { String type = examples == null ? "null" : examples.getClass().getName(); System.err.println("Classifier 'Forms(Word)' defined on line 20 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } return super.classify(examples); }
Source:
<code>public void turnCryptoOnInSiteConfig() { SiteConfiguration.clearInstance(); SiteConfiguration siteConfig = SiteConfiguration.getInstance(); <START> siteConfig.set(Property.INSTANCE_CRYPTO_SERVICE, AESCryptoService.class.getName()); <END> siteConfig.set("instance.crypto.opts.kekId", "file:/ siteConfig.set("instance.crypto.opts.keyManager", "uri"); CryptoServiceFactory.resetInstance(); }</code><technical_language>Site configuration immutable. represents state of a configuration file. typically put stuff in a "CopyConfiguration" (or is "ConfigurationCopy"?) modify it. This setter out of place here</technical_language>

Target:
public void turnCryptoOnInSiteConfig() { SiteConfiguration.clearInstance(); SiteConfiguration siteConfig = SiteConfiguration.create(); siteConfig.set(Property.INSTANCE_CRYPTO_SERVICE, AESCryptoService.class.getName()); siteConfig.set("instance.crypto.opts.kekId", "file:/ siteConfig.set("instance.crypto.opts.keyManager", "uri"); CryptoServiceFactory.resetInstance(); }
Source:
<code>public int getDeviceOutputValue(String token, DSID dSID, String dSUID, String name, Short offset) { if (checkRequiredDevice(dSID, dSUID, name) && convertShortToString(offset) != null) { try { String response = transport.execute(SimpleRequestBuilder.buildNewRequest(InterfaceKeys.JSON) .addRequestClass(ClassKeys.DEVICE).addFunction(FunctionKeys.GET_OUTPUT_VALUE) .addParameter(ParameterKeys.TOKEN, token).addParameter(ParameterKeys.DSID, getDsidString(dSID)) .addParameter(ParameterKeys.DSUID, dSUID).addParameter(ParameterKeys.NAME, name) .addParameter(ParameterKeys.OFFSET, convertShortToString(offset)).buildRequestString()); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject valueObject = JSONResponseHandler.getResultJsonObject(responseObj); if (checkBlankField(valueObject, JSONApiResponseKeysEnum.VALUE.getKey())) { return valueObject.get(JSONApiResponseKeysEnum.VALUE.getKey()).getAsInt(); } } <START> } catch (Exception e) { <END> logger.debug("An exception occurred", e); } } return -1; }</code><technical_language>above, I mark more, please correct everywhere</technical_language>

Target:
public int getDeviceOutputValue(String token, DSID dSID, String dSUID, String name, Short offset) { if (checkRequiredDevice(dSID, dSUID, name) && SimpleRequestBuilder.objectToString(offset) != null) { String response = transport.execute(SimpleRequestBuilder.buildNewRequest(InterfaceKeys.JSON) .addRequestClass(ClassKeys.DEVICE).addFunction(FunctionKeys.GET_OUTPUT_VALUE) .addDefaultDeviceParameter(token, dSID, dSUID, name) .addParameter(ParameterKeys.OFFSET, SimpleRequestBuilder.objectToString(offset)) .buildRequestString()); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject valueObject = JSONResponseHandler.getResultJsonObject(responseObj); if (checkBlankField(valueObject, JSONApiResponseKeysEnum.VALUE.getKey())) { return valueObject.get(JSONApiResponseKeysEnum.VALUE.getKey()).getAsInt(); } } } return -1; }