auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(1)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { String shorturl = RedirectUnshortener.unShorten(m.group(1)); text = m.replaceFirst(" <LINK_0>" + shorturl + " "); continue; } } catch (Throwable e) { e.printStackTrace(); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }

Target:
public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { e.printStackTrace(); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { String shorturl = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" <LINK_0>" + shorturl + " "); continue; } } catch (Throwable e) { e.printStackTrace(); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }
Source:
private void checkAndMaybeComplete() { if (operationTracker.isDone() || operationCompleted) { if (operationTracker.hasSucceeded()) { operationException.set(null); } else if (operationTracker.hasFailedOnNotFound()) { operationException.set(new RouterException("", RouterErrorCode.BlobDoesNotExist)); } operationCompleted = true; } }

Target:
private void checkAndMaybeComplete() { if (operationTracker.isDone() || operationCompleted) { if (operationTracker.hasSucceeded()) { operationException.set(null); } else if (operationTracker.hasFailedOnNotFound()) { operationException.set(new RouterException("DeleteOperation failed because of BlobNotFound", RouterErrorCode.BlobDoesNotExist)); } operationCompleted = true; } }
Source:
private void locationChanged(Item item, String oldName, String newName) { if (item instanceof AbstractProject) { AbstractProject p = Jenkins.getInstance().getItemByFullName(newName, AbstractProject.class); if (p != null) { RunList<? extends Run> builds = p.getBuilds(); for (Run build : builds) { Collection<Fingerprint> fingerprints = build.getBuildFingerprints(); for (Fingerprint f : fingerprints) { try { f.rename(oldName, newName); } catch (IOException e) { logger.log(Level.WARNING, "Failed to update fingerprint record " + f.getFileName() + " when " + oldName + " was renamed to " + newName, e); } } } } } }

Target:
private void locationChanged(Item item, String oldName, String newName) { if (item instanceof Job) { Job p = Jenkins.getInstance().getItemByFullName(newName, Job.class); if (p != null) { RunList<? extends Run> builds = p.getBuilds(); for (Run build : builds) { Collection<Fingerprint> fingerprints = build.getBuildFingerprints(); for (Fingerprint f : fingerprints) { try { f.rename(oldName, newName); } catch (IOException e) { logger.log(Level.WARNING, "Failed to update fingerprint record " + f.getFileName() + " when " + oldName + " was renamed to " + newName, e); } } } } } }
Source:
public MaintenanceConfiguration convert(MaintenanceRequest request) { MaintenanceConfiguration.Builder builder = new MaintenanceConfiguration.Builder(); ofNullable(request.archiveWorkflows).ifPresent(config -> apply(config, builder.withArchiveWorkflows())); ofNullable(request.deleteArchivedWorkflows).ifPresent(config -> apply(config, builder.withDeleteArchivedWorkflows())); ofNullable(request.deleteWorkflows).ifPresent(config -> apply(config, builder.withDeleteWorkflows())); return builder.build(); }

Target:
public MaintenanceConfiguration convert(MaintenanceRequest request) { MaintenanceConfiguration.Builder builder = new MaintenanceConfiguration.Builder(); apply(request.archiveWorkflows, builder::withArchiveWorkflows); apply(request.deleteArchivedWorkflows, builder::withDeleteArchivedWorkflows); apply(request.deleteWorkflows, builder::withDeleteWorkflows); return builder.build(); }
Source:
public static Object[] provideQueryContexts() { return new Object[] { QUERY_CONTEXT_DEFAULT, new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .build(), new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .build(), new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .build(), }; }

Target:
public static Object[] provideQueryContexts() { return new Object[] { QUERY_CONTEXT_DEFAULT, new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, true) .build(), new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .build(), new ImmutableMap.Builder<String, Object>() .putAll(QUERY_CONTEXT_DEFAULT) .put(QueryContexts.JOIN_FILTER_REWRITE_ENABLE_KEY, false) .build(), }; }
Source:
protected void persistTestData() throws IOException, HttpRequestFailedException { DataBundle dataBundle = loadDataBundle(getJsonDataPath()); String responseBody = ""; responseBody = BackDoor.removeAndRestoreDataBundle(dataBundle); String pathToResultFile = createFileAndDirectory(TestProperties.LNP_TEST_DATA_FOLDER, getJsonDataPath()); String jsonValue = JsonUtils.parse(responseBody).getAsJsonObject().get("message").getAsString(); try (BufferedWriter bw = Files.newBufferedWriter(Paths.get(pathToResultFile))) { bw.write(jsonValue); bw.flush(); } }

Target:
protected void persistTestData() throws IOException, HttpRequestFailedException { DataBundle dataBundle = loadDataBundle(getJsonDataPath()); String responseBody = ""; responseBody = BackDoor.removeAndRestoreDataBundle(dataBundle); String pathToResultFile = createFileAndDirectory(TestProperties.LNP_TEST_DATA_FOLDER, getJsonDataPath()); String jsonValue = JsonUtils.parse(responseBody).getAsJsonObject().get("message").getAsString(); FileHelper.saveFile(pathToResultFile, jsonValue); }
Source:
public static Method getMethodIfAvailable(Class<?> clazz, String methodName, @Nullable Class<?>... paramTypes) { Assert.notNull(clazz, "Class must not be null"); Assert.notNull(methodName, "Method name must not be null"); if (paramTypes == null) { return findSingleMethod(clazz, methodName); } Method[] methods = clazz.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && Arrays.equals(method.getParameterTypes(), paramTypes)) { return method; } } return null; }

