auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String put(StorageMetadata metadata, File localFile) { hdfsAuth.authorize(); final Path projectsPath = new Path(rootUri.getPath(), String.valueOf(metadata.getProjectId())); try { if (hdfs.mkdirs(projectsPath)) { log.info("Created project dir: " + projectsPath); } final Path targetPath = createTargetPath(metadata, localFile, projectsPath); if ( hdfs.exists( targetPath )) { throw new StorageException(String.format( "Error: Target file already exists. targetFile: %s, Metadata: %s", targetPath, metadata)); } log.info(String.format("Creating project artifact: meta: %s path: %s", metadata, targetPath)); hdfs.copyFromLocalFile(new Path(localFile.getAbsolutePath()), targetPath); return URI.create(rootUri.getPath()).relativize(targetPath.toUri()).getPath(); } catch (IOException e) { log.error("error in put(): Metadata: " + metadata); throw new StorageException(e); } }

Target:
public String put(StorageMetadata metadata, File localFile) { hdfsAuth.authorize(); final Path projectsPath = new Path(rootUri.getPath(), String.valueOf(metadata.getProjectId())); try { if (hdfs.mkdirs(projectsPath)) { log.info("Created project dir: " + projectsPath); } final Path targetPath = createTargetPath(metadata, localFile, projectsPath); if (hdfs.exists(targetPath)) { log.info( String.format("Duplicate Found: meta: %s path: %s", metadata, targetPath)); return getRelativePath(targetPath); } log.info(String.format("Creating project artifact: meta: %s path: %s", metadata, targetPath)); hdfs.copyFromLocalFile(new Path(localFile.getAbsolutePath()), targetPath); return getRelativePath(targetPath); } catch (IOException e) { log.error("error in put(): Metadata: " + metadata); throw new StorageException(e); } }
Source:
private void cleanQuotaWatchers(QuotaWatcher quotaWatcher) { quotaWatchers.remove(quotaWatcher); log.info("Millis QuotaWatcher was alive: {}", (System.currentTimeMillis() - quotaWatcher.startMS)); quotaWatchers.removeIf(qw -> { if (System.currentTimeMillis() - qw.startMS > 120_000) { log.info("Removing QuotaWatcher with MS alive: {}", (System.currentTimeMillis() - qw.startMS)); return true; } return false; }); }

Target:
private void cleanQuotaWatchers(QuotaWatcher quotaWatcher) { log.info("Millis QuotaWatcher was alive: {}", (System.currentTimeMillis() - quotaWatcher.startMS)); quotaWatchers.entrySet().removeIf(qw -> { if (System.currentTimeMillis() - qw.getValue().startMS > 120_000) { log.info("Removing QuotaWatcher with MS alive: {}", (System.currentTimeMillis() - qw.getValue().startMS)); return true; } return false; }); }
Source:
public void onPlayerInteraction(final PlayerInteractEvent event) { final Player player = event.getPlayer(); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (!RIGHT_CLICK_INTERACT.contains(player.getUniqueId())) { final UUID uuid = player.getUniqueId(); RIGHT_CLICK_INTERACT.add(uuid); new BukkitRunnable() { @Override public void run() { RIGHT_CLICK_INTERACT.remove(uuid); } }.runTaskLater(this.plugin, 5); } if (event.getHand() == EquipmentSlot.HAND) { if (bPlayer.canCurrentlyBendWithWeapons()) { if (event.getClickedBlock() != null) { ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK); } else { ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK); } } } if (bPlayer.getBoundAbilityName().equalsIgnoreCase("EarthSmash")) { new EarthSmash(player, ClickType.RIGHT_CLICK); } } if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) { if (bPlayer.getBoundAbilityName().equalsIgnoreCase("IceBlast")) { if (CoreAbility.hasAbility(player, IceBullet.class)) { CoreAbility.getAbility(player, IceBullet.class).doRightClick(); } } } if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { event.setCancelled(true); Bukkit.broadcastMessage("the 3 combo thingy set the event as cancelled"+MovementHandler.isStopped(player)+Bloodbending.isBloodbent(player)+Suffocate.isBreathbent(player)); } }

Target:
public void onPlayerInteraction(final PlayerInteractEvent event) { final Player player = event.getPlayer(); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (!RIGHT_CLICK_INTERACT.contains(player.getUniqueId())) { final UUID uuid = player.getUniqueId(); RIGHT_CLICK_INTERACT.add(uuid); new BukkitRunnable() { @Override public void run() { RIGHT_CLICK_INTERACT.remove(uuid); } }.runTaskLater(this.plugin, 5); } if (event.getHand() == EquipmentSlot.HAND) { if (bPlayer.canCurrentlyBendWithWeapons()) { if (event.getClickedBlock() != null) { ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK); } else { ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK); } } } if (bPlayer.getBoundAbilityName().equalsIgnoreCase("EarthSmash")) { new EarthSmash(player, ClickType.RIGHT_CLICK); } } if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) { if (bPlayer.getBoundAbilityName().equalsIgnoreCase("IceBlast")) { if (CoreAbility.hasAbility(player, IceBullet.class)) { CoreAbility.getAbility(player, IceBullet.class).doRightClick(); } } } if (MovementHandler.isStopped(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { event.setCancelled(true); } }
Source:
public void setUp() throws Exception { executeDataSet("org/openmrs/module/idgen/include/TestData.xml"); this.service = Context.getService(IdentifierSourceService.class); }

Target:
public void setUp() throws Exception { executeDataSet("org/openmrs/module/idgen/include/TestData.xml"); }
Source:
private static void waitForCrateFramework() { Awaitility.await().atMost(90, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { for (MesosAgent mesosAgent : cluster.getAgents()) { if (!mesosAgent.getState().getFrameworks().isEmpty()) { try { int status = Unirest.head( String.format("http://%s:%d/cluster", mesosAgent.getIpAddress(), API_PORT) ).asJson().getStatus(); crateMesosFrameworkHostIp = mesosAgent.getIpAddress(); return status == 200; } catch (UnirestException e) { } } } return false; } }); }

