auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void verifyTicketAuth(KerberosContainer kdc) throws IOException, InterruptedException { String tokenCache = kdc.getClientTokenCache(); FirefoxDriver negotiatingDriver = getNegotiatingFirefox(kdc, tokenCache); <START> Assert.assertThat(new Login(jenkins), loggedInAs("user")); <END> negotiatingDriver.get(jenkins.url.toExternalForm()); negotiatingDriver.get(jenkins.url("/whoAmI").toExternalForm()); String out = negotiatingDriver.getPageSource(); assertThat(out, containsString(AUTHORIZED)); assertUnauthenticatedRequestIsRejected(getBadassHttpClient()); }</code><technical_language>This line wrong confusing: - is asserting user is logged in in "default" browser - negotiating one. - Accessing login page triggers negotiation in "anonymous access" mode is testing here. fix, I understand it, is happening next line accessing dashboard (url special treatment plugin). I do need this line</technical_language>

Target:
private void verifyTicketAuth(KerberosContainer kdc) throws IOException, InterruptedException { String tokenCache = kdc.getClientTokenCache(); FirefoxDriver negotiatingDriver = getNegotiatingFirefox(kdc, tokenCache); negotiatingDriver.get(jenkins.url.toExternalForm()); negotiatingDriver.get(jenkins.url("/whoAmI").toExternalForm()); String out = negotiatingDriver.getPageSource(); assertThat(out, containsString(AUTHORIZED)); assertUnauthenticatedRequestIsRejected(getBadassHttpClient()); }
Source:
<code>public CommitCommand setCommitter(String name, String email) { <START> this.committer = new PersonIdent(name, email); <END> return this; }</code><technical_language>Style-nit: I I prefer this defined as: public CommitCommand setCommitter(String name, String email) { return setCommitter(new PersonIdent(name, email)); }</technical_language>

Target:
public CommitCommand setCommitter(String name, String email) { return setCommitter(new PersonIdent(name, email)); }
Source:
<code>public void fireFrameworkEvent(FrameworkEvent event) { log.debug("Firing FrameworkEvent on " + frameworkListeners.size() + " listeners"); Object[] listeners = frameworkListeners.getListeners(); for (Object listener : listeners) { log.debug("Start execution of " + listener.getClass() + " listener"); try { ((FrameworkListener) listener).frameworkEvent(event); log.debug("End execution of " + listener.getClass() + " listener"); } catch (RuntimeException e) { log.error("Error during Framework Listener execution : " + listener.getClass(), e); <START> <END> boolean strict = System.getProperty("nuxeo.start.strict") != null; if (strict) { throw e; } } } }</code><technical_language>Remove extra empty line</technical_language>

Target:
public void fireFrameworkEvent(FrameworkEvent event) { log.debug("Firing FrameworkEvent on " + frameworkListeners.size() + " listeners"); Object[] listeners = frameworkListeners.getListeners(); for (Object listener : listeners) { log.debug("Start execution of " + listener.getClass() + " listener"); try { ((FrameworkListener) listener).frameworkEvent(event); log.debug("End execution of " + listener.getClass() + " listener"); } catch (RuntimeException e) { log.error("Error during Framework Listener execution : " + listener.getClass(), e); if (Boolean.getBoolean("nuxeo.start.strict")) { throw e; } } } }
Source:
<code>private void tryWithLock(int alarmId, String reductionKey, BiConsumer<Integer, String> callback, String action) { try { if (getLock().tryLock(LOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { try { callback.accept(alarmId, reductionKey); } finally { getLock().unlock(); } } else { LOG.warn("Failed to acquire Drools session lock within {}ms. " + "{} for alarm with id={} and reduction-key={} will not be immediately reflected in the context.", LOCK_TIMEOUT_MS, action, alarmId, reductionKey); } <START> } catch (InterruptedException e) { <END> LOG.warn("Interrupted while waiting for Drools session lock. " + "{} for alarm with id={} and reduction-key={} will not be immediately reflected in the context.", action, alarmId, reductionKey); } }</code><technical_language>propagate interruption Thread.currentThread().interrupt();</technical_language>

Target:
private void tryWithLock(int alarmId, String reductionKey, BiConsumer<Integer, String> callback, String action) { try { if (getLock().tryLock(LOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { try { callback.accept(alarmId, reductionKey); } finally { getLock().unlock(); } } else { LOG.warn("Failed to acquire Drools session lock within {}ms. " + "{} for alarm with id={} and reduction-key={} will not be immediately reflected in the context.", LOCK_TIMEOUT_MS, action, alarmId, reductionKey); } } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for Drools session lock. " + "{} for alarm with id={} and reduction-key={} will not be immediately reflected in the context.", action, alarmId, reductionKey); Thread.currentThread().interrupt(); } }
Source:
<code><START> public synchronized boolean isCancelled() { <END> if (isCancelled) { sendCancelNotification(); } return isCancelled; }</code><technical_language>understanding is a 'synchronized' block slower, I in case of AHC</technical_language>

Target:
public boolean isCancelled() { boolean cancelled = isCancelled.get(); if (cancelled) { sendCancelNotification(); } return cancelled; }
Source:
<code>public void showPlayer(Player player) { Validate.notNull(player, "player cannot be null"); if (equals(player)) return; if (!player.isOnline() || !session.isActive()) return; <START> if (!hiddenEntities.contains(player.getUniqueId())) return; <END> hiddenEntities.remove(player.getUniqueId()); session.send(UserListItemMessage.addOne(((GlowPlayer) player).getProfile())); }</code><technical_language>turn a single if</technical_language>

Target:
public void showPlayer(Player player) { Validate.notNull(player, "player cannot be null"); if (equals(player) || !player.isOnline() || !session.isActive()) return; if (!hiddenEntities.contains(player.getUniqueId())) return; hiddenEntities.remove(player.getUniqueId()); session.send(new UserListItemMessage(UserListItemMessage.Action.ADD_PLAYER, ((GlowPlayer) player).getUserListEntry())); }
Source:
<code>public AbstractNetworkPopupView(EventBus eventBus) { super(eventBus); dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>()); externalProviderEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider>()); qosEditor = new ListModelListBoxEditor<>(new NameRenderer<HostNetworkQos>()); exportEditor = new EntityModelCheckBoxEditor(Align.RIGHT); exportEditor.asCheckBox().addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { refreshClustersTable(); } }); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); mtuEditor = new IntegerEntityModelTextBoxOnlyEditor(); mtuEditor.setUsePatternFly(true); createSubnetEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<>(SelectionMode.NONE, true); <START> this.shouldSetDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); <END> initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(); localize(); this.nameServerWidget.setUsePatternFly(true); }</code><technical_language>please remove 'this'</technical_language>

