auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testExecuteBatchPreparedStatementFailSyntax() throws Exception { try (Connection conn = DriverManager.getConnection(connectionStr)) { PreparedStatement stmt = conn.prepareStatement("insert test (id, string_field) values (?, ?)"); stmt.setInt(1, 2); stmt.setString(2, "foo"); stmt.addBatch(); stmt.setInt(1, 3); stmt.setString(2, "bar"); stmt.addBatch(); stmt.setInt(1, 4); stmt.setString(2, "baz"); stmt.addBatch(); try { stmt.executeBatch(); fail("BatchUpdateException not thrown"); } catch (BatchUpdateException e) { assertArrayEquals( new int[]{Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED}, e.getUpdateCounts() ); } conn.createStatement().execute("refresh table test"); ResultSet resultSet = conn.createStatement().executeQuery("select count(*) from test"); assertThat(resultSet.next(), is(true)); assertThat(resultSet.getLong(1), is(1L)); } }

Target:
public void testExecuteBatchPreparedStatementFailSyntax() throws Exception { try (Connection conn = DriverManager.getConnection(connectionString)) { PreparedStatement stmt = conn.prepareStatement("insert test (id) values (?)"); stmt.setInt(1, 2); stmt.addBatch(); try { stmt.executeBatch(); fail("BatchUpdateException not thrown"); } catch (BatchUpdateException e) { assertArrayEquals(new int[]{Statement.EXECUTE_FAILED}, e.getUpdateCounts()); } conn.createStatement().execute("refresh table test"); ResultSet resultSet = conn.createStatement().executeQuery("select count(*) from test"); assertThat(resultSet.next(), is(true)); assertThat(resultSet.getLong(1), is(0L)); } }
Source:
public void destroy() { for (JettyHttpClient client : clients) { client.close(); } if (pool != null) { pool.close(); pool = null; if(injector.getExistingBinding(Key.get(MBeanExporter.class)) != null) { injector.getInstance(MBeanExporter.class) .unexport(generatedNameOf(QueuedThreadPoolMBean.class) + "_" + name); } } destroyed.set(true); }

Target:
public void destroy() { for (JettyHttpClient client : clients) { client.close(); } if (pool != null) { pool.close(); pool = null; } destroyed.set(true); }
Source:
public void actionPerformed(ActionEvent event) { Object o = event.getSource(); if (o == askButton || o == text) { String textFiltered = text.getText(); if (filter.isSelected()) { textFiltered = textFiltered.replace("'", " ").replace("-", " "); } send("getResponse", textFiltered); text.setText(""); response.setCaretPosition(response.getDocument().getLength()); } else if (o == startSessionButton) { String path = progABPath.getText().trim(); String user = userName.getText().trim(); String bot = botName.getText().trim(); swingGui.send(boundServiceName, "setPath", path); swingGui.send(boundServiceName, "reloadSession", path, user, bot, true); } else if (o == reloadSession) { swingGui.send(boundServiceName, "startSession", userName.getText().trim()); } else if (o == saveAIML) { swingGui.send(boundServiceName, "writeAIML"); swingGui.send(boundServiceName, "writeAIMLIF"); } else { log.info(o.toString()); log.info("Unknown action!"); } }