Target:
private static void waitForCrateFramework() { Awaitility.await().atMost(WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS) .pollInterval(1, TimeUnit.SECONDS).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { for (MesosAgent mesosAgent : cluster.getAgents()) { if (!mesosAgent.getState().getFrameworks().isEmpty()) { try { int status = Unirest.head( String.format("http://%s:%d/cluster", mesosAgent.getIpAddress(), API_PORT) ).asJson().getStatus(); crateMesosFrameworkHostIp = mesosAgent.getIpAddress(); return status == 200; } catch (UnirestException e) { } } } return false; } }); }
Source:
private static EventFiringWebDriver getFFInstance() { FirefoxProfile profile = new FirefoxProfile(); if (System.getProperty("os.name").toUpperCase().equals("WINDOWS 8")){ System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if (System.getProperty("os.name").toUpperCase().equals("LINUX")) { File mozillaPath = new File(System.getProperty("user.home") + File.separator + ".mozilla" + File.separator); File tempFile; if (!mozillaPath.exists()) { if (!mozillaPath.mkdir()) { throw new RuntimeException("Can't create %s dir".replace("%s", mozillaPath.getAbsolutePath())); } } try { tempFile = File.createTempFile("webdriver", UUID.randomUUID().toString(), mozillaPath); } catch (IOException ex) { throw new RuntimeException(ex.getMessage()); } tempFile.delete(); } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); profile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch(FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } caps.setCapability(FirefoxDriver.PROFILE, profile); return new EventFiringWebDriver(new FirefoxDriver(caps)); }

Target:
private static EventFiringWebDriver getFFInstance() { FirefoxProfile profile = new FirefoxProfile(); if (System.getProperty("os.name").toUpperCase().equals("WINDOWS 8")){ System.setProperty( "webdriver.firefox.bin", "c:" + File.separator + "Program Files (x86)" + File.separator + "Mozilla Firefox" + File.separator + "Firefox.exe" ); } if (System.getProperty("os.name").toUpperCase().equals("LINUX")) { File homePath = new File(System.getenv("HOME") + File.separator); File mozillaPath = new File(homePath + File.separator + ".mozilla"); if (mozillaPath.exists()) { try { File.createTempFile("webdriver", UUID.randomUUID().toString(), mozillaPath); } catch (IOException ex) { throw new RuntimeException("Can't create file in path: %s".replace("%s", mozillaPath.getAbsolutePath())); } } else { try { File.createTempFile("webdriver", UUID.randomUUID().toString(), homePath); } catch (IOException ex) { throw new RuntimeException("Can't create file in path: %s".replace("%s", homePath.getAbsolutePath())); } } } if (browserName.contains("CONSOLE")) { try { File jsErr = new File( "." + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "Firebug" + File.separator + "JSErrorCollector.xpi" ); profile.addExtension(jsErr); Global.JS_ERROR_ENABLED = true; } catch(FileNotFoundException e) { System.out.println("JS extension file doesn't exist in provided location"); } catch (IOException e) { System.out.println("Error with adding firefox extension"); } } caps.setCapability(FirefoxDriver.PROFILE, profile); return new EventFiringWebDriver(new FirefoxDriver(caps)); }
Source:
public long getInternalNumericId(){ return internalNumericId; }

Target:
long getInternalNumericId(){ return internalNumericId; }
Source:
private Set<Integer> getOidSet(String oidList) throws PSQLException { Set<Integer> oids = new HashSet<Integer>(); StringTokenizer tokenizer = new StringTokenizer(oidList, ","); while (tokenizer.hasMoreTokens()) { String oid = tokenizer.nextToken(); oids.add(Oid.valueOf(oid)); } return oids; }

Target:
private static Set<Integer> getOidSet(String oidList) throws PSQLException { Set<Integer> oids = new HashSet<Integer>(); StringTokenizer tokenizer = new StringTokenizer(oidList, ","); while (tokenizer.hasMoreTokens()) { String oid = tokenizer.nextToken(); oids.add(Oid.valueOf(oid)); } return oids; }
Source:
public RealmResults<Session> getSessionsByLocation(String location) { return realm.where(Session.class).equalTo("microlocation.name", location).findAllSortedAsync(Session.Companion.getSTART_TIME()); }

