auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String getDisplayName() { <START> return "Throttle execution of node blocks within this body"; <END> }</code><technical_language>Nice2have: localizable</technical_language>

Target:
public String getDisplayName() { return Messages.ThrottleStep_DisplayName(); }
Source:
<code>private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (Utils.isRealmList(field)) { <START> if (!hasRequiredAnnotation(field)) { <END> final List<? extends TypeMirror> fieldTypeArguments = ((DeclaredType) field.asType()).getTypeArguments(); if (fieldTypeArguments.isEmpty() || !Utils.isRealmModel(fieldTypeArguments.get(0))) { nullableValueListFields.add(field); } } } else { if (isRequiredField(field)) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field)) { nullableFields.add(field); } } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isMutableRealmInteger(field)) { if (!categorizeMutableRealmIntegerField(field)) { return false; } } fields.add(field); return true; }</code><technical_language>I a separated annotation for non-null elements in RealmList<> like: java @ElementsRequired RealmList<Integer> field; is confusing, loose possibility support nullable list field in future. java @Required RealmList<Integer> field @realm/java thinking</technical_language>

Target:
private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (Utils.isRealmList(field)) { if (!hasRequiredAnnotation(field)) { final List<? extends TypeMirror> fieldTypeArguments = ((DeclaredType) field.asType()).getTypeArguments(); if (fieldTypeArguments.isEmpty() || !Utils.isRealmModel(fieldTypeArguments.get(0))) { nullableValueListFields.add(field); } } } else if (isRequiredField(field)) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field) && !Utils.isRealmResults(field)) { nullableFields.add(field); } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isMutableRealmInteger(field)) { if (!categorizeMutableRealmIntegerField(field)) { return false; } } fields.add(field); return true; }
Source:
<code>private void delay(final RetryOnFailure rof, final int attempt) throws InterruptedException { final long delay; if (rof.randomize()) { <START> delay = RAND.nextInt(2 << attempt) * rof.delay(); <END> } else { delay = rof.delay() * attempt; } rof.unit().sleep(delay); }</code><technical_language>Repeater.RAND</technical_language>

Target:
private void delay(final RetryOnFailure rof, final int attempt) throws InterruptedException { final long delay; if (rof.randomize()) { delay = Repeater.RAND.nextInt(2 << attempt) * rof.delay(); } else { delay = rof.delay() * attempt; } rof.unit().sleep(delay); }
Source:
<code>public void unconsentedSignInSetsCookie() throws Exception { Http.Response mockResponse = mockPlayContextWithJson(EMAIL_PASSWORD_SIGN_IN_REQUEST); when(authenticationService.signIn(any(), any(), any())).thenThrow(new ConsentRequiredException(userSession)); try { controller.signInV4(); fail("Should have thrown exeption"); } catch(ConsentRequiredException e) { verify(mockResponse).setCookie(BridgeConstants.SESSION_TOKEN_HEADER, TEST_SESSION_TOKEN, <START> BridgeConstants.BRIDGE_SESSION_EXPIRE_IN_SECONDS, "/"); <END> } }</code><technical_language>leverage verifyCommonLoggingForSignIns() in this test (and in next 3 tests)? This tests consistent complete</technical_language>

Target:
public void unconsentedSignInSetsCookie() throws Exception { response = mockPlayContextWithJson(EMAIL_PASSWORD_SIGN_IN_REQUEST); when(authenticationService.signIn(any(), any(), any())).thenThrow(new ConsentRequiredException(userSession)); try { controller.signInV4(); fail("Should have thrown exeption"); } catch(ConsentRequiredException e) { } verifyCommonLoggingForSignIns(); }
Source:
<code>public Object visitValuesCommand(InvocationContext ctx, ValuesCommand command) throws Throwable { Object values = super.visitValuesCommand(ctx, command); if (enabled && passivationEnabled && values instanceof Collection<?>) { Set<InternalCacheEntry> set = loader.loadAll(); Collection<Object> valueCollection = (Collection<Object>)values; List<Object> valueList = new ArrayList<Object>(set.size() + valueCollection.size()); valueList.addAll(valueCollection); <START> for (InternalCacheEntry ice : set) { <END> valueList.add(ice.getValue()); } return Collections.unmodifiableList(valueList); } else { return values; } }</code><technical_language>call valueList.addAll(set)</technical_language>

Target:
public Object visitValuesCommand(InvocationContext ctx, ValuesCommand command) throws Throwable { Object values = super.visitValuesCommand(ctx, command); if (enabled && !shouldSkipCacheLoader(command)) { Set<InternalCacheEntry> set = loader.loadAll(); Collection<Object> valueCollection = (Collection<Object>)values; List<Object> valueList = new ArrayList<Object>(set.size() + valueCollection.size()); valueList.addAll(valueCollection); for (InternalCacheEntry ice : set) { valueList.add(ice.getValue()); } return Collections.unmodifiableList(valueList); } return values; }
Source:
<code>public synchronized List<Definition> getDefinitions() { List<Definition> defs = fDefs; if (defs == null) { ImmutableList.Builder<Definition> builder = new ImmutableList.Builder<>(); for (int i = 0; i < fLength; i++) { IntegerDeclaration charDecl = IntegerDeclaration.UINT_8_DECL; String fieldName = getFieldName() + '[' + i + ']'; byte fieldValue = fContent[i]; builder.add(new IntegerDefinition(charDecl, getDefinitionScope(), fieldName, fieldValue)); } @SuppressWarnings("null") @NonNull <START> List<Definition> ret = builder.build(); <END> fDefs = ret; return ret; } return defs; }</code><technical_language>line</technical_language>

