auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AutoRecoveryMain(ServerConfiguration conf, StatsLogger statsLogger) throws IOException, InterruptedException, KeeperException, UnavailableException, CompatibilityException { this.conf = conf; this.bkc = Auditor.createBookKeeperClient(conf); MetadataClientDriver metadataClientDriver = bkc.getMetadataClientDriver(); metadataClientDriver.setConnectionExpiredListener(() -> { LOG.error("Client connection to the Metadata server has expired, so shutting down AutoRecoveryMain!"); shutdown(ExitCode.ZK_EXPIRED); }); auditorElector = new AuditorElector( Bookie.getBookieAddress(conf).toString(), conf, bkc, statsLogger.scope(AUDITOR_SCOPE), false); replicationWorker = new ReplicationWorker( conf, bkc, false, statsLogger.scope(REPLICATION_WORKER_SCOPE)); deathWatcher = new AutoRecoveryDeathWatcher(this); }

Target:
public AutoRecoveryMain(ServerConfiguration conf, StatsLogger statsLogger) throws IOException, InterruptedException, KeeperException, UnavailableException, CompatibilityException { this.conf = conf; this.bkc = Auditor.createBookKeeperClient(conf); MetadataClientDriver metadataClientDriver = bkc.getMetadataClientDriver(); metadataClientDriver.setSessionStateListener(() -> { LOG.error("Client connection to the Metadata server has expired, so shutting down AutoRecoveryMain!"); shutdown(ExitCode.ZK_EXPIRED); }); auditorElector = new AuditorElector( Bookie.getBookieAddress(conf).toString(), conf, bkc, statsLogger.scope(AUDITOR_SCOPE), false); replicationWorker = new ReplicationWorker( conf, bkc, false, statsLogger.scope(REPLICATION_WORKER_SCOPE)); deathWatcher = new AutoRecoveryDeathWatcher(this); }
Source:
protected void activate(ComponentContext ctxt) { try { if (log.isDebugEnabled()) { log.debug("User Profile Mgt bundle is activated "); } } catch (Exception e) { log.error("Failed to activate ProfileMgt bundle ", e); } }

Target:
protected void activate(ComponentContext ctxt) { try { if (log.isDebugEnabled()) { log.debug("User Profile Mgt bundle is activated "); } } catch (Throwable e) { log.error("Failed to activate ProfileMgt bundle ", e); } }
Source:
public void shouldUnRetireAnEncounterType() throws Exception { EncounterType encounterType = service.getEncounterTypeByUuid(getUuid()); encounterType.setRetired(true); encounterType.setRetiredBy(Context.getAuthenticatedUser()); encounterType.setDateRetired(new Date()); encounterType.setRetireReason("random reason"); encounterType = service.saveEncounterType(encounterType); assertTrue(encounterType.isRetired()); String json = "{\"deleted\": \"false\"}"; SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); encounterType = service.getEncounterTypeByUuid(getUuid()); assertFalse(encounterType.isRetired()); assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }

Target:
public void shouldUnRetireAnEncounterType() throws Exception { EncounterType encounterType = service.getEncounterTypeByUuid(getUuid()); encounterType.setRetired(true); encounterType.setRetireReason("random reason"); service.saveEncounterType(encounterType); encounterType = service.getEncounterTypeByUuid(getUuid()); assertTrue(encounterType.isRetired()); String json = "{\"deleted\": \"false\"}"; SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); encounterType = service.getEncounterTypeByUuid(getUuid()); assertFalse(encounterType.isRetired()); assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }
Source:
public void lookupImportEmlFileToMailboxShouldReturnEnumValue() { assertThat(CmdType.lookup("importemlfiletomailbox")).isEqualTo(CmdType.IMPORTEMLFILETOMAILBOX); }

Target:
public void lookupImportEmlFileToMailboxShouldReturnEnumValue() { assertThat(CmdType.lookup("ImportEml")) .isEqualTo(CmdType.IMPORTEML); }
Source:
public void init() { setLabel("Plugin"); addAttribute(ID, ROLE_ID).setLabel("Identifier"); addAttribute(LABEL, ROLE_LABEL, ROLE_LOOKUP).setNillable(false).setUnique(true).setLabel("Label"); addAttribute(DESCRIPTION, ROLE_LOOKUP).setLabel("Description").setDataType(HTML); }

Target:
public void init() { setLabel("Plugin"); addAttribute(ID, ROLE_ID).setLabel("Identifier"); addAttribute(LABEL, ROLE_LABEL, ROLE_LOOKUP).setNillable(false).setUnique(true).setLabel("Label"); addAttribute(DESCRIPTION, ROLE_LOOKUP).setLabel("Description"); }
Source:
private void deleteReleaseWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("event parameter is null"); } final TeamPluginGlobalConfig config = TeamPluginGlobalConfig.get(); if (config == null) { throw new InternalError("Cannot load TFS global configuration"); } String webHookNameToDelete = resource.getWebHookName(); ReleaseWebHook webHook = validateAndGetReleaseWebHookByName(webHookNameToDelete); for (final Item projectItem : Jenkins.getActiveInstance().getAllItems()) { if (projectItem instanceof AbstractProject) { AbstractProject project = (AbstractProject) projectItem; ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action != null) { for (ReleaseWebHookName webHookName : action.getWebHookNames()) { if (webHookName.getWebHookName().equalsIgnoreCase(webHookNameToDelete)) { logger.fine(String.format("WebHook %s is referenced in project %s. Cannot delete until all the references are removed.", webHookNameToDelete, project.getName())); return; } } } } } List<ReleaseWebHook> releaseWebHooks = ReleaseWebHookHelper.getReleaseWebHookConfigurations(); releaseWebHooks.remove(webHook); ReleaseWebHookHelper.saveReleaseWebHookConfigurations(releaseWebHooks); }