Target:
public AbstractNetworkPopupView(EventBus eventBus) { super(eventBus); dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>()); externalProviderEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider>()); qosEditor = new ListModelListBoxEditor<>(new NameRenderer<HostNetworkQos>()); exportEditor = new EntityModelCheckBoxEditor(Align.RIGHT); exportEditor.asCheckBox().addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { refreshClustersTable(); } }); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); mtuEditor = new IntegerEntityModelTextBoxOnlyEditor(); mtuEditor.setUsePatternFly(true); createSubnetEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<>(SelectionMode.NONE, true); shouldSetDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(); localize(); nameServersWidget.setUsePatternFly(true); }
Source:
<code>FirstGetChunk() { <START> super(-1, new CompositeBlobInfo.StoreKeyAndSizeAndOffset(blobId, 0L, -1L)); <END> }</code><technical_language>chunkSize is initialized -1L I populated removed codes setting chunkSize. Correct if I wrong</technical_language>

Target:
FirstGetChunk() { super(-1, new CompositeBlobInfo.ChunkMetadata(blobId, 0L, -1L)); }
Source:
<code>public void setPosition(Vector2i position) { <START> checkState(MapUtil.isInMapDecorationBounds(position.getX()), "x position out of bounds"); <END> checkState(MapUtil.isInMapDecorationBounds(position.getY()), "y position out of bounds"); this.x = (byte) position.getX(); this.y = (byte) position.getY(); }</code><technical_language>statically import please (I done elsewhere, shifting that)</technical_language>

Target:
public void setPosition(Vector2i position) { Preconditions.checkState(MapUtil.isInMapDecorationBounds(position.getX()), "x position out of bounds"); Preconditions.checkState(MapUtil.isInMapDecorationBounds(position.getY()), "y position out of bounds"); this.x = (byte) position.getX(); this.y = (byte) position.getY(); }
Source:
<code>public void checkHaddexDate(final I_C_OrderLine orderLine) { if (!orderDAO.getById(OrderId.ofRepoId(orderLine.getC_Order_ID())).isSOTrx()) { return; } final I_M_Product product = productDAO.getById(orderLine.getM_Product_ID()); if (product.isHaddexCheck() && product.getDateHaddexCheck() != null) { final long differenceBetweenNowAndPromisedDateInMonths = Math.abs( ChronoUnit.MONTHS.between( SystemTime.asZonedDateTime(), TimeUtil.asZonedDateTime(orderLine.getDatePromised()) <START> )); <END> if (differenceBetweenNowAndPromisedDateInMonths > getMaxHaddexAgeInMonths(orderLine.getAD_Client_ID(), orderLine.getAD_Org_ID())) { throw new AdempiereException(MSG_HADDEX_CHECK_ERROR).markAsUserValidationError(); } } }</code><technical_language>is product.getDateHaddexCheck() longer used</technical_language>

Target:
public void checkHaddexDate(final I_C_OrderLine orderLine) { final I_C_Order order = orderDAO.getById(OrderId.ofRepoId(orderLine.getC_Order_ID())); if (!order.isSOTrx()) { return; } final I_M_Product product = productDAO.getById(orderLine.getM_Product_ID()); if (product.isHaddexCheck() && product.getDateHaddexCheck() != null) { final long differenceBetweenHaddexCheckDateAndPromisedDateInMonths = Math.abs( ChronoUnit.MONTHS.between( TimeUtil.asZonedDateTime(product.getDateHaddexCheck()), TimeUtil.asZonedDateTime(order.getDatePromised()) )); if (differenceBetweenHaddexCheckDateAndPromisedDateInMonths > getMaxHaddexAgeInMonths(orderLine.getAD_Client_ID(), orderLine.getAD_Org_ID())) { throw new AdempiereException(MSG_HADDEX_CHECK_ERROR).markAsUserValidationError(); } } }
Source:
<code>public int hashCode() { <START> return System.identityHashCode(HibernateUtils.unwrap(this)); <END> }</code><technical_language>HibernateUtils.unwrap(this) : unwrap is useless. This a proxy</technical_language>

Target:
public int hashCode() { return super.hashCode(); }
Source:
<code>private ICPPConstructor getConstructor(IASTDeclaration decl) { if (decl instanceof ICPPASTFunctionDefinition) { ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl; if (functionDefinition.isDeleted()) return null; <START> boolean isDefaulted = functionDefinition.isDefaulted(); <END> IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding(); if (binding instanceof ICPPConstructor) { ICPPConstructor constructor = (ICPPConstructor) binding; if (!(isDefaulted && (SemanticQueries.isMoveConstructor(constructor) || SemanticQueries.isCopyConstructor(constructor)))) { if (constructor.getClassOwner().getKey() != ICompositeType.k_union) { return constructor; } } } } return null; }</code><technical_language>do calculate if? is if</technical_language>

