auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void onFragmentLoaded() { if (listAdapter == null) { MainActivity mainActivity = (MainActivity) getActivity(); listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess, new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes()); listAdapter.setHasStableIds(true); recyclerView.setAdapter(listAdapter); } if(episodes == null || episodes.size() == 0) { recyclerView.setVisibility(View.GONE); layoutEmpty.setVisibility(View.VISIBLE); } else { layoutEmpty.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } listAdapter.notifyDataSetChanged(); restoreScrollPosition(); getActivity().supportInvalidateOptionsMenu(); updateShowOnlyEpisodesListViewState(); }

Target:
private void onFragmentLoaded() { if (listAdapter == null) { MainActivity mainActivity = (MainActivity) getActivity(); listAdapter = new AllEpisodesRecycleAdapter(mainActivity, itemAccess, new DefaultActionButtonCallback(mainActivity), showOnlyNewEpisodes()); listAdapter.setHasStableIds(true); recyclerView.setAdapter(listAdapter); } if (episodes == null || episodes.size() == 0) { recyclerView.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); } else { emptyView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } listAdapter.notifyDataSetChanged(); restoreScrollPosition(); getActivity().supportInvalidateOptionsMenu(); updateShowOnlyEpisodesListViewState(); }
Source:
public void zoomTo() { if (urlParser.isValid() && !zoomedTo) { final Timer timer = new Timer() { @Override public void run() { mapWidget.getMapModel().getMapView().setCurrentScale(urlParser.getR(), MapView.ZoomOption.EXACT); mapWidget.getMapModel().getMapView().setCenterPosition(new Coordinate(urlParser.getX(), urlParser.getY())); this.cancel(); zoomedTo = true; } }; timer.schedule(100); } }

Target:
private void zoomTo() { if (urlParser.isValid() && !zoomedTo) { final Timer timer = new Timer() { @Override public void run() { mapWidget.getMapModel().getMapView().setCurrentScale(urlParser.getR(), MapView.ZoomOption.EXACT); mapWidget.getMapModel().getMapView().setCenterPosition(new Coordinate(urlParser.getX(), urlParser.getY())); this.cancel(); zoomedTo = true; } }; timer.schedule(100); } }
Source:
public void init() { if (!isInit) { try { initInternal(); isInit = true; } catch (final AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException | RyaClientException e) { logger.warn("Unable to initialize index. Throwing Runtime Exception. ", e); throw new RuntimeException(e); } } }

Target:
public void init() { if (!isInit) { try { initReadWrite(); isInit = true; } catch (final AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException | RyaClientException e) { logger.error("Unable to initialize index. Throwing Runtime Exception. ", e); throw new RuntimeException(e); } } }
Source:
public Optional<ImmutableZkWorker> findWorkerForTask( RemoteTaskRunnerConfig config, ImmutableMap<String, ImmutableZkWorker> zkWorkers, Task task ) { final TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int comparation = -Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if(comparation == 0) { comparation = zkWorker2.getWorker().getIp().compareTo(zkWorker.getWorker().getIp()); } return comparation; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } return Optional.absent(); }

Target:
public Optional<ImmutableZkWorker> findWorkerForTask( RemoteTaskRunnerConfig config, ImmutableMap<String, ImmutableZkWorker> zkWorkers, Task task ) { final TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int retVal = -Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if(retVal == 0) { retVal = zkWorker2.getWorker().getVersion().compareTo(zkWorker.getWorker().getVersion()); } return retVal; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } return Optional.absent(); }
Source:
protected void buildEnvVarsFromActionable(Actionable build, Map<String, String> env) { MercurialTagAction a = findTag(build); if (a != null) { env.put("MERCURIAL_REVISION", a.id); env.put("MERCURIAL_REVISION_SHORT", a.getShortId()); env.put("MERCURIAL_REVISION_NUMBER", a.rev); } }

Target:
void buildEnvVarsFromActionable(Actionable build, Map<String, String> env) { MercurialTagAction a = findTag(build); if (a != null) { env.put("MERCURIAL_REVISION", a.id); env.put("MERCURIAL_REVISION_SHORT", a.getShortId()); env.put("MERCURIAL_REVISION_NUMBER", a.rev); } }
Source:
public boolean equals(Object obj) { return Objects.equals(obj, inputEdge); }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SourceInputConfig)) { return false; } SourceInputConfig other = (SourceInputConfig) obj; return Objects.equals(other.inputEdge, inputEdge); }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getHttpRequest().setHeader("Ocp-Apim-Subscription-Key", credential.getSubscriptionKey()); return next.process(); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getHttpRequest().setHeader(OCP_APIM_SUBSCRIPTION_KEY, credential.getSubscriptionKey()); return next.process(); }
Source:
public void updateFeaturedImage(long featuredImageId) { EditPostRepository postRepository = getEditPostRepository(); if (postRepository == null) { return; } postRepository.update(postModel -> { postModel.setFeaturedImageId(featuredImageId); updateFeaturedImageView(); if (featuredImageId != 0) { mFeaturedImageHelper.trackFeaturedImageEvent( FeaturedImageHelper.TrackableEvent.IMAGE_PICKED, postModel, OriginType.EDIT_POST_SETTINGS ); } return true; }); }

Target:
public void updateFeaturedImage(long featuredImageId) { EditPostRepository postRepository = getEditPostRepository(); if (postRepository == null) { return; } postRepository.update(postModel -> { postModel.setFeaturedImageId(featuredImageId); updateFeaturedImageView(); return true; }); }
Source:
private boolean isUnitTest(MethodTree tree) { for (AnnotationTree annotationTree : tree.modifiers().annotations()) { if (annotationTree.symbolType().is("org.junit.Test")) { return true; } } Symbol.TypeSymbol enclosingClass = tree.symbol().enclosingClass(); return enclosingClass != null && enclosingClass.type().isSubtypeOf("junit.framework.TestCase") && tree.simpleName().name().startsWith("test"); }

