auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void update() { Stock updatedStock = (Stock) priceSetterSubject.getUpdate(); if (market.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } }

Target:
public void update() { Stock updatedStock = (Stock) priceSetterSubject.getUpdate(); if (market.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); } else { List<Double> priceList = new ArrayList<Double>(); } priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); }
Source:
private void runEarlyStartup(Object executableExtension) { if (executableExtension instanceof IStartup) { String methodName = executableExtension.getClass().getName() + ".earlyStartup"; try { UIStats.start(UIStats.EARLY_STARTUP, methodName); ((IStartup) executableExtension).earlyStartup(); } finally { UIStats.end(UIStats.EARLY_STARTUP, executableExtension, methodName); } } else { String message = executableExtension == null ? "The startup extension from '" + extension.getNamespaceIdentifier() + "' does not provide a valid class attribute." : MessageFormat.format("Startup class {0} must implement org.eclipse.ui.IStartup", executableExtension.getClass().getName()); IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null); WorkbenchPlugin.log(status); } }

Target:
private void runEarlyStartup(Object executableExtension) { if (executableExtension instanceof IStartup) { String methodName = executableExtension.getClass().getName() + ".earlyStartup"; try { UIStats.start(UIStats.EARLY_STARTUP, methodName); ((IStartup) executableExtension).earlyStartup(); } finally { UIStats.end(UIStats.EARLY_STARTUP, executableExtension, methodName); } } else { String message = executableExtension == null ? "The org.eclipse.ui.IStartup extension from '" + extension.getNamespaceIdentifier() + "' does not provide a valid class attribute." : MessageFormat.format("Startup class {0} must implement org.eclipse.ui.IStartup", executableExtension.getClass().getName()); IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null); WorkbenchPlugin.log(status); } }
Source:
public void internalRun() throws Exception { if (help) { handler.logInfo("\nfull export: metadata-export -f filename"); handler.logInfo("partial export: metadata-export -i handle -f filename"); printHelp(); return; } DSpaceCSV dSpaceCSV = metadataDSpaceCsvExportService .handleExport(context, exportAllItems, exportAllMetadata, handle, handler); handler.writeFilestream(context, filename, dSpaceCSV.getInputStream(), "exportCSV"); context.restoreAuthSystemState(); context.complete(); }

Target:
public void internalRun() throws Exception { if (help) { handler.logInfo("\nfull export: metadata-export -f filename"); handler.logInfo("partial export: metadata-export -i handle -f filename"); printHelp(); return; } Context context = new Context(); context.turnOffAuthorisationSystem(); try { context.setCurrentUser(ePersonService.find(context, this.getEpersonIdentifier())); } catch (SQLException e) { handler.handleException(e); } DSpaceCSV dSpaceCSV = metadataDSpaceCsvExportService .handleExport(context, exportAllItems, exportAllMetadata, handle, handler); handler.writeFilestream(context, filename, dSpaceCSV.getInputStream(), EXPORT_CSV); context.restoreAuthSystemState(); context.complete(); }
Source:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { FirebaseConfig firebaseConfig = new FirebaseConfig.Builder( String.format("https://%s", remaining), (String) parameters.get("rootReference"), (String) parameters.get("serviceAccountFile")) .build(); firebaseConfig.init(); Endpoint endpoint = new FirebaseEndpoint(uri, this, firebaseConfig); setProperties(endpoint, parameters); return endpoint; }

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { FirebaseConfig firebaseConfig = new FirebaseConfig.Builder( String.format("https://%s", remaining), getAndRemoveParameter(parameters, "rootReference", String.class), getAndRemoveParameter(parameters, "serviceAccountFile", String.class)) .build(); firebaseConfig.init(); Endpoint endpoint = new FirebaseEndpoint(uri, this, firebaseConfig); setProperties(endpoint, parameters); return endpoint; }
Source:
public void listsDocs() throws IOException { final String label = "lists"; final String name = "lists-exists"; final Bucket bucket = this.mockBucket(label, name); final List<String> expected = Arrays.asList( name, String.format("sub%sfile", File.separator) ); final List<String> names = new AwsDocs(bucket, label).names(); Collections.sort(names); MatcherAssert.assertThat(names, Matchers.equalTo(expected)); }

Target:
public void listsDocs() throws IOException { final String label = "lists"; final String name = "lists-exists"; final Bucket bucket = this.mockBucket(label, name); final List<String> expected = Arrays.asList( name, Paths.get("sub", "file").toString() ); final List<String> names = new AwsDocs(bucket, label).names(); Collections.sort(names); MatcherAssert.assertThat(names, Matchers.equalTo(expected)); }
Source:
public static StarlarkInt add(StarlarkInt x, StarlarkInt y) { if (x instanceof Int32 && y instanceof Int32) { long xl = ((Int32) x).v; long yl = ((Int32) y).v; return StarlarkInt.of(xl + yl); } try { long xl = x.toLongFast(); long yl = y.toLongFast(); long r = xl + yl; boolean overflow = ((xl >= 0) != (r >= 0)) && ((yl >= 0) != (r >= 0)); if (!overflow) { return StarlarkInt.of(r); } } catch (OverflowException ignore) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.add(ybig); return StarlarkInt.of(zbig); }