Target:
public synchronized List<Definition> getDefinitions() { List<Definition> defs = fDefs; if (defs == null) { ImmutableList.Builder<Definition> builder = new ImmutableList.Builder<>(); for (int i = 0; i < fContent.length; i++) { IntegerDeclaration charDecl = IntegerDeclaration.UINT_8_DECL; String fieldName = getFieldName() + '[' + i + ']'; byte fieldValue = fContent[i]; builder.add(new IntegerDefinition(charDecl, getDefinitionScope(), fieldName, fieldValue)); } @SuppressWarnings("null") @NonNull List<Definition> ret = builder.build(); fDefs = ret; return ret; } return defs; }
Source:
<code>public static Map<String, String> buildUserMetadata(byte[] userMetadata) throws RestServiceException { Map<String, String> toReturn = new HashMap<String, String>(); boolean oldStyle = false; try { if (userMetadata.length > 0) { try { CrcInputStream crcstream = new CrcInputStream(new ByteArrayInputStream(userMetadata)); DataInputStream streamData = new DataInputStream(crcstream); short version = streamData.readShort(); switch (version) { case UserMetadata_Version_V1: ByteBuffer userMetadataBuffer = deserializeUserMetadata(crcstream); if (userMetadataBuffer.hasRemaining()) { int size = userMetadataBuffer.getInt(); int counter = 0; while (counter++ < size) { String key = Utils.deserializeAsciiEncodedString(userMetadataBuffer); String value = Utils.deserializeAsciiEncodedString(userMetadataBuffer); toReturn.put(key, value); } <START> } <END> break; default: logger.trace("Failed to parse version in new format. Returning as old format"); oldStyle = true; } } catch (IOException e) { logger.trace("IOException on parsing user metadata. Returning as old format"); oldStyle = true; } catch (RuntimeException e) { logger.trace("Runtime Exception on parsing user metadata. Returning as old format"); oldStyle = true; } } if (oldStyle) { toReturn = getOldStyleUserMetadataAsHashMap(userMetadata); } } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } return toReturn; }</code><technical_language>else case? happen</technical_language>

Target:
public static Map<String, String> buildUserMetadata(byte[] userMetadata) throws RestServiceException { Map<String, String> toReturn = new HashMap<String, String>(); boolean oldStyle = false; if (userMetadata.length > 0) { try { ByteBuffer userMetadataBuffer = ByteBuffer.wrap(userMetadata); short version = userMetadataBuffer.getShort(); switch (version) { case UserMetadata_Version_V1: int sizeToRead = userMetadataBuffer.getInt(); if (sizeToRead != (userMetadataBuffer.remaining() - 8)) { logger.trace("Size didn't match. Returning as old format"); oldStyle = true; } else { int entryCount = userMetadataBuffer.getInt(); int counter = 0; while (counter++ < entryCount) { String key = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); String value = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); toReturn.put(key, value); } long actualCRC = userMetadataBuffer.getLong(); Crc32 crc32 = new Crc32(); crc32.update(userMetadata, 0, userMetadata.length - Crc_Size); long expectedCRC = crc32.getValue(); if (actualCRC != expectedCRC) { logger.trace("corrupt data while parsing user metadata Expected CRC " + expectedCRC + " Actual CRC " + actualCRC); oldStyle = true; } } break; default: logger.trace("Failed to parse version in new format. Returning as old format"); oldStyle = true; } } catch (RuntimeException e) { logger.trace("Runtime Exception on parsing user metadata. Returning as old format"); oldStyle = true; } } if (oldStyle) { toReturn = getOldStyleUserMetadataAsHashMap(userMetadata); } return toReturn; }
Source:
<code>public void testValidatePropertyWithNestedPathAndNullPropertyInTheWay() { Validator validator = getValidator(); X someX = new X(); Set<ConstraintViolation<X>> constraintViolationsX = validator.validateProperty( someX, "list[0].foo" ); <START> assertNumberOfViolations( constraintViolationsX, 1 ); <END> assertCorrectPropertyPaths( constraintViolationsX, "list[0].foo" ); }</code><technical_language>assertions reached due (expected) exception before</technical_language>

Target:
public void testValidatePropertyWithNestedPathAndNullPropertyInTheWay() { Validator validator = getValidator(); X someX = new X(); validator.validateProperty( someX, "list[0].foo" ); }
Source:
<code>public int getNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) { final Iterator<File> fileIterator = getFileIterator(); <START> int num = 0; while (fileIterator.hasNext()) { fileIterator.next(); num++; } <END> return num; }</code><technical_language>replace [Iterators#size](<LINK_0></technical_language>

Target:
public int getNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) { return Iterators.size(getFileIterator()); }
Source:
<code><START> public int getEtag() { <END> return etag; }</code><technical_language>long</technical_language>

Target:
public long getEtag() { return etag; }
Source:
<code>private void addAddress(List<DiscoveryNode> discoveredNodes, Endpoint endpoint) { if (Boolean.TRUE.equals(resolveNotReadyAddresses) || endpoint.isReady()) { <START> Address address = createAddress(endpoint.getPrivateAddress()); <END> Address publicAddress = createAddress(endpoint.getPublicAddress()); discoveredNodes .add(new SimpleDiscoveryNode(address, publicAddress, endpoint.getAdditionalProperties())); if (logger.isFinestEnabled()) { logger.finest("Found node service with address: " + address); } } }</code><technical_language>lets call address privateAddress... is more readable. I guess</technical_language>

