auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DataContentViewerHTML() { try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetectorInitException ex) { <START> Exceptions.printStackTrace(ex); <END> } initComponents(); resetComponents(); enableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.enableJavaScriptBtnTxt"); disableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.disableJavaScriptBtnTxt"); logger.log(Level.INFO, "Created HTMLView instance: " + this); }</code><technical_language>logger instead of Exceptions.printStackTrace</technical_language>

Target:
public DataContentViewerHTML() { try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetectorInitException ex) { logger.log(Level.WARNING, "An error occured while initializing the file type " + "detector for the HTML content viewer.", ex); } enableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.enableJavaScriptBtnTxt"); disableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.disableJavaScriptBtnTxt"); jfxPanel = new JFXPanel(); setLayout(new BorderLayout()); add(jfxPanel, BorderLayout.CENTER); Platform.runLater(() -> { stage = new Stage(); stage.setResizable(true); BorderPane root = new BorderPane(); scene = new Scene(root); stage.setScene(scene); HBox btnBox = new HBox(); btnBox.setPadding(new Insets(10, 10, 10, 10)); btnBox.setSpacing(10); javaScriptButton = new Button(enableJavaScriptTxt); javaScriptButton.setOnAction((ActionEvent event) -> { if(webEngine.isJavaScriptEnabled()) { webEngine.setJavaScriptEnabled(false); javaScriptButton.setText(enableJavaScriptTxt); } else { webEngine.setJavaScriptEnabled(true); javaScriptButton.setText(disableJavaScriptTxt); } webEngine.reload(); }); btnBox.getChildren().add(javaScriptButton); browser = new WebView(); webEngine = browser.getEngine(); webEngine.setJavaScriptEnabled(false); root.setTop(btnBox); root.setCenter(browser); jfxPanel.setScene(scene); }); resetComponents(); logger.log(Level.INFO, "Created HTMLView instance: " + this); }
Source:
<code>static void LoginAsync(final String userName, final String password, final String domain, final AsyncQuery callback, final GenericApiGWTServiceAsync service) { logger.finer("Frontend: Invoking async Login."); service.Login(userName, password, domain, new AsyncCallback<VdcReturnValueBase>() { @Override public void onSuccess(final VdcReturnValueBase result) { logger.finer("Succesful returned result from Login."); setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), result); <START> setLoginPassword(null); <END> if (getLoginHandler() != null && result.getSucceeded()) { getLoginHandler().onLoginSuccess(userName, password, domain); } } @Override public void onFailure(final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute RunQuery: " + caught, caught); getEventsHandler().runQueryFailed(null); failureEventHandler(caught); if (callback.isHandleFailure()) { setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), null); setLoginPassword(null); } } }); }</code><technical_language>null password</technical_language>

Target:
static void LoginAsync(final String userName, final String password, final String domain, final AsyncQuery callback, final GenericApiGWTServiceAsync service) { logger.finer("Frontend: Invoking async Login."); service.Login(userName, password, domain, new AsyncCallback<VdcReturnValueBase>() { @Override public void onSuccess(final VdcReturnValueBase result) { logger.finer("Succesful returned result from Login."); setLoggedInUser(null); result.setCanDoActionMessages((ArrayList<String>) translateError(result)); callback.getDel().onSuccess(callback.getModel(), result); setLoginPassword(null); if (getLoginHandler() != null && result.getSucceeded()) { getLoginHandler().onLoginSuccess(userName, password, domain); } } @Override public void onFailure(final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute RunQuery: " + caught, caught); getEventsHandler().runQueryFailed(null); failureEventHandler(caught); if (callback.isHandleFailure()) { setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), null); setLoginPassword(null); } } }); }
Source:
<code>private void populateBoards(BoardPickerState state) { boardList.getChildren().clear(); state.getMatchedBoards().stream() .sorted(String::compareToIgnoreCase) .map(PickerBoard::new) .forEach(pickerBoard -> { suggestion.ifPresent(suggestion -> { pickerBoard.setHighlighted(suggestion.equals(pickerBoard.getBoardName())); }); pickerBoard.setOnMouseClicked(e -> handleBoardClick(pickerBoard)); <START> boardList.getChildren().add(pickerBoard); <END> }); updateConfirmButton(); }</code><technical_language>codes involve some level steps, extract more methods</technical_language>

Target:
private void populateBoards(BoardPickerState state) { boardList.getChildren().clear(); state.getMatchedBoards().stream() .sorted(String::compareToIgnoreCase) .map(PickerBoard::new) .forEach(pickerBoard -> { processItem(pickerBoard); addItemToList(pickerBoard); }); updateConfirmButton(); }
Source:
<code>public List<User> getAllowedUsersNotExpired(PerunSession sess, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException { List<Resource> resources = getAssignedResources(sess, facility, specificVo, specificService); List<User> users = new ArrayList<>(); for (Resource resource: resources) { <START> users.addAll(getPerunBl().getResourcesManagerBl().getAllowedUsersNotExpired(sess, resource)); <END> } return users; }</code><technical_language>avoid duplicity of User object</technical_language>

Target:
public List<User> getAllowedUsersNotExpired(PerunSession sess, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException { List<Resource> resources = getAssignedResources(sess, facility, specificVo, specificService); Set<User> users = new TreeSet<>(); for (Resource resource: resources) { users.addAll(getPerunBl().getResourcesManagerBl().getAllowedUsersNotExpired(sess, resource)); } return new ArrayList<>(users); }
Source:
<code>private void setupWords() { <START> for (int i= 0; i < attributeWords.length; i++) { <END> this.addWord(attributeWords[i], blue); } for (int i= 0; i < tagWrods.length; i++) { this.addWord(tagWrods[i], red); } }</code><technical_language>For each</technical_language>

Target:
private void setupWords() { for (String word : attributeWords) { this.addWord(word, blue); } for (String word : tagWords) { this.addWord(word, red); } }
Source:
<code>public Tuple next() throws IOException { if (!reader.isReadable()) { return null; } if (targets.length == 0) { return EmptyTuple.get(); } VTuple tuple = new VTuple(schema.size()); try { do { ByteBuf buf = readLine(); if (buf == null) { return null; } try { deserializer.deserialize(buf, tuple); <START> <END> break; } catch (TextLineParsingError tae) { errorNum++; if (errorNum < errorPrintOutMaxNum) { LOG.warn("Ignore JSON Parse Error (" + errorNum + "): ", tae); } if (errorTorrenceMaxNum >= 0 && errorNum > errorTorrenceMaxNum) { throw tae; } continue; } } while (reader.isReadable()); return tuple; } catch (Throwable t) { LOG.error(t); throw new IOException(t); } }</code><technical_language>move {{recordCount}} this line</technical_language>

Target:
public Tuple next() throws IOException { if (!reader.isReadable()) { return null; } if (targets.length == 0) { return EmptyTuple.get(); } VTuple tuple = new VTuple(schema.size()); try { do { ByteBuf buf = reader.readLine(); if (buf == null) { return null; } try { deserializer.deserialize(buf, tuple); break; } catch (TextLineParsingError tae) { errorNum++; if (errorNum < errorPrintOutMaxNum) { LOG.warn("Ignore JSON Parse Error (" + errorNum + "): ", tae); } if (errorTorrenceMaxNum >= 0 && errorNum > errorTorrenceMaxNum) { throw tae; } continue; } } while (reader.isReadable()); recordCount++; return tuple; } catch (Throwable t) { LOG.error(t); throw new IOException(t); } }
Source:
<code>public Response query2(PerformanceQuery query) { Optional<String> id = Optional.<String> absent(); Optional<String> start = query.getStart() != null ? Optional.of(query .getStart()) : Optional.<String> absent(); Optional<String> end = query.getEnd() != null ? Optional.of(query .getEnd()) : Optional.<String> absent(); Optional<Boolean> exact = query.getExactTimeWindow() == null ? Optional .<Boolean> absent() : Optional.of(query.getExactTimeWindow()); Optional<Boolean> series = (query.getSeries() == null ? Optional .<Boolean> absent() : Optional.of(query.getSeries())); <START> Optional<String> downsample = query.getDownsample() == null ? Optional <END> .<String> absent() : Optional.of(query.getDownsample()); Optional<Map<String, String>> tags = query.getTags() == null ? Optional .<Map<String, String>> absent() : Optional.of(query.getTags()); return api.query(id, start, end, exact, series, downsample, tags, query.getMetrics()); }</code><technical_language>want Optional.fromNullable encapsulates ternary operation</technical_language>

Target:
public Response query2(PerformanceQuery query) { Optional<String> id = Optional.<String> absent(); Optional<String> start = Optional.<String> fromNullable(query .getStart()); Optional<String> end = Optional.<String> fromNullable(query.getEnd()); Optional<Boolean> exact = Optional.<Boolean> fromNullable(query .getExactTimeWindow()); Optional<Boolean> series = Optional.<Boolean> fromNullable(query .getSeries()); Optional<String> downsample = Optional.<String> fromNullable(query .getDownsample()); Optional<Map<String, String>> tags = Optional .<Map<String, String>> fromNullable(query.getTags()); return api.query(id, start, end, exact, series, downsample, tags, query.getMetrics()); }
Source:
<code>public boolean isFunctionDefinition() { return expression instanceof CompiledExpressionImpl && ((CompiledExpressionImpl)expression).getExpression() instanceof FunctionDefNode <START> || expression instanceof ProcessedExpression && ((ProcessedExpression) expression).getInterpreted().isFunctionOhNoWhyAreYouDoingThis() ; <END> }</code><technical_language>isFunctionOhNoWhyAreYouDoingThis()? :D</technical_language>

Target:
public boolean isFunctionDefinition() { return isFunctionDef; }
Source:
<code>private static FSTConfiguration copy(ClassLoader classLoader, FstCodec codec) { <START> FSTConfiguration def = codec.getConfig().deriveConfiguration(); <END> def.setClassLoader(classLoader); def.setCoderSpecific(codec.config.getCoderSpecific()); def.setCrossPlatform(codec.config.isCrossPlatform()); def.setForceClzInit(codec.config.isForceClzInit()); def.setForceSerializable(codec.config.isForceSerializable()); def.setInstantiator(codec.config.getInstantiator(null)); def.setJsonFieldNames(codec.config.getJsonFieldNames()); def.setLastResortResolver(codec.config.getLastResortResolver()); def.setName(codec.config.getName()); def.setPreferSpeed(codec.config.isPreferSpeed()); def.setStructMode(codec.config.isStructMode()); def.setShareReferences(codec.config.isShareReferences()); def.setStreamCoderFactory(codec.config.getStreamCoderFactory()); def.setVerifier(codec.config.getVerifier()); try { Field serializationInfoRegistryField = FSTConfiguration.class.getDeclaredField("serializationInfoRegistry"); serializationInfoRegistryField.setAccessible(true); FSTClazzInfoRegistry registry = (FSTClazzInfoRegistry) serializationInfoRegistryField.get(codec.config); serializationInfoRegistryField.set(def, registry); } catch (Exception e) { throw new IllegalStateException(e); } return def; }</code><technical_language>please codec.config.deriveConfiguration() instead</technical_language>

Target:
private static FSTConfiguration copy(ClassLoader classLoader, FstCodec codec) { FSTConfiguration def = codec.config.deriveConfiguration(); def.setClassLoader(classLoader); def.setCoderSpecific(codec.config.getCoderSpecific()); def.setCrossPlatform(codec.config.isCrossPlatform()); def.setForceClzInit(codec.config.isForceClzInit()); def.setForceSerializable(codec.config.isForceSerializable()); def.setInstantiator(codec.config.getInstantiator(null)); def.setJsonFieldNames(codec.config.getJsonFieldNames()); def.setLastResortResolver(codec.config.getLastResortResolver()); def.setName(codec.config.getName()); def.setPreferSpeed(codec.config.isPreferSpeed()); def.setStructMode(codec.config.isStructMode()); def.setShareReferences(codec.config.isShareReferences()); def.setStreamCoderFactory(codec.config.getStreamCoderFactory()); def.setVerifier(codec.config.getVerifier()); try { Field serializationInfoRegistryField = FSTConfiguration.class.getDeclaredField("serializationInfoRegistry"); serializationInfoRegistryField.setAccessible(true); FSTClazzInfoRegistry registry = (FSTClazzInfoRegistry) serializationInfoRegistryField.get(codec.config); serializationInfoRegistryField.set(def, registry); } catch (Exception e) { throw new IllegalStateException(e); } return def; }
Source:
<code><START> public int getMaxResults() { <END> return maxResults; }</code><technical_language>I this a requested change I this service treats this optional parameter. @JonathanGiles thoughts</technical_language>

Target:
public Integer getMaxResults() { return maxResults; }
Source:
<code>public <CC, C extends IAPIClientProvider<CC>> C getAPIProvider(Class<C> apiProviderClass, IEndpointSelectionStrategy endpointSelectionStrategy) { log.info("ClientProvider request received for class: " + apiProviderClass.getCanonicalName()); for (Class<?> internalAPIProviderClass : internalClientProviders.keySet()) { <START> @SuppressWarnings("unchecked") <END> IInternalAPIProvider<CC> internalAPIProvider = (IInternalAPIProvider<CC>) internalClientProviders.get(internalAPIProviderClass); if (doTypeArgumentsMatch(VALID_API_PROVIDERS, apiProviderClass, internalAPIProviderClass)) { @SuppressWarnings("unchecked") C c = (C) Proxy.newProxyInstance(apiProviderClass.getClassLoader(), new Class[] { apiProviderClass }, new APIProviderAdapter<CC>((IInternalAPIProvider<CC>) internalAPIProvider, coreModelCapability, endpointSelectionStrategy)); log.debug("Providing ClientProvider."); return c; } } log.debug("Not able to provide ClientProvider!"); return null; }</code><technical_language>Add logic initialize strategy, a basic strategy if strategy is user</technical_language>

Target:
public <CC, C extends IAPIClientProvider<CC>> C getAPIProvider(Class<C> apiProviderClass, IEndpointSelectionStrategy endpointSelectionStrategy) { log.info("ClientProvider request received for class: " + apiProviderClass.getCanonicalName()); for (Class<?> internalAPIProviderClass : internalClientProviders.keySet()) { @SuppressWarnings("unchecked") IInternalAPIProvider<CC> internalAPIProvider = (IInternalAPIProvider<CC>) internalClientProviders.get(internalAPIProviderClass); if (doTypeArgumentsMatch(VALID_API_PROVIDERS, apiProviderClass, internalAPIProviderClass)) { if (endpointSelectionStrategy == null) { endpointSelectionStrategy = new BasicEndpointSelectionStrategy(); } @SuppressWarnings("unchecked") C c = (C) Proxy.newProxyInstance(apiProviderClass.getClassLoader(), new Class[] { apiProviderClass }, new APIProviderAdapter<CC>((IInternalAPIProvider<CC>) internalAPIProvider, coreModelCapability, endpointSelectionStrategy)); log.debug("Providing ClientProvider."); return c; } } log.debug("Not able to provide ClientProvider!"); return null; }
Source:
<code>public void leaderChange_afterJobSubmission_recoversSubmittedJob() throws Exception { try (final DispatcherRunner dispatcherRunner = createDispatcherRunner()) { final UUID firstLeaderSessionId = UUID.randomUUID(); final DispatcherGateway firstDispatcherGateway = electLeaderAndRetrieveGateway(firstLeaderSessionId); firstDispatcherGateway.submitJob(jobGraph, TIMEOUT).get(); <START> CommonTestUtils.waitUntilJobManagerIsInitialized(() -> firstDispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get()); <END> dispatcherLeaderElectionService.notLeader(); final UUID secondLeaderSessionId = UUID.randomUUID(); final DispatcherGateway secondDispatcherGateway = electLeaderAndRetrieveGateway(secondLeaderSessionId); final Collection<JobID> jobIds = secondDispatcherGateway.listJobs(TIMEOUT).get(); assertThat(jobIds, contains(jobGraph.getJobID())); } }</code><technical_language>is this needed</technical_language>

Target:
public void leaderChange_afterJobSubmission_recoversSubmittedJob() throws Exception { try (final DispatcherRunner dispatcherRunner = createDispatcherRunner()) { final UUID firstLeaderSessionId = UUID.randomUUID(); final DispatcherGateway firstDispatcherGateway = electLeaderAndRetrieveGateway(firstLeaderSessionId); firstDispatcherGateway.submitJob(jobGraph, TIMEOUT).get(); dispatcherLeaderElectionService.notLeader(); final UUID secondLeaderSessionId = UUID.randomUUID(); final DispatcherGateway secondDispatcherGateway = electLeaderAndRetrieveGateway(secondLeaderSessionId); final Collection<JobID> jobIds = secondDispatcherGateway.listJobs(TIMEOUT).get(); assertThat(jobIds, contains(jobGraph.getJobID())); } }
Source:
<code>private boolean thereAreLinesBetween(Node a, Node b) { if (!a.getRange().isPresent() || !b.getRange().isPresent()) { return true; } if (!PositionUtils.areInOrder(a, b)) { return thereAreLinesBetween(b, a); } <START> int endOfA = a.getRange().get().end.line; <END> return b.getRange().get().begin.line > endOfA + 1; }</code><technical_language>this is a bit long write. create & a getEndLine method</technical_language>

Target:
private boolean thereAreLinesBetween(Node a, Node b) { if (!a.getRange().isPresent() || !b.getRange().isPresent()) { return true; } if (!PositionUtils.areInOrder(a, b)) { return thereAreLinesBetween(b, a); } int endOfA = a.getEnd().get().line; return b.getBegin().get().line > endOfA + 1; }
Source:
<code>protected final void serialize(T src, JsonObject to, JsonSerializationContext context) { <START> to.addProperty(MEMBER_MIN, src.min.toString(getFormatter())); <END> to.addProperty(MEMBER_MAX, src.max.toString(getFormatter())); super.serialize(src, to, context); }</code><technical_language>NPE</technical_language>

Target:
protected final void serialize(T src, JsonObject to, JsonSerializationContext context) { if(src.min != null) { to.addProperty(MEMBER_MIN, src.min.toString(getFormatter())); } if(src.max != null) { to.addProperty(MEMBER_MAX, src.max.toString(getFormatter())); } super.serialize(src, to, context); }
Source:
<code>public void editInstructor(int instrNum, String name, String email, Boolean isDisplayedToStudents, String displayName, String role) { clickEditInstructorLink(instrNum); editInstructorName(instrNum, name); if (getEmailField(instrNum).getAttribute("readonly") == null) { editInstructorEmail(instrNum, email); } <START> if (editInstructorDisplayedToStudents(instrNum, isDisplayedToStudents)) { <END> editInstructorDisplayName(instrNum, displayName); } selectRoleForInstructor(instrNum, role); saveEditInstructor(instrNum); waitForPageToLoad(); }</code><technical_language>Move editInstructorDisplayed... statement out isDisplayedToStudents in if statement for readability</technical_language>

Target:
public void editInstructor(int instrNum, String name, String email, Boolean isDisplayedToStudents, String displayName, String role) { clickEditInstructorLink(instrNum); editInstructorName(instrNum, name); if (getEmailField(instrNum).getAttribute("readonly") == null) { editInstructorEmail(instrNum, email); } editInstructorDisplayedToStudents(instrNum, isDisplayedToStudents); if (isDisplayedToStudents) { editInstructorDisplayName(instrNum, displayName); } selectRoleForInstructor(instrNum, role); saveEditInstructor(instrNum); waitForPageToLoad(); }
Source:
<code>public Secret getPassword() { JenkinsJVM.checkNotJenkinsJVM(); try { String appInstallationToken; synchronized (this) { try { if (cachedToken == null || cachedToken.isStale()) { cachedToken = ch.call(new GetToken(tokenRefreshData)); LOGGER.log(Level.INFO, "Retrieved GitHub App Installation Token for app ID {0} on agent", appID); } } catch (Exception e) { if (cachedToken != null && !cachedToken.isExpired()) { <START> LOGGER.log(Level.WARNING, "Keeping cached GitHub App Installation Token for app ID {0} on agent: token is stale but has not expired", appID); <END> } else { throw e; } } appInstallationToken = cachedToken.getToken(); } LOGGER.log(Level.FINEST, "Returned GitHub App Installation Token for app ID {0} on agent", appID); return Secret.fromString(appInstallationToken); } catch (IOException | InterruptedException x) { LOGGER.log(Level.WARNING, "Failed to get GitHub App Installation token on agent: " + getId(), x); throw new RuntimeException(x); } }</code><technical_language>ditto, important this is agent</technical_language>

Target:
public Secret getPassword() { JenkinsJVM.checkNotJenkinsJVM(); try { String appInstallationToken; synchronized (this) { try { if (cachedToken == null || cachedToken.isStale()) { LOGGER.log(Level.FINE, "Generating App Installation Token for app ID {0} on agent", appID); cachedToken = ch.call(new GetToken(tokenRefreshData)); LOGGER.log(Level.FINER, "Retrieved GitHub App Installation Token for app ID {0} on agent", appID); } } catch (Exception e) { if (cachedToken != null && !cachedToken.isExpired()) { LOGGER.log(Level.WARNING, "Failed to generate new GitHub App Installation Token for app ID " + appID + " on agent: cached token is stale but has not expired"); LOGGER.log(Level.FINER, () -> Functions.printThrowable(e)); } else { throw e; } } appInstallationToken = cachedToken.getToken(); } LOGGER.log(Level.FINEST, "Returned GitHub App Installation Token for app ID {0} on agent", appID); return Secret.fromString(appInstallationToken); } catch (IOException | InterruptedException x) { throw new RuntimeException(x); } }
Source:
<code><START> public void onCheatSheetTabClick(ClickEvent event) { <END> showTab(cheatSheetTab, cheatSheetTabContent); hideTab(editorTab, editorTabContent); }</code><technical_language>This call a method in Presenter call showTab/hideTab based actions. remove test targets this ViewImpl test Presenter instead</technical_language>

Target:
public void onCheatSheetTabClick(ClickEvent event) { presenter.onCheatSheetTabActivated(); }
Source:
<code>public boolean resize(int pointerCount) { if (useCount) { return true; } lruLock.lock(); try { <START> long memoryUsed = ((long) pointerCount) << 3; <END> boolean isNegative = memoryUsed < 0; long change = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(Math.abs(memoryUsed)); if (change >= maxSize) { return false; } if (isNegative) { currentSize -= change; } else { currentSize += change; } } finally { lruLock.unlock(); } return true; }</code><technical_language>suggestion long memoryUsed = ((long) Math.abs(pointerCount)) << 3; memoryUsed sounds negative</technical_language>

Target:
public boolean resize(int pointerCount) { if (useCount) { return true; } lruLock.lock(); try { boolean isNegative = pointerCount < 0; long memoryUsed = ((long) Math.abs(pointerCount)) << 3; long change = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(memoryUsed); if (!isNegative) { long changeSizeForAllSegments = change * numSegments; if (changeSizeForAllSegments < 0 || changeSizeForAllSegments >= maxSize) { return false; } } if (isNegative) { currentSize -= change; } else { currentSize += change; } } finally { lruLock.unlock(); } return true; }
Source:
<code>protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException { try { if (SC_FOUND == statusCode) { response.sendRedirect(finalLocation); } else { response.setStatus(statusCode); response.setHeader("Location", finalLocation); try { response.getWriter().write(finalLocation); } finally { response.getWriter().close(); } } } catch (IOException ioe) { LOG.warn("Unable to redirect to: {}, code: {}! (IOException): {}", finalLocation, statusCode, ioe.toString()); throw ioe; } catch (IllegalStateException ise) { <START> LOG.warn("Unable to redirect to: {}, code: {}! isCommited: {}. (IllegalStateException): {}", finalLocation, statusCode, response.isCommitted(), ise.toString()); <END> throw ise; } }</code><technical_language>Please do .toString, Log4j2 do for :)</technical_language>

Target:
protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException { try { if (SC_FOUND == statusCode) { response.sendRedirect(finalLocation); } else { response.setStatus(statusCode); response.setHeader("Location", finalLocation); try { response.getWriter().write(finalLocation); } finally { response.getWriter().close(); } } } catch (IOException ioe) { LOG.warn("Unable to redirect to: {}, code: {}; {}", finalLocation, statusCode, ioe); throw ioe; } catch (IllegalStateException ise) { LOG.warn("Unable to redirect to: {}, code: {}; isCommited: {}; {}", finalLocation, statusCode, response.isCommitted(), ise); throw ise; } }
Source:
<code>public void createPartControl(Composite parent) { super.createPartControl(parent); <START> super.getTimeGraphCombo().addTimeGraphFilterAdditionalButtonInfo( <END> new ControlFlowCheckActiveButtonProvider(true)); super.getTimeGraphCombo().addTimeGraphFilterAdditionalButtonInfo( new ControlFlowCheckActiveButtonProvider(false)); }</code><technical_language>I propose methods addTimeGraphFilterCheckActiveButton(provider, label, toolTip) addTimeGraphFilterUncheckInactiveButton(provider, label, toolTip). added a pair share providers: (provider, checkLabel, checkToolTip, uncheckLabel, uncheckToolTipe)</technical_language>

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); super.getTimeGraphCombo().addTimeGraphFilterCheckActiveButton( new ControlFlowCheckActiveProvider("Check Active", "Checks all threads executing within the time frame.")); super.getTimeGraphCombo().addTimeGraphFilterUncheckInactiveButton( new ControlFlowCheckActiveProvider("Uncheck Inactive", "Unchecks all threads not executing within the time frame.")); }
Source:
<code>void multipleRejectionSubscriptions() { <START> ImmutableSetMultimap<DispatchKey, SubscriberMethod> map = MethodScan <END> .findMethodsBy(ARejectionSubscriber.class, new SubscriberSignature()); assertThat(map.keys()).hasSize(2); }</code><technical_language>move orphaneous MethodScan next line</technical_language>

Target:
void multipleRejectionSubscriptions() { ImmutableSetMultimap<DispatchKey, SubscriberMethod> map = findMethodsBy(ARejectionSubscriber.class, new SubscriberSignature()); assertThat(map.keys()).hasSize(2); }
Source:
<code>public String saveAndRedirect() { if (migration && WorkflowStatus.DRAFT.equals(this.workflowStatus)) { Helper.setErrorMessage(Helper.getTranslation("errorMigrationDraft")); return this.stayOnCurrentPage; } try { <START> if (hasMultipleSructureTreeConfigurations()) { <END> Helper.setErrorMessage(Helper.getTranslation("errorMultipleConfigurations")); return this.stayOnCurrentPage; } if (saveFiles()) { this.workflow.setStatus(this.workflowStatus); saveWorkflow(); if (migration) { return MIGRATION_FORM_PATH + "&workflowId=" + workflow.getId(); } return workflowListPath; } else { return this.stayOnCurrentPage; } } catch (IOException e) { Helper.setErrorMessage("errorDiagramFile", new Object[] {this.workflow.getTitle() }, logger, e); return this.stayOnCurrentPage; } catch (WorkflowException e) { Helper.setErrorMessage("errorDiagramTask", new Object[] {this.workflow.getTitle(), e.getMessage() }, logger, e); return this.stayOnCurrentPage; } }</code><technical_language>suggestion if (hasMultipleStructureTreeConfigurations()) {</technical_language>

Target:
public String saveAndRedirect() { if (migration && WorkflowStatus.DRAFT.equals(this.workflowStatus)) { Helper.setErrorMessage(Helper.getTranslation("errorMigrationDraft")); return this.stayOnCurrentPage; } try { if (hasMultipleSructureTreeConfiguration()) { Helper.setErrorMessage(Helper.getTranslation("errorMultipleConfigurations")); return this.stayOnCurrentPage; } if (saveFiles()) { this.workflow.setStatus(this.workflowStatus); saveWorkflow(); if (migration) { return MIGRATION_FORM_PATH + "&workflowId=" + workflow.getId(); } return workflowListPath; } else { return this.stayOnCurrentPage; } } catch (IOException e) { Helper.setErrorMessage("errorDiagramFile", new Object[] {this.workflow.getTitle() }, logger, e); return this.stayOnCurrentPage; } catch (WorkflowException e) { Helper.setErrorMessage("errorDiagramTask", new Object[] {this.workflow.getTitle(), e.getMessage() }, logger, e); return this.stayOnCurrentPage; } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(!SessionHistory.hasGameAlreadyPlayedOnce) { DatabaseHandler dbHandler = new DatabaseHandler(this); dbHandler.resetUnlocked(7); <START> <END> } setContentView(R.layout.activity_vocab_match_tutorials); tutorialView = (ImageView) findViewById(R.id.tut); curTutorialImage = 1; tutorialView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(curTutorialImage == PowerUpUtils.VOCAB_MATCH_TUTS.length){ Intent intent = new Intent(VocabMatchTutorials.this,VocabMatchGameActivity.class) .putExtra(PowerUpUtils.CALLED_BY, true); finish(); startActivity(intent); overridePendingTransition(R.animator.fade_in_custom, R.animator.fade_out_custom); }else { tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.VOCAB_MATCH_TUTS[curTutorialImage])); curTutorialImage++; } } }); }</code><technical_language>blank line removed</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vocab_match_tutorials); tutorialView = (ImageView) findViewById(R.id.tut); curTutorialImage = 1; tutorialView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(curTutorialImage == PowerUpUtils.VOCAB_MATCH_TUTS.length){ Intent intent = new Intent(VocabMatchTutorials.this,VocabMatchGameActivity.class) .putExtra(PowerUpUtils.CALLED_BY, true); finish(); startActivity(intent); overridePendingTransition(R.animator.fade_in_custom, R.animator.fade_out_custom); }else { tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.VOCAB_MATCH_TUTS[curTutorialImage])); curTutorialImage++; } } }); }
Source:
<code>public AbfsRestOperation renamePath(String source, final String destination, final String continuation) throws AzureBlobFileSystemException { final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders(); String sasToken = ""; if (authType == AuthType.SAS) { final AbfsUriQueryBuilder queryBuilder = new AbfsUriQueryBuilder(); appendSASTokenToQuery(source, SASTokenProvider.RENAME_SOURCE_OPERATION, queryBuilder); sasToken = queryBuilder.toString(); } final String encodedRenameSource = urlEncode(FORWARD_SLASH + this.getFileSystem() + source) + sasToken; requestHeaders.add(new AbfsHttpHeader(X_MS_RENAME_SOURCE, encodedRenameSource)); requestHeaders.add(new AbfsHttpHeader(IF_NONE_MATCH, STAR)); final AbfsUriQueryBuilder abfsUriQueryBuilder = createDefaultUriQueryBuilder(); abfsUriQueryBuilder.addQuery(QUERY_PARAM_CONTINUATION, continuation); <START> if (authType == AuthType.SAS) { <END> appendSASTokenToQuery(destination, SASTokenProvider.RENAME_DESTINATION_OPERATION, abfsUriQueryBuilder); } final URL url = createRequestUrl(destination, abfsUriQueryBuilder.toString()); final AbfsRestOperation op = new AbfsRestOperation( AbfsRestOperationType.RenamePath, this, HTTP_METHOD_PUT, url, requestHeaders); op.execute(); return op; }</code><technical_language>this is replicated enough method, e.g maybeAppendSASToken(path, operation, querybuilder) if (authType=SAS) { appendSASTokenToQuery(path, SASTokenProvider.RENAME_SOURCE_OPERATION, queryBuilder); } needed</technical_language>