Target:
private void deleteReleaseWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("resource is null"); } final TeamPluginGlobalConfig config = TeamPluginGlobalConfig.get(); if (config == null) { throw new InternalError("Cannot load TFS global configuration"); } String webHookNameToDelete = resource.getWebHookName(); ReleaseWebHook webHook = validateAndGetReleaseWebHookByName(webHookNameToDelete); for (final Item projectItem : Jenkins.getActiveInstance().getAllItems()) { if (projectItem instanceof AbstractProject) { AbstractProject project = (AbstractProject) projectItem; ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action != null) { for (ReleaseWebHookReference webHookReference : action.getWebHookReferences()) { if (webHookReference.getWebHookName().equalsIgnoreCase(webHookNameToDelete)) { throw new UnsupportedOperationException(String.format("WebHook %s is referenced in project %s. Cannot delete until all the references are removed.", webHookNameToDelete, project.getName())); } } } } } List<ReleaseWebHook> releaseWebHooks = ReleaseWebHookHelper.getReleaseWebHookConfigurations(); releaseWebHooks.remove(webHook); ReleaseWebHookHelper.saveReleaseWebHookConfigurations(releaseWebHooks); }
Source:
public void testJDTCompiler() throws Exception { Path tmpRoot = Files.createTempDirectory("repo"); Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); TestUtil.copyTree(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_UNTOUCHED_WITH_ERROR_DIR), temp); Path tmp = Paths.get(tmpRoot.toAbsolutePath().toString(), "dummy"); Path mainPom = Paths.get(tmp.toAbsolutePath().toString(), "pom.xml"); byte[] encoded = Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString(), "pom.xml")); String pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).doesNotContain("<artifactId>kie-takari-lifecycle-plugin</artifactId>"); assertThat(pomAsAstring).doesNotContain("<packaging>kjar</packaging>"); assertThat(pomAsAstring).doesNotContain("<compilerId>jdt</compilerId>"); assertThat(pomAsAstring).doesNotContain("<source>1.8</source>"); assertThat(pomAsAstring).doesNotContain("<target>1.8</target>"); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(), info, new String[]{MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE}, Boolean.FALSE); DefaultIncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler(); assertThat(enabler.process(req).getResult()).isTrue(); encoded = Files.readAllBytes(Paths.get(mainPom.toString())); pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).contains("<compilerId>jdt</compilerId>"); assertThat(pomAsAstring).contains("<source>1.8</source>"); assertThat(pomAsAstring).contains("<target>1.8</target>"); TestUtil.rm(tmpRoot.toFile()); }

Target:
public void testJDTCompiler() throws Exception { Path tmpRoot = Files.createTempDirectory("repo"); Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); TestUtil.copyTree(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_UNTOUCHED_WITH_ERROR_DIR), temp); Path tmp = Paths.get(tmpRoot.toAbsolutePath().toString(), "dummy"); Path mainPom = Paths.get(tmp.toAbsolutePath().toString(), "pom.xml"); byte[] encoded = Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString(), "pom.xml")); String pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).doesNotContain("<artifactId>kie-takari-lifecycle-plugin</artifactId>") .doesNotContain("<packaging>kjar</packaging>") .doesNotContain("<compilerId>jdt</compilerId>") .doesNotContain("<source>1.8</source>") .doesNotContain("<target>1.8</target>"); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(), info, new String[]{MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE}, Boolean.FALSE); DefaultIncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler(); assertThat(enabler.process(req).getResult()).isTrue(); encoded = Files.readAllBytes(Paths.get(mainPom.toString())); pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).contains("<compilerId>jdt</compilerId>") .contains("<source>1.8</source>") .contains("<target>1.8</target>"); TestUtil.rm(tmpRoot.toFile()); }
Source:
public void update(CruiseConfig cruiseConfig) { cruiseConfig.update(getPipelineGroup(), pipelineConfig.name().toString(), pipelineConfig); if (!StringUtils.equalsIgnoreCase(group, updatedGroupName)) { PipelineConfigs group = cruiseConfig.findGroup(this.group); group.remove(pipelineConfig); cruiseConfig.getGroups().addPipeline(updatedGroupName, pipelineConfig); } }

Target:
public void update(CruiseConfig cruiseConfig) { cruiseConfig.update(getExistingPipelineGroupName(), pipelineConfig.name().toString(), pipelineConfig); if (!existingGroupName.equalsIgnoreCase(newGroupName)) { PipelineConfigs group = cruiseConfig.findGroup(this.existingGroupName); group.remove(pipelineConfig); cruiseConfig.getGroups().addPipeline(newGroupName, pipelineConfig); } }
Source:
private String buildSignedHeaders(Multimap<String, String> canonicalizedHeadersMap) { StringBuilder signedHeadersBuffer = new StringBuilder(); for (Entry<String, String> header : canonicalizedHeadersMap.entries()) { String key = header.getKey(); signedHeadersBuffer.append(key.toLowerCase()).append(";"); } if(signedHeadersBuffer.length() > 0) { signedHeadersBuffer.deleteCharAt(signedHeadersBuffer.length()-1); } return signedHeadersBuffer.toString(); }

