auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int compare(StreamInputReader a, StreamInputReader b) { EventDefinition event_a = a.getCurrentEvent(); EventDefinition event_b = b.getCurrentEvent(); <START> if (event_a == null || event_b == null) { <END> return 0; } long ta = event_a.getTimestamp(); long tb = event_b.getTimestamp(); return Utils.unsignedCompare(ta, tb); }</code><technical_language>eventually throw exception ? a behavior change though, patch is a clear improvement</technical_language>

Target:
public int compare(StreamInputReader a, StreamInputReader b) { EventDefinition event_a = a.getCurrentEvent(); EventDefinition event_b = b.getCurrentEvent(); if (event_a == null || event_b == null) { throw new IllegalArgumentException(); } long ta = event_a.getTimestamp(); long tb = event_b.getTimestamp(); return Utils.unsignedCompare(ta, tb); }
Source:
<code>public synchronized BigtableTableAdminClient getTableAdminClient() { if (this.tableAdminClient == null) { Channel channel = createChannel( createTransportOptions(options.getTableAdminHost()), <START> options.getChannelOptions(), <END> batchPool, 1); this.tableAdminClient = new BigtableTableAdminGrpcClient(channel); } return tableAdminClient; }</code><technical_language>batchPool is a class fields, necessary pass here</technical_language>

Target:
public synchronized BigtableTableAdminClient getTableAdminClient() { if (this.tableAdminClient == null) { Channel channel = createChannel( createTransportOptions(options.getTableAdminHost()), 1); this.tableAdminClient = new BigtableTableAdminGrpcClient(channel); } return tableAdminClient; }
Source:
<code>public void destruct(Nd nd, long address) { Database db = nd.getDB(); short poolId = getMemoryPoolId(nd); long headerStartAddress = address + this.offset; long firstBlockAddress = FIRST_BLOCK.get(nd, headerStartAddress); int elementCount = getElementSize(); if (this.inlineElementCount > 0) { long firstAddress = headerStartAddress + LIST_HEADER_BYTES; boolean blockFull = (firstBlockAddress != 0); int blockSize = blockFull ? this.inlineElementCount : db.getShort(firstAddress + this.inlineElementCount * elementCount - Database.SHORT_SIZE); destructElements(nd, firstAddress, blockSize); } long nextBlockAddress = firstBlockAddress; while (pointsToAnotherBlock(nextBlockAddress)) { long currentBlockAddress = nextBlockAddress; nextBlockAddress = BlockHeader.NEXT_BLOCK.get(nd, nextBlockAddress); boolean blockFull = (nextBlockAddress != 0); long firstElementInBlockAddress = currentBlockAddress + BlockHeader.BLOCK_HEADER_BYTES; int blockSize = blockFull ? this.elementsPerBlock : <START> db.getShort( firstElementInBlockAddress <END> + this.elementsPerBlock * elementCount - Database.SHORT_SIZE); destructElements(nd, firstElementInBlockAddress, blockSize); db.free(currentBlockAddress, poolId); } db.clearRange(headerStartAddress, getRecordSize()); }</code><technical_language>this newline line longer</technical_language>