Target:
private boolean isUnitTest(MethodTree tree) { if (tree.symbol().metadata().isAnnotatedWith("org.junit.Test")) { return true; } Symbol.TypeSymbol enclosingClass = tree.symbol().enclosingClass(); return enclosingClass != null && enclosingClass.type().isSubtypeOf("junit.framework.TestCase") && tree.simpleName().name().startsWith("test"); }
Source:
public static boolean containsErrors(Comparison comparison) { boolean isError = false; Diagnostic diagnostic = comparison.getDiagnostic(); if (diagnostic != null) { return diagnostic.getSeverity() > Diagnostic.WARNING; } return isError; }

Target:
public static boolean containsErrors(Comparison comparison) { Diagnostic diagnostic = comparison.getDiagnostic(); if (diagnostic != null) { return diagnostic.getSeverity() > Diagnostic.WARNING; } return false; }
Source:
public Object apply(ConfigResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException { if (input == null || input.operation == null) { throw new BadRequestException("operation must be specified"); } switch (input.operation) { case FLUSH_ALL: for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.apply(cacheResource, new FlushCache.Input()); } return Response.ok("ok"); default: throw new BadRequestException("unsupported operation: " + input.operation); } }

Target:
public Object apply(ConfigResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException { if (input == null || input.operation == null) { throw new BadRequestException("operation must be specified"); } switch (input.operation) { case FLUSH_ALL: for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { CacheResource cacheResource = new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()); if (FlushCache.WEB_SESSIONS.equals(cacheResource.getName())) { continue; } flushCache.apply(cacheResource, null); } return Response.ok(""); default: throw new BadRequestException("unsupported operation: " + input.operation); } }
Source:
private void createRootExtensionsDirectory(File atLocation) { if (!atLocation.mkdirs()) { throw new RuntimeException( String.format( "Unable to create extensions directory at [%s]", atLocation.getAbsolutePath() ) ); } }

