auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void configurePipes(URL backendUrl, Persona persona) { URL pipeUrl = Urls.getUrl(backendUrl, BackendPipes.Paths.ROOT); URL alertReslveUrl = Urls.getUrl(pipeUrl, BackendPipes.Paths.ALERT_RESOLVE); URL alertAckUrl = Urls.getUrl(pipeUrl, BackendPipes.Paths.ALERT_ACKNOWLEDGE); List<PipeModule> pipeModules = Arrays.asList( getAuthorizationModule(), getPersonnelModule(persona)); configurePipe(BackendPipes.Names.ALERTS, pipeUrl, pipeModules, Alert.class); configurePipe(BackendPipes.Names.ALERT_ACKNOWLEDGE, alertAckUrl, pipeModules, String.class); configurePipe(BackendPipes.Names.ALERT_RESOLVE, alertReslveUrl, pipeModules, String.class); configurePipe(BackendPipes.Names.ENVIRONMENTS, pipeUrl, pipeModules, Environment.class); configurePipe(BackendPipes.Names.METRICS, pipeUrl, pipeModules, Metric.class); configurePipe(BackendPipes.Names.METRIC_DATA_AVAILABILITY, pipeUrl, pipeModules, MetricData.class); configurePipe(BackendPipes.Names.METRIC_DATA_GAUGE, pipeUrl, pipeModules, MetricData.class); configurePipe(BackendPipes.Names.PERSONA, backendUrl, pipeModules, Persona.class); configurePipe(BackendPipes.Names.PERSONAS, backendUrl, pipeModules, Persona.class); configurePipe(BackendPipes.Names.RESOURCES, pipeUrl, pipeModules, Resource.class); configurePipe(BackendPipes.Names.TRIGGERS, pipeUrl, pipeModules, Trigger.class); }

Target:
private void configurePipes(URL backendUrl, Persona persona) { URL pipeUrl = Urls.getUrl(backendUrl, BackendPipes.Paths.ROOT); URL alertResolveUrl = Urls.getUrl(pipeUrl, BackendPipes.Paths.ALERT_RESOLVE); URL alertAckUrl = Urls.getUrl(pipeUrl, BackendPipes.Paths.ALERT_ACKNOWLEDGE); List<PipeModule> pipeModules = Arrays.asList( getAuthorizationModule(), getPersonnelModule(persona)); configurePipe(BackendPipes.Names.ALERTS, pipeUrl, pipeModules, Alert.class); configurePipe(BackendPipes.Names.ALERT_ACKNOWLEDGE, alertAckUrl, pipeModules, String.class); configurePipe(BackendPipes.Names.ALERT_RESOLVE, alertResolveUrl, pipeModules, String.class); configurePipe(BackendPipes.Names.ENVIRONMENTS, pipeUrl, pipeModules, Environment.class); configurePipe(BackendPipes.Names.METRICS, pipeUrl, pipeModules, Metric.class); configurePipe(BackendPipes.Names.METRIC_DATA_AVAILABILITY, pipeUrl, pipeModules, MetricData.class); configurePipe(BackendPipes.Names.METRIC_DATA_GAUGE, pipeUrl, pipeModules, MetricData.class); configurePipe(BackendPipes.Names.PERSONA, backendUrl, pipeModules, Persona.class); configurePipe(BackendPipes.Names.PERSONAS, backendUrl, pipeModules, Persona.class); configurePipe(BackendPipes.Names.RESOURCES, pipeUrl, pipeModules, Resource.class); configurePipe(BackendPipes.Names.TRIGGERS, pipeUrl, pipeModules, Trigger.class); }
Source:
private List<Boolean> createBooleanValuesNoNull() { List<Boolean> values = new ArrayList<>(); for (int i = 0; i < 10_000_000; ++i) { values.add(random.nextBoolean()); } return values; }

Target:
private List<Boolean> createBooleanValuesNoNull() { List<Boolean> values = new ArrayList<>(); for (int i = 0; i < ROWS; ++i) { values.add(random.nextBoolean()); } return values; }
Source:
public boolean isEmpty(){ return getItems() == null || getItems().size() == 0; }

Target:
public boolean isEmpty(){ return getItems() == null || getItems().isEmpty(); }
Source:
static Image getAmiImage(AmazonEC2 ec2, String ami) { List<String> images = new LinkedList<>(); images.add(ami); List<String> owners = new LinkedList<>(); List<String> users = new LinkedList<>(); DescribeImagesRequest request = new DescribeImagesRequest(); request.setImageIds(images); request.setOwners(owners); request.setExecutableUsers(users); List<Image> img = ec2.describeImages(request).getImages(); if (img == null || img.isEmpty()) { return null; } else { return img.get(0); } }

Target:
static Image getAmiImage(AmazonEC2 ec2, String ami) { List<String> images = Collections.singletonList(ami); List<String> owners = Collections.emptyList(); List<String> users = Collections.emptyList(); DescribeImagesRequest request = new DescribeImagesRequest(); request.setImageIds(images); request.setOwners(owners); request.setExecutableUsers(users); List<Image> img = ec2.describeImages(request).getImages(); if (img == null || img.isEmpty()) { return null; } else { return img.get(0); } }
Source:
public int available() { return readableStreamChannel.getSize() - totalBytesRead.get() < Integer.MAX_VALUE ? (int) readableStreamChannel.getSize() - totalBytesRead.get() : Integer.MAX_VALUE; }

Target:
public int available() { return readableStreamChannel.getSize() - totalBytesRead < Integer.MAX_VALUE ? (int) (readableStreamChannel.getSize() - totalBytesRead) : Integer.MAX_VALUE; }
Source:
public void onValueChanged() { view.setEnableCommitButton( !view.getMessage().isEmpty() && (!selectableChangesPanelPresenter.getSelectedFiles().isEmpty() || view.isAmend())); }

Target:
public void onValueChanged() { view.setEnableCommitButton( !view.getCommitMessage().isEmpty() && (!selectableChangesPanelPresenter.getSelectedFiles().isEmpty() || view.isAmend())); }
Source:
private static boolean isRaise(AstNode statementList) { return statementList.getFirstChild().getFirstDescendant(PythonGrammar.RAISE_STMT) != null; }

