auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean removeVm() { final List<DiskImage> diskImages = ImagesHandler.filterImageDisks(getVm().getDiskList(), true, false); for (VmNic nic : getInterfaces()) { <START> ExternalNetworkManager externalNetworkManager = new ExternalNetworkManager(nic); <END> externalNetworkManager.deallocateIfExternal(); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { removeVmFromDb(); if (getParameters().isRemoveDisks()) { for (DiskImage image : diskImages) { getCompensationContext().snapshotEntityStatus(image.getImage(), ImageStatus.ILLEGAL); ImagesHandler.updateImageStatus(image.getImage().getId(), ImageStatus.LOCKED); } getCompensationContext().stateChanged(); } else { for (DiskImage image : diskImages) { getImageDao().updateImageVmSnapshotId(image.getImageId(), null); } } return null; } }); if (getParameters().isRemoveDisks() && !diskImages.isEmpty()) { Collection<DiskImage> unremovedDisks = (Collection<DiskImage>)removeVmImages(diskImages).getActionReturnValue(); if (!unremovedDisks.isEmpty()) { processUnremovedDisks(unremovedDisks); return false; } } new MemoryImageRemoverOnDataDomain(getVm(), this).remove(memoryStates); return true; }</code><technical_language>this inlined</technical_language>

Target:
private boolean removeVm() { final List<DiskImage> diskImages = ImagesHandler.filterImageDisks(getVm().getDiskList(), true, false); for (VmNic nic : getInterfaces()) { new ExternalNetworkManager(nic).deallocateIfExternal(); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { removeVmFromDb(); if (getParameters().isRemoveDisks()) { for (DiskImage image : diskImages) { getCompensationContext().snapshotEntityStatus(image.getImage(), ImageStatus.ILLEGAL); ImagesHandler.updateImageStatus(image.getImage().getId(), ImageStatus.LOCKED); } getCompensationContext().stateChanged(); } else { for (DiskImage image : diskImages) { getImageDao().updateImageVmSnapshotId(image.getImageId(), null); } } return null; } }); if (getParameters().isRemoveDisks() && !diskImages.isEmpty()) { Collection<DiskImage> unremovedDisks = (Collection<DiskImage>)removeVmImages(diskImages).getActionReturnValue(); if (!unremovedDisks.isEmpty()) { processUnremovedDisks(unremovedDisks); return false; } } new MemoryImageRemoverOnDataDomain(getVm(), this).remove(memoryStates); return true; }
Source:
<code>public String apply(@Nullable Object value) { <START> if (Objects.isNull(value)) { <END> return null; } if (value instanceof Number) { return bucket(((Number) value).doubleValue()); } else if (value instanceof String) { return apply((String) value); } return null; }</code><technical_language>Objects.isNull method exists for lambda, direct is obscure write == null</technical_language>

Target:
public String apply(@Nullable Object value) { if (value == null) { return null; } if (value instanceof Number) { return bucket(((Number) value).doubleValue()); } else if (value instanceof String) { return apply((String) value); } return null; }
Source:
<code>public void testCSRFTokenHelper() { RequestLookup requestLookup = createRequestLookup(); when(requestLookup.getRequest().getCookieValue(COOKIE_CSRFTOKEN)).thenReturn("A45B3DDE4CF00891E7A9F3B752F18F92"); String output = createRenderable("{{csrfToken}}").render(null, createLookup(), requestLookup, createAPI()); String expected = "<input type=\"hidden\" name=\"csrftoken\" id=\"csrftoken\" " + "value=\"A45B3DDE4CF00891E7A9F3B752F18F92\"/>"; Assert.assertEquals(output, expected); <START> String formoutput = createRenderable("<form>{{csrfToken}}</form>").render(null, createLookup(), <END> requestLookup, createAPI()); Assert.assertEquals(formoutput, "<form>" + expected + "</form>"); }</code><technical_language>I a necessity of this assert (line 361-363)</technical_language>

Target:
public void testCSRFTokenHelper() { RequestLookup requestLookup = createRequestLookup(); when(requestLookup.getRequest().getCookieValue(COOKIE_CSRFTOKEN)).thenReturn("A45B3DDE4CF00891E7A9F3B752F18F92"); String output = createRenderable("{{csrfToken}}").render(null, createLookup(), requestLookup, createAPI()); String expected = "<input type=\"hidden\" name=\"uuf-csrftoken\" " + "value=\"A45B3DDE4CF00891E7A9F3B752F18F92\"/>"; Assert.assertEquals(output, expected); }
Source:
<code>public boolean deleteForOwner(Owner owner) { String deleteForOwner = "delete from UeberCertificate uc where uc.owner = :owner"; Query query = getEntityManager().createQuery(deleteForOwner); query.setParameter("owner", owner); <START> return query.executeUpdate() > 0 ? true : false; <END> }</code><technical_language>return query.executeUpdate() > 0 here</technical_language>

Target:
public boolean deleteForOwner(Owner owner) { String deleteForOwner = "delete from UeberCertificate uc where uc.owner = :owner"; Query query = getEntityManager().createQuery(deleteForOwner); query.setParameter("owner", owner); return query.executeUpdate() > 0; }
Source:
<code><START> public void setPromptClock(boolean showPromptClock) { <END> this.showPromptClock = showPromptClock; }</code><technical_language>static? Setting a static field a nonstatic method is weird</technical_language>

