auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void createAndLoadNativeAd(Context context, String placementID, NativeMediationAdRequest adRequest, Bundle mediationExtras) { isNativeBanner = mediationExtras.getBoolean(NATIVE_BANNER); if (isNativeBanner) { mNativeBannerAd = new NativeBannerAd(context, placementID); mNativeBannerAd.setAdListener(new NativeBannerListener(mNativeBannerAd, adRequest)); buildAdRequest(adRequest); mNativeBannerAd.loadAd(); } else { mMediaView = new MediaView(context); mNativeAd = new NativeAd(context, placementID); mNativeAd.setAdListener(new NativeListener(mNativeAd, adRequest)); buildAdRequest(adRequest); mNativeAd.loadAd(); } }

Target:
private void createAndLoadNativeAd(Context context, String placementID, NativeMediationAdRequest adRequest, Bundle mediationExtras) { if (mediationExtras != null) { isNativeBanner = mediationExtras.getBoolean(NATIVE_BANNER); } if (isNativeBanner) { mNativeBannerAd = new NativeBannerAd(context, placementID); mNativeBannerAd.setAdListener(new NativeBannerListener(mNativeBannerAd, adRequest)); buildAdRequest(adRequest); mNativeBannerAd.loadAd(); } else { mMediaView = new MediaView(context); mNativeAd = new NativeAd(context, placementID); mNativeAd.setAdListener(new NativeListener(mNativeAd, adRequest)); buildAdRequest(adRequest); mNativeAd.loadAd(); } }
Source:
public void shouldWriteInfoAboutManualBuildCause() throws Exception { UserIdCause cause = Cause.UserIdCause.class.newInstance(); FreeStyleBuild build = jenkins.createFreeStyleProject().scheduleBuild2(0, cause).get(); assertThat(build.getResult(), is(SUCCESS)); assertThat(build, withCause(BUILD_CAUSE, MANUAL_TRIGGER)); assertThat(build, withCause(ROOT_BUILD_CAUSE, MANUAL_TRIGGER)); assertThat(build, withCausesIsTrue(sub(BUILD_CAUSE, MANUAL_TRIGGER), sub(ROOT_BUILD_CAUSE, MANUAL_TRIGGER))); assertThat(build, withCause(USER_NAME, cause.getUserName())); }

Target:
public void shouldWriteInfoAboutManualBuildCause() throws Exception { Cause cause = Cause.UserCause.class.newInstance(); FreeStyleBuild build = jenkins.createFreeStyleProject().scheduleBuild2(0, cause).get(); assertThat(build.getResult(), is(SUCCESS)); assertThat(build, withCause(BUILD_CAUSE, MANUAL_TRIGGER)); assertThat(build, withCause(ROOT_BUILD_CAUSE, MANUAL_TRIGGER)); assertThat(build, withCausesIsTrue(sub(BUILD_CAUSE, MANUAL_TRIGGER), sub(ROOT_BUILD_CAUSE, MANUAL_TRIGGER))); }
Source:
public void testGetEvent() { DropletCreation droplet = null; try { droplet = api.getDropletApi().create("eventtest", defaultImage.getId(), defaultSize.getId(), defaultRegion.getId()); Event event = api.getEventApi().get(droplet.getEventId()); assertNotNull(event, "Droplet creation event shouold not be null"); } finally { if (droplet != null) { waitForEvent(droplet.getEventId()); api.getDropletApi().destroy(droplet.getId(), true); } } }

Target:
public void testGetEvent() { DropletCreation droplet = null; try { droplet = api.getDropletApi().create("eventtest", defaultImage.getId(), defaultSize.getId(), defaultRegion.getId()); Event event = api.getEventApi().get(droplet.getEventId()); assertNotNull(event, "Droplet creation event should not be null"); assertTrue(event.getId() > 0, "Event id should be > 0"); } finally { if (droplet != null) { waitForEvent(droplet.getEventId()); api.getDropletApi().destroy(droplet.getId(), true); } } }
Source:
public void move(String newFilePath) throws IOException { if (newFilePath == null) { throw new IOException(); } if (newFilePath.equals(getFilePath())) { return; } final File currentTempFile = new File(getTempFilePath()); final File currentFilePath = new File(getFilePath()); setFilePath(newFilePath); final File targetTempFile = new File(getTempFilePath()); final File targetFilePath = new File(getFilePath()); FileUtil.moveAndOverwrite(currentTempFile, targetTempFile); FileUtil.moveAndOverwrite(currentFilePath, targetFilePath); }

Target:
public void move(String newFilePath) throws IOException { if (newFilePath == null) { throw new IOException(); } if (newFilePath.equals(getFilePath())) { return; } final File currentTempFile = new File(getTempFilePath()); final File currentFilePath = new File(getFilePath()); final File targetTempFile = new File(getTempFilePath(newFilePath)); final File targetFilePath = new File(newFilePath); FileUtil.moveAndOverwrite(currentTempFile, targetTempFile); try { FileUtil.moveAndOverwrite(currentFilePath, targetFilePath); } catch (final IOException ex) { FileUtil.moveAndOverwrite(targetTempFile, currentTempFile); throw ex; } setFilePath(newFilePath); }
Source:
public WebcamRecorder(WebcamVideoConfiguration configuration) { Validate.notNull(configuration, "Video configuration is null!"); this.configuration = configuration; this.frameRate = configuration.getFrameRate(); screenBounds = Toolkit.getDefaultToolkit().getScreenSize(); }