Target:
private ICPPConstructor getConstructor(IASTDeclaration decl) { if (decl instanceof ICPPASTFunctionDefinition) { ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl; if (functionDefinition.isDeleted()) return null; IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding(); if (binding instanceof ICPPConstructor) { ICPPConstructor constructor = (ICPPConstructor) binding; boolean isDefaulted = functionDefinition.isDefaulted(); boolean isMoveConstructor = SemanticQueries.isMoveConstructor(constructor); boolean isCopyConstructor = SemanticQueries.isCopyConstructor(constructor); if (isDefaulted && (isMoveConstructor || isCopyConstructor)) return null; if (constructor.getClassOwner().getKey() == ICompositeType.k_union) return null; return constructor; } } return null; }
Source:
<code>public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { Lock localLock = RedisLockRegistry.this.localRegistry.obtain(lockKey); if (!localLock.tryLock(time, unit)) { return false; } try { long expire = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(time, unit); boolean acquired = false; while (!(acquired = this.obtainLock()) && System.currentTimeMillis() < expire) { Thread.sleep(100); } if (!acquired) { localLock.unlock(); if (this.reLock <= 0) { removeThreadLocal(); <START> } <END> } return acquired; } catch (Exception e) { localLock.unlock(); throw new RuntimeException(e); } }</code><technical_language>is for this method too. typical pattern is: if (lock.tryLock()) { try { ..... } finally { lock.unlock(); } } So, if tryLock() fails exception call unlock clrear ThreadLocal</technical_language>

Target:
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { Lock localLock = RedisLockRegistry.this.localRegistry.obtain(lockKey); if (!localLock.tryLock(time, unit)) { return false; } try { long expire = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(time, unit); boolean acquired = false; while (!(acquired = this.obtainLock()) && System.currentTimeMillis() < expire) { Thread.sleep(100); } if (!acquired) { localLock.unlock(); } return acquired; } catch (Exception e) { localLock.unlock(); throw new RuntimeException(e); } }
Source:
<code>public void testPutAlmostTooBigValueTenTimes() throws IOException { ExecutorService es = Executors.newCachedThreadPool(); try { for (int i = 0; i < 10; i++) { es.submit(new Callable<Void>() { public Void call() throws Exception { testPutGetDeleteExists(10 << 20, true, true); return null; }; }); } } finally { es.shutdown(); while (!es.isTerminated()) { try { <START> es.awaitTermination(1, TimeUnit.SECONDS); <END> } catch (InterruptedException e) { break; } } } }</code><technical_language>loop await for 1 a time instead of a single awaitTermination()? good put upper bound amount of time wait</technical_language>

Target:
public void testPutAlmostTooBigValueTenTimes() throws IOException { ExecutorService es = Executors.newCachedThreadPool(); try { for (int i = 0; i < 10; i++) { es.submit(new Callable<Void>() { public Void call() throws Exception { testPutGetDeleteExists(10 << 20, true, true); return null; }; }); } } finally { es.shutdown(); try { es.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { } } }
Source:
<code><START> @Override public Void deserialize(String topic, byte[] data) { <END> if (data != null) throw new IllegalArgumentException("Data should be null for a VoidDeserializer."); return null; }</code><technical_language>nit: put @Override line</technical_language>

Target:
public Void deserialize(String topic, byte[] data) { if (data != null) throw new IllegalArgumentException("Data should be null for a VoidDeserializer."); return null; }
Source:
<code>void convertsStringToClass() { assertConverts("java.lang.Integer", Class.class, Integer.class); <START> } <END></code><technical_language>Please add assertion for enclosed type: java.lang.Thread.State</technical_language>

Target:
void convertsStringToClass() { assertConverts("java.lang.Integer", Class.class, Integer.class); assertConverts("java.lang.Thread$State", Class.class, State.class); }
Source:
<code>public static boolean isTarFile(String fileName) { <START> assertNotNull(fileName); <END> if (fileName.trim().length() == 0) { return false; } TarFile tarFile = null; try { tarFile = new TarFile(fileName.trim()); } catch (TarException tarException) { return false; } catch (IOException ioException) { return false; } finally { if (tarFile != null) { try { tarFile.close(); } catch (IOException e) { } } } return true; }</code><technical_language>"fileName" is null, throws exception instead return false</technical_language>

Target:
public static boolean isTarFile(String fileName) { if (fileName == null || fileName.trim().length() == 0) { return false; } TarFile tarFile = null; try { tarFile = new TarFile(fileName.trim()); } catch (TarException tarException) { return false; } catch (IOException ioException) { return false; } finally { if (tarFile != null) { try { tarFile.close(); } catch (IOException e) { } } } return true; }
Source:
<code>public static int getGlobalConnectionCount() { <START> return DefaultRawMemcacheClient.GLOBAL_CONNECTION_COUNT.get(); <END> }</code><technical_language>exposing this part of Metrics</technical_language>

Target:
public static int getGlobalConnectionCount() { return DefaultRawMemcacheClient.getGlobalConnectionCount(); }
Source:
<code>private void testPublishUnpublishActions() { ______TS("publish action: OPEN feedback session"); homePage.clickAndCancel(homePage.getPublishLink(feedbackSessionOpen.getCourseId(), <START> feedbackSessionOpen.getFeedbackSessionName())); <END> ______TS("publish action: CLOSED feedback session"); homePage.clickAndCancel(homePage.getPublishLink(feedbackSessionClosed.getCourseId(), feedbackSessionClosed.getFeedbackSessionName())); ______TS("unpublish action: PUBLISHED feedback session"); homePage.clickFeedbackSessionUnpublishLink(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()); homePage.waitForPageToLoad(); homePage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_UNPUBLISHED); assertFalse(BackDoor.getFeedbackSession(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()).isPublished()); ______TS("publish action: PUBLISHED feedback session"); homePage.clickFeedbackSessionPublishLink(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()); homePage.waitForPageToLoad(); homePage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_PUBLISHED); assertTrue(BackDoor.getFeedbackSession(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()).isPublished()); }</code><technical_language>I verify results caret button is disabled too</technical_language>