Target:
public RealmResults<Session> getSessionsByLocation(String location) { return realm.where(Session.class) .equalTo("microlocation.name", location) .sort(Session.START_TIME) .findAllAsync(); }
Source:
public void processEvent(CloudTrailEvent event) { List<String> instanceIds = getInstanceIds(event); Map<String, String> metaData = newHashMap(); for (String id : instanceIds) { Map userData; final String accountId = event.getEventData().getUserIdentity().getAccountId(); final String region = event.getEventData().getAwsRegion(); try { userData = userDataProvider.getUserData(accountId, region, id); } catch (AmazonServiceException e) { LOG.error(e.getMessage()); violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_USER_DATA).build()); return; } if (userData == null) { violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_USER_DATA).build()); return; } String source = (String) userData.get(SOURCE); if (source == null) { violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_SOURCE_IN_USER_DATA).build()); } else if (source.matches(SNAPSHOT_REGEX)) { metaData.put("errorMessage", "EC2 should be deployed within docker and an immutable tag."); metaData.put("application", source); violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(EC2_WITH_A_SNAPSHOT_IMAGE).withMetaInfo(metaData).build()); } } }

Target:
public void processEvent(CloudTrailEvent event) { List<String> instanceIds = getInstanceIds(event); for (String id : instanceIds) { Map userData; final String accountId = event.getEventData().getUserIdentity().getAccountId(); final String region = event.getEventData().getAwsRegion(); try { userData = userDataProvider.getUserData(accountId, region, id); } catch (AmazonServiceException e) { LOG.error(e.getMessage()); violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_USER_DATA).build()); return; } if (userData == null) { violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_USER_DATA).build()); return; } String source = (String) userData.get(SOURCE); if (source == null) { violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(MISSING_SOURCE_IN_USER_DATA).build()); } else if (source.matches(SNAPSHOT_REGEX)) { violationSink.put(violationFor(event).withInstanceId(id).withPluginFullyQualifiedClassName( SnapshotSourcePlugin.class).withType(EC2_WITH_A_SNAPSHOT_IMAGE).withMetaInfo(singletonMap("deployment_artifact", source)).build()); } } }
Source:
private void printSingleLineDescription(PrintWriter out, String prefix, String s) { String comment = StringEscapeUtils.escapeJson(s); out.printf("%s\"%s\"\n", prefix, comment); }

Target:
private void printSingleLineDescription(PrintWriter out, String prefix, String s) { String desc = escapeJsonString(s); out.printf("%s\"%s\"\n", prefix, desc); }
Source:
private void updateTransform() { if (mTransformCallback != null) { mTransformCallback.getTransform(mParentTransform); mTransformCallback.getRootBounds(mRootBounds); } else { mParentTransform.reset(); mRootBounds.set(getBounds()); } mBitmapBounds.set(0, 0, getBitmap().getWidth(), getBitmap().getHeight()); mDrawableBounds.set(getBounds()); mBoundsTransform.setRectToRect(mBitmapBounds, mDrawableBounds, Matrix.ScaleToFit.FILL); if (!mParentTransform.equals(mPrevParentTransform) || !mBoundsTransform.equals(mPrevBoundsTransform)) { mIsShaderTransformDirty = true; mParentTransform.invert(mInverseParentTransform); mTransform.set(mParentTransform); if (!mBoundsTransform.isIdentity()) { mTransform.preConcat(mBoundsTransform); } mPrevParentTransform.set(mParentTransform); mPrevBoundsTransform.set(mBoundsTransform); } if (!mRootBounds.equals(mPrevRootBounds)) { mIsPathDirty = true; mPrevRootBounds.set(mRootBounds); } }

Target:
private void updateTransform() { if (mTransformCallback != null) { mTransformCallback.getTransform(mParentTransform); mTransformCallback.getRootBounds(mRootBounds); } else { mParentTransform.reset(); mRootBounds.set(getBounds()); } mBitmapBounds.set(0, 0, getBitmap().getWidth(), getBitmap().getHeight()); mDrawableBounds.set(getBounds()); mBoundsTransform.setRectToRect(mBitmapBounds, mDrawableBounds, Matrix.ScaleToFit.FILL); if (!mParentTransform.equals(mPrevParentTransform) || !mBoundsTransform.equals(mPrevBoundsTransform)) { mIsShaderTransformDirty = true; mParentTransform.invert(mInverseParentTransform); mTransform.set(mParentTransform); mTransform.preConcat(mBoundsTransform); mPrevParentTransform.set(mParentTransform); mPrevBoundsTransform.set(mBoundsTransform); } if (!mRootBounds.equals(mPrevRootBounds)) { mIsPathDirty = true; mPrevRootBounds.set(mRootBounds); } }
Source:
private List<Patient> filterNotDownloadedPatients(List<Patient> patients) { List<Patient> newPatientList = new LinkedList<>(); for (Patient patient: patients){ if(!new PatientDAO().isUserAlreadySaved(patient.getUuid())){ newPatientList.add(patient); } } return newPatientList; }

Target:
private List<Patient> filterNotDownloadedPatients(List<Patient> patients) { List<Patient> newPatientList = new LinkedList<>(); for (Patient patient: patients){ PatientDAO patientDAO = new PatientDAO(); if(!patientDAO.isUserAlreadySaved(patient.getUuid())){ newPatientList.add(patient); } } return newPatientList; }
Source:
public int hashCode() { return Objects.hash(super.hashCode(), time); }

Target:
public int hashCode() { return Objects.hash(time); }
Source:
public void run() throws Exception { requests.add(-100L); }