Target:
public WebcamRecorder(WebcamVideoConfiguration configuration) { Validate.notNull(configuration, "Video configuration is null!"); this.configuration = configuration; this.frameRate = configuration.getFrameRate(); if (this.configuration.getWidth() > 0 && this.configuration.getHeight() > 0) { screenBounds = new Dimension(this.configuration.getWidth(), this.configuration.getHeight()); } }
Source:
public void run() { long microsLower = day * 1000; long microsUpper = (day * 1000) + TimeUnit.DAYS.toMicros(1) - 1; log.info( "Running Dependencies job for {}: ≤ Span.timestamp {}", dateStamp, microsLower, microsUpper); SparkContext sc = new SparkContext(conf); try { JavaRDD<DependencyLink> links = javaFunctions(sc) .cassandraTable(keyspace, "span") .map(CassandraRowToSpan.INSTANCE) .groupBy(Span::traceId) .flatMapValues(new SpansToDependencyLinks(logInitializer, microsLower, microsUpper)) .values() .mapToPair(link -> new Tuple2<>(new Tuple2<>(link.parent(), link.child()), link)) .reduceByKey((l, r) -> DependencyLink.newBuilder() .parent(l.parent()) .child(l.child()) .callCount(l.callCount() + r.callCount()) .errorCount(l.errorCount() + r.errorCount()) .build()) .values(); if (links.isEmpty()) { log.info("No spans found at {}/span", keyspace); } else { log.info("Saving dependency links to {}/dependency", keyspace); AddDayToDependencyLink converter = new AddDayToDependencyLink(day); javaFunctions(links.map(converter)) .writerBuilder(keyspace, "dependency", mapToRow(DependencyLinkWithDate.class)) .saveToCassandra(); } } finally { sc.stop(); } }

Target:
public void run() { long microsLower = day * 1000; long microsUpper = (day * 1000) + TimeUnit.DAYS.toMicros(1) - 1; log.info( "Running Dependencies job for {}: ≤ Span.timestamp {}", dateStamp, microsLower, microsUpper); SparkContext sc = new SparkContext(conf); try { JavaRDD<DependencyLink> links = flatMapToLinksByTraceId( javaFunctions(sc).cassandraTable(keyspace, "span"), microsUpper, microsLower, inTest ).values() .mapToPair(link -> new Tuple2<>(new Tuple2<>(link.parent(), link.child()), link)) .reduceByKey((l, r) -> DependencyLink.newBuilder() .parent(l.parent()) .child(l.child()) .callCount(l.callCount() + r.callCount()) .errorCount(l.errorCount() + r.errorCount()) .build()) .values(); if (links.isEmpty()) { log.info("No spans found at {}/span", keyspace); } else { log.info("Saving dependency links to {}/dependency", keyspace); AddDayToDependencyLink converter = new AddDayToDependencyLink(day); javaFunctions(links.map(converter)) .writerBuilder(keyspace, "dependency", mapToRow(DependencyLinkWithDate.class)) .saveToCassandra(); } } finally { sc.stop(); } }
Source:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); email = request.getParameter("email"); password = request.getParameter("password"); BasicUserService basicUserService = new BasicUserService(new DbUserServices()); DatabaseBuilder builder = new DatabaseBuilder(new DatabaseConnector(), "DietTracker"); try { if(!builder.CheckIfDbExists()) { builder.CreateDatabase(); } } catch (DatabaseConnectorException e) { e.printStackTrace(); } try { if(!builder.CheckIfTableExists("USERS")) { builder.CreateUserTable(); } } catch (DatabaseConnectorException e) { e.printStackTrace(); } try { basicUserService.createUser(email, password); out.println("successfully created. You will now be directed back to login"); } catch (PersistanceUserServicesException e) { e.printStackTrace(out); } catch (DuplicateUserException e) { e.printStackTrace(out); } }

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); email = request.getParameter("email"); password = request.getParameter("password"); UserService userService = ServiceFactory.getUserServiceInstance(); try { userService.createUser(email, password); } catch (UserServiceException e) { System.err.println("Error creating user"); e.printStackTrace(); } out.println("successfully created. You will now be directed back to login"); response.setHeader("Location", "./login.html"); }
Source:
public void commitAndPushExperiment(Experiment experiment) throws KaramelException { String owner = experiment.getGithubOwner(); String repoName = experiment.getGithubRepo(); File f = Github.getRepoDirectory(repoName); boolean repoExists = Github.repoExists(owner, repoName); if (repoExists) { if (!f.exists()) { throw new KaramelException("Remote repository already exists. Load the experiment if it already exists."); } } else { if (f.exists()) { throw new KaramelException("The remote repo does not exist, however a conflicting local directory was found. " + "Remove the local directory in ~/.karamel/cookbook_designer first, then save again."); } else { initGithubRepo(Github.getUser(), owner, repoName, experiment.getDescription()); Github.scaffoldRepo(repoName); } } ChefExperimentExtractor.parseAttributesAddToGit(owner, repoName, experiment); ChefExperimentExtractor.parseRecipesAddToGit(owner, repoName, experiment); Github.commitPush(owner, repoName); }

Target:
public void commitAndPushExperiment(Experiment experiment) throws KaramelException { String owner = experiment.getGithubOwner(); String repoName = experiment.getGithubRepo(); File f = GithubApi.getRepoDirectory(repoName); boolean repoExists = GithubApi.repoExists(owner, repoName); if (repoExists) { if (!f.exists()) { throw new KaramelException("Remote repository already exists. Load the experiment if it already exists."); } } else { if (f.exists()) { throw new KaramelException("The remote repo does not exist, however a conflicting local directory was found. " + "Remove the local directory in ~/.karamel/cookbook_designer first, then save again."); } else { initGithubRepo(GithubApi.getUser(), owner, repoName, experiment.getDescription()); GithubApi.scaffoldRepo(repoName); } } ChefExperimentExtractor.parseAttributesAddToGit(owner, repoName, experiment); ChefExperimentExtractor.parseRecipesAddToGit(owner, repoName, experiment); GithubApi.commitPush(owner, repoName); }
Source:
public String toString() { return "ZenossToken{" + "id='" + id + '\'' + ", expires=" + expires + '}'; }

Target:
public String toString() { return "ZenossToken{" + "id='********'" + ", expires=" + expires + '}'; }
Source:
static Long callLongGetter(Method method, Object obj) { try { method.setAccessible(true); return (Long) method.invoke(obj); } catch (Exception e) { } for (Class<?> clazz : method.getDeclaringClass().getInterfaces()) { try { Method interfaceMethod = clazz.getMethod(method.getName(), method.getParameterTypes()); Long result = callLongGetter(interfaceMethod, obj); if (result != null) { return result; } } catch (NoSuchMethodException e) { } } return null; }