Target:
private void addAddress(List<DiscoveryNode> discoveredNodes, Endpoint endpoint) { if (Boolean.TRUE.equals(resolveNotReadyAddresses) || endpoint.isReady()) { Address privateAddress = createAddress(endpoint.getPrivateAddress()); Address publicAddress = createAddress(endpoint.getPublicAddress()); discoveredNodes .add(new SimpleDiscoveryNode(privateAddress, publicAddress, endpoint.getAdditionalProperties())); if (logger.isFinestEnabled()) { logger.finest(String.format("Found node service with addresses (private, public): %s, %s ", privateAddress, publicAddress)); } } }
Source:
<code>public RefSpec setDestination(final String destination) { final RefSpec r = new RefSpec(this); r.dstName = destination; if (isWildcard(r.dstName) && r.srcName == null) <START> throw new IllegalStateException(JGitText.get().destinationIsNotAWildcard); <END> if (isWildcard(r.srcName) != isWildcard(r.dstName)) throw new IllegalStateException(JGitText.get().sourceDestinationMustMatch); return r; }</code><technical_language>sourceIsNotAWildcard</technical_language>

Target:
public RefSpec setDestination(final String destination) { final RefSpec r = new RefSpec(this); r.dstName = destination; if (isWildcard(r.dstName) && r.srcName == null) throw new IllegalStateException(JGitText.get().sourceIsNotAWildcard); if (isWildcard(r.srcName) != isWildcard(r.dstName)) throw new IllegalStateException(JGitText.get().sourceDestinationMustMatch); return r; }
Source:
<code>public VaultRawSecret getRawSecret(final String value) { String entryId = this.getVaultEntryKey(value); if (entryId != null) { if (this.provider == null) { throw new IllegalStateException("Required VaultProvider not found - check vault configuration"); } return this.provider.obtainSecret(entryId); } else { ByteBuffer buffer = value != null ? ByteBuffer.wrap(value.getBytes(StandardCharsets.UTF_8)) : null; return DefaultVaultRawSecret.forBuffer(Optional.ofNullable(buffer)); } <START> } <END></code><technical_language>I wondering a situation isVaultExpression returns true (value is in form of ${vault.xyz}) unable transcribe vault. notify users this situation happen? I in majority of cases this caused a wrongly configured vault (maybe a typo in vault id, etc.). result of this for example _unable connect SMTP server (wrong password)_, is root cause. users this is caused vault configuration. sense</technical_language>

Target:
public VaultRawSecret getRawSecret(final String value) { String entryId = this.getVaultEntryKey(value); if (entryId != null) { return this.provider.obtainSecret(entryId); } else { ByteBuffer buffer = value != null ? ByteBuffer.wrap(value.getBytes(StandardCharsets.UTF_8)) : null; return DefaultVaultRawSecret.forBuffer(Optional.ofNullable(buffer)); } }
Source:
<code>public Map<String, Collection<String>> headers() { <START> headers.forEach((key, value) -> value.removeIf(e -> e == null)); <END> headers.entrySet().removeIf(e -> e.getValue() == null || e.getValue().isEmpty()); return Collections.unmodifiableMap(headers); }</code><technical_language>I idea of modifying existing map... filter create new one?</technical_language>

Target:
public Map<String, Collection<String>> headers() { return Collections.unmodifiableMap( headers.entrySet().stream().filter(h -> h.getValue() != null && !h.getValue().isEmpty()) .collect(toMap( Entry::getKey, Entry::getValue, (e1, e2) -> { throw new IllegalStateException("headers should not have duplicated keys"); }, LinkedHashMap::new))); }
Source:
<code>private void initLabelsToNetworks() { for (Network network : clusterNetworks) { <START> if (network != null) { <END> labelToNetworks.computeIfAbsent(network.getLabel(), k -> new ArrayList<>()).add(network); } } }</code><technical_language>network null in this case, problem label null. Besides this +2</technical_language>

Target:
private void initLabelsToNetworks() { for (Network network : clusterNetworks) { labelToNetworks.computeIfAbsent(network.getLabel(), k -> new ArrayList<>()).add(network); } }
Source:
<code>private void reactOnSelection(ISelection selection) { if (selection instanceof StructuredSelection) { <START> System.out.println(">>> selection: " + selection.toString()); END> StructuredSelection ssel = (StructuredSelection) selection; if (ssel.size() != 1) return; if (ssel.getFirstElement() instanceof IResource) showResource((IResource) ssel.getFirstElement()); if (ssel.getFirstElement() instanceof IAdaptable) { IResource adapted = (IResource) ((IAdaptable) ssel .getFirstElement()).getAdapter(IResource.class); if (adapted != null) showResource(adapted); } else if (ssel.getFirstElement() instanceof RepositoryTreeNode) { RepositoryTreeNode repoNode = (RepositoryTreeNode) ssel .getFirstElement(); reload(repoNode.getRepository()); } } }</code><technical_language>This removed</technical_language>

Target:
private void reactOnSelection(ISelection selection) { if (selection instanceof StructuredSelection) { StructuredSelection ssel = (StructuredSelection) selection; if (ssel.size() != 1) return; if (ssel.getFirstElement() instanceof IResource) showResource((IResource) ssel.getFirstElement()); if (ssel.getFirstElement() instanceof IAdaptable) { IResource adapted = (IResource) ((IAdaptable) ssel .getFirstElement()).getAdapter(IResource.class); if (adapted != null) showResource(adapted); } else if (ssel.getFirstElement() instanceof RepositoryTreeNode) { RepositoryTreeNode repoNode = (RepositoryTreeNode) ssel .getFirstElement(); reload(repoNode.getRepository()); } } }
Source:
<code>public IStatus schedule() { <START> final ITmfTrace trace = getTrace(); <END> if (trace == null) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, String.format("No trace specified for analysis %s", getName())); } execute(trace); return Status.OK_STATUS; }</code><technical_language>Unnecessary</technical_language>