Target:
public static void setPromptClock(boolean showPromptClock) { utilMain.showPromptClock = showPromptClock; }
Source:
<code>private void assertNumberOfCars(int expectedCount, String carMake) { long hitCount = Search.getSearchManager(cache).search(Car.class) .where(f -> f.match().field("make").matching(carMake)) .fetchTotalHitCount(); <START> assertEquals("Expected count not met on cache " + cache, expectedCount, hitCount); <END> String ickle = String.format("FROM %s where make:'%s'", Car.class.getName(), carMake); CacheQuery<Car> cacheQuery = Search.getSearchManager(cache).getQuery(ickle); assertThat(cacheQuery.getResultSize()).isEqualTo(expectedCount); Query query = Search.getQueryFactory(cache).create(ickle); assertEquals("Expected count not met on cache " + cache, expectedCount, query.getResultSize()); }</code><technical_language>changes top of version of this test, moved SearchManager query builders. support is Ickle query strings</technical_language>

Target:
private void assertNumberOfCars(int expectedCount, String carMake) { for (Cache<?, ?> cache : caches) { QueryFactory queryFactory = Search.getQueryFactory(cache); Query<Car> query = queryFactory.create(String.format("FROM %s where make:'%s'", Car.class.getName(), carMake)); QueryResult<Car> queryResult = query.execute(); assertEquals("Expected count not met on cache " + cache, expectedCount, queryResult.hitCount().orElse(-1)); assertEquals("Expected count not met on cache " + cache, expectedCount, queryResult.list().size()); } }
Source:
<code>public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException{ <START> if (arguments.length != 1) throw new UDFArgumentLengthException( <END> "Arguments array has more than 1 element"); for (int i = 0; i < arguments.length; i++) { if (arguments[i].getCategory() != Category.PRIMITIVE) { throw new UDFArgumentTypeException(i, "A string argument was expected but an argument of type " + arguments[i].getTypeName() + " was given."); } PrimitiveCategory primitiveCategory = ((PrimitiveObjectInspector) arguments[i]) .getPrimitiveCategory(); if (primitiveCategory != PrimitiveCategory.STRING && primitiveCategory != PrimitiveCategory.VOID) { throw new UDFArgumentTypeException(i, "A string argument was expected but an argument of type " + arguments[i].getTypeName() + " was given."); } } try { cachingParser = new CachingParser(); } catch (IOException e) { LOG.error(e.getMessage(),e); throw new RuntimeException("We could not instantiate CachingParser"); } argumentOIs = arguments; return ObjectInspectorFactory.getStandardMapObjectInspector( PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector); }</code><technical_language>This condition matches, if argument is passed UDF (in case Exceptions message is descriptive)</technical_language>