Target:
static Long callLongGetter(Method method, Object obj) throws InvocationTargetException { try { return (Long) method.invoke(obj); } catch (IllegalAccessException e) { } for (Class<?> clazz : method.getDeclaringClass().getInterfaces()) { try { Method interfaceMethod = clazz.getMethod(method.getName(), method.getParameterTypes()); Long result = callLongGetter(interfaceMethod, obj); if (result != null) { return result; } } catch (NoSuchMethodException e) { } } return null; }
Source:
public SongMetadata moveNext(){ if(unPlayed.size() > 0){ played.add(unPlayed.get(0)); unPlayed.remove(0); } if(unPlayed.size() > 0){ return unPlayed.get(0); } else { return null; } }

Target:
public void moveNext(){ if(unPlayed.size() > 0){ played.add(unPlayed.get(0)); unPlayed.remove(0); } else { Log.i(TAG, "Cannot moveNext out of songs"); } }
Source:
public String getURI(int index) { return uris.elementAt(index).toString(); }

Target:
public String getURI(int index) { return uris.get(index); }
Source:
boolean putData(String key, Object value) { if (TextUtils.isEmpty(key)) { throw new IllegalArgumentException("Preference key value cannot be empty."); } return getStorage().put(key, value); }

Target:
private boolean putData(String key, Object value) { if (TextUtils.isEmpty(key)) { throw new IllegalArgumentException("Preference key value cannot be empty."); } return getStorage().put(key, value); }
Source:
public void addAllReviewers(ChangeAttribute a, Change change) throws OrmException { List<PatchSetApproval> approvals = db.get().patchSetApprovals().byChange(change.getId()).toList(); if (approvals.isEmpty()) { return; } a.allReviewers = Lists.newArrayList(); Set<Account.Id> accountIdlist = Sets.newHashSet(); for (PatchSetApproval psa : approvals) { Account.Id accountId = psa.getAccountId(); if (!accountIdlist.contains(accountId)) { accountIdlist.add(accountId); a.allReviewers.add(asAccountAttribute(psa.getAccountId())); } } }

Target:
public void addAllReviewers(ChangeAttribute a, Change change) throws OrmException { List<PatchSetApproval> approvals = db.get().patchSetApprovals().byChange(change.getId()).toList(); if (!approvals.isEmpty()) { a.allReviewers = Lists.newArrayList(); Set<Account.Id> seen = Sets.newHashSet(); for (PatchSetApproval psa : approvals) { Account.Id id = psa.getAccountId(); if (!seen.contains(id)) { seen.add(id); a.allReviewers.add(asAccountAttribute(id)); } } } }
Source:
public synchronized ICommandResult executeCommand(ICommandInput command, IProgressMonitor monitor) throws ExecutionException { Map<String, ICommandResult> commands = fScenarioMap.get(fScenario); if (commands == null) { throw new IllegalStateException(); } String commandLine = command.toString(); String fullCommand = commandLine; Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(commandLine); if (matcher.matches() && !commandLine.matches(LTTNG_LIST_PROVIDER_PATTERN)) { String sessionName = matcher.group(1).trim(); Integer i = fSessionNameMap.get(sessionName); if (i != null) { i++; } else { i = 0; } fSessionNameMap.put(sessionName, i); fullCommand += String.valueOf(i); } if (commands.containsKey(fullCommand)) { return checkNotNull(commands.get(fullCommand)); } String[] output = new String[1]; output[0] = String.valueOf("Command not found"); ICommandResult result = createCommandResult(1, output, output); return result; }

Target:
public synchronized ICommandResult executeCommand(ICommandInput command, IProgressMonitor monitor) throws ExecutionException { Map<String, ICommandResult> commands = fScenarioMap.get(fScenario); commands = checkNotNull(commands); String commandLine = command.toString(); String fullCommand = commandLine; Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(commandLine); if (matcher.matches() && !commandLine.matches(LTTNG_LIST_PROVIDER_PATTERN)) { String sessionName = matcher.group(1).trim(); Integer i = fSessionNameMap.get(sessionName); if (i != null) { i++; } else { i = 0; } fSessionNameMap.put(sessionName, i); fullCommand += String.valueOf(i); } if (commands.containsKey(fullCommand)) { return checkNotNull(commands.get(fullCommand)); } String[] output = new String[1]; output[0] = String.valueOf("Command not found"); ICommandResult result = createCommandResult(1, output, output); return result; }
Source:
public static void removeKeyFromMap( final Map<String, ?> params, final String key ) { if ( params == null || key == null ) { logger.debug( "Map or key are null, cannot remove." ); return; } params.remove( key ); if ( KEY_MAP.keySet().contains( key ) ) { params.remove( KEY_MAP.get( key ) ); } else if ( KEY_MAP.values().contains( key ) ) { final Iterator<Map.Entry<String, String>> keyMapIter = KEY_MAP.entrySet().iterator(); while ( keyMapIter.hasNext() ) { final Map.Entry<String, String> entry = keyMapIter.next(); final String keyMapKey = entry.getKey(); final String keyMapValue = entry.getValue(); if ( key.equals( keyMapValue ) ) { params.remove( keyMapKey ); break; } } } }

Target:
public static void removeKeyFromMap( final Map<String, ?> params, final String key ) { if ( params == null || key == null ) { logger.debug( "Map or key are null, cannot remove." ); return; } params.remove( key ); if ( KEY_MAP.containsKey( key ) ) { params.remove( KEY_MAP.get( key ) ); } else if ( KEY_MAP.containsValue( key ) ) { final Iterator<Map.Entry<String, String>> keyMapIter = KEY_MAP.entrySet().iterator(); while ( keyMapIter.hasNext() ) { final Map.Entry<String, String> entry = keyMapIter.next(); final String keyMapKey = entry.getKey(); final String keyMapValue = entry.getValue(); if ( key.equals( keyMapValue ) ) { params.remove( keyMapKey ); break; } } } }
Source:
protected InputStream getInitialContents() { boolean useNewCamelRoute = true; IProject project = getJavaProject().getProject(); String version = SwitchYardModelUtils.getSwitchYardProjectRuntimeVersion(project); if (version.startsWith("2.0") || version.startsWith("1")) { useNewCamelRoute = false; } String serviceName = getService().getName(); if (serviceName != null) { if (useNewCamelRoute) { return new ByteArrayInputStream(getNewRouteStubText(serviceName).getBytes()); } else { return getOldRouteStubText(); } } return null; }