Target:
private static boolean isRaise(AstNode statementList) { return statementList.getFirstChild().hasDescendant(PythonGrammar.RAISE_STMT); }
Source:
public void testCXidRollover() throws Exception { TestableZooKeeper zk = null; try { zk = createClient(); zk.setXid(Integer.MAX_VALUE - 10); zk.create("/testnode", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); for (int i = 0; i < 20; ++i) { final CountDownLatch latch = new CountDownLatch(1); final AtomicInteger rc = new AtomicInteger(0); zk.setData("/testnode", "".getBytes(), -1, new AsyncCallback.StatCallback() { @Override public void processResult(int retcode, String path, Object ctx, Stat stat) { rc.set(retcode); latch.countDown(); } }, null); Assert.assertTrue("setData should complete within 5s", latch.await(5, TimeUnit.SECONDS)); Assert.assertEquals("setData should have succeeded", Code.OK.intValue(), rc.get()); } zk.delete("/testnode", -1); Assert.assertTrue("xid should be positive", zk.checkXid() > 0); } finally { if (zk != null) { zk.close(); } } }

Target:
public void testCXidRollover() throws Exception { TestableZooKeeper zk = null; try { zk = createClient(); zk.setXid(Integer.MAX_VALUE - 10); zk.create("/testnode", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); for (int i = 0; i < 20; ++i) { final CountDownLatch latch = new CountDownLatch(1); final AtomicInteger rc = new AtomicInteger(0); zk.setData("/testnode", "".getBytes(), -1, new AsyncCallback.StatCallback() { @Override public void processResult(int retcode, String path, Object ctx, Stat stat) { rc.set(retcode); latch.countDown(); } }, null); Assert.assertTrue("setData should complete within 5s", latch.await(zk.getSessionTimeout(), TimeUnit.MILLISECONDS)); Assert.assertEquals("setData should have succeeded", Code.OK.intValue(), rc.get()); } zk.delete("/testnode", -1); Assert.assertTrue("xid should be positive", zk.checkXid() > 0); } finally { if (zk != null) { zk.close(); } } }
Source:
protected String parseString(GraphicalEditPart editPart, Collection<String> displayValue) { NamedElement namedElement = getUMLElement(editPart); StringBuilder buffer = new StringBuilder(); if (displayValue.contains("stereotype")) { buffer.append(stereotypesToDisplay((GraphicalEditPart) editPart.getParent())); } if (namedElement != null) { buffer.append(getCustomLabel(namedElement, displayValue)); } return buffer.toString(); }

Target:
protected String parseString(GraphicalEditPart editPart, Collection<String> displayValue) { NamedElement namedElement = getUMLElement(editPart); StringBuilder buffer = new StringBuilder(); if (displayValue.contains(STEREOTYPE)) { buffer.append(stereotypesToDisplay((GraphicalEditPart) editPart.getParent())); } if (namedElement != null) { buffer.append(getCustomLabel(namedElement, displayValue)); } return buffer.toString(); }
Source:
public void onAttach(@NonNull Context context) { super.onAttach(context); mCameraController = new CameraController(getContext()); }

Target:
public void onAttach(@NonNull Context context) { super.onAttach(context); mCameraController = new CameraController(context); }
Source:
public Task getLatestTask(ItemGroup context, AbstractBuild firstBuild) { AbstractProject<?, ?> project = getProject(this, context); AbstractBuild build = null; if (!ProjectUtil.isQueued(project, firstBuild)) { build = BuildUtil.match(project.getBuilds(), firstBuild); } final Status taskStatus = SimpleStatus.resolveStatus(project, build, firstBuild); final String taskLink = resolveTaskLink(taskStatus, build); final String taskBuildId = resolveBuildId(taskStatus, build); final ManualStep manualStep = ManualStep.getManualStepLatest(project, build, firstBuild); final String buildDescription = TokenUtils.decodedTemplate(build, resolveBuildDescription(build)); final String name = TokenUtils.decodedTemplate(build, this.getName()); final String taskName = (TokenUtils.stringIsNotEmpy(name) ? name : project.getName()); return new Task(this, taskName, taskBuildId, taskStatus, taskLink, manualStep, TestResult.getTestResult(build), buildDescription); }

Target:
public Task getLatestTask(ItemGroup context, AbstractBuild firstBuild) { AbstractProject<?, ?> project = getProject(this, context); AbstractBuild<?, ?> build = null; if (!ProjectUtil.isQueued(project, firstBuild)) { build = BuildUtil.match(project.getBuilds(), firstBuild); } final Status taskStatus = SimpleStatus.resolveStatus(project, build, firstBuild); final String taskLink = resolveTaskLink(taskStatus, build); final String taskBuildId = resolveBuildId(taskStatus, build); final ManualStep manualStep = ManualStep.getManualStepLatest(project, build, firstBuild); final String buildDescription = TokenUtils.decodedTemplate(build, resolveBuildDescription(build)); final String name = TokenUtils.decodedTemplate(build, this.getName()); final String taskName = (TokenUtils.stringIsNotEmpy(name) ? name : project.getDisplayName()); return new Task(this, taskName, taskBuildId, taskStatus, taskLink, manualStep, TestResult.getTestResult(build), buildDescription); }
Source:
protected void generateGroups(String version) { List<String> mvnGroupNames = new ArrayList<>(); mvnGroupNames.addAll(mavenGroups.keySet()); for (String mvnGroupName : mvnGroupNames) { List<String> artifactIds = mavenGroups.get(mvnGroupName); Collections.sort(artifactIds); Set<String> subGroups = new LinkedHashSet<>(); for (String id : artifactIds) { if (id.contains(".")) { String suffix = id.substring(id.lastIndexOf(".") + 1); if (BLACKLIST_SUFFIX.contains(suffix.toLowerCase())) { continue; } String grpName = id.substring(0, id.lastIndexOf(".")); String grp = BundleGroup.PREFIX + grpName; if (grp.equals(mvnGroupName) || BLACKLIST.contains(grpName.toLowerCase())) { continue; } subGroups.add(grp); } } if (subGroups.size() < 1) { } else { for (String grp : subGroups) { List<String> grpArtifactIds = new ArrayList<>(); for (String aid : artifactIds) { if (aid.startsWith(grp) || (BundleGroup.PREFIX + aid).startsWith(grp)) { grpArtifactIds.add(aid); } } if (grpArtifactIds.size() > 1) { for (String aid : grpArtifactIds) { artifactIds.remove(aid); } mavenSubGroups.put(grp, grpArtifactIds); artifactIds.add(grp); } } } } for (String grpId : mavenGroups.keySet()) { buildBundleGroup(grpId, version, true); } }