Target:
private void createRootExtensionsDirectory(File atLocation) { if (!atLocation.mkdirs()) { throw new ISE( String.format( "Unable to create extensions directory at [%s]", atLocation.getAbsolutePath() ) ); } }
Source:
private Response processMessage(final Message message) { if (message == null) { throw new IllegalArgumentException("Cannot notify listeners for null message"); } Class<? extends Message> messageType = message.getClass(); Response finalResponse = Response.empty(); synchronized (messageHandlers) { List<MessageHandler> handlers = messageHandlers.get(messageType); if (handlers != null) { for (MessageHandler handler : handlers) { try { Response response = processMessage(handler, message); finalResponse = finalResponse.combine(response); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while processing message", e); } } } } return finalResponse; }

Target:
private Response processMessage(final Message message) { if (message == null) { throw new IllegalArgumentException("Cannot notify listeners for null message"); } Class<? extends Message> messageType = message.getClass(); Response finalResponse = Response.empty(); synchronized (messageHandlers) { List<MessageHandler> handlers = messageHandlers.get(messageType); if (handlers != null) { for (MessageHandler handler : handlers) { try { Response response = processMessage(handler, message); finalResponse = finalResponse.combine(response); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while processing message " + message, e); } } } } return finalResponse; }
Source:
public boolean apply(@Nullable Entity input) { if (input == null) return false; for (Class<?> cls : ClassUtils.getAllInterfaces(input.getClass())) { if (pattern.matcher(cls.getName()).matches()) { return true; } } return false; }

Target:
public boolean apply(@Nullable Entity input) { if (input == null) return false; for (Class<?> cls : Reflections.getAllInterfaces(input.getClass())) { if (pattern.matcher(cls.getName()).matches()) { return true; } } return false; }
Source:
Map<String, Object> parse(Map<String, String> substitutions, Properties props, List<String> moduleArgs) { ArgumentsParser parser = new ArgumentsParser(props, moduleArgs.remove(0)); parser.getSubstitutions().putAll(substitutions); parser.parse(moduleArgs); Map<String, Object> argMap = parser.getParsedArgs(); if((Boolean)argMap.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { System.err.format("FATAL: %s%n", t.getMessage()); } throw new ExitException("Parsing error", 1); } return argMap; }

Target:
Map<String, Object> parse(Map<String, String> substitutions, Properties props, List<String> moduleArgs) { ArgumentsParser parser = new ArgumentsParser(props, moduleArgs.remove(0)); parser.getSubstitutions().putAll(substitutions); parser.parse(moduleArgs); Map<String, Object> argMap = parser.getParsedArgs(); if((Boolean)argMap.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { log.error(t.getMessage()); } throw new ExitException("Parsing error", 1); } if (moduleArgs.size() != 0) { log.error("Extra parameters in command-line"); throw new ExitException("Parsing error", 1); } return argMap; }
Source:
public void testAllowNonRBAC() throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(TestModelType.DOMAIN) .setXmlResource("domain-transform-no-rbac-provider.xml"); builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion).skipReverseControllerCheck(); KernelServices mainServices = builder.build(); Assert.assertTrue(mainServices.isSuccessfulBoot()); KernelServices legacyServices = mainServices.getLegacyServices(modelVersion); Assert.assertTrue(legacyServices.isSuccessfulBoot()); ModelFixer fixer = new RbacModelFixer(modelVersion) { @Override public ModelNode fixModel(ModelNode modelNode) { System.out.println("Running for " + modelVersion); return super.fixModel(modelNode); } }; if (modelVersion.getMajor() == 4) { checkCoreModelTransformation(mainServices, modelVersion, fixer, null); } mainServices.shutdown(); }

Target:
public void testAllowNonRBAC() throws Exception { KernelServicesBuilder builder = createKernelServicesBuilder(TestModelType.DOMAIN) .setXmlResource("domain-transform-no-rbac-provider.xml"); builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion).skipReverseControllerCheck(); KernelServices mainServices = builder.build(); Assert.assertTrue(mainServices.isSuccessfulBoot()); KernelServices legacyServices = mainServices.getLegacyServices(modelVersion); Assert.assertTrue(legacyServices.isSuccessfulBoot()); checkCoreModelTransformation(mainServices, modelVersion, new RbacModelFixer(modelVersion), null); mainServices.shutdown(); }
Source:
@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = rs.getDatabase(getDefaultCatalog(conf), dbName); if (database != null) { return !ReplUtils.isFirstIncDone(database.getParameters()); } LOG.info("Unable to find database " + dbName); return true; } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }

Target:
@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = rs.getDatabase(getDefaultCatalog(conf), dbName); return ReplUtils.isFirstIncPending(database.getParameters()); } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }
Source:
public String getName() { return "COLLATION_KEY"; }

Target:
public String getName() { return NAME; }
Source:
abstract ActionResult getCachedActionResult(DigestUtil.ActionKey actionKey) throws IOException, InterruptedException; abstract public boolean isGrpcBlobStore(); abstract void upload( DigestUtil.ActionKey actionKey, Action action, Command command, Path execRoot, Collection<Path> files, FileOutErr outErr) throws ExecException, IOException, InterruptedException; protected abstract ListenableFuture<Void> downloadBlob(Digest digest, OutputStream out); public ListenableFuture<byte[]> downloadBlob(Digest digest) { if (digest.getSizeBytes() == 0) { return EMPTY_BYTES; } ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) digest.getSizeBytes()); SettableFuture<byte[]> outerF = SettableFuture.create(); Futures.addCallback( downloadBlob(digest, bOut), new FutureCallback<Void>() { @Override public void onSuccess(Void aVoid) { outerF.set(bOut.toByteArray()); } @Override public void onFailure(Throwable t) { outerF.setException(t); } }, directExecutor()); return outerF; }

Target:
abstract ActionResult getCachedActionResult(DigestUtil.ActionKey actionKey) throws IOException, InterruptedException; abstract public boolean supportsRemoteExecution(); abstract void upload( DigestUtil.ActionKey actionKey, Action action, Command command, Path execRoot, Collection<Path> files, FileOutErr outErr) throws ExecException, IOException, InterruptedException; protected abstract ListenableFuture<Void> downloadBlob(Digest digest, OutputStream out); public ListenableFuture<byte[]> downloadBlob(Digest digest) { if (digest.getSizeBytes() == 0) { return EMPTY_BYTES; } ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) digest.getSizeBytes()); SettableFuture<byte[]> outerF = SettableFuture.create(); Futures.addCallback( downloadBlob(digest, bOut), new FutureCallback<Void>() { @Override public void onSuccess(Void aVoid) { outerF.set(bOut.toByteArray()); } @Override public void onFailure(Throwable t) { outerF.setException(t); } }, directExecutor()); return outerF; }
Source:
public void matchesEmptyType() throws IOException { MatcherAssert.assertThat( new FkContentType( "*/*", FkContentTypeTest.createTakeWithEmptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "" ) ).has(), Matchers.is(true) ); }

Target:
public void matchesEmptyType() throws IOException { MatcherAssert.assertThat( new FkContentType( "*/*", FkContentTypeTest.emptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "" ) ).has(), Matchers.is(true) ); }
Source:
private String getTokenValue(int length) { lastTokenType = TOKEN_VALUE; lastTokenValue = builder.substring(0, length); builder = new StringBuilder(BUFFER_SIZE); return lastTokenValue; }

Target:
private String getTokenValue(int length) { lastTokenType = TOKEN_VALUE; lastTokenValue = builder.toString(); builder.setLength(0); return lastTokenValue; }
Source:
public Entity sendEntitySpawn(Player player, EntityType entityType, Location location, ArrayList<Mechanism> mechanisms) { PlayerConnection conn = ((CraftPlayer) player).getHandle().playerConnection; net.minecraft.server.v1_15_R1.Entity nmsEntity = ((CraftWorld) location.getWorld()).createEntity(location, entityType.getEntityClass()); EntityTag entity = new EntityTag(nmsEntity.getBukkitEntity()); for (Mechanism mechanism : mechanisms) { entity.safeAdjust(mechanism); } EntityTag.rememberEntity(entity.getBukkitEntity()); if (nmsEntity instanceof EntityLiving) { EntityLiving nmsLivingEntity = (EntityLiving) nmsEntity; conn.sendPacket(new PacketPlayOutSpawnEntityLiving(nmsLivingEntity)); for (EnumItemSlot itemSlot : EnumItemSlot.values()) { ItemStack nmsItemStack = nmsLivingEntity.getEquipment(itemSlot); if (nmsItemStack != null && nmsItemStack.getItem() != Items.AIR) { conn.sendPacket(new PacketPlayOutEntityEquipment(nmsLivingEntity.getId(), itemSlot, nmsItemStack)); } } } else if (nmsEntity instanceof EntityExperienceOrb) { conn.sendPacket(new PacketPlayOutSpawnEntityExperienceOrb((EntityExperienceOrb) nmsEntity)); } else if (nmsEntity instanceof EntityPainting) { conn.sendPacket(new PacketPlayOutSpawnEntityPainting((EntityPainting) nmsEntity)); } else if (nmsEntity instanceof EntityLightning) { conn.sendPacket(new PacketPlayOutSpawnEntityWeather(nmsEntity)); } else { conn.sendPacket(new PacketPlayOutSpawnEntity(nmsEntity)); } conn.sendPacket(new PacketPlayOutEntityMetadata(nmsEntity.getId(), nmsEntity.getDataWatcher(), true)); return entity.getBukkitEntity(); }

