auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void load(String mountTableConfigPath, Configuration conf) throws IOException { this.mountTablePath = new Path(mountTableConfigPath); String scheme = mountTablePath.toUri().getScheme(); ViewFileSystem.FsGetter fsGetter = new ViewFileSystemOverloadScheme.ChildFsGetter(scheme); FileSystem fs = fsGetter.getNewInstance(mountTablePath.toUri(), conf); RemoteIterator<LocatedFileStatus> listFiles = fs.listFiles(mountTablePath, false); LocatedFileStatus lfs = null; int higheirVersion = -1; while (listFiles.hasNext()) { LocatedFileStatus curLfs = listFiles.next(); String cur = curLfs.getPath().getName(); String[] nameParts = cur.split(REGEX_DOT); if (nameParts.length < 2) { logInvalidFileNameFormat(cur); continue; } int curVersion = higheirVersion; try { curVersion = Integer.parseInt(nameParts[nameParts.length - 2]); } catch (NumberFormatException nfe) { logInvalidFileNameFormat(cur); continue; } if (curVersion > higheirVersion) { higheirVersion = curVersion; lfs = curLfs; } } if (lfs == null) { LOGGER.warn("No valid mount-table file exist at: " + mountTableConfigPath + ". At least one mount-table file should present with the name " + "format: mount-table.<versionNumber>.xml"); return; } Path letestVersionMountTable = lfs.getPath(); conf.addResource(fs.open(letestVersionMountTable)); }