Target:
protected void generateGroups(String version) { List<String> mvnGroupNames = new ArrayList<>(); mvnGroupNames.addAll(mavenGroups.keySet()); for (String mvnGroupName : mvnGroupNames) { List<String> artifactIds = mavenGroups.get(mvnGroupName); Collections.sort(artifactIds); Set<String> subGroups = new LinkedHashSet<>(); for (String id : artifactIds) { if (id.contains(".")) { String suffix = id.substring(id.lastIndexOf(".") + 1); if (BLACKLIST_SUFFIX.contains(suffix.toLowerCase())) { continue; } String grpName = id.substring(0, id.lastIndexOf(".")); String grp = BundleGroup.PREFIX + grpName; if (grp.equals(mvnGroupName) || BLACKLIST.contains(grpName.toLowerCase())) { continue; } subGroups.add(grp); } } if (subGroups.size() < 1) { } else { for (String grp : subGroups) { List<String> grpArtifactIds = new ArrayList<>(); for (String aid : artifactIds) { if (aid.startsWith(grp) || (BundleGroup.PREFIX + aid).startsWith(grp)) { grpArtifactIds.add(aid); } } if (grpArtifactIds.size() > 1) { artifactIds.removeAll(grpArtifactIds); if (mavenGroups.containsKey(grp)) { mavenGroups.get(grp).addAll(grpArtifactIds); } else { if (mavenSubGroups.containsKey(grp)) { mavenSubGroups.get(grp).addAll(grpArtifactIds); } else { mavenSubGroups.put(grp, grpArtifactIds); } artifactIds.add(grp); } } } } } for (String grpId : mavenGroups.keySet()) { buildBundleGroup(grpId, version, true); } }
Source:
public int run() throws Exception { if (threads <= 0) { threads = 1; } dbInjector = createDbInjector(MULTI_USER); gitInjector = dbInjector.createChildInjector(new LifecycleModule() { @Override protected void configure() { bind(GitRepositoryManager.class).to(LocalDiskRepositoryManager.class); listener().to(LocalDiskRepositoryManager.Lifecycle.class); } }); manager.add(dbInjector, gitInjector); manager.start(); gitInjector.injectMembers(this); final ReviewDb db = database.open(); try { todo = db.changes().all().toList(); synchronized (monitor) { monitor.beginTask("Scanning changes", todo.size()); } } finally { db.close(); } final List<Worker> workers = new ArrayList<Worker>(threads); for (int tid = 0; tid < threads; tid++) { Worker t = new Worker(); t.start(); workers.add(t); } for (Worker t : workers) { t.join(); } synchronized (monitor) { monitor.endTask(); } manager.stop(); return 0; }

Target:
public int run() throws Exception { if (threads <= 0) { threads = 1; } dbInjector = createDbInjector(MULTI_USER); gitInjector = dbInjector.createChildInjector(new LifecycleModule() { @Override protected void configure() { bind(GitRepositoryManager.class).to(LocalDiskRepositoryManager.class); listener().to(LocalDiskRepositoryManager.Lifecycle.class); bind(CachePool.class); install(ProjectCacheImpl.module()); } }); manager.add(dbInjector, gitInjector); manager.start(); gitInjector.injectMembers(this); final ReviewDb db = database.open(); try { todo = db.changes().all().toList(); synchronized (monitor) { monitor.beginTask("Scanning changes", todo.size()); } } finally { db.close(); } final List<Worker> workers = new ArrayList<Worker>(threads); for (int tid = 0; tid < threads; tid++) { Worker t = new Worker(); t.start(); workers.add(t); } for (Worker t : workers) { t.join(); } synchronized (monitor) { monitor.endTask(); } manager.stop(); return 0; }
Source:
public void onStockMediaUploaded(MediaStore.OnStockMediaUploaded event) { mIsUploading = false; showUploadProgressDialog(false); if (event.isError()) { ToastUtils.showToast(this, R.string.media_upload_error); AppLog.e(AppLog.T.MEDIA, "An error occurred while uploading stock media"); } else { int count = event.mediaList.size(); long[] idArray = new long[count]; for (int i = 0; i < count; i++) { idArray[i] = event.mediaList.get(i).getMediaId(); } Map<String, Integer> properties = new HashMap<>(); properties.put("count", count); AnalyticsTracker.track(AnalyticsTracker.Stat.STOCK_MEDIA_UPLOADED, properties); Intent intent = new Intent(); intent.putExtra(KEY_UPLOADED_MEDIA_IDS, idArray); setResult(RESULT_OK, intent); finish(); } }

Target:
public void onStockMediaUploaded(MediaStore.OnStockMediaUploaded event) { mIsUploading = false; showUploadProgressDialog(false); if (event.isError()) { ToastUtils.showToast(this, R.string.media_upload_error); AppLog.e(AppLog.T.MEDIA, "An error occurred while uploading stock media"); } else { trackUploadedStockMediaEvent(event.mediaList); int count = event.mediaList.size(); long[] idArray = new long[count]; for (int i = 0; i < count; i++) { idArray[i] = event.mediaList.get(i).getMediaId(); } Intent intent = new Intent(); intent.putExtra(KEY_UPLOADED_MEDIA_IDS, idArray); setResult(RESULT_OK, intent); finish(); } }
Source:
public void convert(JsonElement value, ColumnVector vect, int row) { if (value == null || value.isJsonNull()) { vect.noNulls = false; vect.isNull[row] = true; } else { if (value.getAsJsonPrimitive().isString()) { TimestampColumnVector vector = (TimestampColumnVector) vect; vector.set( row, Timestamp.valueOf(value.getAsString().replaceAll( "[TZ]", " "))); } else if (value.getAsJsonPrimitive().isNumber()) { TimestampColumnVector vector = (TimestampColumnVector) vect; vector.set( row, new Timestamp(value.getAsLong())); } else { vect.noNulls = false; vect.isNull[row] = true; } } }