Target:
public static Method getMethodIfAvailable(Class<?> clazz, String methodName, @Nullable Class<?>... paramTypes) { Assert.notNull(clazz, "Class must not be null"); Assert.notNull(methodName, "Method name must not be null"); if (paramTypes == null) { return findSingleMethod(clazz, methodName); } Method[] methods = clazz.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && method.getParameterCount() == paramTypes.length && Arrays.equals(method.getParameterTypes(), paramTypes)) { return method; } } return null; }
Source:
public double pidGet() { if (pidSource == PIDSourceType.kDisplacement) { return getDistance(); } else { return getRate(); } }

Target:
public double pidGet() { try { return pidGetSafely(); } catch (InvalidSensorException e) { LogKitten.e(e); return 0.0; } }
Source:
public void shouldListAllUsers() { when(userDao.listAll()).thenReturn(Arrays.asList(user, anotherUser)); controller.list(); assertEquals(Arrays.asList(user, anotherUser), result.included().get("users")); }

Target:
public void shouldListAllUsers() { when(userDao.listAll()).thenReturn(Arrays.asList(user, anotherUser)); controller.list(); assertThat((List<User>)result.included().get("users"), contains(user, anotherUser)); }
Source:
protected void refNameSelected(String refName) { boolean tagSelected = refName != null && refName.startsWith(Constants.R_TAGS); boolean branchSelected = refName != null && (refName.startsWith(Constants.R_HEADS) || refName .startsWith(Constants.R_REMOTES)); Button okButton = getButton(Window.OK); if (((TreeSelection) branchTree.getSelection()).size() > 1) { TreeSelection selection = (TreeSelection) branchTree .getSelection(); renameButton.setEnabled(false); deleteButton .setEnabled(onlyBranchesExcludingCurrentAreSelected(selection)); newButton.setEnabled(false); } else { okButton.setEnabled(branchSelected || tagSelected); renameButton.setEnabled(branchSelected && !tagSelected); deleteButton.setEnabled(branchSelected && !tagSelected && !isCurrentBranch(refName)); newButton.setEnabled(true); } if (BranchOperationUI.checkoutWillShowQuestionDialog(refName)) okButton.setText(UIText.CheckoutDialog_OkCheckoutWithQuestion); else okButton.setText(UIText.CheckoutDialog_OkCheckout); okButton.setEnabled(!isCurrentBranch(refName)); }

Target:
protected void refNameSelected(String refName) { boolean tagSelected = refName != null && refName.startsWith(Constants.R_TAGS); boolean branchSelected = refName != null && (refName.startsWith(Constants.R_HEADS) || refName .startsWith(Constants.R_REMOTES)); Button okButton = getButton(Window.OK); if (((TreeSelection) branchTree.getSelection()).size() > 1) { TreeSelection selection = (TreeSelection) branchTree .getSelection(); renameButton.setEnabled(false); deleteButton .setEnabled(onlyBranchesExcludingCurrentAreSelected(selection)); newButton.setEnabled(false); okButton.setEnabled(false); } else { renameButton.setEnabled(branchSelected && !tagSelected); deleteButton.setEnabled(branchSelected && !tagSelected && !isCurrentBranch(refName)); newButton.setEnabled(true); okButton.setEnabled((branchSelected || tagSelected) && !isCurrentBranch(refName)); } if (BranchOperationUI.checkoutWillShowQuestionDialog(refName)) okButton.setText(UIText.CheckoutDialog_OkCheckoutWithQuestion); else okButton.setText(UIText.CheckoutDialog_OkCheckout); }
Source:
private SnapshotComparer() { options = new Options(); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(leftOption) .withDescription("the left snapshot file") .withArgName("LEFT") .withType(File.class) .create("l")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(rightOption) .withDescription("the right snapshot file") .withArgName("RIGHT") .withType(File.class) .create("r")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(byteThresholdOption) .withDescription("the node data delta size threshold, in bytes, for printing the node") .withArgName("BYTETHRESHOLD") .withType(File.class) .create("b")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(nodeThresholdOption) .withDescription("the descendant node delta size threshold, in nodes, for printing the node") .withArgName("NODETHRESHOLD") .withType(String.class) .create("n")); options.addOption( OptionBuilder .hasArg() .withLongOpt(debugOption) .withDescription("use debug output") .withArgName("DEBUG") .withType(String.class) .create("d")); options.addOption( OptionBuilder .hasArg() .withLongOpt(interactiveOption) .withDescription("interactive mode") .withArgName("INTERACTIVE") .withType(String.class) .create("i")); }

Target:
private SnapshotComparer() { options = new Options(); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(leftOption) .withDescription("(Required) The left snapshot file.") .withArgName("LEFT") .withType(File.class) .create("l")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(rightOption) .withDescription("(Required) The right snapshot file.") .withArgName("RIGHT") .withType(File.class) .create("r")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(byteThresholdOption) .withDescription("(Required) The node data delta size threshold, in bytes, for printing the node.") .withArgName("BYTETHRESHOLD") .withType(String.class) .create("b")); options.addOption( OptionBuilder .hasArg() .isRequired(true) .withLongOpt(nodeThresholdOption) .withDescription("(Required) The descendant node delta size threshold, in nodes, for printing the node.") .withArgName("NODETHRESHOLD") .withType(String.class) .create("n")); options.addOption("d", debugOption, false, "Use debug output."); options.addOption("i", interactiveOption, false, "Enter interactive mode."); }
Source:
private List<Pair<Resource, Member>> getAffectedMemberResourceObjects(PerunSessionImpl perunSession, User user, Facility facility) throws InternalErrorException { List<Pair<Resource, Member>> listOfAffectedObjects = new ArrayList<>(); List<Resource> assignedResources = perunSession.getPerunBl().getFacilitiesManagerBl().getAssignedResources(perunSession, facility); List<Member> userMembers = perunSession.getPerunBl().getMembersManagerBl().getMembersByUser(perunSession, user); for(Resource resource: assignedResources) { List<Member> assignedMembers = perunSession.getPerunBl().getResourcesManagerBl().getAssignedMembers(perunSession, resource); for(Member member: userMembers) { if(assignedMembers.contains(member)) { listOfAffectedObjects.add(new Pair(resource, member)); break; } } } return listOfAffectedObjects; }