Target:
public void run() throws Exception { requests.add(CANCELLED); }
Source:
public void validateGetPort() throws Exception { ClusterMapConfig clusterMapConfig; Properties props = new Properties(); props.setProperty("clustermap.ssl.enabled.datacenters", "datacenter1,datacenter2,datacenter3"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); System.out.println(clusterMapConfig.clusterMapSslEnabledDatacenters); JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); DataNode dataNode = new TestDataNode("datacenter2", jsonObject, clusterMapConfig); assertEquals("The datacenter of the data node is in the ssl enabled datacenter list. SSL port should be returned", PortType.SSL, dataNode.getPortToConnectTo().getPortType()); dataNode = new TestDataNode("datacenter5", jsonObject, clusterMapConfig); assertEquals( "The datacenter of the data node is not in the ssl enabled datacenter list. Plaintext port should be returned", PortType.PLAINTEXT, dataNode.getPortToConnectTo().getPortType()); }

Target:
public void validateGetPort() throws Exception { ClusterMapConfig clusterMapConfig; Properties props = new Properties(); props.setProperty("clustermap.ssl.enabled.datacenters", "datacenter1,datacenter2,datacenter3"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); System.out.println(clusterMapConfig.clusterMapSslEnabledDatacenters); JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); DataNode dataNode = new TestDataNode("datacenter2", jsonObject, clusterMapConfig); assertEquals("The datacenter of the data node is in the ssl enabled datacenter list. SSL port should be returned", PortType.SSL, dataNode.getPortToConnectTo().getPortType()); dataNode = new TestDataNode("datacenter5", jsonObject, clusterMapConfig); assertEquals( "The datacenter of the data node is not in the ssl enabled datacenter list. Plaintext port should be returned", PortType.PLAINTEXT, dataNode.getPortToConnectTo().getPortType()); jsonObject.remove("sslport"); dataNode = new TestDataNode("datacenter1", jsonObject, clusterMapConfig); try { dataNode.getPortToConnectTo(); fail("Should have thrown Exception because there is no sslPort."); } catch (IllegalStateException e) { } }
Source:
public void report(String content) throws ReportException { try { try (OutputStream outputStream = reportFile == null ? System.out : new FileOutputStream(reportFile); Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, encoding))) { writer.write(content); } } catch (IOException ioe) { throw new ReportException(ioe); } }

Target:
public void report(String content) throws ReportException { try (Writer writer = new BufferedWriter(new OutputStreamWriter(getOutputStream(), encoding))) { writer.write(content); } catch (IOException ioe) { throw new ReportException(ioe); } }
Source:
protected void parseSiteConfiguration(Map<String, RelayConfig.SiteConfig> map) throws Exception { super.parseSiteConfiguration(map); String testName = TestResourceTracker.getCurrentTestName(); map.forEach((s, siteConfig) -> { List<RelayConfig.BridgeConfig> bridges = siteConfig.getBridges(); for (int i = 0; i < bridges.size(); i++) { RelayConfig.BridgeConfig bridgeConfig = bridges.get(i); String config = (String) TestingUtil.extractField(RelayConfig.PropertiesBridgeConfig.class, bridgeConfig, "config"); if (testName != null) { String clusterName = "bridge-" + testName; bridges.set(i, new RelayConfig.PropertiesBridgeConfig(clusterName, config)); } } }); }

Target:
protected void parseSiteConfiguration(Map<String, RelayConfig.SiteConfig> map) throws Exception { super.parseSiteConfiguration(map); String testName = TestResourceTracker.getCurrentTestName(); map.forEach((s, siteConfig) -> { List<RelayConfig.BridgeConfig> bridges = siteConfig.getBridges(); for (int i = 0; i < bridges.size(); i++) { RelayConfig.BridgeConfig bridgeConfig = bridges.get(i); String config = (String) TestingUtil.extractField(RelayConfig.PropertiesBridgeConfig.class, bridgeConfig, "config"); String clusterName = "bridge-" + (testName != null ? testName : "namenotset"); bridges.set(i, new RelayConfig.PropertiesBridgeConfig(clusterName, config)); } }); }
Source:
public void testRevisionedCheckout() throws Exception { FreeStyleProject p = createFreeStyleProject(); p.setScm(new SubversionSCM("<LINK_0>")); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertTrue(b.getLog(LOG_LIMIT).toString().contains("at revision 13000")); assertBuildStatus(Result.SUCCESS,b); b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertTrue(b.getLog(LOG_LIMIT).toString().contains("at revision 13000")); assertBuildStatus(Result.SUCCESS,b); }

Target:
public void testRevisionedCheckout() throws Exception { FreeStyleProject p = createFreeStyleProject(); p.setScm(new SubversionSCM("<LINK_0>")); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertLogContains("at revision 13000", b); assertBuildStatus(Result.SUCCESS,b); b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertLogContains("at revision 13000", b); assertBuildStatus(Result.SUCCESS,b); }
Source:
public int getNextRow(int column) { int curRow; if(firstEmptyRowOfColumns == null) { firstEmptyRowOfColumns = new HashMap<Integer, Integer>(); } if(!firstEmptyRowOfColumns.containsKey(column)) { firstEmptyRowOfColumns.put(column, 0); } curRow = firstEmptyRowOfColumns.get(column); firstEmptyRowOfColumns.put(column, curRow+1); return curRow; }