Target:
public AbfsRestOperation renamePath(String source, final String destination, final String continuation) throws AzureBlobFileSystemException { final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders(); final AbfsUriQueryBuilder srcQueryBuilder = new AbfsUriQueryBuilder(); appendSASTokenToQuery(source, SASTokenProvider.RENAME_SOURCE_OPERATION, srcQueryBuilder); String encodedRenameSource = urlEncode(FORWARD_SLASH + this.getFileSystem() + source); if (authType == AuthType.SAS) { encodedRenameSource += srcQueryBuilder.toString(); } LOG.trace("Rename source queryparam added {}", encodedRenameSource); requestHeaders.add(new AbfsHttpHeader(X_MS_RENAME_SOURCE, encodedRenameSource)); requestHeaders.add(new AbfsHttpHeader(IF_NONE_MATCH, STAR)); final AbfsUriQueryBuilder abfsUriQueryBuilder = createDefaultUriQueryBuilder(); abfsUriQueryBuilder.addQuery(QUERY_PARAM_CONTINUATION, continuation); appendSASTokenToQuery(destination, SASTokenProvider.RENAME_DESTINATION_OPERATION, abfsUriQueryBuilder); final URL url = createRequestUrl(destination, abfsUriQueryBuilder.toString()); final AbfsRestOperation op = new AbfsRestOperation( AbfsRestOperationType.RenamePath, this, HTTP_METHOD_PUT, url, requestHeaders); op.execute(); return op; }
Source:
<code>public void routerErrorCodeResolutionTest() throws Exception { blobId = new BlobId(BlobId.BLOB_ID_V6, BlobId.BlobIdType.NATIVE, ClusterMapUtils.UNKNOWN_DATACENTER_ID, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM), partition, false, BlobId.BlobDataType.DATACHUNK); blobIdString = blobId.getID(); LinkedHashMap<ServerErrorCode, RouterErrorCode> codesToSetAndTest = new LinkedHashMap<>(); codesToSetAndTest.put(ServerErrorCode.Blob_Authorization_Failure, RouterErrorCode.BlobAuthorizationFailure); codesToSetAndTest.put(ServerErrorCode.Blob_Expired, RouterErrorCode.BlobExpired); codesToSetAndTest.put(ServerErrorCode.Disk_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.IO_Error, RouterErrorCode.UnexpectedInternalError); doRouterErrorCodeResolutionTest(codesToSetAndTest); codesToSetAndTest.clear(); codesToSetAndTest.put(ServerErrorCode.Blob_Authorization_Failure, RouterErrorCode.BlobAuthorizationFailure); codesToSetAndTest.put(ServerErrorCode.Disk_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.Replica_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.Partition_Unknown, RouterErrorCode.UnexpectedInternalError); doRouterErrorCodeResolutionTest(codesToSetAndTest); <START> <END> blobId = new BlobId(BlobId.BLOB_ID_V6, BlobId.BlobIdType.NATIVE, clusterMap.getLocalDatacenterId(), Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM), partition, false, BlobId.BlobDataType.DATACHUNK); blobIdString = blobId.getID(); }</code><technical_language>need this code block here? accidentally copied</technical_language>