Target:
public void load(String mountTableConfigPath, Configuration conf) throws IOException { this.mountTable = new Path(mountTableConfigPath); String scheme = mountTable.toUri().getScheme(); ViewFileSystem.FsGetter fsGetter = new ViewFileSystemOverloadScheme.ChildFsGetter(scheme); try (FileSystem fs = fsGetter.getNewInstance(mountTable.toUri(), conf)) { RemoteIterator<LocatedFileStatus> listFiles = fs.listFiles(mountTable, false); LocatedFileStatus lfs = null; int higherVersion = -1; while (listFiles.hasNext()) { LocatedFileStatus curLfs = listFiles.next(); String cur = curLfs.getPath().getName(); String[] nameParts = cur.split(REGEX_DOT); if (nameParts.length < 2) { logInvalidFileNameFormat(cur); continue; } int curVersion = higherVersion; try { curVersion = Integer.parseInt(nameParts[nameParts.length - 2]); } catch (NumberFormatException nfe) { logInvalidFileNameFormat(cur); continue; } if (curVersion > higherVersion) { higherVersion = curVersion; lfs = curLfs; } } if (lfs == null) { LOGGER.warn("No valid mount-table file exist at: {}. At least one " + "mount-table file should present with the name format: " + "mount-table.<versionNumber>.xml", mountTableConfigPath); return; } Path latestVersionMountTable = lfs.getPath(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Loading the mount-table into configuration.", latestVersionMountTable); } try (FSDataInputStream open = fs.open(latestVersionMountTable)) { Configuration newConf = new Configuration(false); newConf.addResource(open); conf.addResource(newConf); } } }
Source:
public String getPublicRouter(PaasManagerUser user, String region, String publicNetworkId) throws OpenStackException { log.debug("Obtain public router for external netwrk " + publicNetworkId); if (publicNetworkId == null ) { String errorMessage = "There is not an external network valid for the router"; log.error(errorMessage); throw new OpenStackException(errorMessage); } String type = "router"; RegionCache regionCache = new RegionCache(); String routerId = regionCache.getUrl(region, type); if (routerId != null) { return routerId; } PaasManagerUser adminUser = openOperationUtil.getAdminUser(user); HttpUriRequest request = openOperationUtil.createQuantumGetRequest(RESOURCE_ROUTERS, APPLICATION_JSON, region, adminUser.getToken(), adminUser.getTenantId()); String response = null; try { response = openOperationUtil.executeNovaRequest(request); routerId = getPublicRouterId(response, adminUser.getUserName(), publicNetworkId); if (routerId == null) { String errorMessage = "It is not possible to find a public router for network " + publicNetworkId + ": "; log.error(errorMessage); throw new OpenStackException(errorMessage); } regionCache.putUrl(region, type, routerId); return routerId; } catch (OpenStackException e) { String errorMessage = "Error getting router for obtaining the public router: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error getting router from OpenStack for obtaining the public router: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } }

Target:
public String getPublicRouter(PaasManagerUser user, String region, String publicNetworkId) throws OpenStackException { log.debug("Obtain public router for external netwrk " + publicNetworkId); if (publicNetworkId == null ) { String errorMessage = "There is not an external network valid for the router"; log.warn(errorMessage); throw new OpenStackException(errorMessage); } String type = "router"; RegionCache regionCache = new RegionCache(); String routerId = regionCache.getUrl(region, type); if (routerId != null) { return routerId; } PaasManagerUser adminUser = openOperationUtil.getAdminUser(user); HttpUriRequest request = openOperationUtil.createQuantumGetRequest(RESOURCE_ROUTERS, APPLICATION_JSON, region, adminUser.getToken(), adminUser.getTenantId()); String response = null; try { response = openOperationUtil.executeNovaRequest(request); routerId = getPublicRouterId(response, adminUser.getUserName(), publicNetworkId); if (routerId == null) { String errorMessage = "It is not possible to find a public router for network " + publicNetworkId + ": "; log.error(errorMessage); throw new OpenStackException(errorMessage); } regionCache.putUrl(region, type, routerId); return routerId; } catch (OpenStackException e) { String errorMessage = "Error getting router for obtaining the public router: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error getting router from OpenStack for obtaining the public router: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } }
Source:
public void put(String key, String value) { Assert.notNull(key, "'key' must not be null."); Assert.notNull(value, "'value' must not be null."); Map<String,String> fileInfo = new HashMap(); fileInfo.put(ID_FIELD, key); fileInfo.put(VALUE, value); template.save(fileInfo, collectionName); }

Target:
public void put(String key, String value) { Assert.notNull(key, "'key' must not be null."); Assert.notNull(value, "'value' must not be null."); final Map<String, String> entry = new HashMap<String, String>(); entry.put(ID_FIELD, key); entry.put(VALUE, value); template.execute(collectionName, (CollectionCallback<Object>) collection -> collection .save(new BasicDBObject(entry))); }
Source:
public Duration getElapsedAttemptTime() { return Optional.ofNullable(attemptStartTime).map(x -> new Duration(System.nanoTime() - x.toNanos(), TimeUnit.NANOSECONDS)).orElse(null); }

Target:
public Duration getElapsedAttemptTime() { if (attemptStartTime == null) { return null; } return new Duration(System.nanoTime() - attemptStartTime.toNanos(), TimeUnit.NANOSECONDS); }
Source:
public void testDecodeManagedBlob() throws Exception { String emptyKeyJson = "{\"providerId\":\"testBlobProvider\"}"; ObjectMapper om = new ObjectMapper(); Blob blob = ComplexTypeJSONDecoder.getBlobFromJSON((ObjectNode) om.readTree(emptyKeyJson)); assertNull(blob); String unknownProviderJson = "{\"providerId\":\"fakeBlobProvider\", \"key\":\"testKey\"}"; blob = ComplexTypeJSONDecoder.getBlobFromJSON((ObjectNode) om.readTree(unknownProviderJson)); assertNull(blob); String json = "{\"providerId\":\"testBlobProvider\", \"key\":\"testKey\"}"; blob = ComplexTypeJSONDecoder.getBlobFromJSON((ObjectNode) om.readTree(json)); assertTrue(blob instanceof ManagedBlob); ManagedBlob managedBlob = (ManagedBlob) blob; assertEquals("testBlobProvider", managedBlob.getProviderId()); assertEquals("testBlobProvider:testKey", managedBlob.getKey()); }

Target:
public void testDecodeManagedBlob() throws Exception { String json = "{\"providerId\":\"testBlobProvider\", \"key\":\"testKey\"}"; Blob blob = ComplexTypeJSONDecoder.getBlobFromJSON((ObjectNode) OBJECT_MAPPER.readTree(json)); assertTrue(blob instanceof ManagedBlob); ManagedBlob managedBlob = (ManagedBlob) blob; assertEquals("testBlobProvider", managedBlob.getProviderId()); assertEquals("testBlobProvider:testKey", managedBlob.getKey()); }
Source:
public SameSiteCookieHandler(final HttpHandler next, final String mode) { this(next, mode, null, false); }

Target:
public SameSiteCookieHandler(final HttpHandler next, final String mode) { this(next, mode, null, true, true, true); }
Source:
void renameTo(final String src, final String dst, boolean logRetryCache, Options.Rename... options) throws IOException { final String operationName = "rename (options="+ Arrays.toString(options) + ")"; FSDirRenameOp.RenameResult res = null; checkOperation(OperationCategory.WRITE); final FSPermissionChecker pc = getPermissionChecker(); FSPermissionChecker.setOperationType(operationName); try { writeLock(); try { checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode("Cannot rename " + src); res = FSDirRenameOp.renameToInt(dir, pc, src, dst, logRetryCache, options); } finally { FileStatus status = res != null ? res.auditStat : null; writeUnlock(operationName, getLockReportInfoSupplier(src, dst, status)); } } catch (AccessControlException e) { logAuditEvent(false, operationName, src, dst, null); throw e; } getEditLog().logSync(); BlocksMapUpdateInfo collectedBlocks = res.collectedBlocks; if (!collectedBlocks.getToDeleteList().isEmpty()) { removeBlocks(collectedBlocks); collectedBlocks.clear(); } logAuditEvent(true, operationName, src, dst, res.auditStat); }

Target:
void renameTo(final String src, final String dst, boolean logRetryCache, Options.Rename... options) throws IOException { final String operationName = "rename"; FSDirRenameOp.RenameResult res = null; checkOperation(OperationCategory.WRITE); final FSPermissionChecker pc = getPermissionChecker(); FSPermissionChecker.setOperationType(operationName); try { writeLock(); try { checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode("Cannot rename " + src); res = FSDirRenameOp.renameToInt(dir, pc, src, dst, logRetryCache, options); } finally { FileStatus status = res != null ? res.auditStat : null; writeUnlock(operationName, getLockReportInfoSupplier(src, dst, status)); } } catch (AccessControlException e) { logAuditEvent(false, operationName + " (options=" + Arrays.toString(options) + ")", src, dst, null); throw e; } getEditLog().logSync(); BlocksMapUpdateInfo collectedBlocks = res.collectedBlocks; if (!collectedBlocks.getToDeleteList().isEmpty()) { removeBlocks(collectedBlocks); collectedBlocks.clear(); } logAuditEvent(true, operationName + " (options=" + Arrays.toString(options) + ")", src, dst, res.auditStat); }
Source:
public WatchPageObject unfollowVideo(String wikiURL, String videoName) { getUrl( wikiURL + URLsContent.wikiDir + URLsContent.fileNS + videoName+ "?action=unwatch" ); return new WatchPageObject(driver); }

Target:
public WatchPageObject unfollowVideo(String wikiURL, String videoName) { getUrl( wikiURL + URLsContent.wikiDir + URLsContent.fileNameSpace + videoName + "?action=unwatch" ); return new WatchPageObject(driver); }
Source:
public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { logger.entering("ReleaseWebhookAction", "Perform"); JSONObject json = new JSONObject(); final String payload = JenkinsEventNotifier.getApiJson(build.getUrl()); if (payload != null) { json = JSONObject.fromObject(payload); } json.put("name", build.getProject().getName()); json.put("id", build.getNumber()); json.put("startedBy", getStartedBy(build)); HashMap<String, ReleaseWebHook> nameToWebHookMap = new HashMap<String, ReleaseWebHook>(); for (ReleaseWebHook webHook : ReleaseWebHookHelper.getReleaseWebHookConfigurations()) { nameToWebHookMap.put(webHook.getWebHookName(), webHook); } List<ReleaseWebHookStatus> webHookStatus = new ArrayList<ReleaseWebHookStatus>(); ReleaseWebHook webHook = null; for (ReleaseWebHookName webHookName : webHookNames) { if (nameToWebHookMap.containsKey(webHookName.getWebHookName())) { try { webHook = nameToWebHookMap.get(webHookName.getWebHookName()); logger.fine(String.format("Sending payload event to %s", webHook.getPayloadUrl())); ReleaseWebHookStatus status = sendJobCompletedEvent(json, webHook); webHookStatus.add(status); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); webHookStatus.add(new ReleaseWebHookStatus(webHook.getPayloadUrl(), HttpURLConnection.HTTP_NOT_FOUND, ex.toString())); } } } build.addAction(new ReleaseWebHookSummaryAction((webHookStatus))); return true; }

Target:
public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { logger.entering("ReleaseWebhookAction", "Perform"); JSONObject json = new JSONObject(); final String payload = JenkinsEventNotifier.getApiJson(build.getUrl()); if (payload != null) { json = JSONObject.fromObject(payload); } json.put("name", build.getProject().getName()); json.put("id", build.getNumber()); json.put("startedBy", getStartedBy(build)); HashMap<String, ReleaseWebHook> nameToWebHookMap = new HashMap<String, ReleaseWebHook>(); for (ReleaseWebHook webHook : ReleaseWebHookHelper.getReleaseWebHookConfigurations()) { nameToWebHookMap.put(webHook.getWebHookName(), webHook); } List<ReleaseWebHookStatus> webHookStatus = new ArrayList<ReleaseWebHookStatus>(); ReleaseWebHook webHook = null; for (ReleaseWebHookReference webHookName : webHookReferences) { if (nameToWebHookMap.containsKey(webHookName.getWebHookName())) { try { webHook = nameToWebHookMap.get(webHookName.getWebHookName()); logger.fine(String.format("Sending payload event to %s", webHook.getPayloadUrl())); ReleaseWebHookStatus status = sendJobCompletedEvent(json, webHook); webHookStatus.add(status); } catch (Exception ex) { logger.log(Level.SEVERE, StringUtils.EMPTY, ex); webHookStatus.add(new ReleaseWebHookStatus(webHook.getPayloadUrl(), HttpURLConnection.HTTP_INTERNAL_ERROR, ex.toString())); } } } build.addAction(new ReleaseWebHookSummaryAction((webHookStatus))); return true; }
Source:
public void updateSessionAttributes(String id, SessionData updatedSessionData) { synchronized (sessionDataMap) { SessionData sessionData = sessionDataMap.get(id); if (sessionData != null && !sessionData.getAllAttributes().equals(sessionData)) { LOGGER.trace( "Storing new attributes for session at context {}", id, _context.getCanonicalContextPath()); sessionData.clearAllAttributes(); sessionData.putAllAttributes(updatedSessionData.getAllAttributes()); sessionData.setExpiry(updatedSessionData.getExpiry()); } } }

Target:
public void updateSessionAttributes(String id, SessionData updatedSessionData) { synchronized (sessionDataMap) { SessionData sessionData = sessionDataMap.get(id); if (sessionData == null) { return; } if (!sessionData.getAllAttributes().equals(updatedSessionData.getAllAttributes())) { LOGGER.trace( "Storing new attributes for session at context {}", id, _context.getCanonicalContextPath()); sessionData.clearAllAttributes(); sessionData.putAllAttributes(updatedSessionData.getAllAttributes()); } LOGGER.trace( "Updating expiry for session at context to {}", id, _context.getCanonicalContextPath(), updatedSessionData.getExpiry()); sessionData.setExpiry(updatedSessionData.getExpiry()); } }
Source:
static void sleep(long ms) throws IOException { if (ms < 0) { return; } try { Thread.sleep(ms); } catch (InterruptedException e) { throw new IOException(e); } }

Target:
static void sleep(long ms) throws IOException { if (ms < 0) { return; } try { Thread.sleep(ms); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } }
Source:
private void createNewDiskId() { Guid diskId = !getParameters().isUsePassedDiskId() ? Guid.newGuid() : getParameters().getDiskInfo().getId(); getParameters().getDiskInfo().setId(diskId); if (!isFloatingDisk()) { getDiskVmElement().getId().setDeviceId(diskId); } }

Target:
private void createNewDiskId() { Guid diskId = getParameters().isUsePassedDiskId() ? getParameters().getDiskInfo().getId() : Guid.newGuid(); getParameters().getDiskInfo().setId(diskId); if (!isFloatingDisk()) { getDiskVmElement().getId().setDeviceId(diskId); } }
Source:
public int hashCode() { if (hashCode == 0) { hashCode = Objects.hash(values, constraints, peekValue(), lastAssociatedSymbol); } return hashCode; }

Target:
public int hashCode() { if (hashCode == 0) { hashCode = Objects.hash(values, constraints, peekValue()); } return hashCode; }
Source:
public synchronized void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { final Map<String, HostConfig> hostConfigs = new HashMap<String, HostConfig>(); for (String key : list(config.keys())) { String value = (String) config.get(key); Matcher m = CONFIG_PATTERN.matcher(key); if (!m.matches()) { continue; } String qualifier = checkQualifier(m.group(2)); String configKey = m.group(3); HostConfig hostConfig = hostConfigs.get(qualifier); if (hostConfig == null) { hostConfig = new HostConfig(); hostConfigs.put(qualifier, hostConfig); } if (configKey.equals("host")) { hostConfig.setHost(value); } else if (configKey.equals("username")) { hostConfig.setUsername(value); } else { hostConfig.setPassword(value); } } setProperlyConfigured(false); removeAllClients(); new Thread(new Runnable() { @Override public void run() { for (Entry<String, HostConfig> entry : hostConfigs.entrySet()) { final String qualifier = entry.getKey(); HostConfig hostConfig = entry.getValue(); if (!hostConfig.isValid()) { continue; } try { HarmonyClient harmonyClient = HarmonyClient.getInstance(); logger.debug("Connecting to with user {}", qualifier, hostConfig.getHost(), hostConfig.getUsername() ); harmonyClient.connect(hostConfig.getHost(), hostConfig.getUsername(), hostConfig.getPassword()); hubs.put(qualifier, new HarmonyHubInstance(harmonyClient)); logger.debug("Devices for qualifier {}\n{}",qualifier,harmonyClient.getDeviceLabels().toString()); logger.debug("Activity for qualifier {}\n{}",qualifier,harmonyClient.getConfig().getActivities()); logger.debug("Config for qualifier {}\n{}", qualifier,harmonyClient.getConfig().toJson()); } catch (Exception e) { logger.error(format( "Failed creating harmony hub connection to %s", hostConfig.getHost()), e); } } setProperlyConfigured(true); } }).start(); } }

Target:
public synchronized void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { final Map<String, HostConfig> hostConfigs = new HashMap<String, HostConfig>(); for (String key : list(config.keys())) { String value = (String) config.get(key); Matcher m = CONFIG_PATTERN.matcher(key); if (!m.matches()) { continue; } String qualifier = checkQualifier(m.group(2)); String configKey = m.group(3); HostConfig hostConfig = hostConfigs.get(qualifier); if (hostConfig == null) { hostConfig = new HostConfig(); hostConfigs.put(qualifier, hostConfig); } if (configKey.equals("host")) { hostConfig.setHost(value); } else if (configKey.equals("username")) { hostConfig.setUsername(value); } else { hostConfig.setPassword(value); } } setProperlyConfigured(false); removeAllClients(); new Thread(new Runnable() { @Override public void run() { for (Entry<String, HostConfig> entry : hostConfigs.entrySet()) { final String qualifier = entry.getKey(); HostConfig hostConfig = entry.getValue(); if (!hostConfig.isValid()) { continue; } connectClient(qualifier, hostConfig); } setProperlyConfigured(true); } }).start(); } }
Source:
private void removeDetachedServers(List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { log.debugFormat("Existing servers list returned {0} comparing with fetched servers {1)", existingServers, fetchedServers); boolean serverRemoved = false; for (VDS server : existingServers) { if (isRemovableStatus(server.getStatus()) && serverDetached(server, fetchedServers)) { log.infoFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getName()); logUtil.logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); try { removeServerFromDb(server); try (EngineLock lock = getGlusterUtil().acquireGlusterLockWait(server.getVdsGroupId())) { runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); } serverRemoved = true; } catch (Exception e) { log.errorFormat("Error while removing server {0} from database!", server.getName(), e); } } } if (serverRemoved) { log.infoFormat("Servers detached using gluster CLI is removed from engine after inspecting the Gluster servers list returned {0} " + "- comparing with db servers {1}", fetchedServers, existingServers); } }

Target:
private void removeDetachedServers(List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { log.debugFormat("Existing servers list returned {0} comparing with fetched servers {1)", existingServers, fetchedServers); boolean serverRemoved = false; for (VDS server : existingServers) { if (isRemovableStatus(server.getStatus()) && serverDetached(server, fetchedServers)) { log.infoFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getName()); logUtil.logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); try (EngineLock lock = getGlusterUtil().acquireGlusterLockWait(server.getId())) { removeServerFromDb(server); runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); serverRemoved = true; } catch (Exception e) { log.errorFormat("Error while removing server {0} from database!", server.getName(), e); } } } if (serverRemoved) { log.infoFormat("Servers detached using gluster CLI is removed from engine after inspecting the Gluster servers list returned {0} " + "- comparing with db servers {1}", fetchedServers, existingServers); } }
Source:
void requestReturnsDbAndSolrStatus() throws Exception { mockMvc.perform(get("/json/health")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.Solr", is(oneOf("UP", "DOWN")))) .andExpect(jsonPath("$.DB", is(oneOf("UP", "DOWN")))); }

Target:
void requestReturnsDbAndSolrStatus() throws Exception { mockMvc.perform(get("/json/dbsolr/status")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.Solr", is(oneOf("UP", "DOWN")))) .andExpect(jsonPath("$.DB", is(oneOf("UP", "DOWN")))); }
Source:
private static Set<UnitType> getTargets(final GameData data) { Set<UnitType> types = null; for (final UnitSupportAttachment rule : get(data)) { if (rule.getBonusType().getSecond().equals(Constants.OLD_ART_RULE_NAME)) { types = rule.getUnitType(); if (rule.getName().startsWith(Constants.SUPPORT_RULE_NAME_OLD_TEMP_FIRST)) { final UnitType attachedTo = (UnitType) rule.getAttachedTo(); attachedTo.removeAttachment(rule.getName()); rule.setAttachedTo(null); } } } return types; }

Target:
private static Set<UnitType> getTargets(final GameData data) { Set<UnitType> types = null; for (final UnitSupportAttachment rule : get(data)) { if (rule.getBonusType().isOldArtilleryRule()) { types = rule.getUnitType(); if (rule.getName().startsWith(Constants.SUPPORT_RULE_NAME_OLD_TEMP_FIRST)) { final UnitType attachedTo = (UnitType) rule.getAttachedTo(); attachedTo.removeAttachment(rule.getName()); rule.setAttachedTo(null); } } } return types; }
Source:
public HealthCheckResult getOrRunHealthCheck(String name) { int refreshSeconds = Integer.parseInt(Framework.getProperty(DEFAULT_HEALTH_CHECK_INTERVAL_SECONDS_PROPERTY, DEFAULT_HEALTH_CHECK_INTERVAL_SECONDS)); if (!probesForHealthCheck.containsKey(name)) { log.warn("Probe:" + name + " does not exist, or not registed for the healthCheck"); return new HealthCheckResult(Collections.emptyList()); } ProbeInfo probe = probesForHealthCheck.get(name); getStatusOrRunProbe(probe, refreshSeconds); return new HealthCheckResult(Collections.singletonList(probe)); }

Target:
public HealthCheckResult getOrRunHealthCheck(String name) throws IllegalArgumentException { if (!probesForHealthCheck.containsKey(name)) { throw new IllegalArgumentException("Probe:" + name + " does not exist, or not registed for the healthCheck"); } ProbeInfo probe = probesForHealthCheck.get(name); getStatusOrRunProbe(probe, getDefaultCheckInterval()); return new HealthCheckResult(Collections.singletonList(probe)); }
Source:
public void cancel() { Map.Entry<Address, IntSet> target = currentTarget.getAndSet(null); if (target != null && alreadyCreated) { Address targetNode = target.getKey(); CompletionStage<Response> rpc = ClusterStreamManagerImpl.this.rpc.invokeCommand(targetNode, factory.buildStreamIteratorCloseCommand(id), SingleResponseCollector.INSTANCE, rpcOptions); if (trace) { rpc.exceptionally(t -> { log.tracef(t, "Unable to close iterator on %s for requestId %s", targetNode, requestId); return null; }); } } iteratorsRunning.remove(s); }

Target:
public void cancel() { Map.Entry<Address, IntSet> target = currentTarget.getAndSet(null); if (target != null && alreadyCreated) { Address targetNode = target.getKey(); CompletionStage<ValidResponse> rpcStage = rpc.invokeCommand(targetNode, factory.buildStreamIteratorCloseCommand(id), SingleResponseCollector.validOnly(), rpcOptions); if (trace) { rpcStage.exceptionally(t -> { log.tracef(t, "Unable to close iterator on %s for requestId %s", targetNode, requestId); return null; }); } } iteratorsRunning.remove(s); }
Source:
public void startTracingSpan() { Context traceContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>"); Context updatedContext = tracer.start("azure.keyvault.secrets/setsecret", traceContext); System.out.printf("Span returned in the context object: %s%n", updatedContext.getData(OPENCENSUS_SPAN_KEY).get().getClass()); END: com.azure.core.util.tracing.start#string-context END Context sendContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>") .addData(ENTITY_PATH, "entity-path").addData(HOST_NAME, "hostname"); END Context updatedSendContext = tracer.start("azure.eventhubs.send", sendContext, ProcessKind.SEND); System.out.printf("Span returned in the context object: %s%n", updatedSendContext.getData(OPENCENSUS_SPAN_KEY).get()); END: com.azure.core.util.tracing.start#string-context-processKind-SEND Context updatedReceiveContext = tracer.start("azure.eventhubs.receive", traceContext, ProcessKind.RECEIVE); System.out.printf("Diagnostic Id: %s%n", (String) updatedReceiveContext.getData(DIAGNOSTIC_ID_KEY).get()); END: com.azure.core.util.tracing.start#string-context-processKind-RECEIVE Context processContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>") .addData(SPAN_CONTEXT, "<user-current-span-context>"); Context updatedProcessContext = tracer.start("azure.eventhubs.process", processContext, ProcessKind.PROCESS); System.out.printf("Scope: %s%n", updatedProcessContext.getData("scope").get().getClass()); END: com.azure.core.util.tracing.start#string-context-processKind-PROCESS }

Target:
public void startTracingSpan() { Context traceContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>"); Context updatedContext = tracer.start("azure.keyvault.secrets/setsecret", traceContext); System.out.printf("Span returned in the context object: %s%n", updatedContext.getData(OPENCENSUS_SPAN_KEY).get()); END: com.azure.core.util.tracing.start#string-context END Context sendContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>") .addData(ENTITY_PATH, "entity-path").addData(HOST_NAME, "hostname"); END Context updatedSendContext = tracer.start("azure.eventhubs.send", sendContext, ProcessKind.SEND); System.out.printf("Span returned in the context object: %s%n", updatedSendContext.getData(OPENCENSUS_SPAN_KEY).get()); END: com.azure.core.util.tracing.start#string-context-processKind-SEND Context updatedReceiveContext = tracer.start("azure.eventhubs.receive", traceContext, ProcessKind.RECEIVE); System.out.printf("Diagnostic Id: %s%n", updatedReceiveContext.getData(DIAGNOSTIC_ID_KEY).get().toString()); END: com.azure.core.util.tracing.start#string-context-processKind-RECEIVE Context processContext = new Context(OPENCENSUS_SPAN_KEY, "<user-current-span>") .addData(SPAN_CONTEXT, "<user-current-span-context>"); Context updatedProcessContext = tracer.start("azure.eventhubs.process", processContext, ProcessKind.PROCESS); System.out.printf("Scope: %s%n", updatedProcessContext.getData("scope").get()); END: com.azure.core.util.tracing.start#string-context-processKind-PROCESS }
Source:
public GoConfigHolder execute(FullConfigUpdateCommand updatingCommand, List<PartialConfig> partials, String currentUser) throws Exception { LOGGER.debug("[Config Save] Starting Config Save using FullConfigSaveNormalFlow"); CruiseConfig configForEdit = configForEditWithPartials(updatingCommand, partials); CruiseConfig preProcessedConfig = preprocessAndValidate(configForEdit); String configForEditXmlString = toXmlString(configForEdit); postValidationUpdates(preProcessedConfig, configForEdit, configForEditXmlString, partials); checkinToConfigRepo(currentUser, configForEdit, configForEditXmlString); writeToConfigXml(configForEditXmlString); GoConfigHolder goConfigHolder = new GoConfigHolder(preProcessedConfig, configForEdit); setMergedConfigForEditOn(goConfigHolder, partials); LOGGER.debug("[Config Save] Done Config Save using FullConfigSaveNormalFlow"); return goConfigHolder; }

Target:
public GoConfigHolder execute(FullConfigUpdateCommand updatingCommand, List<PartialConfig> partials, String currentUser) throws Exception { LOGGER.debug("[Config Save] Starting Config Save using FullConfigSaveNormalFlow"); CruiseConfig configForEdit = configForEditWithPartials(updatingCommand, partials); String configForEditXmlString = toXmlString(configForEdit); postValidationUpdates(configForEdit, configForEditXmlString); CruiseConfig preProcessedConfig = preprocessAndValidate(configForEdit); checkinToConfigRepo(currentUser, configForEdit, configForEditXmlString); writeToConfigXml(configForEditXmlString); GoConfigHolder goConfigHolder = new GoConfigHolder(preProcessedConfig, configForEdit); setMergedConfigForEditOn(goConfigHolder, partials); cachedGoPartials.markAsValid(partials); LOGGER.debug("[Config Save] Done Config Save using FullConfigSaveNormalFlow"); return goConfigHolder; }
Source:
public static void setUp() throws IOException, SolrServerException { solrContainer.start(); solrClient = new Http2SolrClient.Builder("http://localhost:" + solrContainer.getSolrPort() + "/solr").build(); solrClient.add(COLLECTION_NAME, Collections.singletonList( new SolrInputDocument(createMap( "id", createInputField("id", "1"), "title", createInputField("title", "old skool - trainers - shoes") )) )); solrClient.add(COLLECTION_NAME, Collections.singletonList( new SolrInputDocument(createMap( "id", createInputField("id", "2"), "title", createInputField("title", "print t-shirt") )) )); solrClient.commit(COLLECTION_NAME); }

Target:
public static void setUp() throws IOException, SolrServerException { solrContainer.start(); solrClient = new Http2SolrClient.Builder("http://" + solrContainer.getContainerIpAddress() + ":" + solrContainer.getSolrPort() + "/solr").build(); solrClient.add(COLLECTION_NAME, Collections.singletonList( new SolrInputDocument(createMap( "id", createInputField("id", "1"), "title", createInputField("title", "old skool - trainers - shoes") )) )); solrClient.add(COLLECTION_NAME, Collections.singletonList( new SolrInputDocument(createMap( "id", createInputField("id", "2"), "title", createInputField("title", "print t-shirt") )) )); solrClient.commit(COLLECTION_NAME); }
Source:
public <T> Model<T> get(Class<T> type) throws NotExportableException { if (type.getAnnotation(ExportedBean.class) == null) { throw new NotExportableException(type); } return get(type, null, null); }

Target:
public <T> Model<T> get(Class<T> type) throws NotExportableException { return get(type, null, null); }
Source:
public void destroyInternals() { clearIndexes(); clearMapStore(); clearStorage(false); storage.destroy(false); mutationObserver.onClear(); }

Target:
public void destroyInternals() { clearMapStore(); clearStorage(false); storage.destroy(false); mutationObserver.onDestroy(true); }
Source:
public static UUID idOf(org.midonet.midolman.layer3.Route route) { long msb = (((long)route.dstNetworkAddr) << 32) | route.srcNetworkAddr; long lsb = (((long)route.nextHopGateway) << 32) | ((route.dstNetworkLength & 0xFF) << 24) | ((route.srcNetworkLength & 0xFF) << 16) | route.weight; msb = msb ^ route.nextHopPort.getMostSignificantBits() ^ route.routerId.getMostSignificantBits(); lsb = lsb ^ route.nextHopPort.getLeastSignificantBits() ^ route.routerId.getLeastSignificantBits(); return new UUID(msb, lsb); }

Target:
public static UUID idOf(org.midonet.midolman.layer3.Route route) { long msb = (((long)route.dstNetworkAddr) << 32) | route.srcNetworkAddr; long lsb = (((long)route.nextHopGateway) << 32) | ((route.dstNetworkLength & 0xFF) << 24) | ((route.srcNetworkLength & 0xFF) << 16) ^ route.weight; msb = msb ^ route.nextHopPort.getMostSignificantBits() ^ route.routerId.getMostSignificantBits(); lsb = lsb ^ route.nextHopPort.getLeastSignificantBits() ^ route.routerId.getLeastSignificantBits(); return new UUID(msb, lsb); }
Source:
public static Package getUserModel(ExecutionEvent event) { ServiceUtilsForHandlers serviceUtils = ServiceUtilsForHandlers.getInstance(); try { URI uri = serviceUtils.getModelSet(event).getURIWithoutExtension().appendFileExtension(UML_EXT); Resource userResource = serviceUtils.getModelSet(event).getResource(uri, false); if (userResource != null && userResource.getContents().size() > 0) { EObject topEObj = userResource.getContents().get(0); if ((topEObj instanceof Package) && (!(topEObj instanceof Profile))) { return (Package) topEObj; } } } catch (ServiceException e) { Activator.log.error(e); } return null; }

Target:
public static Package getUserModel(ExecutionEvent event) { ServiceUtilsForHandlers serviceUtils = ServiceUtilsForHandlers.getInstance(); try { ModelSet modelSet = serviceUtils.getModelSet(event); URI uri = modelSet.getURIWithoutExtension().appendFileExtension(UML_EXT); Resource userResource = modelSet.getResource(uri, false); if (userResource != null && userResource.getContents().size() > 0) { EObject topEObj = userResource.getContents().get(0); if ((topEObj instanceof Package) && (!(topEObj instanceof Profile))) { return (Package) topEObj; } } } catch (ServiceException e) { Activator.log.error(e); } return null; }
Source:
public boolean add(@Nullable E val) { if (val == null) { throw new IllegalArgumentException(); } fLock.writeLock().lock(); try { fStore.add(val); Comparable<E> cmp = o -> { int ret = Long.compare(val.getStart(), o.getStart()); if (ret == 0) { return Long.compare(val.getEnd(), o.getEnd()); } return ret; }; for (int i = size() - 1; i > 0 && cmp.compareTo(fStore.get(i - 1)) < 0; i--) { Collections.swap(fStore, i, i - 1); } return true; } finally { fLock.writeLock().unlock(); } }

Target:
public boolean add(@Nullable E val) { if (val == null) { throw new IllegalArgumentException("Cannot add null value"); } fLock.writeLock().lock(); try { fStore.add(val); for (int i = size() - 1; i > 0 && COMPARATOR.compare(val, fStore.get(i - 1)) < 0; i--) { Collections.swap(fStore, i, i - 1); } return true; } finally { fLock.writeLock().unlock(); } }
Source:
public ParentViewHolder(View itemView, ParentItemClickListener parentItemClickListener) { super(itemView); itemView.setOnClickListener(this); this.mParentItemClickListener = parentItemClickListener; this.mRotationEnabled = false; this.mIsRotated = false; this.mIsExpanded = false; this.mRotation = DEFAULT_ROTATE_DURATION; }

Target:
public ParentViewHolder(View itemView, ParentItemClickListener parentItemClickListener) { super(itemView); itemView.setOnClickListener(this); mParentItemClickListener = parentItemClickListener; mRotationEnabled = false; mIsRotated = false; mIsExpanded = false; mRotation = DEFAULT_ROTATE_DURATION_MS; }
Source:
private void onCanceled(LockPlaceHolder canceled) { if (trace) { log.tracef("Release lock for %s. It was canceled.", canceled.owner); } LockPlaceHolder wantToRelease = lockOwners.get(canceled.owner); if (wantToRelease == null) { if (trace) { log.tracef("%s not found!", canceled.owner); } return; } LockPlaceHolder currentLocked = current; if (currentLocked == wantToRelease) { if (!casRelease(currentLocked)) { if (trace) { log.tracef("Releasing lock for %s. It is the current lock owner but another thread changed it.", canceled.owner); } } else { tryAcquire(); } } }

Target:
private void onCanceled(LockPlaceHolder canceled) { if (trace) { log.tracef("Release lock for %s. It was canceled.", canceled.owner); } LockPlaceHolder currentLocked = current; if (currentLocked == canceled) { tryAcquire(canceled); } }
Source:
public ProcessingEnvironment processingEnvironment() { return processingEnvironment(); }

Target:
public ProcessingEnvironment processingEnvironment() { return processingEnvironment; }
Source:
public void testSTGeometryFromBinary() { assertToFromBinary("POINT EMPTY"); assertToFromBinary("LINESTRING (1 1, 2 2)"); assertToFromBinary("POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))"); assertToFromBinary("POLYGON ((1 1, 1 4, 4 4, 4 1))", "POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))"); assertToFromBinary("MULTIPOLYGON (((1 1, 4 1, 4 4, 1 4, 1 1)), ((1 1, 4 1, 4 4, 1 4, 1 1)))"); }

Target:
public void testSTGeometryFromBinary() { assertFunction("ST_GeomFromBinary(null)", GEOMETRY, null); assertGeomFromBinary("POINT EMPTY"); assertGeomFromBinary("MULTIPOINT EMPTY"); assertGeomFromBinary("LINESTRING EMPTY"); assertGeomFromBinary("MULTILINESTRING EMPTY"); assertGeomFromBinary("POLYGON EMPTY"); assertGeomFromBinary("MULTIPOLYGON EMPTY"); assertGeomFromBinary("GEOMETRYCOLLECTION EMPTY"); assertGeomFromBinary("POINT (1 2)"); assertGeomFromBinary("MULTIPOINT ((1 2), (3 4))"); assertGeomFromBinary("LINESTRING (0 0, 1 2, 3 4)"); assertGeomFromBinary("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))"); assertGeomFromBinary("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"); assertGeomFromBinary("POLYGON ((0 0, 3 0, 3 3, 0 3, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))"); assertGeomFromBinary("MULTIPOLYGON (((1 1, 3 1, 3 3, 1 3, 1 1)), ((2 4, 6 4, 6 6, 2 6, 2 4)))"); assertGeomFromBinary("GEOMETRYCOLLECTION (POINT (1 2), LINESTRING (0 0, 1 2, 3 4), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)))"); assertGeomFromBinary("MULTIPOINT ((0 0), (0 1), (1 1), (0 1))"); assertGeomFromBinary("LINESTRING (0 0, 0 1, 0 1, 1 1, 1 0, 0 0)"); assertInvalidFunction("ST_GeomFromBinary(from_hex('deadbeef'))", "Invalid WKB"); }
Source:
public void close() { if (!closed) { closed = true; threadLocalGrouper.remove(); groupers.forEach(Grouper::close); } }

Target:
public void close() { if (!closed) { closed = true; threadToGrouperMap.clear(); groupers.forEach(Grouper::close); } }
Source:
public boolean isStorageQuotaExceeded(Guid quotaId) { if (quotaId == null) { return false; } Quota quota = getQuotaDAO().getById(quotaId); if (quota == null) { return false; } boolean quotaExceededStorage = (quota.getGlobalQuotaStorage() != null && quota.getGlobalQuotaStorage().getStorageSizeGB() != null && !quota.getGlobalQuotaStorage().getStorageSizeGB().equals(QuotaStorage.UNLIMITED) && quota.getGlobalQuotaStorage().getStorageSizeGB() < quota.getGlobalQuotaStorage().getStorageSizeGBUsage()); if (!quotaExceededStorage && quota.getQuotaStorages() != null) { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { quotaExceededStorage |= quotaStorage.getStorageSizeGB() < quotaStorage.getStorageSizeGBUsage(); } } return quotaExceededStorage; }

Target:
public boolean isStorageQuotaExceeded(Guid quotaId) { if (quotaId == null) { return false; } Quota quota = getQuotaDAO().getById(quotaId); if (quota == null) { return false; } if (quota.getGlobalQuotaStorage() != null && quota.getGlobalQuotaStorage().getStorageSizeGB() != null && !quota.getGlobalQuotaStorage().getStorageSizeGB().equals(QuotaStorage.UNLIMITED) && quota.getGlobalQuotaStorage().getStorageSizeGB() < quota.getGlobalQuotaStorage().getStorageSizeGBUsage()) { return true; } else if (quota.getQuotaStorages() != null) { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { if (quotaStorage.getStorageSizeGB() < quotaStorage.getStorageSizeGBUsage()) { return true; } } } return false; }
Source:
private void finishIfNoVisibleBlogs() { if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { ToastUtils.showToast(getBaseContext(), R.string.no_account, ToastUtils.Duration.LONG); startActivity(new Intent(this, SignInActivity.class)); finish(); } else { ToastUtils.showToast(getBaseContext(), R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } }

Target:
private void finishIfNoVisibleBlogs() { if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { ToastUtils.showToast(getBaseContext(), R.string.no_account, ToastUtils.Duration.LONG); startActivity(new Intent(this, SignInActivity.class)); finish(); } else { ToastUtils.showToast(getBaseContext(), R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } }
Source:
private void onQueueClicked() { queueVisible = true; hideSystemUIIfNeeded(); buildQueue(); updatePlaybackButtons(); getControlsRoot().setVisibility(View.INVISIBLE); animateView(queueLayout, SLIDE_AND_ALPHA, true, DEFAULT_CONTROLS_DURATION); itemsList.scrollToPosition(playQueue.getIndex()); }

Target:
private void onQueueClicked() { queueVisible = true; hideSystemUIIfNeeded(); buildQueue(); updatePlaybackButtons(); getControlsRoot().setVisibility(View.INVISIBLE); queueLayout.requestFocus(); animateView(queueLayout, SLIDE_AND_ALPHA, true, DEFAULT_CONTROLS_DURATION); itemsList.scrollToPosition(playQueue.getIndex()); }
Source:
void subscribe(final String topic) throws MqttException { if (started.compareAndSet(false, true)) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); } client.subscribe(topic); }

Target:
void subscribe(final String topic) throws MqttException { synchronized (subscribeLock) { if (!started) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); started = true; } client.subscribe(topic); } }
Source:
public Job dbLoaderJob() throws CdaLoaderException { List<Flow> ontologyFlows = new ArrayList<>(); List<Flow> parallelFlows = new ArrayList<>(); for (int i = 0; i < ontologyLoaderList.size(); i++) { OntologyLoader ontologyLoader = ontologyLoaderList.get(i); parallelFlows.add(new FlowBuilder<Flow>("ontology_" + i + "_parallelFlow").from(ontologyLoader).end()); } FlowBuilder<Flow> parallelFlowBuilder = new FlowBuilder<Flow>("ontologyLoaderParallelFlows").start(parallelFlows.get(0)); for (int i = 1; i < parallelFlows.size(); i++) { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(Executors.defaultThreadFactory()); parallelFlowBuilder.split(executor).add(parallelFlows.get(i)); } Flow ontologyFlow = parallelFlowBuilder.build(); Flow markersFlow = new FlowBuilder<Flow>("markersFlow").from(markerLoader).end(); Flow allelesFlow = new FlowBuilder<Flow>("allelesFlow").from(alleleLoader).end(); Flow strainsFlow = new FlowBuilder<Flow>("strainsFlow").from(strainLoader).end(); Flow bioModelsFlow = new FlowBuilder<Flow>("bioModelsFlow").from(bioModelLoader).end(); Flow phenotypedColoniesFlow = new FlowBuilder<Flow>("phenotypedColoniesFlow").from(phenotypedColonyLoader).end(); return jobBuilderFactory.get("dbLoaderJob") .incrementer(new RunIdIncrementer()) .start(ontologyFlow) .next(markersFlow) .next(allelesFlow) .next(strainsFlow) .next(bioModelsFlow) .next(phenotypedColoniesFlow) .end() .build(); }

Target:
public Job dbLoaderJob() throws CdaLoaderException { List<Flow> ontologyFlows = new ArrayList<>(); List<Flow> parallelFlows = new ArrayList<>(); for (int i = 0; i < ontologyLoaderList.size(); i++) { OntologyLoader ontologyLoader = ontologyLoaderList.get(i); parallelFlows.add(new FlowBuilder<Flow>("ontology_" + ontologyLoader.getName() + "_parallelFlow").from(ontologyLoader).end()); } FlowBuilder<Flow> parallelFlowBuilder = new FlowBuilder<Flow>("ontologyLoaderParallelFlows").start(parallelFlows.get(0)); for (int i = 1; i < parallelFlows.size(); i++) { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(Executors.defaultThreadFactory()); parallelFlowBuilder.split(executor).add(parallelFlows.get(i)); } Flow ontologyFlow = parallelFlowBuilder.build(); Flow markersFlow = new FlowBuilder<Flow>("markersFlow").from(markerLoader).end(); Flow allelesFlow = new FlowBuilder<Flow>("allelesFlow").from(alleleLoader).end(); Flow strainsFlow = new FlowBuilder<Flow>("strainsFlow").from(strainLoader).end(); Flow bioModelsFlow = new FlowBuilder<Flow>("bioModelsFlow").from(bioModelLoader).end(); Flow phenotypedColoniesFlow = new FlowBuilder<Flow>("phenotypedColoniesFlow").from(phenotypedColonyLoader).end(); return jobBuilderFactory.get("dbLoaderJob") .incrementer(new RunIdIncrementer()) .start(ontologyFlow) .next(markersFlow) .next(allelesFlow) .next(strainsFlow) .next(bioModelsFlow) .next(phenotypedColoniesFlow) .end() .build(); }
Source:
public Rule Reserved() { return FirstOf( Sequence( Find(), builder.setOperation( Operation.FIND ) ), Sequence( Count(), builder.setOperation( Operation.COUNT ) ) ); }

Target:
public Rule Reserved() { return FirstOf( Find(), Count() ); }
Source:
protected void assertActivatedKeyStore() throws IOException { if (ks != null) return; char[] passwd = securityManager.getMasterPassword(); try { ks = KeyStore.getInstance(KEYSTORETYPE); if (getResource().getType() == Type.UNDEFINED) { ks.load(null, passwd); addInitialKeys(); OutputStream fos = getResource().out(); ks.store(fos, passwd); fos.close(); } else { InputStream fis = getResource().in(); ks.load(fis, passwd); fis.close(); } } catch (Exception ex) { if (ex instanceof IOException) throw (IOException) ex; throw new IOException (ex); } finally { securityManager.disposePassword(passwd); } }

Target:
protected void assertActivatedKeyStore() throws IOException { if (ks != null) return; char[] passwd = securityManager.getMasterPassword(); try { ks = KeyStore.getInstance(KEYSTORETYPE); if (getResource().getType() == Type.UNDEFINED) { ks.load(null, passwd); addInitialKeys(); try (OutputStream fos = getResource().out()) { ks.store(fos, passwd); } } else { try (InputStream fis = getResource().in()) { ks.load(fis, passwd); } } } catch (Exception ex) { if (ex instanceof IOException) throw (IOException) ex; throw new IOException (ex); } finally { securityManager.disposePassword(passwd); } }
Source:
public UniformRandomProducer(double from, double to, long seed) { super(seed); A.ensure(to >= from, "from > to"); this.from = from; this.to = to; }

Target:
public UniformRandomProducer(double from, double to, long seed) { super(seed); A.ensure(to >= from, "from >= to"); this.from = from; this.to = to; }
Source:
public Set<Value> gather(PrimaryKey record, long timestamp) { read.lock(); try { boolean historical = timestamp == Time.NONE; Set<Value> values = Sets.newLinkedHashSet(); for (Value value : history.keySet()) { Set<PrimaryKey> records = historical ? get(value, timestamp) : get(value); if(records.contains(record)) { values.add(value); } } return values; } finally { read.unlock(); } }

Target:
public Set<Value> gather(PrimaryKey record, long timestamp) { Preconditions.checkState(!isPartial(), "Cannot gather from a partial Secondary Record."); read.lock(); try { Map<PrimaryKey, Set<Value>> slice = cube.slice(timestamp); if(slice == null) { Set<Value> values = Sets.newHashSet(); Set<Entry<Value, Set<PrimaryKey>>> entries = timestamp != Time.NONE ? LazyTransformSet.of(history.keySet(), key -> new AbstractMap.SimpleImmutableEntry<>( key, get(key, timestamp))) : present.entrySet(); for (Entry<Value, Set<PrimaryKey>> entry : entries) { Value value = entry.getKey(); Set<PrimaryKey> records = entry.getValue(); if(records.contains(record)) { values.add(value); } for (PrimaryKey $record : records) { if($record.equals(record)) { values.add(value); } cube.put($record, value, timestamp); } } return values; } else { return slice.getOrDefault(record, ImmutableSet.of()); } } finally { read.unlock(); } }
Source:
public String addEscapeCharacters(String s) { if (dbProduct != DatabaseProduct.DERBY) { return s.replaceAll("\\\\", "\\\\\\\\"); } return s; }

Target:
public String addEscapeCharacters(String s) { if (dbProduct == DatabaseProduct.MYSQL) { return s.replaceAll("\\\\", "\\\\\\\\"); } return s; }