Target:
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 1) { throw new UDFArgumentLengthException( "The UAParserUDF takes an array with only 1 element as argument"); } ObjectInspector arg = arguments[0]; int argIndex = 0; if (arg.getCategory() != Category.PRIMITIVE) { throw new UDFArgumentTypeException(argIndex, "A string argument was expected but an argument of type " + arg.getTypeName() + " was given."); } PrimitiveCategory primitiveCategory = ((PrimitiveObjectInspector) arg) .getPrimitiveCategory(); if (primitiveCategory != PrimitiveCategory.STRING) { throw new UDFArgumentTypeException(argIndex, "A string argument was expected but an argument of type " + arg.getTypeName() + " was given."); } try { cachingParser = new CachingParser(); } catch (IOException e) { Log.error(e.getMessage(), e); throw new RuntimeException("We could not instantiate CachingParser"); } argumentOI = arg; return ObjectInspectorFactory.getStandardMapObjectInspector( PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector); }
Source:
<code>public void copyObject(String bucketName, String objectName, String objectSource, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { if (copyConditions == null) { throw new InvalidArgumentException("Copy conditions should be a non null value"); } if (objectSource == null) { throw new InvalidArgumentException("Invalid object source"); } String sourceBucketName = getBucketNameFromPath(objectSource); String sourceObjectName = getObjectNameFromPath(objectSource); <START> ObjectStat objectStat = statObject(sourceBucketName, sourceObjectName); <END> String etag = objectStat.etag(); Date lastModified = objectStat.createdTime(); long length = objectStat.length(); if (copyConditions.isUnmodifiedSince(lastModified) && copyConditions.isModifiedAfter(lastModified) && copyConditions.etagMatches(etag) && copyConditions.etagDoesNotMatch(etag)) { InputStream objectByteStream = getObject(sourceBucketName, sourceObjectName); putObject(bucketName, objectName, objectByteStream, length, "application/octet-stream"); objectByteStream.close(); } }</code><technical_language>need do statObject(), send request server server fail appropriately</technical_language>

Target:
public CopyObjectResult copyObject(String bucketName, String objectName, String objectSource, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { Map<String, String> headerMap = new HashMap<>(); if (objectSource == null) { throw new InvalidArgumentException("Invalid object source"); } headerMap.put("x-amz-copy-source", objectSource); if (copyConditions != null) { headerMap.putAll(copyConditions.getCopyConditions()); } HttpResponse response = execute(Method.PUT, US_EAST_1, bucketName, objectName, headerMap, null, null, "", 0); CopyObjectResult result = new CopyObjectResult(); result.parseXml(response.body().charStream()); response.body().close(); return result; }
Source:
<code>private Result waitForCompletion() throws InterruptedException, IOException { Result result; <START> while((result = checkForCompletion()) != null) { <END> Thread.sleep(1000); } return result; }</code><technical_language>@bkmeneguello <code>!=</code> is correct</technical_language>

Target:
private Result waitForCompletion() throws InterruptedException, IOException { Result result; while((result = checkForCompletion()) == null) { Thread.sleep(1000); } return result; }
Source:
<code>protected JobGraph getJobGraph() throws Exception { String[] parameters = new String[] { "1", <START> "1", <END> pagesWithRankPath, edgesPath, resultPath, "<none>", "5", "25", "25", "30", "5", "1", "0", "100", "0" }; return CustomCompensatableDanglingPageRank.getJobGraph(parameters); }</code><technical_language>reduce DOP numSubTasksPerInstance</technical_language>

Target:
protected JobGraph getJobGraph() throws Exception { String[] parameters = new String[] { "4", "4", pagesWithRankPath, edgesPath, resultPath, "<none>", "5", "25", "25", "30", "5", "1", "0", "100", "0" }; return CustomCompensatableDanglingPageRank.getJobGraph(parameters); }
Source:
<code>public void shouldCreateSubscription() throws Exception { onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(Subscription.URI_TEMPLATE.expand(project.getId(), account.getId()).toString()) .havingBody(jsonEquals(readStringFromResource("/notification/subscriptionToCreate.json"))) .respond() .withStatus(201) .withBody(readFromResource("/notification/subscription.json")); final Subscription subscription = gd.getNotificationService().createSubscription(project, account, new Subscription( Arrays.asList(new TimerEvent("0 * * * * *"), new TimerEvent("1 * * * * *")), new Condition("true"), new Template("test message"), <START> Arrays.asList("/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff/channelConfigurations/59dca8f160b2c601f3c72e1b"), <END> new Meta("test subscription"))); assertThat(subscription, is(notNullValue())); }</code><technical_language>singletonList</technical_language>

Target:
public void shouldCreateSubscription() throws Exception { onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(Subscription.URI_TEMPLATE.expand(project.getId(), account.getId()).toString()) .havingBody(jsonEquals(readStringFromResource("/notification/subscriptionToCreate.json"))) .respond() .withStatus(201) .withBody(readFromResource("/notification/subscription.json")); final Subscription subscription = gd.getNotificationService().createSubscription(project, account, new Subscription( Arrays.asList(new TimerEvent("0 * * * * *"), new TimerEvent("1 * * * * *")), singletonList(channel), new TriggerCondition("true"), new MessageTemplate("test message"), "test subscription")); assertThat(subscription, is(notNullValue())); }
Source:
<code><START> private static void addCaseFileVariableToResult(Collection<Pair<Object, String>> result, String element) { <END> if (element.length() > 0) { List<String> list = Arrays.asList(element.split(",")); list.forEach(s1 -> { String value = CaseFileVariables.CASE_FILE_PREFIX + s1.split(":")[0]; result.add(new Pair<>(value, value)); }); } }</code><technical_language>same, I this method need static</technical_language>

Target:
private void addCaseFileVariableToResult(Collection<Pair<Object, String>> result, String element) { if (element.length() > 0) { List<String> list = Arrays.asList(element.split(",")); list.forEach(s1 -> { String value = CaseFileVariables.CASE_FILE_PREFIX + s1.split(":")[0]; result.add(new Pair<>(value, value)); }); } }
Source:
<code>public void createBlob(String key, InputStream in, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException, IOException { AtomicOutputStream out = null; try { out = createBlob(key, meta, who); byte[] buffer = new byte[2048]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } } finally { try { if (out != null) { out.cancel(); <START> } <END> in.close(); } catch (IOException throwaway) { } } }</code><technical_language>calling cancel instead of close() for normal case</technical_language>

Target:
public void createBlob(String key, InputStream in, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException, IOException { AtomicOutputStream out = null; try { out = createBlob(key, meta, who); byte[] buffer = new byte[2048]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } out.close(); out = null; } finally { try { if (out != null) { out.cancel(); } in.close(); } catch (IOException throwaway) { } } }
Source:
<code>public void onPrepared(final boolean playWhenReady) { if (DEBUG) Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]"); if (playWhenReady) audioReactor.requestAudioFocus(); if (isPlaybackResumeEnabled() && currentMetadata != null) { final Disposable d = recordManager.loadStreamState(currentMetadata.getMetadata()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( state -> { if (state.getProgressTime() > PLAYBACK_SAVE_THRESHOLD_START_MILLIS && state.getProgressTime() < simpleExoPlayer.getDuration() - PLAYBACK_SAVE_THRESHOLD_END_MILLIS) { seekTo(state.getProgressTime()); onPositionRestored(state.getProgressTime()); } changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED); }, error -> { <START> Log.e(TAG, "Player resume failure: ", error); <END> changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED); }, () -> changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED) ); databaseUpdateReactor.add(d); } else { changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED); } }</code><technical_language>suggestion if (DEBUG) Log.e(TAG, "Player resume failure: ", error);</technical_language>

Target:
public void onPrepared(final boolean playWhenReady) { if (DEBUG) Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]"); if (playWhenReady) audioReactor.requestAudioFocus(); changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED); }
Source:
<code>private String createLuaXmlRequestMessage(final FBType fbType) { ForteLuaExportFilter luaFilter = new ForteLuaExportFilter(); <START> String luaSkript = luaFilter.createLUA(fbType); String escapedLuaSkript = escapeXmlCharacters(luaSkript); <END> return MessageFormat.format(CREATE_FB_TYPE, getNextId(), fbType.getName(), escapedLuaSkript); }</code><technical_language>combine commands in line. This indicate, intermediate result (luaSkript) is intended in this method. Also, script is written a c in English ;)</technical_language>

Target:
private String createLuaXmlRequestMessage(final FBType fbType) { ForteLuaExportFilter luaFilter = new ForteLuaExportFilter(); String escapedLuaScript = escapeXmlCharacters(luaFilter.createLUA(fbType)); return MessageFormat.format(CREATE_FB_TYPE, getNextId(), fbType.getName(), escapedLuaScript); }
Source:
<code>public CachedNode getNode( NodeKey key ) { checkNotClosed(); CachedNode node = nodesByKey.get(key); if (node == null) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Node '{0}' is not found in the '{1}' workspace cache; looking in store", key, workspaceName); } Document doc = documentFor(key); if (doc != null) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Materialized document '{0}' in '{1}' workspace from store: {2}", key, workspaceName, doc); } CachedNode newNode = new LazyCachedNode(key, doc); Integer cacheTtlSeconds = translator().getCacheTtlSeconds(doc); if (nodesByKey instanceof BasicCache && cacheTtlSeconds != null) { node = ((BasicCache<NodeKey, CachedNode>)nodesByKey).putIfAbsent(key, newNode, cacheTtlSeconds.longValue(), TimeUnit.SECONDS); } else if (nodesByKey instanceof CacheSupport && cacheTtlSeconds != null) { node = ((CacheSupport<NodeKey, CachedNode>)nodesByKey).putIfAbsent(key, newNode, cacheTtlSeconds.longValue(), TimeUnit.SECONDS); } else { try { node = nodesByKey.putIfAbsent(key, newNode); } catch (TimeoutException e) { <START> node = null; <END> } } if (node == null) node = newNode; } } return node; }</code><technical_language>add a debug message indicating a timeout occurs this thread/process unable update cache</technical_language>