Target:
public int getNextRow(int column) { int curRow; if(!nextEmptyRowForColumn.containsKey(column)) { nextEmptyRowForColumn.put(column, 0); } curRow = nextEmptyRowForColumn.get(column); nextEmptyRowForColumn.put(column, curRow+1); return curRow; }
Source:
public void onContradiction(ContradictionException cex) { if (cex.c instanceof Propagator) { Propagator p = (Propagator) cex.c; double qj = q.get(p); q.put(p, (1 - a) * qj + a * r.get(p)); double rj = r.get(p); r.put(p, 1d / (conflicts - rj + 1)); a = Math.max(0.06, a - STEP); conflict.put(p, conflicts); conflicts++; } }

Target:
public void onContradiction(ContradictionException cex) { if (cex.c instanceof Propagator) { Propagator p = (Propagator) cex.c; double qj = q.get(p); double r = 1d / (conflicts - conflict.get(p) + 1); q.put(p, (1 - a) * qj + a * r); a = Math.max(0.06, a - STEP); conflict.put(p, conflicts); conflicts++; } }
Source:
public void setReply(Message<?> reply) { if (this.reply == null) { this.reply = reply; logger.debug("reply" + reply); this.latch.countDown(); } else if (this.reply instanceof ErrorMessage) { this.reply = reply; logger.debug("second" + reply); this.secondChanceLatch.countDown(); } }

Target:
public void setReply(Message<?> reply) { if (this.reply == null) { this.reply = reply; this.latch.countDown(); } else if (this.reply instanceof ErrorMessage) { this.reply = reply; this.secondChanceLatch.countDown(); } }
Source:
public void getShareDoesNotCreateAShare() { ShareAsyncClient client = serviceClient.getShareAsyncClient(shareName); try { client.getStatistics().block(); fail("getShareAsyncClient shouldn't create a share in Azure."); } catch (Exception ex) { TestHelpers.assertExceptionStatusCode(ex, 400); } }

Target:
public void getShareDoesNotCreateAShare() { ShareAsyncClient client = serviceClient.getShareAsyncClient(shareName); try { client.getStatistics().block(); fail("getShareAsyncClient shouldn't create a share in Azure."); } catch (Exception ex) { helper.assertExceptionStatusCode(ex, 404); } }
Source:
private void dequeue(Connection connection) { while (!pendingBorrows.isEmpty()) { while (true) { int inFlight = connection.inFlight.get(); if (inFlight >= Math.min(connection.maxAvailableStreams(), options().getMaxRequestsPerConnection(hostDistance))) { return; } if (connection.inFlight.compareAndSet(inFlight, inFlight + 1)) break; } SettableFuture<Connection> pendingBorrow = pendingBorrows.poll(); if (pendingBorrow == null) { connection.inFlight.decrementAndGet(); } else { pendingBorrowCount.decrementAndGet(); pendingBorrow.set(connection); } } }

Target:
private void dequeue(Connection connection) { while (!pendingBorrows.isEmpty()) { while (true) { int inFlight = connection.inFlight.get(); if (inFlight >= Math.min(connection.maxAvailableStreams(), options().getMaxRequestsPerConnection(hostDistance))) { return; } if (connection.inFlight.compareAndSet(inFlight, inFlight + 1)) { break; } } final SettableFuture<Connection> pendingBorrow = pendingBorrows.poll(); if (pendingBorrow == null) { connection.inFlight.decrementAndGet(); } else { totalInFlight.incrementAndGet(); pendingBorrowCount.decrementAndGet(); ListenableFuture<Connection> setKeyspaceFuture = connection.setKeyspaceAsync(manager.poolsState.keyspace); if (setKeyspaceFuture.isDone()) { try { pendingBorrow.set(Uninterruptibles.getUninterruptibly(setKeyspaceFuture)); } catch (ExecutionException e) { pendingBorrow.setException(e.getCause()); } } else { Futures.addCallback(setKeyspaceFuture, new FutureCallback<Connection>() { @Override public void onSuccess(Connection c) { pendingBorrow.set(c); } @Override public void onFailure(Throwable t) { pendingBorrow.setException(t); } }); } } } }
Source:
public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-Modified")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/?format=xml", response.getHeader("Resource-Parent")); Assert.assertEquals("directory", response.getHeader("Resource-Type")); Assert.assertEquals("application/xml", response.getHeader("Content-Type")); }

Target:
public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-Modified")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/", response.getHeader("Resource-Parent")); Assert.assertEquals("directory", response.getHeader("Resource-Type")); Assert.assertEquals("application/xml", response.getHeader("Content-Type")); }
Source:
public void createFromEmptyStoreWithNoProjectionGeoTif() throws Exception { URL storeUrl = TestData.url(this, "nocrs"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("no_crs"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } Properties properties = new Properties(); properties.put(Utils.Prop.STORE_NAME, "test"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "datastore.properties"))) { properties.store(fos, null); } properties = new Properties(); properties.put(Utils.Prop.TYPENAME, "abcd"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "indexer.properties"))) { properties.store(fos, null); } DefaultRepository repository = new DefaultRepository(); final Map<String, Serializable> params = Collections.singletonMap( ShapefileDataStoreFactory.URLP.key, URLs.fileToUrl(testDirectory)); DataStore ds = new ShapefileDataStoreFactory().createDataStore(params); assertNotNull(ds); repository.register("test", ds); Hints hints = new Hints(Hints.REPOSITORY, repository); ImageMosaicReader reader = FORMAT.getReader(testDirectory, hints); final File expectedIndexFile = new File(testDirectory, "abcd.shp"); assertTrue( expectedIndexFile.getAbsolutePath() + " does not exist", expectedIndexFile.exists()); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); ds.dispose(); }

