auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setBonusType(final String type) throws GameParseException { final String[] s = splitOnColon(type); if (s.length > 2) { <START> throw new GameParseException("bonusType can only have value and count" + thisErrorMsg()); <END> } if (s.length == 1) { bonusType = Tuple.of(1, s[0]); } else { bonusType = Tuple.of(getInt(s[0]), s[1]); } }</code><technical_language>clear offending value, sense print out 'pre-split' value</technical_language>

Target:
private void setBonusType(final String type) throws GameParseException { final String[] s = splitOnColon(type); if (s.length > 2) { throw new GameParseException( "bonusType can only have value and count: " + type + thisErrorMsg()); } if (s.length == 1) { bonusType = new BonusType(s[0], 1); } else { bonusType = new BonusType(s[1], getInt(s[0])); } }
Source:
<code>protected void registerResourceTransformers(final KnownModelVersion modelVersion, final ResourceTransformationDescriptionBuilder resourceBuilder, final ResourceTransformationDescriptionBuilder loggingProfileBuilder) { switch (modelVersion) { case VERSION_1_1_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, AUTOFLUSH, TARGET) .end() .discardOperations(); break; } case VERSION_2_0_0: { resourceBuilder .getAttributeBuilder() <START> .setValueConverter(new DefaultAttributeConverter() { <END> @Override protected void convertAttribute(final PathAddress address, final String attributeName, final ModelNode attributeValue, final TransformationContext context) { final String currentValue = attributeValue.asString(); final String newValue = CONSOLE_PATTERN.matcher(currentValue).replaceAll(Target.SYSTEM_OUT.toString()); if (attributeValue.getType() == ModelType.EXPRESSION) { attributeValue.set(new ValueExpression(newValue)); } else if (attributeValue.getType() == ModelType.STRING) { attributeValue.set(newValue); } } }, TARGET) .end(); break; } } }</code><technical_language>I this a reject a conversion</technical_language>

Target:
protected void registerResourceTransformers(final KnownModelVersion modelVersion, final ResourceTransformationDescriptionBuilder resourceBuilder, final ResourceTransformationDescriptionBuilder loggingProfileBuilder) { switch (modelVersion) { case VERSION_1_1_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, AUTOFLUSH, TARGET) .end() .discardOperations(); break; } case VERSION_2_0_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, TARGET) .addRejectCheck(new SimpleRejectAttributeChecker(new ModelNode(Target.CONSOLE.toString())), TARGET) .end(); break; } } }
Source:
<code><START> public boolean isInVisibleLines() { <END> return support.isInVisibleLines(this); }</code><technical_language>this public? extender of annotation, I this is I need invoke expect underlying framework do necssary optimizations</technical_language>

Target:
protected boolean isInVisibleLines() { return support.isInVisibleLines(this); }
Source:
<code>@Test public void getPicassoKindMini() throws Exception { assertThat(getPicassoKind(512, 384)).isEqualTo(MINI); assertThat(getPicassoKind(100, 100)).isEqualTo(MINI); <START> assertThat(getPicassoKind(1000, 384)).isEqualTo(MINI); <END> }</code><technical_language>I guess depends image. If center crop, yes. If center inside, no</technical_language>

Target:
@Test public void getPicassoKindMini() throws Exception { assertThat(getPicassoKind(512, 384)).isEqualTo(MINI); assertThat(getPicassoKind(100, 100)).isEqualTo(MINI); }
Source:
<code>public static long parseBytes(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String unitString = getUnits(s); String numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length() - unitString.length())); if (numberString.length() == 0) throw new ConfigException.BadValue(originForException, pathForException, "No number in size-in-bytes value '" + input + "'"); MemoryUnit units = MemoryUnit.parseUnit(unitString); if (units == null) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes unit '" + unitString + "' (try k, K, kB, KiB, kilobytes, kibibytes)"); } try { BigInteger result; if (numberString.matches("[0-9]+")) { Long v = Long.parseLong(numberString); <START> result = units.bytes.multiply(BigInteger.valueOf(v)); <END> } else { Double v = Double.parseDouble(numberString); BigDecimal resultDecimal = (new BigDecimal(units.bytes)).multiply(BigDecimal.valueOf(v)); result = resultDecimal.toBigInteger(); } if (isValidLong(result)) return result.longValue(); else throw new ConfigException.BadValue(originForException, pathForException, "size-in-bytes value is out of range for a 64-bit long: '" + input + "'"); } catch (NumberFormatException e) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes number '" + numberString + "'"); } }</code><technical_language>result = units.bytes.multiply(new BigInteger(numberString)) Or</technical_language>

Target:
public static long parseBytes(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String unitString = getUnits(s); String numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length() - unitString.length())); if (numberString.length() == 0) throw new ConfigException.BadValue(originForException, pathForException, "No number in size-in-bytes value '" + input + "'"); MemoryUnit units = MemoryUnit.parseUnit(unitString); if (units == null) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes unit '" + unitString + "' (try k, K, kB, KiB, kilobytes, kibibytes)"); } try { BigInteger result; if (numberString.matches("[0-9]+")) { result = units.bytes.multiply(new BigInteger(numberString)); } else { BigDecimal resultDecimal = (new BigDecimal(units.bytes)).multiply(new BigDecimal(numberString)); result = resultDecimal.toBigInteger(); } if (result.bitLength() < 64) return result.longValue(); else throw new ConfigException.BadValue(originForException, pathForException, "size-in-bytes value is out of range for a 64-bit long: '" + input + "'"); } catch (NumberFormatException e) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes number '" + numberString + "'"); } }
Source:
<code>public String getContent() { String value = super.getContent(); if (value != null) { return value; } else if(this.groupId.getContent() != null && this.artifactId.getContent() != null) { return this.groupId.getContent() .concat(".") .concat(this.artifactId.getContent()) <START> .replaceAll("-", ""); <END> } return null; }</code><technical_language>groupId rule replace - .. This change a new rule replaces dashes empty space. breaking do for groupId</technical_language>