Target:
public void actionPerformed(ActionEvent event) { Object o = event.getSource(); String path = progABPath.getText().trim(); String user = userName.getText().trim(); String bot = null; if (botName.getItemCount() > 0) { bot = botName.getSelectedItem().toString(); } if (o == askButton || o == text) { String textFiltered = text.getText(); if (filter.isSelected()) { textFiltered = textFiltered.replace("'", " ").replace("-", " "); } send("getResponse", textFiltered); text.setText(""); response.setCaretPosition(response.getDocument().getLength()); } else if (o == startSession) { swingGui.send(boundServiceName, "setPath", path); swingGui.send(boundServiceName, "startSession", path, user, bot); } else if (o == reloadSession) { swingGui.send(boundServiceName, "reloadSession", user, bot); } else if (o == saveAIML) { swingGui.send(boundServiceName, "writeAIML"); swingGui.send(boundServiceName, "writeAIMLIF"); } else { log.info(o.toString()); log.info("Unknown action!"); } }
Source:
public ActivationKeyDTO updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, @ApiParam(name = "update", required = true) ActivationKeyDTO update) { ActivationKey toUpdate = this.fetchActivationKey(activationKeyId); if (update.getName() != null) { String keyName = update.getName() .replace("-", "0").replace("_", "0"); if (!keyName.matches("[a-zA-Z0-9]*")) { throw new BadRequestException( i18n.tr("The activation key name \"{0}\" must be alphanumeric or " + "include the characters \"-\" or \"_\"", update.getName())); } toUpdate.setName(update.getName()); } String serviceLevel = update.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner().getId(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (update.getReleaseVersion() != null) { toUpdate.setReleaseVer(new Release(update.getReleaseVersion())); } if (update.getDescription() != null) { toUpdate.setDescription(update.getDescription()); } if (update.getUsage() != null) { toUpdate.setUsage(update.getUsage()); } if (update.getRole() != null) { toUpdate.setRole(update.getRole()); } if (update.getAddOns() != null) { Set<String> addOns = new HashSet<>(); addOns.addAll(update.getAddOns()); toUpdate.setAddOns(addOns); } if (update.isAutoAttach() != null) { toUpdate.setAutoAttach(update.isAutoAttach()); } toUpdate = activationKeyCurator.merge(toUpdate); return this.translator.translate(toUpdate, ActivationKeyDTO.class); }

Target:
public ActivationKeyDTO updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, @ApiParam(name = "update", required = true) ActivationKeyDTO update) { ActivationKey toUpdate = this.fetchActivationKey(activationKeyId); if (update.getName() != null) { Matcher keyMatcher = AK_CHAR_FILTER.matcher(update.getName()); if (!keyMatcher.matches()) { throw new BadRequestException( i18n.tr("The activation key name \"{0}\" must be alphanumeric or " + "include the characters \"-\" or \"_\"", update.getName())); } toUpdate.setName(update.getName()); } String serviceLevel = update.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner().getId(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (update.getReleaseVersion() != null) { toUpdate.setReleaseVer(new Release(update.getReleaseVersion())); } if (update.getDescription() != null) { toUpdate.setDescription(update.getDescription()); } if (update.getUsage() != null) { toUpdate.setUsage(update.getUsage()); } if (update.getRole() != null) { toUpdate.setRole(update.getRole()); } if (update.getAddOns() != null) { Set<String> addOns = new HashSet<>(); addOns.addAll(update.getAddOns()); toUpdate.setAddOns(addOns); } if (update.isAutoAttach() != null) { toUpdate.setAutoAttach(update.isAutoAttach()); } toUpdate = activationKeyCurator.merge(toUpdate); return this.translator.translate(toUpdate, ActivationKeyDTO.class); }
Source:
private void initView(Context context) { setId(AndroidUtil.generateViewId()); View view = LayoutInflater.from(context).inflate(R.layout.media_layout, this); audioButton = view.findViewById(R.id.audio_button); videoButton = view.findViewById(R.id.video_button); textViewContainer = view.findViewById(R.id.question_text_container); videoView = view.findViewById(R.id.inline_video_view); qrView = view.findViewById(R.id.qr_view); imageView = view.findViewById(R.id.image); resizingImageView = view.findViewById(R.id.resizing_image); downloadIcon = view.findViewById(R.id.download_media_icon); progressBar = view.findViewById(R.id.progress_bar); missingMediaStatus = view.findViewById(R.id.missing_media_tv); divider = view.findViewById(R.id.divider); mediaLayoutBottomBarrier = view.findViewById(R.id.media_barrier); missingMediaBackground = view.findViewById(R.id.missing_media_background); }

Target:
private void initView(Context context) { setId(AndroidUtil.generateViewId()); View view = LayoutInflater.from(context).inflate(R.layout.media_layout, this); audioButton = view.findViewById(R.id.audio_button); videoButton = view.findViewById(R.id.video_button); textViewContainer = view.findViewById(R.id.question_text_container); videoView = view.findViewById(R.id.inline_video_view); qrView = view.findViewById(R.id.qr_view); imageView = view.findViewById(R.id.image); resizingImageView = view.findViewById(R.id.resizing_image); downloadIcon = view.findViewById(R.id.download_media_icon); progressBar = view.findViewById(R.id.progress_bar); missingMediaStatus = view.findViewById(R.id.missing_media_tv); divider = view.findViewById(R.id.divider); mediaLayoutBottomBarrier = view.findViewById(R.id.media_barrier); missingMediaBackground = view.findViewById(R.id.missing_media_background); questionBottomBarrier = view.findViewById(R.id.question_barrier); }
Source:
private void doButtonAction(boolean okPressed) { if (okPressed) { String newTagDisplayName = tagNameTextField.getText().trim(); String descriptionText = descriptionTextArea.getText(); if (newTagDisplayName.isEmpty()) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.title"), JOptionPane.ERROR_MESSAGE); return; } if (TagsManager.containsIllegalCharacters(newTagDisplayName)) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.title"), JOptionPane.ERROR_MESSAGE); return; } else if (descriptionText.contains(",") || descriptionText.contains(";")) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.title"), JOptionPane.ERROR_MESSAGE); return; } userTagDescription = descriptionTextArea.getText(); userTagDisplayName = newTagDisplayName; userTagIsNotable = notableCheckbox.isSelected(); result = BUTTON_PRESSED.OK; } else { result = BUTTON_PRESSED.CANCEL; } setVisible(false); }

Target:
private void doButtonAction(boolean okPressed) { if (okPressed) { String newTagDisplayName = tagNameTextField.getText().trim(); String descriptionText = descriptionTextArea.getText(); if (newTagDisplayName.isEmpty()) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.title"), JOptionPane.ERROR_MESSAGE); return; } if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.getStandardTagNames().contains(newTagDisplayName)) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.title"), JOptionPane.ERROR_MESSAGE); return; } else if (descriptionText.contains(",") || descriptionText.contains(";")) { JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.message"), NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagDescriptionIllegalCharacters.title"), JOptionPane.ERROR_MESSAGE); return; } userTagDescription = descriptionTextArea.getText(); userTagDisplayName = newTagDisplayName; userTagIsNotable = notableCheckbox.isSelected(); result = BUTTON_PRESSED.OK; } else { result = BUTTON_PRESSED.CANCEL; } setVisible(false); }
Source:
public void should_not_create_a_span_when_current_thread_should_be_ignored() throws ExecutionException, InterruptedException { String threadNameToIgnore = "^MyCustomThread.*$"; RxJavaPlugins.getInstance().registerSchedulersHook(new MyRxJavaSchedulersHook()); SleuthRxJavaSchedulersHook schedulersHook = new SleuthRxJavaSchedulersHook( this.tracer, this.traceKeys, Arrays.asList("HystixMetricPoller", threadNameToIgnore)); Future<Void> hello = executorService().submit((Callable<Void>) () -> { Action0 action = schedulersHook.onSchedule(() -> { caller = new StringBuilder("hello"); }); action.call(); return null; }); hello.get(); BDDMockito.then(this.tracer).should(never()).createSpan(anyString()); BDDMockito.then(this.tracer).should(never()).continueSpan(any()); }