Target:
private List<Pair<Resource, Member>> getAffectedMemberResourceObjects(PerunSessionImpl perunSession, User user, Facility facility) throws InternalErrorException { List<Pair<Resource, Member>> listOfAffectedObjects = new ArrayList<>(); List<Resource> assignedResources = perunSession.getPerunBl().getFacilitiesManagerBl().getAssignedResources(perunSession, facility); for(Resource resource: assignedResources) { List<Member> assignedMembers = perunSession.getPerunBl().getResourcesManagerBl().getAssignedMembers(perunSession, resource); for(Member member: assignedMembers) { if(member.getUserId() == user.getId()) { listOfAffectedObjects.add(new Pair(resource, member)); break; } } } return listOfAffectedObjects; }
Source:
private void finishAndReportAsync(Map<OperatorID, OperatorSnapshotFutures> snapshotFutures, CheckpointMetaData metadata, CheckpointMetrics metrics) { final Future<?> channelWrittenFuture; if (unalignedCheckpointEnabled) { ChannelStateWriteResult writeResult = channelStateWriter.getWriteResult(metadata.getCheckpointId()); channelWrittenFuture = writeResult.getJointFuture() .whenComplete((dummy, ex) -> channelStateWriter.notifyCheckpointComplete(metadata.getCheckpointId())); } else { channelWrittenFuture = FutureUtils.completedVoidFuture(); } executorService.execute(new AsyncCheckpointRunnable( snapshotFutures, metadata, metrics, channelWrittenFuture, System.nanoTime(), taskName, closeableRegistry, env, asyncExceptionHandler)); }

Target:
private void finishAndReportAsync(Map<OperatorID, OperatorSnapshotFutures> snapshotFutures, CheckpointMetaData metadata, CheckpointMetrics metrics) { final Future<?> channelWrittenFuture; if (unalignedCheckpointEnabled) { ChannelStateWriteResult writeResult = channelStateWriter.getWriteResult(metadata.getCheckpointId()); channelWrittenFuture = CompletableFuture.allOf( writeResult.getInputChannelStateHandles(), writeResult.getResultSubpartitionStateHandles()) .whenComplete((dummy, ex) -> channelStateWriter.stop(metadata.getCheckpointId())); } else { channelWrittenFuture = FutureUtils.completedVoidFuture(); } executorService.execute(new AsyncCheckpointRunnable( snapshotFutures, metadata, metrics, channelWrittenFuture, System.nanoTime(), taskName, closeableRegistry, env, asyncExceptionHandler)); }
Source:
public void writeAstyanaxReadDatastax() throws Exception { astyanaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(0)); astyanaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(1)); astyanaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(2)); astyanaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(3)); Set<Locator> excessEnums = datastaxExcessEnumIO.getExcessEnumMetrics(); String excessEnumLocators = ""; for ( Iterator<Locator> it = excessEnums.iterator(); it.hasNext(); ) { excessEnumLocators += it.next().toString() + ","; } assertTrue("excess enum does not contain " + testLocators.get(0), excessEnumLocators.contains(testLocators.get(0).toString())); assertTrue("excess enum does not contain " + testLocators.get(1), excessEnumLocators.contains(testLocators.get(1).toString())); assertTrue("excess enum does not contain " + testLocators.get(2), excessEnumLocators.contains(testLocators.get(2).toString())); assertTrue("excess enum does not contain " + testLocators.get(3), excessEnumLocators.contains(testLocators.get(3).toString())); }

Target:
public void writeAstyanaxReadDatastax() throws Exception { for (Locator testLocator : testLocators) { astyanaxExcessEnumIO.insertExcessEnumMetric(testLocator); } Set<Locator> excessEnums = datastaxExcessEnumIO.getExcessEnumMetrics(); assertEquals("Unexpected number of excessEnums", testLocators.size(), excessEnums.size()); for (Locator expectedLocator : testLocators) { assertTrue("excess enum does not contain " + expectedLocator, excessEnums.contains(expectedLocator)); } }
Source:
protected boolean contains(ArrayContainer arrayContainer) { final int cardinality = getCardinality(); final int runCount = numberOfRuns(); if (arrayContainer.getCardinality() > cardinality) { return false; } int ia = 0, ir = 0; while(ia < arrayContainer.getCardinality() && ir < runCount) { int start = getValue(ir); int stop = start + toIntUnsigned(getLength(ir)); if(arrayContainer.content[ia] < start) { return false; } else if (arrayContainer.content[ia] > stop) { ++ir; } else { ++ia; } } return ia == arrayContainer.getCardinality(); }

Target:
protected boolean contains(ArrayContainer arrayContainer) { final int cardinality = getCardinality(); final int runCount = numberOfRuns(); if (arrayContainer.getCardinality() > cardinality) { return false; } int ia = 0, ir = 0; while(ia < arrayContainer.getCardinality() && ir < runCount) { int start = toIntUnsigned(this.getValue(ir)); int stop = start + toIntUnsigned(getLength(ir)); int ac = toIntUnsigned(arrayContainer.content[ia]); if(ac < start) { return false; } else if (ac > stop) { ++ir; } else { ++ia; } } return ia == arrayContainer.getCardinality(); }
Source:
public final Field getLookupFieldByName(String name) { for (Field field : getFields()) { if (StringUtils.equals(name, field.getName())) { return field; } } LOGGER.info("Can't get field with name {}", name); return null; }