Target:
private static String buildSignedHeaders(Multimap<String, String> canonicalizedHeadersMap) { return Joiner.on(';').join(Iterables.transform(canonicalizedHeadersMap.keySet(), new Function<String, String>() { @Override public String apply(String input) { return input.toLowerCase(); } })); }
Source:
public static int getHeaderBlockEndColumnIndex(final List<GridColumn<?>> allColumns, final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == allColumns.size() - 1) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex < allColumns.size() - 1) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex + 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!candidateHeaderMetaData.get(headerRowIndex).equals(headerMetaData)) { break; } candidateHeaderColumnIndex++; } return candidateHeaderColumnIndex; }

Target:
public static int getHeaderBlockEndColumnIndex(final List<GridColumn<?>> allColumns, final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == allColumns.size() - 1) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex < allColumns.size() - 1) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex + 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!Objects.equals(candidateHeaderMetaData.get(headerRowIndex), headerMetaData)) { break; } candidateHeaderColumnIndex++; } return candidateHeaderColumnIndex; }
Source:
public void onFrob(ActivateEvent event, EntityRef entity) { DoorComponent door = entity.getComponent(DoorComponent.class); if (door.isOpen) { entity.send(new CloseDoorEvent(event.getInstigator())); } else { entity.send(new CloseDoorEvent(event.getInstigator())); } }

Target:
public void onFrob(ActivateEvent event, EntityRef entity) { DoorComponent door = entity.getComponent(DoorComponent.class); if (door.isOpen) { event.getInstigator().send(new CloseDoorEvent(entity)); } else { event.getInstigator().send(new OpenDoorEvent(entity)); } }
Source:
public void destroyGameObject(int id) { gameObjects.get(id).destroy(); }

Target:
public void destroyGameObject(int id) { gameObjects.remove(id); gameObjects.get(id).destroy(); }
Source:
public String getSearchTitle() { String title = new String(); if (req.getParameter("q") != null && !req.getParameter("q").isEmpty()) { title += req.getParameter("q") + " (full)"; } if (req.getParameter(QueryBuilder.DEFS) != null && !req.getParameter(QueryBuilder.DEFS).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.DEFS) + " (definition)"; } if (req.getParameter(QueryBuilder.REFS) != null && !req.getParameter(QueryBuilder.REFS).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.REFS) + " (reference)"; } if (req.getParameter(QueryBuilder.PATH) != null && !req.getParameter(QueryBuilder.PATH).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.PATH) + " (path)"; } if (req.getParameter(QueryBuilder.HIST) != null && !req.getParameter(QueryBuilder.HIST).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.HIST) + " (history)"; } if (req.getParameterValues(QueryBuilder.PROJECT) != null && req.getParameterValues(QueryBuilder.PROJECT).length != 0) { if (!title.isEmpty()) { title += " "; } title += "in projects: "; String projects[] = req.getParameterValues(QueryBuilder.PROJECT); for (int i = 0; i < projects.length; i++) { title += projects[i]; if (i < projects.length - 1) { title += ", "; } } } return Util.htmlize(title + " - OpenGrok search results"); }

Target:
public String getSearchTitle() { String title = new String(); if (req.getParameter("q") != null && !req.getParameter("q").isEmpty()) { title += req.getParameter("q") + " (full)"; } if (req.getParameter(QueryBuilder.DEFS) != null && !req.getParameter(QueryBuilder.DEFS).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.DEFS) + " (definition)"; } if (req.getParameter(QueryBuilder.REFS) != null && !req.getParameter(QueryBuilder.REFS).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.REFS) + " (reference)"; } if (req.getParameter(QueryBuilder.PATH) != null && !req.getParameter(QueryBuilder.PATH).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.PATH) + " (path)"; } if (req.getParameter(QueryBuilder.HIST) != null && !req.getParameter(QueryBuilder.HIST).isEmpty()) { title = addTitleDelimiter(title); title += req.getParameter(QueryBuilder.HIST) + " (history)"; } if (req.getParameterValues(QueryBuilder.PROJECT) != null && req.getParameterValues(QueryBuilder.PROJECT).length != 0) { if (!title.isEmpty()) { title += " "; } title += "in projects: "; String projects[] = req.getParameterValues(QueryBuilder.PROJECT); title += Arrays.asList(projects).stream().collect(Collectors.joining(",")); } return Util.htmlize(title + " - OpenGrok search results"); }
Source:
private void setVmToNonHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getParameters().getDev().getVmId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() == DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.qxl); vmStaticDao.update(vmStatic); } if (getVmDeviceUtils().getVideoDevices(getParameters().getDev().getVmId()).isEmpty()) { getVmDeviceUtils().addVideoDevices(vmStatic, getVmDeviceUtils().getNeededNumberOfVideoDevices(vmStatic)); } }

Target:
private void setVmToNonHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getParameters().getDev().getVmId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() == DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.qxl); resourceManager.getVmManager(getParameters().getDev().getVmId()).update(vmStatic); } if (getVmDeviceUtils().getVideoDevices(getParameters().getDev().getVmId()).isEmpty()) { getVmDeviceUtils().addVideoDevices(vmStatic, getVmDeviceUtils().getNeededNumberOfVideoDevices(vmStatic)); } }
Source:
private void getBookmarks(IngestJobContext context, AbstractFile file) throws TskCoreException, IOException, SAXException, PropertyListFormatException, ParseException, ParserConfigurationException { if (file.getSize() == 0) { return; } File tempFile = createTemporaryFile(context, file); try { postArtifact( getBookmarkArtifacts(file, tempFile, context)); } finally { tempFile.delete(); } }

Target:
private void getBookmarks(IngestJobContext context, AbstractFile file) throws TskCoreException, IOException, SAXException, PropertyListFormatException, ParseException, ParserConfigurationException { if (file.getSize() == 0) { return; } File tempFile = createTemporaryFile(context, file); try { postArtifacts(getBookmarkArtifacts(file, tempFile, context)); } finally { tempFile.delete(); } }
Source:
protected ExprEval eval(final double x, final double y) { return ExprEval.of((long) x / (long) y); }