Target:
public Entity sendEntitySpawn(Player player, EntityType entityType, Location location, ArrayList<Mechanism> mechanisms) { PlayerConnection conn = ((CraftPlayer) player).getHandle().playerConnection; net.minecraft.server.v1_15_R1.Entity nmsEntity = ((CraftWorld) location.getWorld()).createEntity(location, entityType.getEntityClass()); EntityTag entity = new EntityTag(nmsEntity.getBukkitEntity()); for (Mechanism mechanism : mechanisms) { entity.safeAdjust(mechanism); } if (nmsEntity instanceof EntityLiving) { EntityLiving nmsLivingEntity = (EntityLiving) nmsEntity; conn.sendPacket(new PacketPlayOutSpawnEntityLiving(nmsLivingEntity)); for (EnumItemSlot itemSlot : EnumItemSlot.values()) { ItemStack nmsItemStack = nmsLivingEntity.getEquipment(itemSlot); if (nmsItemStack != null && nmsItemStack.getItem() != Items.AIR) { conn.sendPacket(new PacketPlayOutEntityEquipment(nmsLivingEntity.getId(), itemSlot, nmsItemStack)); } } } else if (nmsEntity instanceof EntityExperienceOrb) { conn.sendPacket(new PacketPlayOutSpawnEntityExperienceOrb((EntityExperienceOrb) nmsEntity)); } else if (nmsEntity instanceof EntityPainting) { conn.sendPacket(new PacketPlayOutSpawnEntityPainting((EntityPainting) nmsEntity)); } else if (nmsEntity instanceof EntityLightning) { conn.sendPacket(new PacketPlayOutSpawnEntityWeather(nmsEntity)); } else { conn.sendPacket(new PacketPlayOutSpawnEntity(nmsEntity)); } conn.sendPacket(new PacketPlayOutEntityMetadata(nmsEntity.getId(), nmsEntity.getDataWatcher(), true)); return entity.getBukkitEntity(); }
Source:
private boolean navigate(WebElement dateBox, Calendar date) { dateBox.click(); Calendar selectedDate = Calendar.getInstance(); String month = date.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH); String year = Integer.toString(date.get(Calendar.YEAR)); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); try { selectedDate.setTime(dateFormat.parse(dateBox.getAttribute("value"))); } catch (ParseException e) { e.printStackTrace(); } if (selectedDate.after(date)) { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement previousButton = browser.driver.findElement(By.className("ui-datepicker-prev")); if (previousButton.getAttribute("class").contains("ui-state-disabled")) { return false; } else { previousButton.click(); } } } else { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement nextButton = browser.driver.findElement(By.className("ui-datepicker-next")); if (nextButton.getAttribute("class").contains("ui-state-disabled")) { return false; } else { nextButton.click(); } } } return true; }

Target:
private boolean navigate(WebElement dateBox, Calendar date) throws ParseException { dateBox.click(); Calendar selectedDate = Calendar.getInstance(); String month = date.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH); String year = Integer.toString(date.get(Calendar.YEAR)); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); selectedDate.setTime(dateFormat.parse(dateBox.getAttribute("value"))); if (selectedDate.after(date)) { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement previousButton = browser.driver.findElement(By.className("ui-datepicker-prev")); if (previousButton.getAttribute("class").contains("ui-state-disabled")) { return false; } else { previousButton.click(); } } } else { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement nextButton = browser.driver.findElement(By.className("ui-datepicker-next")); if (nextButton.getAttribute("class").contains("ui-state-disabled")) { return false; } else { nextButton.click(); } } } return true; }
Source:
public void setClipOverlappingReads(final boolean clipOverlappingReads) { this.clipOverlappingReads = clipOverlappingReads; this.hardClipOverlappingReads = false; }

Target:
public void setClipOverlappingReads(final boolean clipOverlappingReads) { this.clipOverlappingReads = clipOverlappingReads; }
Source:
private boolean isGMFSpecificEditPart(EditPart editPart) { return editPart instanceof NoteEditPart || editPart instanceof TextEdit || editPart instanceof NoteAttachmentEditPart; }

Target:
private boolean isGMFSpecificEditPart(EditPart editPart) { return editPart instanceof SiriusNoteEditPart || editPart instanceof SiriusTextEditPart || editPart instanceof NoteAttachmentEditPart; }
Source:
public void setUp() throws IOException, InterruptedException, ParseException, ConceptNameAlreadyInUseException { openMRSTasksNotifier = (OpenMRSTasksNotifier) ServiceRetriever .getWebAppContext(bundleContext, OPENMRS_CHANNEL_NAME) .getBean("openMrsTasksNotifier"); setUpSecurityContext("motech", "motech", "manageTasks", "manageOpenMRS"); waitForChannel(OPENMRS_CHANNEL_NAME); waitForChannel(MDS_CHANNEL_NAME); createPatientTestData(); createEncounterTestData(); }