Target:
public void destruct(Nd nd, long address) { Database db = nd.getDB(); short poolId = getMemoryPoolId(nd); long headerStartAddress = address + this.offset; long firstBlockAddress = FIRST_BLOCK.get(nd, headerStartAddress); long nextBlockAddress = firstBlockAddress; while (nextBlockAddress != 0) { long currentBlockAddress = nextBlockAddress; nextBlockAddress = BlockHeader.NEXT_BLOCK.get(nd, currentBlockAddress); int elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, currentBlockAddress); destructElements(nd, currentBlockAddress + BlockHeader.BLOCK_HEADER_BYTES, elementsInBlock); db.free(currentBlockAddress, poolId); } db.clearRange(headerStartAddress, getRecordSize()); }
Source:
<code>public void testListForTraces() { TmfTraceStub trace = null; final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); try { File test = new File(FileLocator.toFileURL(location).toURI()); trace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null); Map<String, IAnalysisModule> map = TmfAnalysisManager.getAnalysisModules(trace); assertTrue(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.test")); assertTrue(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.test2")); assertFalse(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.testctf")); } catch (URISyntaxException e) { fail("Cannot generate trace"); } catch (IOException e) { fail("Cannot generate trace"); } catch (TmfTraceException e) { fail("Cannot generate trace"); } finally { if (trace != null) { trace.dispose(); } } CtfTmfTrace ctftrace = null; try { <START> String PATH = CtfTmfTestTraces.getTestTracePath(0); <END> ctftrace = new CtfTmfTrace(); ctftrace.initTrace((IResource) null, PATH, CtfTmfEvent.class); Map<String, IAnalysisModule> map = TmfAnalysisManager.getAnalysisModules(ctftrace); assertTrue(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.test")); assertTrue(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.test2")); assertTrue(map.containsKey("org.eclipse.linuxtools.tmf.core.tests.analysis.testctf")); } catch (TmfTraceException e) { fail("Cannot generate ctf trace"); } finally { if (ctftrace != null) { ctftrace.dispose(); } } }</code><technical_language>rebase this latest HEAD. CtfTmfTestTrace (singular) refer traces name index. simpler ;)</technical_language>

Target:
public void testListForTraces() { ITmfTrace trace = TmfTestTrace.A_TEST_10K.getTrace(); Map<String, IAnalysisModule> map = TmfAnalysisManager.getAnalysisModules(trace); assertTrue(map.containsKey(MODULE_PARAM)); assertTrue(map.containsKey(MODULE_PARAM_DEFAULT)); assertFalse(map.containsKey(MODULE_CTF)); CtfTmfTrace ctftrace = CtfTmfTestTrace.KERNEL.getTrace(); map = TmfAnalysisManager.getAnalysisModules(ctftrace); assertTrue(map.containsKey(MODULE_PARAM)); assertTrue(map.containsKey(MODULE_PARAM_DEFAULT)); assertTrue(map.containsKey(MODULE_CTF)); }
Source:
<code><START> public static LanguageServer getLanguageServer(@NonNull IFile file, @NonNull LanguageServerDefinition lsDefinition) throws IOException { <END> ProjectSpecificLanguageServerWrapper wrapper = getLSWrapper(file, capabilites -> Boolean.TRUE, lsDefinition); if (wrapper != null) { wrapper.connect(file.getLocation(), null); return wrapper.getServer(); } return null; }</code><technical_language>language server definition is account in getLSWrapper method, this method is deprecated. In case need a retrieve a specific language server (which sense), need implementation for that, remove parameter method signature - I say</technical_language>

Target:
public static LanguageServer getLanguageServer(@NonNull IFile file, @NonNull LanguageServerDefinition lsDefinition) throws IOException { ProjectSpecificLanguageServerWrapper wrapper = getLSWrapperForConnection(file.getProject(), lsDefinition); if (wrapper != null) { wrapper.connect(file.getLocation(), null); return wrapper.getServer(); } return null; }
Source:
<code>public void notifyBuildEnded(GerritTriggeredEvent event) { if (event instanceof ChangeBasedEvent) { IGerritHudsonTriggerConfig serverConfig = getServerConfig(event); if ((serverConfig != null && serverConfig.isGerritBuildCurrentPatchesOnly()) <START> || this.getBuildCancellationPolicy().isEnabled()) { <END> getRunningJobs().remove((ChangeBasedEvent)event); } } }</code><technical_language>check for null in EventListener I guess need check for well</technical_language>

Target:
public void notifyBuildEnded(GerritTriggeredEvent event) { if (event instanceof ChangeBasedEvent) { IGerritHudsonTriggerConfig serverConfig = getServerConfig(event); if ((serverConfig != null && serverConfig.isGerritBuildCurrentPatchesOnly()) || (this.getBuildCancellationPolicy() != null && this.getBuildCancellationPolicy().isEnabled())) { getRunningJobs().remove((ChangeBasedEvent)event); } } }
Source:
<code>protected void onPostExecute(@Nullable Address address) { if (address == null) { return; } if (address.getMaxAddressLineIndex() > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; ; ++i) { sb.append(address.getAddressLine(i)); if (i == address.getMaxAddressLineIndex()) { sb.append("."); break; } else { sb.append(", "); } } <START> mLocationTextView.setText(sb.toString()); <END> } }</code><technical_language>This is handled in refactor PR dispatch post changes immediately. So, I adding a note intention a issue here: I _think_ need isAdded() check updating text view. updateLocationTextView() method this check updates text view this call in other places well. refactor, flow slightly change, I worth here</technical_language>

Target:
protected void onPostExecute(@Nullable Address address) { if (!isAdded() || address == null || address.getMaxAddressLineIndex() == 0) { return; } StringBuilder sb = new StringBuilder(); for (int i = 0; ; ++i) { sb.append(address.getAddressLine(i)); if (i == address.getMaxAddressLineIndex()) { sb.append("."); break; } else { sb.append(", "); } } mLocationTextView.setText(sb.toString()); }
Source:
<code>public Network(String addr, String description, Guid id, String name, String vdsmName, String subnet, String gateway, Integer type, Integer vlan_id, boolean stp, int mtu, boolean vmNetwork) { this(); this.addr = addr; this.setDescription(description); this.id = id; <START> this.name = name; <END> this.vdsmName = vdsmName; this.subnet = subnet; this.gateway = gateway; this.type = type; this.vlanId = vlan_id; this.stp = stp; this.mtu = mtu; this.vmNetwork = vmNetwork; this.comment = ""; }</code><technical_language>setName() here</technical_language>

Target:
public Network(String addr, String description, Guid id, String name, String vdsmName, String subnet, String gateway, Integer type, Integer vlan_id, boolean stp, int mtu, boolean vmNetwork) { this(); this.addr = addr; this.setDescription(description); this.id = id; this.setName(name); this.vdsmName = vdsmName; this.subnet = subnet; this.gateway = gateway; this.type = type; this.vlanId = vlan_id; this.stp = stp; this.mtu = mtu; this.vmNetwork = vmNetwork; this.comment = ""; }
Source:
<code>public void setHeaderFields() throws Exception { String authUser = "user"; RuntimeEngine runtimeEngine = RemoteRuntimeEngineFactory.newRestBuilder() .addUserName(authUser) .addPassword("pass") .addUrl(new URL("http://localhost:8080/business-central")) .addHeader("HEADER-NAME", "header-value") .build(); try { <START> runtimeEngine.getTaskService().claim(23l, "user"); <END> fail( "This should have failed because there's no server running... "); } catch( org.kie.remote.client.api.exception.RemoteCommunicationException rce ) { logger.info("The " + NoSuchAlgorithmException.class.getSimpleName() + " above is expected, nothing is wrong."); } }</code><technical_language>Correct if wrong, declare authUser for exact purpose of able reuse here</technical_language>