Target:
public IStatus schedule() { synchronized (syncObj) { final ITmfTrace trace = getTrace(); if (trace == null) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, String.format("No trace specified for analysis %s", getName())); } execute(trace); } return Status.OK_STATUS; }
Source:
<code>public void shouldMakeTransactionToFail() throws Throwable { try ( Transaction ignore = db.beginTx() ) { db.createNode( Label.label( "Person" ) ); } <START> Result result = db.execute( "CALL org.neo4j.procedure.failure" ); <END> exception.expect( TransactionFailureException.class ); result.next(); }</code><technical_language>I calling procedure failingPersonCount this test easier read. a time realize a node needed</technical_language>

Target:
public void shouldMakeTransactionToFail() throws Throwable { try ( Transaction ignore = db.beginTx() ) { db.createNode( Label.label( "Person" ) ); } Result result = db.execute( "CALL org.neo4j.procedure.failingPersonCount" ); exception.expect( TransactionFailureException.class ); result.next(); }
Source:
<code>@Override public boolean cancel() { <START> acceptException(new IgniteFutureCancelledCheckedException("Snapshot operation has been cancelled by external process " + <END> "[snpName=" + snpName + ']')); try { closeAsync().get(); } catch (InterruptedException | ExecutionException e) { U.error(log, "SnapshotFutureTask cancellation failed", e); return false; } return true; }</code><technical_language>long line</technical_language>

Target:
@Override public boolean cancel() { acceptException(new IgniteFutureCancelledCheckedException("Snapshot operation has been cancelled " + "by external process [snpName=" + snpName + ']')); try { closeAsync().get(); } catch (InterruptedException | ExecutionException e) { U.error(log, "SnapshotFutureTask cancellation failed", e); return false; } return true; }
Source:
<code>public ListenableFuture<Boolean> issueSpeculativeRequest() { return lh.bk.getMainWorkerPool().submitOrdered(lh.getId(), new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (!isComplete() && null != maybeSendSpeculativeRead(heardFromHostsBitSet)) { <START> if (LOG.isInfoEnabled()) { <END> LOG.info("Send speculative read for {}. Hosts sent are {}, " + " Hosts heard are {}, ensemble is {}.", this, sentToHosts, heardFromHostsBitSet, ensemble); } return true; } return false; } }); }</code><technical_language>changing this debug info? a high load cluster, 5-10% more traffic do speculative reads ensure predictable latency. This change result in producing a lot of unnecessary logging. I ask a question? useful this logging helps guys production</technical_language>

Target:
public ListenableFuture<Boolean> issueSpeculativeRequest() { return lh.bk.getMainWorkerPool().submitOrdered(lh.getId(), new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (!isComplete() && null != maybeSendSpeculativeRead(heardFromHostsBitSet)) { if (LOG.isDebugEnabled()) { LOG.debug("Send speculative read for {}. Hosts sent are {}, " + " Hosts heard are {}, ensemble is {}.", this, sentToHosts, heardFromHostsBitSet, ensemble); } return true; } return false; } }); }
Source:
<code>protected String doInBackground(Void... arg0) { Map<String, String> request_params = new HashMap<String, String>(); <START> request_params.put("grant_type", "password"); <END> request_params.put("username", username); request_params.put("password", password); APIUtilities apiUtilities = new APIUtilities(); apiUtilities.setEndPoint(tokenEndPoint); apiUtilities.setHttpMethod("POST"); apiUtilities.setRequestParamsMap(request_params); Map<String, String> headers = new HashMap<String, String>(); String authorizationString = "Basic " + new String( Base64.encodeBase64((clientID + ":" + clientSecret).getBytes())); headers.put("Authorization", authorizationString); headers.put("Content-Type", "application/x-www-form-urlencoded"); Map<String, String> response_params = ServerApiAccess.postDataAPI(apiUtilities, headers); response = response_params.get("response"); responseCode = response_params.get("status"); return response; }</code><technical_language>of string literals for property names, re-used in a places. introduce constants able code more maintainable</technical_language>