Target:
protected ExprEval eval(final double x, final double y) { return ExprEval.of((long) (x / y)); }
Source:
public String toString() { String versionString = componentVersion; if (this.wineryVersion > 0) { versionString += ((Objects.nonNull(versionString) && versionString.length() > 0) ? WINERY_VERSION_SEPARATOR : "") + WINERY_VERSION_PREFIX + wineryVersion; if (this.workInProgressVersion > 0) { versionString += WINERY_VERSION_SEPARATOR + WINERY_WIP_VERSION_PREFIX + this.workInProgressVersion; } } return versionString; }

Target:
public String toString() { String versionString = componentVersion; if (this.wineryVersion > 0) { versionString += (StringUtils.isEmpty(versionString) ? "" : WINERY_VERSION_SEPARATOR) + WINERY_VERSION_PREFIX + wineryVersion; if (this.workInProgressVersion > 0) { versionString += WINERY_VERSION_SEPARATOR + WINERY_WIP_VERSION_PREFIX + this.workInProgressVersion; } } return versionString; }
Source:
public void testPublishDocument() throws OperationException { OperationContext ctx = new OperationContext(session); ctx.setInput(fileToPublish); DocumentModel publishedDoc = (DocumentModel) service.run(ctx, PublishDocument.ID, Collections.singletonMap("target", section)); assertEquals(section.getId(), session.getDocument(publishedDoc.getParentRef()).getId()); assertEquals(1, session.getChildren(section.getRef()).size()); }

Target:
public void testPublishDocument() throws OperationException { try (OperationContext ctx = new OperationContext(session); CapturingEventListener listener = new CapturingEventListener(DocumentEventTypes.DOCUMENT_PUBLISHED)) { ctx.setInput(fileToPublish); DocumentModel publishedDoc = (DocumentModel) service.run(ctx, PublishDocument.ID, Collections.singletonMap("target", section)); assertEquals(section.getId(), session.getDocument(publishedDoc.getParentRef()).getId()); assertEquals(1, session.getChildren(section.getRef()).size()); assertTrue(listener.hasBeenFired(DocumentEventTypes.DOCUMENT_PUBLISHED)); } }
Source:
private void validateModel(BpmnModel model) throws Exception { FlowElement flowElement = model.getMainProcess().getFlowElement("ManualTask_0ej3luy"); assertNotNull(flowElement); assertTrue(flowElement instanceof ManualTask); checkXml(model); }

Target:
private void validateModel(BpmnModel model) throws Exception { FlowElement flowElement = model.getMainProcess().getFlowElement("ManualTask_0ej3luy"); assertThat(flowElement).isNotNull(); assertThat(flowElement instanceof ManualTask).isTrue(); checkXml(model); }
Source:
public void onConnect() { logger.info("Connected to my.openHAB service"); mIsConnected = true; }

Target:
public void onConnect() { logger.info("Connected to my.openHAB service (UUID = {}, base URL = {})", this.mUUID, this.mOHBaseUrl); mIsConnected = true; }
Source:
public static void setVelocity(Ability ability, Entity entity, Vector vector) { final AbilityVelocityAffectEntityEvent event = new AbilityVelocityAffectEntityEvent(ability, entity, vector); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) return; Vector velocity = event.getNewVector(); if (entity instanceof TNTPrimed) { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.TNT")) { velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.TNTStrengthMultiplier")); } } else if (entity instanceof FallingBlock) { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.Normal")) { velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier")); } } if (velocity.getX() > 4) { velocity.setX(4); } else if (velocity.getX() < -4) { velocity.setX(-4); } if (velocity.getY() > 4) { velocity.setY(4); } else if (velocity.getY() < -4) { velocity.setY(-4); } if (velocity.getZ() > 4) { velocity.setZ(4); } else if (velocity.getZ() < -4) { velocity.setZ(-4); } event.getAffected().setVelocity(velocity); }

Target:
public static void setVelocity(Ability ability, Entity entity, Vector vector) { final AbilityVelocityAffectEntityEvent event = new AbilityVelocityAffectEntityEvent(ability, entity, vector); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) return; Vector velocity = event.getVelocity(); if(velocity == null || Double.isNaN(velocity.length())) return; if (entity instanceof TNTPrimed) { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.TNT")) { velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.TNTStrengthMultiplier")); } } else if (entity instanceof FallingBlock) { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.Normal")) { velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier")); } } if (velocity.getX() > 4) { velocity.setX(4); } else if (velocity.getX() < -4) { velocity.setX(-4); } if (velocity.getY() > 4) { velocity.setY(4); } else if (velocity.getY() < -4) { velocity.setY(-4); } if (velocity.getZ() > 4) { velocity.setZ(4); } else if (velocity.getZ() < -4) { velocity.setZ(-4); } event.getAffected().setVelocity(velocity); }
Source:
public Long get() { return supplier.get(); }

Target:
public Long get() { Long ts = supplier.get(); for (ImmutableTimestampMonitor monitor : monitors) { monitor.update(ts); } return ts; }
Source:
public void checkUserIsNotAssigneeForRepo() throws Exception { MatcherAssert.assertThat( RtAssigneesITCase.repo().assignees().check("octocat"), Matchers.is(false) ); }