Target:
protected InputStream getInitialContents() { boolean useNewCamelRoute = true; IProject project = getJavaProject().getProject(); String version = SwitchYardModelUtils.getSwitchYardProjectRuntimeVersion(project); if (version.startsWith("2.0") || version.startsWith("1")) { useNewCamelRoute = false; } String serviceName = getService().getName(); if (serviceName != null) { if (useNewCamelRoute) { return new ByteArrayInputStream( getNewRouteStubText(serviceName).getBytes( java.nio.charset.StandardCharsets.UTF_8)); } else { return getOldRouteStubText(); } } return null; }
Source:
public Block bingTileCoordinates(@SqlType(BingTileType.NAME) long input) { if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder tileBlockBuilder = blockBuilder.beginBlockEntry(); BingTile tile = BingTile.decode(input); INTEGER.writeLong(tileBlockBuilder, tile.getX()); INTEGER.writeLong(tileBlockBuilder, tile.getY()); blockBuilder.closeEntry(); pageBuilder.declarePosition(); return BING_TILE_COORDINATES_ROW_TYPE.getObject(blockBuilder, blockBuilder.getPositionCount() - 1); }

Target:
public Block bingTileCoordinates(@SqlType(BingTileType.NAME) long input) { if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BingTile tile = BingTile.decode(input); BlockBuilder tileBlockBuilder = blockBuilder.beginBlockEntry(); INTEGER.writeLong(tileBlockBuilder, tile.getX()); INTEGER.writeLong(tileBlockBuilder, tile.getY()); blockBuilder.closeEntry(); pageBuilder.declarePosition(); return BING_TILE_COORDINATES_ROW_TYPE.getObject(blockBuilder, blockBuilder.getPositionCount() - 1); }
Source:
MockClientState getMockClientWithPreviousCaughtUpTasks(final Set<TaskId> statefulActiveTasks) { if (!statefulTasks.containsAll(statefulActiveTasks)) { throw new IllegalArgumentException("Need to initialize stateful tasks set before creating mock clients"); } final Map<TaskId, Long> taskLags = new HashMap<>(); for (final TaskId task : statefulTasks) { if (statefulActiveTasks.contains(task)) { taskLags.put(task, 0L); } else { taskLags.put(task, Long.MAX_VALUE); } } final MockClientState client = new MockClientState(1, taskLags); client.addPreviousActiveTasks(statefulActiveTasks); return client; }

Target:
private MockClientState getMockClientWithPreviousCaughtUpTasks(final Set<TaskId> statefulActiveTasks) { if (!statefulTasks.containsAll(statefulActiveTasks)) { throw new IllegalArgumentException("Need to initialize stateful tasks set before creating mock clients"); } final Map<TaskId, Long> taskLags = new HashMap<>(); for (final TaskId task : statefulTasks) { if (statefulActiveTasks.contains(task)) { taskLags.put(task, 0L); } else { taskLags.put(task, Long.MAX_VALUE); } } final MockClientState client = new MockClientState(1, taskLags); client.addPreviousActiveTasks(statefulActiveTasks); return client; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FieldOrMethod that = (FieldOrMethod) o; return ownerIsInterface == that.ownerIsInterface && Objects.equals(owner, that.owner) && Objects.equals(name, that.name) && Objects.equals(desc, that.desc); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } FieldOrMethod that = (FieldOrMethod) o; return ownerIsInterface == that.ownerIsInterface && Objects.equals(owner, that.owner) && Objects.equals(name, that.name) && Objects.equals(desc, that.desc); }
Source:
public void testFindIndexForSuffixes(final String dataFileSuffix, final String indexFileSuffix, final String expectIndexSuffix) throws IOException { final File dataFile = File.createTempFile("test", dataFileSuffix); dataFile.deleteOnExit(); Assert.assertNull(SamFiles.findIndex(dataFile)); Assert.assertNull(SamFiles.findIndex(dataFile.toPath())); File indexFile = null; if (indexFileSuffix != null) { indexFile = new File(dataFile.getAbsolutePath().replaceFirst("\\.\\S+$", indexFileSuffix)); indexFile.createNewFile(); indexFile.deleteOnExit(); } final File foundIndexFile = SamFiles.findIndex(dataFile); if (expectIndexSuffix == null) { Assert.assertNull(foundIndexFile); return; } Assert.assertNotNull(foundIndexFile); Assert.assertTrue(foundIndexFile.getName().endsWith(expectIndexSuffix)); final Path foundIndexPath = SamFiles.findIndex(dataFile.toPath()); if (expectIndexSuffix == null) { Assert.assertNull(foundIndexPath); return; } Assert.assertNotNull(foundIndexPath); Assert.assertTrue(foundIndexPath.getFileName().toString().endsWith(expectIndexSuffix)); }