Target:
public void setHeaderFields() throws Exception { RuntimeEngine runtimeEngine = RemoteRuntimeEngineFactory.newRestBuilder() .addUserName("user") .addPassword("pass") .addUrl(new URL("http://localhost:8080/business-central")) .addHeader("HEADER-NAME", "header-value") .clearHeaderFields() .clearCorrelationProperties() .addDeploymentId("dep-id") .build(); try { runtimeEngine.getTaskService().claim(23l, "user"); fail( "This should have failed because there's no server running... "); } catch( org.kie.remote.client.api.exception.RemoteCommunicationException rce ) { } }
Source:
<code>public static ISymbolProvider getSymbolProvider(ITmfTrace trace) { <START> return new DefaultSymbolProvider(trace); <END> }</code><technical_language>behavior of this method, if deprecated, is expected before. in localGetSymbolProvider() in this method before. brought before</technical_language>

Target:
public ISymbolProvider getSymbolProvider(ITmfTrace trace) { return getSymbolProviders(trace).iterator().next(); }
Source:
<code>public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); <START> System.out.printf("%s%n", result ? "ACL set successfully" : "ACL not set"); <END> client.close(); return null; }</code><technical_language>False means Acl passed is existing, in this case return false. message ACL set is meaningful do need reword this</technical_language>

Target:
public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", "Acl added successfully: " + result); client.close(); return null; }
Source:
<code>Mono<DecryptResult> decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey) { if (iv != null || authenticationData != null || authenticationTag != null) { return Mono.error(new IllegalArgumentException( <START> "iv, " <END> + "authenticationData and authenticationTag parameters are not supported for Rsa decrypt operation")); } keyPair = getKeyPair(jsonWebKey); Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); if (baseAlgorithm == null) { if (serviceCryptoAvailable()) { return serviceClient.decrypt(algorithm, cipherText, context); } return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); } if (keyPair.getPrivate() == null) { if (serviceCryptoAvailable()) { return serviceClient.decrypt(algorithm, cipherText, context); } return Mono.error(new IllegalArgumentException( "Private portion of the key not available to perform decrypt operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; ICryptoTransform transform; try { transform = algo.createDecryptor(keyPair); return Mono.just(new DecryptResult(transform.doFinal(cipherText))); } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { return Mono.error(e); } }</code><technical_language>This is interesting place split string. try fit line</technical_language>

Target:
Mono<DecryptResult> decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey) { if (iv != null || authenticationData != null || authenticationTag != null) { return Mono.error(new IllegalArgumentException( "iv, authenticationData and authenticationTag parameters are not supported for Rsa decrypt operation")); } keyPair = getKeyPair(jsonWebKey); Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); if (baseAlgorithm == null) { if (serviceCryptoAvailable()) { return serviceClient.decrypt(algorithm, cipherText, context); } return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); } if (keyPair.getPrivate() == null) { if (serviceCryptoAvailable()) { return serviceClient.decrypt(algorithm, cipherText, context); } return Mono.error(new IllegalArgumentException( "Private portion of the key not available to perform decrypt operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; ICryptoTransform transform; try { transform = algo.createDecryptor(keyPair); return Mono.just(new DecryptResult(transform.doFinal(cipherText))); } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { return Mono.error(e); } }
Source:
<code>public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF); attr.setFriendlyName("projectDirPermissions"); <START> attr.setDisplayName("projectDirPermissions"); <END> attr.setType(Integer.class.getName()); attr.setDescription("Permissions (ACL) to directory, where the project exists. Standard unix file system permissions in numeric format."); return attr; }</code><technical_language>Please, text "Project directory permission" (Name fixed sending this pool request) thank you</technical_language>

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF); attr.setFriendlyName("projectDirPermissions"); attr.setDisplayName("Project directory permission"); attr.setType(Integer.class.getName()); attr.setDescription("Permissions (ACL) to directory, where the project exists. Standard unix file system permissions in numeric format."); return attr; }
Source:
<code>public PropertyInvertedRegexTester(IPersonAttributesGroupTestDefinition definition) { super(definition); final String propertyName = definition.getTestValue(); String regexExpression = PropertiesManager.getProperty (propertyName, ""); if (StringUtils.isBlank(regexExpression)) { logger.error("Unable to find property name in portal.properties or has empty value." + " PAGS PropertyInvertedRegexTester will always return true for attribute {}", propertyName, definition.getAttributeName()); } setPattern(regexExpression); <START> } <END></code><technical_language>Minor, duplicating lines 44 - 51, put in a private method invoked constructors, this constructor invoke other</technical_language>