Target:
public String getContent() { String value = super.getContent(); if (value != null) { return value; } else if(this.groupId.getContent() != null && this.artifactId.getContent() != null) { return this.groupId.getContent() .concat(".") .concat(this.artifactId.getContent()) .replaceAll("-", "") .replaceAll("\\.[0-9]+", "."); } return null; }
Source:
<code>public UserRequest(final Activity activity, User user, HashMap<String, JSONObject> params, final Response.Listener<User> listener) { <START> super(Request.Method.GET, makeURL("users"), new JSONObject(params), <END> new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { String userJson = jsonObject.get("user").toString(); ObjectMapper mapper = getNetworkManager(activity.getApplicationContext()).getObjectMapper(); User user = mapper.readValue(userJson, new TypeReference<User>() { }); listener.onResponse(user); } catch (Exception e) { Log.e("Json exception", e.toString()); } } }, activity); }</code><technical_language>Assuming create a temp user object id, able makeURLWithObject pass in user object</technical_language>

Target:
public UserRequest(final Activity activity, User user, HashMap<String, JSONObject> params, final Response.Listener<User> listener) { super(Request.Method.GET, makeObjectURL("users", user), new JSONObject(params), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { String userJson = jsonObject.get("user").toString(); ObjectMapper mapper = getNetworkManager(activity.getApplicationContext()).getObjectMapper(); User user = mapper.readValue(userJson, new TypeReference<User>() { }); listener.onResponse(user); } catch (Exception e) { Log.e("Json exception", e.toString()); } } }, activity); }
Source:
<code>public void of(RecordCursor base, SqlExecutionContext executionContext) { try { this.chainCursor = chain.getCursor(base); final Record record = base.getRecord(); chain.clear(); while (base.hasNext()) { <START> executionContext.getSqlExecutionInterruptor().checkInterrupted(); <END> chain.put(record); } chainCursor.toTop(); } catch (CairoException ex) { base.close(); throw ex; } }</code><technical_language>same, double de-ref</technical_language>

Target:
public void of(RecordCursor base, SqlExecutionContext executionContext) { try { this.chainCursor = chain.getCursor(base); final Record record = base.getRecord(); SqlExecutionInterruptor interruptor = executionContext.getSqlExecutionInterruptor(); chain.clear(); while (base.hasNext()) { interruptor.checkInterrupted(); chain.put(record); } chainCursor.toTop(); } catch (CairoException ex) { base.close(); throw ex; } }
Source:
<code>public void testUpdateCommentEmail() throws Exception { CommentAttributes existingComment1 = dataBundle.comments.get("comment1FromI1C1toS1C1"); ______TS("typical success case: email changed"); String courseId = existingComment1.courseId; String oldInstrEmail = existingComment1.lastEditorEmail; String updatedInstrEmail = "otheremail@gmail.tmt"; commentsLogic.updateInstructorEmail(courseId, oldInstrEmail, updatedInstrEmail); List<CommentAttributes> updatedComments = commentsLogic.getCommentsForGiver(courseId, updatedInstrEmail); for (CommentAttributes updatedComment : updatedComments) { assertEquals(updatedInstrEmail, updatedComment.giverEmail); if (updatedComment.lastEditorEmail != null) { assertEquals(updatedInstrEmail, updatedComment.lastEditorEmail); } } <START> commentsLogic.updateInstructorEmail(courseId, updatedInstrEmail, oldInstrEmail); <END> }</code><technical_language>Do need this</technical_language>

Target:
public void testUpdateCommentEmail() throws Exception { CommentAttributes existingComment1 = dataBundle.comments.get("comment1FromI1C1toS1C1"); ______TS("typical success case: email changed"); String courseId = existingComment1.courseId; String oldInstrEmail = existingComment1.lastEditorEmail; String updatedInstrEmail = "otheremail@gmail.tmt"; commentsLogic.updateInstructorEmail(courseId, oldInstrEmail, updatedInstrEmail); List<CommentAttributes> updatedComments = commentsLogic.getCommentsForGiver(courseId, updatedInstrEmail); for (CommentAttributes updatedComment : updatedComments) { assertEquals(updatedInstrEmail, updatedComment.giverEmail); if (updatedComment.lastEditorEmail != null) { assertEquals(updatedInstrEmail, updatedComment.lastEditorEmail); } } }
Source:
<code>public List<ProcessDTO> getProcesses() { try { if (ServiceManager.getSecurityAccessService().hasAuthorityToViewProcessList() && processList.isEmpty()) { processList = ServiceManager.getProcessService().loadData(0, 10, SORT_ID, SortOrder.DESCENDING, null); <START> Collections.sort(processList, (one, other) -> other.getId() - one.getId()); <END> } } catch (DataException | JsonException e) { Helper.setErrorMessage(ERROR_LOADING_MANY, new Object[] {ObjectType.PROCESS.getTranslationPlural() }, logger, e); } return processList; }</code><technical_language>is this neccessary? processes returned in a sorted list, SORT_ID constant passed parameter loadData in previous line, they? If want reverse order start lowest ID, SortOrder.ASCENDING instead of DESCENDING, I guess</technical_language>