Target:
public CachedNode getNode( NodeKey key ) { checkNotClosed(); CachedNode node = nodesByKey.get(key); if (node == null) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Node '{0}' is not found in the '{1}' workspace cache; looking in store", key, workspaceName); } Document doc = documentFor(key); if (doc != null) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Materialized document '{0}' in '{1}' workspace from store: {2}", key, workspaceName, doc); } CachedNode newNode = new LazyCachedNode(key, doc); try { Integer cacheTtlSeconds = translator().getCacheTtlSeconds(doc); if (cacheTtlSeconds != null && nodesByKey instanceof BasicCache) { node = ((BasicCache<NodeKey, CachedNode>)nodesByKey).putIfAbsent(key, newNode, cacheTtlSeconds.longValue(), TimeUnit.SECONDS); } else { node = nodesByKey.putIfAbsent(key, newNode); } } catch (TimeoutException e) { node = null; } if (node == null) { node = newNode; } } } return node; }
Source:
<code>public static ColorDescriptor getErrorColorDescriptorFromCurrentTheme() { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); <START> System.out.println(theme.getColorRegistry().getKeySet()); <END> return Preconditions.checkNotNull(theme.getColorRegistry().getColorDescriptor(ERROR_COLOR)); }</code><technical_language>this System.out here</technical_language>

Target:
public static ColorDescriptor getErrorColorDescriptorFromCurrentTheme() { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); return Preconditions.checkNotNull(theme.getColorRegistry().getColorDescriptor(ERROR_COLOR)); }
Source:
<code>public String format(String value) { Objects.requireNonNull(value); if (value.isEmpty()) { return value; } String cleanValue = value.replace("pp.", "").replace("p.", ""); cleanValue = EM_EN_DASH_PATTERN.matcher(cleanValue).replaceAll("-"); <START> cleanValue = REJECT_LITERALS_PATTERN.matcher(cleanValue).replaceAll(""); <END> Matcher matcher = PAGES_DETECT_PATTERN.matcher(cleanValue); if (matcher.matches()) { if (Strings.isNullOrEmpty(matcher.group("endpage"))) { return matcher.replaceFirst(SINGLE_PAGE_REPLACE_PATTERN); } else { return matcher.replaceFirst(PAGES_REPLACE_PATTERN); } } return cleanValue; }</code><technical_language>I this result in unwanted changes. formatter format pages if "kind of" in right format. 40&50 is changed 4050</technical_language>

Target:
public String format(String value) { Objects.requireNonNull(value); if (value.isEmpty()) { return value; } value = value.trim(); value = value.replace("pp.", "").replace("p.", "").trim(); value = EM_EN_DASH_PATTERN.matcher(value).replaceAll("--"); Matcher matcher = DASHES_DETECT_PATTERN.matcher(value); if (matcher.find() && matcher.start() >= 0) { String fixedValue = matcher.replaceFirst("--"); if (matcher.find()) { return value; } return unprotectTermsFormatter.format(fixedValue); } return value; }
Source:
<code>public synchronized void updateResourcePools(ResourcePools pools){ TreeSet<ResourceType> resourceTypes = new TreeSet<ResourceType>(); Collections.addAll(resourceTypes, ResourceType.Core.values()); Iterator<ResourceType> resourceTypeIterator = resourceTypes.descendingIterator(); while (resourceTypeIterator.hasNext()) { ResourceType currentResourceType = resourceTypeIterator.next(); if (config.getResourcePools().getPoolForResource(currentResourceType) != null && pools.getPoolForResource(currentResourceType) != null && config.getResourcePools().getPoolForResource(currentResourceType).getType() == pools.getPoolForResource(currentResourceType).getType()) { Long oldValue = config.getResourcePools() .getPoolForResource(currentResourceType) .getSize(); Long newValue = pools.getPoolForResource(currentResourceType).getSize(); <START> fireCacheConfigurationChange(CacheConfigurationProperties.UPDATESIZE, oldValue, newValue); <END> } } }</code><technical_language>While I understand question, I clue this code is supposed work exceptions. difference for event updating heap resource disk resource</technical_language>

Target:
public synchronized void updateResourcePools(ResourcePools pools) { if(pools == null) { throw new NullPointerException("Pools to be updated cannot be null"); } ResourcePoolMerger poolMerger = new ResourcePoolMerger(); ResourcePools updatedResourcePools = poolMerger.validateAndMerge(config.getResourcePools(), pools); fireCacheConfigurationChange(CacheConfigurationProperty.UPDATESIZE, config.getResourcePools(), updatedResourcePools); this.resourcePools = updatedResourcePools; }
Source:
<code><START> public final This addCleanable(Cleanable cleanable) <END> { getContext().addCleanable(cleanable); return (This) this; }</code><technical_language>I kinda hoped Cleanable expose out public API. I guess if expect people write execution strategies</technical_language>