Target:
public void convert(JsonElement value, ColumnVector vect, int row) { if (value == null || value.isJsonNull()) { vect.noNulls = false; vect.isNull[row] = true; } else { if (value.getAsJsonPrimitive().isString()) { TimestampColumnVector vector = (TimestampColumnVector) vect; vector.set( row, Timestamp.valueOf(value.getAsString().replaceAll( "[TZ]", " "))); } else if (value.getAsJsonPrimitive().isNumber()) { TimestampColumnVector vector = (TimestampColumnVector) vect; vector.set( row, new Timestamp(value.getAsLong())); } else { if (!back.isBackOff()) { LOG.warn("Timestamp is neither string nor number: {}", value); } vect.noNulls = false; vect.isNull[row] = true; } } }
Source:
protected void finish() { try { if (!samRecords.isEmpty()) flushContainer(); CramIO.issueEOF(cramVersion, outputStream); outputStream.flush(); if (indexer != null) indexer.finish(); outputStream.close(); } catch (final RuntimeException re) { throw re; } catch (final Exception e) { throw new RuntimeException(e); } }

Target:
protected void finish() { try { if (!samRecords.isEmpty()) { flushContainer(); } CramIO.issueEOF(cramVersion, outputStream); outputStream.flush(); if (indexer != null) { indexer.finish(); } outputStream.close(); } catch (final IOException e) { throw new RuntimeIOException(e); } catch (final IllegalAccessException e) { throw new RuntimeException(e); } }
Source:
private void initTitles() { toolbarTitle = new HashMap<>(); toolbarTitle.put(GlucosioExternalLinks.PRIVACY, R.string.preferences_privacy); toolbarTitle.put(GlucosioExternalLinks.LICENSES, R.string.preferences_licences_open); toolbarTitle.put(GlucosioExternalLinks.TERMS, R.string.preferences_licences_open); }

Target:
private void initTitles() { toolbarTitle = new HashMap<>(); toolbarTitle.put(GlucosioExternalLinks.PRIVACY, R.string.preferences_privacy); toolbarTitle.put(GlucosioExternalLinks.LICENSES, R.string.preferences_licences_open); toolbarTitle.put(GlucosioExternalLinks.TERMS, R.string.preferences_terms); }
Source:
public Long getPatientId() { if (isValidPatientId()) { return withPatient.getPatientId(); } return 0L; }

Target:
public Long getPatientId() { Long localId = 0L; if (isValidPatientId()) { localId = withPatient.getPatientId(); } return localId; }
Source:
default Optional<String> get(String key, Locale locale) { checkNotNull(key, "key"); checkNotNull(locale, "locale"); return Optional.of(getBundle(locale).getString(key)); }

Target:
default Optional<String> get(String key, Locale locale) { checkNotNull(key, "key"); checkNotNull(locale, "locale"); try { return Optional.of(getBundle(locale).getString(key)); } catch (MissingResourceException e) { return Optional.empty(); } }
Source:
protected boolean setAndValidateDiskProfiles() { Map<DiskImage, Guid> map = new HashMap<>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageByImageId(parameters.getImageId()); if (diskImage != null && diskImage.getDiskStorageType() == DiskStorageType.IMAGE) { map.put(diskImage, diskImage.getStorageIds().get(0)); } } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map, getStoragePool().getcompatibility_version())); }

Target:
protected boolean setAndValidateDiskProfiles() { Map<DiskImage, Guid> map = new HashMap<>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageByImageId(parameters.getImageId()); map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map, getStoragePool().getcompatibility_version())); }
Source:
public void deleteCollectionAdminGroupNotFoundTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + UUID.randomUUID() + "/adminGroup")) .andExpect(status().isNotFound()); }

Target:
public void deleteCollectionAdminGroupNotFoundTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + UUID.randomUUID() + "/adminGroup")) .andExpect(status().isNotFound()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(adminGroup.getID(), adminGroup.getName()))); }
Source:
private boolean isMuted(TopicPartition tp, long now) { Long throttleUntilTime = muted.get(tp); boolean result = throttleUntilTime != null && throttleUntilTime > now; if (!result) muted.remove(tp); return result; }

Target:
private boolean isMuted(TopicPartition tp, long now) { Long throttleUntilTime = muted.get(tp); if (throttleUntilTime == null) return false; if (now >= throttleUntilTime) { muted.remove(tp); return false; } return true; }
Source:
private void requestLocationPermissions() { if (!getActivity().isFinishing()) { new Single<Object>(){ @Override protected void subscribeActual(SingleObserver<? super Object> observer) { locationManager.requestPermissions(getActivity()); } }.subscribeOn(Schedulers.newThread()) .subscribe(); } }

Target:
private void requestLocationPermissions() { if (!getActivity().isFinishing()) { disposable = new Single<Object>() { @Override protected void subscribeActual(SingleObserver<? super Object> observer) { locationManager.requestPermissions(getActivity()); } }.subscribeOn(Schedulers.newThread()) .subscribe(); } }
Source:
void loadFiles () { if (sourcePath == null) return; files = new HashMap<> (); for (String element : sourcePath) { File file = new File(element); if (file.exists()) { if (!file.isDirectory()) { if (file.getAbsolutePath().endsWith(".java")) { files.put(file, loadFile(file)); } } else { loadDirectory(file); } } } }

Target:
void loadFiles () { if (sourcePath == null) return; files = new HashMap<> (); for (String path : sourcePath) { File file = new File(path); if (file.exists()) { if (!file.isDirectory()) { if (file.getAbsolutePath().endsWith(".java")) { files.put(file, loadFile(file)); } } else { loadDirectory(file); } } } }
Source:
public void deleteRecursively() throws RuntimeIOException { if (isDirectory()) { boolean allSucces = true; for (OverthereFile each : listFiles()) { try { each.deleteRecursively(); } catch (RuntimeIOException rio) { logger.warn("Unable to delete child "+ each + ". Continue...", rio); allSucces = false; } } if (allSucces) { delete(); } else { throw new RuntimeIOException("Cannot delete " + this + ", not all children are deleted."); } } else { delete(); } }