Target:
public void testFindIndexForSuffixes(final String dataFileSuffix, final String indexFileSuffix, final String expectIndexSuffix) throws IOException { final File dataFile = File.createTempFile("test", dataFileSuffix); dataFile.deleteOnExit(); Assert.assertNull(SamFiles.findIndex(dataFile)); Assert.assertNull(SamFiles.findIndex(dataFile.toPath())); File indexFile = null; if (indexFileSuffix != null) { indexFile = new File(dataFile.getAbsolutePath().replaceFirst("\\.\\S+$", indexFileSuffix)); indexFile.createNewFile(); indexFile.deleteOnExit(); } final File foundIndexFile = SamFiles.findIndex(dataFile); if (expectIndexSuffix == null) { Assert.assertNull(foundIndexFile); } else { Assert.assertNotNull(foundIndexFile); Assert.assertTrue(foundIndexFile.getName().endsWith(expectIndexSuffix)); } final Path foundIndexPath = SamFiles.findIndex(dataFile.toPath()); if (expectIndexSuffix == null) { Assert.assertNull(foundIndexPath); } else { Assert.assertNotNull(foundIndexPath); Assert.assertTrue(foundIndexPath.getFileName().toString().endsWith(expectIndexSuffix)); } }
Source:
private static Optional<Path> findDistribution(Path projectRootDirectory) { final Path distTargetDirectory = projectRootDirectory.resolve("flink-dist").resolve("target"); try { Collection<Path> paths = FileUtils.listFilesInDirectory(distTargetDirectory, p -> p.getFileName().toString().contains("flink-dist")); if (paths.size() == 0) { return Optional.empty(); } if (paths.size() > 1) { LOG.warn("Detected multiple distributions under flink-dist/target. It is recommended to explicitly" + " select the distribution by setting the '{}}' property.", DISTRIBUTION_DIRECTORY.getPropertyName()); } return Optional.of(paths.iterator().next().getParent().getParent()); } catch (IOException e) { LOG.error("Error while searching for distribution.", e); return Optional.empty(); } }

Target:
private static Optional<Path> findDistribution(Path projectRootDirectory) { final Path distTargetDirectory = projectRootDirectory.resolve("flink-dist").resolve("target"); try { Collection<Path> paths = FileUtils.listFilesInDirectory( distTargetDirectory, LocalStandaloneFlinkResourceFactory::isDistribution); if (paths.size() == 0) { return Optional.empty(); } if (paths.size() > 1) { LOG.warn("Detected multiple distributions under flink-dist/target. It is recommended to explicitly" + " select the distribution by setting the '{}}' property.", DISTRIBUTION_DIRECTORY.getPropertyName()); } return Optional.of(paths.iterator().next().getParent().getParent()); } catch (IOException e) { LOG.error("Error while searching for distribution.", e); return Optional.empty(); } }
Source:
public void deleteForDeploymentUnit() throws Exception { CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1); ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener); String caseIdIncomplete = caseService.startCase(DEPLOYMENT_UNIT, LOG_INCOMPLETE_CLEANUP_ID); logger.info("CASE CREATED: {}", caseIdIncomplete); caseService.cancelCase(caseIdIncomplete); Thread.sleep(1010); Assertions.assertThat(getCaseFileDataLogSize()).isEqualTo(1); Assertions.assertThat(getCaseAssignmentRoleLogSize()).isPositive(); scheduleLogCleanup(null, "1s", Collections.singletonMap("ForDeployment", DEPLOYMENT_UNIT)); countDownListener.waitTillCompleted(); Assertions.assertThat(getCaseFileDataLogSize()).isZero(); Assertions.assertThat(getCaseAssignmentRoleLogSize()).isZero(); }

Target:
public void deleteForDeploymentUnit() throws Exception { CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(1); ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener); String caseIdIncomplete = caseService.startCase(DEPLOYMENT_UNIT, LOG_INCOMPLETE_CLEANUP_ID); logger.info("CASE CREATED: {}", caseIdIncomplete); caseService.cancelCase(caseIdIncomplete); Thread.sleep(1010); Assertions.assertThat(getCaseFileDataLogSize()).isEqualTo(1); Assertions.assertThat(getCaseAssignmentRoleLogSize()).isPositive(); Map<String, Object> params = new HashMap<>(); params.put("Status", "2,3"); params.put("ForDeployment", DEPLOYMENT_UNIT); scheduleLogCleanup(null, "1s", params); countDownListener.waitTillCompleted(); Assertions.assertThat(getCaseFileDataLogSize()).isZero(); Assertions.assertThat(getCaseAssignmentRoleLogSize()).isZero(); Assertions.assertThat(getProcessLogSize(LOG_INCOMPLETE_CLEANUP_ID)).isZero(); Assertions.assertThat(getTaskLogSize(LOG_INCOMPLETE_CLEANUP_ID)).isZero(); Assertions.assertThat(getNodeInstanceLogSize(LOG_INCOMPLETE_CLEANUP_ID)).isZero(); Assertions.assertThat(getVariableLogSize(LOG_INCOMPLETE_CLEANUP_ID)).isZero(); }
Source:
public void addGroup(String username, String group) { throw new RuntimeException("Adding a group is not supporting in LDAP"); }

Target:
public void addGroup(String username, String group) { throw new UnsupportedOperationException("Adding a group is not supporting in LDAP"); }
Source:
public final void run() { affinityInterceptor.beforeRun(); try { run0(); } finally { affinityInterceptor.afterRun(); } }

Target:
public final void run() { if (affinityController == null) { run0(); return; } affinityController.assign(); try { run0(); } finally { affinityController.release(); } }
Source:
public synchronized boolean resubmit(Verification verification, QueryException queryException) { if (!shouldRequeue(queryException)) { return false; } VerificationRef ref = new VerificationRef(verification); Integer requeudCount = requeuedCounts.getOrDefault(ref, 0); if (requeudCount < failureRequeueLimit) { queriesSubmitted.addAndGet(1); requeuedCounts.compute(ref, (key, count) -> count == null ? 1 : count + 1); completionService.submit(verification::run); log.info("Verification failed with %s, re-queued for verification (%s/%s)", queryException.getErrorCode(), requeudCount, failureRequeueLimit); return true; } log.info("Verification failed with %s, re-queue limit exceeded", queryException.getErrorCode()); return false; }

Target:
public synchronized boolean resubmit(Verification verification, QueryException queryException) { if (!shouldResubmit(queryException)) { return false; } String name = verification.getSourceQuery().getName(); VerificationRef ref = new VerificationRef(verification); Integer resubmittedCount = resubmittedCounts.getOrDefault(ref, 0); if (resubmittedCount >= verificationResubmissionLimit) { log.info("Verification %s failed with %s, resubmission limit exceeded", name, queryException.getErrorCode()); return false; } queriesSubmitted.addAndGet(1); resubmittedCounts.compute(ref, (key, count) -> count == null ? 1 : count + 1); completionService.submit(verification::run); log.info("Verification %s failed with %s, resubmitted for verification (%s/%s)", name, queryException.getErrorCode(), resubmittedCount, verificationResubmissionLimit); return true; }
Source:
public void throwIfConditionInvalid(long timestamp) { if (startTs.filter(ts -> ts != timestamp).isPresent()) { commitUpdate.set(lockWatchManager.getCommitUpdate(startTs.get())); } }