Target:
public static StarlarkInt add(StarlarkInt x, StarlarkInt y) { if (x instanceof Int32 && y instanceof Int32) { long xl = ((Int32) x).v; long yl = ((Int32) y).v; return StarlarkInt.of(xl + yl); } try { long xl = x.toLongFast(); long yl = y.toLongFast(); long zl = xl + yl; boolean overflow = ((xl ^ zl) & (yl ^ zl)) < 0; if (!overflow) { return StarlarkInt.of(zl); } } catch (Overflow unused) { } BigInteger xbig = x.toBigInteger(); BigInteger ybig = y.toBigInteger(); BigInteger zbig = xbig.add(ybig); return StarlarkInt.of(zbig); }
Source:
public Iterable<String> getLinks() { return EnvUtil.splitAtCommasAndTrim(links); }

Target:
public List<String> getLinks() { return EnvUtil.splitAtCommasAndTrim(links); }
Source:
public void validateAndUpdateCertificate() throws CertificateManagerException { if (isHashTokenEmpty()) { if (service.validateTrustStorePassKey(trustStorePasskey)) { String hashToken = service.getHashToken(trustStorePasskey); saveHashToken(hashToken); RequestContext.getCurrentInstance().execute("PF('editPassKeyDlg').hide();"); updateSelectedCertificateTS(hashToken); trustStorePasskey = null; } else { HelperUtil.addMessageError(EDIT_PASS_ERROR_MSG, INVALID_PASS_ERR_MSG); } } else { updateSelectedCertificateTS(getHashTokenFromSession()); } }

Target:
public void validateAndUpdateCertificate() throws CertificateManagerException { if (isHashTokenEmpty()) { String hashToken = service.getHashToken(trustStorePasskey); if (updateSelectedCertificateTS(hashToken)) { saveHashToken(hashToken); RequestContext.getCurrentInstance().execute("PF('editPassKeyDlg').hide();"); } else { HelperUtil.addMessageError(EDIT_PASS_ERROR_MSG, BAD_MISMATCH_TOKEN); } } else { updateSelectedCertificateTS(getHashTokenFromSession()); } trustStorePasskey = null; }
Source:
public void pushNonExistentImage() throws Exception { exception.expect(DockerClientException.class); dockerRule.getClient().pushImageCmd(username + "/xxx") .exec(new PushImageResultCallback()) .awaitSuccess(); }

Target:
public void pushNonExistentImage() throws Exception { if (isNotSwarm(dockerRule.getClient()) && getVersion(dockerRule.getClient()) .isGreaterOrEqual(RemoteApiVersion.VERSION_1_24)) { exception.expect(DockerClientException.class); } else { exception.expect(NotFoundException.class); } dockerRule.getClient().pushImageCmd(username + "/xxx") .exec(new PushImageResultCallback()) .awaitCompletion(30, TimeUnit.SECONDS); }
Source:
public CosmosEntityInformation(Class<T> domainType) { super(domainType); this.id = getIdField(domainType); ReflectionUtils.makeAccessible(this.id); this.autoGenerateId = isIdFieldAnnotatedWithGeneratedValue(this.id); this.containerName = getContainerName(domainType); this.partitionKeyPath = getPartitionKeyPathValue(domainType); this.partitionKeyField = getPartitionKeyField(domainType); if (this.partitionKeyField != null) { ReflectionUtils.makeAccessible(this.partitionKeyField); } this.versionField = getVersionedField(domainType); if (this.versionField != null) { ReflectionUtils.makeAccessible(this.versionField); } this.requestUnit = getRequestUnit(domainType); this.timeToLive = getTimeToLive(domainType); this.indexingPolicy = getIndexingPolicy(domainType); this.autoCreateContainer = getIsAutoCreateContainer(domainType); }

Target:
public CosmosEntityInformation(Class<T> domainType) { super(domainType); this.id = getIdField(domainType); ReflectionUtils.makeAccessible(this.id); this.autoGenerateId = isIdFieldAnnotatedWithGeneratedValue(this.id); this.containerName = getContainerName(domainType); this.partitionKeyPath = getPartitionKeyPathAnnotationValue(domainType); this.partitionKeyField = getPartitionKeyField(domainType); if (this.partitionKeyField != null) { ReflectionUtils.makeAccessible(this.partitionKeyField); } this.versionField = getVersionedField(domainType); if (this.versionField != null) { ReflectionUtils.makeAccessible(this.versionField); } this.requestUnit = getRequestUnit(domainType); this.timeToLive = getTimeToLive(domainType); this.indexingPolicy = getIndexingPolicy(domainType); this.autoCreateContainer = getIsAutoCreateContainer(domainType); }
Source:
public StorageUsageRefresher.Listener getUsageRefresherListener() { return new StorageUsageRefresher.Listener() { @Override public void onNewContainerStorageUsage(Map<String, Map<String, Long>> containerStorageUsage) { initMap(containerStorageUsage, storageUsage, true); } }; }

Target:
StorageUsageRefresher.Listener getUsageRefresherListener() { return containerStorageUsage -> { initMap(containerStorageUsage, storageUsage, true); }; }
Source:
public Iterable<OpenSshCertificate> loadCertificates(SessionContext session) throws IOException, GeneralSecurityException { List<OpenSshCertificate> certificates = new ArrayList<>(); for (Path file : files) { List<String> lines = IoUtils.readAllLines(new FileInputStream(file.toFile())); for (String line : lines) { PublicKeyEntry publicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(line); PublicKey publicKey = publicKeyEntry.resolvePublicKey(session, null, null); certificates.add((OpenSshCertificate) publicKey); } } return certificates; }