Target:
public void setUp() throws IOException, InterruptedException, ParseException, ConceptNameAlreadyInUseException { setUpSecurityContext("motech", "motech", "manageTasks", "manageOpenMRS"); waitForChannel(OPENMRS_CHANNEL_NAME); waitForChannel(MDS_CHANNEL_NAME); createPatientTestData(); createEncounterTestData(); }
Source:
private void loadView() { try { FXMLLoader loader = new FXMLLoader(UI.class.getResource("fxml/PickerBoardItem.fxml")); loader.setRoot(this); loader.setController(this); loader.load(); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void loadView() { try { FXMLLoader loader = new FXMLLoader(UI.class.getResource("fxml/PickerBoardItem.fxml")); loader.setRoot(this); loader.setController(this); loader.load(); } catch (IOException e) { logger.error("Failure to load FXML. " + e.getMessage()); } }
Source:
public static void run(ISafeRunnable code) { run(new ISafeRunnableWithResult<Object>() { @Override public Object runWithResult() throws Exception { code.run(); return null; } @Override public void handleException(Throwable exception) { code.handleException(exception); } }); }

Target:
public static void run(ISafeRunnable code) { run(new ISafeRunnableWithResult<Void>() { @Override public Void runWithResult() throws Exception { code.run(); return null; } @Override public void handleException(Throwable exception) { code.handleException(exception); } }); }
Source:
private void addToRecentAdapter(final View view) { if (adapter == null) { return; } logger.debug("reloading adapter..."); final String selectedId = adapter.getVideoId(); if (getRecentDownloadedVideosTask != null) { getRecentDownloadedVideosTask.cancel(true); } else { getRecentDownloadedVideosTask = new GetRecentDownloadedVideosTask(getActivity()) { @Override protected void onSuccess(List<SectionItemInterface> list) throws Exception { super.onSuccess(list); if (list != null) { adapter.clear(); for (SectionItemInterface m : list) { adapter.add(m); } logger.debug("reload done"); } if (adapter.getCount() <= 0) { hideDeletePanel(view); } videoListView.setOnItemClickListener(adapter); if (selectedId != null) { adapter.setVideoId(selectedId); } notifyAdapter(); if (playerFragment != null) { playerFragment.setNextPreviousListeners(getNextListener(), getPreviousListener()); } } }; } getRecentDownloadedVideosTask.execute(); }

Target:
private void addToRecentAdapter(final View view) { if (adapter == null) { return; } logger.debug("reloading adapter..."); final String selectedId = adapter.getVideoId(); if (getRecentDownloadedVideosTask != null) { getRecentDownloadedVideosTask.cancel(true); } else { getRecentDownloadedVideosTask = new GetRecentDownloadedVideosTask(getActivity()) { @Override protected void onSuccess(List<SectionItemInterface> list) throws Exception { super.onSuccess(list); if (list != null && !list.isEmpty()) { adapter.clear(); adapter.addAll(list); logger.debug("reload done"); } if (adapter.getCount() <= 0) { hideDeletePanel(view); } videoListView.setOnItemClickListener(adapter); if (selectedId != null) { adapter.setVideoId(selectedId); } notifyAdapter(); if (playerFragment != null) { playerFragment.setNextPreviousListeners(getNextListener(), getPreviousListener()); } } }; } getRecentDownloadedVideosTask.execute(); }
Source:
public void secondary_id_not_found() throws Exception { thrown.expectMessage("Invalid test file: precise secondary location is provided for ID 'B' but no issue is asserted with such ID"); check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }

Target:
public void secondary_id_not_found() throws Exception { thrown.expectMessage("Invalid test file: precise secondary location is provided for ID 'B' but no issue is asserted with such ID (line 3)"); check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }
Source:
public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; Map<String, String> map = attribute.valueAsMap(); if(map.isEmpty()) return; Set<String> mapKeys = map.keySet(); for(String mapKey: mapKeys) { String value = map.get(mapKey); if (value == null || value.isEmpty()) throw new WrongAttributeValueException(attribute, "AUPs for key: '"+mapKey+"' can't be empty."); try { JSONArray array = new JSONArray(value); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); if (!object.has("version")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key version in JSON."); if (!object.has("date")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key date in JSON."); if (!object.has("link")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key link in JSON."); if (!object.has("text")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key text in JSON."); } } catch (JSONException ex) { throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is not valid JSON.", ex); } } }

Target:
public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; Map<String, String> map = attribute.valueAsMap(); Set<String> mapKeys = map.keySet(); for(String mapKey: mapKeys) { String value = map.get(mapKey); if (value == null || value.isEmpty()) throw new WrongAttributeValueException(attribute, "AUPs for key: '"+mapKey+"' can't be empty."); try { JSONArray array = new JSONArray(value); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); if (!object.has("version")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key version in JSON."); if (!object.has("date")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key date in JSON."); if (!object.has("link")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key link in JSON."); if (!object.has("text")) throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is missing key text in JSON."); } } catch (JSONException ex) { throw new WrongAttributeValueException(attribute, "AUP for key: '"+mapKey+"' is not valid JSON.", ex); } } }
Source:
public KafkaFuture<Void> all() { final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>(); this.future.whenComplete((topicPartitions, throwable) -> { if (throwable != null) { result.completeExceptionally(throwable); } else for (TopicPartition partition : partitions) { if (hasPartitionLevelError(topicPartitions, partition, result)) { return; } } result.complete(null); }); return result; }

Target:
public KafkaFuture<Void> all() { final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>(); this.future.whenComplete((topicPartitions, throwable) -> { if (throwable != null) { result.completeExceptionally(throwable); } else { for (TopicPartition partition : partitions) { if (maybeCompleteExceptionally(topicPartitions, partition, result)) { return; } } result.complete(null); } }); return result; }
Source:
public Record<K,V>[] createStorage(int size) { return (Record<K,V>[])new Record[size]; }