Target:
public void throwIfConditionInvalid(long timestamp) { startTs.filter(ts -> ts != timestamp) .ifPresent(ts -> commitUpdate.set(lockWatchManager.getCommitUpdate(ts))); }
Source:
protected boolean canAddDomain() { if (getStorageDomainStaticDAO().get(getStorageDomain().getId()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST); } List<LUNs> physicalVolumeIdsOnStorage = getLUNsFromVgInfo(getStorageDomain().getStorage()); if (CollectionUtils.containsAny(physicalVolumeIdsOnStorage, getPhysicalVolumesFromLunsList(getDbFacade().getLunDao().getAll()))) { log.info("There are existing luns in the system which are part of VG id '{}'", getStorageDomain().getStorage()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_STORAGE_DOMAIN_EXTERNAL_LUN_DISK_EXIST); } return true; }

Target:
protected boolean canAddDomain() { if (getStorageDomainStaticDAO().get(getStorageDomain().getId()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST); } List<LUNs> physicalVolumeIdsOnStorage = getLUNsFromVgInfo(getStorageDomain().getStorage()); if (CollectionUtils.containsAny(physicalVolumeIdsOnStorage, Entities.getPhysicalVolumesFromLunsList(getDbFacade().getLunDao().getAll()))) { log.info("There are existing luns in the system which are part of VG id '{}'", getStorageDomain().getStorage()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_STORAGE_DOMAIN_EXTERNAL_LUN_DISK_EXIST); } return true; }
Source:
private String getJsonDiskDescription() { try { return ImagesHandler.getJsonDiskDescription(getParameters().getDiskInfo().getDiskAlias(), getParameters().getDiskInfo().getDiskDescription()); } catch (IOException e) { throw new RuntimeException("Exception while generating json for disk", e); } }

Target:
private String getJsonDiskDescription() throws IOException { return ImagesHandler.getJsonDiskDescription(getParameters().getDiskInfo().getDiskAlias(), getParameters().getDiskInfo().getDiskDescription()); }
Source:
public boolean matchConfigValue(String in) { if (name().toLowerCase().replace('_', '-') .equals(in.substring("--".length()))) return true; return false; }

Target:
public boolean matchConfigValue(String in) { if (StringUtils.isEmptyOrNull(in)) return false; if (!in.startsWith("--")) return false; return name().equalsIgnoreCase(in.substring(2).replace('-', '_')); }
Source:
public static IEditorDescriptor getEditorDescriptor(IFile file) throws PartInitException { try { return getEditorDescriptor(file, true, false); } catch (OperationCanceledException ex) { throw new PartInitException(ex.getMessage(), ex); } }

Target:
public static IEditorDescriptor getEditorDescriptor(IFile file) throws PartInitException { return getEditorDescriptor(file, true); }
Source:
public FIXValue valueOf(int tag, int fromIndex) { for (int i = fromIndex; i < count; i++) { if (tags[i] == tag) return values[i]; } return null; }

Target:
public FIXValue valueOf(int tag, int fromIndex) { for (; fromIndex < count; fromIndex++) { if (tags[fromIndex] == tag) return values[fromIndex]; } return null; }
Source:
public int bytesRead() { if (buffer == null) return size.position(); return payload().position() + size.position(); }

Target:
public int bytesRead() { if (buffer == null) return size.position(); return buffer.position() + size.position(); }
Source:
public EObject updateCreatedObject(EObject newObject, String loadedVersion) { EObject returnedValue = null; for (IMigrationParticipant contribution : delegatesParticipants) { returnedValue = contribution.updateCreatedObject(newObject, loadedVersion); if (returnedValue != null) { break; } } return returnedValue; }

Target:
public EObject updateCreatedObject(EObject newObject, String loadedVersion) { EObject returnedValue = newObject; for (IMigrationParticipant contribution : delegatesParticipants) { returnedValue = contribution.updateCreatedObject(newObject, loadedVersion); } return returnedValue; }
Source:
protected void doStart() throws Exception { super.doStart(); if (client == null) { DefaultAsyncHttpClientConfig.Builder builder = clientConfig != null ? new DefaultAsyncHttpClientConfig.Builder(clientConfig) : new DefaultAsyncHttpClientConfig.Builder(); if (configuration != null && ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { LOG.debug("Setup http proxy host:{} port:{} for TelegramService", configuration.getProxyHost(), configuration.getProxyPort()); builder.setProxyServer( new ProxyServer.Builder(configuration.getProxyHost(), configuration.getProxyPort()).build()); } final AsyncHttpClientConfig config = builder.build(); client = new DefaultAsyncHttpClient(config); } if (telegramService == null) { telegramService = new TelegramServiceRestBotAPIAdapter( client, 4 * 1024, configuration.getBaseUri(), configuration.getAuthorizationToken()); } }

Target:
protected void doStart() throws Exception { super.doStart(); if (client == null) { DefaultAsyncHttpClientConfig.Builder builder = clientConfig != null ? new DefaultAsyncHttpClientConfig.Builder(clientConfig) : new DefaultAsyncHttpClientConfig.Builder(); if (configuration != null && ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { LOG.debug("Setup http proxy host:{} port:{} for TelegramService", configuration.getProxyHost(), configuration.getProxyPort()); builder.setProxyServer( new ProxyServer.Builder(configuration.getProxyHost(), configuration.getProxyPort()).build()); } final AsyncHttpClientConfig config = builder.build(); client = new DefaultAsyncHttpClient(config); } if (telegramService == null) { telegramService = new TelegramServiceRestBotAPIAdapter( client, bufferSize, configuration.getBaseUri(), configuration.getAuthorizationToken()); } }
Source:
public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id, TaskOpenListener listener, long timestamp) { IRepositoryManager repositoryManager = TasksUi.getRepositoryManager(); AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(connectorKind); String taskUrl = connector.getTaskUrl(repositoryUrl, id); if (taskUrl == null) { return false; } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); if (windows != null && windows.length > 0) { window = windows[0]; } } if (window == null) { return false; } IWorkbenchPage page = window.getActivePage(); OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(connectorKind, repositoryUrl, id, id, taskUrl, timestamp, page); job.setListener(listener); job.schedule(); return true; }