Target:
This addCleanable(Cleanable cleanable) { getContext().addCleanable(cleanable); return typedThis; }
Source:
<code>public synchronized T get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Args.notNull(unit, "Time unit"); final long msecs = unit.toMillis(timeout); final long startTime = (msecs <= 0) ? 0 : System.currentTimeMillis(); long waitTime = msecs; if (this.completed) { return getResult(); } else if (waitTime <= 0) { <START> throw TimeoutValueException.ofMillis(msecs, msecs + Math.abs(waitTime)); <END> } else { for (;;) { wait(waitTime); if (this.completed) { return getResult(); } waitTime = msecs - (System.currentTimeMillis() - startTime); if (waitTime <= 0) { throw TimeoutValueException.ofMillis(msecs, msecs + Math.abs(waitTime)); } } } }</code><technical_language>@garydgregory is of this information? good print out current time deadline in milliseconds? I thought include timeout in exception message, of some marginal use</technical_language>

Target:
public synchronized T get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Args.notNull(unit, "Time unit"); final long msecs = unit.toMillis(timeout); final long startTime = (msecs <= 0) ? 0 : System.currentTimeMillis(); long waitTime = msecs; if (this.completed) { return getResult(); } else if (waitTime <= 0) { throw TimeoutValueException.fromMillis(msecs, msecs + Math.abs(waitTime)); } else { for (;;) { wait(waitTime); if (this.completed) { return getResult(); } waitTime = msecs - (System.currentTimeMillis() - startTime); if (waitTime <= 0) { throw TimeoutValueException.fromMillis(msecs, msecs + Math.abs(waitTime)); } } } }
Source:
<code>protected void execute(Context context) throws SQLException { long now = system2.now(); MassUpdate massUpdate = context.prepareMassUpdate(); <START> massUpdate.select("select p.kee, p.organization_uuid, p.kee, p.parent_kee from rules_profiles p "); <END> massUpdate.update("insert into qprofiles" + " (uuid, organization_uuid, rules_profile_uuid, parent_uuid, created_at, updated_at) values (?, ?, ?, ?, ?, ?)"); massUpdate.rowPluralName("qprofiles"); massUpdate.execute((row, update) -> { if (existQProfile(context, row.getString(1), row.getString(2))) { return false; } update.setString(1, row.getString(1)); update.setString(2, row.getString(2)); update.setString(3, row.getString(3)); update.setString(4, row.getString(4)); update.setLong(5, now); update.setLong(6, now); return true; }); }</code><technical_language>need select column p.kee twice</technical_language>

Target:
protected void execute(Context context) throws SQLException { long now = system2.now(); MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select p.kee, p.organization_uuid, p.parent_kee from rules_profiles p " + "where not exists ( select qp.uuid from qprofiles qp where qp.uuid = p.kee and qp.organization_uuid = p.organization_uuid )"); massUpdate.update("insert into qprofiles" + " (uuid, organization_uuid, rules_profile_uuid, parent_uuid, created_at, updated_at) values (?, ?, ?, ?, ?, ?)"); massUpdate.rowPluralName("qprofiles"); massUpdate.execute((row, update) -> { update.setString(1, row.getString(1)); update.setString(2, row.getString(2)); update.setString(3, row.getString(1)); update.setString(4, row.getString(3)); update.setLong(5, now); update.setLong(6, now); return true; }); }
Source:
<code>public ValidationBean checkConnection(final SubprocessExecutionContext execCtx) { <START> throw new UnprocessableEntityException(String.format("'checkConnection' cannot be performed on material of type %s", type)); <END> }</code><technical_language>this level, I prefer UnsupportedOperationException instead of UnprocessableEntityException</technical_language>

Target:
public ValidationBean checkConnection(final SubprocessExecutionContext execCtx) { throw new UnsupportedOperationException(String.format("'checkConnection' cannot be performed on material of type %s", type)); }
Source:
<code>private Brand mergeBrand(Brand current, Brand extracted) { <START> current.setCanonicalUri(extracted.getCanonicalUri()); <END> current.setPublisher(extracted.getPublisher()); current.setCurie(extracted.getCurie()); current.setTitle(extracted.getTitle()); current.setDescription(extracted.getDescription()); current.setGenres(extracted.getGenres()); current.setImage(extracted.getImage()); current.setImages(extracted.getImages()); current.setMediaType(extracted.getMediaType()); current.setSpecialization(extracted.getSpecialization()); return current; }</code><technical_language>change canonical URI publisher based inbound data; a bug if changed</technical_language>

Target:
private Brand mergeBrand(Brand current, Brand extracted) { current.setCurie(extracted.getCurie()); current.setTitle(extracted.getTitle()); current.setDescription(extracted.getDescription()); current.setGenres(extracted.getGenres()); current.setImage(extracted.getImage()); current.setImages(extracted.getImages()); current.setMediaType(extracted.getMediaType()); current.setSpecialization(extracted.getSpecialization()); return current; }
Source:
<code>public void layoutGalleryDescription() { GalleryItem item = getCurrentItem(); if (item == null) { infoContainer.setVisibility(View.GONE); return; } CharSequence descriptionStr = ""; if (item.getMetadata().containsKey("ImageDescription")) { descriptionStr = Html .fromHtml(item.getMetadata().get("ImageDescription")); } else if (item.getMetadata().containsKey("ObjectName")) { descriptionStr = Html .fromHtml(item.getMetadata().get("ObjectName")); } if (descriptionStr.length() > 0) { descriptionText.setText(Utils.trim(descriptionStr)); descriptionText.setVisibility(View.VISIBLE); } else { descriptionText.setVisibility(View.GONE); } if (item.isLicenseFree()) { if (item.isLicensePD()) { <START> licenseIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_license_pd)); <END> } else if (item.isLicenseCC()) { licenseIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_license_cc)); } else { licenseIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_license_cite)); } } else { licenseIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_license_cite)); } licenseIcon.setTag(item.getLicenseUrl()); String creditStr = ""; if (item.getMetadata().containsKey("Artist")) { creditStr = Html.fromHtml(item.getMetadata().get("Artist")).toString(); } else if (item.getMetadata().containsKey("LicenseShortName")) { creditStr = item.getMetadata().get("LicenseShortName"); } else if (item.getMetadata().containsKey("UsageTerms")) { creditStr = item.getMetadata().get("UsageTerms"); } creditText.setText(creditStr.trim()); infoContainer.setVisibility(View.VISIBLE); }</code><technical_language>good if set contentDescription based icon set, screen readers pick up. show long press icon, save license page. a link for it. uninitiated reader icon means</technical_language>