Target:
public Record<K,V>[] createStorage(int size) { return new Record[size]; }
Source:
private void shootProjectile(final Integer slot, Vector3f gunVec, Vector3f lookVector, DriveableType type, Boolean secondary, float speed) { ItemStack bullet = driveableData.getStackInSlot(slot); ItemBullet bulletItem = (ItemBullet)bullet.getItem(); int damageMultiplier = secondary ? type.damageModifierSecondary : type.damageModifierPrimary; FireableGun fireableGun = new FireableGun(bulletItem.type, bulletItem.type.damageVsLiving*damageMultiplier, bulletItem.type.damageVsDriveable*damageMultiplier, bulletItem.type.bulletSpread, speed); FiredShot shot = new FiredShot(fireableGun, (BulletType) bulletItem.type, this, (EntityPlayerMP) getDriver()); ShootBulletHandler handler = (Boolean isExtraBullet) -> { if(!driverIsCreative()) { ItemStack bulletStack = driveableData.getStackInSlot(slot); bulletStack.setItemDamage(bulletStack.getItemDamage() + 1); if(bulletStack.getItemDamage() == bulletStack.getMaxDamage()) { bulletStack.setItemDamage(0); bulletStack.setCount(bulletStack.getCount() - 1); if(bulletStack.getCount() == 0) bulletStack = ItemStack.EMPTY.copy(); } driveableData.setInventorySlotContents(slot, bulletStack); } }; Vector3f gunVector = Vector3f.add(gunVec, new Vector3f(posX,posY,posZ), null); ShotHandler.fireGun(world, shot, bulletItem.type.numBullets, gunVector, lookVector, handler); if (type.shootSound(secondary) != null) { PacketPlaySound.sendSoundPacket(gunVector.x, gunVector.y, gunVector.z, FlansMod.soundRange, world.provider.getDimension(), type.shootSound(secondary), false); } setShootDelay(type.shootDelay(secondary), secondary); }