Target:
protected String doInBackground(Void... arg0) { Map<String, String> request_params = new HashMap<String, String>(); request_params.put(Constants.GRANT_TYPE, Constants.GRANT_TYPE_PASSWORD); request_params.put(USERNAME_LABEL, info.getUsername()); request_params.put(PASSWORD_LABEL, info.getPassword()); EndPointInfo apiUtilities = new EndPointInfo(); apiUtilities.setEndPoint(info.getTokenEndPoint()); apiUtilities.setHttpMethod(HTTP_METHODS.POST); apiUtilities.setRequestParamsMap(request_params); byte[] credentials = Base64.encodeBase64((info.getClientID() + COLON + info.getClientSecret()).getBytes()); String encodedCredentials = new String(credentials); Map<String, String> headers = new HashMap<String, String>(); String authorizationString = Constants.AUTHORIZATION_MODE + encodedCredentials; headers.put(Constants.AUTHORIZATION_HEADER, authorizationString); headers.put(Constants.CONTENT_TYPE_HEADER, Constants.DEFAULT_CONTENT_TYPE); Map<String, String> responseParams = null; try { responseParams = ServerUtilities.postDataAPI(apiUtilities, headers); response = responseParams.get(Constants.SERVER_RESPONSE_BODY); responseCode = responseParams.get(Constants.SERVER_RESPONSE_STATUS); } catch (IDPTokenManagerException e) { Log.e(TAG, "Failed to contact server." + e); } return response; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); navigationDrawerFragment = (NavigationDrawerFragment)getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { MovieListFragment movieListFragment = new MovieListFragment(); if (Utils.isLollipopOrLater()) { Fade fade = new Fade(); fade.setDuration(50); <START> movieListFragment.setExitTransition(fade); <END> movieListFragment.setReenterTransition(TransitionInflater .from(this) .inflateTransition(android.R.transition.fade)); movieListFragment.setSharedElementReturnTransition(TransitionInflater.from( this).inflateTransition(R.transition.change_image)); } getSupportFragmentManager() .beginTransaction() .add(R.id.fragment_container, movieListFragment) .commit(); } else { selectedMovieId = savedInstanceState.getInt(MOVIEID, -1); selectedMovieTitle = savedInstanceState.getString(MOVIETITLE, null); } setupActionBar(selectedMovieTitle); }</code><technical_language>default android.R.transition.fade used? in reenter transition (line bellow), inflated once, in 2 places</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); navigationDrawerFragment = (NavigationDrawerFragment)getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { MovieListFragment movieListFragment = new MovieListFragment(); if (Utils.isLollipopOrLater()) { Transition fade = TransitionInflater .from(this) .inflateTransition(android.R.transition.fade); movieListFragment.setExitTransition(fade); movieListFragment.setReenterTransition(fade); movieListFragment.setSharedElementReturnTransition(TransitionInflater.from( this).inflateTransition(R.transition.change_image)); } getSupportFragmentManager() .beginTransaction() .add(R.id.fragment_container, movieListFragment) .commit(); } else { selectedMovieId = savedInstanceState.getInt(MOVIEID, -1); selectedMovieTitle = savedInstanceState.getString(MOVIETITLE, null); } setupActionBar(selectedMovieTitle); }
Source:
<code>public Map<Node, Integer> cluster() { final int[] cluster = IntStream.range(0, nodes.size()).toArray(); IntStream.range(0, neighbors.size()).forEach(i -> neighbors.get(i).stream().forEach(j -> joinNodes(cluster, j, i))); <START> return nodes.stream().collect(Collectors.toMap(n -> n, n -> findRepNode(cluster, cluster[nodes.indexOf(n)]))); <END> }</code><technical_language>calling findRepNode, drop cluster[.] call? suggestion return nodes.stream().collect(Collectors.toMap(n -> n, n -> findRepNode(cluster, nodes.indexOf(n))));</technical_language>

Target:
public Map<Node, Integer> cluster() { final int[] cluster = IntStream.range(0, nodes.size()).toArray(); IntStream.range(0, neighbors.size()).forEach(i -> neighbors.get(i).stream().forEach(j -> joinNodes(cluster, j, i))); return nodes.stream().collect(Collectors.toMap(n -> n, n -> findRepNode(cluster, nodes.indexOf(n)))); }
Source:
<code>public boolean testSourceType(CommandSource source) { <START> return dispatcher.testSourceType(source); <END> }</code><technical_language>checkNotNull(source, "source") Qualify this.</technical_language>

Target:
public boolean testSourceType(CommandSource source) { return this.dispatcher.testSourceType(source); }
Source:
<code>public String generateSas(StorageSharedKeyCredential storageSharedKeyCredentials, Context context) { StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); ensureState(); final String canonicalName = getCanonicalName(storageSharedKeyCredentials.getAccountName()); final String stringToSign = stringToSign(canonicalName); <START> if (context != null && Boolean.TRUE.equals(context.getData("Log-String-To-Sign").orElse(false))) { <END> logger.info("The string to sign computed by the SDK is: {}{}", stringToSign, System.getProperty("line.separator")); logger.warning("Please remember to disable 'Log-String-To-Sign' before going to production as this " + "string can potentially contain PII."); } final String signature = storageSharedKeyCredentials.computeHmac256(stringToSign); return encode(null , signature); }</code><technical_language>I a key azure-log-string-to-sign ensure is overlap Azure SDK specific</technical_language>

Target:
public String generateSas(StorageSharedKeyCredential storageSharedKeyCredentials, Context context) { StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); ensureState(); final String canonicalName = getCanonicalName(storageSharedKeyCredentials.getAccountName()); final String stringToSign = stringToSign(canonicalName); StorageImplUtils.logStringToSign(logger, stringToSign, context); final String signature = storageSharedKeyCredentials.computeHmac256(stringToSign); return encode(null , signature); }
Source:
<code>public View display(Context context, int position, View v, FuzzyScore fuzzyScore) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView appName = v.findViewById(R.id.item_search_text); ImageView image = v.findViewById(R.id.item_search_icon); String text; int pos; int len; if (searchPojo.direct) { text = String.format(context.getString(R.string.ui_item_visit), this.pojo.getName()); pos = text.indexOf(this.pojo.getName()); len = this.pojo.getName().length(); image.setImageResource(R.drawable.ic_public); } else { text = String.format(context.getString(R.string.ui_item_search), this.pojo.getName(), searchPojo.query); pos = text.indexOf(searchPojo.query); len = searchPojo.query.length(); image.setImageResource(search); } <START> appName.setText(text); <END> image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }</code><technical_language>fault, appName a good variable name</technical_language>

Target:
public View display(Context context, int position, View v, FuzzyScore fuzzyScore) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView searchText = v.findViewById(R.id.item_search_text); ImageView image = v.findViewById(R.id.item_search_icon); String text; int pos; int len; if (searchPojo.direct) { text = String.format(context.getString(R.string.ui_item_visit), this.pojo.getName()); pos = text.indexOf(this.pojo.getName()); len = this.pojo.getName().length(); image.setImageResource(R.drawable.ic_public); } else { text = String.format(context.getString(R.string.ui_item_search), this.pojo.getName(), searchPojo.query); pos = text.indexOf(searchPojo.query); len = searchPojo.query.length(); image.setImageResource(search); } displayHighlighted(text, Collections.singletonList(new Pair<Integer, Integer>(pos, pos + len)), searchText, context); image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }
Source:
<code><START> public AbstractFetchCommand(final boolean isUid, @Nonnull final String msgNumbers, @Nonnull final FetchMacro macro) { <END> this(isUid, msgNumbers, macro, null); }</code><technical_language>u change constructors protected</technical_language>

