auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleVdsLiveSnapshotFailure(VdcBLLException e) { <START> log.warnFormat("Could not live snapshot due to error: {0}. VM will still be configured to the new created snapshot", <END> ExceptionUtils.getMessage(e)); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); updateCallStackFromThrowable(e); AuditLogDirector.log(this, AuditLogType.USER_CREATE_LIVE_SNAPSHOT_FINISHED_FAILURE); }</code><technical_language>add "perform"</technical_language>

Target:
private void handleVdsLiveSnapshotFailure(VdcBLLException e) { log.warnFormat("Could not perform live snapshot due to error: {0}. VM will still be configured to the new created snapshot", ExceptionUtils.getMessage(e)); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); updateCallStackFromThrowable(e); AuditLogDirector.log(this, AuditLogType.USER_CREATE_LIVE_SNAPSHOT_FINISHED_FAILURE); }
Source:
<code>private void detectCycles( DMNModelImpl model ) { final Map<DecisionNodeImpl, Boolean> registry = new HashMap<>(); for ( DecisionNode decision : model.getDecisions() ) { <START> assert decision instanceof DecisionNodeImpl; <END> final DecisionNodeImpl decisionNode = (DecisionNodeImpl) decision; detectCycles( decisionNode, registry, model ); } }</code><technical_language>if want asserts in code. enabled default in JVM. I if a decision of DecisionNodeImpl type, code handle incorrect types. do think</technical_language>

Target:
private void detectCycles( DMNModelImpl model ) { final Map<DecisionNodeImpl, Boolean> registry = new HashMap<>(); for ( DecisionNode decision : model.getDecisions() ) { final DecisionNodeImpl decisionNode = (DecisionNodeImpl) decision; detectCycles( decisionNode, registry, model ); } }
Source:
<code>protected Map<String, String> getTemplateParameterList(ContractsGrantsInvoiceDocument document) { Map<String, String> templateParameters = super.getTemplateParameterList(document); Map<String, String> localParameterMap = getInstitutionTemplateParameters(document); if(!localParameterMap.isEmpty()) { <START> templateParameters.putAll(localParameterMap); <END> } return templateParameters; }</code><technical_language>This code need adjusted templateParameters localParameterMap of mappings inserted another new Map, modifying templateParameters directly. superclass Collectors.toMap() generate template parameters Map (stored in templateParameters variable), Java 11 API, Map generated Collectors.toMap() is necessarily mutable</technical_language>

Target:
protected Map<String, String> getTemplateParameterList(ContractsGrantsInvoiceDocument document) { Map<String, String> templateParameters = new HashMap<String, String>(); templateParameters.putAll(super.getTemplateParameterList(document)); Map<String, String> localParameterMap = getInstitutionTemplateParameters(document); if(!localParameterMap.isEmpty()) { templateParameters.putAll(localParameterMap); } return templateParameters; }
Source:
<code>public CompletableFuture<Multihash> uploadChunk(CryptreeNode metadata, Location location, SigningPrivateKeyAndPublicHash writer) { if (! writer.publicKeyHash.equals(location.writer)) throw new IllegalStateException("Non matching location writer and signing writer key!"); try { byte[] metaBlob = metadata.serialize(); return dhtClient.put(location.writer, writer.secret.signatureOnly(metaBlob), metaBlob) .thenCompose(blobHash -> tree.put(writer, location.getMapKey(), metadata.committedHash(), blobHash) .thenApply(res -> blobHash)); } catch (Exception e) { <START> LOG.info(e.getMessage()); <END> throw new RuntimeException(e); } }</code><technical_language>this a severe</technical_language>

Target:
public CompletableFuture<Multihash> uploadChunk(CryptreeNode metadata, Location location, SigningPrivateKeyAndPublicHash writer) { if (! writer.publicKeyHash.equals(location.writer)) throw new IllegalStateException("Non matching location writer and signing writer key!"); try { byte[] metaBlob = metadata.serialize(); return dhtClient.put(location.writer, writer.secret.signatureOnly(metaBlob), metaBlob) .thenCompose(blobHash -> tree.put(writer, location.getMapKey(), metadata.committedHash(), blobHash) .thenApply(res -> blobHash)); } catch (Exception e) { LOG.severe(e.getMessage()); throw new RuntimeException(e); } }
Source:
<code>public GlusterVolume update(GlusterVolume incomingVolume) { <START> validateParameters(incomingVolume, "id", "status"); <END> QueryIdResolver<Guid> volumeResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterVolumeById, IdQueryParameters.class); GlusterVolumeEntity entity = getEntity(volumeResolver, true); return performUpdate(incomingVolume, entity, map(entity), volumeResolver, VdcActionType.UpdateGlusterVolume, new UpdateParametersProvider()); }</code><technical_language>for brick resource</technical_language>