Target:
public Iterable<OpenSshCertificate> loadCertificates(SessionContext session) throws IOException, GeneralSecurityException { List<OpenSshCertificate> certificates = new ArrayList<>(); for (Path file : files) { List<String> lines = Files.readAllLines(file, StandardCharsets.UTF_8); for (String line : lines) { line = GenericUtils.replaceWhitespaceAndTrim(line); if (line.isEmpty() || line.startsWith("#")) { continue; } PublicKeyEntry publicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(line); if (publicKeyEntry == null) { continue; } PublicKey publicKey = publicKeyEntry.resolvePublicKey(session, null, null); if (publicKey == null) { continue; } if (!(publicKey instanceof OpenSshCertificate)) { throw new InvalidKeyException("Got unexpected key type in " + file + ". Expected OpenSSHCertificate."); } certificates.add((OpenSshCertificate) publicKey); } } return certificates; }
Source:
public void test() { HazelcastInstance hz1 = Hazelcast.newHazelcastInstance(); final TcpIpConnectionManager connectionManager = (TcpIpConnectionManager) getNode(hz1).getConnectionManager(); HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(); hz2.shutdown(); assertTrueAllTheTime(new AssertTask() { @Override public void run() throws Exception { assertEquals(0, connectionManager.acceptedChannels.size()); } }, 5); }

Target:
public void test() { HazelcastInstance hz1 = Hazelcast.newHazelcastInstance(); final TcpIpConnectionManager connectionManager = (TcpIpConnectionManager) getNode(hz1).getConnectionManager(); HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(); hz2.shutdown(); assertTrueAllTheTime(new AssertTask() { @Override public void run() throws Exception { assertEquals(0, connectionManager.getAcceptedChannels().size()); } }, 5); }
Source:
private StringBuilder buildMainFileName(Artifact artifact) { StringBuilder mainName = new StringBuilder(); String versionString = "-" + getNormalizedVersion(artifact); String classifierString = StringUtils.EMPTY; if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) { classifierString = "-" + artifact.getClassifier(); } mainName.append(artifact.getArtifactId()).append(versionString); mainName.append(classifierString).append("."); return mainName; }

Target:
private StringBuilder buildMainFileName(Artifact artifact) { StringBuilder mainName = new StringBuilder(); String versionString = "-" + getNormalizedVersion(artifact); String classifierString = StringUtils.EMPTY; if (StringUtils.isNotBlank(artifact.getClassifier())) { classifierString = "-" + artifact.getClassifier(); } mainName.append(artifact.getArtifactId()).append(versionString); mainName.append(classifierString).append("."); return mainName; }
Source:
public void showSavingsAccountCreatedSuccessfully(Savings savings) { Toast.makeText(getActivity(), getResources().getString(R.string.savings_account_submitted), Toast.LENGTH_LONG).show(); }

Target:
public void showSavingsAccountCreatedSuccessfully(Savings savings) { Toast.makeText(getActivity(), getResources().getString(R.string.savings_account_submitted_for_approval), Toast.LENGTH_LONG).show(); }
Source:
protected File getFile(Class<?> type, String qualifier, String fileName, boolean createIfNotExist) throws IOException { final File path = new File(fileStorageDirectory + "/" + type.getSimpleName().toLowerCase() + "/" + qualifier + "/"); final File file = new File(path, fileName); log.info("Looking up " + file); if (path.exists()) { if (file.exists()) { if (file.canRead()) { log.info("OK"); return file; } else { throw new IOException("Access denied. Please check file permissions."); } } else { if (createIfNotExist && file.createNewFile()) { log.info("OK"); return file; } throw new IOException("No such file."); } } else { log.warn("MISO files directory doesn't seem to exist. Trying to create it..."); if (path.mkdirs()) { log.warn("MISO files directory created.. retrying file listing..."); return getFile(type, qualifier, fileName, createIfNotExist); } else { throw new IOException("Could not create MISO file directory (" + path + "). Please create this directory or allow the parent to be writable to MISO."); } } }

Target:
protected File getFile(Class<?> type, String qualifier, String fileName, boolean createIfNotExist) throws IOException { final File path = new File(fileStorageDirectory + "/" + type.getSimpleName().toLowerCase() + "/" + qualifier + "/"); final File file = new File(path, fileName); log.info("Looking up {}", file); if (path.exists()) { if (file.exists()) { if (file.canRead()) { log.info("OK"); return file; } else { throw new IOException("Access denied. Please check file permissions."); } } else { if (createIfNotExist && file.createNewFile()) { log.info("OK"); return file; } throw new IOException("No such file."); } } else { log.warn("MISO files directory doesn't seem to exist. Trying to create it..."); if (path.mkdirs()) { log.warn("MISO files directory created.. retrying file listing..."); return getFile(type, qualifier, fileName, createIfNotExist); } else { throw new IOException("Could not create MISO file directory (" + path + "). Please create this directory or allow the parent to be writable to MISO."); } } }
Source:
public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType != null) { typeBuilder.add(childType); parentType = childType; } } else { break; } } List<org.apache.parquet.schema.Type> paths = typeBuilder.build(); if (paths.isEmpty()) { return new MessageType(subfield.getRootName(), ImmutableList.of()); } else { org.apache.parquet.schema.Type type = paths.get(paths.size() - 1); for (int i = paths.size() - 2; i >= 0; --i) { GroupType groupType = paths.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } MessageType result = new MessageType(subfield.getRootName(), ImmutableList.of(type)); return result; } }