Target:
public void createFromEmptyStoreWithNoProjectionGeoTif() throws Exception { URL storeUrl = TestData.url(this, "nocrs"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("no_crs"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } ImageMosaicReader reader = FORMAT.getReader(testDirectory); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); }
Source:
private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { if (!(selection instanceof ITreeSelection)) return EMPTY_WORKING_SET_ARRAY; ITreeSelection treeSelection = (ITreeSelection) selection; if (treeSelection.isEmpty()) return EMPTY_WORKING_SET_ARRAY; @SuppressWarnings("unchecked") List<Object> elements= treeSelection.toList(); if (elements.size() == 1) { Object element = elements.get(0); TreePath[] paths = treeSelection.getPathsFor(element); if (paths.length != 1 || paths[0].getSegmentCount() == 0) return EMPTY_WORKING_SET_ARRAY; Object candidate = paths[0].getSegment(0); if (!(candidate instanceof IWorkingSet)) return EMPTY_WORKING_SET_ARRAY; IWorkingSet workingSetCandidate = (IWorkingSet) candidate; if (!workingSetCandidate.isAggregateWorkingSet()) return new IWorkingSet[] { workingSetCandidate }; return EMPTY_WORKING_SET_ARRAY; } ArrayList<IWorkingSet> result = new ArrayList<IWorkingSet>(); for (Iterator<Object> iterator = elements.iterator(); iterator.hasNext();) { Object element = iterator.next(); if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { result.add((IWorkingSet)element); } } if (result.size() > 0) { return result.toArray(new IWorkingSet[result.size()]); } else { return EMPTY_WORKING_SET_ARRAY; } }

Target:
private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { if (!(selection instanceof ITreeSelection)) return EMPTY_WORKING_SET_ARRAY; ITreeSelection treeSelection = (ITreeSelection) selection; if (treeSelection.isEmpty()) return EMPTY_WORKING_SET_ARRAY; List<?> elements= treeSelection.toList(); if (elements.size() == 1) { Object element = elements.get(0); TreePath[] paths = treeSelection.getPathsFor(element); if (paths.length != 1 || paths[0].getSegmentCount() == 0) return EMPTY_WORKING_SET_ARRAY; Object candidate = paths[0].getSegment(0); if (!(candidate instanceof IWorkingSet)) return EMPTY_WORKING_SET_ARRAY; IWorkingSet workingSetCandidate = (IWorkingSet) candidate; if (!workingSetCandidate.isAggregateWorkingSet()) return new IWorkingSet[] { workingSetCandidate }; return EMPTY_WORKING_SET_ARRAY; } ArrayList<IWorkingSet> result = new ArrayList<IWorkingSet>(); for (Object element : elements) { if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { result.add((IWorkingSet)element); } } if (!result.isEmpty()) { return result.toArray(new IWorkingSet[result.size()]); } else { return EMPTY_WORKING_SET_ARRAY; } }
Source:
public InetSocketAddress getHost() { String value = getFirst(HOST); if (value == null) { return null; } int idx = value.indexOf(':'); String hostname = null; int port = 0; if (idx != -1 && idx < value.length() - 1) { hostname = value.substring(0, idx); String portString = value.substring(idx + 1); try { port = Integer.parseInt(portString); } catch (NumberFormatException ex) { } } if (hostname == null) { hostname = value; } return InetSocketAddress.createUnresolved(hostname, port); }

Target:
public InetSocketAddress getHost() { String value = getFirst(HOST); if (value == null) { return null; } int idx = value.lastIndexOf(':'); String hostname = null; int port = 0; if (idx != -1 && idx < value.length() - 1) { hostname = value.substring(0, idx); String portString = value.substring(idx + 1); try { port = Integer.parseInt(portString); } catch (NumberFormatException ex) { } } if (hostname == null) { hostname = value; } return InetSocketAddress.createUnresolved(hostname, port); }
Source:
public static Map<Task.PullHost, List<IntermediateEntry>> hashByHost(List<IntermediateEntry> entries) { Map<Task.PullHost, List<IntermediateEntry>> hashed = new HashMap<>(); Task.PullHost host; for (IntermediateEntry entry : entries) { host = entry.getPullHost(); if (hashed.containsKey(host)) { hashed.get(host).add(entry); } else { List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList(entry)); hashed.put(host, inputList); } } return hashed; }

Target:
public static Map<Task.PullHost, List<IntermediateEntry>> hashByHost(List<IntermediateEntry> entries) { Map<Task.PullHost, List<IntermediateEntry>> hashed = new HashMap<>(); Task.PullHost host; for (IntermediateEntry entry : entries) { host = entry.getPullHost(); if (hashed.containsKey(host)) { hashed.get(host).add(entry); } else { hashed.put(host, Arrays.asList(entry)); } } return hashed; }
Source:
public void dispose() { if (fTreeViewer != null) { fTreeViewer.dispose(); } if (fXYViewer != null) { fXYViewer.dispose(); } }