Target:
private void testPublishUnpublishActions() { ______TS("publish action: AWAITING feedback session"); homePage.verifyUnclickable(homePage.getSessionResultsOptionsCaretElement(feedbackSessionAwaiting.getCourseId(), feedbackSessionAwaiting.getFeedbackSessionName())); ______TS("publish action: OPEN feedback session"); homePage.clickAndCancel(homePage.getPublishLink(feedbackSessionOpen.getCourseId(), feedbackSessionOpen.getFeedbackSessionName())); ______TS("publish action: CLOSED feedback session"); homePage.clickAndCancel(homePage.getPublishLink(feedbackSessionClosed.getCourseId(), feedbackSessionClosed.getFeedbackSessionName())); ______TS("unpublish action: PUBLISHED feedback session"); homePage.clickFeedbackSessionUnpublishLink(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()); homePage.waitForPageToLoad(); homePage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_UNPUBLISHED); assertFalse(BackDoor.getFeedbackSession(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()).isPublished()); ______TS("publish action: PUBLISHED feedback session"); homePage.clickFeedbackSessionPublishLink(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()); homePage.waitForPageToLoad(); homePage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_PUBLISHED); assertTrue(BackDoor.getFeedbackSession(feedbackSessionPublished.getCourseId(), feedbackSessionPublished.getFeedbackSessionName()).isPublished()); }
Source:
<code>public TaskAttempt(Long delay, TimeUnit timeUnit) { if (delay == null || delay < 0) { throw new IllegalArgumentException(String.format("Argument for delay parameter = %d, must be zero or any positive integer", delay)); } if (timeUnit == null) { throw new IllegalArgumentException("Argument for timeUnit parameter is null"); } this.delay = delay; this.timeOut = 0L; <START> this.timeUnit = TimeUnit.SECONDS; <END> }</code><technical_language>I this saving passed in timeUnit</technical_language>

Target:
public TaskAttempt(Long delay, TimeUnit timeUnit) { if (delay == null || delay < 0) { throw new IllegalArgumentException(String.format("Argument for delay parameter = %d, must be zero or any positive integer", delay)); } if (timeUnit == null) { throw new IllegalArgumentException("Argument for timeUnit parameter is null"); } this.delay = delay; this.timeOut = 0L; this.timeUnit = timeUnit; }
Source:
<code>StreamChunkParser( @Nullable InputRowParser<ByteBuffer> parser, @Nullable InputFormat inputFormat, InputRowSchema inputRowSchema, TransformSpec transformSpec, File indexingTmpDir ) { if (parser == null && inputFormat == null) { <START> throw new IAE("Either parser or inputFormat shouldn't be set"); <END> } this.parser = parser; this.lazyByteEntityReaderSupplier = Suppliers.memoize(() -> new SettableByteEntityReader( inputFormat, inputRowSchema, transformSpec, indexingTmpDir )); }</code><technical_language>nit: this error message "Either parser inputFormat **should** set" this is checking if null</technical_language>

Target:
StreamChunkParser( @Nullable InputRowParser<ByteBuffer> parser, @Nullable InputFormat inputFormat, InputRowSchema inputRowSchema, TransformSpec transformSpec, File indexingTmpDir ) { if (parser == null && inputFormat == null) { throw new IAE("Either parser or inputFormat should be set"); } this.parser = parser; if (inputFormat != null) { this.byteEntityReader = new SettableByteEntityReader( inputFormat, inputRowSchema, transformSpec, indexingTmpDir ); } else { this.byteEntityReader = null; } }
Source:
<code>public void onIterationCompleted(final int numCompletedIterations) { <START> LOG.log(Level.INFO, "[Shuffle] {0}th stage : {1} th iteration is completed", <END> new Object[]{stageSequence, numCompletedIterations}); }</code><technical_language>Inconsistent log format. {0}th {0} th. {0}-th is better</technical_language>

Target:
public void onIterationCompleted(final int numCompletedIterations) { LOG.log(Level.INFO, "[Shuffle] {0}-th stage : {1}-th iteration is completed", new Object[]{stageSequence, numCompletedIterations}); }
Source:
<code><START> public void setProgramGroup(final String programGroup) { setAttribute(PROGRAM_GROUP, programGroup);} <END></code><technical_language>formatting of new setter code is a bit</technical_language>

Target:
public void setProgramGroup(final String programGroup) { setAttribute(PROGRAM_GROUP_TAG, programGroup); }
Source:
<code><START> protected String getAdNetworkId() { return ""; } <END></code><technical_language>Return zone id instead of returning empty string</technical_language>

Target:
protected String getAdNetworkId() { return zoneId; }
Source:
<code>public ArrayList<TranslationResult> getTranslations( TranscriptionResult result) { ArrayList<TranslationResult> translatedResults = new ArrayList<>(); <START> <END> for(String language : languages.keySet()) { String translatedText = translationService.translate( result.getAlternatives().iterator().next().getTranscription(), result.getLanguage().substring(0,2), language); translatedResults.add(new TranslationResult( result, language, translatedText)); } return translatedResults; }</code><technical_language>this threadsafe, consider synchronising making a copy block map for a long period of time</technical_language>