Target:
public final Field getLookupFieldByName(String name) { for (Field field : getFields()) { if (StringUtils.equals(name, field.getName())) { return field; } } LOGGER.warn("Can't get field with name {}", name); return null; }
Source:
private void setColor() { this.textColor.setValue(this.color); this.smallIcon.getValue().setColorFilter(color, PorterDuff.Mode.SRC_ATOP); for (int i = 0; i < this.actionImage.getValue().size(); i++) { this.actionImage.getValue().get(i).setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } }

Target:
private void setColor() { this.textColor.setValue(this.color); if (this.smallIcon.getValue() != null) { this.smallIcon.getValue().setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } if (this.actionImages.getValue() != null) { for (int i = 0; i < this.actionImages.getValue().size(); i++) { this.actionImages.getValue().get(i).setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } } }
Source:
public ApplicationMail getMailById(PerunSession sess, Integer id) throws ApplicationMailNotExistsException, PrivilegeException { ApplicationMail mail; try { List<ApplicationMail> mails = jdbc.query("select id,app_type,form_id,mail_type,send from application_mails where id=?", (resultSet, arg1) -> new ApplicationMail(resultSet.getInt("id"), AppType.valueOf(resultSet.getString("app_type")), resultSet.getInt("form_id"), MailType.valueOf(resultSet.getString("mail_type")), resultSet.getBoolean("send")), id); if (mails.size() != 1) { log.error("[MAIL MANAGER] Wrong number of mail definitions returned by unique params, expected 1 but was: {}.", mails.size()); throw new ApplicationMailNotExistsException("Wrong number of mail definitions returned by unique params, expected 1 but was: "+mails.size()); } mail = mails.get(0); } catch (EmptyResultDataAccessException ex) { throw new InternalErrorException("Mail definition with ID="+id+" doesn't exists."); } List<MailText> texts; try { texts = jdbc.query(MAIL_TEXTS_SELECT_BY_MAIL_ID, (resultSet, arg1) -> new MailText(new Locale(resultSet.getString("locale")), resultSet.getString("subject"), resultSet.getString("text")), mail.getId()); } catch (EmptyResultDataAccessException ex) { log.error("[MAIL MANAGER] Mail do not contains any text message.", ex); return mail; } for (MailText text : texts) { mail.getMessage().put(text.getLocale(), text); } return mail; }

Target:
public ApplicationMail getMailById(PerunSession sess, Integer id) throws ApplicationMailNotExistsException { ApplicationMail mail; try { List<ApplicationMail> mails = jdbc.query("select id,app_type,form_id,mail_type,send from application_mails where id=?", (resultSet, arg1) -> new ApplicationMail(resultSet.getInt("id"), AppType.valueOf(resultSet.getString("app_type")), resultSet.getInt("form_id"), MailType.valueOf(resultSet.getString("mail_type")), resultSet.getBoolean("send")), id); if (mails.size() > 1) { log.error("[MAIL MANAGER] Wrong number of mail definitions returned by unique params, expected 1 but was: {}.", mails.size()); throw new ConsistencyErrorException("Wrong number of mail definitions returned by unique params, expected 1 but was: "+mails.size()); } mail = mails.get(0); } catch (EmptyResultDataAccessException ex) { throw new ApplicationMailNotExistsException("Mail definition with ID="+id+" doesn't exists."); } List<MailText> texts; try { texts = jdbc.query(MAIL_TEXTS_SELECT_BY_MAIL_ID, (resultSet, arg1) -> new MailText(new Locale(resultSet.getString("locale")), resultSet.getString("subject"), resultSet.getString("text")), mail.getId()); } catch (EmptyResultDataAccessException ex) { log.error("[MAIL MANAGER] Mail do not contains any text message.", ex); return mail; } for (MailText text : texts) { mail.getMessage().put(text.getLocale(), text); } return mail; }
Source:
public void setItems(final Collection value, final Guid storageDomainId) { Frontend.getInstance().runQuery(VdcQueryType.GetAllVms, new VdcQueryParametersBase(), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { vms = ((VdcQueryReturnValue) returnValue).getReturnValue(); List<ImportVmData> vmDataList = new ArrayList<>(); for (VM vm : (Iterable<VM>) value) { ImportVmData vmData = new ImportVmData(vm); if (vms.contains(vm)) { vmData.setExistsInSystem(true); vmData.getClone().setEntity(true); vmData.getClone().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .importVMThatExistsInSystemMustClone()); vmData.getClone().setIsChangable(false); } else { vms.add(vm); } vmDataList.add(vmData); } ImportVmFromExportDomainModel.super.setItems(vmDataList); doInit(storageDomainId); } })); }

Target:
public void setItems(final Collection value, final Guid storageDomainId) { Frontend.getInstance().runQuery(VdcQueryType.Search, new SearchParameters(createSearchPattern(value), SearchType.VM), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VM> vms = ((VdcQueryReturnValue) returnValue).getReturnValue(); Set<String> existingNames = new HashSet<>(); for (VM vm : vms) { existingNames.add(vm.getName()); } List<ImportVmData> vmDataList = new ArrayList<>(); for (VM vm : (Iterable<VM>) value) { ImportVmData vmData = new ImportVmData(vm); if (vms.contains(vm)) { vmData.setExistsInSystem(true); vmData.getClone().setEntity(true); vmData.getClone().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .importVMThatExistsInSystemMustClone()); vmData.getClone().setIsChangable(false); } if (!vmData.getClone().getEntity() && existingNames.contains(vm.getName())) { vmData.setError(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason()); } vmDataList.add(vmData); } ImportVmFromExportDomainModel.super.setItems(vmDataList); doInit(storageDomainId); } })); }
Source:
private static File getFromHomeDir (String subDir) { Function<Path, Boolean> createDirIfNotExists = path -> { try { if (!Files.exists(path)) Files.createDirectory(path); return true; } catch (IOException e) return false; }; Path path = Paths.get(Constant.getZapHome(), subDir); Boolean pathExists = createDirIfNotExists.apply(path); if (pathExists && Files.isDirectory(path) && Files.isWritable(path)) { return path.toFile(); } return Model.getSingleton().getOptionsParam().getUserDirectory(); }