Target:
public GlusterVolume update(GlusterVolume incomingVolume) { validateParameters(incomingVolume, "id", "status", "status.detail"); QueryIdResolver<Guid> volumeResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterVolumeById, IdQueryParameters.class); GlusterVolumeEntity entity = getEntity(volumeResolver, true); return performUpdate(incomingVolume, entity, map(entity), volumeResolver, VdcActionType.UpdateGlusterVolume, new UpdateParametersProvider()); }
Source:
<code>UnlockWorkflow(@UnlockWindow Stage window, @UnlockWindow Vault vault, VaultService vaultService, AtomicReference<char[]> password, @Named("savePassword") AtomicBoolean savePassword, @Named("savedPassword") Optional<char[]> savedPassword, UserInteractionLock<PasswordEntry> passwordEntryLock, Optional<KeychainManager> keychain, @FxmlScene(FxmlFile.UNLOCK) Lazy<Scene> unlockScene, @FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy<Scene> successScene, @FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy<Scene> invalidMountPointScene, ErrorComponent.Builder errorComponent) { this.window = window; this.vault = vault; this.vaultService = vaultService; this.password = password; this.savePassword = savePassword; this.savedPassword = savedPassword; this.passwordEntryLock = passwordEntryLock; this.keychain = keychain; this.unlockScene = unlockScene; this.successScene = successScene; this.invalidMountPointScene = invalidMountPointScene; this.errorComponent = errorComponent; <START> setOnScheduled(event -> vault.setState(VaultState.PROCESSING)); setOnSucceeded(event -> vault.setState(VaultState.UNLOCKED)); setOnCancelled(event -> vault.setState(VaultState.LOCKED)); <END> setOnFailed(event -> { vault.setState(VaultState.LOCKED); Throwable throwable = event.getSource().getException(); if (throwable instanceof InvalidMountPointException) { handleInvalidMountPoint((InvalidMountPointException) throwable); } else { handleGenericError(throwable); } }); }</code><technical_language>afaik a _single_ listener this is a public method. I.e. if set a "onSucceeded" listener, vault state longer updated correctly. In other words: Overwriting proteceted succeeded() (etc) methods a deliberate choice listener caller interference</technical_language>

Target:
UnlockWorkflow(@UnlockWindow Stage window, @UnlockWindow Vault vault, VaultService vaultService, AtomicReference<char[]> password, @Named("savePassword") AtomicBoolean savePassword, @Named("savedPassword") Optional<char[]> savedPassword, UserInteractionLock<PasswordEntry> passwordEntryLock, Optional<KeychainManager> keychain, @FxmlScene(FxmlFile.UNLOCK) Lazy<Scene> unlockScene, @FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy<Scene> successScene, @FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy<Scene> invalidMountPointScene, ErrorComponent.Builder errorComponent) { this.window = window; this.vault = vault; this.vaultService = vaultService; this.password = password; this.savePassword = savePassword; this.savedPassword = savedPassword; this.passwordEntryLock = passwordEntryLock; this.keychain = keychain; this.unlockScene = unlockScene; this.successScene = successScene; this.invalidMountPointScene = invalidMountPointScene; this.errorComponent = errorComponent; setOnFailed(event -> { Throwable throwable = event.getSource().getException(); if (throwable instanceof InvalidMountPointException) { handleInvalidMountPoint((InvalidMountPointException) throwable); } else { handleGenericError(throwable); } }); }
Source:
<code>private int getPermittedLimit() { <START> if (!enforceVisibility) { return Integer.MAX_VALUE; } return userProvider.get().getCapabilities() .getRange(GlobalCapability.QUERY_LIMIT) .getMax(); <END> }</code><technical_language>I wrap user code: if (enforceVisibility) { return userProvider.get()... } return Integer.MAX_VALUE;</technical_language>

Target:
private int getPermittedLimit() { if (enforceVisibility) { return userProvider.get().getCapabilities() .getRange(GlobalCapability.QUERY_LIMIT) .getMax(); } return Integer.MAX_VALUE; }
Source:
<code>public void shouldCreateNewAutoGenerationOption() throws Exception { long originalCount = getAllCount(); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("location", LOCATION); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", true); autoGenerationOption.add("manualEntryEnabled", true); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newAutoGenerationOption = deserialize(handle(req)); assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "uuid")); assertEquals(originalCount + 1, getAllCount()); assertNotNull( PropertyUtils.getProperty(newAutoGenerationOption, "source")); <START> assertNotNull( PropertyUtils.getProperty(newAutoGenerationOption, "location")); <END> assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "identifierType")); assertEquals(true, PropertyUtils.getProperty(newAutoGenerationOption, "automaticGenerationEnabled")); assertEquals(true, PropertyUtils.getProperty(newAutoGenerationOption, "manualEntryEnabled")); }</code><technical_language>Instead of assertNotNull, assertEquals more precise? null, a expect. so</technical_language>

Target:
public void shouldCreateNewAutoGenerationOption() throws Exception { long originalCount = getAllCount(); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("location", LOCATION); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", true); autoGenerationOption.add("manualEntryEnabled", true); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject response = deserialize(handle(req)); assertEquals(originalCount + 1, getAllCount()); Object autogenerationOptionUuid = PropertyUtils.getProperty(response, "uuid"); AutoGenerationOption newAutoGenerationOption = identifierSourceService .getAutoGenerationOption(Integer.parseInt(autogenerationOptionUuid.toString())); assertEquals(SOURCE, newAutoGenerationOption.getSource().getUuid()); assertEquals(LOCATION, newAutoGenerationOption.getLocation().getUuid()); assertEquals(IDENTIFIER_TYPE_UUID, newAutoGenerationOption.getIdentifierType().getUuid()); assertEquals(true, newAutoGenerationOption.isAutomaticGenerationEnabled()); assertEquals(true, newAutoGenerationOption.isManualEntryEnabled()); }
Source:
<code>public ClassLoaderModel build() { Optional<Plugin> pluginOptional = empty(); if (processSharedLibraries || processAdditionalPluginLibraries) { pluginOptional = findMuleMavenPluginDeclaration(); } if (processSharedLibraries) { pluginOptional.ifPresent(this::exportSharedLibrariesResourcesAndPackages); } if (processAdditionalPluginLibraries) { pluginOptional.ifPresent(this::processAdditionalPluginLibraries); } <START> localPackages.removeAll(packages); <END> localResources.removeAll(resources); return super.build(); }</code><technical_language>delegate</technical_language>

Target:
public ClassLoaderModel build() { Optional<Plugin> pluginOptional = empty(); if (processSharedLibraries || processAdditionalPluginLibraries) { pluginOptional = findMuleMavenPluginDeclaration(); } if (processSharedLibraries) { pluginOptional.ifPresent(this::exportSharedLibrariesResourcesAndPackages); } if (processAdditionalPluginLibraries) { pluginOptional.ifPresent(this::processAdditionalPluginLibraries); } return super.build(); }
Source:
<code>public void addDeviceModel(@Identification final String organisationIdentification, final String manufacturerId, final String modelCode, final String description) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.CREATE_DEVICEMODEL); final Manufacturer manufacturer = this.manufacturerRepository.findByManufacturerId(manufacturerId); if (manufacturer == null) { LOGGER.info("Manufacturer doesn't exixts."); throw new FunctionalException(FunctionalExceptionType.EXISTING_MANUFACTURER, ComponentType.WS_CORE, <START> new ExistingEntityException(Manufacturer.class, manufacturerId)); <END> } final DeviceModel savedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(manufacturer, modelCode); if (savedDeviceModel != null) { LOGGER.info("DeviceModel already exixts."); throw new FunctionalException(FunctionalExceptionType.EXISTING_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(DeviceModel.class, manufacturerId)); } else { final DeviceModel deviceModel = new DeviceModel(manufacturer, modelCode, description); this.deviceModelRepository.save(deviceModel); } }</code><technical_language>ExistingEntityException is thrown, UnknownEntityException a more valid choice</technical_language>