Target:
public void should_not_create_a_span_when_current_thread_should_be_ignored() throws ExecutionException, InterruptedException { String threadNameToIgnore = "^MyCustomThread.*$"; RxJavaPlugins.getInstance().registerSchedulersHook(new MyRxJavaSchedulersHook()); SleuthRxJavaSchedulersHook schedulersHook = new SleuthRxJavaSchedulersHook( this.tracer, this.traceKeys, Collections.singletonList(threadNameToIgnore)); Future<Void> hello = executorService().submit((Callable<Void>) () -> { Action0 action = schedulersHook.onSchedule(() -> { caller = new StringBuilder("hello"); }); action.call(); return null; }); hello.get(); BDDMockito.then(this.tracer).should(never()).createSpan(anyString()); BDDMockito.then(this.tracer).should(never()).continueSpan(any()); }
Source:
public PageableResult search(RequestContext context) throws ResponseException { String tag = context.getRequest().getParameter("tag"); List<Location> locations = new ArrayList<Location>(); try { Context.addProxyPrivilege(PrivilegeConstants.VIEW_LOCATIONS); LocationTag locationTag = Context.getLocationService().getLocationTagByName(tag); if (locationTag == null) { locationTag = Context.getLocationService().getLocationTagByUuid(tag); } if (locationTag != null) { locations = Context.getLocationService().getLocationsByTag(locationTag); } } finally { Context.removeProxyPrivilege(PrivilegeConstants.VIEW_LOCATIONS); } return new NeedsPaging<Location>(locations, context); }