Target:
public void layoutGalleryDescription() { GalleryItem item = getCurrentItem(); if (item == null) { infoContainer.setVisibility(View.GONE); return; } CharSequence descriptionStr = ""; if (item.getMetadata().containsKey("ImageDescription")) { descriptionStr = Html .fromHtml(item.getMetadata().get("ImageDescription")); } else if (item.getMetadata().containsKey("ObjectName")) { descriptionStr = Html .fromHtml(item.getMetadata().get("ObjectName")); } if (descriptionStr.length() > 0) { descriptionText.setText(Utils.trim(descriptionStr)); descriptionText.setVisibility(View.VISIBLE); } else { descriptionText.setVisibility(View.GONE); } licenseIcon.setImageDrawable(getResources().getDrawable(getLicenseIcon(item))); licenseIcon.setContentDescription(item.getMetadata().get("UsageTerms")); licenseIcon.setTag(item.getLicenseUrl()); String creditStr = ""; if (item.getMetadata().containsKey("Artist")) { creditStr = Html.fromHtml(item.getMetadata().get("Artist")).toString(); } else if (item.getMetadata().containsKey("LicenseShortName")) { creditStr = item.getMetadata().get("LicenseShortName"); } else if (item.getMetadata().containsKey("UsageTerms")) { creditStr = item.getMetadata().get("UsageTerms"); } creditText.setText(creditStr.trim()); infoContainer.setVisibility(View.VISIBLE); }
Source:
<code>public void getResourcesByCoreAttributeValue() throws Exception { System.out.println(CLASS_NAME + "getResourcesByCoreAttributeValue"); Facility facility = setUpFacility("testFacility"); Resource resource1 = setUpResource("testResource01", vo, facility); Resource resource2 = setUpResource("testResource02", vo, facility); Resource resource3 = setUpResource("testResource03", vo, facility); Map<String, String> searchParams = new HashMap<>(); searchParams.put(AttributesManager.NS_RESOURCE_ATTR_CORE + ":name", resource1.getName()); List<Resource> foundResources = searcherBl.getResources(sess, searchParams, false); assertEquals("Found resource number of resources", 1, foundResources.size()); assertTrue("Found resources did not contain resource it should.", foundResources.contains(resource1)); searchParams.put(AttributesManager.NS_RESOURCE_ATTR_CORE + ":name", "testResource"); foundResources = searcherBl.getResources(sess, searchParams, true); assertEquals("Found resource number of resources", 3, foundResources.size()); <START> assertTrue("Found resources did not contain resource it should.", foundResources.contains(resource1)); assertTrue("Found resources did not contain resource it should.", foundResources.contains(resource2)); assertTrue("Found resources did not contain resource it should.", foundResources.contains(resource3)); <END> }</code><technical_language>Nit: assertThat method assertJ simplify this. assertThat(foundResources).containsOnly(resource1, resource2, resource3);</technical_language>

Target:
public void getResourcesByCoreAttributeValue() throws Exception { System.out.println(CLASS_NAME + "getResourcesByCoreAttributeValue"); Facility facility = setUpFacility("testFacility"); Resource resource1 = setUpResource("testResource01", vo, facility); Resource resource2 = setUpResource("testResource02", vo, facility); Resource resource3 = setUpResource("testResource03", vo, facility); Map<String, String> searchParams = new HashMap<>(); searchParams.put(AttributesManager.NS_RESOURCE_ATTR_CORE + ":name", resource1.getName()); List<Resource> foundResources = searcherBl.getResources(sess, searchParams, false); assertThat(foundResources).containsOnlyOnce(resource1); searchParams.put(AttributesManager.NS_RESOURCE_ATTR_CORE + ":name", "testResource"); foundResources = searcherBl.getResources(sess, searchParams, true); assertThat(foundResources).containsOnlyOnce(resource1, resource2, resource3); }
Source:
<code>public void should_have_the_same_methods_as_in_bdd_assertions() { Class<Assertions> classA = Assertions.class; String methodA = "assertThat"; Class<BDDAssertions> classB = BDDAssertions.class; String methodB = "then"; List<Method> assertThatMethods = findMethodsWithName(classA, methodA); List<Method> thenMethods = findMethodsWithName(classB, methodB); Comparator<Method> methodComparator = ignoringDeclaringClassAndMethodName(); <START> Assertions.assertThat(assertThatMethods).usingElementComparator(methodComparator) <END> .containsExactlyInAnyOrder(thenMethods.toArray(new Method[thenMethods.size()])); }</code><technical_language>I findMethodsWithName return Method[], avoid array conversion in tests</technical_language>

Target:
public void should_have_the_same_methods_as_in_bdd_assertions() { Method[] assertThatMethods = findMethodsWithName(Assertions.class, "assertThat"); Method[] thenMethods = findMethodsWithName(BDDAssertions.class, "then"); Comparator<Method> methodComparator = ignoringDeclaringClassAndMethodName(); assertThat(assertThatMethods).usingElementComparator(methodComparator).containsExactlyInAnyOrder(thenMethods); }
Source:
<code>public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; if (HttpMethod.OPTIONS.equals(httpReq.getMethod())) { if (allowUnauthenticatedHttpOptions) { <START> httpReq.setAttribute( <END> AuthConfig.DRUID_AUTHENTICATION_RESULT, new AuthenticationResult(AuthConfig.ALLOW_ALL_NAME, AuthConfig.ALLOW_ALL_NAME, null) ); } httpReq.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true); } chain.doFilter(request, response); }</code><technical_language>This override authentication information if _is_ present in request. ideally retain if present. Is a do that</technical_language>