Target:
public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType != null) { typeBuilder.add(childType); parentType = childType; } } else { typeBuilder.add(parentType.asGroupType().getFields().get(0)); break; } } List<org.apache.parquet.schema.Type> subfieldTypes = typeBuilder.build(); if (subfieldTypes.isEmpty()) { return new MessageType(subfield.getRootName(), ImmutableList.of()); } org.apache.parquet.schema.Type type = subfieldTypes.get(subfieldTypes.size() - 1); for (int i = subfieldTypes.size() - 2; i >= 0; --i) { GroupType groupType = subfieldTypes.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } return new MessageType(subfield.getRootName(), ImmutableList.of(type)); }
Source:
private EnsembleProvider createEnsembleProvider() throws Exception { switch (conn.getType()) { case EXHIBITOR: throw new RuntimeException("Exhibitor support is removed on 2020-12-15; use zookeeper connection"); case ZOOKEEPER: final String addressesJoined = conn.getAddresses().stream() .map(AddressPort::asAddressPort) .collect(Collectors.joining(",")); return new ChrootedFixedEnsembleProvider(addressesJoined, conn.getPathPrepared()); default: throw new RuntimeException("Connection type " + conn.getType() + " is not supported"); } }

Target:
private EnsembleProvider createEnsembleProvider() throws Exception { switch (conn.getType()) { case ZOOKEEPER: final String addressesJoined = conn.getAddresses().stream() .map(AddressPort::asAddressPort) .collect(Collectors.joining(",")); return new ChrootedFixedEnsembleProvider(addressesJoined, conn.getPathPrepared()); default: throw new RuntimeException("Connection type " + conn.getType() + " is not supported"); } }
Source:
public SetViewportSizeOf(String fboName) { this.fboName = fboName; if (!fboName.equals(DEFAULT_FBO)) { fbo = frameBuffersManager.getFBO(fboName); } }

Target:
public SetViewportSizeOf(String fboName) { this.fboName = fboName; }
Source:
public boolean isForceTextMessageFormat() { if (!cryptoEnablePgpInline) { return false; } ComposeCryptoStatus cryptoStatus = getCurrentCryptoStatus(); return cryptoStatus.isEncryptionEnabled() || cryptoStatus.isSigningEnabled(); }

Target:
public boolean isForceTextMessageFormat() { if (cryptoEnablePgpInline) { ComposeCryptoStatus cryptoStatus = getCurrentCryptoStatus(); return cryptoStatus.isEncryptionEnabled() || cryptoStatus.isSigningEnabled(); } else { return false; } }
Source:
public CacheOperationsTest cacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return this; }

Target:
public AbstractTwoSitesTest cacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return this; }
Source:
public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, int segment, boolean localInvocation, boolean includeStores) { return Maybe.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Loading entry for key %s with segment %d", key, segment); } return Flowable.fromIterable(stores.entrySet()) .filter(entry -> !entry.getValue().characteristics.contains(Characteristic.WRITE_ONLY) && allowLoad(entry.getValue(), localInvocation, includeStores)) .concatMapMaybe(entry -> Maybe.fromCompletionStage( PersistenceManagerImpl.<K, V>storeForEntry(entry).load(segment, key)), 1) .firstElement(); }, this::releaseReadLock ).toCompletionStage(null); }

Target:
public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, int segment, boolean localInvocation, boolean includeStores) { return Maybe.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Loading entry for key %s with segment %d", key, segment); } return Flowable.fromIterable(stores) .filter(storeStatus -> allowLoad(storeStatus, localInvocation, includeStores)) .concatMapMaybe(storeStatus -> Maybe.fromCompletionStage( storeStatus.<K, V>store().load(segment, key)), 1) .firstElement(); }, this::releaseReadLock ).toCompletionStage(null); }
Source:
public void memo() throws IOException { final String memo = "<memo></memo>"; final AttributeValue value = Mockito.mock(AttributeValue.class); final Item item = Mockito.mock(Item.class); Mockito.when(value.getS()).thenReturn(memo); Mockito.when(item.get(DyRepo.ATTR_MEMO)).thenReturn(value); MatcherAssert.assertThat( new DyRepo(item).memo(), Matchers.instanceOf(DyMemo.class) ); }

Target:
public void memo() throws IOException { final Region region = new MkRegion( new H2Data().with( DyRepo.TBL, new String[] {DyRepo.ATTR_MEMO}, new String[] {DyRepo.ATTR_UPDATED} ) ); final Table table = region.table(DyRepo.TBL); table.put( new Attributes() .with(DyRepo.ATTR_MEMO, "<memo></memo>") .with(DyRepo.ATTR_UPDATED, System.currentTimeMillis()) ); MatcherAssert.assertThat( new DyRepo(table.frame().iterator().next()).memo(), Matchers.instanceOf(DyMemo.class) ); }
Source:
private void configureMemoryPools(NodeMemoryConfig config, long availableMemory) { validateHeapHeadroom(config, availableMemory); maxMemory = new DataSize(availableMemory - config.getHeapHeadroom().toBytes(), BYTE); checkArgument( config.getMaxQueryMemoryPerNode().toBytes() <= config.getMaxQueryTotalMemoryPerNode().toBytes(), "Max query memory per node (%s) cannot be greater than the max query total memory per node (%s).", QUERY_MAX_MEMORY_PER_NODE_CONFIG, QUERY_MAX_TOTAL_MEMORY_PER_NODE_CONFIG); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); long generalPoolSize = maxMemory.toBytes(); if (config.isLegacyReservedPoolEnabled()) { builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryTotalMemoryPerNode())); generalPoolSize -= config.getMaxQueryTotalMemoryPerNode().toBytes(); } verify(generalPoolSize > 0, "general memory pool size is 0"); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, new DataSize(generalPoolSize, BYTE))); this.pools = builder.build(); }