Target:
public PageableResult search(RequestContext context) throws ResponseException { String tag = context.getRequest().getParameter("tag"); List<Location> locations = new ArrayList<Location>(); try { Context.addProxyPrivilege(PrivilegeConstants.VIEW_LOCATIONS); LocationTag locationTag = Context.getLocationService().getLocationTagByUuid(tag); if (locationTag == null) { locationTag = Context.getLocationService().getLocationTagByName(tag); } if (locationTag != null) { locations = Context.getLocationService().getLocationsByTag(locationTag); } } finally { Context.removeProxyPrivilege(PrivilegeConstants.VIEW_LOCATIONS); } return new NeedsPaging<Location>(locations, context); }
Source:
public void patchReplacePasswordWithToken() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .withPassword(password) .build(); String newPassword = "newpassword"; context.restoreAuthSystemState(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/password", newPassword); ops.add(replaceOperation); String patchBody = getPatchContent(ops); accountService.sendRegistrationInfo(context, ePerson.getEmail()); String tokenForEPerson = registrationDataService.findByEmail(context, ePerson.getEmail()).getToken(); String token = getAuthToken(admin.getEmail(), password); PasswordHash oldPassword = ePersonService.getPasswordHash(ePerson); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON) .param("token", tokenForEPerson)) .andExpect(status().isOk()); PasswordHash newPasswordHash = ePersonService.getPasswordHash(ePerson); assertFalse(oldPassword.equals(newPasswordHash)); assertTrue(registrationDataService.findByEmail(context, ePerson.getEmail()) == null); context.turnOffAuthorisationSystem(); registrationDataService.deleteByToken(context, tokenForEPerson); context.restoreAuthSystemState(); }

Target:
public void patchReplacePasswordWithToken() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .withPassword(password) .build(); String newPassword = "newpassword"; context.restoreAuthSystemState(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/password", newPassword); ops.add(replaceOperation); String patchBody = getPatchContent(ops); accountService.sendRegistrationInfo(context, ePerson.getEmail()); String tokenForEPerson = registrationDataService.findByEmail(context, ePerson.getEmail()).getToken(); PasswordHash oldPassword = ePersonService.getPasswordHash(ePerson); getClient().perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON) .param("token", tokenForEPerson)) .andExpect(status().isOk()); PasswordHash newPasswordHash = ePersonService.getPasswordHash(ePerson); assertNotEquals(oldPassword, newPasswordHash); assertTrue(registrationDataService.findByEmail(context, ePerson.getEmail()) == null); assertNull(registrationDataService.findByToken(context, tokenForEPerson)); }
Source:
public static String[] splitKeyword(String keyword) { Pattern p = Pattern.compile(String.format("([^\\%s\\%s]+)(\\%s|\\%s)([^\\%s\\%s]*)", EXCLUSIVE_DELIMITER, NONEXCLUSIVE_DELIMITER, EXCLUSIVE_DELIMITER, NONEXCLUSIVE_DELIMITER, EXCLUSIVE_DELIMITER, NONEXCLUSIVE_DELIMITER)); Matcher m = p.matcher(keyword); if (m.find()) return new String[] {m.group(1), m.group(2), m.group(3)}; return new String[] {"", "", keyword}; }

Target:
private static String[] splitKeyword(String keyword) { Pattern p = Pattern.compile(GROUP_PATTERN); Matcher m = p.matcher(keyword); if (!m.find()) return new String[] {"", "", keyword}; return new String[] {m.group(1), m.group(2), m.group(3)}; }
Source:
public void testCallbackQueryFailureHandling() { final AsyncResult<QueryResult> res = new AsyncResult<>(); this.influxDB.query(new Query("SHOW SERRIES"), res.resultConsumer, res.errorConsumer); Assertions.assertThrows(InfluxDBException.class, res::result, "Malformed query should throw InfluxDBException"); }

Target:
public void testCallbackQueryFailureHandling() throws Throwable { final AsyncResult<QueryResult> res = new AsyncResult<>(); this.influxDB.query(new Query("SHOW SERRIES"), res.resultConsumer, res.errorConsumer); try{ res.result(); Assertions.fail("Malformed query should throw InfluxDBException"); } catch (InfluxDBException e){ Pattern errorPattern = Pattern.compile("Bad Request.*error parsing query: found SERRIES, expected.*", Pattern.DOTALL); Assertions.assertTrue(errorPattern.matcher(e.getMessage()).matches(), "Error string \"" + e.getMessage() + "\" does not match error pattern"); } }
Source:
public void assertSimilarity( final BufferedImage actualImage, final double maxDistance) throws IOException { if (this.generateExpectedImages) { ImageIO.write(actualImage, "png", this.expectedPath); return; } final File actualOutput = new File(this.expectedPath.getParentFile(), (this.expectedPath.getName().contains("expected") ? this.expectedPath.getName().replace("expected", "actual") : "actual-" + this.expectedPath.getName()) .replace(".tiff", ".png")); if (!this.expectedPath.exists()) { ImageIO.write(actualImage, "png", expectedPath); throw new AssertionError("The expected file was missing and has been generated: " + actualOutput.getAbsolutePath()); } final double distance = calcDistance(actualImage); if (distance > maxDistance) { ImageIO.write(actualImage, "png", actualOutput); throw new AssertionError(String.format("similarity difference between images is: %s which is " + "greater than the max distance of %s%n" + "actual=%s%n" + "expected=%s", distance, maxDistance, actualOutput.getAbsolutePath(), this.expectedPath.getAbsolutePath())); } }

Target:
public void assertSimilarity( final BufferedImage actualImage, final double maxDistance) throws IOException { final File actualOutput = getRelatedFile("actual"); if (!this.expectedPath.exists()) { ImageIO.write(actualImage, "png", expectedPath); throw new AssertionError("The expected file was missing and has been generated: " + actualOutput.getAbsolutePath()); } final double distance = calcDistance(actualImage); if (distance > maxDistance) { ImageIO.write(actualImage, "png", actualOutput); throw new AssertionError(String.format("similarity difference between images is: %s which is " + "greater than the max distance of %s%n" + "actual=%s%n" + "expected=%s", distance, maxDistance, actualOutput.getAbsolutePath(), this.expectedPath.getAbsolutePath())); } }
Source:
private void showDaysOfMonth() { int row = 0; int column = 0; for(int i = 1; i < 32; i++) { if(i%7 == 1 && i != 1) { row++; column = 0; } daysOfMonth.setWidget(row, column, new Label(Integer.toString(i))); daysOfMonth.getCellFormatter().getElement(row, column).addClassName("normalFlexTableCell"); clickedMap.put(i, false); column++; } Label widget = new Label("Last Day"); daysOfMonth.setWidget(row, column, widget); daysOfMonth.getFlexCellFormatter().setColSpan(row, column, 4); clickedMap.put(32, false); wrapperPanel.add(daysOfMonth); }

Target:
private void showDaysOfMonth() { int row = 0; int column = 0; for (int i = 1; i < LAST_DAY; i++) { if (i % DAYS_IN_WEEK == 1 && i != 1) { row++; column = 0; } daysOfMonth.setWidget(row, column, new Label(Integer.toString(i))); daysOfMonth.getCellFormatter().getElement(row, column).addClassName("normalFlexTableCell"); clickedMap.put(i, false); column++; } Label widget = new Label(constants.lastDay()); daysOfMonth.setWidget(row, column, widget); daysOfMonth.getFlexCellFormatter().setColSpan(row, column, 4); clickedMap.put(LAST_DAY, false); wrapperPanel.add(daysOfMonth); }
Source:
public void eval(Object rowKey) throws IOException { Result result = table.get(readHelper.createGet(rowKey)); if (!result.isEmpty()) { collect(serde.convertToRow(result)); } }

Target:
public void eval(Object rowKey) throws IOException { Get get = serde.createGet(rowKey); if (get != null) { Result result = table.get(get); if (!result.isEmpty()) { collect(serde.convertToRow(result)); } } }
Source:
public void calculate() { zoombarHeight = calculate(ZoomBarView.ZOOM_BAR_FACTOR, getHeight()); sidebarWidth = calculate(SideBarView.SIDEBAR_FACTOR, getWidth()); }

Target:
public void calculate() { zoombarHeight = calculate(ZoomBarView.ZOOMBAR_FACTOR, getHeight()); sidebarWidth = calculate(SideBarView.SIDEBAR_FACTOR, getWidth()); }
Source:
private Map<T, Double> normalize() { if (isNormalised) return normalised; Map<T, Double> temp = createMapDataStructure(); double sum = 0; for (Entry<T, Double> entry : map.entrySet()) { final Double p = entry.getValue(); if (p != null) { sum += p; } } for (Entry<T, Double> entry : temp.entrySet()) { final T t = entry.getKey(); final Double p = entry.getValue(); if (p != null) { temp.put(t, p / sum); } } normalised = temp; isNormalised = true; return temp; }

Target:
private Map<T, Double> normalize() { if (isNormalised) return normalised; Map<T, Double> temp = createMapDataStructure(); double sum = 0; for (Entry<T, Double> entry : map.entrySet()) { Double p = entry.getValue(); if (p != null) { sum += p; } } for (Entry<T, Double> entry : temp.entrySet()) { T t = entry.getKey(); Double p = entry.getValue(); if (p != null) { temp.put(t, p / sum); } } normalised = temp; isNormalised = true; return temp; }
Source:
private void parseGenotype(String genotype) { String[] alleles = genotypePattern.split(genotype, -1); this.code = alleles.length > 1 ? AllelesCode.ALLELES_OK : AllelesCode.HAPLOID; this.allelesIdx = new int[alleles.length]; for (int i = 0; i < alleles.length; i++) { String allele = alleles[i]; if (allele.equals(".") || allele.equals("-1")) { this.code = AllelesCode.ALLELES_MISSING; this.allelesIdx[i] = -1; } else { if (StringUtils.isNumeric(allele)) { this.allelesIdx[i] = Integer.parseInt(allele); } else { if (allele.equalsIgnoreCase(reference)) { this.allelesIdx[i] = 0; } else if (allele.equalsIgnoreCase(alternate)) { this.allelesIdx[i] = 1; } else { if (allele.isEmpty()) { System.out.println("Empty allele: REF=" + reference + ",ALT=" + alternate); } this.allelesIdx[i] = 2; } } if (allelesIdx[i] > 1) { this.code = AllelesCode.MULTIPLE_ALTERNATES; } } } }

Target:
private void parseGenotype(String genotype) { String[] alleles = genotypePattern.split(genotype, -1); this.code = alleles.length > 1 ? AllelesCode.ALLELES_OK : AllelesCode.HAPLOID; this.allelesIdx = new int[alleles.length]; for (int i = 0; i < alleles.length; i++) { String allele = alleles[i]; if (allele.equals(".") || allele.equals("-1")) { this.code = AllelesCode.ALLELES_MISSING; this.allelesIdx[i] = -1; } else { Integer alleleParsed = Ints.tryParse(allele); if (alleleParsed != null) { this.allelesIdx[i] = alleleParsed; } else { if (allele.equalsIgnoreCase(reference)) { this.allelesIdx[i] = 0; } else if (allele.equalsIgnoreCase(alternate)) { this.allelesIdx[i] = 1; } else { if (allele.isEmpty()) { logger.error("Empty allele: REF=" + reference + ",ALT=" + alternate); } this.allelesIdx[i] = 2; } } if (allelesIdx[i] > 1) { this.code = AllelesCode.MULTIPLE_ALTERNATES; } } } }
Source:
@Override public String toString() { return new StringBuilder().append(type) .append(" Affected object: ") .append(objectName) .append(" Timestamp: ") .append(df.format(timestamp)) .append(" User: ") .append(user) .append(" Additional information: ") .append(extraInfo) .toString(); }

Target:
@Override public String toString() { return new StringBuilder().append(type) .append(" Affected object: \"") .append(objectName) .append("\" Timestamp: \"") .append(df.format(timestamp)) .append("\" User: \"") .append(user) .append("\" Additional information: \"") .append(extraInfo) .append("\"") .toString(); }
Source:
public RqChunk(final Request req) { super( new RqOf( req::head, () -> RqChunk.cap(req) ) ); }

Target:
public RqChunk(final Request req) { super( new RequestOf( req::head, () -> RqChunk.cap(req) ) ); }
Source:
public long skip(long n) { if (n > 0) { long skip = bytes.length - pos; if (skip < pos) skip = n; pos += skip; return skip; } else { int idx = Math.min(bytes.length, pos); long skip = idx + n; pos = (int) (skip + offset); return skip; } }

Target:
public long skip(long n) { if (n > 0) { long skip = bytes.length - pos; if (skip > n) skip = n; pos += skip; return skip; } else { int idx = Math.min(bytes.length, pos); long skip = idx + n; pos = (int) (skip + offset); return skip; } }
Source:
public void testSnippetContent() throws GitLabApiException { Snippet snippet = createSnippet( new Snippet("Snippet 1", "Snippet.java", "System.out.println(\"\");")); SnippetsApi api = gitLabApi.getSnippetApi(); String snippetContent = api.getSnippetContent(snippet.getId()); assertEquals("System.out.println(\"\");", snippetContent); deleteSnippet(snippet); }

Target:
public void testSnippetContent() throws GitLabApiException { Snippet snippet = createSnippet( new Snippet(TEST_SNIPPET_TITLE_1, TEST_SNIPPET_FILE_NAME_1, TEST_SNIPPET_CONTENT_1)); SnippetsApi api = gitLabApi.getSnippetApi(); String snippetContent = api.getSnippetContent(snippet.getId()); assertEquals(TEST_SNIPPET_CONTENT_1, snippetContent); deleteSnippet(snippet); }
Source:
private boolean removeVmsInPool() { List<VM> vmsInPool = DbFacade.getInstance().getVmDao().getAllForVmPool(getVmPoolId()); VdcReturnValueBase result; for (VM vm : vmsInPool) { if (!vm.isDown()) { return false; } result = runInternalActionWithTasksContext( VdcActionType.RemoveVmFromPool, new RemoveVmFromPoolParameters(vm.getId())); if (!result.getSucceeded()) { return false; } result = runInternalAction( VdcActionType.RemoveVm, withRootCommandInfo(new RemoveVmParameters(vm.getId(), false), getActionType()), createRemoveVmStepContext(vm.getName())); if (!result.getSucceeded()) { return false; } } return true; }

Target:
private boolean removeVmsInPool() { VdcReturnValueBase result; for (VM vm : getVmsInPool()) { RemoveVmFromPoolParameters removeVmFromPoolParameters = new RemoveVmFromPoolParameters(vm.getId()); removeVmFromPoolParameters.setTransactionScopeOption(TransactionScopeOption.Suppress); result = runInternalActionWithTasksContext( VdcActionType.RemoveVmFromPool, removeVmFromPoolParameters); if (!result.getSucceeded()) { return false; } result = runInternalAction( VdcActionType.RemoveVm, withRootCommandInfo(new RemoveVmParameters(vm.getId(), false), getActionType()), createRemoveVmStepContext(vm)); if (!result.getSucceeded()) { return false; } } return true; }
Source:
public void run() { Job job = new Job(ifJobName) { @Override protected IStatus run(IProgressMonitor monitor) { TimeGraphControl ctrl = getTimeGraphViewer().getTimeGraphControl(); ITimeGraphEntry traceEntry = ctrl.getSelectedTrace(); long ts = ctrl.getTimeDataProvider().getSelectionBegin(); ITmfTimestamp ts2 = TmfTraceManager.getInstance().getCurrentTraceContext().getSelectionRange().getStartTime(); ITimeEvent selectedState = Utils.findEvent(traceEntry, ts, 0); if (selectedState == null) { return Status.OK_STATUS; } ITimeGraphEntry entry = selectedState.getEntry(); if (!(entry instanceof ControlFlowEntry)) { return Status.OK_STATUS; } ControlFlowEntry cfEntry = (ControlFlowEntry) entry; int tid = cfEntry.getThreadId(); ITmfTrace trace = cfEntry.getTrace(); ITmfContext ctx = trace.seekEvent(ts2); long rank = ctx.getRank(); ctx.dispose(); Predicate<@NonNull ITmfEvent> predicate = event -> { Integer eventTid = KernelTidAspect.INSTANCE.resolve(event); return (eventTid != null && eventTid.intValue() == tid); }; ITmfEvent event = (ifDirection ? TmfTraceUtils.getNextEventMatching(cfEntry.getTrace(), rank, predicate, monitor) : TmfTraceUtils.getPreviousEventMatching(cfEntry.getTrace(), rank, predicate, monitor)); if (event != null) { TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, event.getTimestamp())); } return Status.OK_STATUS; } }; job.setRule(fSearchActionMutexRule); job.schedule(); }