Target:
public void addDeviceModel(@Identification final String organisationIdentification, final String manufacturerId, final String modelCode, final String description) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.CREATE_DEVICEMODEL); final Manufacturer manufacturer = this.manufacturerRepository.findByManufacturerId(manufacturerId); if (manufacturer == null) { LOGGER.info("Manufacturer doesn't exixts."); throw new FunctionalException(FunctionalExceptionType.EXISTING_MANUFACTURER, ComponentType.WS_CORE, new UnknownEntityException(Manufacturer.class, manufacturerId)); } final DeviceModel savedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(manufacturer, modelCode); if (savedDeviceModel != null) { LOGGER.info("DeviceModel already exixts."); throw new FunctionalException(FunctionalExceptionType.EXISTING_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(DeviceModel.class, manufacturerId)); } else { final DeviceModel deviceModel = new DeviceModel(manufacturer, modelCode, description); this.deviceModelRepository.save(deviceModel); } }
Source:
<code>public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(selectTimeOutMs); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { <START> logger.debug("Error in accepting new connection", e); <END> } } } } logger.debug("Closing server socket and selector."); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { logger.error("Error during shutdown of acceptor thread {}", e); } }</code><technical_language>metric</technical_language>

Target:
public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(selectTimeOutMs); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { key.cancel(); metrics.acceptConnectionErrorCount.inc(); logger.debug("Error in accepting new connection", e); } } } } logger.debug("Closing server socket and selector."); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { metrics.acceptorShutDownErrorCount.inc(); logger.error("Error during shutdown of acceptor thread", e); } }
Source:
<code><START> static public void setLevel(int <END> value) { level.set(value); }</code><technical_language>nit: public static void public is irrelevant. visible class, is package access. skip public keyword</technical_language>

Target:
static void setLevel(int value) { level.set(value); }
Source:
<code>public void fail_to_subtract_too_big_values() { final Duration duration1 = seconds(Long.MAX_VALUE); final Duration duration2 = seconds(Long.MAX_VALUE / 2); <START> com.google.protobuf.util.Durations.subtract(duration1, duration2); <END> }</code><technical_language>remove FQN</technical_language>

Target:
public void fail_to_subtract_too_big_values() { final Duration duration1 = seconds(Long.MAX_VALUE); final Duration duration2 = seconds(Long.MAX_VALUE / 2); subtract(duration1, duration2); }
Source:
<code>public OutputStream write(String item, IProgressMonitor monitor) throws IOException { File file = getFile(item); <START> return new BufferedOutputStream(new FileOutputStream(file)); <END> }</code><technical_language>modify this. classes this method implement buffered writing</technical_language>