Target:
public List<ProcessDTO> getProcesses() { try { if (ServiceManager.getSecurityAccessService().hasAuthorityToViewProcessList() && processList.isEmpty()) { processList = ServiceManager.getProcessService().loadData(0, 10, SORT_ID, SortOrder.DESCENDING, null); } } catch (DataException | JsonException e) { Helper.setErrorMessage(ERROR_LOADING_MANY, new Object[] {ObjectType.PROCESS.getTranslationPlural() }, logger, e); } return processList; }
Source:
<code>public synchronized long registerOperationWithHeapSize(long heapSize){ long operationId = ++operationSequenceGenerator; while (currentWriteBufferSize >= maxHeapSize || pendingOperationsWithSize.size() >= maxInFlightRpcs) { try { wait(WAIT_MILLIS); <START> } catch (InterruptedException e) { <END> LOG.error("Failed waiting for async operation", e); } } pendingOperationsWithSize.put(operationId, heapSize); currentWriteBufferSize += heapSize; return operationId; }</code><technical_language>thread interrupted, I continuing happened</technical_language>

Target:
public synchronized long registerOperationWithHeapSize(long heapSize) throws InterruptedException { long operationId = ++operationSequenceGenerator; while (currentWriteBufferSize >= maxHeapSize || pendingOperationsWithSize.size() >= maxInFlightRpcs) { wait(WAIT_MILLIS); } lastOperationChange = System.currentTimeMillis(); pendingOperationsWithSize.put(operationId, heapSize); currentWriteBufferSize += heapSize; return operationId; }
Source:
<code>public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { final Object[] <START> list = <END> getListeners(); if (list.length == 0) { return; } final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); for (Object element : list) { final IPropertyChangeListener listener = (IPropertyChangeListener) element; SafeRunner.run(new SafeRunnable(JFaceResources .getString("PreferenceStore.changeError")) { @Override public void run() { listener.propertyChange(event); } }); } }</code><technical_language>rename 'listeners'</technical_language>

Target:
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { final Object[] listeners = getListeners(); if (listeners.length == 0) { return; } final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); for (Object listener : listeners) { final IPropertyChangeListener propertyChangeListener = (IPropertyChangeListener) listener; SafeRunner.run(new SafeRunnable(JFaceResources .getString("PreferenceStore.changeError")) { @Override public void run() { propertyChangeListener.propertyChange(event); } }); } }
Source:
<code>public ChatComponent setUnderlined(boolean underlined) { <START> $lock.writeLock().lock(); <END> if (this.underlined == null) this.underlined = new AtomicBoolean(underlined); else this.underlined.set(underlined); $lock.writeLock().unlock(); return this; }</code><technical_language>THREAD-SAFETY This is a poor construct for a thread-safe class. save (that much) memory, solved a volatile boolean set false a default instead</technical_language>

Target:
public ChatComponent setUnderlined(boolean underlined) { if (this.underlined == null) this.underlined = new AtomicBoolean(underlined); else this.underlined.set(underlined); return this; }
Source:
<code>public void testGetStudyDetailsForGeolocationWithPI_ID() { final DmsProject environmentDataset = this.testDataInitializer .createDmsProject("Summary Dataset", "Summary Dataset-Description", study, study, DatasetTypeEnum.SUMMARY_DATA); final int locationId = 101; final Geolocation geolocation = this.testDataInitializer.createTestGeolocation("1", locationId); this.testDataInitializer .createTestExperiment(environmentDataset, geolocation, TermId.TRIAL_ENVIRONMENT_EXPERIMENT.getId(), "0", null); this.testDataInitializer.addProjectProp(study, TermId.PI_ID.getId(), "", VariableType.STUDY_DETAIL, "1", 6); final StudyDetailsDto studyDetailsDto = this.studyService.getStudyDetailsForGeolocation(geolocation.getLocationId()); <START> Assert.assertFalse(CollectionUtils.isEmpty(studyDetailsDto.getContacts())); <END> Assert.assertEquals(locationId, studyDetailsDto.getMetadata().getLocationId().intValue()); Assert.assertEquals(geolocation.getLocationId(), studyDetailsDto.getMetadata().getStudyDbId()); Assert.assertEquals(this.study.getProjectId(), studyDetailsDto.getMetadata().getTrialDbId()); Assert.assertEquals(this.study.getName() + " Environment Number 1", studyDetailsDto.getMetadata().getStudyName()); }</code><technical_language>stronger add assertion comparison of studyDetails.getContacts().get(0) user details retrieved workbench users table</technical_language>

Target:
public void testGetStudyDetailsForGeolocationWithPI_ID() { final DmsProject environmentDataset = this.testDataInitializer .createDmsProject("Summary Dataset", "Summary Dataset-Description", this.study, this.study, DatasetTypeEnum.SUMMARY_DATA); final WorkbenchUser user = this.testDataInitializer.createUserForTesting(); final int locationId = 101; final Geolocation geolocation = this.testDataInitializer.createTestGeolocation("1", locationId); this.testDataInitializer .createTestExperiment(environmentDataset, geolocation, TermId.TRIAL_ENVIRONMENT_EXPERIMENT.getId(), "0", null); this.testDataInitializer.addProjectProp(this.study, TermId.PI_ID.getId(), "", VariableType.STUDY_DETAIL, user.getUserid().toString(), 6); final StudyDetailsDto studyDetailsDto = this.studyService.getStudyDetailsForGeolocation(geolocation.getLocationId()); Assert.assertFalse(CollectionUtils.isEmpty(studyDetailsDto.getContacts())); Assert.assertEquals(user.getUserid(), studyDetailsDto.getContacts().get(0).getUserId()); Assert.assertEquals(locationId, studyDetailsDto.getMetadata().getLocationId().intValue()); Assert.assertEquals(geolocation.getLocationId(), studyDetailsDto.getMetadata().getStudyDbId()); Assert.assertEquals(this.study.getProjectId(), studyDetailsDto.getMetadata().getTrialDbId()); Assert.assertEquals(this.study.getName() + " Environment Number 1", studyDetailsDto.getMetadata().getStudyName()); }
Source:
<code>public int hashCode() { <START> return name.hashCode(); <END> }</code><technical_language>This include fields. parent class's hashCode a basis incorporate this class's fields mix</technical_language>