Target:
private List<TranslationResult> getTranslations( TranscriptionResult result) { ArrayList<TranslationResult> translatedResults = new ArrayList<>(); Set<String> translationLanguages; synchronized (languages) { translationLanguages = languages.keySet(); } Collection<TranscriptionAlternative> alternatives = result.getAlternatives(); if(!alternatives.isEmpty()) { for(String targetLanguage : translationLanguages) { String translatedText = translationService.translate( alternatives.iterator().next().getTranscription(), result.getParticipant().getSourceLanguage(), targetLanguage); translatedResults.add(new TranslationResult( result, targetLanguage, translatedText)); } } return translatedResults; }
Source:
<code>void doAddNewInclude() { final String groupName = addIncludeBox.getText(); if (groupName.length() == 0) { return; } <START> UUID uuid = accountGroupSuggestOracle.getUUID(groupName); <END> addIncludeBox.setEnabled(false); GroupApi.addIncludedGroup(getGroupUUID(), uuid.get(), new GerritCallback<GroupInfo>() { public void onSuccess(final GroupInfo result) { addIncludeBox.setEnabled(true); addIncludeBox.setText(""); includes.insert(result); } @Override public void onFailure(final Throwable caught) { addIncludeBox.setEnabled(true); super.onFailure(caught); } }); }</code><technical_language>import UUID. AccountGroup.UUID here</technical_language>

Target:
void doAddNewInclude() { final String groupName = addIncludeBox.getText(); if (groupName.length() == 0) { return; } AccountGroup.UUID uuid = accountGroupSuggestOracle.getUUID(groupName); addIncludeBox.setEnabled(false); GroupApi.addIncludedGroup(getGroupUUID(), uuid.get(), new GerritCallback<GroupInfo>() { public void onSuccess(final GroupInfo result) { addIncludeBox.setEnabled(true); addIncludeBox.setText(""); includes.insert(result); } @Override public void onFailure(final Throwable caught) { addIncludeBox.setEnabled(true); super.onFailure(caught); } }); }
Source:
<code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String datasource = getRequiredParameter(request, "datasource"); if (config.isCheckDatasource() && !validateDatasource(request, datasource)) { sendForbiddenError(response); return; } String resourceManagerUrl = config.getResourceManagerUrl(datasource); <START> String id = request.getParameter("id"); <END> if (id.startsWith("application_")) { killApplication(response, resourceManagerUrl, id); return; } if (config.isUseJdbcCancel(datasource)) { LOG.info(format("killing %s in %s by Statement#cancel", id, datasource)); try (Statement statement = statements.getStatement(datasource, id)) { if (statement == null) { LOG.error("statement is null"); } else { statement.cancel(); } statements.removeStatement(datasource, id); } catch (SQLException e) { throw new RuntimeException(e); } return; } YarnUtil.getApplication(resourceManagerUrl, id, getUsername(request), config.getResourceManagerBegin(datasource)).ifPresent(application -> { String applicationId = (String) application.get("id"); killApplication(response, resourceManagerUrl, applicationId); }); }</code><technical_language>null check of id is necessary</technical_language>

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String id = request.getParameter("id"); if (id == null) { return; } String datasource = getRequiredParameter(request, "datasource"); if (config.isCheckDatasource() && !validateDatasource(request, datasource)) { sendForbiddenError(response); return; } String resourceManagerUrl = config.getResourceManagerUrl(datasource); if (id.startsWith("application_")) { killApplication(response, resourceManagerUrl, id); return; } if (config.isUseJdbcCancel(datasource)) { LOG.info(format("killing %s in %s by Statement#cancel", id, datasource)); try (Statement statement = statements.getStatement(datasource, id)) { if (statement == null) { LOG.error("statement is null"); } else { statement.cancel(); } statements.removeStatement(datasource, id); } catch (SQLException e) { throw new RuntimeException(e); } return; } YarnUtil.getApplication(resourceManagerUrl, id, getUsername(request), config.getResourceManagerBegin(datasource)).ifPresent(application -> { String applicationId = (String) application.get("id"); killApplication(response, resourceManagerUrl, applicationId); }); }
Source:
<code>public String findCPUHost() { List<Hosts> hosts = find(); for(Hosts host: hosts){ <START> if(host.getNumGpus() == 0){ <END> return host.getHostname(); } } return null; }</code><technical_language>Check if (host.getNumGpus() ==0 && host.isAnacondaEnabled())</technical_language>

Target:
public String findCPUHost() { List<Hosts> hosts = find(); for(Hosts host: hosts){ if(host.getNumGpus() == 0 && host.getCondaEnabled()){ return host.getHostname(); } } return null; }
Source:
<code>public static void main(String[] args) throws Exception { <START> while (!makeNodeUpToDate()) { <END> Thread.sleep(5000); } String jarFile = DEFAULT_SCHEDULER_NODE_JAR; if (System.getProperty(NODE_JAR_SAVEAS_PROPERTY) != null) { jarFile = System.getProperty(NODE_JAR_SAVEAS_PROPERTY); } System.out.println("Launching a computing node"); ProcessBuilder pb = generateSubProcess(args, jarFile); final Process p = pb.start(); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { try { p.destroy(); } catch (Exception e) { } } })); p.waitFor(); }</code><technical_language>timeout</technical_language>