Target:
public void checkUserIsNotAssigneeForRepo() throws Exception { MatcherAssert.assertThat( RtAssigneesITCase.repo() .assignees() .check(RandomStringUtils.randomAlphabetic(Tv.TEN)), Matchers.is(false) ); }
Source:
public static SnomedIdentifierValidator getIdentifierValidator(ComponentCategory category) { switch (category) { case CONCEPT: case DESCRIPTION: case RELATIONSHIP: return new SnomedComponentIdentifierValidator(category); default: throw new UnsupportedOperationException(""+category); } }

Target:
public static SnomedIdentifierValidator getIdentifierValidator(ComponentCategory category) { switch (category) { case CONCEPT: case DESCRIPTION: case RELATIONSHIP: return new SnomedComponentIdentifierValidator(category); default: throw new UnsupportedOperationException("Can't create validator for category: " + category); } }
Source:
public void testInPackageScan() { DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan"); assertForAnnotation(scanner); }

Target:
public void testInPackageScan() { final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN); assertNotNull(scanner); assertForAnnotation(scanner); }
Source:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); final HostPageData pageData = new HostPageData(); pageData.pluginUrls = getPluginUrls(); pageData.config = config; final StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); final Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); permutations = new HashMap<Permutation, Content>(); for (Permutation p : selector.getPermutations()) { final Document d = HtmlDomUtil.clone(hostDoc); Element nocache = HtmlDomUtil.find(d, "gerrit_module"); nocache.getParentNode().removeChild(nocache); p.inject(d); permutations.put(p, new Content(d)); } Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.setAttribute("src", noCacheName); permutations.put(null, new Content(hostDoc)); }

Target:
Page() throws IOException { Document hostDoc = HtmlDomUtil.clone(template); css = injectCssFile(hostDoc, "gerrit_sitecss", site.site_css); header = injectXmlFile(hostDoc, "gerrit_header", site.site_header); footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer); final HostPageData pageData = new HostPageData(); pageData.config = config; final StringWriter w = new StringWriter(); w.write("var " + HPD_ID + "="); json(pageData, w); w.write(";"); final Element data = HtmlDomUtil.find(hostDoc, HPD_ID); asScript(data); data.appendChild(hostDoc.createTextNode(w.toString())); data.appendChild(hostDoc.createComment(HPD_ID)); permutations = new HashMap<Permutation, Content>(); for (Permutation p : selector.getPermutations()) { final Document d = HtmlDomUtil.clone(hostDoc); Element nocache = HtmlDomUtil.find(d, "gerrit_module"); nocache.getParentNode().removeChild(nocache); p.inject(d); permutations.put(p, new Content(d)); } Element nocache = HtmlDomUtil.find(hostDoc, "gerrit_module"); asScript(nocache); nocache.setAttribute("src", noCacheName); permutations.put(null, new Content(hostDoc)); }
Source:
Object getValue(Object obj) throws Exception { throw new HazelcastException("Path agnostic value extraction is not supported"); }

Target:
Object getValue(Object obj) { throw new HazelcastException("Path agnostic value extraction is not supported"); }
Source:
public Response setClusterStateModelDefinition( @PathParam("clusterId") String clusterId, @PathParam("statemodel") String statemodel, String content ) { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a valid ZNRecord!"); } StateModelDefinition stateModelDefinition = new StateModelDefinition(record); HelixDataAccessor dataAccessor = getDataAccssor(clusterId); PropertyKey key = dataAccessor.keyBuilder().stateModelDef(stateModelDefinition.getId()); boolean retcode = true; try { retcode = dataAccessor.setProperty(key, stateModelDefinition); } catch (Exception e) { _logger.error("Failed to set StateModelDefinition key:" + key + ", Exception: " + e); retcode = false; } if (!retcode) { return badRequest("Failed to set the content " + content); } return OK(); }

Target:
public Response setClusterStateModelDefinition(@PathParam("clusterId") String clusterId, @PathParam("statemodel") String statemodel, String content) { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a valid ZNRecord!"); } StateModelDefinition stateModelDefinition = new StateModelDefinition(record); HelixDataAccessor dataAccessor = getDataAccssor(clusterId); PropertyKey key = dataAccessor.keyBuilder().stateModelDef(stateModelDefinition.getId()); boolean retcode = true; try { retcode = dataAccessor.setProperty(key, stateModelDefinition); } catch (Exception e) { _logger.error("Failed to set StateModelDefinition key:" + key + ", Exception: " + e); return badRequest("Failed to set the content " + content); } return OK(); }
Source:
public ExcelConfiguration(int columnNameLineNumber, boolean skipEmptyLines, boolean skipEmptyColumns) { this(columnNameLineNumber, null, skipEmptyLines, skipEmptyColumns, false, 1000); }

Target:
public ExcelConfiguration(int columnNameLineNumber, boolean skipEmptyLines, boolean skipEmptyColumns) { this(columnNameLineNumber, null, skipEmptyLines, skipEmptyColumns, false, NUMBERS_OF_LINES_TO_SCAN); }
Source:
public final Message<?> postReceive(Message<?> message, MessageChannel channel) { if (message instanceof MessageWithSpan) { MessageWithSpan messageWithSpan = (MessageWithSpan) message; Message<?> messageToHandle = messageWithSpan.message; populatePropagatedContext(messageWithSpan.span, messageToHandle, channel); publish(new ClientReceivedEvent(this, messageWithSpan.span)); return message; } return message; }

Target:
public final Message<?> postReceive(Message<?> message, MessageChannel channel) { if (message instanceof MessageWithSpan) { MessageWithSpan messageWithSpan = (MessageWithSpan) message; Message<?> messageToHandle = messageWithSpan.message; populatePropagatedContext(messageWithSpan.span, messageToHandle, channel); return message; } return message; }
Source:
public void notification_onCommitRealmResults() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<RealmResults<AllJavaTypes>> listener = new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> object) { counter.incrementAndGet(); } }; child.getObjectParents().addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); looperThread.postRunnable( new Runnable() { @Override public void run() { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); looperThread.testComplete(); } } ); }