Target:
public OutputStream write(String item, IProgressMonitor monitor) throws IOException { File file = getFile(item); return new FileOutputStream(file); }
Source:
<code>protected boolean reconstructMaster() { proceedStorageDomainTreatmentByDomainType(true); <START> if (getParameters().isInactive() && !getStorageDomain().getId().equals(_newMasterStorageDomainId)) { <END> executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { setStorageDomainStatus(StorageDomainStatus.InActive, getCompensationContext()); calcStoragePoolStatusByDomainsStatus(); getCompensationContext().stateChanged(); return null; } }); } if (_isLastMaster) { return stopSpm(); } boolean commandSucceeded = stopSpm(); final List<String> disconnectPoolFormats = Config.<List<String>> GetValue( ConfigValues.DisconnectPoolOnReconstruct); if (commandSucceeded && disconnectPoolFormats.contains(getNewMaster(true).getStorageFormat().getValue())) { commandSucceeded = runVdsCommand( VDSCommandType.DisconnectStoragePool, new DisconnectStoragePoolVDSCommandParameters(getVds().getId(), getStoragePool().getId(), getVds().getVdsSpmId()) ).getSucceeded(); } if (!commandSucceeded) { return false; } List<StoragePoolIsoMap> domains = getStoragePoolIsoMapDAO() .getAllForStoragePool(getStoragePool().getId()); setActionReturnValue(true); return runVdsCommand(VDSCommandType.ReconstructMaster, new ReconstructMasterVDSCommandParameters(getVds().getId(), getVds().getVdsSpmId(), getStoragePool().getId(), getStoragePool().getName(), _newMasterStorageDomainId, domains, getStoragePool().getmaster_domain_version())).getSucceeded(); }</code><technical_language>mind canChooseCurrentMasterAsNewMaster here</technical_language>

Target:
protected boolean reconstructMaster() { proceedStorageDomainTreatmentByDomainType(true); if (getParameters().isInactive() && !getStorageDomain().getId().equals(_newMasterStorageDomainId)) { executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { setStorageDomainStatus(StorageDomainStatus.InActive, getCompensationContext()); calcStoragePoolStatusByDomainsStatus(); getCompensationContext().stateChanged(); return null; } }); } if (_isLastMaster) { return stopSpm(); } boolean commandSucceeded = stopSpm(); final List<String> disconnectPoolFormats = Config.<List<String>> getValue( ConfigValues.DisconnectPoolOnReconstruct); if (commandSucceeded && disconnectPoolFormats.contains(getNewMaster(true).getStorageFormat().getValue())) { commandSucceeded = runVdsCommand( VDSCommandType.DisconnectStoragePool, new DisconnectStoragePoolVDSCommandParameters(getVds().getId(), getStoragePool().getId(), getVds().getVdsSpmId()) ).getSucceeded(); } if (!commandSucceeded) { return false; } List<StoragePoolIsoMap> domains = getStoragePoolIsoMapDAO() .getAllForStoragePool(getStoragePool().getId()); setActionReturnValue(true); return runVdsCommand(VDSCommandType.ReconstructMaster, new ReconstructMasterVDSCommandParameters(getVds().getId(), getVds().getVdsSpmId(), getStoragePool().getId(), getStoragePool().getName(), _newMasterStorageDomainId, domains, getStoragePool().getmaster_domain_version())).getSucceeded(); }
Source:
<code>public MetaTagDataLoader(final NodeDao nodeDao, final SessionUtils sessionUtils, final EntityScopeProvider entityScopeProvider) { <START> this.nodeDao = nodeDao; <END> this.sessionUtils = sessionUtils; this.entityScopeProvider = entityScopeProvider; setConfig(new MetaTagConfiguration(Maps.fromProperties(System.getProperties()))); }</code><technical_language>Objects.requireNotNull, too. Especially, if is actively in constructor</technical_language>

Target:
public MetaTagDataLoader(final NodeDao nodeDao, final SessionUtils sessionUtils, final EntityScopeProvider entityScopeProvider) { this.nodeDao = Objects.requireNonNull(nodeDao, "nodeDao must not be null"); this.sessionUtils = Objects.requireNonNull(sessionUtils, "sessionUtils must not be null"); this.entityScopeProvider = Objects.requireNonNull(entityScopeProvider, "entityScopeProvider must not be null"); setConfig(new MetaTagConfiguration(Maps.fromProperties(System.getProperties()))); }
Source:
<code>public static void store(Object entity) throws EntityStorageException { if (!entity.getClass().isAnnotationPresent(Entity.class)) { throw new EntityStorageException("Entity to store is missing the Entity annotation."); } try { Session session = openNewSession(); session.beginTransaction(); session.save(entity); session.getTransaction().commit(); session.close(); } catch (ConstraintViolationException e) { System.out.println("Coughed constraint violation exception"); } catch (HsqlException e) { System.out.println("Coughed generic exception"); <START> } <END> }</code><technical_language>do need change this file</technical_language>

Target:
public static void store(Object entity) throws EntityStorageException { if (!entity.getClass().isAnnotationPresent(Entity.class)) { throw new EntityStorageException("Entity to store is missing the Entity annotation."); } Session session = openNewSession(); session.beginTransaction(); session.save(entity); session.getTransaction().commit(); session.close(); }
Source:
<code>public TableInstance createImmutable(JdbcTableDefinition tableDefinition, TableHandle tableHandle) { TableName tableName = createImmutableTableName(tableHandle); LOGGER.debug("creating immutable table {}", tableName); if (!tableExists(tableName)) { <START> createTable(tableDefinition, tableName); <END> JdbcTableDataSource dataSource = tableDefinition.getDataSource(); insertData(tableName, dataSource); } return new JdbcTableInstance(tableName, tableDefinition); }</code><technical_language>extract lines a separate method? private void createTableWithData(tableDefinition, tableName)</technical_language>