Target:
public PropertyInvertedRegexTester(IPersonAttributesGroupTestDefinition definition) { super(definition); setPattern(definition.getAttributeName(), definition.getTestValue()); }
Source:
<code>public static byte[] encodeOSCoreResponse(OSCoreCtx ctx, final boolean newPartialIV) { int firstByte = 0x00; ByteArrayOutputStream bRes = new ByteArrayOutputStream(); <START> if(ctx.getIncludeContextId() == true) { <END> firstByte = firstByte | 0x10; } if (newPartialIV) { byte[] partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); firstByte = firstByte | (partialIV.length & 0x07); bRes.write(firstByte); try { bRes.write(partialIV); } catch (IOException e) { e.printStackTrace(); } } else { bRes.write(firstByte); } if(ctx.getIncludeContextId() == true) { try { bRes.write(ctx.getIdContext().length); bRes.write(ctx.getIdContext()); } catch (IOException e) { e.printStackTrace(); } } byte[] optionBytes = bRes.toByteArray(); if(optionBytes.length == 1 && optionBytes[0] == 0x00) { return Bytes.EMPTY; } else { return optionBytes; } }</code><technical_language>Please insert a space (' ') "if" "("</technical_language>

Target:
public static byte[] encodeOSCoreResponse(OSCoreCtx ctx, final boolean newPartialIV) { int firstByte = 0x00; ByteArrayOutputStream bRes = new ByteArrayOutputStream(); if (ctx.getIncludeContextId()) { firstByte = firstByte | 0x10; } if (newPartialIV) { byte[] partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); firstByte = firstByte | (partialIV.length & 0x07); bRes.write(firstByte); try { bRes.write(partialIV); } catch (IOException e) { e.printStackTrace(); } } else { bRes.write(firstByte); } if (ctx.getIncludeContextId()) { try { bRes.write(ctx.getIdContext().length); bRes.write(ctx.getIdContext()); } catch (IOException e) { e.printStackTrace(); } } byte[] optionBytes = bRes.toByteArray(); if (optionBytes.length == 1 && optionBytes[0] == 0x00) { return Bytes.EMPTY; } else { return optionBytes; } }
Source:
<code>public void start() { parseOptions(); if(inlineHash) { if(excludes == null || excludes.isEmpty()) { stackHasher = new StackHasher(); } else { <START> stackHasher = new StackHasher(StackElementFilter.byPattern(excludes)); <END> } } super.start(); }</code><technical_language>StackHasher excludes consideration? excludes shorten log output. for error correlation want include stack elements. thoughts</technical_language>

Target:
public void start() { parseOptions(); if(excludes == null || excludes.isEmpty()) { if(inlineHash) { addInfo("[inlineHash] is active with no exclusion pattern: use non null source info filter to exclude generated classnames (see doc)"); stackElementFilter = StackElementFilter.withSourceInfo(); } else { stackElementFilter = StackElementFilter.any(); } } else { stackElementFilter = StackElementFilter.byPattern(excludes); } if(inlineHash) { stackHasher = new StackHasher(stackElementFilter); } super.start(); }
Source:
<code>private void closeLockServiceIfPossible() { <START> if (lockService instanceof Closeable) { <END> try { ((Closeable) lockService).close(); } catch (IOException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } } }</code><technical_language>AutoCloseable</technical_language>