Target:
public static void main(String[] args) { RMNodeUpdater rmNodeUpdater = new RMNodeUpdater(); rmNodeUpdater.parseCommandLine(args); rmNodeUpdater.updateNodeAndLaunchJVM(args); }
Source:
<code>public void processElement(ProcessContext context) throws ConstraintViolationException { if (converter == null) { AvroRegistry registry = new AvroRegistry(); converter = registry.createIndexedRecordConverter(context.element().getClass()); } IndexedRecord inputRecord = (IndexedRecord) converter.convertToAvro(context.element()); try { if (inputConstraints != null) { inputConstraints.validate(inputRecord, properties); } boolean returnedBooleanValue = true; String columnName = properties.columnName.getValue(); if (!StringUtils.isEmpty(columnName)) { List<Object> inputValues = getInputFields(inputRecord, columnName); if (inputValues.size() == 0) { returnedBooleanValue = false; } for (Object inputValue : inputValues) { returnedBooleanValue = returnedBooleanValue && checkCondition(inputValue, properties); } } if (returnedBooleanValue) { if (hasOutputSchema) { context.output(inputRecord); } } else { if (hasRejectSchema) { context.sideOutput(FilterRowRuntime.rejectOutput, inputRecord); } } } catch (ConstraintViolationException cve) { <START> context.sideOutput(FilterRowRuntime.discardOutput, inputRecord); <END> } }</code><technical_language>do validation input record beginning, able avoid try/catch, somethinglike: if !valid() {<discard code>} else {<business code>}</technical_language>

Target:
public void processElement(ProcessContext context) throws ConstraintViolationException { if (converter == null) { AvroRegistry registry = new AvroRegistry(); converter = registry.createIndexedRecordConverter(context.element().getClass()); } IndexedRecord inputRecord = (IndexedRecord) converter.convertToAvro(context.element()); try { if (inputConstraints != null) { inputConstraints.validate(inputRecord, properties); } boolean returnedBooleanValue = true; String columnName = properties.columnName.getValue(); if (!StringUtils.isEmpty(columnName)) { List<Object> inputValues = getInputFields(inputRecord, columnName); if (inputValues.size() == 0) { returnedBooleanValue = false; } for (Object inputValue : inputValues) { returnedBooleanValue = returnedBooleanValue && checkCondition(inputValue, properties); } } if (returnedBooleanValue) { if (hasOutputSchema) { context.output(inputRecord); } } else { if (hasRejectSchema) { context.sideOutput(FilterRowRuntime.rejectOutput, inputRecord); } } } catch (ConstraintViolationException cve) { if (stopPipelineOnError) { throw cve; } context.sideOutput(FilterRowRuntime.discardOutput, inputRecord); } }
Source:
<code><START> public void endWithFailure() { <END> updateDiskStatus(ImageStatus.ILLEGAL); }</code><technical_language>failure try delete disk added, current handling in task handlers</technical_language>

Target:
public void endWithFailure() { updateDiskStatus(ImageStatus.ILLEGAL); setSucceeded(true); }
Source:
<code>public void run() { String processTitle = null; try { <START> while (index < processes.size()) { <END> final long begin = System.nanoTime(); Process process = processes.get(index++); processTitle = process.getTitle(); setWorkDetail(processTitle); migrationService.migrateMetadata(process); if (logger.isTraceEnabled()) { logger.trace("Migrating took ms", processTitle, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin)); } setProgress(100 * index / processes.size()); if (isInterrupted()) { return; } } setProgress(100); } catch (Throwable thrown) { if (thrown instanceof Error) { throw (Error) thrown; } else { if (thrown instanceof Exception) { Helper.setErrorMessage(thrown.getLocalizedMessage(), processTitle, logger, (Exception) thrown); } super.setException(thrown); } } }</code><technical_language>please a for loop</technical_language>

Target:
public void run() { String processTitle = null; try { for (int index = progress; index < processes.size(); index++) { final long begin = System.nanoTime(); Process process = processes.get(index); processTitle = process.getTitle(); setWorkDetail(processTitle); migrationService.migrateMetadata(process); if (logger.isTraceEnabled()) { logger.trace("Migrating took ms", processTitle, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin)); } progress = index + 1; setProgress(100 * progress / processes.size()); if (isInterrupted()) { return; } } setProgress(100); } catch (DAOException exception) { Helper.setErrorMessage(exception.getLocalizedMessage(), processTitle, logger, exception); super.setException(exception); } }
Source:
<code>private void waitingRequestOnError(final CallbackHandler handler, final AuthenticationRequestState waitingRequest, final int requestId, final AuthenticationException exc) { try { if (waitingRequest != null && waitingRequest.getDelegate() != null) { Logger.v(TAG, "Sending error to callback" + mAuthContext.getCorrelationInfoFromWaitingRequest(waitingRequest)); waitingRequest.getAPIEvent().setWasApiCallSuccessful(false); waitingRequest.getAPIEvent().setCorrelationId( <START> waitingRequest.getRequest().getCorrelationId().toString()); <END> waitingRequest.getAPIEvent().stopTelemetryAndFlush(); if (handler != null) { handler.onError(exc); } else { waitingRequest.getDelegate().onError(exc); } } } finally { if (exc != null && exc.getCode() != ADALError.AUTH_FAILED_CANCELLED) { mAuthContext.removeWaitingRequest(requestId); } } }</code><technical_language>adding correlation id? set start event? #Closed</technical_language>