Target:
public void run() { Job job = new Job(ifJobName) { @Override protected IStatus run(IProgressMonitor monitor) { TimeGraphControl ctrl = getTimeGraphViewer().getTimeGraphControl(); ITimeGraphEntry traceEntry = ctrl.getSelectedTrace(); long ts = getTimeGraphViewer().getSelectionBegin(); ITimeEvent selectedState = Utils.findEvent(traceEntry, ts, 0); if (selectedState == null) { return Status.OK_STATUS; } ITimeGraphEntry entry = selectedState.getEntry(); if (!(entry instanceof ControlFlowEntry)) { return Status.OK_STATUS; } ControlFlowEntry cfEntry = (ControlFlowEntry) entry; int tid = cfEntry.getThreadId(); ITmfTrace trace = cfEntry.getTrace(); ITmfContext ctx = trace.seekEvent(TmfTimestamp.fromNanos(ts)); long rank = ctx.getRank(); ctx.dispose(); Predicate<@NonNull ITmfEvent> predicate = event -> { Integer eventTid = KernelTidAspect.INSTANCE.resolve(event); return (eventTid != null && eventTid.intValue() == tid); }; ITmfEvent event = (ifDirection ? TmfTraceUtils.getNextEventMatching(cfEntry.getTrace(), rank, predicate, monitor) : TmfTraceUtils.getPreviousEventMatching(cfEntry.getTrace(), rank, predicate, monitor)); if (event != null) { TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, event.getTimestamp())); } return Status.OK_STATUS; } }; job.setRule(fSearchActionMutexRule); job.schedule(); }
Source:
public static <A> Show<A> showS(final F<A, String> f) { return new Show<A>(a -> fromString(f.f(a))); }