Target:
private void closeLockServiceIfPossible() { if (lockService instanceof AutoCloseable) { try { ((AutoCloseable) lockService).close(); } catch (Exception e) { throw Throwables.rewrapAndThrowUncheckedException("Exception when closing the lock service", e); } } }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ImageView image = (ImageView) view.findViewById(R.id.promo_dialog_image); image.setImageResource(mDrawableId); LinearLayout imageContainer = (LinearLayout) view.findViewById(R.id.promo_dialog_image_container); imageContainer.setVisibility(DisplayUtils.isLandscape(getActivity()) ? View.GONE : View.VISIBLE); WPTextView title = (WPTextView) view.findViewById(R.id.promo_dialog_title); title.setText(mTitleId); WPTextView description = (WPTextView) view.findViewById(R.id.promo_dialog_description); description.setText(mDescriptionId); WPTextView link = (WPTextView) view.findViewById(R.id.promo_dialog_link); if (mLinkId != 0) { link.setText(mLinkId); link.setOnClickListener(mLinkOnClickListener); } else { link.setVisibility(View.GONE); } Button buttonNegative = (Button) view.findViewById(R.id.promo_dialog_button_negative); if (mButtonNegativeId != 0) { buttonNegative.setText(mButtonNegativeId); buttonNegative.setOnClickListener(mNegativeButtonOnClickListener); } else { buttonNegative.setVisibility(View.GONE); } Button buttonPositive = (Button) view.findViewById(R.id.promo_dialog_button_positive); buttonPositive.setText(mButtonPositiveId); <START> buttonPositive.setOnClickListener(mPositiveButtonOnClickListener); <END> }</code><technical_language>of this is necessary positive button's text listener set in base class</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ImageView image = (ImageView) view.findViewById(R.id.promo_dialog_image); image.setImageResource(mDrawableResId); LinearLayout imageContainer = (LinearLayout) view.findViewById(R.id.promo_dialog_image_container); imageContainer.setVisibility(DisplayUtils.isLandscape(getActivity()) ? View.GONE : View.VISIBLE); WPTextView title = (WPTextView) view.findViewById(R.id.promo_dialog_title); title.setText(mTitleResId); WPTextView description = (WPTextView) view.findViewById(R.id.promo_dialog_description); description.setText(mDescriptionResId); WPTextView link = (WPTextView) view.findViewById(R.id.promo_dialog_link); if (mLinkResId != 0) { link.setText(mLinkResId); link.setOnClickListener(mLinkOnClickListener); } else { link.setVisibility(View.GONE); } Button buttonNegative = (Button) view.findViewById(R.id.promo_dialog_button_negative); if (mButtonNegativeResId != 0) { buttonNegative.setText(mButtonNegativeResId); buttonNegative.setOnClickListener(mNegativeButtonOnClickListener); } else { buttonNegative.setVisibility(View.GONE); } Button buttonPositive = (Button) view.findViewById(R.id.promo_dialog_button_positive); buttonPositive.setText(mButtonPositiveResId); buttonPositive.setOnClickListener(mPositiveButtonOnClickListener); }
Source:
<code>private void showErrorsAndCleanupState(FactModelTuple factModelTuple) { StringBuilder builder = new StringBuilder(); boolean showError = false; <START> if (factModelTuple.getTopLevelCollectionError().size() > 0) { <END> showError = true; builder.append("Top-level collections are not supported! Violated by:<br/>"); factModelTuple.getTopLevelCollectionError().forEach(error -> builder.append("<b>" + error + "</b><br/>")); builder.append("<br/>"); } if (factModelTuple.getMultipleNestedCollectionError().size() > 0) { showError = true; builder.append("Nested collections are not supported! Violated by:<br/>"); factModelTuple.getMultipleNestedCollectionError().forEach(error -> builder.append("<b>" + error + "</b><br/>")); builder.append("<br/>"); } if (factModelTuple.getMultipleNestedObjectError().size() > 0) { showError = true; builder.append("Complex nested objects inside a collection are not supported! Violated by:<br/>"); factModelTuple.getMultipleNestedObjectError().forEach(error -> builder.append("<b>" + error + "</b><br/>")); } if (showError) { factModelTuple.getTopLevelCollectionError().clear(); factModelTuple.getMultipleNestedCollectionError().clear(); factModelTuple.getMultipleNestedObjectError().clear(); eventBus.fireEvent(new UnsupportedDMNEvent(builder.toString())); } }</code><technical_language>Please remove this block (now supported)</technical_language>

Target:
private void showErrorsAndCleanupState(FactModelTuple factModelTuple) { StringBuilder builder = new StringBuilder(); boolean showError = false; if (factModelTuple.getMultipleNestedCollectionError().size() > 0) { showError = true; builder.append("Nested collections are not supported! Violated by:<br/>"); factModelTuple.getMultipleNestedCollectionError().forEach(error -> builder.append("<b>" + error + "</b><br/>")); builder.append("<br/>"); } if (factModelTuple.getMultipleNestedObjectError().size() > 0) { showError = true; builder.append("Complex nested objects inside a collection are not supported! Violated by:<br/>"); factModelTuple.getMultipleNestedObjectError().forEach(error -> builder.append("<b>" + error + "</b><br/>")); } if (showError) { factModelTuple.getMultipleNestedCollectionError().clear(); factModelTuple.getMultipleNestedObjectError().clear(); eventBus.fireEvent(new UnsupportedDMNEvent(builder.toString())); } }
Source:
<code>private DataNodeId getCloudDataNode() throws ReplicationException { <START> if (vcrNodes.get().size() == 0) { <END> logger.error("No vcr node found to replicate partition from cloud."); throw new ReplicationException("No vcr node found to replicate partition from cloud."); } return vcrNodes.get().toArray(new CloudDataNode[0])[Utils.getRandomShort(new Random()) % vcrNodes.get().size()]; }</code><technical_language>isEmpty() is simpler</technical_language>

Target:
DataNodeId getCloudDataNode() throws ReplicationException { List<CloudDataNode> nodes = vcrNodes.get(); if (nodes.isEmpty()) { throw new ReplicationException("No VCR node found to replicate partition from cloud."); } return nodes.get(Utils.getRandomShort(random) % nodes.size()); }
Source:
<code>private TokenMap getTokenMap() { Optional<? extends TokenMap> maybeTokenMap = session().getMetadata().getTokenMap(); <START> if (maybeTokenMap.isPresent()) { <END> TokenMap tokenMap = maybeTokenMap.get(); assertThat(tokenMap.getPartitionerName()).isEqualTo(expectedPartitionerName); return tokenMap; } else { fail("Expected token map to be present"); return null; } }</code><technical_language>simplified to: assertThat(maybeTokenMap).isPresent().hasValueSatisfying(tokenMap -> { assertThat(tokenMap.getPartitionerName()).isEqualTo(expectedPartitionerName); });</technical_language>