Target:
protected AbstractFetchCommand(final boolean isUid, @Nonnull final String msgNumbers, @Nonnull final FetchMacro macro) { this(isUid, msgNumbers, macro, null, false); }
Source:
<code>public void setFillGradient(LinearGradient.LinearGradientJSO grad) { <START> throwException(); <END> }</code><technical_language>I more descriptive exception (e.g. UnsupportedOperationException that)</technical_language>

Target:
public void setFillGradient(LinearGradient.LinearGradientJSO grad) { setFillColor(null); }
Source:
<code>public List<Condition> searchConditionsByPatient(String patientUuid) { return null; <START> } <END></code><technical_language>replace this null</technical_language>

Target:
public List<Condition> searchConditionsByPatient(String patientUuid) { throw new NotImplementedException(); }
Source:
<code>public void init() throws Exception { context = new AutomationContext("AS", "appServerInstance0002", ContextXpathConstants.SUPER_TENANT, ContextXpathConstants.ADMIN); authenticatorClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl()); authenticatorClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl()); <START> String mySQLPath = " END> AutomationContext context = new AutomationContext(); mySQL_DB_URL = context.getConfigurationValue(mySQLPath); }</code><technical_language>Create a framework constant class automation .xml related xpath values</technical_language>

Target:
public void init() throws XPathExpressionException, AxisFault { context = new AutomationContext(ASIntegrationConstants.AS_PRODUCT_GROUP, ASIntegrationConstants.AS_INSTANCE_0002, ContextXpathConstants.SUPER_TENANT, ContextXpathConstants.SUPER_ADMIN); authenticatorClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl()); dataSourceBean = CarbonCommandToolsUtil.getDataSourceInformation("MySQL"); }
Source:
<code>public ModelAndView deleteMrrtReportTemplate(HttpServletRequest request, @RequestParam("templateId") MrrtReportTemplate mrrtReportTemplate) { <START> mrrtReportTemplateService.purgeMrrtReportTemplate(mrrtReportTemplate); <END> request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.MrrtReportTemplate.deleted"); return new ModelAndView(RADIOLOGY_REPORT_TEMPLATES_TAB_VIEW); }</code><technical_language>handle APIException</technical_language>

Target:
public ModelAndView deleteMrrtReportTemplate(HttpServletRequest request, @RequestParam("templateId") MrrtReportTemplate mrrtReportTemplate) { try { mrrtReportTemplateService.purgeMrrtReportTemplate(mrrtReportTemplate); request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.MrrtReportTemplate.deleted"); } catch (APIException ex) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to delete template file" + " => " + ex.getMessage()); } return new ModelAndView(RADIOLOGY_REPORT_TEMPLATES_TAB_VIEW); }
Source:
<code>public int getApplicabilityRating(PresentationType presentationType, IArtifact artifact) throws OseeCoreException { Artifact aArtifact = artifact.getFullArtifact(); if (aArtifact.isAttributeTypeValid(CoreAttributeTypes.HTMLContent)) { if (presentationType.matches(PresentationType.DIFF)) { return PRESENTATION_SUBTYPE_MATCH; } } <START> return NO_MATCH; <END> }</code><technical_language>Suggest a return variable returning eliminating return statements</technical_language>

Target:
public int getApplicabilityRating(PresentationType presentationType, IArtifact artifact) throws OseeCoreException { Artifact aArtifact = artifact.getFullArtifact(); int toReturn = NO_MATCH; if (aArtifact.isAttributeTypeValid(CoreAttributeTypes.HTMLContent)) { if (presentationType.matches(PresentationType.DIFF)) { toReturn = PRESENTATION_SUBTYPE_MATCH; } } return toReturn; }
Source:
<code>public void scheduleAtFixedRate(final Runnable command, long initialDelay, long period, TimeUnit unit) { <START> lock.lock(); <END> try { Configuration newConfiguration = new Configuration(command, initialDelay, period, unit); if (!newConfiguration.equals(currentConfiguration)) { log.debug("Schedule new task {}", newConfiguration); currentConfiguration = newConfiguration; if (lastStartedLoopProcess != null) { lastStartedLoopProcess.cancel(false); } lastStartedLoopProcess = loopExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { taskExecutor.submit(command); } }, initialDelay, period, unit); } } finally { lock.unlock(); } }</code><technical_language>sync methods</technical_language>

Target:
public synchronized void scheduleAtFixedRate(final Runnable command, long initialDelay, long period, TimeUnit unit) { Configuration newConfiguration = new Configuration(command, initialDelay, period, unit); if (!newConfiguration.equals(currentConfiguration)) { log.debug("Schedule new task {}", newConfiguration); currentConfiguration = newConfiguration; if (lastStartedLoopProcess != null) { lastStartedLoopProcess.cancel(false); } lastStartedLoopProcess = loopExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { taskExecutor.submit(command); } }, initialDelay, period, unit); } }
Source:
<code>private Integer updateReference(Object key, Integer updateCount) { Integer currentCounter = counterMap.get(key); <START> currentCounter = updateCount + ((currentCounter == null) ? 0 : currentCounter); <END> counterMap.put(key, currentCounter); return currentCounter; }</code><technical_language>I MoreObject.firstNonNull(counterMap.get(key), 0) cleaner</technical_language>