Target:
private void configureMemoryPools(NodeMemoryConfig config, long availableMemory) { validateHeapHeadroom(config, availableMemory); maxMemory = new DataSize(availableMemory - config.getHeapHeadroom().toBytes(), BYTE); checkArgument( config.getMaxQueryMemoryPerNode().toBytes() <= config.getMaxQueryTotalMemoryPerNode().toBytes(), "Max query memory per node (%s) cannot be greater than the max query total memory per node (%s).", QUERY_MAX_MEMORY_PER_NODE_CONFIG, QUERY_MAX_TOTAL_MEMORY_PER_NODE_CONFIG); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); long generalPoolSize = maxMemory.toBytes(); if (config.isReservedPoolEnabled()) { builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryTotalMemoryPerNode())); generalPoolSize -= config.getMaxQueryTotalMemoryPerNode().toBytes(); } verify(generalPoolSize > 0, "general memory pool size is 0"); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, new DataSize(generalPoolSize, BYTE))); this.pools = builder.build(); }
Source:
public synchronized void close() { clearCache(); if (instance != null) { instance.usageCount -= 1; if (instance.usageCount <= 0 && instance.isOpen()) { instance.usageCount = 0; instance.closeStatements(); try { instance.connection.close(); } catch (SQLException ex) { LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } catch (Throwable ex) { LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } instance.statementBundle = null; instance.preparedStatements.clear(); instance.databaseProperties = null; instance.connection = null; } } }

Target:
public synchronized void close() { if (instance != null) { instance.usageCount -= 1; if (instance.usageCount <= 0 && instance.isOpen()) { instance.usageCount = 0; clearCache(); instance.closeStatements(); try { instance.connection.close(); } catch (SQLException ex) { LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } catch (Throwable ex) { LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } instance.statementBundle = null; instance.preparedStatements.clear(); instance.databaseProperties = null; instance.connection = null; } } }
Source:
public void addQqxUselang() { String url = getCurrentUrl(); getUrl(url + ggx); }

Target:
public void addQqxUselang() { appendToUrl(URLsContent.translatableLanguage); }
Source:
protected CommandStatus executeTransfer(Connection connection, String source, String destination, int permissions, int transferType) { ChannelSftp channel = null; try { channel = (ChannelSftp) connection.getChannel(); if (transferType == 1) { channel.put(source, destination); } else if (transferType == 2) { channel.get(source, destination); } else if (transferType == 3) { transferRemoteToRemote(connection, source, destination); } else { logger.info("Unknown handle type..."); status = CommandStatus.FAILED; return status; } if (permissions != -999) channel.chmod(permissions, destination); } catch (JSchException | SftpException e) { logger.error("Failed to connect or obtain file to/from remote host. Returning failed."); status = CommandStatus.FAILED; return status; } status = CommandStatus.SUCCESS; return status; }

Target:
protected CommandStatus executeTransfer(Connection connection, String source, String destination, int permissions, int transferType) { ChannelSftp channel = null; try { channel = connection.getSftpChannel(); if (transferType == 1) { channel.put(source, destination); } else if (transferType == 2) { channel.get(source, destination); } else if (transferType == 3) { transferRemoteToRemote(connection, source, destination); } else { logger.info("Unknown handle type..."); status = CommandStatus.FAILED; return status; } if (permissions != -999) channel.chmod(permissions, destination); } catch (JSchException | SftpException e) { logger.error("Failed to connect or obtain file to/from remote host. Returning failed.", e); status = CommandStatus.FAILED; return status; } status = CommandStatus.SUCCESS; return status; }
Source:
public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); SaveablesList saveables = (SaveablesList) getSite().getService(ISaveablesLifecycleListener.class); if (saveables != null) { saveables.addModelLifecycleListener(saveablesTracker); } getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); ISaveablesLifecycleListener saveables = getSite().getService(ISaveablesLifecycleListener.class); if (saveables instanceof SaveablesList) { ((SaveablesList) saveables).addModelLifecycleListener(saveablesTracker); } getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }
Source:
public static TypeName fromString(String typeName) { TypeName result = ANY_TYPENAME; if (typeName != null) { if ("ecore.EJavaObject".equals(typeName) || "EJavaObject".equals(typeName)) { result = ANY_TYPENAME; } else if ("ecore.EObject".equals(typeName) || "EObject".equals(typeName)) { result = EOBJECT_TYPENAME; } else { result = new TypeName(typeName.trim()); } } return result; }