Target:
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; if (HttpMethod.OPTIONS.equals(httpReq.getMethod())) { if (httpReq.getAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT) == null) { if (allowUnauthenticatedHttpOptions) { httpReq.setAttribute( AuthConfig.DRUID_AUTHENTICATION_RESULT, new AuthenticationResult(AuthConfig.ALLOW_ALL_NAME, AuthConfig.ALLOW_ALL_NAME, null) ); } else { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } } httpReq.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true); } chain.doFilter(request, response); }
Source:
<code>public void testJacocoWorkaround() throws Exception { mockStatic(System.class); Main.main(); verifyStatic(System.class, times(1)); System.exit(-1); <START> } <END></code><technical_language>I understand System.exit is test</technical_language>

Target:
public void testJacocoWorkaround() throws Exception { final String expected = "Files to process must be specified, found 0." + System.lineSeparator(); mockStatic(System.class); Main.main(); assertEquals("Unexpected output log", expected, systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }
Source:
<code>public int hashCode() { int result = Objects.hashCode(id); <START> return result; <END> }</code><technical_language>need for result attribute: @Override public int hashCode() { return Objects.hashCode(id); }</technical_language>

Target:
public int hashCode() { return Objects.hashCode(id); }
Source:
<code>private void refreshDiagram(final Session session, final DDiagram diagram) { final TransactionalEditingDomain editingDomain = session.getTransactionalEditingDomain(); <START> RefreshSiriusElement cmd <END> = new RefreshSiriusElement(editingDomain, diagram); editingDomain.getCommandStack().execute(cmd); }</code><technical_language>I is RefreshRepresentationsCommand (org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand). please some tests identify if RefreshSiriusElement job</technical_language>

Target:
private void refreshDiagram(final Session session, final DDiagram diagram) { final TransactionalEditingDomain editingDomain = session.getTransactionalEditingDomain(); editingDomain.getCommandStack().execute(new RefreshRepresentationsCommand(editingDomain, new NullProgressMonitor(), diagram)); }
Source:
<code>protected void verifyUserAuthorization(String userId) { authRule.disableAuthorization(); if (AUTHORIZATION_TYP_RUNTIME.equals(authorizationType)) { <START> System.out.println("RUNTIME!"); <END> Authorization runtimeUserAuthorization = authorizationService.createAuthorizationQuery() .resourceType(TASK) .userIdIn(userId) .singleResult(); assertNotNull(runtimeUserAuthorization); verifyReadVariablePermission(runtimeUserAuthorization, TaskPermissions.READ_VARIABLE); } else if (AUTHORIZATION_TYP_HISTORIC.equals(authorizationType)) { System.out.println("HISTORY!"); Authorization historyUserAuthorization = authorizationService.createAuthorizationQuery() .resourceType(HISTORIC_TASK) .userIdIn(userId) .singleResult(); assertNotNull(historyUserAuthorization); verifyReadVariablePermission(historyUserAuthorization, HistoricTaskPermissions.READ_VARIABLE); } else { throw new RuntimeException("auth type not found"); } }</code><technical_language>Is for debugging purposes, remove it</technical_language>

Target:
protected void verifyUserAuthorization(String userId) { authRule.disableAuthorization(); if (AUTHORIZATION_TYP_RUNTIME.equals(authorizationType)) { Authorization runtimeUserAuthorization = authorizationService.createAuthorizationQuery() .resourceType(TASK) .userIdIn(userId) .singleResult(); assertNotNull(runtimeUserAuthorization); verifyReadVariablePermission(runtimeUserAuthorization, TaskPermissions.READ_VARIABLE); } else if (AUTHORIZATION_TYP_HISTORIC.equals(authorizationType)) { Authorization historyUserAuthorization = authorizationService.createAuthorizationQuery() .resourceType(HISTORIC_TASK) .userIdIn(userId) .singleResult(); assertNotNull(historyUserAuthorization); verifyReadVariablePermission(historyUserAuthorization, HistoricTaskPermissions.READ_VARIABLE); } else { throw new RuntimeException("auth type not found"); } }
Source:
<code>public RuntimeConfigBuilder defaults(Version version) { <START> String directoryName = String.format("mysql-%s-%s", version.getMajorVersion(), UUID.randomUUID().toString()); <END> defaults().artifactStore().setDefault(artifactStoreBuilderFor(directoryName)); return this; }</code><technical_language>need for toString provide string conversion in format string</technical_language>

Target:
public RuntimeConfigBuilder defaults(Version version) { String directoryName = String.format("mysql-%s-%s", version.getMajorVersion(), UUID.randomUUID()); defaults().artifactStore().setDefault(artifactStoreBuilderFor(directoryName)); return this; }
Source:
<code>public static void main(final String[] args) { final QlessJavaWorker worker = new QlessJavaWorker(); final CmdLineParser parser = new CmdLineParser(worker); try { parser.parseArgument(args); } catch (final CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); } try { final JedisPool jedisPool = new JedisPool(worker.host); final Client client = new Client(jedisPool); final SerialWorker serialWorker = new SerialWorker( Arrays.asList(worker.queues), client, worker.name, worker.inverval); serialWorker.run(); } catch (InterruptedException | IOException e) { <START> System.err.println(e.getMessage()); <END> } }</code><technical_language>want print entire stack trace instead of message: java e.printStackTrace(); // default this System.err</technical_language>