Target:
public TableInstance createImmutable(JdbcTableDefinition tableDefinition, TableHandle tableHandle) { TableName tableName = createImmutableTableName(tableHandle); LOGGER.debug("creating immutable table {}", tableName); if (!tableExists(tableName)) { createTable(tableDefinition, tableName); JdbcTableDataSource dataSource = tableDefinition.getDataSource(); insertData(tableName, dataSource); } else { LOGGER.info("Table already exists, skipping creation of immutable table", tableName.getNameInDatabase()); } return new JdbcTableInstance(tableName, tableDefinition); }
Source:
<code><START> protected static void mountFromHostToContainer(GenericContainer container, String sourceDirectory, <END> String targetDirectory) { String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("mac os x")) { MountableFile mountableDirectory = MountableFile.forHostPath(sourceDirectory); container.withCopyFileToContainer(mountableDirectory, targetDirectory); } else { container.withFileSystemBind(sourceDirectory, targetDirectory); } }</code><technical_language>I static (causes sort of issues, including for testing sets some states)</technical_language>

Target:
protected void mountFromHostToContainer(GenericContainer container, String sourceDirectory, String targetDirectory) { String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("mac os x")) { MountableFile mountableDirectory = MountableFile.forHostPath(sourceDirectory); container.withCopyFileToContainer(mountableDirectory, targetDirectory); } else { container.withFileSystemBind(sourceDirectory, targetDirectory); } }
Source:
<code>private void handleTransferComplete(final FileTransfer fileTransfer) { this.activeFileTransfers.remove(fileTransfer); this.concurrentTransfersSemaphore.release(); <START> System.out.println(">>> " + this.concurrentTransfersSemaphore.availablePermits()); <END> }</code><technical_language>Assuming this is another debugging call</technical_language>

Target:
private void handleTransferComplete(final FileTransfer fileTransfer) { this.activeFileTransfers.remove(fileTransfer); this.concurrentTransfersSemaphore.release(); }
Source:
<code>protected void initializeClientConfiguration() { if (this.casPrefixUrl != null && !this.casPrefixUrl.endsWith("/")) { this.casPrefixUrl += "/"; } if (CommonHelper.isBlank(this.casPrefixUrl)) { <START> this.casPrefixUrl = this.casLoginUrl.replaceFirst("/login$", "/$"); <END> } else if (CommonHelper.isBlank(this.casLoginUrl)) { this.casLoginUrl = this.casPrefixUrl + "login"; } }</code><technical_language>surprised replacement String: a dollar end</technical_language>

Target:
protected void initializeClientConfiguration() { if (this.casPrefixUrl != null && !this.casPrefixUrl.endsWith("/")) { this.casPrefixUrl += "/"; } if (CommonHelper.isBlank(this.casPrefixUrl)) { this.casPrefixUrl = this.casLoginUrl.replaceFirst("/login$", "/"); } else if (CommonHelper.isBlank(this.casLoginUrl)) { this.casLoginUrl = this.casPrefixUrl + "login"; } }
Source:
<code>private ASTValue evalStatementList(WordsEnvironment environment) { for (int i = 0; i < children.size(); i++) { try { children.get(i).eval(environment); } catch (WordsException e) { System.err.println(e.toString()); <START> System.err.print("> "); <END> } } return null; }</code><technical_language>Is purpose of this show user REPL prompt again</technical_language>

Target:
private ASTValue evalStatementList(WordsEnvironment environment) { for (int i = 0; i < children.size(); i++) { try { children.get(i).eval(environment); } catch (WordsRuntimeException e) { WordsProgramException decoratedException = new WordsProgramException(children.get(i), e); System.err.println(); System.err.println(decoratedException); System.out.print("> "); } } return null; }
Source:
<code>Aggregate<T> newInstance(Callable<T> factoryMethod) throws Exception; <START> default Aggregate<T> loadOrCreate(String aggregateIdentifier, Long expectedVersion, Callable<T> factoryMethod) { <END> throw new UnsupportedOperationException("loadOrCreate not implemented on this repository"); }</code><technical_language>expect a thrown Exception factoryMethod, newInstance(Callable<T>) throws Exception does</technical_language>

Target:
Aggregate<T> newInstance(Callable<T> factoryMethod) throws Exception; default Aggregate<T> loadOrCreate(String aggregateIdentifier, Callable<T> factoryMethod) throws Exception { throw new UnsupportedOperationException("loadOrCreate not implemented on this repository"); }
Source:
<code><START> private List<Position> collectNoFormatCodePositions(IASTTranslationUnit translationUnit) { <END> if (translationUnit == null || !this.preferences.use_fomatter_comment_tag) { return Collections.emptyList(); } String fileName = translationUnit.getFilePath(); if (fileName == null) { return Collections.emptyList(); } List<Position> positions = new ArrayList<>(); int inactiveCodeStart = -1; boolean inInactiveCode = false; Stack<Boolean> inactiveCodeStack = new Stack<>(); IASTComment[] commentsStmts = translationUnit.getComments(); for (IASTComment commentStmt : commentsStmts) { IASTComment statement = commentStmt; if (!statement.isPartOfTranslationUnitFile()) { continue; } IASTNodeLocation nodeLocation = statement.getFileLocation(); if (nodeLocation == null) { continue; } String coment = new String(statement.getComment()); if (coment.contains(this.preferences.comment_formatter_off_tag)) { inactiveCodeStack.push(Boolean.valueOf(inInactiveCode)); if (statement.isActive()) { if (!inInactiveCode) { inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); inInactiveCode = true; } } } else if (coment.contains(this.preferences.comment_formatter_on_tag)) { try { boolean wasInInactiveCode = inactiveCodeStack.pop().booleanValue(); if (inInactiveCode && !wasInInactiveCode) { int inactiveCodeEnd = nodeLocation.getNodeOffset(); positions.add(new Position(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart)); } inInactiveCode = wasInInactiveCode; } catch (EmptyStackException e) { } } } return positions; }</code><technical_language>This implementation support on/off cross #ifdefs (active code) AFAICT. I obvious a user this case, especially if I stop formatting of #ifdef line itself</technical_language>