Target:
private void waitingRequestOnError(final CallbackHandler handler, final AuthenticationRequestState waitingRequest, final int requestId, final AuthenticationException exc) { try { if (waitingRequest != null && waitingRequest.getDelegate() != null) { Logger.v(TAG, "Sending error to callback" + mAuthContext.getCorrelationInfoFromWaitingRequest(waitingRequest)); waitingRequest.getAPIEvent().setWasApiCallSuccessful(false, exc); waitingRequest.getAPIEvent().setCorrelationId( waitingRequest.getRequest().getCorrelationId().toString()); waitingRequest.getAPIEvent().stopTelemetryAndFlush(); if (handler != null) { handler.onError(exc); } else { waitingRequest.getDelegate().onError(exc); } } } finally { if (exc != null && exc.getCode() != ADALError.AUTH_FAILED_CANCELLED) { mAuthContext.removeWaitingRequest(requestId); } } }
Source:
<code>private void usualFormToDiscover(boolean isDiscovered) { if (isDiscovered) { authLabel.setText(constants.hostPopupAuthLabelForExternalHost()); <START> rbPublicKey.setVisible(false); <END> rbPassword.setVisible(false); expanderContent.setVisible(false); publicKeyEditor.setVisible(false); authSshPortEditor.setVisible(false); hostAddressEditor.setEnabled(true); userNameEditor.setVisible(false); } else { authLabel.setText(constants.hostPopupAuthLabel()); rbPublicKey.setVisible(true); rbPassword.setVisible(true); rbPassword.setValue(true); expanderContent.setVisible(true); publicKeyEditor.setVisible(true); authSshPortEditor.setVisible(true); displayPassPkWindow(true); userNameEditor.setVisible(true); } }</code><technical_language>consider 'isDiscovered' boolean for editors</technical_language>

Target:
private void usualFormToDiscover(boolean isDiscovered) { if (isDiscovered) { authLabel.setText(constants.hostPopupAuthLabelForExternalHost()); hostAddressEditor.setEnabled(true); } else { authLabel.setText(constants.hostPopupAuthLabel()); displayPassPkWindow(true); rbPassword.setValue(true); } rbPublicKey.setVisible(!isDiscovered); rbPassword.setVisible(!isDiscovered); expanderContent.setVisible(!isDiscovered); publicKeyEditor.setVisible(!isDiscovered); authSshPortEditor.setVisible(!isDiscovered); userNameEditor.setVisible(!isDiscovered); }
Source:
<code>public StoragePool getEntity() { <START> return (StoragePool) ((super.getEntity() instanceof StoragePool) ? super.getEntity() : null); <END> }</code><technical_language>do need this check? setEntity takes StoragePool..</technical_language>

Target:
public StoragePool getEntity() { return (StoragePool) super.getEntity(); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WorkloadDetails that = (WorkloadDetails) o; if (!id.equals(that.id)) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; if (version != null ? !version.equals(that.version) : that.version != null) return false; <START> if (description != null ? !description.equals(description) : that.description != null) return false; <END> return true; }</code><technical_language>missing that? >>!description.equals(description)<< false</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WorkloadDetails that = (WorkloadDetails) o; if (!id.equals(that.id)) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; if (version != null ? !version.equals(that.version) : that.version != null) return false; if (description != null ? !description.equals(that.description) : that.description != null) return false; return true; }
Source:
<code>private void processFailures(Map<KeyExtent,List<Range>> failures, ResultReceiver receiver, List<Column> columns) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (log.isTraceEnabled()) log.trace("Failed to execute multiscans against " + failures.size() + " tablets, retrying..."); try { Thread.sleep(failSleepTime); } catch (InterruptedException e) { Thread.currentThread().interrupt(); log.debug("Exiting failure processing on interrupt"); return; } failSleepTime = Math.min(5000, failSleepTime * 2); Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>(); List<Range> allRanges = new ArrayList<Range>(); for (List<Range> ranges : failures.values()) allRanges.addAll(ranges); if (!locator.isValid()) <START> locator = new TimeoutTabletLocator(TabletLocator.getLocator(instance, new Text(table)), timeout); <END> binRanges(locator, allRanges, binnedRanges); doLookups(binnedRanges, receiver, columns); }</code><technical_language>TabletServerBatchReaderIterator#lookup is synchronized, reassignment is thread-safe for other accesses respect instance's lock. This reassignment, in processFailures, occurs a branch a QueryTask, do reassignment in a synchronized block (it a semaphore of QueryTask, separate TSBI instance lock). So, this: is safe do re-assignments of a synchronized block? implied updates happen in threads, QueryTasks executed ExecutorService</technical_language>

Target:
private void processFailures(Map<KeyExtent,List<Range>> failures, ResultReceiver receiver, List<Column> columns) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (log.isTraceEnabled()) log.trace("Failed to execute multiscans against " + failures.size() + " tablets, retrying..."); try { Thread.sleep(failSleepTime); } catch (InterruptedException e) { Thread.currentThread().interrupt(); log.debug("Exiting failure processing on interrupt"); return; } failSleepTime = Math.min(5000, failSleepTime * 2); Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>(); List<Range> allRanges = new ArrayList<Range>(); for (List<Range> ranges : failures.values()) allRanges.addAll(ranges); binRanges(locator, allRanges, binnedRanges); doLookups(binnedRanges, receiver, columns); }
Source:
<code>protected File getAvatarDir(final String userId) { <START> File avatarDir = new File(mSession.getCacheDir(), "avatar"); <END> if (!avatarDir.exists()) { avatarDir.mkdirs(); } return avatarDir; }</code><technical_language>Move a constant</technical_language>

Target:
protected File getAvatarDir(final String userId) { File avatarDir = new File(mSession.getCacheDir(), DEFAULT_AVATAR_DIR_NAME); if (!avatarDir.exists()) { avatarDir.mkdirs(); } cleanOutOldAvatars(avatarDir, DEFAULT_MAX_AGE); return avatarDir; }
Source:
<code>public static void setUpBeforeClass() throws Exception { Configuration conf = TEST_UTIL.getConfiguration(); conf.setClass(HConstants.REGION_IMPL, InterruptInterceptingHRegion.class, Region.class); conf.setBoolean(HRegion.CLOSE_WAIT_ABORT, true); conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); <START> } <END></code><technical_language>want restrict 5 min of wait time updating CLOSE_WAIT_TIME</technical_language>