Target:
public int hashCode() { return Objects.hash(volumeSize, super.hashCode()); }
Source:
<code>public static int getBestMipMapLevel( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint ) { final int[] targetLevels = new int[] { -1, -1, -1 }; final int numLevels = source.getNumMipmapLevels(); for ( int level = numLevels - 1; level >= 0; --level ) { final double[] voxelScreenSize = getVoxelScreenSize( screenTransform, source, timepoint, level ); for ( int d = 0; d < 3; ++d ) { if ( voxelScreenSize[ d ] < 0.99 && targetLevels[ d ] == -1 ) { targetLevels[ d ] = Math.min( level + 1, numLevels - 1 ); } } } int targetLevel = Math.max( Arrays.stream( targetLevels ).max().getAsInt(), 0 ); if ( targetLevel > 0 ) { final double[] size1 = getVoxelScreenSize( screenTransform, source, timepoint, targetLevel ); final double[] size0 = getVoxelScreenSize( screenTransform, source, timepoint, targetLevel - 1 ); <START> if ( Math.abs( Arrays.stream( size1 ).max().getAsDouble() - 1.0 ) / 2 > Math.abs( Arrays.stream( size0 ).max().getAsDouble() - 1.0 ) ) <END> targetLevel--; } return targetLevel; }</code><technical_language>..and (old signature) getVoxelScreenSize avoid Arrays.stream(...).max().getAsDouble()</technical_language>

Target:
public static int getBestMipMapLevel( final AffineTransform3D screenTransform, final Source< ? > source, final int timepoint ) { final int numLevels = source.getNumMipmapLevels(); final double[] bestPixelSourceSize = new double[] { 1, 1 }; int targetLevel = numLevels; double minDist = Double.POSITIVE_INFINITY; for ( int level = 0; level < numLevels; ++level ) { final double[] pixelSourceSize = getPixelSourceSize( screenTransform, source, timepoint, level ); final double dist = LinAlgHelpers.squareDistance( pixelSourceSize, bestPixelSourceSize ); if ( minDist > dist ) { minDist = dist; targetLevel = level; } } return targetLevel; }
Source:
<code>public PooledConnection borrowConnection(ServerLocation server, long acquireTimeout, boolean onlyUseExistingCnx) <START> throws AllConnectionsInUseException, NoAvailableServersException, ServerOperationException { <END> PooledConnection connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (!onlyUseExistingCnx) { connection = forceCreateConnection(server); if (null != connection) { return connection; } throw new ServerConnectivityException(BORROW_CONN_ERROR_MSG + server); } long waitStart = NOT_WAITING; try { long timeout = System.nanoTime() + MILLISECONDS.toNanos(acquireTimeout); while (true) { connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (checkShutdownInterruptedOrTimeout(timeout)) { break; } waitStart = beginConnectionWaitStatIfNotStarted(waitStart); Thread.yield(); } } finally { endConnectionWaitStatIfStarted(waitStart); } cancelCriterion.checkCancelInProgress(null); throw new AllConnectionsInUseException(); }</code><technical_language>I this is throwing ServerOperationException. throws superclass, ServerConnectivityException</technical_language>