Target:
private static File getFromHomeDir (String subDir) { Path path = Paths.get(Constant.getZapHome(), subDir); try { if (Files.notExists(path)) { Files.createDirectory(path); } } catch (IOException e) if (Files.isDirectory(path) && Files.isWritable(path)) { return path.toFile(); } return Model.getSingleton().getOptionsParam().getUserDirectory(); }
Source:
private BinaryContent getBinaryContentFromZip(String filePath) throws CatalogTransformerException { BinaryContent binaryContent; try { File zipFile = new File(filePath); InputStream fileInputStream = new ZipInputStream(new FileInputStream(zipFile)); binaryContent = new BinaryContentImpl(fileInputStream); jarSigner.signJar( zipFile, System.getProperty(SystemBaseUrl.EXTERNAL_HOST), System.getProperty("javax.net.ssl.keyStorePassword"), System.getProperty("javax.net.ssl.keyStore"), System.getProperty("javax.net.ssl.keyStorePassword")); } catch (FileNotFoundException e) { throw new CatalogTransformerException("Unable to get ZIP file from ZipInputStream.", e); } return binaryContent; }

Target:
private BinaryContent getBinaryContentFromZip(String filePath) throws CatalogTransformerException { BinaryContent binaryContent; InputStream fileInputStream; File zipFile = new File(filePath); try { fileInputStream = new ZipInputStream(new FileInputStream(zipFile)); binaryContent = new BinaryContentImpl(fileInputStream); } catch (FileNotFoundException e) { throw new CatalogTransformerException("Unable to get ZIP file from ZipInputStream.", e); } jarSigner.signJar( zipFile, AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SystemBaseUrl.EXTERNAL_HOST)), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); return binaryContent; }
Source:
private void removeCinderVolume() { CinderDisk cinderSnapshotForRemove = (CinderDisk) getDiskImageDao().getSnapshotById(getParameters().getImageId()); cinderSnapshotForRemove.setActive(false); getImageDao().update(cinderSnapshotForRemove.getImage()); removeDescendentSnapshots(cinderSnapshotForRemove); removeCinderVolume(cinderSnapshotForRemove.getStorageIds().get(0), 0); }

Target:
private void removeCinderVolume() { CinderDisk cinderSnapshotToRemove = (CinderDisk) getDiskImageDao().getSnapshotById(getParameters().getImageId()); cinderSnapshotToRemove.setActive(false); getImageDao().update(cinderSnapshotToRemove.getImage()); removeDescendentSnapshots(cinderSnapshotToRemove); removeCinderVolume(cinderSnapshotToRemove.getStorageIds().get(0), 0); }
Source:
public GenericShuffleProducer construct(Server server) throws MyriaApiException { int numCells = 1; for (int d : hyperCubeDimensions) { numCells = numCells * d; } for (int[] partition : cellPartition) { for (int cellId : partition) { if (cellId >= getRealWorkerIds().size()) { throw new MyriaApiException(Status.BAD_REQUEST, "cellId in cellPartition must be smaller than worker number " + getRealWorkerIds().size() + "( " + cellId + " is found)"); } } } MFMDHashPartitionFunction pf = new MFMDHashPartitionFunction(cellPartition.length, hyperCubeDimensions, hashedColumns, mappedHCDimensions); return new GenericShuffleProducer(null, MyriaUtils.getSingleElement(getRealOperatorIds()), cellPartition, MyriaUtils.integerCollectionToIntArray(server.getAliveWorkers(numCells)), pf); }

Target:
public GenericShuffleProducer construct(Server server) throws MyriaApiException { int numCells = 1; for (int d : hyperCubeDimensions) { numCells = numCells * d; } for (int[] partition : cellPartition) { for (int cellId : partition) { Preconditions.checkElementIndex(cellId, getRealWorkerIds().size()); } } MFMDHashPartitionFunction pf = new MFMDHashPartitionFunction(cellPartition.length, hyperCubeDimensions, hashedColumns, mappedHCDimensions); return new GenericShuffleProducer(null, MyriaUtils.getSingleElement(getRealOperatorIds()), cellPartition, MyriaUtils.integerCollectionToIntArray(server.getRandomWorkers(numCells)), pf); }
Source:
public void prepareBuffers() { if (nullsBuffer == null) { nullsBuffer = new byte[DEFAULT_MAX_ELEMENT_COUNT / 8]; } nullsBufferIndex = ARRAY_BYTE_BASE_OFFSET; if (offsetsBuffer == null) { offsetsBuffer = new byte[DEFAULT_MAX_ELEMENT_COUNT * Integer.BYTES]; } offsetsBufferIndex = ARRAY_BYTE_BASE_OFFSET; rawBlockBuffer.prepareBuffers(); }