Target:
public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id, TaskOpenListener listener, long timestamp) { String taskUrl = getTaskUrl(connectorKind, repositoryUrl, id); if (taskUrl == null) { return false; } IWorkbenchWindow window = getWindow(); if (window == null) { return false; } IWorkbenchPage page = window.getActivePage(); OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(connectorKind, repositoryUrl, id, taskUrl, timestamp, page); job.setListener(listener); job.schedule(); return true; }
Source:
public void locatorLauncherUsesConfigFileInClasspathWithGeodePlugins() throws Exception { copy(configWithGeodePluginsFile, temporaryFolder.getRoot().toPath().resolve("log4j2.xml")); String classpath = temporaryFolder.getRoot().getAbsolutePath() + File.pathSeparator + geodeDependencies.toFile().getAbsolutePath(); ProcessBuilder processBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(stdoutFile.toFile()) .directory(temporaryFolder.getRoot()) .command("java", "-Dgemfire.http-service-port=" + httpServicePort, "-Dgemfire.jmx-manager-start=true", "-Djava.awt.headless=true", "-cp", classpath, "org.apache.geode.distributed.LocatorLauncher", "start", LOCATOR_NAME, "--port", String.valueOf(locatorPort)); System.out.println("Launching command: " + processBuilder.command()); locator = processBuilder .start(); assertThat(locator.isAlive()).isTrue(); await().untilAsserted(() -> { assertThat(locatorLogFile) .doesNotExist(); assertThat(pulseLogFile) .doesNotExist(); LogFileAssert.assertThat(stdoutFile.toFile()) .exists() .contains("Located war: geode-pulse") .contains("Adding webapp /pulse") .contains("Starting server location for Distribution Locator") .doesNotContain("geode-pulse war file was not found") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); }); }

Target:
public void locatorLauncherUsesConfigFileInClasspathWithGeodePlugins() throws Exception { copy(configWithGeodePluginsFile, temporaryFolder.getRoot().toPath().resolve("log4j2.xml")); String classpath = temporaryFolder.getRoot().getAbsolutePath() + File.pathSeparator + geodeDependencies.toFile().getAbsolutePath(); ProcessBuilder processBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(stdoutFile.toFile()) .directory(temporaryFolder.getRoot()) .command(javaBin.toFile().getAbsolutePath(), "-Dgemfire.http-service-port=" + httpServicePort, "-Dgemfire.jmx-manager-start=true", "-Djava.awt.headless=true", "-cp", classpath, "org.apache.geode.distributed.LocatorLauncher", "start", LOCATOR_NAME, "--port", String.valueOf(locatorPort)); System.out.println("Environment: " + System.getenv()); System.out.println("Launching command: " + processBuilder.command()); locator = processBuilder .start(); assertThat(locator.isAlive()).isTrue(); await().untilAsserted(() -> { assertThat(locatorLogFile) .as(locatorLogFile.toFile().getAbsolutePath()) .doesNotExist(); assertThat(pulseLogFile) .as(pulseLogFile.toFile().getAbsolutePath()) .doesNotExist(); LogFileAssert.assertThat(stdoutFile.toFile()) .as(stdoutFile.toFile().getAbsolutePath()) .exists() .contains("Located war: geode-pulse") .contains("Adding webapp /pulse") .contains("Starting server location for Distribution Locator") .doesNotContain("geode-pulse war file was not found") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); }); }
Source:
public ResponseEntity<String> refreshConfiguration(HttpServletRequest request) { String accessToken = utilService.getAccessTokenFromRequest(request); if (StringUtils.isEmpty(accessToken)) return new ResponseEntity<>("Access token not specified.", HttpStatus.BAD_REQUEST); String role = tokenService.getRole(accessToken); if (!StringUtils.equals(role, UserType.TECH_ADMIN.getName())) return new ResponseEntity<>("Tech Admin role is needed to call this service.", HttpStatus.BAD_REQUEST); randomizationService.refreshConfigurations(accessToken); return new ResponseEntity("Success", HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<String> refreshConfiguration(HttpServletRequest request) { String accessToken = utilService.getAccessTokenFromRequest(request); if (StringUtils.isEmpty(accessToken)) return new ResponseEntity<>("Access token not specified.", HttpStatus.BAD_REQUEST); String userType = tokenService.getUserType(accessToken); if (!StringUtils.equals(userType, UserType.TECH_ADMIN.getName())) return new ResponseEntity<>("Tech Admin user type is needed to call this service.", HttpStatus.FORBIDDEN); Map<String, String> configMap = new HashMap<>(); boolean isSuccess = randomizationService.refreshConfigurations(accessToken, configMap); if (isSuccess) return new ResponseEntity(configMap, HttpStatus.NO_CONTENT); else return new ResponseEntity(configMap, HttpStatus.UNPROCESSABLE_ENTITY); }
Source:
public void getNettyServerTest() throws Exception { Properties properties = new Properties(); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); NettyConfig nettyConfig = new NettyConfig(verifiableProperties); RestRequestHandler restRequestHandler = new MockRestRequestResponseHandler(); PublicAccessLogger publicAccessLogger = new PublicAccessLogger(new String[]{}, new String[]{}); RestServerState restServerState = new RestServerState("/healthCheck"); SSLFactory sslFactory = new MockSSLFactory(verifiableProperties); for (int i = 0; i < 2; i++) { NettyServerFactory nettyServerFactory = new NettyServerFactory(verifiableProperties, new MetricRegistry(), restRequestHandler, publicAccessLogger, restServerState, i == 0 ? sslFactory : null); NioServer nioServer = nettyServerFactory.getNioServer(); assertNotNull("No NioServer returned", nioServer); assertEquals("Did not receive a NettyServer instance", NettyServer.class.getCanonicalName(), nioServer.getClass().getCanonicalName()); Map<Integer, ChannelInitializer<SocketChannel>> channelInitializers = nettyServerFactory.getChannelInitializers(); if (i == 0) { assertEquals("Expected two ChannelInitializers when SSLFactoryImpl is not null", 2, channelInitializers.size()); assertNotNull("No ChannelInitializer for SSL port", channelInitializers.get(nettyConfig.nettyServerSSLPort)); } else { assertEquals("Expected one ChannelInitializer when SSLFactoryImpl is null", 1, channelInitializers.size()); } assertNotNull("No ChannelInitializer for plaintext port", channelInitializers.get(nettyConfig.nettyServerPort)); } }

Target:
public void getNettyServerTest() throws Exception { Properties properties = new Properties(); doGetNettyServerTest(properties, SSL_FACTORY); doGetNettyServerTest(properties, null); properties.setProperty("netty.server.enable.ssl", "true"); doGetNettyServerTest(properties, SSL_FACTORY); }
Source:
public List<FeatureDto> findApplicationFeatures(String applicationName) { List<FeatureDto> features = new ArrayList<FeatureDto>(); try { for (Feature feature : getRepositoryFeatures(applicationName)) { if (!isAppInFeatureList(feature, applicationName)) { features.add(getFeatureView(feature)); } } } catch (Exception ex) { logger.warn("getRepositoryFeatures Exception: " + ex.getMessage(), ex); } return features; }

Target:
public List<FeatureDetails> findApplicationFeatures(String applicationName) { List<FeatureDetails> features = new ArrayList<FeatureDetails>(); try { for (Feature feature : getRepositoryFeatures(applicationName)) { if (!isAppInFeatureList(feature, applicationName)) { features.add(getFeatureView(feature)); } } } catch (Exception ex) { logger.warn("Could not obtain Application Features.", ex); } return features; }
Source:
protected void perform() { if (!getVm().isManaged()) { kubevirt.restart(getVm()); setSucceeded(true); return; } if (isColdReboot()) { ActionReturnValue returnValue = runInternalAction(ActionType.ShutdownVm, new ShutdownVmParameters(getVmId(), false)); setReturnValue(returnValue); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { resourceManager.getVmManager(getVmId()).setColdReboot(true); } } else { final VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RebootVm, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); setActionReturnValue(returnValue.getReturnValue()); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { vmDynamicDao.updateStatus(getVm().getId(), VMStatus.RebootInProgress); } } }