Target:
private TokenMap getTokenMap() { return session() .getMetadata() .getTokenMap() .map( tokenMap -> { assertThat(tokenMap.getPartitionerName()).isEqualTo(expectedPartitionerName); return tokenMap; }) .orElseThrow(() -> new AssertionError("Expected token map to be present")); }
Source:
<code>public StatsManager(StorageManager storageManager, List<PartitionId> partitionIds, MetricRegistry registry, StatsManagerConfig config, Time time) throws IOException { this.storageManager = storageManager; initialPartitionIds = partitionIds; statsOutputFile = new File(config.outputFilePath); publishPeriodInSecs = config.publishPeriodInSecs; metrics = new StatsManagerMetrics(registry); this.time = time; <START> scheduler = Utils.newScheduler(1, false); <END> }</code><technical_language>create scheduler in start() method</technical_language>

Target:
public StatsManager(StorageManager storageManager, List<PartitionId> partitionIds, MetricRegistry registry, StatsManagerConfig config, Time time) throws IOException { this.storageManager = storageManager; totalPartitionIds = partitionIds; statsOutputFile = new File(config.outputFilePath); publishPeriodInSecs = config.publishPeriodInSecs; metrics = new StatsManagerMetrics(registry); this.time = time; }
Source:
<code>public Entity getEntity(IGroupMember member) { <START> if (member != null) { <END> EntityEnum entityEnum = getEntityType(member); Entity entity; if (entityEnum.isGroup()) { entity = EntityFactory.createEntity((IEntityGroup) member, entityEnum); } else { entity = EntityFactory.createEntity(member, entityEnum); } if (entity.getName() == null) { entity.setName(lookupEntityName(entity)); } if (EntityEnum.GROUP.toString().equals(entity.getEntityType()) || EntityEnum.PERSON.toString().equals(entity.getEntityType())) { IAuthorizationPrincipal authP = getPrincipalForEntity(entity); Principal principal = new PrincipalImpl(authP.getKey(), authP.getPrincipalString()); entity.setPrincipal(principal); } return entity; } return null; }</code><technical_language>art: Personally I lean a guard statement. java if (member == null) { return null } ..</technical_language>

Target:
public Entity getEntity(IGroupMember member) { if (member == null) { return null; } EntityEnum entityEnum = getEntityType(member); Entity entity; if (entityEnum.isGroup()) { entity = EntityFactory.createEntity((IEntityGroup) member, entityEnum); } else { entity = EntityFactory.createEntity(member, entityEnum); } if (entity.getName() == null) { entity.setName(lookupEntityName(entity)); } if (EntityEnum.GROUP.toString().equals(entity.getEntityType()) || EntityEnum.PERSON.toString().equals(entity.getEntityType())) { IAuthorizationPrincipal authP = getPrincipalForEntity(entity); Principal principal = new PrincipalImpl(authP.getKey(), authP.getPrincipalString()); entity.setPrincipal(principal); } return entity; }
Source:
<code>public void presentation(String programName, String programEditor, String editorURL, String scriptorName, String prefixName) throws CancelException { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer); <START> formatter.format("This wizard will help you install %1$s on your computer.\n\nThis program was created by: %2$s\n%3$s\n\nThis installation program is provided by: %4$s\n\n%1$s will be installed in: ${application.user.wineprefix}%5$s\n\n${application.name} is not responsible for anything that might happen as a result of using these scripts.\n\nClick Next to start", programName, programEditor, editorURL, scriptorName, prefixName); <END> presentation(translate(buffer.toString())); }</code><technical_language>Simply String.format() here. Also, try shorter lines</technical_language>

Target:
public void presentation(String programName, String programEditor, String editorURL, String scriptorName, String prefixName) throws CancelException { final String textToShow = String.format(translate("This wizard will help you install %1$s on your computer.\n\n" + "This program was created by: %2$s\n%3$s\n\nThis installation program is provided by: %4$s" + "\n\n%1$s will be installed in: ${application.user.wineprefix}%5$s\n\n" + "${application.name} is not responsible for anything that might happen as a result of using" + " these scripts.\n\nClick Next to start") , programName, programEditor, editorURL, scriptorName, prefixName); presentation(textToShow); }
Source:
<code>protected String currentTimestampDatabaseQuery() { <START> return "SELECT CURRENT_TIMESTAMP;"; <END> }</code><technical_language>String for checkConnectionQuery() is SELECT 1 a semicolon, is one. a reason for that, standardize other</technical_language>

Target:
protected String currentTimestampDatabaseQuery() { return "SELECT CURRENT_TIMESTAMP"; }
Source:
<code>public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser && unit != null) { <START> initializeYoutubePlayer(); <END> } else { removeFragment(); fromLandscape = false; transcriptsHandler.removeCallbacksAndMessages(null); subtitleDisplayHandler.removeCallbacks(subtitlesProcessorRunnable); initializeHandler.removeCallbacks(null); } }</code><technical_language>initializeYoutubePlayer needs refactor initializeYoutubePlayerFragment youTubePlayerFragment attached container onActivityCreated remove container container destroy e.g onDestroyView</technical_language>