Target:
public static <A> Show<A> showS(final F<A, String> f) { return show(a -> fromString(f.f(a))); }
Source:
public KeyframeRequester(int mediaSenderSSRC) { super(FIR_RETRY_INTERVAL_MS); this.mediaSenderSSRC = mediaSenderSSRC; this.sequenceNumber = new AtomicInteger(0); this.remainingRetries = 0; }

Target:
public KeyframeRequester(int mediaSenderSSRC) { super(FIR_RETRY_INTERVAL_MS); this.mediaSenderSSRC = mediaSenderSSRC; this.remainingRetries = 0; }
Source:
public void testSetTtlTimeProvider() throws Exception { AbstractStreamOperatorTestHarness<Integer> result; AbstractStreamOperator operator = new AbstractStreamOperator<Integer>() {}; result = new AbstractStreamOperatorTestHarness<>( operator, 1, 1, 0); result.config.setStateKeySerializer(IntSerializer.INSTANCE); long expectedTimeStamp = 42; result.setTtlTimeProvider(() -> expectedTimeStamp); result.initializeState(new OperatorSubtaskState()); result.open(); Assert.assertEquals(expectedTimeStamp, ((AbstractKeyedStateBackend<?>) operator.getKeyedStateBackend()).getTtlTimeProvider().currentTimestamp()); }

Target:
public void testSetTtlTimeProvider() throws Exception { AbstractStreamOperator<Integer> operator = new AbstractStreamOperator<Integer>() {}; try (AbstractStreamOperatorTestHarness<Integer> result = new AbstractStreamOperatorTestHarness<>( operator, 1, 1, 0)) { result.config.setStateKeySerializer(IntSerializer.INSTANCE); Time timeToLive = Time.hours(1); result.initializeState(new OperatorSubtaskState()); result.open(); ValueStateDescriptor<Integer> stateDescriptor = new ValueStateDescriptor<>("test", IntSerializer.INSTANCE); stateDescriptor.enableTimeToLive(StateTtlConfig.newBuilder(timeToLive).build()); KeyedStateBackend<Integer> keyedStateBackend = operator.getKeyedStateBackend(); ValueState<Integer> state = keyedStateBackend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor); int expectedValue = 42; keyedStateBackend.setCurrentKey(1); result.setStateTtlProcessingTime(0L); state.update(expectedValue); Assert.assertEquals(expectedValue, (int) state.value()); result.setStateTtlProcessingTime(timeToLive.toMilliseconds() + 1); Assert.assertNull(state.value()); } }
Source:
private void setNumericTimestamp(Timestamp value, Calendar cal) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(isNull(), "setNumericTimestamp called when already set"); } if (value != null) { if( cal == null) { cal = localCal.get(); } setValue(computeEncodedDate(value, cal), computeEncodedTime(value, cal), value.getNanos()); } }

Target:
private void setNumericTimestamp(Timestamp value, Calendar cal) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(isNull(), "setNumericTimestamp called when already set"); } if (value != null) { if( cal == null) { cal = SQLDate.GREGORIAN_CALENDAR.get(); } setValue(computeEncodedDate(value, cal), computeEncodedTime(value, cal), value.getNanos()); } }
Source:
public void addFences(List<Fence> newFences) throws Throwable { if (sourceImmutablePolicy == null) { throw new Throwable("Source Policy is null cannot add fences"); } ArrayList<Fence> fences = new ArrayList<>(); if (sourceImmutablePolicy.getFences() != null) { fences.addAll(sourceImmutablePolicy.getFences()); } fences.addAll(newFences); if (sourceImmutablePolicy instanceof MethodAmountPolicy) { sourceImmutablePolicy = new MethodAmountPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, ((MethodAmountPolicy) sourceImmutablePolicy).getAmount()); } else if (sourceImmutablePolicy instanceof FactorsPolicy) { FactorsPolicy factorsPolicy = (FactorsPolicy) sourceImmutablePolicy; sourceImmutablePolicy = new FactorsPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, factorsPolicy.isInherenceRequired(), factorsPolicy.isKnowledgeRequired(), factorsPolicy.isPossessionRequired()); } else if (sourceImmutablePolicy instanceof ConditionalGeoFencePolicy) { sourceImmutablePolicy = new ConditionalGeoFencePolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, ((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInPolicy(), ((ConditionalGeoFencePolicy) sourceImmutablePolicy).getOutPolicy()); } else { throw new Throwable("Source Policy is of unknown type"); } }