Target:
public static TypeName fromString(String typeName) { TypeName result = ANY_TYPENAME; if (!StringUtil.isEmpty(typeName)) { if ("ecore.EJavaObject".equals(typeName) || "EJavaObject".equals(typeName)) { result = ANY_TYPENAME; } else if ("ecore.EObject".equals(typeName) || "EObject".equals(typeName)) { result = EOBJECT_TYPENAME; } else { result = new TypeName(typeName.trim()); } } return result; }
Source:
AbstractAccessor(T element) { this.element = element; if (element.getEnclosingElement().getKind() == ElementKind.CLASS) { Element enclosingClass = element.getEnclosingElement(); boolean isBuilder = enclosingClass.getEnclosingElement().getKind() == ElementKind.CLASS && MappedByBuilderPrism.getInstanceOn( enclosingClass.getEnclosingElement() ) != null; this.builderType = isBuilder ? enclosingClass.asType() : null; } else { this.builderType = null; } }

Target:
AbstractAccessor(T element ) { this( element, false ); }
Source:
public String toString() { return "SocketInfo {Type:" + ipTypeToString(mIpFamily) + ", " + mTcpInfo + " mark:" + mMark + " updated at " + updateTime + "}"; }

Target:
public String toString() { return "SocketInfo {Type:" + ipTypeToString(iIpFamily) + ", " + iTcpInfo + ", mark:" + iMark + " updated at " + iUpdateTime + "}"; }
Source:
public void VideosModuleTest_001() { wikiURL = urlBuilder.getUrlForWiki(URLsContent.videoTestWiki); WikiBasePageObject base = new WikiBasePageObject(driver); VideosModuleComponentObject videosModule = new VideosModuleComponentObject(driver); base.openRandomArticle(wikiURL); videosModule.verifyVideosModuleShowing(); base.openFilePage(wikiURL, VideoContent.youtubeVideoURL2Filename); videosModule.verifyVideosModuleShowing(); }

Target:
public void VideosModuleTest_001() { wikiURL = urlBuilder.getUrlForWiki(URLsContent.videoTestWiki); WikiBasePageObject base = new WikiBasePageObject(driver); VideosModuleComponentObject videosModule = new VideosModuleComponentObject(driver); base.openRandomArticle(wikiURL); videosModule.verifyVideosModuleShowing(); base.openFilePage(wikiURL, VideoContent.youtubeVideoURL2FileName); videosModule.verifyVideosModuleShowing(); }
Source:
public void actionPerformed(final ActionEvent e) { final MapController mapController = Controller.getCurrentModeController().getMapController(); final ViewerController vc = Controller.getCurrentController().getModeController() .getExtension(ViewerController.class); final NodeModel selectedNode = mapController.getSelectedNode(); if (selectedNode == null) { return; } final Controller controller = Controller.getCurrentController(); final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final MapModel model = controller.getMap(); final ExternalResource extRes = (ExternalResource) vc.createExtension(selectedNode); if (extRes == null) { return; } else { final URI absoluteUri = extRes.getAbsoluteUri(selectedNode.getMap()); mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, absoluteUri.toString()); } }

Target:
public void actionPerformed(final ActionEvent e) { final Controller controller = Controller.getCurrentController(); final MapController mapController = Controller.getCurrentModeController().getMapController(); final ViewerController vc = controller.getModeController().getExtension(ViewerController.class); final NodeModel selectedNode = mapController.getSelectedNode(); if (selectedNode == null) { return; } final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final URI uri = vc.createURI(selectedNode); if (uri == null) { return; } final MapModel model = controller.getMap(); mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, uri.toString()); }
Source:
public void prepareMockGitHub() throws Exception { new File("src/test/resources/api/mappings").mkdirs(); new File("src/test/resources/api/__files").mkdirs(); new File("src/test/resources/raw/mappings").mkdirs(); new File("src/test/resources/raw/__files").mkdirs(); githubApi.enableRecordMappings(new SingleRootFileSource("src/test/resources/api/mappings"), new SingleRootFileSource("src/test/resources/api/__files")); githubRaw.enableRecordMappings(new SingleRootFileSource("src/test/resources/raw/mappings"), new SingleRootFileSource("src/test/resources/raw/__files")); githubApi.stubFor( get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom("<LINK_0>"))); githubRaw.stubFor(get(urlMatching(".*")).atPriority(10) .willReturn(aResponse().proxiedFrom("<LINK_1>"))); if (source.isConfiguredByUrl()) { source = new GitHubSCMSource("cloudbeers", "yolo", "http://localhost:" + githubApi.port() + "/cloudbeers/yolo", true); } else { source.setApiUri("http://localhost:" + githubApi.port()); } source.setTraits(Arrays.asList(new BranchDiscoveryTrait(true, true), new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE), new ForkPullRequestDiscoveryTrait.TrustContributors()))); github = Connector.connect("http://localhost:" + githubApi.port(), null); repo = github.getRepository("cloudbeers/yolo"); }