Target:
public void deleteRecursively() throws RuntimeIOException { if (isDirectory()) { RuntimeIOException accumulator = new RuntimeIOException("Cannot delete " + this + ", not all children are deleted."); for (OverthereFile each : listFiles()) { try { each.deleteRecursively(); } catch (RuntimeIOException rio) { logger.warn("Unable to delete child {}. Continue...", each); accumulator.addSuppressed(rio); } } Throwable[] suppressed = accumulator.getSuppressed(); if (suppressed == null || suppressed.length == 0) { delete(); } else { throw accumulator; } } else { delete(); } }
Source:
public static FileSystem getWALFileSystem(final Configuration c) throws IOException { Path p = getWALRootDir(c); FileSystem fs = p.getFileSystem(c); String enforceStreamCapability = c.get(UNSAFE_STREAM_CAPABILITY_ENFORCE); if (enforceStreamCapability != null) { fs.getConf().set(UNSAFE_STREAM_CAPABILITY_ENFORCE, enforceStreamCapability); } if (!c.getBoolean(HConstants.CLUSTER_DISTRIBUTED, false)) { LOG.warn("Cannot enforce durability guarantees while running in" + " standalone mode ({}={}).", HConstants.CLUSTER_DISTRIBUTED, false); fs.getConf().setBoolean(UNSAFE_STREAM_CAPABILITY_ENFORCE, false); } return fs; }

Target:
public static FileSystem getWALFileSystem(final Configuration c) throws IOException { Path p = getWALRootDir(c); FileSystem fs = p.getFileSystem(c); String enforceStreamCapability = c.get(UNSAFE_STREAM_CAPABILITY_ENFORCE); if (enforceStreamCapability != null) { fs.getConf().set(UNSAFE_STREAM_CAPABILITY_ENFORCE, enforceStreamCapability); } if (fs instanceof LocalFileSystem) { final boolean value = false; LOG.warn("Cannot enforce durability guarantees while running on {}. Setting {}={} for" + " this FileSystem.", fs.getUri(), UNSAFE_STREAM_CAPABILITY_ENFORCE, value); fs.getConf().setBoolean(UNSAFE_STREAM_CAPABILITY_ENFORCE, value); } return fs; }
Source:
static OverlapDetector<Interval> getOverlapDetectorFromIntervalListFile(File intervalList, int lhsBuffer, int rhsBuffer) { if (intervalList == null) { return null; } else { List<Interval> intervals = IntervalList.fromFile(intervalList).uniqued().getIntervals(); OverlapDetector<Interval> detector = new OverlapDetector<>(lhsBuffer, rhsBuffer); detector.addAll(intervals, intervals); return detector; } }