Target:
public void routerErrorCodeResolutionTest() throws Exception { LinkedHashMap<ServerErrorCode, RouterErrorCode> codesToSetAndTest = new LinkedHashMap<>(); codesToSetAndTest.put(ServerErrorCode.Blob_Authorization_Failure, RouterErrorCode.BlobAuthorizationFailure); codesToSetAndTest.put(ServerErrorCode.Blob_Expired, RouterErrorCode.BlobExpired); codesToSetAndTest.put(ServerErrorCode.Disk_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.IO_Error, RouterErrorCode.UnexpectedInternalError); doRouterErrorCodeResolutionTest(codesToSetAndTest); codesToSetAndTest.clear(); codesToSetAndTest.put(ServerErrorCode.Blob_Authorization_Failure, RouterErrorCode.BlobAuthorizationFailure); codesToSetAndTest.put(ServerErrorCode.Disk_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.Replica_Unavailable, RouterErrorCode.AmbryUnavailable); codesToSetAndTest.put(ServerErrorCode.Partition_Unknown, RouterErrorCode.UnexpectedInternalError); doRouterErrorCodeResolutionTest(codesToSetAndTest); }
Source:
<code>public void purgeUserLocation_shouldPurgeAUserLocation() throws Exception { <START> Assert.fail("Not yet implemented"); <END> }</code><technical_language>similar above; fix this tests fail</technical_language>