Target:
private List<Position> collectNoFormatCodePositions(IASTTranslationUnit translationUnit) { if (translationUnit == null || !this.preferences.use_fomatter_comment_tag) { return Collections.emptyList(); } String fileName = translationUnit.getFilePath(); if (fileName == null) { return Collections.emptyList(); } List<Position> positions = new ArrayList<>(); int inactiveCodeStart = -1; boolean inInactiveCode = false; IASTComment[] commentsStmts = translationUnit.getComments(); for (IASTComment commentStmt : commentsStmts) { IASTComment statement = commentStmt; if (!statement.isPartOfTranslationUnitFile()) { continue; } IASTNodeLocation nodeLocation = statement.getFileLocation(); if (nodeLocation == null) { continue; } String comment = new String(statement.getComment()); int offPos = comment.lastIndexOf(this.preferences.comment_formatter_off_tag); int onPos = comment.lastIndexOf(this.preferences.comment_formatter_on_tag); if (offPos != -1 && offPos > onPos) { if (!inInactiveCode) { inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); inInactiveCode = true; } } else if (onPos != -1 && onPos > offPos) { if (inInactiveCode) { int inactiveCodeEnd = nodeLocation.getNodeOffset(); positions.add(new Position(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart)); } inInactiveCode = false; } } return positions; }
Source:
<code>public Mono<ShouldRetryResult> shouldRetry(Exception exception) { return this.retryWithRetryPolicy.shouldRetry(exception) .flatMap((retryWithResult) -> { if (retryWithResult.shouldRetry) { return Mono.just(retryWithResult); } return this.goneRetryPolicy.shouldRetry(exception) .flatMap((goneRetryResult) -> { if (!goneRetryResult.shouldRetry) { logger.warn("Operation will NOT be retried. Exception:", <START> exception); <END> stopStopWatch(this.durationTimer); } return Mono.just(goneRetryResult); }); }); }</code><technical_language>this logs stacktrace warning level. logging stacktrace warning level policies too. this get stacktrace dumped twice. log stacktrace warn place. I if remove this fully rely warn retryPolicy log</technical_language>

Target:
public Mono<ShouldRetryResult> shouldRetry(Exception exception) { return this.retryWithRetryPolicy.shouldRetry(exception) .flatMap((retryWithResult) -> { if (retryWithResult.shouldRetry) { return Mono.just(retryWithResult); } return this.goneRetryPolicy.shouldRetry(exception) .flatMap((goneRetryResult) -> { if (!goneRetryResult.shouldRetry) { logger.debug("Operation will NOT be retried. Exception:", exception); this.end = Instant.now(); } return Mono.just(goneRetryResult); }); }); }
Source:
<code><START> private Object fetchTaskStatusDetails() { <END> GlusterVolumeTaskStatusEntity entity = null; VDSReturnValue returnValue = new VDSReturnValue(); try { returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getStepId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } } catch (Exception err) { returnValue.setSucceeded(false); returnValue.setExceptionString(err.toString()); } return returnValue; }</code><technical_language>Shouldnt return VDSReturnValue here? If some exception, succedded flag is set false, else getReturnValue status entity populated</technical_language>

Target:
private GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } return entity; }
Source:
<code>public void after() throws IOException { <START> deployer.undeploy(PICKETLINK_STS); <END> deployer.undeploy(PICKETLINK_STS_WS); }</code><technical_language>need revert server config state test started</technical_language>

Target:
public void after() throws Exception { deployer.undeploy(PICKETLINK_STS); deployer.undeploy(PICKETLINK_STS_WS); this.serverConfigurationCleanup(); }
Source:
<code>public static int unsignedCompare(long left, long right) { final long a = left + Long.MIN_VALUE; final long b = right + Long.MIN_VALUE; <START> return Long.valueOf(a).compareTo(Long.valueOf(b)); <END> }</code><technical_language>In fact, I a good idea allocate a Long. This function fast. Thus, a branch if solution. if (a < b) ... else if (a > b) ... else ... domain trick works avoid "sign" hack</technical_language>

Target:
public static int unsignedCompare(long left, long right) { final long a = left + Long.MIN_VALUE; final long b = right + Long.MIN_VALUE; if (a < b) { return -1; } else if (a > b) { return 1; } return 0; }
Source:
<code>public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { <START> String flowChainId = runningFlows.getFlowChainId(id); if (flowChainId != null) { flowChains.removeFullFlowChain(flowChainId); } runningFlows.remove(id); <END> } }</code><technical_language>this is cancelFlowWithoutDbUpdate</technical_language>