Target:
public PooledConnection borrowConnection(ServerLocation server, long acquireTimeout, boolean onlyUseExistingCnx) throws AllConnectionsInUseException, NoAvailableServersException, ServerConnectivityException { PooledConnection connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (!onlyUseExistingCnx) { connection = forceCreateConnection(server); if (null != connection) { return connection; } throw new ServerConnectivityException(BORROW_CONN_ERROR_MSG + server); } long waitStart = NOT_WAITING; try { long timeout = System.nanoTime() + MILLISECONDS.toNanos(acquireTimeout); while (true) { connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (checkShutdownInterruptedOrTimeout(timeout)) { break; } waitStart = beginConnectionWaitStatIfNotStarted(waitStart); Thread.yield(); } } finally { endConnectionWaitStatIfStarted(waitStart); } cancelCriterion.checkCancelInProgress(null); throw new AllConnectionsInUseException(); }
Source:
<code>private String waitAndRetrieveContainerID(String deploymentName) throws IOException { for (int i = 0; i < OPENSHIFT_WAIT_POD_TIMEOUT; i++) { try { Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } List<Pod> pods = openShiftClient.pods() .inNamespace(this.openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() .getItems(); if (pods.size() < 1) { <START> throw new DockerException(String.format("Pod with deployment name %s not found", <END> deploymentName), 1); } else if (pods.size() > 1) { throw new DockerException(String.format("Multiple pods with deployment name %s found", deploymentName), 1); } Pod pod = pods.get(0); String status = pod.getStatus().getPhase(); if (OPENSHIFT_POD_STATUS_RUNNING.equals(status)) { String containerID = pod.getStatus().getContainerStatuses().get(0).getContainerID(); String normalizedID = KubernetesStringUtils.normalizeContainerID(containerID); openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withName(pod.getMetadata().getName()) .edit() .editMetadata() .addToLabels(CHE_CONTAINER_IDENTIFIER_LABEL_KEY, KubernetesStringUtils.getLabelFromContainerID(normalizedID)) .endMetadata() .done(); return normalizedID; } } return null; }</code><technical_language>@amisevsk more relevant throw OpenShiftException</technical_language>

Target:
private String waitAndRetrieveContainerID(String deploymentName) throws IOException { for (int i = 0; i < OPENSHIFT_WAIT_POD_TIMEOUT; i++) { try { Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } List<Pod> pods = openShiftClient.pods() .inNamespace(this.openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() .getItems(); if (pods.size() < 1) { throw new OpenShiftException(String.format("Pod with deployment name %s not found", deploymentName)); } else if (pods.size() > 1) { throw new OpenShiftException(String.format("Multiple pods with deployment name %s found", deploymentName)); } Pod pod = pods.get(0); String status = pod.getStatus().getPhase(); if (OPENSHIFT_POD_STATUS_RUNNING.equals(status)) { String containerID = pod.getStatus().getContainerStatuses().get(0).getContainerID(); String normalizedID = KubernetesStringUtils.normalizeContainerID(containerID); openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withName(pod.getMetadata().getName()) .edit() .editMetadata() .addToLabels(CHE_CONTAINER_IDENTIFIER_LABEL_KEY, KubernetesStringUtils.getLabelFromContainerID(normalizedID)) .endMetadata() .done(); return normalizedID; } } return null; }
Source:
<code>public static Pair<String, Long> getPrimaryStoragePathAndSize() { return Pair.create(null, <START> FileUtils.roundStorageSize(Environment.getDataDirectory().getTotalSpace())); <END> }</code><technical_language>want replace this a call getPrimaryStorageSize() ensure updated logic is applied in places</technical_language>

Target:
public static Pair<String, Long> getPrimaryStoragePathAndSize() { return Pair.create(null, FileUtils.roundStorageSize(Environment.getDataDirectory().getTotalSpace() + Environment.getRootDirectory().getTotalSpace())); }
Source:
<code>private void write(SelectionKey key, Transmissions transmissions) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { SocketChannel socketChannel = channel(key); NetworkSend networkSend = transmissions.send; Send send = networkSend.getPayload(); if (send == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } send.writeTo(socketChannel); if (logger.isTraceEnabled()) { logger.trace("Bytes written to using key ", socketChannel.socket().getRemoteSocketAddress(), key); } if (send.isSendComplete()) { if (logger.isTraceEnabled()) { logger.trace("Finished writing, registering for read on connection {}", socketChannel.socket().getRemoteSocketAddress()); } <START> this.completedSends.add(transmissions.send); <END> transmissions.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { if (logger.isTraceEnabled()) { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmissions.connectionId, writeTime); } } }</code><technical_language>forgot update metrics. metrics.updateNodeResponseMetric.....</technical_language>

Target:
private void write(SelectionKey key, Transmissions transmissions) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { SocketChannel socketChannel = channel(key); NetworkSend networkSend = transmissions.send; Send send = networkSend.getPayload(); if (send == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } send.writeTo(socketChannel); logger.trace("Bytes written to using key {}", socketChannel.socket().getRemoteSocketAddress(), transmissions.connectionId); if (send.isSendComplete()) { logger.trace("Finished writing, registering for read on connection {}", socketChannel.socket().getRemoteSocketAddress()); networkSend.onSendComplete(); this.completedSends.add(networkSend); metrics.sendInFlight.dec(); metrics.updateNodeSendMetric(transmissions.remoteHostName, transmissions.remotePort, send.sizeInBytes(), time.milliseconds() - networkSend.getSendStartTimeInMs()); transmissions.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmissions.connectionId, writeTime); } }
Source:
<code>@Nullable public String getScope() { for (FormGroup formGroup : form) { <START> for (FormField formField : formGroup.getFields()) { <END> if (formField.getId().equals("scope")) { return formField.getValue().toString(); } } } return null; }</code><technical_language>careful of nullable fields</technical_language>

Target:
@Nullable public String getScope() { for (FormGroup formGroup : form) { for (FormField formField : formGroup.getFields()) { if (formField.getId() != null && formField.getValue() != null && formField.getId().equals(FormField.SCOPE)) { return formField.getValue().toString(); } } } return null; }
Source:
<code>protected void cleanUp(UserAccount userAccount) { SalesforceAnalyticsManager.reset(userAccount); RestClient.clearCaches(userAccount); <START> UserAccountManager.getInstance().clearCachedCurrentUser(userAccount); <END> }</code><technical_language>need clear cache user switching occurs</technical_language>

Target:
protected void cleanUp(UserAccount userAccount) { SalesforceAnalyticsManager.reset(userAccount); RestClient.clearCaches(userAccount); UserAccountManager.getInstance().clearCachedCurrentUser(); }
Source:
<code>public boolean isUseBase() { <START> if (useBase == null){ <END> return getDefault().useBase; } return useBase; }</code><technical_language>I do this defaulting logic. sense if this is a LSH parsed LS backend query hints provided engine. sense if this LSH is a builder end user wanting customize hints of a query. if a specific hint is set in customization, engine static default, overridden engine-specific options query specification. I suggest removing defaulting logic getters. defaulting logic in backend achieved extracting some of logic of ViatraQueryEngineImpl.overrideKnownHints() a public static method, LS backend combine parsed LSH LSH.getDefault()</technical_language>

Target:
public boolean isUseBase() { return useBase; }
Source:
<code><START> public JSONArray(Iterable<?> iter) { <END> this(); if (iter == null) { return; } this.addAll(iter); }</code><technical_language>I is a case for this, if disagree</technical_language>

Target:
public JSONArray(Iterable<?> iter) { this(); if (iter == null) { return; } this.addAll(iter, true); }
Source:
<code>public void setScrollTargetCallback(ScrollTargetCallback scrollTargetCallback) { mScrollTargetCallback = scrollTargetCallback; <START> setBehaviorScrollTargetCallback(); <END> }</code><technical_language>I keeping this method is a right design setScrollTargetCallback is preferred call in onCreate change in other states of Activity / Fragment lifecycle calling this method is redundant. update yesterday, mScrollTargetCallback is set, prioritize result this method first. that, more flexible now. return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : getSupportedScrollTarget(target); I prefer setBehaviorScrollTargetCallback method rollback some changes in Behavior class. rest good merge</technical_language>

Target:
public void setScrollTargetCallback(ScrollTargetCallback scrollTargetCallback) { mScrollTargetCallback = scrollTargetCallback; }
Source:
<code>private void onStart() { if (!mIsRunning) { return; } mAnimatedDrawableDiagnostics.onStartMethodBegin(); try { mStartTimeMs = mMonotonicClock.now(); mStartTimeMs -= resumable ? mAnimatedDrawableBackend.getTimestampMsForFrame(mPauseFrameNumber) : 0; mScheduledFrameNumber = resumable ? mPauseFrameNumber : 0; <START> mScheduledFrameMonotonicNumber = resumable ? mPauseFrameNumber : 0; <END> long nextFrameMs = mStartTimeMs + mAnimatedDrawableBackend.getDurationMsForFrame(0); scheduleSelf(mNextFrameTask, nextFrameMs); mNextFrameTaskMs = nextFrameMs; doInvalidateSelf(); } finally { mAnimatedDrawableDiagnostics.onStartMethodEnd(); } }</code><technical_language>if/else block this readable</technical_language>

Target:
private void onStart() { if (!mIsRunning) { return; } mAnimatedDrawableDiagnostics.onStartMethodBegin(); try { mStartTimeMs = mMonotonicClock.now(); if (mIsPaused) { mStartTimeMs -= mAnimatedDrawableBackend.getTimestampMsForFrame(mScheduledFrameNumber); } else { mScheduledFrameNumber = 0; mScheduledFrameMonotonicNumber = 0; } long nextFrameMs = mStartTimeMs + mAnimatedDrawableBackend.getDurationMsForFrame(0); scheduleSelf(mNextFrameTask, nextFrameMs); mNextFrameTaskMs = nextFrameMs; doInvalidateSelf(); } finally { mAnimatedDrawableDiagnostics.onStartMethodEnd(); } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RequestParam that = (RequestParam) o; return name.equals(that.name); <START> } <END></code><technical_language>this confusing people. params name considered "equal"? value? if some part of code wants treat Params "equal" long equal names, is this comparison logic close area, a local Comparator class something, data object itself. this allow reusability for this class in future</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RequestParam that = (RequestParam) o; return name.equals(that.name) && value.equals(that.value); }
Source:
<code><START> public PreviewEditModePageObject previewArticle() { <END> preview(); return new PreviewEditModePageObject(driver); }</code><technical_language>change method name clickPreview</technical_language>