Target:
public void purgeUserLocation_shouldPurgeAUserLocation() throws Exception { MohCoreService cservice = Context.getService(MohCoreService.class); User sysUser = new User(); sysUser.setUserId(501); Location userLoc = new Location(); userLoc.setLocationId(1); UserLocation userlocation = new UserLocation(); userlocation.setSysUser(sysUser); userlocation.setUserLoc(userLoc); UserLocation uloc = cservice.saveUserLocation(userlocation); Integer userlocationid=uloc.getUserLocationId(); Assert.assertNotNull(userlocationid); cservice.purgeUserLocation(uloc); Assert.assertNull(cservice.getUserLocation(userlocationid)); }
Source:
<code><START> private void updateDefaultQuota() { <END> if (_oldStoragePool.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && getStoragePool().getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED) { Pair<Quota, Boolean> defaultQuotaPair = getQutoaHelper().getUnlimitedQuota(getStoragePool(), true, true); Quota defaultQuota = defaultQuotaPair.getFirst(); boolean isQuotaReused = defaultQuotaPair.getSecond(); if (isQuotaReused) { log.debugFormat("Reusing quota {0} as the default quota for Storage Pool {1}", defaultQuota.getId(), defaultQuota.getStoragePoolId()); } else { defaultQuota.setQuotaName(getQutoaHelper().getDefaultQuotaName(getStoragePool())); } getQutoaHelper().saveQuotaForUser(defaultQuota, MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID, isQuotaReused); } }</code><technical_language>is a matter of personal preference leave :) I a method isQuotaStausChangedToDisable() write if condition code easier read</technical_language>