Target:
public void dispose() { super.dispose(); if (fTreeViewer != null) { fTreeViewer.dispose(); } if (fXYViewer != null) { fXYViewer.dispose(); } }
Source:
public boolean isValid(DeveloperValidationContext context) { ErrorMessageUtil msgUtil = context.getErrorMessageUtil(); DeveloperDTO updatedDev = context.getDeveloperDTO(); DeveloperDTO beforeDev = context.getBeforeDev(); DeveloperStatusEventDTO newDevStatus = updatedDev.getStatus(); DeveloperStatusEventDTO currDevStatus = beforeDev.getStatus(); boolean currentStatusChanged = !currDevStatus.getStatus().getStatusName() .equals(newDevStatus.getStatus().getStatusName()); if (currentStatusChanged && !newDevStatus.getStatus().getStatusName() .equals(DeveloperStatusType.UnderCertificationBanByOnc.toString()) && !resourcePermissions.isUserRoleAdmin() && !resourcePermissions.isUserRoleOnc()) { String msg = msgUtil.getMessage("developer.statusChangeNotAllowedWithoutAdmin"); getMessages().add(msg); return false; } if (!StringUtils.isEmpty(updatedDev.getWebsite())) { if (!ValidationUtils.isWellFormedUrl(updatedDev.getWebsite())) { String msg = msgUtil.getMessage("developer.websiteIsInvalid"); getMessages().add(msg); return false; } } return true; }

Target:
public boolean isValid(DeveloperValidationContext context) { ErrorMessageUtil msgUtil = context.getErrorMessageUtil(); DeveloperDTO updatedDev = context.getDeveloperDTO(); DeveloperDTO beforeDev = context.getBeforeDev(); DeveloperStatusEventDTO newDevStatus = updatedDev.getStatus(); DeveloperStatusEventDTO currDevStatus = beforeDev.getStatus(); boolean currentStatusChanged = !currDevStatus.getStatus().getStatusName() .equals(newDevStatus.getStatus().getStatusName()); if (currentStatusChanged && !newDevStatus.getStatus().getStatusName() .equals(DeveloperStatusType.UnderCertificationBanByOnc.toString()) && !resourcePermissions.isUserRoleAdmin() && !resourcePermissions.isUserRoleOnc()) { String msg = msgUtil.getMessage("developer.statusChangeNotAllowedWithoutAdmin"); getMessages().add(msg); return false; } return true; }
Source:
public CounterManager getCounterManager() { return counterManager; }