Target:
public void notification_onCommitRealmResults() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<RealmResults<AllJavaTypes>> listener = new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> object) { counter.incrementAndGet(); } }; child.getObjectParents().addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); verifyPostConditions( looperThreadRealm, new PostConditions() { public void run(Realm realm) { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); } }, child, parent); }
Source:
public String getIdentitySelectString(String table, String column, int type) { return "select currval('" + table + '_' + column + "_seq')"; }

Target:
public String getIdentitySelectString(String table, String column, int type) { return "select 1"; }
Source:
public String evaluate(Run<?, ?> run, FilePath workspace, TaskListener listener, String macroName) { StringBuilder buffer = new StringBuilder(); AbstractTestResultAction<?> testResult = run.getAction(AbstractTestResultAction.class); if (null == testResult) { return "No tests ran."; } List<TestResult> failedTests = testResult.getFailedTests().stream().collect(Collectors.toList()); failedTests = testSuiteName.length() == 0 ? failedTests : failedTests.stream().filter(t -> t.getFullName().contains(testSuiteName)).collect(Collectors.toList()); int failCount = failedTests.size(); if (failCount == 0) { buffer.append("All tests passed"); } else { String lineBreak = getLineBreak(); buffer.append(failCount).append(" tests failed.").append(lineBreak); boolean showOldFailures = !onlyRegressions; if(maxLength < Integer.MAX_VALUE) { maxLength *= 1024; } if (maxTests > 0) { int printedTests = 0; int printedLength = 0; for (TestResult failedTest : failedTests) { if (showOldFailures || getTestAge(failedTest) == 1) { if (printedTests < maxTests && printedLength <= maxLength) { printedLength += outputTest(buffer, failedTest, showStack, showMessage, maxLength-printedLength); printedTests++; } } } if (failCount > printedTests) { buffer.append("... and ").append(failCount - printedTests).append(" other failed tests.") .append(lineBreak); } if (printedLength >= maxLength) { buffer.append(lineBreak).append("... output truncated.").append(lineBreak); } } } return buffer.toString(); }

Target:
public String evaluate(Run<?, ?> run, FilePath workspace, TaskListener listener, String macroName) { StringBuilder buffer = new StringBuilder(); AbstractTestResultAction<?> testResult = run.getAction(AbstractTestResultAction.class); if (null == testResult) { return "No tests ran."; } int failCount = testResult.getFailCount(); List<? extends TestResult> failedAndFilteredTests = filterTests(testResult.getFailedTests(), testNamePattern); failCount = testNamePattern.length() == 0 ? failCount : failedAndFilteredTests.size(); if (failCount == 0) { buffer.append("All tests passed"); } else { String lineBreak = getLineBreak(); buffer.append(failCount).append(" tests failed.").append(lineBreak); boolean showOldFailures = !onlyRegressions; if(maxLength < Integer.MAX_VALUE) { maxLength *= 1024; } if (maxTests > 0) { int printedTests = 0; int printedLength = 0; for (TestResult failedTest : failedAndFilteredTests) { if (showOldFailures || getTestAge(failedTest) == 1) { if (printedTests < maxTests && printedLength <= maxLength) { printedLength += outputTest(buffer, failedTest, showStack, showMessage, maxLength-printedLength); printedTests++; } } } if (failCount > printedTests) { buffer.append("... and ").append(failCount - printedTests).append(" other failed tests.") .append(lineBreak); } if (printedLength >= maxLength) { buffer.append(lineBreak).append("... output truncated.").append(lineBreak); } } } return buffer.toString(); }
Source:
public void testExcelReporter() { XmlSuite suite = new XmlSuite(); suite.setName("ExcelReporterSuite"); XmlTest test = new XmlTest(suite); test.setName("ExcelReporterTest"); List<XmlClass> classes = new ArrayList<>(); classes.add(new XmlClass(ConfigTest.class)); test.setXmlClasses(classes); List<XmlSuite> xmlSuites = new ArrayList<>(); xmlSuites.add(suite); Configuration config = new Configuration(); SuiteRunner iSuite = new SuiteRunner(config, suite, SUREFIRE_DEFAULT_REPORTS_DIR); iSuite.getXmlSuite().setParentSuite(suite); List<ISuite> iSuites = new ArrayList<>(); iSuites.add(iSuite); ExcelReport excelReport = new ExcelReport(); excelReport.setExcelFileName(excelReportFileName); excelReport.generateReport(xmlSuites, iSuites, SUREFIRE_DEFAULT_REPORTS_DIR); assertTrue(Files.exists(p), "Verify path of Excel Report file."); assertTrue(Files.isRegularFile(p), "Verify that Excel_Report.xls is a file."); if (Files.exists(p) && Files.isRegularFile(p)) { FileInputStream fileInputStream = null; HSSFWorkbook workbook = null; try { fileInputStream = new FileInputStream(p.toFile()); workbook = new HSSFWorkbook(fileInputStream); assertEquals(ReportSheetNames.values().length, workbook.getNumberOfSheets(), "Verify number of worksheets in ExcelReport"); } catch (FileNotFoundException e) { fail("Test excel-report-test failed due to FileNotFoundException."); } catch (IOException e) { fail("Test excel-report-test failed due to IOException."); } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }

Target:
public void testExcelReporter() throws IOException { XmlSuite suite = new XmlSuite(); suite.setName("ExcelReporterSuite"); XmlTest test = new XmlTest(suite); test.setName("ExcelReporterTest"); List<XmlClass> classes = new ArrayList<>(); classes.add(new XmlClass(ConfigTest.class)); test.setXmlClasses(classes); List<XmlSuite> xmlSuites = new ArrayList<>(); xmlSuites.add(suite); Configuration config = new Configuration(); SuiteRunner iSuite = new SuiteRunner(config, suite, strReportsDirectory); iSuite.getXmlSuite().setParentSuite(suite); List<ISuite> iSuites = new ArrayList<>(); iSuites.add(iSuite); ExcelReport excelReport = new ExcelReport(); excelReport.setExcelFileName(excelReportFileName); excelReport.generateReport(xmlSuites, iSuites, strReportsDirectory); assertTrue(Files.exists(excelFile), "Verify path of Excel Report file."); assertTrue(Files.isRegularFile(excelFile), "Verify that Excel Report is a file."); FileInputStream fileInputStream = new FileInputStream(excelFile.toFile()); HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream); assertEquals(ReportSheetNames.values().length, workbook.getNumberOfSheets(), "Verify number of worksheets in ExcelReport"); IOUtils.closeQuietly(fileInputStream); }
Source:
public MapReactiveUserDetailsService(Collection<UserDetails> users) { Assert.notEmpty(users, "users cannot be null or empty"); final ConcurrentHashMap<String, UserDetails> map = new ConcurrentHashMap<>(); for (UserDetails user: users) { map.put(user.getUsername(), user); } this.users = map; }