Target:
protected void prepareBuffers() { if (nullsBuffer == null) { nullsBuffer = new byte[DEFAULT_MAX_ELEMENT_COUNT / ARRAY_BYTE_INDEX_SCALE]; } nullsBufferIndex = ARRAY_BYTE_BASE_OFFSET; if (offsetsBuffer == null) { offsetsBuffer = new byte[DEFAULT_MAX_ELEMENT_COUNT * ARRAY_LONG_INDEX_SCALE]; } offsetsBufferIndex = ARRAY_BYTE_BASE_OFFSET; rawBlockBuffer.prepareBuffers(); }
Source:
private static JsonArray getClientCertificateContentAndMetaData(List<ClientCertificateDTO> clientCertificateDTOs, String certDirectoryPath) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); JsonArray certificatesList = new JsonArray(); clientCertificateDTOs.forEach(metadataDTO -> { ByteArrayInputStream certificate = null; try { String certificateContent = metadataDTO.getCertificate(); String certificateContentEncoded = APIConstants.BEGIN_CERTIFICATE_STRING .concat(certificateContent).concat("\n") .concat(APIConstants.END_CERTIFICATE_STRING); CommonUtil.writeFile(certDirectoryPath + File.separator + metadataDTO.getAlias() + ".crt", certificateContentEncoded); metadataDTO.setCertificate(metadataDTO.getAlias() + ".crt"); JsonObject certificateMetadata = (JsonObject) gson.toJsonTree(metadataDTO); certificatesList.add(certificateMetadata); } catch (APIImportExportException e) { log.error("Error while writing the certificate content. For alias: " + metadataDTO.getAlias(), e); } finally { if (certificate != null) { IOUtils.closeQuietly(certificate); } } }); return certificatesList; }

Target:
private static JsonArray getClientCertificateContentAndMetaData(List<ClientCertificateDTO> clientCertificateDTOs, String certDirectoryPath) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); JsonArray certificatesList = new JsonArray(); clientCertificateDTOs.forEach(metadataDTO -> { try { String certificateContent = metadataDTO.getCertificate(); String certificateContentEncoded = APIConstants.BEGIN_CERTIFICATE_STRING .concat(certificateContent).concat("\n") .concat(APIConstants.END_CERTIFICATE_STRING); CommonUtil.writeFile(certDirectoryPath + File.separator + metadataDTO.getAlias() + ".crt", certificateContentEncoded); metadataDTO.setCertificate(metadataDTO.getAlias() + ".crt"); JsonObject certificateMetadata = (JsonObject) gson.toJsonTree(metadataDTO); certificatesList.add(certificateMetadata); } catch (APIImportExportException e) { log.error("Error while writing the certificate content. For alias: " + metadataDTO.getAlias(), e); } }); return certificatesList; }
Source:
public void setUp() throws IOException { MockitoAnnotations.initMocks(this); this.userSelection = new UserSelection(); this.fillObservationInfoOfUserSelection(this.userSelection); Mockito.when(this.contextUtil.getCurrentProgramUUID()).thenReturn(PROGRAM_UUID); Mockito.when(this.fileService.retrieveWorkbook(Mockito.anyString())).thenReturn(this.workbook); this.measurementVariableTestDataInitializer = new MeasurementVariableTestDataInitializer(); this.measurementDataTestDataInitializer = new MeasurementDataTestDataInitializer(); StandardVariable standardVariable = Mockito.mock(StandardVariable.class); Mockito.when(this.ontologyService.getStandardVariable(TermId.ENTRY_TYPE.getId(), PROGRAM_UUID)).thenReturn(standardVariable); Mockito.when(standardVariable.getEnumerations()).thenReturn(Arrays.asList(new Enumeration(TermId.ENTRY_TYPE.getId(), TermId.ENTRY_TYPE.name(), "", 0))); }

Target:
public void setUp() throws IOException { MockitoAnnotations.initMocks(this); this.userSelection = new UserSelection(); this.fillObservationInfoOfUserSelection(this.userSelection); Mockito.when(this.contextUtil.getCurrentProgramUUID()).thenReturn(ETLServiceTest.PROGRAM_UUID); Mockito.when(this.fileService.retrieveWorkbook(Matchers.anyString())).thenReturn(this.workbook); this.measurementVariableTestDataInitializer = new MeasurementVariableTestDataInitializer(); this.measurementDataTestDataInitializer = new MeasurementDataTestDataInitializer(); final StandardVariable standardVariable = Mockito.mock(StandardVariable.class); Mockito.when(this.ontologyService.getStandardVariable(TermId.ENTRY_TYPE.getId(), ETLServiceTest.PROGRAM_UUID)) .thenReturn(standardVariable); Mockito.when(standardVariable.getEnumerations()) .thenReturn(Arrays.asList(new Enumeration(TermId.CHECK.getId(), TermId.CHECK.name(), "", 0))); }
Source:
void copyDockerfileDirectory(Class<? extends DockerContainer> fixture, DockerFixture f, File dir) throws IOException { String dockerfilePath = resolveDockerfileLocation(fixture, f); if(dockerfilePath.startsWith(FILE_SCHEMA)) { String dockerfileLocation = dockerfilePath.substring(dockerfilePath.indexOf(FILE_SCHEMA) + FILE_SCHEMA.length()); copyDockerfileDirectoryFromDisk(dir, dockerfileLocation); } else { String dockerfileLocation = dockerfilePath; if(dockerfilePath.startsWith(CLASSPATH_SCHEMA)) { dockerfileLocation = dockerfilePath.substring( dockerfilePath.indexOf(CLASSPATH_SCHEMA) + CLASSPATH_SCHEMA.length()); } copyDockerfileDirectoryFromClasspath(fixture, dockerfileLocation, dir); } }