Target:
CounterManager getCounterManager() { return counterManager; }
Source:
private List<FieldSpec> getFields() { ArrayList<FieldSpec> results = new ArrayList(); TypeName functionOfTransactionAndTriggersType = ParameterizedTypeName.get( ClassName.get(Function.class), WildcardTypeName.supertypeOf(Transaction.class), sharedTriggersType); results.add(FieldSpec.builder(Namespace.class, "namespace") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(FieldSpec.builder(ParameterizedTypeName.get( ClassName.get(List.class), functionOfTransactionAndTriggersType), "sharedTriggers") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(getDefaultNamespaceField()); return results; }

Target:
private List<FieldSpec> getFields() { ArrayList<FieldSpec> results = new ArrayList<>(); TypeName functionOfTransactionAndTriggersType = ParameterizedTypeName.get( ClassName.get(Function.class), WildcardTypeName.supertypeOf(Transaction.class), sharedTriggersType); results.add(getDefaultNamespaceField()); results.add(FieldSpec.builder(ParameterizedTypeName.get( ClassName.get(List.class), functionOfTransactionAndTriggersType), "sharedTriggers") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(FieldSpec.builder(Namespace.class, "namespace") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); return results; }
Source:
protected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadAuthorizedKeys({})[{}] check permissions of {}", username, session, path); } PosixFilePermission violation = KeyUtils.validateStrictKeyFilePermissions(path); if (violation != null) { throw new IOException("String permission violation (" + violation + ") for " + path); } String ownerViolation = KeyUtils.validateStrictKeyFileOwner(path); if (ownerViolation != null) { throw new IOException("String owner violation (" + ownerViolation + ") for " + path); } } return super.reloadAuthorizedKeys(path, username, session); }

Target:
protected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadAuthorizedKeys({})[{}] check permissions of {}", username, session, path); } Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path); if (violation != null) { throw new IOException(String.format("%s for %s", violation.getFirst(), path)); } } return super.reloadAuthorizedKeys(path, username, session); }
Source:
void merge(GitSyncObjectCache value, String parentPath, Collection<String> updateRequests) { if (value.members != null) { if (members == null) members = new HashMap<String, GitSyncObjectCache>(); else for (Entry<String, GitSyncObjectCache> entry : members .entrySet()) { String entryKey = entry.getKey(); if (!value.members.containsKey(entryKey)) { GitSyncObjectCache entryValue = entry.getValue(); if (updateRequests.contains(parentPath + "/" + entryValue.diffEntry)) entryValue.diffEntry.changeType = ChangeType.IN_SYNC; } } for (Entry<String, GitSyncObjectCache> entry : value.members .entrySet()) { String key = entry.getKey(); if (members.containsKey(key)) members.get(key).merge(entry.getValue(), parentPath + "/" + key, updateRequests); else members.put(key, entry.getValue()); } } else if (members != null) for (GitSyncObjectCache obj : members.values()) { if (updateRequests.contains(obj.diffEntry.getPath())) obj.diffEntry.changeType = ChangeType.IN_SYNC; } else diffEntry.changeType = value.diffEntry.changeType; }

Target:
void merge(GitSyncObjectCache value, String parentPath, Collection<String> updateRequests) { if (value.members != null) { if (members == null) members = new HashMap<String, GitSyncObjectCache>(); else for (Entry<String, GitSyncObjectCache> entry : members .entrySet()) { String entryKey = entry.getKey(); if (!value.members.containsKey(entryKey)) { GitSyncObjectCache entryValue = entry.getValue(); if (updateRequests.contains(entryValue.getDiffEntry() .getPath())) entryValue.diffEntry.changeType = ChangeType.IN_SYNC; } } for (Entry<String, GitSyncObjectCache> entry : value.members .entrySet()) { String key = entry.getKey(); if (members.containsKey(key)) { final String entryPath; if ("".equals(parentPath)) { entryPath = key; } else { entryPath = parentPath + "/" + key; } members.get(key).merge(entry.getValue(), entryPath, updateRequests); } else { members.put(key, entry.getValue()); } } } else if (members != null) for (GitSyncObjectCache obj : members.values()) { String entryPath = obj.getDiffEntry().getPath(); if (updateRequests.contains(entryPath)) obj.diffEntry.changeType = ChangeType.IN_SYNC; } else diffEntry.changeType = value.diffEntry.changeType; }
Source:
public void updateTargetToModel() { final IObservableSet<T> targetSet = target; targetSet.getRealm().exec(() -> { SetDiff<T> diff = Diffs.computeSetDiff(Collections.emptySet(), targetSet); doUpdate(targetSet, model, diff, targetToModel, true, true); }); }

Target:
public void updateTargetToModel() { target.getRealm().exec(() -> { SetDiff<T> diff = Diffs.computeSetDiff(Collections.emptySet(), target); doUpdate(target, model, diff, targetToModel, true, true); }); }
Source:
private void populate() { this.pathField = new TextField(); this.openBrowser = new Button(tr("Choose Directory…")); openBrowser.setOnAction(event -> { DirectoryChooser chooser = new DirectoryChooser(); File directory = chooser.showDialog(null); pathField.setText(directory.toString()); }); HBox content = new HBox(pathField, openBrowser); content.setId("addLocalRepository"); HBox.setHgrow(pathField, Priority.ALWAYS); this.setCenter(content); }

Target:
private void populate() { this.pathField = new TextField(); this.openBrowser = new Button(tr("Choose Directory ...")); openBrowser.setOnAction(event -> { DirectoryChooser chooser = new DirectoryChooser(); File directory = chooser.showDialog(null); pathField.setText(directory.toString()); }); HBox content = new HBox(pathField, openBrowser); content.setId("addLocalRepository"); HBox.setHgrow(pathField, Priority.ALWAYS); this.setCenter(content); }
Source:
public void testTaskWithDisableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", new String("false")); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }

Target:
public void testTaskWithDisableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", "false"); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }
Source:
public void onAjax(AjaxRequestTarget target, JQueryEvent event) { if (event instanceof NavigateEvent) { this.listener.onNavigate(target, ((NavigateEvent) event)); } if (event instanceof SchedulerPayload) { SchedulerPayload payload = (SchedulerPayload) event; SchedulerEvent schedulerEvent = this.factory.toObject(payload.getObject(), this.getResourceListModel().getObject()); if (event instanceof EditEvent) { this.listener.onEdit(target, schedulerEvent, payload.getView()); } if (event instanceof CreateEvent) { this.listener.onCreate(target, schedulerEvent); } if (event instanceof UpdateEvent) { this.listener.onUpdate(target, schedulerEvent); } if (event instanceof DeleteEvent) { this.listener.onDelete(target, schedulerEvent); } } }

Target:
public void onAjax(AjaxRequestTarget target, JQueryEvent event) { if (event instanceof NavigateEvent) { this.listener.onNavigate(target, (NavigateEvent) event); } if (event instanceof SchedulerPayload) { SchedulerPayload payload = (SchedulerPayload) event; SchedulerEvent schedulerEvent = this.factory.toObject(payload.getObject(), this.getResourceListModel().getObject()); if (event instanceof EditEvent) { this.listener.onEdit(target, schedulerEvent, payload.getView()); } if (event instanceof CreateEvent) { this.listener.onCreate(target, schedulerEvent); } if (event instanceof UpdateEvent) { this.listener.onUpdate(target, schedulerEvent); } if (event instanceof DeleteEvent) { this.listener.onDelete(target, schedulerEvent); } } }
Source:
public DatabaseInfo getDatabaseInfo() throws IOException { try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri() == null ? "" : glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription() == null ? "" : glueDatabase.getDescription(); Map<String, String> glueParameters = glueDatabase.getParameters() == null ? Collections.emptyMap() : glueDatabase.getParameters(); return new DatabaseInfo( glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e); } }

Target:
public DatabaseInfo getDatabaseInfo() throws IOException { try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri() == null ? "" : glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription() == null ? "" : glueDatabase.getDescription(); Map<String, String> glueParameters = new HashMap<>(); if (glueDatabase.getParameters() != null) { glueParameters.putAll(glueDatabase.getParameters()); } return new DatabaseInfo( glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e); } }