Target:
private void updateDefaultQuota() { if (wasQuotaEnforcementDisabled()) { Pair<Quota, Boolean> defaultQuotaPair = getQutoaHelper().getUnlimitedQuota(getStoragePool(), true, true); Quota defaultQuota = defaultQuotaPair.getFirst(); boolean isQuotaReused = defaultQuotaPair.getSecond(); if (isQuotaReused) { log.debugFormat("Reusing quota {0} as the default quota for Storage Pool {1}", defaultQuota.getId(), defaultQuota.getStoragePoolId()); } else { defaultQuota.setQuotaName(getQutoaHelper().getDefaultQuotaName(getStoragePool())); } getQutoaHelper().saveQuotaForUser(defaultQuota, MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID, isQuotaReused); } }
Source:
<code>static ConsoleLauncherExecutionResult forSummary(TestExecutionSummary summary, CommandLineOptions options) { <START> return new ConsoleLauncherExecutionResult(summary, options); <END> }</code><technical_language>I a single constructor ConsoleLauncherExecutionResult(exitCode, summary), inline computeExitCode() forSummary, change unit tests forSummary. done in a subsequent commit/PR, though</technical_language>

Target:
static ConsoleLauncherExecutionResult forSummary(TestExecutionSummary summary, CommandLineOptions options) { int exitCode = computeExitCode(summary, options); return new ConsoleLauncherExecutionResult(exitCode, summary); }
Source:
<code>public Observable<ChangeNotification<Server>> resolvePeers(final ServiceType serviceType) { return clusterChangeObservable().map( new Func1<ChangeNotification<WriteServerAddress>, ChangeNotification<Server>>() { @Override public ChangeNotification<Server> call(ChangeNotification<WriteServerAddress> notification) { if (notification.getKind() == Kind.BufferSentinel) { return null; } WriteServerAddress data = notification.getData(); int port; switch (serviceType) { case Registration: port = data.getRegistrationPort(); break; case Interest: port = data.getDiscoveryPort(); break; <START> default: END> port = data.getReplicationPort(); } Server serverAddress = new Server(data.getHostName(), port); switch (notification.getKind()) { case Add: return new ChangeNotification<Server>(Kind.Add, serverAddress); case Modify: throw new IllegalStateException("Modify not expected"); case Delete: return new ChangeNotification<Server>(Kind.Delete, serverAddress); } return null; } }).filter(RxFunctions.filterNullValuesFunc()); }</code><technical_language>change code pattern explicitly check for cases defaults some sort of breaking error? Treating default a specific valid case potentially lead missed updates enum is added for example, lead non-deterministic behaviour</technical_language>