Target:
public static void setUpBeforeClass() throws Exception { Configuration conf = TEST_UTIL.getConfiguration(); conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); conf.setClass(HConstants.REGION_IMPL, InterruptInterceptingHRegion.class, Region.class); conf.setBoolean(HRegion.CLOSE_WAIT_ABORT, true); long waitInterval = conf.getLong(HRegion.CLOSE_WAIT_INTERVAL, HRegion.DEFAULT_CLOSE_WAIT_INTERVAL); sleepTime = waitInterval * 2; conf.setLong(HRegion.CLOSE_WAIT_TIME, sleepTime * 2); }
Source:
<code>public DatastoreImpl(String dir, String name, KeyProvider provider) throws SQLException, IOException, DatastoreException { Preconditions.checkNotNull(dir); Preconditions.checkNotNull(name); Preconditions.checkNotNull(provider); this.keyProvider = provider; this.datastoreDir = dir; this.datastoreName = name; this.extensionsDir = FilenameUtils.concat(this.datastoreDir, "extensions"); final String dbFilename = FilenameUtils.concat(this.datastoreDir, DB_FILE_NAME); queue = new SQLDatabaseQueue(dbFilename, provider); int dbVersion = queue.getVersion(); int highestSupportedVersionExclusive = 300; if (dbVersion >= highestSupportedVersionExclusive) { throw new DatastoreException(String.format("Database version is higher than the " + "version supported by this library, current version %d , highest supported " + <START> "version %d", dbVersion, highestSupportedVersionExclusive)); <END> } queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion3()), 3); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion4()), 4); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion5()), 5); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion6()), 6); queue.updateSchema(new MigrateDatabase6To100(), 100); queue.updateSchema(new MigrateDatabase100To200(), 200); this.eventBus = new EventBus(); this.attachmentsDir = this.extensionDataFolder(ATTACHMENTS_EXTENSION_NAME); this.attachmentStreamFactory = new AttachmentStreamFactory(this.getKeyProvider()); }</code><technical_language>highestSupportedVersionExclusive-1</technical_language>

Target:
public DatastoreImpl(String dir, String name, KeyProvider provider) throws SQLException, IOException, DatastoreException { Preconditions.checkNotNull(dir); Preconditions.checkNotNull(name); Preconditions.checkNotNull(provider); this.keyProvider = provider; this.datastoreDir = dir; this.datastoreName = name; this.extensionsDir = FilenameUtils.concat(this.datastoreDir, "extensions"); final String dbFilename = FilenameUtils.concat(this.datastoreDir, DB_FILE_NAME); queue = new SQLDatabaseQueue(dbFilename, provider); int dbVersion = queue.getVersion(); int highestSupportedVersionExclusive = 300; if (dbVersion >= highestSupportedVersionExclusive) { throw new DatastoreException(String.format("Database version is higher than the " + "version supported by this library, current version %d , highest supported " + "version %d", dbVersion, highestSupportedVersionExclusive - 1)); } queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion3()), 3); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion4()), 4); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion5()), 5); queue.updateSchema(new SchemaOnlyMigration(DatastoreConstants.getSchemaVersion6()), 6); queue.updateSchema(new MigrateDatabase6To100(), 100); queue.updateSchema(new MigrateDatabase100To200(), 200); this.eventBus = new EventBus(); this.attachmentsDir = this.extensionDataFolder(ATTACHMENTS_EXTENSION_NAME); this.attachmentStreamFactory = new AttachmentStreamFactory(this.getKeyProvider()); }
Source:
<code>public void BlogTests_001_addFromProfile() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); String blogTitle = PageContent.blogPostNamePrefix + base.getTimeStamp(); String blogContent = PageContent.blogContent + base.getTimeStamp(); UserProfilePageObject userProfile = base.navigateToProfilePage(credentials.userName, wikiURL); userProfile.clickOnBlogTab(); SpecialCreatePagePageObject createBlogPage = userProfile.clickOnCreateBlogPost(); VisualEditModePageObject visualEditMode = createBlogPage.populateTitleField(blogTitle); visualEditMode.addContent(blogContent); <START> BlogPageObject blogPage = (BlogPageObject) visualEditMode.submit(PageType.Blog); <END> blogPage.verifyBlogTitle(blogTitle); blogPage.verifyContent(blogContent); }</code><technical_language>casting :(</technical_language>

Target:
public void BlogTests_001_addFromProfile() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); String blogTitle = PageContent.blogPostNamePrefix + base.getTimeStamp(); String blogContent = PageContent.blogContent + base.getTimeStamp(); UserProfilePageObject userProfile = base.navigateToProfilePage(credentials.userName, wikiURL); userProfile.clickOnBlogTab(); SpecialCreatePagePageObject createBlogPage = userProfile.clickOnCreateBlogPost(); VisualEditModePageObject visualEditMode = createBlogPage.populateTitleField(blogTitle); visualEditMode.addContent(blogContent); BlogPageObject blogPage = visualEditMode.submitBlog(); blogPage.verifyBlogTitle(blogTitle); blogPage.verifyContent(blogContent); }
Source:
<code>public void testFindStorageDomainForMemoryWithSingleInvalidDomain() { <START> verifyNoDomainForMemory(Arrays.asList(invalidStorageDomain1)); <END> }</code><technical_language>Please Collections.singletonList()</technical_language>

Target:
public void testFindStorageDomainForMemoryWithSingleInvalidDomain() { verifyNoDomainForMemory(Collections.singletonList(invalidStorageDomain1)); }