Target:
private Integer updateReference(Object key, Integer updateCount) { Integer currentCount = updateCount + MoreObjects.firstNonNull(counterMap.get(key), 0); if (currentCount <= 0) { counterMap.remove(key); } else { counterMap.put(key, currentCount); } return currentCount; }
Source:
<code>private void useFlyClickJump(final User user) { try { final Location otarget = LocationUtil.getTarget(user.getBase()); class DelayedClickJumpTask implements Runnable { @Override public void run() { Location loc = user.getLocation(); loc.setX(otarget.getX()); loc.setZ(otarget.getZ()); while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) { loc.setY(loc.getY() + 1d); } <START> PaperLib.teleportAsync(user.getBase(), loc); <END> } } ess.scheduleSyncDelayedTask(new DelayedClickJumpTask()); } catch (Exception ex) { if (ess.getSettings().isDebug()) { LOGGER.log(Level.WARNING, ex.getMessage(), ex); } } }</code><technical_language>Is absolutely TeleportCause</technical_language>

Target:
private void useFlyClickJump(final User user) { try { final Location otarget = LocationUtil.getTarget(user.getBase()); class DelayedClickJumpTask implements Runnable { @Override public void run() { Location loc = user.getLocation(); loc.setX(otarget.getX()); loc.setZ(otarget.getZ()); while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) { loc.setY(loc.getY() + 1d); } PaperLib.teleportAsync(user.getBase(), loc, TeleportCause.PLUGIN); } } ess.scheduleSyncDelayedTask(new DelayedClickJumpTask()); } catch (Exception ex) { if (ess.getSettings().isDebug()) { LOGGER.log(Level.WARNING, ex.getMessage(), ex); } } }
Source:
<code>public IDefaultLaunchArguments getDefaultLaunchArguments() { String[] as5Types = new String[]{ IJBossToolingConstants.AS_50, IJBossToolingConstants.AS_51, IJBossToolingConstants.EAP_50, IJBossToolingConstants.SERVER_AS_50, IJBossToolingConstants.SERVER_AS_51, IJBossToolingConstants.SERVER_EAP_50, }; boolean isAS5 = false; String serverType = (server == null ? null : server.getServerType() == null ? null : server.getServerType().getId()); String rtType = (runtime == null ? null : runtime.getRuntimeType() == null ? null : runtime.getRuntimeType().getId()); for( int i = 0; i < as5Types.length; i++ ) { if( as5Types[i].equals(serverType) || as5Types[i].equals(rtType)) { isAS5 = true; break; } } if( isAS5 ) { ServerBean sb = new ServerBeanLoader(runtime.getLocation().toFile()).getServerBean(); <START> if( sb.getBeanType().getId().equals("EAP_STD")) { END> sb = new ServerBeanLoader(runtime.getLocation().toFile().getParentFile()).getServerBean(); if( sb != null && "SOA-P".equals(sb.getBeanType().getId()) && sb.getVersion().equals("5.3")) { if( server != null) return new JBossSoa53DefaultLaunchArguments(server); return new JBossSoa53DefaultLaunchArguments(runtime); } } if( server != null) return new JBoss5xDefaultLaunchArguments(server); return new JBoss5xDefaultLaunchArguments(runtime); } if( server != null) return new JBossDefaultLaunchArguments(server); return new JBossDefaultLaunchArguments(runtime); }</code><technical_language>bean types defined for consistency</technical_language>

Target:
public IDefaultLaunchArguments getDefaultLaunchArguments() { String[] as5Types = new String[]{ IJBossToolingConstants.AS_50, IJBossToolingConstants.AS_51, IJBossToolingConstants.EAP_50, IJBossToolingConstants.SERVER_AS_50, IJBossToolingConstants.SERVER_AS_51, IJBossToolingConstants.SERVER_EAP_50, }; boolean isAS5 = false; String serverType = (server == null ? null : server.getServerType() == null ? null : server.getServerType().getId()); String rtType = (runtime == null ? null : runtime.getRuntimeType() == null ? null : runtime.getRuntimeType().getId()); for( int i = 0; i < as5Types.length; i++ ) { if( as5Types[i].equals(serverType) || as5Types[i].equals(rtType)) { isAS5 = true; break; } } if( isAS5 ) { ServerBean sb = new ServerBeanLoader(runtime.getLocation().toFile()).getServerBean(); if( sb.getBeanType().getId().equals(JBossServerType.EAP_STD.getId())) { sb = new ServerBeanLoader(runtime.getLocation().toFile().getParentFile()).getServerBean(); if( sb != null && JBossServerType.SOAP.getId().equals(sb.getBeanType().getId()) && sb.getVersion().startsWith("5.")) { if( server != null) return new JBossSoa5xDefaultLaunchArguments(server); return new JBossSoa5xDefaultLaunchArguments(runtime); } } if( server != null) return new JBoss5xDefaultLaunchArguments(server); return new JBoss5xDefaultLaunchArguments(runtime); } if( server != null) return new JBossDefaultLaunchArguments(server); return new JBossDefaultLaunchArguments(runtime); }
Source:
<code><START> public static void main(String[] args) throws InterruptedException { <END> SpringApplication.run(CounterSinkApplication.class, args); }</code><technical_language>Is a reason this method throws InterruptedException</technical_language>

Target:
public static void main(String[] args) { SpringApplication.run(CounterSinkApplication.class, args); }
Source:
<code>private DefaultSolverManager(String solverConfigResource, ClassLoader classLoader, SolverFactory<Solution_> solverFactory, ThreadFactory threadFactory) { if (solverFactory != null) { this.solverFactory = solverFactory; } else if (classLoader != null) { this.solverFactory = SolverFactory.createFromXmlResource(solverConfigResource, classLoader); } else { this.solverFactory = SolverFactory.createFromXmlResource(solverConfigResource); } int numAvailableProcessors = Runtime.getRuntime().availableProcessors(); int activeThreadCount = Math.max(numAvailableProcessors - 2, 1); logger.info("Number of available processors: {}. Active thread count: {}.", numAvailableProcessors, activeThreadCount); if (threadFactory != null) { this.solverFactory.getSolverConfig().setThreadFactoryClass(threadFactory.getClass()); solverExecutorService = Executors.newFixedThreadPool(activeThreadCount, threadFactory); eventHandlerExecutorService = Executors.newSingleThreadExecutor(threadFactory); } else { <START> solverExecutorService = Executors.newFixedThreadPool(numAvailableProcessors - 1); <END> eventHandlerExecutorService = Executors.newSingleThreadExecutor(); } }</code><technical_language>Is numAvailableProcessors - 1 intended? I a reason number of threads in pool depending supply a thread factory not</technical_language>