Target:
public void addFences(List<Fence> newFences) throws Throwable { if (sourceImmutablePolicy == null) { throw new Throwable("Source Policy is null and cannot add fences"); } ArrayList<Fence> fences = new ArrayList<>(); if (sourceImmutablePolicy.getFences() != null) { fences.addAll(sourceImmutablePolicy.getFences()); } fences.addAll(newFences); if (sourceImmutablePolicy instanceof MethodAmountPolicy) { sourceImmutablePolicy = new MethodAmountPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, ((MethodAmountPolicy) sourceImmutablePolicy).getAmount()); } else if (sourceImmutablePolicy instanceof FactorsPolicy) { FactorsPolicy factorsPolicy = (FactorsPolicy) sourceImmutablePolicy; sourceImmutablePolicy = new FactorsPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, factorsPolicy.isInherenceRequired(), factorsPolicy.isKnowledgeRequired(), factorsPolicy.isPossessionRequired()); } else if (sourceImmutablePolicy instanceof ConditionalGeoFencePolicy) { sourceImmutablePolicy = new ConditionalGeoFencePolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), fences, ((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInside(), ((ConditionalGeoFencePolicy) sourceImmutablePolicy).getOutside()); } else { throw new Throwable("Source Policy is of unknown type"); } }
Source:
private List<Long> getMutatedGenes() { List<Long> mutatedGenes = new ArrayList<Long>(); config.getChromosomeLength(); for (int i = 0; i < config.getChromosomeLength(); i++) { mutatedGenes.add(selectGene(i)); } return mutatedGenes; }

Target:
private List<Long> getMutatedGenes() { List<Long> mutatedGenes = new ArrayList<Long>(); config.getChromosomeLength(); for (int i = 0; i < config.getChromosomeLength(); i++) mutatedGenes.add(selectGene(i)); return mutatedGenes; }
Source:
public synchronized void stateChanged(TaskStatus newStatus) { long currentUserMemory = newStatus.getMemoryReservation().toBytes(); long currentSystemMemory = newStatus.getSystemMemoryReservation().toBytes(); long deltaUserMemoryInBytes = currentUserMemory - previousUserMemory; long deltaSystemMemoryInBytes = currentSystemMemory - previousSystemMemory; previousUserMemory = currentUserMemory; previousSystemMemory = currentSystemMemory; stateMachine.updateMemoryUsage(deltaUserMemoryInBytes, deltaSystemMemoryInBytes); }