Target:
void copyDockerfileDirectory(Class<? extends DockerContainer> fixture, DockerFixture f, File dir) throws IOException { String dockerfilePath = resolveDockerfileLocation(fixture, f); copyDockerfileDirectoryFromClasspath(fixture, dockerfilePath, dir); }
Source:
UpdateHandler(Class<?> sqlObjectType, Method method) { super(sqlObjectType, method); this.sqlObjectType = sqlObjectType; boolean isGetGeneratedKeys = method.isAnnotationPresent(GetGeneratedKeys.class); Type returnType = GenericTypes.resolveType(method.getGenericReturnType(), sqlObjectType); if (!isGetGeneratedKeys) { if (isNumeric(method.getReturnType())) { this.returner = (update, handle) -> update.execute(); } else if (isBoolean(method.getReturnType())) { this.returner = (update, handle) -> update.execute() > 0; } else { throw new UnableToCreateSqlObjectException(invalidReturnTypeMessage(method, returnType)); } } else { final ResultReturnThing magic = ResultReturnThing.forMethod(sqlObjectType, method); final GetGeneratedKeys ggk = method.getAnnotation(GetGeneratedKeys.class); final RowMapper<?> mapper; if (DefaultGeneratedKeyMapper.class.equals(ggk.value())) { mapper = new DefaultGeneratedKeyMapper(returnType, ggk.columnName()); } else { try { mapper = ggk.value().newInstance(); } catch (Exception e) { throw new UnableToCreateStatementException("Unable to instantiate row mapper for statement", e, null); } } this.returner = (update, handle) -> { GeneratedKeys<?> o = update.executeAndReturnGeneratedKeys(mapper, ggk.columnName()); return magic.result(o, handle); }; } }

Target:
UpdateHandler(Class<?> sqlObjectType, Method method) { super(sqlObjectType, method); this.sqlObjectType = sqlObjectType; boolean isGetGeneratedKeys = method.isAnnotationPresent(GetGeneratedKeys.class); Type returnType = GenericTypes.resolveType(method.getGenericReturnType(), sqlObjectType); if (isGetGeneratedKeys) { final ResultReturnThing magic = ResultReturnThing.forMethod(sqlObjectType, method); final GetGeneratedKeys ggk = method.getAnnotation(GetGeneratedKeys.class); final RowMapper<?> mapper; if (DefaultGeneratedKeyMapper.class.equals(ggk.value())) { mapper = new DefaultGeneratedKeyMapper(returnType, ggk.columnName()); } else { try { mapper = ggk.value().newInstance(); } catch (Exception e) { throw new UnableToCreateStatementException("Unable to instantiate row mapper for statement", e, null); } } this.returner = (update, handle) -> { GeneratedKeys<?> o = update.executeAndReturnGeneratedKeys(mapper, ggk.columnName()); return magic.result(o, handle); }; } else if (isNumeric(method.getReturnType())) { this.returner = (update, handle) -> update.execute(); } else if (isBoolean(method.getReturnType())) { this.returner = (update, handle) -> update.execute() > 0; } else { throw new UnableToCreateSqlObjectException(invalidReturnTypeMessage(method, returnType)); } }
Source:
String userDetails(HttpServletRequest req, Model model) { Account account = accountResolver.getAccount(req); Map<String, Set<Permission>> springSecurityPermissions = new HashMap<>(); List<Group> groups = new ArrayList<>(); for (Group group : account.getGroups()) { groups.add(group); springSecurityPermissions.put( "group:" + group.getName(), stormpathGroupPermissionResolver.resolvePermissions(group) ); } model.addAttribute("groups", groups); springSecurityPermissions.put( "account", stormpathAccountPermissionResolver.resolvePermissions(account) ); model.addAttribute("springSecurityPermissions", springSecurityPermissions); return "userdetails"; }

Target:
String userDetails(HttpServletRequest req, Model model) { Account account = accountResolver.getAccount(req); Map<String, Set<Permission>> aggregatePermissionsModel = new HashMap<>(); List<Group> groups = new ArrayList<>(); for (Group group : account.getGroups()) { groups.add(group); aggregatePermissionsModel.put( "group:" + group.getName(), stormpathGroupPermissionResolver.resolvePermissions(group) ); } model.addAttribute("groups", groups); aggregatePermissionsModel.put( "account", stormpathAccountPermissionResolver.resolvePermissions(account) ); model.addAttribute("aggregatePermissionsModel", aggregatePermissionsModel); return "userdetails"; }
Source:
protected void setText(String newText) { firePropertyChange("text", text, text = newText); }

Target:
protected void setText(String newText) { firePropertyChange("text", "", text = newText); }
Source:
void auditRateOf(String key) { try { auditCache.get(key, () -> new RateLimit(auditRate, perMillis)).updateAllowance(); } catch (RateLimitException e) { LOGGER.info(String.format( "Rate limit reached for rate limit key %s using rate of %d requests per %d ms", key, auditRate, perMillis) ); } catch (ExecutionException e) { LOGGER.error("Unexpected error creating a Rate Limiter object in cache", e); } }