Target:
public static void main(final String[] args) { final QlessJavaWorker worker = new QlessJavaWorker(); final CmdLineParser parser = new CmdLineParser(worker); try { parser.parseArgument(args); } catch (final CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); } try { final JedisPool jedisPool = new JedisPool(worker.host); final Client client = new Client(jedisPool); final SerialWorker serialWorker = new SerialWorker( Arrays.asList(worker.queues), client, worker.name, worker.inverval); serialWorker.run(); } catch (InterruptedException | IOException e) { e.printStackTrace(); } }
Source:
<code>private void printMemberTree(final PrintWriter stdout, final GroupMembersList groupMembers) { <START> printMember(stdout, groupMembers, 0, true, new HashSet<AccountGroup.Id>()); <END> }</code><technical_language>I if some obvious sharing of this tree code code print project trees? I bother if pains get there, if approaches easily share code, easier maintain/understand</technical_language>

Target:
private void printMemberTree(final PrintWriter stdout, final GroupMembersList groupMembers) { final TreeFormatter treeFormatter = new TreeFormatter(stdout); treeFormatter.printTree(accountGroupNodeFactory.create(groupMembers)); }
Source:
<code>public void testSimpleKafka() throws Exception{ <START> final StreamDataProvider<JSONObject> dataProvider = simpleKafkaGateway.buildDataProvider((DataSourceFilter)null, String.valueOf("0"), null, null); <END> BaseGatewayTestUtil.doTest(dataProvider); }</code><technical_language>point of String.valueOf("0") ? "0"</technical_language>

Target:
public void testSimpleKafka() throws Exception{ final StreamDataProvider<JSONObject> dataProvider = simpleKafkaGateway.buildDataProvider((DataSourceFilter)null, "0", null, null); BaseGatewayTestUtil.doTest(dataProvider); }
Source:
<code>public JobInfo(String jobName_, String groupName_, Class job_, String shouldRecover) { this(jobName_, groupName_, job_); if(shouldRecover == null) { this.shouldRecover= true; } else { <START> this.shouldRecover = Boolean.getBoolean(shouldRecover); <END> } }</code><technical_language>Boolean.valueOf instead of Boolean.getBoolean</technical_language>

Target:
public JobInfo(String jobName_, String groupName_, Class job_, String shouldRecover) { this(jobName_, groupName_, job_); if(shouldRecover == null) { this.shouldRecover= true; } else { this.shouldRecover = Boolean.valueOf(shouldRecover); } }
Source:
<code>private static void fillChecksFromModifierPackage() { NAME_TO_FULL_MODULE_NAME.put("ModifierOrderCheck", BASE_PACKAGE + ".checks.modifier.ModifierOrderCheck"); NAME_TO_FULL_MODULE_NAME.put("RedundantModifierCheck", BASE_PACKAGE + ".checks.modifier.RedundantModifierCheck"); NAME_TO_FULL_MODULE_NAME.put("InterfaceMemberImpliedModifierCheck", <START> BASE_PACKAGE + ".checks.modifier.InterfaceMemberImpliedModifierCheck"); <END> }</code><technical_language>please order checks alphabetically</technical_language>

Target:
private static void fillChecksFromModifierPackage() { NAME_TO_FULL_MODULE_NAME.put("InterfaceMemberImpliedModifierCheck", BASE_PACKAGE + ".checks.modifier.InterfaceMemberImpliedModifierCheck"); NAME_TO_FULL_MODULE_NAME.put("ModifierOrderCheck", BASE_PACKAGE + ".checks.modifier.ModifierOrderCheck"); NAME_TO_FULL_MODULE_NAME.put("RedundantModifierCheck", BASE_PACKAGE + ".checks.modifier.RedundantModifierCheck"); }
Source:
<code>private void openDatabase() { <START> Boolean connected = viewModel.openDatabase(); <END> if (connected) { this.close(); } }</code><technical_language>boolean Boolean</technical_language>

Target:
private void openDatabase() { boolean connected = viewModel.openDatabase(); if (connected) { this.close(); } }
Source:
<code>public void testInsertTemplateToUnregisteredEntity() { dao = dbFacade.getUnregisteredOVFDataDao(); <START> final String OVF_EXTRA_DATA = "<ovf> Some extra OVF data </ovf>"; <END> dao.insertOVFDataForEntities(FixturesTool.VM_TEMPLATE_RHEL5, "Stam", "TEMPLATE", null, 1, 1, 1, 1, null, 1, "3.4", FixturesTool.STORAGE_DOAMIN_NFS2_1, OVF_EXTRA_DATA); OvfEntityData ovfEntityData = dao.getByVmId(FixturesTool.VM_TEMPLATE_RHEL5); assertNotNull(ovfEntityData); assertTrue("The entity type should be template", ovfEntityData.getEntityType().equals("TEMPLATE")); assertTrue("The entity OVF extra data should be updated", ovfEntityData.getOvfExtraData().equals(OVF_EXTRA_DATA)); }</code><technical_language>please change name java conventions, please rename if ovfData</technical_language>

Target:
public void testInsertTemplateToUnregisteredEntity() { dao = dbFacade.getUnregisteredOVFDataDao(); final String ovfExtraData = "<ovf> Some extra OVF data </ovf>"; dao.insertOVFDataForEntities(FixturesTool.VM_TEMPLATE_RHEL5, "Stam", "TEMPLATE", 1, "3.4", FixturesTool.STORAGE_DOAMIN_NFS2_1, ovfExtraData); OvfEntityData ovfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNotNull(ovfEntityData); assertTrue("The entity type should be template", ovfEntityData.getEntityType().equals("TEMPLATE")); assertTrue("The entity OVF extra data should be updated", ovfEntityData.getOvfExtraData() .equals(ovfExtraData)); }