Target:
public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } }
Source:
<code>public PageContent createPageContent(final Cart cart, final Form<? extends AddDiscountCodeFormData> form) { final CartPageContent cartPageContent = pageContentFactory.create(cart); <START> cartPageContent.getCart().setAddDiscountCodeForm(form); <END> return cartPageContent; }</code><technical_language>need a solution for kind of situations need add more more elements page, right? This solution lines of changing method, is nice. problem is distributes responsibilities view model construction. Need too... right I choose add a new argument method, alternative method, distribution of responsibilities is a worse situation IMO. I opinion, is :D</technical_language>

Target:
public PageContent createPageContent(final Cart cart, final Form<? extends AddDiscountCodeFormData> form) { final CartPageContent cartPageContent = pageContentFactory.create(cart, form); return cartPageContent; }
Source:
<code>public List<HostAndPort> getAddresses() { <START> return Collections.singletonList(address); <END> }</code><technical_language>ImmutableList.of</technical_language>

Target:
public List<HostAndPort> getAddresses() { return ImmutableList.of(address); }
Source:
<code>public void close() { try { closer.close(); closed = true; } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>throw UncheckedIOException(e)</technical_language>

Target:
public void close() { try { closer.close(); closed = true; } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void notifyData(Collection<Data> data) { if (distributed) { NotifyData nData = new NotifyData(currentNode, data, Data.class); Integer key = nData.hashCode(); if (log.isDebugEnabled()) { log.debugf("Sending data [%s]", nData); <START> } <END> dataCache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES) .putAsync(key, nData, LIFESPAN, TimeUnit.MILLISECONDS); } }</code><technical_language>same, remove wrapper</technical_language>

Target:
public void notifyData(Collection<Data> data) { if (distributed) { NotifyData nData = new NotifyData(currentNode, data, Data.class); Integer key = nData.hashCode(); log.debugf("Sending data [%s]", nData); dataCache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES) .putAsync(key, nData, LIFESPAN, TimeUnit.MILLISECONDS); } }
Source:
<code>public void convertToMavenProject(String projectName, String defaultPackaging, boolean withDependencies){ PackageExplorerPart pexplorer = new PackageExplorerPart(); pexplorer.open(); new WaitUntil(new ProjectExists(projectName)); pexplorer.getProject(projectName).select(); new ContextMenuItem("Configure","Convert to Maven Project").select(); <START> AbstractWait.sleep(TimePeriod.DEFAULT); <END> new DefaultShell("Create new POM"); assertEquals("Project " +projectName+" packaging should be set to "+defaultPackaging, defaultPackaging, new LabeledCombo(new DefaultGroup("Artifact"),"Packaging:").getText()); new PushButton("Finish").click(); try{ new DefaultShell("Convert to Maven Dependencies"); new WaitUntil(new ControlIsEnabled(new PushButton("Finish")), TimePeriod.LONG); if(withDependencies){ new PushButton("Finish").click(); } else { new PushButton("Skip Dependency Conversion").click(); } new WaitWhile(new ShellIsAvailable("Convert to Maven Dependencies")); } catch (CoreLayerException ex){ } finally { new WaitWhile(new ShellIsAvailable("Create new POM")); new WaitWhile(new JobIsRunning(),TimePeriod.VERY_LONG); } }</code><technical_language>waiting condition instead of abstract wait, new WaitUntil(new JobIsRunning()), similar. Is a reason for AbstractWait</technical_language>

Target:
public void convertToMavenProject(String projectName, String defaultPackaging, boolean withDependencies){ PackageExplorerPart pexplorer = new PackageExplorerPart(); pexplorer.open(); new WaitUntil(new ProjectExists(projectName)); pexplorer.getProject(projectName).select(); new ContextMenuItem("Configure","Convert to Maven Project").select(); new DefaultShell("Create new POM"); assertEquals("Project " +projectName+" packaging should be set to "+defaultPackaging, defaultPackaging, new LabeledCombo(new DefaultGroup("Artifact"),"Packaging:").getText()); new PushButton("Finish").click(); try{ new DefaultShell("Convert to Maven Dependencies"); new WaitUntil(new ControlIsEnabled(new PushButton("Finish")), TimePeriod.LONG); if(withDependencies){ new PushButton("Finish").click(); } else { new PushButton("Skip Dependency Conversion").click(); } new WaitWhile(new ShellIsAvailable("Convert to Maven Dependencies")); } catch (CoreLayerException ex){ } finally { new WaitWhile(new ShellIsAvailable("Create new POM")); new WaitWhile(new JobIsRunning(),TimePeriod.VERY_LONG); } }
Source:
<code>private org.osgi.service.cm.Configuration getConfigurationWithContext(String serviceId) throws IOException, InvalidSyntaxException { org.osgi.service.cm.Configuration[] configs = configurationAdmin <START> .listConfigurations("(&(service.pid=" + serviceId + "))"); <END> if (configs == null) { return null; } if (configs.length > 1) { throw new IllegalStateException("More than one configuration with PID " + serviceId + " exists"); } return configs[0]; }</code><technical_language>OSGi a constant for this one: org.osgi.framework.Constants.SERVICE_PID</technical_language>