Target:
public PreviewEditModePageObject previewArticle() { driver.switchTo().defaultContent(); previewButton.click(); PageObjectLogging.log("preview", "Page preview displayed", true); return new PreviewEditModePageObject(driver); }
Source:
<code>public static void _doScript(StaplerRequest req, StaplerResponse rsp, RequestDispatcher view, VirtualChannel channel, ACL acl) throws IOException, ServletException { acl.checkPermission(ADMINISTER); String text = req.getParameter("script"); if (text != null) { if (!"POST".equals(req.getMethod())) { throw HttpResponses.error(HttpURLConnection.HTTP_BAD_METHOD, "requires POST"); } if (channel == null) { throw HttpResponses.error(HttpURLConnection.HTTP_NOT_FOUND, "Node is offline"); } try { <START> LOGGER.log(Level.INFO, req.getRemoteAddr() + "|" + Jenkins.getAuthentication().getName() + "|ScriptConsole|" + Base64.getEncoder().encodeToString(text.getBytes())); <END> req.setAttribute("output", RemotingDiagnostics.executeGroovy(text, channel)); } catch (InterruptedException e) { throw new ServletException(e); } } view.forward(req, rsp); }</code><technical_language>log channel information well</technical_language>

Target:
public static void _doScript(StaplerRequest req, StaplerResponse rsp, RequestDispatcher view, VirtualChannel channel, ACL acl) throws IOException, ServletException { acl.checkPermission(ADMINISTER); String text = req.getParameter("script"); if (text != null) { if (!"POST".equals(req.getMethod())) { throw HttpResponses.error(HttpURLConnection.HTTP_BAD_METHOD, "requires POST"); } if (channel == null) { throw HttpResponses.error(HttpURLConnection.HTTP_NOT_FOUND, "Node is offline"); } try { LOGGER.log(Level.INFO, "Administrative Groovy script by " + Jenkins.getAuthentication().getName() + " from " + req.getRemoteAddr() + ": (base64) " + Base64.getEncoder().encodeToString(text.getBytes())); req.setAttribute("output", RemotingDiagnostics.executeGroovy(text, channel)); } catch (InterruptedException e) { throw new ServletException(e); } } view.forward(req, rsp); }
Source:
<code>private void persist(List<EntityType> copiedEntityTypes, CopyState state) { entityTypeDependencyResolver .resolve(copiedEntityTypes) .stream() .map(copy -> cutDefaultValues(copy, state)) .map(this::persistEntityType) <START> .collect(toList()) <END> .stream() .map(copy -> copyEntities(copy, state)) .map(copy -> pasteDefaultValues(copy, state)) .forEach(e -> state.progress().increment(1)); }</code><technical_language>is purpose of collecting a list while streaming? If this is required please add a note source code</technical_language>