Target:
public MapReactiveUserDetailsService(Collection<UserDetails> users) { Assert.notEmpty(users, "users cannot be null or empty"); this.users = new ConcurrentHashMap<>(); for (UserDetails user : users) { this.users.put(getKey(user.getUsername()), user); } }
Source:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || o.getClass() != BeanGroupProcessedUnit.class ) { return false; } BeanGroupProcessedUnit that = (BeanGroupProcessedUnit) o; if ( bean != that.bean ) { return false; } if ( !group.equals( that.group ) ) { return false; } return true; }

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } BeanGroupProcessedUnit that = (BeanGroupProcessedUnit) o; if ( bean != that.bean ) { return false; } if ( !group.equals( that.group ) ) { return false; } return true; }
Source:
public boolean areCursorsValid(final String topic, final List<Cursor> cursors) { final List<TopicPartition> partitions = listPartitions(topic); return cursors .stream() .allMatch(cursor -> partitions .stream() .filter(tp -> tp.getPartitionId().equals(cursor.getPartition())) .findFirst() .map(pInfo -> { final long newestOffset = Long.parseLong(pInfo.getNewestAvailableOffset()); final long oldestOffset = Long.parseLong(pInfo.getOldestAvailableOffset()); final long offset = Long.parseLong(cursor.getOffset()); return offset >= oldestOffset && offset <= newestOffset; }) .orElse(false)); }

Target:
public boolean areCursorsValid(final String topic, final List<Cursor> cursors) { final List<TopicPartition> partitions = listPartitions(topic); return cursors .stream() .allMatch(cursor -> partitions .stream() .filter(tp -> tp.getPartitionId().equals(cursor.getPartition())) .findFirst() .map(pInfo -> { final long newestOffset = toKafkaOffset(pInfo.getNewestAvailableOffset()); final long oldestOffset = toKafkaOffset(pInfo.getOldestAvailableOffset()); try { final long offset = fromNakadiCursor(cursor).getOffset(); return offset >= oldestOffset && offset <= newestOffset; } catch (NumberFormatException e) { return false; } }) .orElse(false)); }
Source:
private Iterable<Review> reviews(final Publisher contentPublisher, Set<org.atlasapi.media.entity.simple.Review> simpleReviews) { return Iterables.transform(simpleReviews, new Function<org.atlasapi.media.entity.simple.Review, Review>() { @Override public Review apply(org.atlasapi.media.entity.simple.Review simpleReview) { if (simpleReview.getPublisherDetails() != null && !getPublisher(simpleReview.getPublisherDetails()) .equals(contentPublisher)) { throw new IllegalArgumentException("Review publisher must match content publisher"); } Review review = new Review(Locale.forLanguageTag( simpleReview.getLanguage()), simpleReview.getReview() ); review.setType(simpleReview.getType()); review.setPeople(simpleReview.getPeople()); return review; } }); }

Target:
private Iterable<Review> reviews(final Publisher contentPublisher, Set<org.atlasapi.media.entity.simple.Review> simpleReviews) { return Iterables.transform(simpleReviews, simpleReview -> { if (simpleReview.getPublisherDetails() != null && !getPublisher(simpleReview.getPublisherDetails()) .equals(contentPublisher)) { throw new IllegalArgumentException( "Review publisher must match content publisher" ); } Review review = new Review(Locale.forLanguageTag( simpleReview.getLanguage()), simpleReview.getReview() ); review.setType(simpleReview.getType()); Author author = Author.builder() .withAuthorName(simpleReview.getAuthor().getAuthorName()) .withAuthorInitials(simpleReview.getAuthor().getAuthorInitials()) .build(); review.setAuthor(author); return review; } ); }
Source:
private boolean postLog(){ try{ final byte[] bytes = getByteLog(); if(bytes.length >= MAX_LOG_SIZE){ LOGGER.warn("Log message too large, size {}", bytes.length); return false; } this.dataLogger.put(this.senseId, bytes); return true; } catch (ProvisionedThroughputExceededException ptEx){ LOGGER.error("Provisioned Throughput Exceeded."); } catch (AmazonClientException awsEx){ LOGGER.error("Post log message for sense failed: {}", this.senseId, awsEx.getMessage()); } catch (Exception ex){ LOGGER.error("Post log message for sense failed, generic error: {}", this.senseId, ex.getMessage()); } return false; }