Target:
private org.osgi.service.cm.Configuration getConfigurationWithContext(String serviceId) throws IOException, InvalidSyntaxException { org.osgi.service.cm.Configuration[] configs = configurationAdmin .listConfigurations("(&(" + Constants.SERVICE_PID + "=" + serviceId + "))"); if (configs == null) { return null; } if (configs.length > 1) { throw new IllegalStateException("More than one configuration with PID " + serviceId + " exists"); } return configs[0]; }
Source:
<code>private void setUpDefaults() { if (Android.isDebugging()) { <START> hostEdit.append(BackendEndpoints.Community.HOST); <END> portEdit.append(BackendEndpoints.Community.PORT); } }</code><technical_language>guy I append set a text instead of setText :smile:</technical_language>

Target:
private void setUpDefaults() { if (Android.isDebugging()) { hostEdit.setText(BackendEndpoints.Community.HOST); portEdit.setText(BackendEndpoints.Community.PORT); } }
Source:
<code><START> public void transform(NodeType node) { <END> String versionLabel = componentType.getVersionParameter(); String distributionLabel = componentType.getDistributionParameter(); if (!versionsLabel.contains(ComponentUtilities.getNodePropertyValue(node, versionLabel))) { ComponentUtilities.setNodeValue(node, distributionLabel, DEFAULT_DISTRIBUTION); ComponentUtilities.setNodeValue(node, versionLabel, DEFAULT_VERSION); } }</code><technical_language>Is @ Override annotation missed</technical_language>

Target:
public void transform(NodeType node) { String versionLabel = componentType.getVersionParameter(); String distributionLabel = componentType.name(); if (!versionsLabel.contains(ComponentUtilities.getNodePropertyValue(node, versionLabel))) { try { ComponentUtilities.setNodeValue(node, distributionLabel, DEFAULT_DISTRIBUTION); }catch(IllegalArgumentException distException) { distException.printStackTrace(); } try { ComponentUtilities.setNodeValue(node, versionLabel, defaultVersion); }catch(IllegalArgumentException versionException) { versionException.printStackTrace(); } } }
Source:
<code>private void setUpDaoMocks() { when(diskDao.getAllFromDisksIncludingSnapshotsByDiskId(diskWithSnapshots.getId(), getUser().getId(), getQueryParameters().isFiltered())).thenReturn(getDiskWithSnapshotsList()); <START> disksMap.keySet().forEach(diskId <END> -> when(diskDao.getAllFromDisksIncludingSnapshotsByDiskId(diskId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(Collections.singletonList(disksMap.get(diskId))) ); }</code><technical_language>this include diskWithSnapshots, mocked previous line</technical_language>

Target:
private void setUpDaoMocks() { when(diskDao.getAllFromDisksIncludingSnapshotsByDiskId(diskWithSnapshots.getId(), getUser().getId(), getQueryParameters().isFiltered())).thenReturn(getDiskWithSnapshotsList()); disksMap.keySet().stream().filter(diskId -> !diskId.equals(diskWithSnapshots.getId())).forEach(diskId -> when(diskDao.getAllFromDisksIncludingSnapshotsByDiskId(diskId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(Collections.singletonList(disksMap.get(diskId))) ); }
Source:
<code>public AuthConfig lookupAuthConfig(DockerImageName dockerImageName) { log.debug("Looking up auth config for image: {}", dockerImageName); log.debug("RegistryAuthLocator has configFile: ({}) and commandPathPrefix: {}", configFile, configFile.exists() ? "exists" : "does not exist", commandPathPrefix); try { final JsonNode config = OBJECT_MAPPER.readTree(configFile); <START> final String reposName = dockerImageName.getRegistry(); <END> final AuthConfig existingAuthConfig = findExistingAuthConfig(config, reposName); if (existingAuthConfig != null) { return existingAuthConfig; } final AuthConfig helperAuthConfig = authConfigUsingHelper(config, reposName); if (helperAuthConfig != null) { return helperAuthConfig; } final AuthConfig storeAuthConfig = authConfigUsingStore(config, reposName); if (storeAuthConfig != null) { return storeAuthConfig; } } catch (Exception e) { log.error("Failure when attempting to lookup auth config (dockerImageName: {}, configFile: {}. " + "Falling back to docker-java default behaviour", dockerImageName, configFile, e); } return defaultAuthConfig; }</code><technical_language>a check running Windows fall normal (current) behaviour</technical_language>

Target:
public AuthConfig lookupAuthConfig(DockerImageName dockerImageName) { if (SystemUtils.IS_OS_WINDOWS) { log.debug("RegistryAuthLocator is not supported on Windows. Please help test or improve it and update " + "<LINK_0>"); return defaultAuthConfig; } log.debug("Looking up auth config for image: {}", dockerImageName); log.debug("RegistryAuthLocator has configFile: ({}) and commandPathPrefix: {}", configFile, configFile.exists() ? "exists" : "does not exist", commandPathPrefix); try { final JsonNode config = OBJECT_MAPPER.readTree(configFile); final String reposName = dockerImageName.getRegistry(); final AuthConfig existingAuthConfig = findExistingAuthConfig(config, reposName); if (existingAuthConfig != null) { return existingAuthConfig; } final AuthConfig helperAuthConfig = authConfigUsingHelper(config, reposName); if (helperAuthConfig != null) { return helperAuthConfig; } final AuthConfig storeAuthConfig = authConfigUsingStore(config, reposName); if (storeAuthConfig != null) { return storeAuthConfig; } } catch (Exception e) { log.error("Failure when attempting to lookup auth config (dockerImageName: {}, configFile: {}. " + "Falling back to docker-java default behaviour", dockerImageName, configFile, e); } return defaultAuthConfig; }