Target:
void auditRateOf(String key) { try { auditCache.get(key, () -> new RateLimit(auditRate, perMillis)).updateAllowance(); } catch (RateLimitException e) { LOGGER.info(String.format( "Rate limit reached for a service using rate of %d requests per %d ms", auditRate, perMillis) ); } catch (ExecutionException e) { LOGGER.error("Unexpected error creating a Rate Limiter object in cache", e); } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { Intent intent = null; switch (item.getItemId()) { case R.id.actionEntourage: intent = new Intent(this, CreatingAccountActivity.class); break; case R.id.actionDiscover: intent = new Intent(this, CreatingAccountActivity.class); break; case R.id.actionCreate: intent = new Intent(this, CreateGroupSelectNameActivity.class); break; case R.id.actionSettings: intent = new Intent(this, CreatingAccountActivity.class); break; default: return super.onOptionsItemSelected(item); } if (intent == null){ Log.d(TAG, "Error : intent should never be null at this point"); } else { startActivity(intent); } return intent == null; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { Intent intent = null; switch (item.getItemId()) { case R.id.actionEntourage: intent = new Intent(this, CreatingAccountActivity.class); break; case R.id.actionDiscover: intent = new Intent(this, CreatingAccountActivity.class); break; case R.id.actionCreate: intent = new Intent(this, CreateGroupSelectNameActivity.class); break; case R.id.actionSettings: intent = new Intent(this, CreatingAccountActivity.class); break; default: return super.onOptionsItemSelected(item); } if (intent == null){ throw new IllegalStateException("Itent should never be null at this point"); } else { startActivity(intent); } return intent != null; }
Source:
public String generate(String sessionId, Path logFile) throws IOException { String uidDir = System.getProperty("nativeDir", "lib"); Files.setPosixFilePermissions(Paths.get(uidDir, "/faf-uid"), Sets.immutableEnumSet(PosixFilePermission.OTHERS_READ)); return OsUtils.execAndGetOutput(String.format("%s/faf-uid %s", uidDir, sessionId)); }

Target:
public String generate(String sessionId, Path logFile) throws IOException { String uidDir = System.getProperty("nativeDir", "lib"); return OsUtils.execAndGetOutput(String.format("%s/faf-uid %s", uidDir, sessionId)); }
Source:
public void approve(String uuid) { AgentInstance agentInstance = findAgentAndRefreshStatus(uuid); boolean hasAgent = hasAgent(agentInstance.getUuid()); agentInstance.enable(); if (hasAgent) { LOGGER.warn("Registered agent with the same uuid already approved.", agentInstance); } else { Agent agent = agentInstance.getAgent(); generateCookieForAgentIfAgentDoesNotHaveACookie(agent); saveOrUpdate(agent); } }

Target:
public void approve(String uuid) { AgentInstance agentInstance = findAgentAndRefreshStatus(uuid); boolean doesAgentExistAndIsRegistered = isRegistered(agentInstance.getUuid()); agentInstance.enable(); if (doesAgentExistAndIsRegistered) { LOGGER.warn("Registered agent with the same uuid already approved.", agentInstance); } else { Agent agent = agentInstance.getAgent(); if (!agent.cookieAssigned()) { generateAndAddCookie(agent); } saveOrUpdate(agent); } }
Source:
public List<String> sourceTopicsForStore(final String storeName) { final List<String> results = new ArrayList<>(); for (final Map.Entry<String, Set<String>> entry : stateStoreNameToSourceTopics.entrySet()) { if (entry.getKey().equals(storeName)) { results.addAll(maybeDecorateInternalSourceTopics(entry.getValue())); return results; } } return null; }

Target:
public Collection<String> sourceTopicsForStore(final String storeName) { return maybeDecorateInternalSourceTopics(stateStoreNameToSourceTopics.get(storeName)); }
Source:
public GlobalView() { Button remove = new Button("Remove from global and reload", event -> { ApplicationRouteRegistry .getInstance(VaadinServlet.getCurrent().getServletContext()) .removeRoute("global"); UI.getCurrent().getPage().reload(); }); RouterLink tologin = new RouterLink("To login", Login.class); add(new Span( "This is a view registered from the admin view to the global servlet scope."), remove, tologin); }

Target:
public GlobalView() { Button remove = new Button("Remove from global and reload", event -> { RouteConfiguration.forApplicationScope().removeRoute("global"); UI.getCurrent().getPage().reload(); }); remove.setId("remove-global"); RouterLink tologin = new RouterLink("To login", Login.class); tologin.setId("to-root-link"); add(new Span( "This is a view registered from the admin view to the global servlet scope."), remove, tologin); }
Source:
public void testPhiroPlayToneBrick() { List<Integer> spinnerValuesResourceIds = Arrays.asList( R.string.phiro_tone_do, R.string.phiro_tone_re, R.string.phiro_tone_mi, R.string.phiro_tone_fa, R.string.phiro_tone_so, R.string.phiro_tone_la); checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.phiro_play_tone); checkIfValuesAvailableInSpinnerOnBrick(spinnerValuesResourceIds, R.id.brick_phiro_select_tone_spinner, brickPosition); enterValueInFormulaTextFieldOnBrickAtPosition(TONE_DURATION, R.id.brick_phiro_play_tone_duration_edit_text, brickPosition); }

Target:
public void testPhiroPlayToneBrick() { checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.phiro_play_tone); List<Integer> spinnerValuesResourceIds = Arrays.asList( R.string.phiro_tone_do, R.string.phiro_tone_re, R.string.phiro_tone_mi, R.string.phiro_tone_fa, R.string.phiro_tone_so, R.string.phiro_tone_la); checkIfValuesAvailableInSpinnerOnBrick(spinnerValuesResourceIds, R.id.brick_phiro_select_tone_spinner, brickPosition); enterValueInFormulaTextFieldOnBrickAtPosition(TONE_DURATION, R.id.brick_phiro_play_tone_duration_edit_text, brickPosition); }
Source:
private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group) { if (tracker.contains(group)) { return new ArrayList<>(); } tracker.add(group); return map.get(group); }

Target:
private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group) { if (tracker.contains(group)) { return Collections.EMPTY_LIST; } tracker.add(group); return map.get(group); }
Source:
private int getExtendedFlags() { if (!isExtended()) { return 0; } return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; }

Target:
private int getExtendedFlags() { if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0; }
Source:
public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputRegexp.invalid.header")); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; try { verify(checkConfig, getPath("InputRegexpHeaderMulti52.java"), expected); fail("IllegalArgumentException is expected"); } catch (IllegalArgumentException ex) { assertEquals("line 1 in header specification is not a regular expression", ex.getMessage()); } }

Target:
public void testHeaderWithInvalidRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputRegexpHeader.invalid.header")); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; try { verify(checkConfig, getPath("InputRegexpHeaderMulti52.java"), expected); fail("IllegalArgumentException is expected"); } catch (IllegalArgumentException ex) { assertEquals("line 1 in header specification is not a regular expression", ex.getMessage()); } }