Target:
public void prepareMockGitHub() throws Exception { new File("src/test/resources/api/mappings").mkdirs(); new File("src/test/resources/api/__files").mkdirs(); new File("src/test/resources/raw/mappings").mkdirs(); new File("src/test/resources/raw/__files").mkdirs(); githubApi.enableRecordMappings(new SingleRootFileSource("src/test/resources/api/mappings"), new SingleRootFileSource("src/test/resources/api/__files")); githubRaw.enableRecordMappings(new SingleRootFileSource("src/test/resources/raw/mappings"), new SingleRootFileSource("src/test/resources/raw/__files")); githubApi.stubFor( get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom("<LINK_0>"))); githubRaw.stubFor(get(urlMatching(".*")).atPriority(10) .willReturn(aResponse().proxiedFrom("<LINK_1>"))); source.setApiUri("http://localhost:" + githubApi.port()); source.setTraits(Arrays.asList(new BranchDiscoveryTrait(true, true), new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE), new ForkPullRequestDiscoveryTrait.TrustContributors()))); github = Connector.connect("http://localhost:" + githubApi.port(), null); repo = github.getRepository("cloudbeers/yolo"); }
Source:
public boolean hasNext() { if (bufferedRecord != null) { return true; } try { readNextRecord(bufferedReader); } catch (IOException e) { LOG.error("Exception from BufferedReader:", e); return false; } return bufferedRecord != null; }

Target:
public boolean hasNext() { if (bufferedRecord != null) { return true; } try { readNextRecord(bufferedReader); } catch (IOException | RuntimeException e) { LOG.error("Exception from BufferedReader:", e); return false; } return bufferedRecord != null; }
Source:
private void evaluateConstantFilterFunction(FilterFunction filter, Block[] constantBlocks, QualifyingSet qualifyingSet) { int[] channels = filter.getInputChannels(); Block[] inputs = new Block[channels.length]; for (int i = 0; i < channels.length; i++) { inputs[i] = constantBlocks[channels[i]]; } int[] filterResults = new int[qualifyingSet.getPositionCount()]; PageSourceOptions.ErrorSet errors = qualifyingSet.getOrCreateErrorSet(); int numHits = filter.filter(new Page(qualifyingSet.getPositionCount(), inputs), filterResults, errors); qualifyingSet.compactPositionsAndErrors(filterResults, numHits); }

Target:
private static void evaluateConstantFilterFunction(FilterFunction filter, Block[] constantBlocks, QualifyingSet qualifyingSet) { int[] channels = filter.getInputChannels(); Block[] inputs = new Block[channels.length]; for (int i = 0; i < channels.length; i++) { inputs[i] = constantBlocks[channels[i]]; } int[] filterResults = new int[qualifyingSet.getPositionCount()]; PageSourceOptions.ErrorSet errors = qualifyingSet.getOrCreateErrorSet(); int numHits = filter.filter(new Page(qualifyingSet.getPositionCount(), inputs), filterResults, errors); qualifyingSet.compactPositionsAndErrors(filterResults, numHits); }
Source:
public synchronized void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != newInput) { if (newInput != null) { ImportTraceContentProvider input = (ImportTraceContentProvider) newInput; clearCandidates(); fTraceTypes.putAll(input.fTraceTypes); fTraceFiles.putAll(fTraceFiles); } } }

Target:
public synchronized void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != newInput && newInput != null) { ImportTraceContentProvider input = (ImportTraceContentProvider) newInput; clearCandidates(); fTraceTypes.putAll(input.fTraceTypes); fTraceFiles.putAll(fTraceFiles); } }
Source:
public Version() { major = minor = build = revision = -1; }