Target:
private DefaultSolverManager(String solverConfigResource, ClassLoader classLoader, SolverFactory<Solution_> solverFactory, ThreadFactory threadFactory) { if (solverFactory != null) { this.solverFactory = solverFactory; } else if (classLoader != null) { this.solverFactory = SolverFactory.createFromXmlResource(solverConfigResource, classLoader); } else { this.solverFactory = SolverFactory.createFromXmlResource(solverConfigResource); } int numAvailableProcessors = Runtime.getRuntime().availableProcessors(); int activeThreadCount = Math.max(numAvailableProcessors - 2, 1); logger.info("Number of available processors: {}. Active thread count: {}.", numAvailableProcessors, activeThreadCount); if (threadFactory != null) { this.solverFactory.getSolverConfig().setThreadFactoryClass(threadFactory.getClass()); solverExecutorService = Executors.newFixedThreadPool(activeThreadCount, threadFactory); eventHandlerExecutorService = Executors.newSingleThreadExecutor(threadFactory); } else { solverExecutorService = Executors.newFixedThreadPool(activeThreadCount); eventHandlerExecutorService = Executors.newSingleThreadExecutor(); } }
Source:
<code>public void addItemToListPropertyTest() throws IOException, OperationException { assertNotNull(doc); assertNotNull(doc.getPropertyValue("ds:fields")); assertEquals(((Collection) doc.getPropertyValue("ds:fields")).size(), 0); <START> String fieldsDataAsJSon = readPropertiesFromFile("creationFields.json"); <END> OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testAddItemToPropertyChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("ComplexJsonProperties", fieldsDataAsJSon); DocumentModel resultDoc = (DocumentModel) service.run(ctx, chain); java.util.ArrayList<?> dbFields = (java.util.ArrayList<?>) resultDoc.getPropertyValue("ds:fields"); assertEquals(5, dbFields.size()); }</code><technical_language>fieldsDataAsJ**s**on instead of fieldsDataAsJ**S**on</technical_language>

Target:
public void addItemToListPropertyTest() throws IOException, OperationException { assertNotNull(doc); assertNotNull(doc.getPropertyValue("ds:fields")); assertEquals(((Collection) doc.getPropertyValue("ds:fields")).size(), 0); String fieldsDataAsJson = readPropertiesFromFile("creationFields.json"); OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testAddItemToPropertyChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("complexJsonProperties", fieldsDataAsJson); DocumentModel resultDoc = (DocumentModel) service.run(ctx, chain); List<?> dbFields = (List<?>) resultDoc.getPropertyValue("ds:fields"); assertEquals(5, dbFields.size()); }
Source:
<code>private void testSpecialPage(AdsBaseObject ads) { ads.setPageType("special"); <START> specialPageExpectedDataProvider(); <END> ads.verifyAds(SPECIAL_PAGE_EXPECTED_LINE_ITEMS, SPECIAL_PAGE_EXPECTED_AD_UNITS); }</code><technical_language>this hashmap in test scope only? needed static class property</technical_language>

Target:
private void testSpecialPage(AdsBaseObject ads) { ads.setPageType("special"); ads.verifyAds(getSpecialPageExpectedLineItems(), getSpecialPageExpectedAdUnits()); }
Source:
<code>public void executeQuery(String query) throws NullPointerException, DataAccessException { if (LOG.isLoggable(GaeLevel.DEBUG)) { LOG.log(GaeLevel.DEBUG, "executing query: " + query); } if (query == null) throw new NullPointerException("query cannot be null"); if (query.length() == 0) throw new IllegalArgumentException("query cannot be empty"); affectedRowCount = -1; statement = null; insertedId = -1; connect(); try { if (statement == null) { statement = connection.createStatement(); } if (statement.execute(query, Statement.RETURN_GENERATED_KEYS)) { queryResult = statement.getResultSet(); } else { queryResult = statement.getGeneratedKeys(); } } catch (MySQLIntegrityConstraintViolationException ex) { <START> LOG.log(GaeLevel.SEVERE, "Error executing query - duplicate entry key", ex); <END> throw new DuplicateKeyException(); } catch (SQLException ex) { LOG.log(GaeLevel.SEVERE, "Error executing query", ex); throw new DataAccessException(); } return; }</code><technical_language>logged for information re-thrown is caught originated</technical_language>

Target:
public void executeQuery(String query) throws NullPointerException, DataAccessException { if (LOG.isLoggable(GaeLevel.DEBUG)) { LOG.log(GaeLevel.DEBUG, "executing query: " + query); } if (query == null) throw new NullPointerException("query cannot be null"); if (query.length() == 0) throw new IllegalArgumentException("query cannot be empty"); affectedRowCount = -1; statement = null; insertedId = -1; connect(); try { if (statement == null) { statement = connection.createStatement(); } if (statement.execute(query, Statement.RETURN_GENERATED_KEYS)) { queryResult = statement.getResultSet(); } else { queryResult = statement.getGeneratedKeys(); } } catch (SQLException ex) { LOG.log(GaeLevel.SEVERE, "Error executing query", ex); throw new DataAccessException(ex); } return; }