Target:
private boolean postLog(){ try{ final byte[] bytes = toByteArray(); if(bytes.length >= MAX_LOG_SIZE){ LOGGER.warn("Log message too large, size {}", bytes.length); return false; } this.dataLogger.put(this.senseId, bytes); return true; } catch (ProvisionedThroughputExceededException ptEx){ LOGGER.error("Provisioned Throughput Exceeded."); } catch (AmazonClientException awsEx){ LOGGER.error("Post log message for sense failed: {}", this.senseId, awsEx.getMessage()); } catch (Exception ex){ LOGGER.error("Post log message for sense failed, generic error: {}", this.senseId, ex.getMessage()); } return false; }
Source:
public File getResource(String providerName, String resourcePath) { if (resourcePath == null || !resourcePath.equals(FilenameUtils.normalize(resourcePath)) || new File(resourcePath) .isAbsolute()) { return null; } if (providerName == null) { for (ResourceProvider provider : resourceProviders.values()) { File ret = provider.getResource(resourcePath); if (ret != null) return ret; } return null; } else { ResourceProvider provider = resourceProviders.get(providerName); return provider.getResource(resourcePath); } }

Target:
public File getResource(String providerName, String resourcePath) { if (resourcePath == null) { return null; } if (!resourcePath.equals(FilenameUtils.normalize(resourcePath))) { log.warn("Attempted to load file via directory traversal using path: {}", resourcePath); return null; } if (providerName == null) { for (ResourceProvider provider : resourceProviders.values()) { File ret = provider.getResource(resourcePath); if (ret != null) return ret; } return null; } else { ResourceProvider provider = resourceProviders.get(providerName); return provider.getResource(resourcePath); } }
Source:
public void configure(Binder binder) { binder.bind(ThriftConnector.class).in(Scopes.SINGLETON); thriftClientBinder(binder).bindThriftClient(PrestoThriftService.class); binder.bind(ThriftMetadata.class).in(Scopes.SINGLETON); binder.bind(ThriftSplitManager.class).in(Scopes.SINGLETON); binder.bind(ThriftPageSourceProvider.class).in(Scopes.SINGLETON); binder.bind(PrestoThriftServiceProvider.class).to(RetryingPrestoThriftServiceProvider.class).in(Scopes.SINGLETON); binder.bind(PrestoThriftServiceProvider.class).annotatedWith(NonRetrying.class).to(DefaultPrestoThriftServiceProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ThriftConnectorConfig.class); binder.bind(ThriftSessionProperties.class).in(Scopes.SINGLETON); binder.bind(ThriftIndexProvider.class).in(Scopes.SINGLETON); newExporter(binder).export(PrestoThriftServiceProvider.class).as(generatedNameOf(RetryingPrestoThriftServiceProvider.class, connectorId)); }

Target:
public void configure(Binder binder) { binder.bind(ThriftConnector.class).in(Scopes.SINGLETON); thriftClientBinder(binder).bindThriftClient(PrestoThriftService.class); binder.bind(ThriftMetadata.class).in(Scopes.SINGLETON); binder.bind(ThriftSplitManager.class).in(Scopes.SINGLETON); binder.bind(ThriftPageSourceProvider.class).in(Scopes.SINGLETON); binder.bind(PrestoThriftServiceProvider.class).to(RetryingPrestoThriftServiceProvider.class).in(Scopes.SINGLETON); binder.bind(PrestoThriftServiceProvider.class).annotatedWith(NonRetrying.class).to(DefaultPrestoThriftServiceProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ThriftConnectorConfig.class); binder.bind(ThriftSessionProperties.class).in(Scopes.SINGLETON); binder.bind(ThriftIndexProvider.class).in(Scopes.SINGLETON); binder.bind(ThriftConnectorStats.class).in(Scopes.SINGLETON); newExporter(binder).export(PrestoThriftServiceProvider.class) .as(generatedNameOf(RetryingPrestoThriftServiceProvider.class, connectorId)); newExporter(binder).export(ThriftConnectorStats.class) .as(generatedNameOf(ThriftConnectorStats.class, connectorId)); }
Source:
public final void contextDestroyed(final ServletContextEvent sce) { val logger = Logger.getLogger("org.apereo.cas"); logger.info("Unregistering JdbcServletContextListener"); val cl = Thread.currentThread().getContextClassLoader(); val drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { val driver = drivers.nextElement(); if (driver.getClass().getClassLoader() == cl) { try { DriverManager.deregisterDriver(driver); } catch (final SQLException ex) { logger.warning("Error deregistering JDBC driver " + ex); } } else { logger.info("Not deregistering JDBC driver as it does not belong to this webapp's ClassLoader: " + driver); } } }

Target:
public final void contextDestroyed(final ServletContextEvent sce) { val logger = Logger.getLogger("org.apereo.cas"); logger.fine("Unregistering JdbcServletContextListener"); val cl = Thread.currentThread().getContextClassLoader(); val drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { val driver = drivers.nextElement(); if (driver.getClass().getClassLoader() == cl) { try { DriverManager.deregisterDriver(driver); } catch (final SQLException ex) { logger.warning("Error deregistering JDBC driver " + ex); } } else { logger.fine("Not deregistering JDBC driver as it does not belong to this webapp's ClassLoader: " + driver); } } }