Target:
protected void perform() { if (!getVm().isManaged()) { kubevirt.restart(getVm()); setSucceeded(true); return; } if (isColdReboot()) { ActionReturnValue returnValue = runInternalAction(ActionType.ShutdownVm, new ShutdownVmParameters(getVmId(), false)); setReturnValue(returnValue); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { resourceManager.getVmManager(getVmId()).setColdReboot(true); } } else { final VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RebootVm, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); setActionReturnValue(returnValue.getReturnValue()); setSucceeded(returnValue.getSucceeded()); } if (getSucceeded()) { vmDynamicDao.updateStatus(getVm().getId(), VMStatus.RebootInProgress); } }
Source:
public Method aggregateArguments( final ArgumentsAccessor arguments, final ParameterContext context) throws ArgumentsAggregationException { final int offset = context.getIndex(); final Class<?> clazz = arguments.get(offset, Class.class); final String methodName = arguments.getString(offset + 1); final Class<?>[] args = IntStream.range(offset + 2, arguments.size()) .mapToObj(i -> arguments.get(i, Class.class)) .toArray(Class<?>[]::new); try { return clazz.getMethod(methodName, args); } catch (final NoSuchMethodException e) { throw new ArgumentsAggregationException("Invalid method specified", e); } }

Target:
public Method aggregateArguments( final ArgumentsAccessor arguments, final ParameterContext context) throws ArgumentsAggregationException { final int offset = context.getIndex(); final Class<?> remoteInterface = arguments.get(offset, Class.class); final String methodName = arguments.getString(offset + 1); final Class<?>[] argumentTypes = IntStream.range(offset + 2, arguments.size()) .mapToObj(i -> arguments.get(i, Class.class)) .toArray(Class<?>[]::new); try { return remoteInterface.getMethod(methodName, argumentTypes); } catch (final NoSuchMethodException e) { throw new ArgumentsAggregationException("Invalid method specified", e); } }
Source:
private void checkRoot() throws IOException, InterruptedException { ZooKeeper zk = new ZooKeeper(hostPort, 10000, this); try { zk.create(dirOnZK, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException ke) { } catch (KeeperException ke) { Assert.fail("Unexpected exception code for create " + dirOnZK + ": " + ke.getMessage()); } try { zk.create(testDirOnZK, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException ke) { } catch (KeeperException ke) { Assert.fail("Unexpected exception code for create " + testDirOnZK + ": " + ke.getMessage()); } zk.close(); }

Target:
private void checkRoot() throws IOException, InterruptedException { ZooKeeper zk = new ZooKeeper(hostPort, 10000, this); try { zk.create(dirOnZK, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException ke) { } catch (KeeperException ke) { fail("Unexpected exception code for create " + dirOnZK + ": " + ke.getMessage()); } try { zk.create(testDirOnZK, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException ke) { } catch (KeeperException ke) { fail("Unexpected exception code for create " + testDirOnZK + ": " + ke.getMessage()); } zk.close(); }
Source:
public void verifyBasicRequest() { String expected = "{book {edges {node {id title}}}}"; String actual = document( selection( field( "book", selections( field("id"), field("title") ) ) ) ).toQuery(); Assert.assertEquals(actual, expected); }

Target:
public void verifyBasicRequest() { String expected = "{book {edges {node {id title}}}}"; String actual = document( selection( field( "book", selections( field("id"), field("title") ) ) ) ).toQuery(); assertEquals(expected, actual); }