Target:
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser && unit != null) { setVideoModel(); initializeHandler.postDelayed(() -> { initializeYoutubePlayer(); }, 1000); } else { releaseYoutubePlayer(); allowFullScreen = true; transcriptsHandler.removeCallbacksAndMessages(null); subtitleDisplayHandler.removeCallbacks(subtitlesProcessorRunnable); initializeHandler.removeCallbacks(null); } }
Source:
<code>static List<String> generateRandomLogSegmentName(int count) { List<String> randomLogSegmentNames = new ArrayList<>(); while (randomLogSegmentNames.size() < count) { <START> String logSegmentNames = <END> Integer.toString(TestUtils.RANDOM.nextInt(20)) + '_' + Integer.toString(TestUtils.RANDOM.nextInt(20)); if (randomLogSegmentNames.contains(logSegmentNames)) { continue; } randomLogSegmentNames.add(logSegmentNames); } Collections.sort(randomLogSegmentNames, LogSegmentNameHelper.COMPARATOR); return randomLogSegmentNames; }</code><technical_language>1. Generate longs (or long) LogSegmentNameHelper.getName() 2. longs generated repeat (this do checking names) 3. Set limit (which is 20) 1000 * count</technical_language>

Target:
static List<String> generateRandomLogSegmentName(int count) { List<String> randomLogSegmentNames = new ArrayList<>(); while (randomLogSegmentNames.size() < count) { String logSegmentName = LogSegmentNameHelper.getName(TestUtils.RANDOM.nextInt(count * 1000), TestUtils.RANDOM.nextInt(count * 1000)); if (!randomLogSegmentNames.contains(logSegmentName)) { randomLogSegmentNames.add(logSegmentName); } } Collections.sort(randomLogSegmentNames, LogSegmentNameHelper.COMPARATOR); return randomLogSegmentNames; }
Source:
<code>private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { throwErrorAt("NOP padding is not allowed within annotation wrappers."); } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } if (_value_tid == PrivateIonConstants.tidTypedecl) { <START> throwErrorAt("Malformed ION, annotation of an annotation found."); <END> } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }</code><technical_language>suggest a message like: "An annotation wrapper another annotation wrapper." malformed Ion error is thrown, "annotation of annotation" is a bit ambiguous</technical_language>

Target:
private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { throwErrorAt("NOP padding is not allowed within annotation wrappers."); } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } if (_value_tid == PrivateIonConstants.tidTypedecl) { throwErrorAt("An annotation wrapper may not contain another annotation wrapper."); } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }
Source:
<code>public void offer( long candidate ) { long currentHighest; do { currentHighest = highestId.get(); <START> if ( candidate < currentHighest ) <END> { return; } } while ( !highestId.compareAndSet( currentHighest, candidate ) ); }</code><technical_language><=</technical_language>

Target:
public void offer( long candidate ) { long currentHighest; do { currentHighest = highestId.get(); if ( candidate <= currentHighest ) { return; } } while ( !highestId.compareAndSet( currentHighest, candidate ) ); }
Source:
<code>public List<ReviewFile> listFiles() { try { List<ReviewFile> files = new ArrayList<ReviewFile>(); Map<String, FileInfo> changeFiles = gerritApi.changes() .id(gerritPatchset.getChangeId()).revision(gerritPatchset.getRevisionId()).files(); <START> for (Map.Entry<String, FileInfo> entry : changeFiles.entrySet()) { <END> if (COMMIT_MSG.equals(entry.getKey())) { continue; } FileInfo fileInfo = entry.getValue(); if (fileInfo.status != null && fileInfo.status == 'D') { continue; } files.add(new ReviewFile(entry.getKey())); } return files; } catch (RestApiException e) { throw new GerritException("Error when listing files", e); } }</code><technical_language>entry => changeFileEntry</technical_language>