Target:
private void persist(List<EntityType> copiedEntityTypes, CopyState state) { List<EntityType> persistedEntityTypes = entityTypeDependencyResolver .resolve(copiedEntityTypes) .stream() .map(copy -> cutDefaultValues(copy, state)) .map(this::persistEntityType) .collect(toList()); persistedEntityTypes .stream() .map(copy -> copyEntities(copy, state)) .map(copy -> pasteDefaultValues(copy, state)) .forEach(e -> state.progress().increment(1)); }
Source:
<code>public boolean isValidTokenLocalUser(int token, String username) throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if ("Base64".equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { log.error("Error when reading the tenant encoding method"); } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); try { int tenantId = IdentityUtil.getTenantIdOFUser(username); UserRealm userRealm = TOTPManagerComponent.getRealmService().getTenantUserRealm(tenantId); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); String secretkey = userStoreManager.getUserClaimValue(MultitenantUtils.getTenantAwareUsername (username), Constants.SECRET_KEY, null); return googleAuthenticator.authorize(secretkey, token); } else { throw new TOTPException("Cannot find the user realm for the given tenant domain : " + CarbonContext .getThreadLocalCarbonContext().getTenantDomain()); } } catch (IdentityException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to get the tenant ID of the user : " + username, e); } catch (UserStoreException e) { <START> log.error("TOTPTokenVerifier failed while trying to access userRealm", e); <END> throw new TOTPException("TOTPTokenVerifier failed while trying to access userRealm of the user : " + username, e); } }</code><technical_language>Exception logged twice</technical_language>

Target:
public boolean isValidTokenLocalUser(int token, String username) throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if ("Base64".equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { log.error("Error when reading the tenant encoding method"); } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); try { int tenantId = IdentityUtil.getTenantIdOFUser(username); UserRealm userRealm = TOTPManagerComponent.getRealmService().getTenantUserRealm(tenantId); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); String secretkey = userStoreManager.getUserClaimValue(MultitenantUtils.getTenantAwareUsername (username), Constants.SECRET_KEY, null); return googleAuthenticator.authorize(secretkey, token); } else { throw new TOTPException("Cannot find the user realm for the given tenant domain : " + CarbonContext .getThreadLocalCarbonContext().getTenantDomain()); } } catch (IdentityException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to get the tenant ID of the user : " + username, e); } catch (UserStoreException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to access userRealm of the user : " + username, e); } }
Source:
<code><START> private boolean hasSpaceForSnapthosts(VM vm) { <END> for (Disk disk : getPluggedDisks(vm)) { if (disk.isAllowSnapshot()) { for (storage_domains domain : getStorageDomainDAO().getAllStorageDomainsByImageId(((DiskImage) disk).getImageId())) { if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, Config.<Integer> GetValue(ConfigValues.InitStorageSparseSizeInGB))) { log.errorFormat("not enough space to create snapshot for disk {0} on domain {1}", disk.getId(), domain.getId()); return false; } } } } return true; }</code><technical_language>this method need sum disks domain, otherwise, if i 1 domain 5 disks, space for 1 snapshot, check pass</technical_language>