Target:
static OverlapDetector<Interval> getOverlapDetectorFromIntervalListFile(File intervalList, int lhsBuffer, int rhsBuffer) { if (intervalList == null) { return null; } List<Interval> intervals = IntervalList.fromFile(intervalList).uniqued().getIntervals(); OverlapDetector<Interval> detector = new OverlapDetector<>(lhsBuffer, rhsBuffer); detector.addAll(intervals, intervals); return detector; }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { File file = new File("zzz"); if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } File zipFile = new File("bak.zip"); ZipHelper zip = new ZipHelper(); zip.zipDir(new File("zzz").getAbsolutePath(), zipFile.getAbsolutePath()); response.setHeader("Content-Type", "application/zip"); response.setHeader("Content-Length", String.valueOf(zipFile.length())); response.setHeader("Content-disposition", "attachment;filename=\"bak.zip\""); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFile)); BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); int b = 0; while (b != -1) { b = bis.read(); if (b != -1) { bos.write(b); } } bos.flush(); bos.close(); bis.close(); }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { File file = new File("zzz"); if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } File zipFile = new File("bak.zip"); FileUtil.zipDir(new File("zzz").getAbsolutePath(), zipFile.getAbsolutePath()); response.setHeader("Content-Type", "application/zip"); response.setHeader("Content-Length", String.valueOf(zipFile.length())); response.setHeader("Content-disposition", "attachment;filename=\"bak.zip\""); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(zipFile)); BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); IoUtil.write(bis, bos); bos.flush(); bos.close(); bis.close(); }
Source:
public Response serviceAnnouncementGET( final @PathParam("id") String id ) { if (Strings.isNullOrEmpty(id)) { return Response.status(Response.Status.BAD_REQUEST) .entity(ServletResourceUtils.sanitizeException( new IllegalArgumentException( "Cannot have null or empty id" ) )) .build(); } try { return handler.handleGET(id); } catch (Exception e) { log.error(e, "Exception in handling GET request for [%s]", id); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }

Target:
public Response serviceAnnouncementGET( final @PathParam("id") String id ) { if (Strings.isNullOrEmpty(id)) { return makeNullIdResponse(); } try { return handler.handleGET(id); } catch (Exception e) { LOG.error(e, "Exception in handling GET request for [%s]", id); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }
Source:
private Response getServiceItemList(String serviceName) { PersistenceService service = null; if (serviceName == null) { } else { service = persistenceServices.get(serviceName); } if (service == null) { logger.warn("Persistence service not found '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.CONFLICT, "Persistence service not found: " + serviceName); } if (!(service instanceof QueryablePersistenceService)) { logger.warn("Persistence service not queryable '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.CONFLICT, "Persistence service not queryable: " + serviceName); } QueryablePersistenceService qService = (QueryablePersistenceService) service; List<PersistenceItemInfoBean> items = new ArrayList<PersistenceItemInfoBean>(); Set<PersistenceItemInfo> itemNames = qService.getItems(); for (PersistenceItemInfo item : itemNames) { PersistenceItemInfoBean itemBean = new PersistenceItemInfoBean(); itemBean.name = item.getName(); itemBean.count = item.getCount(); if (item.getEarliest() != null) { itemBean.earliest = isoDateFormat.format(item.getEarliest()); } if (item.getLatest() != null) { itemBean.latest = isoDateFormat.format(item.getLatest()); } items.add(itemBean); } return JSONResponse.createResponse(Status.OK, items, ""); }

Target:
private Response getServiceItemList(String serviceName) { PersistenceService service = null; if (serviceName == null) { serviceName = PersistenceExtensions.getDefaultService(); } service = persistenceServices.get(serviceName); if (service == null) { logger.debug("Persistence service not found '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Persistence service not found: " + serviceName); } if (!(service instanceof QueryablePersistenceService)) { logger.debug("Persistence service not queryable '{}'.", serviceName); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Persistence service not queryable: " + serviceName); } QueryablePersistenceService qService = (QueryablePersistenceService) service; return JSONResponse.createResponse(Status.OK, qService.getItemInfo(), ""); }
Source:
Iterator<T> iterator() { return new Iterator<T>() { int globalIndex = 0; int index = lastDigit(offset()); T[] leaf = getLeaf(globalIndex); int length = leaf.length; @Override public boolean hasNext() { return globalIndex < BitMappedTrie.this.length(); } @Override public T next() { if (index == length) { setCurrentArray(); } final T next = leaf[index]; index++; globalIndex++; return next; } void setCurrentArray() { index = 0; leaf = getLeaf(globalIndex); length = leaf.length; assert leaf != null; } }; }

Target:
Iterator<T> iterator() { return new Iterator<T>() { final int globalLength = BitMappedTrie.this.length(); int globalIndex = 0; int index = lastDigit(offset()); T[] leaf = getLeaf(globalIndex); int length = leaf.length; @Override public boolean hasNext() { return globalIndex < globalLength; } @Override public T next() { if (index == length) { setCurrentArray(); } final T next = leaf[index]; index++; globalIndex++; return next; } void setCurrentArray() { index = 0; leaf = getLeaf(globalIndex); length = leaf.length; assert leaf != null; } }; }
Source:
protected void execute() { long start = System.currentTimeMillis(); String stackCrn = "NotInitialized"; try { MDCBuilder.buildMdcContext(cluster); cluster = clusterService.findById(clusterId); stackCrn = cluster.getStackCrn(); loadAlert = cluster.getLoadAlerts().stream().findFirst().get(); loadAlertConfiguration = loadAlert.getLoadAlertConfiguration(); policyHostGroup = loadAlert.getScalingPolicy().getHostGroup(); if (isCoolDownTimeElapsed(cluster.getStackCrn(), loadAlertConfiguration.getCoolDownMillis(), cluster.getLastScalingActivity())) { pollYarnMetricsAndScaleCluster(); } } catch (Exception ex) { LOGGER.info("Failed to process load alert for Cluster {}, exception {}", stackCrn, ex); eventPublisher.publishEvent(new UpdateFailedEvent(clusterId)); } finally { LOGGER.debug("Finished loadEvaluator for cluster in ms", stackCrn, System.currentTimeMillis() - start); } }

Target:
protected void execute() { long start = System.currentTimeMillis(); String stackCrn = null; try { MDCBuilder.buildMdcContext(cluster); cluster = clusterService.findById(clusterId); stackCrn = cluster.getStackCrn(); loadAlert = cluster.getLoadAlerts().stream().findFirst().get(); loadAlertConfiguration = loadAlert.getLoadAlertConfiguration(); policyHostGroup = loadAlert.getScalingPolicy().getHostGroup(); if (isCoolDownTimeElapsed(cluster.getStackCrn(), loadAlertConfiguration.getCoolDownMillis(), cluster.getLastScalingActivity())) { pollYarnMetricsAndScaleCluster(); } } catch (Exception ex) { LOGGER.info("Failed to process load alert for Cluster '{}', exception '{}'", stackCrn, ex); eventPublisher.publishEvent(new UpdateFailedEvent(clusterId)); } finally { LOGGER.debug("Finished loadEvaluator for cluster '{}' in '{}' ms", stackCrn, System.currentTimeMillis() - start); } }
Source:
public <T> CompletableFuture<T> callLaterInClientSession(final Callable<T> task) { Assert.requireNonNull(task, "task"); final CompletableFuture<T> future = new CompletableFuture(); runLaterExecutor.execute(new Runnable() { @Override public void run() { try { T result = task.call(); future.complete(result); } catch (Exception e) { LOG.error("Unchaught exception in task!", e); future.completeExceptionally(e); } } }); return future; }

Target:
public <T> CompletableFuture<T> callLaterInClientSession(final Callable<T> task) { Assert.requireNonNull(task, "task"); final CompletableFuture<T> future = new CompletableFuture(); runLaterExecutor.execute(() -> { try { final T result = task.call(); future.complete(result); } catch (final Exception e) { LOG.error("Unchaught exception in task!", e); future.completeExceptionally(e); } }); return future; }
Source:
public final void compileAndValidate( @Nonnull CompilationProperties properties, @Nonnull DexValidator<DexFile> validator, @Nonnull String... testPackages) throws Exception { File[] testFolders = new File[testPackages.length]; for (int i = 0; i < testPackages.length; i++) { testFolders[i] = AbstractTestTools.getTestRootDir(testPackages[i]); } File outFolder = AbstractTestTools.createTempDir(); File out = new File(outFolder, DexFileWriter.DEX_FILENAME); List<Class<? extends IToolchain>> exclude = new ArrayList<>(); if (!properties.allowJillToolchains) { exclude.add(JillBasedToolchain.class); } JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class, exclude); for (Map.Entry<String, Object> e : properties.properties.entrySet()) { toolchain.addProperty(e.getKey(), e.getValue().toString()); } toolchain.addToClasspath(toolchain.getDefaultBootClasspath()) .srcToExe(outFolder, false, testFolders); validator.validate(new DexFile(out)); }

Target:
public final void compileAndValidate( @Nonnull CompilationProperties properties, @Nonnull DexValidator<DexFile> validator, @Nonnull String... testPackages) throws Exception { File[] testFolders = new File[testPackages.length]; for (int i = 0; i < testPackages.length; i++) { testFolders[i] = AbstractTestTools.getTestRootDir(testPackages[i]); } File testFolder = new File(AbstractTestTools.getTestRootDir(testPackage), "jack"); File unitTestFolder = new File(AbstractTestTools.getTestRootDir(testPackage), "dx"); File outFolder = AbstractTestTools.createTempDir(); File out = new File(outFolder, DexFileWriter.DEX_FILENAME); List<Class<? extends IToolchain>> exclude = new ArrayList<>(); if (!properties.allowJillToolchains) { exclude.add(JillBasedToolchain.class); } JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class, exclude); for (Map.Entry<String, Object> e : properties.properties.entrySet()) { toolchain.addProperty(e.getKey(), e.getValue().toString()); } toolchain.addProperty(Optimizations.REMOVE_UNUSED_NON_SYNTHETIC_DEFINITION.getName(), String.valueOf(false)); toolchain.addToClasspath(toolchain.getDefaultBootClasspath()) .srcToExe(outFolder, false, testFolder, unitTestFolder); validator.validate(new DexFile(out)); RuntimeTestHelper.runOnRuntimeEnvironments( Collections.singletonList(testPackage + ".dx.Tests"), RuntimeTestHelper.getJunitDex(), out); }
Source:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { pointer = null; if (walker.isSubtree()) { return walker.isRecursive(); } ObjectId objectId = walker.getObjectId(0); ObjectLoader object = walker.getObjectReader().open(objectId); if (object.getSize() > 1024) { return false; } pointer = LfsPointer.parseLfsPointer(object.openStream()); return pointer != null; }

Target:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { pointer = null; if (walker.isSubtree()) { return walker.isRecursive(); } ObjectId objectId = walker.getObjectId(0); ObjectLoader object = walker.getObjectReader().open(objectId); if (object.getSize() > 1024) { return false; } try (ObjectStream stream = object.openStream()) { pointer = LfsPointer.parseLfsPointer(stream); return pointer != null; } }
Source:
public static void initAsyncPrettyPrinterForResponse( InspectorResponse response, NetworkPeerManager peerManager) { AsyncPrettyPrinterRegistry registry = peerManager.getAsyncPrettyPrinterRegistry(); for (int i = 0, count = response.headerCount(); i < count; i++) { AsyncPrettyPrinterFactory factory = registry.lookup(response.headerName(i)); if (factory != null) { AsyncPrettyPrinter asyncPrettyPrinter = factory.getInstance( response.headerName(i), response.headerValue(i)); peerManager.getResponseBodyFileManager().associateAsyncPrettyPrinterWithId( response.requestId(), asyncPrettyPrinter); break; } } }

Target:
static AsyncPrettyPrinter initAsyncPrettyPrinterForResponse( InspectorResponse response, NetworkPeerManager peerManager) { AsyncPrettyPrinterRegistry registry = peerManager.getAsyncPrettyPrinterRegistry(); AsyncPrettyPrinter asyncPrettyPrinter = createPrettyPrinterForResponse(response, registry); if (asyncPrettyPrinter != null) { peerManager.getResponseBodyFileManager().associateAsyncPrettyPrinterWithId( response.requestId(), asyncPrettyPrinter); } return asyncPrettyPrinter; }
Source:
public static void main(String[] args) throws IOException { JobParameters params = new JobParameters(); JCommander jcommander = new JCommander(params); jcommander.parse(args); SparkConf conf = new SparkConf(); conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer"); conf.set("spark.kryo.registrator", "pl.edu.icm.sparkutils.avro.AvroCompatibleKryoRegistrator"); try (JavaSparkContext sc = new JavaSparkContext(conf)) { HdfsUtils.remove(sc.hadoopConfiguration(), params.outputPath); JavaRDD<DocumentText> documentTexts = sparkAvroLoader.loadJavaRDD(sc, params.inputDocumentTextPath, DocumentText.class); JavaRDD<ExtractedDocumentMetadataMergedWithOriginal> documentMetadatas = sparkAvroLoader.loadJavaRDD(sc, params.inputExtractedDocumentMetadataMergedWithOriginalPath, ExtractedDocumentMetadataMergedWithOriginal.class); JavaPairRDD<CharSequence, DocumentText> documentTextsById = documentTexts .mapToPair(x -> new Tuple2<>(x.getId(), x)); JavaPairRDD<CharSequence, List<CharSequence>> documentMetadatasById = documentMetadatas .filter(x -> Objects.nonNull(x.getImportedAuthors())) .filter(x -> x.getImportedAuthors().stream().allMatch(y -> StringUtils.isNotBlank(y.getFullname()))) .mapToPair(x -> new Tuple2<>(x.getId(), x.getImportedAuthors().stream().map(Author::getFullname).collect(Collectors.toList()))); JavaRDD<DocumentTextWithAuthors> merged = documentTextsById .join(documentMetadatasById) .values() .map(PatentReferenceExtractionInputDocumentTextAuthorMerger::merge); sparkAvroSaver.saveJavaRDD(merged, DocumentTextWithAuthors.SCHEMA$, params.outputPath); } }

Target:
public static void main(String[] args) throws IOException { JobParameters params = new JobParameters(); JCommander jcommander = new JCommander(params); jcommander.parse(args); SparkConf conf = new SparkConf(); conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer"); conf.set("spark.kryo.registrator", "pl.edu.icm.sparkutils.avro.AvroCompatibleKryoRegistrator"); try (JavaSparkContext sc = new JavaSparkContext(conf)) { HdfsUtils.remove(sc.hadoopConfiguration(), params.outputPath); JavaRDD<DocumentText> documentTexts = sparkAvroLoader.loadJavaRDD(sc, params.inputDocumentTextPath, DocumentText.class); JavaRDD<ExtractedDocumentMetadataMergedWithOriginal> documentMetadatas = sparkAvroLoader.loadJavaRDD(sc, params.inputExtractedDocumentMetadataMergedWithOriginalPath, ExtractedDocumentMetadataMergedWithOriginal.class); JavaPairRDD<CharSequence, DocumentText> documentTextsById = documentTexts .mapToPair(x -> new Tuple2<>(x.getId(), x)); JavaPairRDD<CharSequence, List<CharSequence>> documentMetadatasById = documentMetadatas .mapToPair(x -> new Tuple2<>(x.getId(), filterAuthorsOrEmptyList(x.getImportedAuthors()))); JavaRDD<DocumentTextWithAuthors> merged = documentTextsById .join(documentMetadatasById) .values() .map(PatentReferenceExtractionInputDocumentTextAuthorMerger::merge); sparkAvroSaver.saveJavaRDD(merged, DocumentTextWithAuthors.SCHEMA$, params.outputPath); } }
Source:
public void run(final int iteration) { final Map<Long, NeuralNetworkData> workloadMap = memoryStore.getAll(); final Collection<NeuralNetworkData> workload = workloadMap.values(); final Collection<NeuralNetworkData> validationWorkload = new ArrayList<>(); for (final NeuralNetworkData data : workload) { final Matrix input = data.getMatrix(); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } if (data.isValidation()) { validationWorkload.add(data); } else { neuralNetwork.train(input, labels); trainingValidator.validate(input, labels); } data.cleanup(); } for (final NeuralNetworkData data : validationWorkload) { final Matrix input = data.getMatrix(); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } crossValidator.validate(input, labels); data.cleanup(); } LOG.log(Level.INFO, generateIterationLog( trainingValidator.getValidationStats(), crossValidator.getValidationStats(), iteration)); crossValidator.getValidationStats().reset(); trainingValidator.getValidationStats().reset(); }

Target:
public void run(final int iteration) { final Map<Long, NeuralNetworkData> workloadMap = memoryStore.getAll(); final Collection<NeuralNetworkData> workload = workloadMap.values(); final Collection<NeuralNetworkData> validationWorkload = new ArrayList<>(); for (final NeuralNetworkData data : workload) { final Matrix input = data.getMatrix(); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } if (data.isValidation()) { validationWorkload.add(data); } else { neuralNetwork.train(input, labels); trainingValidator.validate(input, labels); } } for (final NeuralNetworkData data : validationWorkload) { final Matrix input = data.getMatrix(); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } crossValidator.validate(input, labels); } LOG.log(Level.INFO, generateIterationLog( trainingValidator.getValidationStats(), crossValidator.getValidationStats(), iteration)); crossValidator.getValidationStats().reset(); trainingValidator.getValidationStats().reset(); }
Source:
public void ifClientSendsCookieRetrieveAndResetIt() { Http.Cookie mockCookie = mock(Http.Cookie.class); doReturn("ABC").when(mockCookie).value(); Http.Request mockRequest = mock(Http.Request.class); doReturn(mockCookie).when(mockRequest).cookie(BridgeConstants.SESSION_TOKEN_HEADER); Http.Context context = mock(Http.Context.class); when(context.request()).thenReturn(mockRequest); Http.Response mockResponse = mock(Http.Response.class); when(context.response()).thenReturn(mockResponse); Http.Context.current.set(context); BaseController controller = new SchedulePlanController(); controller.setBridgeConfig(BridgeConfigFactory.getConfig()); String token = controller.getSessionToken(); assertEquals("ABC", token); verify(mockResponse).setCookie(BridgeConstants.SESSION_TOKEN_HEADER, "ABC", BridgeConstants.BRIDGE_SESSION_EXPIRE_IN_SECONDS, "/", BridgeConfigFactory.getConfig().get("webservices.url"), false, false); }

Target:
public void ifClientSendsCookieRetrieveAndResetIt() { Http.Cookie mockCookie = mock(Http.Cookie.class); doReturn("ABC").when(mockCookie).value(); Http.Request mockRequest = mock(Http.Request.class); doReturn(mockCookie).when(mockRequest).cookie(BridgeConstants.SESSION_TOKEN_HEADER); Http.Context context = mock(Http.Context.class); when(context.request()).thenReturn(mockRequest); Http.Response mockResponse = mock(Http.Response.class); when(context.response()).thenReturn(mockResponse); Http.Context.current.set(context); BridgeConfig mockConfig = mock(BridgeConfig.class); when(mockConfig.get("webservices.url")).thenReturn(WEBSERVICE_URL); when(mockConfig.getEnvironment()).thenReturn(Environment.LOCAL); BaseController controller = new SchedulePlanController(); controller.setBridgeConfig(mockConfig); String token = controller.getSessionToken(); assertEquals("ABC", token); verify(mockResponse).setCookie(BridgeConstants.SESSION_TOKEN_HEADER, "ABC", BridgeConstants.BRIDGE_SESSION_EXPIRE_IN_SECONDS, "/", WEBSERVICE_URL, false, false); }
Source:
public void removeRegistryHook(RegistryHook<Item> hook) { registryHooks.add(hook); }

Target:
public void removeRegistryHook(RegistryHook<Item> hook) { registryHooks.remove(hook); }
Source:
protected void onHide() { super.onHide(); Event entityChangedEvent = getModel().getDiskViewType().getEntityChangedEvent(); entityChangedEvent.removeListener(getView().getDiskTypeChangedEventListener()); }

Target:
protected void onHide() { super.onHide(); Event systemTreeSelectedItemChangedEvent = CommonModel.getInstance().getSystemTree().getSelectedItemChangedEvent(); systemTreeSelectedItemChangedEvent.removeListener(systemTreeListener); }
Source:
void dispose(OpenHashSet<Disposable> set) { if (set == null) { return; } List<Throwable> errors = null; Object[] array = set.keys(); for (Object o : array) { if (o instanceof Disposable) { try { ((Disposable) o).dispose(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); if (errors == null) { errors = new ArrayList<Throwable>(); } errors.add(ex); } } } if (errors != null) { if (errors.size() == 1) { Throwable ex = errors.get(0); if (ex instanceof Error) { throw (Error)ex; } if (ex instanceof RuntimeException) { throw (RuntimeException)ex; } throw ExceptionHelper.wrap(ex); } throw new CompositeException(errors); } }

Target:
void dispose(OpenHashSet<Disposable> set) { if (set == null) { return; } List<Throwable> errors = null; Object[] array = set.keys(); for (Object o : array) { if (o instanceof Disposable) { try { ((Disposable) o).dispose(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); if (errors == null) { errors = new ArrayList<Throwable>(); } errors.add(ex); } } } if (errors != null) { if (errors.size() == 1) { throw ExceptionHelper.wrapOrThrow(errors.get(0)); } throw new CompositeException(errors); } }
Source:
public void testSurroundingScopeOfNodeChildOfLiteralNewIsAnoninner() { final DetailAST ast = new DetailAST(); ast.setType(TokenTypes.LITERAL_NEW); final DetailAST ast2 = new DetailAST(); ast2.setType(TokenTypes.IDENT); ast.addChild(ast2); Assert.assertEquals(Scope.ANONINNER, ScopeUtils.getSurroundingScope(ast2)); }

Target:
public void testSurroundingScopeOfNodeChildOfLiteralNewIsAnoninner() { assertEquals(Scope.ANONINNER, ScopeUtils.getSurroundingScope( getNode(TokenTypes.LITERAL_NEW, TokenTypes.IDENT))); }