Target:
public synchronized void stateChanged(TaskStatus newStatus) { long currentUserMemory = newStatus.getMemoryReservation().toBytes(); long currentSystemMemory = newStatus.getSystemMemoryReservation().toBytes(); stateMachine.updateMemoryUsage(currentUserMemory, currentSystemMemory); }
Source:
public void verifyFollowedArticle(String articleName){ waitForElementByXPath(" PageObjectLogging.log("verifyFollowedArticle", articleName + "is visible on followed list", true, driver); }

Target:
public void verifyFollowedArticle(String articleName) { waitForElementByXPath(" PageObjectLogging.log("verifyFollowedArticle", articleName + "is visible on followed list", true); }
Source:
public PrimeVaccinationScheduleDto createOrUpdateWithDto(PrimeVaccinationScheduleDto dto, Boolean ignoreLimitation) { VisitBookingDetails primeDetails = visitBookingDetailsDataService.findById(dto.getVisitBookingDetailsId()); VisitBookingDetails screeningDetails = getScreeningDetails(primeDetails); if (primeDetails == null || screeningDetails == null) { throw new IllegalArgumentException("Cannot save, because details for Visit not found"); } Clinic clinic = primeDetails.getClinic(); if (clinic != null && !ignoreLimitation) { checkNumberOfPatients(dto, clinic); } if (!dto.getIgnoreDateLimitation()) { validateDate(dto); } return new PrimeVaccinationScheduleDto(updateVisitWithDto(primeDetails, screeningDetails, dto)); }

Target:
public PrimeVaccinationScheduleDto createOrUpdateWithDto(PrimeVaccinationScheduleDto dto, Boolean ignoreLimitation) { VisitBookingDetails primeDetails = visitBookingDetailsDataService.findById(dto.getVisitBookingDetailsId()); VisitBookingDetails screeningDetails = getScreeningDetails(primeDetails); if (primeDetails == null || screeningDetails == null) { throw new IllegalArgumentException("Cannot save, because details for Visit not found"); } Clinic clinic = primeDetails.getClinic(); validateDate(dto); if (clinic != null && !ignoreLimitation) { checkNumberOfPatients(dto, clinic); } return new PrimeVaccinationScheduleDto(updateVisitWithDto(primeDetails, screeningDetails, dto)); }
Source:
private void checkNotOverlappingRules(Rule first, Rule second) { BinaryComparisonOperator fFirst = (BinaryComparisonOperator) first.getFilter(); BinaryComparisonOperator fSecond; if (second.getFilter() instanceof And) fSecond = (BinaryComparisonOperator) ((And) second.getFilter()).getChildren().get(0); else fSecond = (BinaryComparisonOperator) second.getFilter(); assertTrue(fFirst.getExpression2().equals(fSecond.getExpression2())); assertFalse(fSecond instanceof PropertyIsGreaterThanOrEqualTo); }

Target:
private void checkNotOverlappingRules(Rule first, Rule second) throws IOException { SimpleFeatureType ft = (SimpleFeatureType) getCatalog().getFeatureTypeByName("ClassificationPoints2").getFeatureType(); SimpleFeature feature = DataUtilities.createFeature(ft, "=1|2.0|POINT(4 2.5)"); assertTrue(first.getFilter().evaluate(feature)); assertFalse(second.getFilter().evaluate(feature)); }
Source:
public DataSourceDto(DataSource dataSource, DataFeed dataFeed) { dataSourceId = dataSource.getId(); dataSourceName = dataSource.getName(); description = dataSource.getDescription(); tagIds = getTagIds(dataSource.getTags()); tags = getTagNames(dataSource.getTags()); timestamp = dataSource.getTimestamp(); type = dataSource.getType(); typeConfig = dataSource.getTypeConfig(); if (dataFeed != null) { dataFeedName = dataFeed.getName(); parserId = dataFeed.getParserId(); dataFeedType = dataFeed.getType(); } }

Target:
public DataSourceDto(DataSource dataSource, DataFeed dataFeed) { dataSourceId = dataSource.getId(); dataSourceName = dataSource.getName(); description = dataSource.getDescription(); tags = getTagNames(dataSource.getTags()); timestamp = dataSource.getTimestamp(); type = dataSource.getType(); typeConfig = dataSource.getTypeConfig(); if (dataFeed != null) { dataFeedName = dataFeed.getName(); parserId = dataFeed.getParserId(); dataFeedType = dataFeed.getType(); } }
Source:
public T signalNext(T element) throws InterruptedException { sendNext(element); return element; }

Target:
private T signalNext(T element) throws InterruptedException { sendNext(element); return element; }
Source:
private static void createDirectoryIfNonExistent(String fileDirectory) throws IOException { File directory = new File(fileDirectory); boolean directoryExists = directory.exists() && directory.isDirectory(); if (!directoryExists) { if (directory.mkdirs()) { logger.info("Directory created: " + directory.toString()); } else { logger.error("Could not create file directory"); throw new IOException(); } } }

Target:
private static void createDirectoryIfNonExistent(String fileDirectory) throws IOException { File directory = new File(fileDirectory); boolean isDirectoryExists = directory.exists() && directory.isDirectory(); if (isDirectoryExists) { return; } boolean isMkdirsSuccessful = directory.mkdirs(); if (isMkdirsSuccessful) { logger.info("Directory created: " + directory.toString()); return; } logger.error("Could not create file directory"); throw new IOException("Could not create file directory"); }
Source:
private ClusterSetup(Builder builder) throws IOException, InvalidRoutingDataException { switch (builder._realmMode) { case MULTI_REALM: _zkClient = new FederatedZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig); break; case SINGLE_REALM: _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder._realmAwareZkConnectionConfig.createZkConnectionConfig(), builder._realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder._realmMode); } _admin = new ZKHelixAdmin(_zkClient); _usesExternalZkClient = false; }

Target:
private ClusterSetup(Builder builder) { switch (builder._realmMode) { case MULTI_REALM: try { _zkClient = new FederatedZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig.setZkSerializer(new ZNRecordSerializer())); break; } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Failed to create ClusterSetup!", e); } case SINGLE_REALM: _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder._zkAddress), builder._realmAwareZkClientConfig.createHelixZkClientConfig() .setZkSerializer(new ZNRecordSerializer())); break; default: throw new HelixException("Invalid RealmMode given: " + builder._realmMode); } _admin = new ZKHelixAdmin(_zkClient); _usesExternalZkClient = false; }
Source:
public void before(){ browser.navigate().refresh(); Graphene.goTo(DataSourcesMetricsPage.class); browser.manage().window().maximize(); Console.withBrowser(browser).waitUntilLoaded(); }

Target:
public void before(){ browser.navigate().refresh(); Graphene.goTo(DataSourcesMetricsPage.class); Console.withBrowser(browser).maximizeWindow().waitUntilLoaded(); }
Source:
public CaffeineCache(final Cache<NamedKey, byte[]> cache, CaffeineCacheConfig config) { this.cache = cache; this.config = config; }

Target:
private CaffeineCache(final Cache<NamedKey, byte[]> cache, CaffeineCacheConfig config) { this.cache = cache; this.config = config; }
Source:
private BlobReadOptions getUndeletedBlobReadOptions(IndexValue value, StoreKey key, ConcurrentSkipListMap<Offset, IndexSegment> indexSegments) throws StoreException { IndexValue putValue = findKey(key, new FileSpan(getStartOffset(indexSegments), value.getOffset()), EnumSet.of(IndexEntryType.PUT), indexSegments); if (putValue != null) { return new BlobReadOptions(log, putValue.getOffset(), new MessageInfo(key, putValue.getSize(), false, value.isFlagSet(IndexValue.Flags.Ttl_Update_Index), true, value.getExpiresAtMs(), null, putValue.getAccountId(), putValue.getContainerId(), putValue.getOperationTimeInMs(), value.getLifeVersion())); } else { throw new StoreException("Did not find PUT index entry for key [" + key + "] when there is an undelete entry", StoreErrorCodes.ID_Not_Found); } }

Target:
private BlobReadOptions getUndeletedBlobReadOptions(IndexValue value, StoreKey key, ConcurrentSkipListMap<Offset, IndexSegment> indexSegments) throws StoreException { IndexValue putValue = findKey(key, new FileSpan(getStartOffset(indexSegments), value.getOffset()), EnumSet.of(IndexEntryType.PUT), indexSegments); if (putValue != null) { return new BlobReadOptions(log, putValue.getOffset(), new MessageInfo(key, putValue.getSize(), false, value.isTTLUpdate(), true, value.getExpiresAtMs(), null, putValue.getAccountId(), putValue.getContainerId(), putValue.getOperationTimeInMs(), value.getLifeVersion())); } else { throw new StoreException("Did not find PUT index entry for key [" + key + "] when there is an undelete entry", StoreErrorCodes.ID_Not_Found); } }
Source:
private void pauseTopicManagerPartitions(Collection<TopicPartition> topicManagerPartitions) { if (null == topicManagerPartitions || topicManagerPartitions.isEmpty()) { return; } _consumer.pause(topicManagerPartitions); for (TopicPartition tp : topicManagerPartitions) { _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata(() -> _topicManager.shouldUnPausePartition(tp), PausedSourcePartitionMetadata.Reason.TOPIC_NOT_CREATED)); } _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); }

Target:
private void pauseTopicManagerPartitions(Collection<TopicPartition> topicManagerPartitions) { if (null == topicManagerPartitions || topicManagerPartitions.isEmpty()) { return; } _consumer.pause(topicManagerPartitions); for (TopicPartition tp : topicManagerPartitions) { _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata(() -> _topicManager.shouldResumePartition(tp), PausedSourcePartitionMetadata.Reason.TOPIC_NOT_CREATED)); } }