Target:
private void shootProjectile(final Integer slot, Vector3f gunVec, Vector3f lookVector, DriveableType type, Boolean secondary, float speed) { ItemStack bullet = driveableData.getStackInSlot(slot); ItemBullet bulletItem = (ItemBullet)bullet.getItem(); int damageMultiplier = secondary ? type.damageModifierSecondary : type.damageModifierPrimary; FireableGun fireableGun = new FireableGun(bulletItem.type, bulletItem.type.damageVsLiving*damageMultiplier, bulletItem.type.damageVsDriveable*damageMultiplier, bulletItem.type.bulletSpread, speed); FiredShot shot = new FiredShot(fireableGun, bulletItem.type, this, (EntityPlayerMP) getDriver()); ShootBulletHandler handler = (Boolean isExtraBullet) -> { if(!driverIsCreative()) { ItemStack bulletStack = driveableData.getStackInSlot(slot); bulletStack.setItemDamage(bulletStack.getItemDamage() + 1); if(bulletStack.getItemDamage() == bulletStack.getMaxDamage()) { bulletStack.setItemDamage(0); bulletStack.setCount(bulletStack.getCount() - 1); if(bulletStack.getCount() == 0) bulletStack = ItemStack.EMPTY.copy(); } driveableData.setInventorySlotContents(slot, bulletStack); } }; Vector3f gunVector = Vector3f.add(gunVec, new Vector3f(posX,posY,posZ), null); ShotHandler.fireGun(world, shot, bulletItem.type.numBullets, gunVector, lookVector, handler); if (type.shootSound(secondary) != null) { PacketPlaySound.sendSoundPacket(gunVector.x, gunVector.y, gunVector.z, FlansMod.soundRange, world.provider.getDimension(), type.shootSound(secondary), false); } setShootDelay(type.shootDelay(secondary), secondary); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(StringUtils.getStringRobust(this, R.string.application_name) + " > " + StringUtils.getStringRobust(this, R.string.get_location)); locationController = CommCareLocationControllerFactory.Companion.getLocationController(this, this); setupLocationDialog(); long mLong = -1; if (savedInstanceState != null) { mLong = savedInstanceState.getLong("millisRemaining", -1); } if (mLong > 0) { mTimer = new TimeoutTimer(mLong, this); } else { mTimer = new TimeoutTimer(HiddenPreferences.getGpsWidgetTimeoutInMilliseconds(), this); } mTimer.start(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(StringUtils.getStringRobust(this, R.string.application_name) + " > " + StringUtils.getStringRobust(this, R.string.get_location)); locationController = CommCareLocationControllerFactory.getLocationController(this, this); setupLocationDialog(); long mLong = -1; if (savedInstanceState != null) { mLong = savedInstanceState.getLong("millisRemaining", -1); } if (mLong > 0) { mTimer = new TimeoutTimer(mLong, this); } else { mTimer = new TimeoutTimer(HiddenPreferences.getGpsWidgetTimeoutInMilliseconds(), this); } mTimer.start(); }
Source:
public boolean valueOfIsValid(String place) { T element = getElementToRetrieveValue(place, null); List<T> invalidElements = findAllByCss("input:invalid"); Collection<String> attributesToCompare = Arrays.asList("name", "id"); return !containsElement(invalidElements, element, attributesToCompare); }

Target:
public boolean valueOfIsValid(String place) { T element = waitUntil(d -> getElementToRetrieveValue(place, null)); List<T> invalidElements = findAllByCss("input:invalid"); return !invalidElements.contains(element); }
Source:
protected Map<String, ZuulRoute> getRoutesMap() { if (this.routes.get() == null) { this.routes.set(locateRoutes()); } return Collections.unmodifiableMap(this.routes.get()); }

Target:
protected Map<String, ZuulRoute> getRoutesMap() { if (this.routes.get() == null) { this.routes.set(locateRoutes()); } return this.routes.get(); }
Source:
public static <E extends Extent> Predicate<BlockRayHit<E>> blockTypeFilter(final BlockType... types) { return lastHit -> { for (BlockType type : types) { if (lastHit.getExtent().getBlockType(lastHit.getBlockX(), lastHit.getBlockY(), lastHit.getBlockZ()).equals(type)) { return true; } } return false; }; }

Target:
public static <E extends Extent> Predicate<BlockRayHit<E>> blockTypeFilter(final BlockType... types) { return lastHit -> { final BlockType targetBlockType = lastHit.getExtent().getBlockType(lastHit.getBlockX(), lastHit.getBlockY(), lastHit.getBlockZ()); for (final BlockType type : types) { if (targetBlockType.equals(type)) { return true; } } return false; }; }
Source:
public DruidStorageHandler() { final String base = SessionState.getSessionConf().get("hive.druid.metadata.base", "druid"); final String dbType = SessionState.getSessionConf().get("hive.druid.metadata.db.type", "mysql"); final String username = SessionState.getSessionConf().get("hive.druid.metadata.username", ""); final String password = SessionState.getSessionConf().get("hive.druid.metadata.password", ""); final String uri = SessionState.getSessionConf() .get("hive.druid.metadata.uri", "jdbc:mysql://localhost/druid"); druidMetadataStorageTablesConfig = MetadataStorageTablesConfig.fromBase(base); final Supplier<MetadataStorageConnectorConfig> storageConnectorConfigSupplier = Suppliers.<MetadataStorageConnectorConfig>ofInstance( new MetadataStorageConnectorConfig() { @Override public String getConnectURI() { return uri; } @Override public String getUser() { return username; } @Override public String getPassword() { return password; } }); if (dbType.equals("mysql")) { connector = new MySQLConnector(storageConnectorConfigSupplier, Suppliers.ofInstance(druidMetadataStorageTablesConfig) ); } else if (dbType.equals("postgres")) { connector = new PostgreSQLConnector(storageConnectorConfigSupplier, Suppliers.ofInstance(druidMetadataStorageTablesConfig) ); } else { throw new IllegalStateException(String.format("Unknown metadata storage type [%s]", dbType)); } druidSqlMetadataStorageUpdaterJobHandler = new SQLMetadataStorageUpdaterJobHandler(connector); }

Target:
public DruidStorageHandler() { final String base = HiveConf .getVar(SessionState.getSessionConf(), HiveConf.ConfVars.DRUID_METADATA_BASE); final String dbType = HiveConf .getVar(SessionState.getSessionConf(), HiveConf.ConfVars.DRUID_METADATA_DB_TYPE); final String username = HiveConf .getVar(SessionState.getSessionConf(), HiveConf.ConfVars.DRUID_METADATA_DB_USERNAME); final String password = HiveConf .getVar(SessionState.getSessionConf(), HiveConf.ConfVars.DRUID_METADATA_DB_PASSWORD); final String uri = HiveConf .getVar(SessionState.getSessionConf(), HiveConf.ConfVars.DRUID_METADATA_DB_URI); druidMetadataStorageTablesConfig = MetadataStorageTablesConfig.fromBase(base); final Supplier<MetadataStorageConnectorConfig> storageConnectorConfigSupplier = Suppliers.<MetadataStorageConnectorConfig>ofInstance( new MetadataStorageConnectorConfig() { @Override public String getConnectURI() { return uri; } @Override public String getUser() { return username; } @Override public String getPassword() { return password; } }); if (dbType.equals("mysql")) { connector = new MySQLConnector(storageConnectorConfigSupplier, Suppliers.ofInstance(druidMetadataStorageTablesConfig) ); } else if (dbType.equals("postgres")) { connector = new PostgreSQLConnector(storageConnectorConfigSupplier, Suppliers.ofInstance(druidMetadataStorageTablesConfig) ); } else { throw new IllegalStateException(String.format("Unknown metadata storage type [%s]", dbType)); } druidSqlMetadataStorageUpdaterJobHandler = new SQLMetadataStorageUpdaterJobHandler(connector); }
Source:
public List<TestPosition> detectTests(TestDetectionContext context) { List<TestPositionDto> testPositionDtos = extensionManager.detectTest( prefixURI(context.getFilePath()), getTestAnnotation(), context.getOffset()); return testPositionDtos .stream() .map( it -> newDto(TestPosition.class) .withFrameworkName(getName()) .withTestName(it.getTestName()) .withTestNameLength(it.getTestNameLength()) .withTestBodyLength(it.getTestBodyLength()) .withTestNameStartOffset(it.getTestNameStartOffset())) .collect(Collectors.toList()); }

Target:
public List<TestPosition> detectTests(TestDetectionContext context) { List<TestPositionDto> testPositionDtos = extensionService.detectTest( prefixURI(context.getFilePath()), testMethodAnnotation, context.getOffset()); return testPositionDtos .stream() .map( it -> newDto(TestPosition.class) .withFrameworkName(getName()) .withTestName(it.getTestName()) .withTestNameLength(it.getTestNameLength()) .withTestBodyLength(it.getTestBodyLength()) .withTestNameStartOffset(it.getTestNameStartOffset())) .collect(Collectors.toList()); }
Source:
private Patient getPatient(String lookupName, Map<String, String> lookupFields, String configName) { Patient patient = null; try { switch (lookupName) { case BY_MOTECH_ID: patient = patientService.getPatientByMotechId(configName, lookupFields.get(MOTECH_ID)); break; case BY_UUID: patient = patientService.getPatientByUuid(configName, lookupFields.get(UUID)); break; default: if (lookupFields != null) { patient = patientService.getPatientByIdentifier(configName, lookupFields.get(IDENTIFIER_ID), lookupName); } else { LOGGER.error("Lookup with name doesn't exist for patient object", lookupName); } break; } } catch (OpenMRSException e) { LOGGER.warn(e.getMessage()); } return patient; }

Target:
private Patient getPatient(String lookupName, Map<String, String> lookupFields, String configName) { Patient patient = null; try { switch (lookupName) { case BY_MOTECH_ID: patient = patientService.getPatientByMotechId(configName, lookupFields.get(MOTECH_ID)); break; case BY_UUID: patient = patientService.getPatientByUuid(configName, lookupFields.get(UUID)); break; default: if (lookupFields != null) { patient = patientService.getPatientByIdentifier(configName, lookupFields.get(IDENTIFIER_ID), lookupName); } else { LOGGER.error("Lookup with name doesn't exist for patient object", lookupName); } break; } } catch (OpenMRSException e) { LOGGER.error(e.getMessage(), e); } return patient; }
Source:
public void initParam(Object obj) { final OptionsParam options = (OptionsParam) obj; final BreakpointsParam param = options.getParamSet(BreakpointsParam.class); getCheckBoxConfirmDropMessage().setSelected(param.isConfirmDropMessage()); getCheckBoxAlwaysOnTop().setSelected(!param.getAlwaysOnTop().equals(Boolean.FALSE)); getCheckBoxInScopeOnly().setSelected(param.isInScopeOnly()); getButtonMode().setSelectedIndex(param.getButtonMode() - 1); }

Target:
public void initParam(Object obj) { final OptionsParam options = (OptionsParam) obj; final BreakpointsParam param = options.getParamSet(BreakpointsParam.class); getCheckBoxConfirmDropMessage().setSelected(param.isConfirmDropMessage()); getCheckBoxAlwaysOnTop().setSelected(!Boolean.FALSE.equals(param.getAlwaysOnTop())); getCheckBoxInScopeOnly().setSelected(param.isInScopeOnly()); getButtonMode().setSelectedIndex(param.getButtonMode() - 1); }
Source:
public Long defaultValue() { return 0L; }

Target:
public Long defaultValue() { return Long.MAX_VALUE; }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String resourceStr = getMyParameter("resource", request); String formatStr = getMyParameter("format", request); String alias = getMyParameter("alias", request); try { if (resourceStr == null) { throw new IllegalArgumentException("Missing resource name"); } PKIResources.Resource resource = resources.get(resourceStr); if (resource == null) { throw new IllegalArgumentException(String.format("Resource '%1$s' is invalid", resourceStr)); } PKIResources.Format format = null; if (formatStr != null) { format = formats.get(formatStr); if (format == null) { throw new IllegalArgumentException(String.format("Format '%1$s' is invalid", formatStr)); } } try (PrintWriter out = response.getWriter()) { response.setContentType(resource.getContentType(format)); out.print(resource.toString(format, alias)); } } catch(Exception e) { log.error("Cannot send public key resource '{}' format '{}'", resourceStr, formatStr); log.error("Exception", e); response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String resourceStr = getMyParameter("resource", request); String formatStr = getMyParameter("format", request); String alias = getMyParameter("alias", request); try { if (resourceStr == null) { throw new IllegalArgumentException("Missing resource name"); } PKIResources.Resource resource = resources.get(resourceStr); if (resource == null) { throw new IllegalArgumentException(String.format("Resource '%1$s' is invalid", resourceStr)); } PKIResources.Format format = null; if (formatStr != null) { format = formats.get(formatStr); if (format == null) { throw new IllegalArgumentException(String.format("Format '%1$s' is invalid", formatStr)); } } try (PrintWriter out = response.getWriter()) { response.setContentType(resource.getContentType(format)); out.print(resource.toString(format, alias)); } } catch(Exception e) { log.error("Cannot send public key resource '{}' format '{}': {}", resourceStr, formatStr, e.getMessage()); log.debug("Exception", e); response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } }
Source:
private EObject precedingSiblingOrContainer(EObject context) { EObject container = context.eContainer(); EStructuralFeature containingFeature = context.eContainingFeature(); if (container != null && containingFeature != null) { Object val = container.eGet(containingFeature); if (val instanceof Collection) { List<EObject> childs = Lists.newArrayList(Iterables.filter((Collection) val, EObject.class)); int contextPositionInContainingList = childs.indexOf(context); if (contextPositionInContainingList > 0) { EObject sibling = childs.get(contextPositionInContainingList - 1); if (sibling != null) { return sibling; } } } } return container; }

Target:
private EObject precedingSiblingOrContainer(EObject context) { EObject container = context.eContainer(); EStructuralFeature containingFeature = context.eContainingFeature(); if (container != null && containingFeature != null) { Object val = container.eGet(containingFeature); if (val instanceof EList<?>) { EList<?> childs = (EList<?>) val; int contextPositionInContainingList = childs.indexOf(context); if (contextPositionInContainingList > 0) { Object sibling = childs.get(contextPositionInContainingList - 1); if (sibling instanceof EObject) { return (EObject)sibling; } } } } return container; }
Source:
public void setQuota(Path src, final long namespaceQuota, final long storagespaceQuota) throws IOException { throw new UnsupportedOperationException(getClass().getCanonicalName() + "does not support setQuota"); }

Target:
public void setQuota(Path src, final long namespaceQuota, final long storagespaceQuota) throws IOException { methodNotSupported(); }