Target:
public List<ReviewFile> listFiles() { try { List<ReviewFile> files = new ArrayList<ReviewFile>(); Map<String, FileInfo> changeFiles = gerritApi.changes() .id(gerritPatchset.getChangeId()).revision(gerritPatchset.getRevisionId()).files(); for (Map.Entry<String, FileInfo> changeFileEntry : changeFiles.entrySet()) { if (COMMIT_MSG.equals(changeFileEntry.getKey())) { continue; } FileInfo fileInfo = changeFileEntry.getValue(); if (isDeleted(fileInfo)) { continue; } files.add(new ReviewFile(changeFileEntry.getKey())); } return files; } catch (RestApiException e) { throw new GerritException("Error when listing files", e); } }
Source:
<code>protected void setActionMessageParameters() { <START> addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ENABLE_GLUSTER_HOOK); <END> addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_HOOK); }</code><technical_language>Similar start, stop, etc. I name of action enum more generic (VAR__ACTION__ENABLE)</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ENABLE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_HOOK); }
Source:
<code><START> public void prepareRun(StageSubmitterContext context) throws Exception { <END> super.prepareRun(context); context.record( TransformLineageRecorderUtils.oneToOneIn(TransformLineageRecorderUtils.getFields(outSchema), "decompress", "Use the specified algorithm to decompress specific fields.")); }</code><technical_language>This is similar Compressor</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); parseConfiguration(config.decompressor, context.getFailureCollector()); List<String> inFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); List<String> outFields = TransformLineageRecorderUtils.getFields(context.getOutputSchema()); List<String> identityFields = outFields.stream() .filter(field -> !deCompMap.containsKey(field) || deCompMap.get(field) == DecompressorType.NONE) .collect(Collectors.toList()); List<String> processedFields = new ArrayList<>(outFields); processedFields.removeAll(identityFields); List<String> droppedFields = new ArrayList<>(inFields); droppedFields.removeAll(outFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(processedFields, "decompress", "Used the specified algorithm to decompress the field.")); output.addAll(TransformLineageRecorderUtils.generateDrops(droppedFields)); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); <START> if (null == file) { <END> response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()){ Object languagePageShown = request.getSession(true).getAttribute(LANG_PAGE_SHOWN); if (!file.equals(originalFile)) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if ((null == languagePageShown || !Boolean.parseBoolean(languagePageShown.toString()))) { request.getSession(true).setAttribute(LANG_PAGE_SHOWN, true); request.setAttribute(LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); RequestDispatcher dispatcher = request.getRequestDispatcher(LANG_JSP); if (dispatcher != null) { dispatcher.include(request, response); } } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }</code><technical_language>Please "something <operator> null" convention</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()){ Object languagePageShown = request.getSession(true).getAttribute(LANG_PAGE_SHOWN); if (!file.equals(originalFile)) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if ((languagePageShown == null || !Boolean.parseBoolean(languagePageShown.toString()))) { request.getSession(true).setAttribute(LANG_PAGE_SHOWN, true); request.setAttribute(LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); RequestDispatcher dispatcher = request.getRequestDispatcher(LANG_JSP); if (dispatcher != null) { dispatcher.include(request, response); } } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }
Source:
<code>public int evaluate(IRoutingTile tile, EntityMinecart cart) { if (conditions == null) return 0; EntityMinecart controllingCart = getRoutableCart(cart); if (controllingCart == null) return 0; for (Condition condition : conditions) { int value = condition.evaluate(tile, controllingCart); if (value != 0) <START> return value; <END> } return 0; }</code><technical_language>match max here</technical_language>

Target:
public int evaluate(IRoutingTile tile, EntityMinecart cart) { if (expressions == null) return NO_POWER; EntityMinecart controllingCart = getRoutableCart(cart); if (controllingCart == null) return NO_POWER; for (Expression expression : expressions) { int value = expression.evaluate(tile, controllingCart); if (value != NO_POWER) return value; } return NO_POWER; }
Source:
<code>private void downloadComponent(ComponentInstallationJob job) { Path tempZipPath = null; try { tempZipPath = Files.createTempFile(job.getComponent(), ""); DigitalExchangeBaseCall call = new DigitalExchangeBaseCall( HttpMethod.GET, "digitalExchange", "components", job.getComponent(), "packages"); try (InputStream in = client.getStreamResponse(job.getDigitalExchange(), call)) { Files.copy(in, tempZipPath, StandardCopyOption.REPLACE_EXISTING); } createComponentsDir(); extractZip(tempZipPath); } catch (ApsSystemException | IOException | UncheckedIOException ex) { logger.error("Error while downloading component", ex); throw new InstallationException("Unable to save component", ex); } finally { if (tempZipPath != null) { <START> tempZipPath.toFile().delete(); <END> } } }</code><technical_language>If deletion fails here, it. log if delete returns false</technical_language>

Target:
private void downloadComponent(ComponentInstallationJob job) { Path tempZipPath = null; try { tempZipPath = Files.createTempFile(job.getComponent(), ""); DigitalExchangeBaseCall call = new DigitalExchangeBaseCall( HttpMethod.GET, "digitalExchange", "components", job.getComponent(), "packages"); try (InputStream in = client.getStreamResponse(job.getDigitalExchange(), call)) { Files.copy(in, tempZipPath, StandardCopyOption.REPLACE_EXISTING); } createComponentsDir(); extractZip(tempZipPath); } catch (ApsSystemException | IOException | UncheckedIOException ex) { logger.error("Error while downloading component", ex); throw new InstallationException("Unable to save component", ex); } finally { if (tempZipPath != null) { if (!tempZipPath.toFile().delete()) { logger.warn("Unable to delete temporary zip file {}", tempZipPath.toFile().getAbsolutePath()); } } } }
Source:
<code>public static void writeBigEndianLongToOutputStream(OutputStream out, long value, ByteBuffer helperBuffer) throws IOException { if (helperBuffer.order() != ByteOrder.BIG_ENDIAN) { throw new IllegalArgumentException("Expected big-endian byteBuffer"); } helperBuffer.putLong(0, value); <START> out.write(helperBuffer.array(), 0, 8); <END> }</code><technical_language>nice null-check helperBuffer.array() ensure get it. is, NPE 1. out is null 2. helperBuffer is null 3. helperBuffer is wrong object type .array() is null</technical_language>

Target:
public static void writeBigEndianLongToOutputStream(OutputStream out, long value, ByteBuffer helperBuffer) throws IOException { if (helperBuffer.order() != ByteOrder.BIG_ENDIAN || !helperBuffer.hasArray()) { throw new IllegalArgumentException("Expected writable, big-endian, heap byteBuffer"); } helperBuffer.putLong(0, value); out.write(helperBuffer.array(), helperBuffer.arrayOffset(), Longs.BYTES); }