Target:
public Observable<ChangeNotification<Server>> resolvePeers(final ServiceType serviceType) { return clusterChangeObservable().map( new Func1<ChangeNotification<ClusterAddress>, ChangeNotification<Server>>() { @Override public ChangeNotification<Server> call(ChangeNotification<ClusterAddress> notification) { if (notification.getKind() == Kind.BufferSentinel) { return null; } ClusterAddress data = notification.getData(); int port; switch (serviceType) { case Registration: port = data.getRegistrationPort(); break; case Interest: port = data.getInterestPort(); break; case Replication: port = data.getReplicationPort(); break; default: throw new IllegalStateException("Unexpected enum value " + serviceType); } Server serverAddress = new Server(data.getHostName(), port); switch (notification.getKind()) { case Add: return new ChangeNotification<Server>(Kind.Add, serverAddress); case Modify: throw new IllegalStateException("Modify not expected"); case Delete: return new ChangeNotification<Server>(Kind.Delete, serverAddress); } return null; } }).filter(RxFunctions.filterNullValuesFunc()); }
Source:
<code>public void testGeometryGetObjectValue() throws Exception { Slice slice = GeoFunctions.stPoint(1.2, 3.4); int[] offsets = {0, slice.length()}; boolean[] valueIsNull = {false}; <START> VariableWidthBlock block = new VariableWidthBlock(1, slice, offsets, valueIsNull); <END> assertEquals("POINT (1.2 3.4)", GEOMETRY.getObjectValue(null, block, 0)); }</code><technical_language>Creating a block manually is generally a bad idea, in a test. Type create block: java BlockBuilder builder = GEOMETRY.createBlockBuilder(new BlockBuilderStatus(), 1); GEOMETRY.writeSlice(builder, slice); Block block = block.build();</technical_language>