Target:
public Version() { major = minor = build = revision = VERSION_NOT_SET; }
Source:
public void fanoutBinding() { FanoutExchange fanoutExchange = new FanoutExchange("f"); Binding binding = BindingBuilder.bind(queue).to(fanoutExchange); assertEquals(fanoutExchange.getName(), binding.getExchange()); assertEquals("", binding.getRoutingKey()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertNotNull(binding); }

Target:
public void fanoutBinding() { FanoutExchange fanoutExchange = new FanoutExchange("f"); Binding binding = BindingBuilder.bind(queue).to(fanoutExchange); assertNotNull(binding); assertEquals(fanoutExchange.getName(), binding.getExchange()); assertEquals("", binding.getRoutingKey()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); }
Source:
public void apply(ExtensionLoadingContext extensionLoadingContext) { ExtensionDeclarer extensionDeclarer = extensionLoadingContext.getExtensionDeclarer(); this.typeCatalog = extensionLoadingContext.getDslResolvingContext().getTypeCatalog(); this.typeLoader = new DefaultExtensionsTypeLoaderFactory().createTypeLoader(extensionLoadingContext.getExtensionClassLoader()); ExtensionDeclaration declaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration(); this.namespace = getStereotypePrefix(extensionDeclarer); this.processorParent = newStereotype(PROCESSOR.getType(), namespace).withParent(PROCESSOR).build(); this.sourceParent = newStereotype(SOURCE.getType(), namespace).withParent(SOURCE).build(); IdempotentDeclarationWalker enricher = declaration.getModelProperty(ImplementingTypeModelProperty.class).isPresent() ? getJavaBasedStereotypeEnricher() : getDefaultStereotypeEnricher(); enricher.walk(declaration); resolveDeclaredTypesStereotypes(declaration, namespace); }

Target:
public void apply(ExtensionLoadingContext extensionLoadingContext) { ExtensionDeclarer extensionDeclarer = extensionLoadingContext.getExtensionDeclarer(); this.typeLoader = new DefaultExtensionsTypeLoaderFactory().createTypeLoader(extensionLoadingContext.getExtensionClassLoader()); ExtensionDeclaration declaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration(); this.namespace = getStereotypePrefix(extensionDeclarer); this.processorParent = newStereotype(PROCESSOR.getType(), namespace).withParent(PROCESSOR).build(); this.sourceParent = newStereotype(SOURCE.getType(), namespace).withParent(SOURCE).build(); IdempotentDeclarationWalker enricher = declaration.getModelProperty(ImplementingTypeModelProperty.class).isPresent() ? getJavaBasedStereotypeEnricher() : getDefaultStereotypeEnricher(); enricher.walk(declaration); resolveDeclaredTypesStereotypes(declaration, namespace); }
Source:
void testSubList(int subListDepth, int filterDepth, int sortDepth) { if (!(test instanceof ReplicaCollection.Builder<?>)) Assert.assertSame(test, test.subList(0, test.size())); if (test.isEmpty()) return; TestCase<C> skipFront = new TestCase<>(test.subList(1, test.size()), canonicalList.subList(1, canonicalList.size())); assertSubList(skipFront.test, 1, canonicalList.size()); skipFront.testAll(subListDepth - 1, filterDepth, sortDepth); TestCase<C> skipBack = new TestCase<>(test.subList(0, test.size() - 1), canonicalList.subList(0, canonicalList.size() - 1)); assertSubList(skipBack.test, 0, canonicalList.size() - 1); skipBack.testAll(subListDepth - 1, filterDepth, sortDepth); }

Target:
void testSubList(int subListDepth, int filterDepth, int sortDepth) { if (!isBuilder) Assert.assertSame(test, test.subList(0, test.size())); if (test.isEmpty()) return; Assert.assertSame(test.list.contents, test.subList(0, 1).list.contents); TestCase<C> skipFront = new TestCase<>(false, test.subList(1, test.size()), canonicalList.subList(1, canonicalList.size())); assertSubList(skipFront.test, 1, canonicalList.size()); skipFront.testAll(subListDepth - 1, filterDepth, sortDepth); TestCase<C> skipBack = new TestCase<>(false, test.subList(0, test.size() - 1), canonicalList.subList(0, canonicalList.size() - 1)); assertSubList(skipBack.test, 0, canonicalList.size() - 1); skipBack.testAll(subListDepth - 1, filterDepth, sortDepth); }
Source:
public void replaceNote(Note newNote) { int position = getPositionForNoteUnfiltered(newNote.getId()); mNotes.set(position, newNote); }

Target:
public void replaceNote(Note newNote) { if (newNote != null) { int position = getPositionForNoteUnfiltered(newNote.getId()); if (position != RecyclerView.NO_POSITION && position < mNotes.size()) { mNotes.set(position, newNote); } } }
Source:
public void testFilteredChanges() throws Exception { Repository repo = repoProvider.createGeogig("repo1", null); repoProvider.getTestRepository("repo1").initializeRpository(); new TestData(repo).init("testGeoGig", "geogig@geogig.org").loadDefaultData(); Optional<RevObject> masterRevObject = repo.command(RevObjectParse.class) .setRefSpec("master").call(); String commitId = masterRevObject.get().getId().toString(); JsonObject json = new JsonObject(); json.addProperty("commitId", commitId); MockHttpServletRequestBuilder post = MockMvcRequestBuilders.post("/repos/repo1/repo/filteredchanges").contentType( MediaType.APPLICATION_JSON).content(getBytes(json)); perform(post).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)); }

Target:
public void testFilteredChanges() throws Exception { Repository repo = repoProvider.createGeogig("repo1", null); repoProvider.getTestRepository("repo1").initializeRpository(); new TestData(repo).init("testGeoGig", "geogig@geogig.org").loadDefaultData(); Optional<RevObject> masterRevObject = repo.command(RevObjectParse.class) .setRefSpec("master").call(); String commitId = masterRevObject.get().getId().toString(); JsonObject json = new JsonObject(); json.addProperty("commitId", commitId); MockHttpServletRequestBuilder post = MockMvcRequestBuilders.post("/repos/repo1/repo/filteredchanges").contentType( MediaType.APPLICATION_JSON).content(getBytes(json)); byte[] content = perform(post).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)) .andReturn().getResponse().getContentAsByteArray(); FilteredChangesReader reader = new FilteredChangesReader(content, DataStreamSerializationFactoryV1.INSTANCE); while (reader.hasNext()) { DiffPacket diff = reader.next(); assertNotNull(diff.revObject); assertNotNull(diff.metadataObject); assertNotNull(diff.diffEntry); } assertFalse(reader.isFiltered()); repo.close(); }
Source:
private DruidExpression handleFunction( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { switch (function.getDisplayName().toLowerCase(ENGLISH)) { case "date_trunc": return handleDateTruncationViaDateTruncation(function, context); default: throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported function: " + function.getDisplayName() + " to pushdown for Druid connector "); } }

Target:
private DruidExpression handleFunction( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { if (function.getDisplayName().toLowerCase(ENGLISH).equals(DATE_TRUNC)) { return handleDateTruncationViaDateTruncation(function, context); } throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported function: " + function.getDisplayName() + " to pushdown for Druid connector."); }