Target:
public boolean hasSpaceForSnapthosts(VM vm) { Map<storage_domains, Integer> map = mapStorageDomainsToNumOfDisks(vm); Integer minSnapshotSize = Config.<Integer> GetValue(ConfigValues.InitStorageSparseSizeInGB); for (storage_domains domain : map.keySet()) { if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, minSnapshotSize * map.get(domain))) { log.error("not enough space to create snapshot on domain {0}" + domain.getId()); return false; } } return true; }
Source:
<code>public void onActivityResult(final int requestCode, final int resultCode, @NonNull final Intent data) { assureCorrectAppLanguage(getContext()); super.onActivityResult(requestCode, resultCode, data); if (DEBUG) { Log.d(TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], " + "resultCode = [" + resultCode + "], " + "data = [" + data + "]"); } if ((requestCode == REQUEST_IMPORT_PATH || requestCode == REQUEST_EXPORT_PATH) && resultCode == Activity.RESULT_OK && data.getData() != null) { try { Uri uri = data.getData(); if (FilePickerActivityHelper.isOwnFileUri(getContext(), uri)) { uri = Uri.fromFile(Utils.getFileForUri(uri)); } if (requestCode == REQUEST_EXPORT_PATH) { <START> final StoredDirectoryHelper directory = new StoredDirectoryHelper(getContext(), uri, null); final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); exportDatabase(directory.createFile("NewPipeData-" <END> + sdf.format(new Date()) + ".zip", "application/zip")); } else { final StoredFileHelper file = new StoredFileHelper(getContext(), uri, StoredFileHelper.DEFAULT_MIME); final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.override_current_data) .setPositiveButton(getString(R.string.finish), (DialogInterface d, int id) -> importDatabase(file)) .setNegativeButton(android.R.string.cancel, (DialogInterface d, int id) -> d.cancel()); builder.create().show(); } } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>A dir picker good</technical_language>

Target:
public void onActivityResult(final int requestCode, final int resultCode, @NonNull final Intent data) { assureCorrectAppLanguage(getContext()); super.onActivityResult(requestCode, resultCode, data); if (DEBUG) { Log.d(TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], " + "resultCode = [" + resultCode + "], " + "data = [" + data + "]"); } if ((requestCode == REQUEST_IMPORT_PATH || requestCode == REQUEST_EXPORT_PATH) && resultCode == Activity.RESULT_OK && data.getData() != null) { final StoredFileHelper file = new StoredFileHelper(getContext(), data.getData(), "application/zip"); if (requestCode == REQUEST_EXPORT_PATH) { exportDatabase(file); } else { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.override_current_data) .setPositiveButton(R.string.finish, (DialogInterface d, int id) -> importDatabase(file)) .setNegativeButton(R.string.cancel, (DialogInterface d, int id) -> d.cancel()); builder.create().show(); } } }
Source:
<code>public ViewerCell<E> getCell(int column) { if (column >= 0) <START> return new ViewerCell<E>((ViewerRow<E>) clone(), column, getElement()); <END> return null; }</code><technical_language>I get a warning this cast Object</technical_language>

Target:
public ViewerCell<E> getCell(int column) { if (column >= 0){ @SuppressWarnings("unchecked") ViewerRow<E> viewerRow = (ViewerRow<E>) clone(); return new ViewerCell<E>(viewerRow, column, getElement()); } return null; }
Source:
<code>private static DetailAST adjustParens(DetailAST node, UnaryOperator<DetailAST> step) { DetailAST result = node; <START> int acc = 0; <END> while (true) { if (result.getType() == TokenTypes.LPAREN) { acc--; } else if (result.getType() == TokenTypes.RPAREN) { acc++; } if (acc == 0) { break; } result = step.apply(result); } return result; }</code><technical_language>is acc ? please full name</technical_language>

Target:
private static DetailAST adjustParens(DetailAST node, UnaryOperator<DetailAST> step) { DetailAST result = node; int accumulator = 0; while (true) { if (result.getType() == TokenTypes.LPAREN) { accumulator--; } else if (result.getType() == TokenTypes.RPAREN) { accumulator++; } if (accumulator == 0) { break; } result = step.apply(result); } return result; }
Source:
<code>public boolean StorageDomainRemoved(storage_domain_static storageDomain) { final List<storage_server_connections> list = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForVolumeGroup(storageDomain.getstorage()); final List<LUNs> lunsList = DbFacade.getInstance().getLunDao().getAllForVolumeGroup(storageDomain.getstorage()); int numOfRemovedLuns = 0; for (LUNs lun : lunsList) { if (DbFacade.getInstance().getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) == null) { DbFacade.getInstance().getLunDao().remove(lun.getLUN_id()); numOfRemovedLuns++; } else { <START> DbFacade.getInstance().getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), ""); <END> } } if (numOfRemovedLuns > 0) { for (storage_server_connections connection : FilterConnectionsUsedByOthers(list, storageDomain.getstorage())) { DbFacade.getInstance().getStorageServerConnectionDao().remove(connection.getid()); } } return true; }</code><technical_language>getLunDao() instead of DbFacade.getInstance().getLunDao(). Also, empty string null</technical_language>

Target:
public boolean StorageDomainRemoved(storage_domain_static storageDomain) { int numOfRemovedLuns = removeLunsOfLunStorageDomain(storageDomain); if (numOfRemovedLuns > 0) { List<storage_server_connections> list = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForVolumeGroup(storageDomain.getstorage()); for (storage_server_connections connection : FilterConnectionsUsedByOthers(list, storageDomain.getstorage())) { DbFacade.getInstance().getStorageServerConnectionDao().remove(connection.getid()); } } return true; }
Source:
<code>public List<FormField> getOrderedFormFields() { if (this.formFields != null) { List<FormField> fieldList = new ArrayList<FormField>(); Set<FormField> fieldSet = new HashSet<FormField>(); fieldSet.addAll(this.formFields); int fieldSize = fieldSet.size(); for (int i = 0; i < fieldSize; i++) { int fieldNum = 0; FormField next = null; for (FormField ff : fieldSet) { <START> if (ff.getFieldNumber() != null) { <END> if (ff.getFieldNumber() < fieldNum || fieldNum == 0) { fieldNum = ff.getFieldNumber(); next = ff; } } else { if (fieldNum == 0) { next = ff; } } } fieldList.add(next); fieldSet.remove(next); } return fieldList; } else { return null; } }</code><technical_language>object comparison is primitive comparison</technical_language>

Target:
public List<FormField> getOrderedFormFields() { if (this.formFields != null) { List<FormField> fieldList = new ArrayList<>(); Set<FormField> fieldSet = new HashSet<>(this.formFields); int fieldSize = fieldSet.size(); for (int i = 0; i < fieldSize; i++) { int fieldNum = 0; FormField next = null; for (FormField ff : fieldSet) { if (ff.getFieldNumber() != null) { if (ff.getFieldNumber() < fieldNum || fieldNum == 0) { fieldNum = ff.getFieldNumber(); next = ff; } } else { if (fieldNum == 0) { next = ff; } } } fieldList.add(next); fieldSet.remove(next); } return fieldList; } else { return null; } }