Target:
public void testGeometryGetObjectValue() throws Exception { BlockBuilder builder = GEOMETRY.createBlockBuilder(new BlockBuilderStatus(), 1); GEOMETRY.writeSlice(builder, GeoFunctions.stPoint(1.2, 3.4)); Block block = builder.build(); assertEquals("POINT (1.2 3.4)", GEOMETRY.getObjectValue(null, block, 0)); }
Source:
<code>public int hashCode() { int hash = mLocation.hashCode(); hash = hash * 31 + mMessageId; <START> hash = hash * 31 + mSerialNumber; <END> return hash; }</code><technical_language>hash = mLocation.hashCode() + 5 * mMessageId + 7 * mSerialNumber;</technical_language>

Target:
public int hashCode() { return mLocation.hashCode() + 5 * mMessageId + 7 * mSerialNumber; }
Source:
<code>private void verifyAndOrRebuildIndex() throws IOException { if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == IndexTool.IndexVerifyType.NONE || verifyType == IndexTool.IndexVerifyType.NONE) { rebuildIndexRows(mutations); } if (verifyType == IndexTool.IndexVerifyType.NONE) { return; } if (verifyType == IndexTool.IndexVerifyType.BEFORE || verifyType == IndexTool.IndexVerifyType.BOTH || verifyType == IndexTool.IndexVerifyType.ONLY) { onlyVerify = true; parallelizeIndexVerify(); } if (verifyType == IndexTool.IndexVerifyType.BEFORE || verifyType == IndexTool.IndexVerifyType.BOTH) { mutations.clear(); for (Map.Entry<byte[], Put> entry: dataKeyToDataPutMap.entrySet()) { mutations.add(entry.getValue()); } rebuildIndexRows(mutations); } if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == IndexTool.IndexVerifyType.BOTH) { <START> onlyVerify = false; END> indexKeyToDataPutMap.clear(); parallelizeIndexVerify(); } indexKeyToDataPutMap.clear(); }</code><technical_language>if onlyVerify means "don't stop mismatch" rebuilds not, variable name is confusing</technical_language>

Target:
private void verifyAndOrRebuildIndex() throws IOException { if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == IndexTool.IndexVerifyType.NONE) { rebuildIndexRows(mutations); } if (verifyType == IndexTool.IndexVerifyType.NONE) { return; } if (verifyType == IndexTool.IndexVerifyType.BEFORE || verifyType == IndexTool.IndexVerifyType.BOTH || verifyType == IndexTool.IndexVerifyType.ONLY) { doNotFail = true; parallelizeIndexVerify(); } if (verifyType == IndexTool.IndexVerifyType.BEFORE || verifyType == IndexTool.IndexVerifyType.BOTH) { mutations.clear(); for (Map.Entry<byte[], Put> entry: dataKeyToDataPutMap.entrySet()) { mutations.add(entry.getValue()); } rebuildIndexRows(mutations); } if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == IndexTool.IndexVerifyType.BOTH) { doNotFail = false; indexKeyToDataPutMap.clear(); parallelizeIndexVerify(); } indexKeyToDataPutMap.clear(); }
Source:
<code>public void flushCommits() throws IOException { BufferedMutator bufMutator = connection.getBufferedMutator(this.tableName); for (ConcurrentLinkedQueue<Mutation> buffer : bPool) { for (Mutation m: buffer) { bufMutator.mutate(m); bufMutator.flush(); } } <START> bufMutator.close(); <END> }</code><technical_language>yeah I this well, this if millions of operations buffered, flush of one, this get tests pass. IMO bufMutator.flush() remain is, find out mutations get applied asynchronously call flush</technical_language>

Target:
public void flushCommits() throws IOException { BufferedMutator bufMutator = connection.getBufferedMutator(this.tableName); for (ConcurrentLinkedQueue<Mutation> buffer : bPool) { while (!buffer.isEmpty()) { Mutation m = buffer.poll(); bufMutator.mutate(m); } } bufMutator.flush(); bufMutator.close(); }
Source:
<code>public void testListPersonsLimit() { given().headers(getAuthHeaders()) .get("/persons/persons?firstResult=2&maxResults=3") .then() .statusCode(200) .body("id.size()", is(3)) .body("id[0]", is(3) ) .body("birthday[0]", is(getDate(1990, 1, 1).toString() )) <START> .body("sex[0]", is("FEMALE") ) <END> .body("socialSecurityNumber[0]", is("123456-7890") ) .body("secureInfo[0]", is(Boolean.FALSE) ) .body("id[1]", is(4) ) .body("birthday[1]", is(getDate(1990, 1, 1).toString() )) .body("sex[1]", is("MALE") ) .body("socialSecurityNumber[1]", is("01234567-8901") ) .body("secureInfo[1]", is(Boolean.FALSE) ); }</code><technical_language>Hardcored "enum-type" strings prone typos, symbolic constants</technical_language>

Target:
public void testListPersonsLimit() { given().headers(getAuthHeaders()) .get("/persons/persons?firstResult=2&maxResults=3") .then() .statusCode(200) .body("id.size()", is(3)) .body("id[0]", is(3) ) .body("birthday[0]", is(getDate(1990, 1, 1).toString() )) .body("sex[0]", is( Sex.FEMALE.name() ) ) .body("socialSecurityNumber[0]", is("123456-7890") ) .body("secureInfo[0]", is(Boolean.FALSE) ) .body("id[1]", is(4) ) .body("birthday[1]", is(getDate(1990, 1, 1).toString() )) .body("sex[1]", is( Sex.MALE.name() ) ) .body("socialSecurityNumber[1]", is("01234567-8901") ) .body("secureInfo[1]", is(Boolean.FALSE) ); }
Source:
<code>public Mono<T> cancelOperation() throws UnsupportedOperationException { if (this.cancelOperation == null) { throw logger.logExceptionAsError(new UnsupportedOperationException( "Cancel operation is not supported on this service/resource.")); } final PollResponse<T> response = this.pollResponse; if (response != null && response.getStatus() != OperationStatus.IN_PROGRESS) { return Mono.empty(); } <START> return this.cancelOperation.apply(this); <END> }</code><technical_language>if cancelOepration throws exception</technical_language>

Target:
public Mono<T> cancelOperation() { if (this.cancelOperation == null) { return Mono.error(logger.logExceptionAsError(new UnsupportedOperationException( "Cancel operation is not supported on this service/resource."))); } final PollResponse<T> response = this.pollResponse; if (response != null && response.getStatus() != OperationStatus.IN_PROGRESS) { return Mono.empty(); } return this.cancelOperation.apply(this); }
Source:
<code><START> public int hashCode() { <END> int prime = 31; int result = 1; result = prime * result + (isCall ? 1231 : 1237); long temp; temp = Double.doubleToLongBits(strike); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(timeToExpiry); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }</code><technical_language>This unnecessarily complicated. get Eclipse regenerate others</technical_language>

Target:
public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getStrike()); hash = hash * 31 + JodaBeanUtils.hashCode(getTimeToExpiry()); hash = hash * 31 + JodaBeanUtils.hashCode(getPutCall()); return hash; }