auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void not_save_zero_coverage_sq_62() throws Exception { Settings newSettings = new Settings().setProperty(FORCE_ZERO_COVERAGE_KEY, "true"); context.setSettings(newSettings); utCoverageSensor.execute(context, linesOfCode, RUN_WITH_SQ_6_2); assertThat(context.lineHits("moduleKey:file1.js", CoverageType.UNIT, 1)).isNull(); newSettings.setProperty(JavaScriptPlugin.LCOV_UT_REPORT_PATH, "reports/report_ut.lcov"); context.setSettings(newSettings); itCoverageSensor.execute(context, linesOfCode, RUN_WITH_SQ_6_2); assertThat(context.lineHits("moduleKey:file1.js", CoverageType.IT, 1)).isNull(); overallCoverageSensor.execute(context, linesOfCode, RUN_WITH_SQ_6_2); assertThat(context.lineHits("moduleKey:file1.js", CoverageType.OVERALL, 1)).isEqualTo(2); }

Target:
public void not_save_zero_coverage_sq_62() throws Exception { Settings newSettings = new Settings().setProperty(FORCE_ZERO_COVERAGE_KEY, "true"); context.setSettings(newSettings); utCoverageSensor.execute(context, linesOfCode, RUN_WITH_SQ_6_2); assertThat(context.lineHits("moduleKey:file1.js", CoverageType.UNIT, 1)).isNull(); newSettings.setProperty(JavaScriptPlugin.LCOV_UT_REPORT_PATH, "reports/report_ut.lcov"); context.setSettings(newSettings); itCoverageSensor.execute(context, linesOfCode, RUN_WITH_SQ_6_2); assertThat(context.lineHits("moduleKey:file1.js", CoverageType.IT, 1)).isNull(); }
Source:
private static KernelTransactions createTransactions( StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard availabilityGuard ) { return new KernelTransactions( statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, null, null, new TransactionHooks(), mock( TransactionMonitor.class ), availabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new AtomicReference<>( CpuClock.NOT_AVAILABLE ), new AtomicReference<>( HeapAllocation.NOT_AVAILABLE ), new CanWrite(), DefaultCursors::new, AutoIndexing.UNSUPPORTED, mock( ExplicitIndexStore.class ), EmptyVersionContextSupplier.EMPTY, ON_HEAP, mock( ConstraintSemantics.class ), mock( SchemaState.class ), mock( IndexingProvidersService.class) ); }

Target:
private static KernelTransactions createTransactions( StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard availabilityGuard ) { return new KernelTransactions( statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, null, null, new TransactionHooks(), mock( TransactionMonitor.class ), availabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new AtomicReference<>( CpuClock.NOT_AVAILABLE ), new AtomicReference<>( HeapAllocation.NOT_AVAILABLE ), new CanWrite(), DefaultCursors::new, AutoIndexing.UNSUPPORTED, mock( ExplicitIndexStore.class ), EmptyVersionContextSupplier.EMPTY, ON_HEAP, mock( ConstraintSemantics.class ), mock( SchemaState.class ), mock( IndexingProvidersService.class), mock( PropertyKeyTokenHolder.class ) ); }
Source:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { int viewType = getItemViewType(position); if (viewType == VIEW_TYPE_HEADER) { } else if (viewType == VIEW_TYPE_INPUT) { final InputViewHolder inputViewHolder = (InputViewHolder) holder; inputViewHolder.progressBar.setVisibility(mIsLoading ? View.VISIBLE : View.GONE); if (inputViewHolder.input.getTag() == null) { inputViewHolder.input.setText(mKeywords); inputViewHolder.input.setTag(Boolean.TRUE); inputViewHolder.input.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(final Editable editable) { mDebouncer.debounce(Void.class, new Runnable() { @Override public void run() { mOnAdapterListener.onKeywordsChange(editable.toString()); } }, 400, TimeUnit.MILLISECONDS); } }); } } else { final DomainSuggestionResponse suggestion = getItem(position); final DomainViewHolder domainViewHolder = (DomainViewHolder) holder; domainViewHolder.radioButton.setChecked(suggestion.equals(mSelectedDomain)); domainViewHolder.textView.setText(suggestion.domain_name); View.OnClickListener clickListener = new View.OnClickListener() { @Override public void onClick(View view) { if (!suggestion.equals(mSelectedDomain)) { mSelectedDomain = suggestion; notifyDataSetChanged(); mOnAdapterListener.onSelectionChange(mSelectedDomain.domain_name); } } }; holder.itemView.setOnClickListener(clickListener); domainViewHolder.radioButton.setOnClickListener(clickListener); } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { int viewType = getItemViewType(position); switch (viewType) { case VIEW_TYPE_INPUT: bindInput((InputViewHolder) holder); break; case VIEW_TYPE_ITEM: bindSuggest((DomainViewHolder) holder, position); break; } }
Source:
public <T> T loadFiles(Class<T> type, List<File> files, List<String> resources) { if (files == null) { return loadResources(type, resources); } Config config = null; for (File file : files) { if (config == null) { config = ConfigFactory.parseFile(file, ConfigParseOptions.defaults().setAllowMissing(false)); } else { config = config.withFallback(ConfigFactory.parseFile(file, ConfigParseOptions.defaults().setAllowMissing(false))); } } for (String resource : resources) { if (config == null) { config = ConfigFactory.load(classLoader, resource); } else { config = config.withFallback(ConfigFactory.load(classLoader, resource)); } } return map(Objects.requireNonNull(config).resolve(), type); }

Target:
public <T> T loadFiles(Class<T> type, List<File> files, List<String> resources) { if (files == null) { return loadResources(type, resources); } Config config = null; for (File file : files) { if (config == null) { config = ConfigFactory.parseFile(file, ConfigParseOptions.defaults().setAllowMissing(false)); } else { config = config.withFallback(ConfigFactory.parseFile(file, ConfigParseOptions.defaults().setAllowMissing(false))); } } for (String resource : resources) { if (config == null) { config = ConfigFactory.load(classLoader, resource); } else { config = config.withFallback(ConfigFactory.load(classLoader, resource)); } } return map(checkNotNull(config, "config cannot be null").resolve(), type); }
Source:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) throws InternalErrorException { Attribute attribute = new Attribute(attributeDefinition); String url = "<LINK_0>"; try { Attribute attributeDef = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":elixirBonaFideStatusREMS"); String attrDefValue = (String) attributeDef.getValue(); if (attrDefValue != null && !attrDefValue.isEmpty()) { attribute.setValue(attrDefValue); } else { Attribute uesAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":eduPersonScopedAffiliations"); List<String> affiliations = (List<String>)uesAttribute.getValue(); for (String affiliation : affiliations) { if (affiliation != null && affiliation.startsWith("faculty@")) { attribute.setValue(url); break; } } } } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { log.error("Cannot read elixirBonaFideStatusREMS from user " + user.getId(), e); } return attribute; }

Target:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) throws InternalErrorException { Attribute attribute = new Attribute(attributeDefinition); try { Attribute statusAttr = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":" + USER_REMS_ATTR_NAME); String statusAttrValue = (String) statusAttr.getValue(); if (statusAttrValue != null && !statusAttrValue.isEmpty()) { attribute.setValue(URL); } } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { log.error("Cannot read from user {}", USER_REMS_ATTR_NAME, user, e); } if (attribute.getValue() == null) { try { Attribute userAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":" + USER_AFFILIATIONS_ATTR_NAME); if (userAttribute.getValue() != null) { List<String> affiliations = (List<String>) userAttribute.getValue(); for (String affiliation : affiliations) { if (affiliation != null && affiliation.startsWith("faculty@")) { attribute.setValue(URL); break; } } } } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { log.error("Cannot read from user {}", USER_AFFILIATIONS_ATTR_NAME, user, e); } } return attribute; }
Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters().getCommandStep(), getParameters().getChildCommands()); Guid currentChildId = getCurrentChildId(getParameters().getCommandStep(), getParameters().getChildCommands()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
public void testCreateExternalGoogleCloudFileHandleFromExistingFile() throws Exception { Assume.assumeTrue(config.getGoogleCloudEnabled()); assertNotNull(imageFile); assertTrue(imageFile.exists()); String md5 = MD5ChecksumHelper.getMD5Checksum(imageFile); String baseKey = "integration-test/IT049FileHandleTest/testCreateExternalGoogleCloudFileHandleFromExistingFile/" + UUID.randomUUID().toString(); String key = baseKey + FILE_NAME; uploadOwnerTxtToGoogleCloud(googleCloudBucket, baseKey, synapse.getUserProfile(userToDelete.toString()).getUserName()); googleCloudStorageClient.putObject(googleCloudBucket, key, imageFile); ExternalGoogleCloudStorageLocationSetting storageLocationSetting = new ExternalGoogleCloudStorageLocationSetting(); storageLocationSetting.setBucket(googleCloudBucket); storageLocationSetting.setBaseKey(baseKey); storageLocationSetting.setUploadType(UploadType.GOOGLECLOUDSTORAGE); storageLocationSetting = synapse.createStorageLocationSetting(storageLocationSetting); GoogleCloudFileHandle fh = new GoogleCloudFileHandle(); fh.setStorageLocationId(storageLocationSetting.getStorageLocationId()); fh.setBucketName(googleCloudBucket); fh.setKey(key); fh.setContentMd5(md5); GoogleCloudFileHandle result = synapse.createExternalGoogleCloudFileHandle(fh); assertNotNull(result); toDelete.add(result); assertNotNull(result.getFileName()); }

Target:
public void testCreateExternalGoogleCloudFileHandleFromExistingFile() throws Exception { Assume.assumeTrue(config.getGoogleCloudEnabled()); assertNotNull(imageFile); assertTrue(imageFile.exists()); String md5 = MD5ChecksumHelper.getMD5Checksum(imageFile); String baseKey = "integration-test/IT049FileHandleTest/testCreateExternalGoogleCloudFileHandleFromExistingFile/" + UUID.randomUUID().toString(); String key = baseKey + FILE_NAME; uploadOwnerTxtToGoogleCloud(googleCloudBucket, baseKey, synapse.getUserProfile(userToDelete.toString()).getUserName()); putToGoogleCloudWaitForConsistency(googleCloudBucket, key, imageFile); ExternalGoogleCloudStorageLocationSetting storageLocationSetting = new ExternalGoogleCloudStorageLocationSetting(); storageLocationSetting.setBucket(googleCloudBucket); storageLocationSetting.setBaseKey(baseKey); storageLocationSetting.setUploadType(UploadType.GOOGLECLOUDSTORAGE); storageLocationSetting = synapse.createStorageLocationSetting(storageLocationSetting); GoogleCloudFileHandle fh = new GoogleCloudFileHandle(); fh.setStorageLocationId(storageLocationSetting.getStorageLocationId()); fh.setBucketName(googleCloudBucket); fh.setKey(key); fh.setContentMd5(md5); GoogleCloudFileHandle result = synapse.createExternalGoogleCloudFileHandle(fh); assertNotNull(result); toDelete.add(result); assertNotNull(result.getFileName()); }
Source:
private DiscoveryService providesDiscoveryService(final ZKClientService zkClient, final ZKDiscoveryService delegate) { return new DiscoveryService() { @Override public Cancellable register(Discoverable discoverable) { zkClient.startAndWait(); return delegate.register(discoverable); } }; }

Target:
private DiscoveryService providesDiscoveryService(final ZKClientService zkClient, final ZKDiscoveryService delegate) { return new DiscoveryService() { @Override public Cancellable register(Discoverable discoverable) { if (!zkClient.isRunning()) { zkClient.startAndWait(); } return delegate.register(discoverable); } }; }
Source:
public SolrInputDocument makeContainerDocument(PID pid, String title, ResourceType type, PID... ancestors) { SolrInputDocument newDoc = new SolrInputDocument(); newDoc.addField("title", title); newDoc.addField("id", pid.getPid()); newDoc.addField("rollup", pid.getPid()); newDoc.addField("ancestorIds", makeAncestorIds(pid, ancestors)); newDoc.addField("ancestorPath", makeAncestorPath(ancestors)); newDoc.addField("resourceType", type.name()); return newDoc; }

Target:
private SolrInputDocument makeContainerDocument(PID pid, String title, ResourceType type, PID... ancestors) { SolrInputDocument newDoc = new SolrInputDocument(); newDoc.addField("title", title); newDoc.addField("id", pid.getPid()); newDoc.addField("rollup", pid.getPid()); newDoc.addField("ancestorIds", makeAncestorIds(pid, ancestors)); newDoc.addField("ancestorPath", makeAncestorPath(ancestors)); newDoc.addField("resourceType", type.name()); return newDoc; }
Source:
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) { try { super.initialize(keyClass, persistentClass, properties); this.conf = HBaseConfiguration.create(getConf()); admin = new HBaseAdmin(this.conf); mapping = readMapping(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); filterUtil = new HBaseFilterUtil<>(this.conf); } catch (FileNotFoundException ex) { LOG.error(DEFAULT_MAPPING_FILE + " is not found, please check the file."); throw new RuntimeException(ex); } catch (Exception e) { throw new RuntimeException(e); } try { this.setScannerCaching( Integer.valueOf(DataStoreFactory.findProperty(this.properties, this, SCANNER_CACHING_PROPERTIES_KEY, String.valueOf(SCANNER_CACHING_PROPERTIES_DEFAULT)))) ; }catch(Exception e){ LOG.error("Can not load " + SCANNER_CACHING_PROPERTIES_KEY + " from gora.properties. Setting to default value: " + SCANNER_CACHING_PROPERTIES_DEFAULT, e) ; this.setScannerCaching(SCANNER_CACHING_PROPERTIES_DEFAULT) ; } if(autoCreateSchema) { createSchema(); } try{ boolean autoflush = this.conf.getBoolean("hbase.client.autoflush.default", false); table = new HBaseTableConnection(getConf(), getSchemaName(), autoflush); } catch(IOException ex2){ LOG.error(ex2.getMessage(), ex2); } }

Target:
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) { try { super.initialize(keyClass, persistentClass, properties); this.conf = HBaseConfiguration.create(getConf()); admin = new HBaseAdmin(this.conf); mapping = readMapping(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); filterUtil = new HBaseFilterUtil<>(this.conf); } catch (FileNotFoundException ex) { LOG.error("{} is not found, please check the file.", DEFAULT_MAPPING_FILE); throw new RuntimeException(ex); } catch (Exception e) { throw new RuntimeException(e); } try { this.setScannerCaching( Integer.valueOf(DataStoreFactory.findProperty(this.properties, this, SCANNER_CACHING_PROPERTIES_KEY, String.valueOf(SCANNER_CACHING_PROPERTIES_DEFAULT)))) ; }catch(Exception e){ LOG.error("Can not load " + SCANNER_CACHING_PROPERTIES_KEY + " from gora.properties. Setting to default value: " + SCANNER_CACHING_PROPERTIES_DEFAULT, e) ; this.setScannerCaching(SCANNER_CACHING_PROPERTIES_DEFAULT) ; } if(autoCreateSchema) { createSchema(); } try{ boolean autoflush = this.conf.getBoolean("hbase.client.autoflush.default", false); table = new HBaseTableConnection(getConf(), getSchemaName(), autoflush); } catch(IOException ex2){ LOG.error(ex2.getMessage(), ex2); } }
Source:
protected Optional<VirtualFile> findChildInDirectory(VirtualFile parent, String name) { try { SmbFile parentFile = parent.tryAs(SmbFile.class) .orElseThrow(() -> new IllegalArgumentException(Strings.apply( "Invalid parent: %s! Expecte a SmbFile!", parent))); SmbFile child = new SmbFile(parentFile, name); if (child.isDirectory()) { return Optional.of(wrapSmbFile(parent, new SmbFile(parentFile, name + "/"))); } return Optional.of(wrapSmbFile(parent, child)); } catch (Exception e) { throw Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 3/CIFS: Cannot resolve file: %s in parent: %s - %s (%s)", name, parent) .handle(); } }

Target:
protected Optional<VirtualFile> findChildInDirectory(VirtualFile parent, String name) { try { SmbFile parentFile = parent.tryAs(SmbFile.class) .orElseThrow(() -> new IllegalArgumentException(Strings.apply( "Invalid parent: %s! Expected a SmbFile!", parent))); SmbFile child = new SmbFile(parentFile, name); if (child.isDirectory()) { return Optional.of(wrapSmbFile(parent, new SmbFile(parentFile, name + "/"))); } return Optional.of(wrapSmbFile(parent, child)); } catch (Exception e) { throw Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 3/CIFS: Cannot resolve file: %s in parent: %s - %s (%s)", name, parent) .handle(); } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (brick.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (!brick.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }
Source:
private static SchemaTableName parseTableName(String schemaTableName) { checkArgument(!isNullOrEmpty(schemaTableName), "schemaTableName is null or is empty"); List<String> parts = Splitter.on('.').splitToList(schemaTableName); checkArgument(parts.size() == 2, "Invalid schemaTableName: %s", schemaTableName); return new SchemaTableName(parts.get(0), parts.get(1)); }

Target:
private static SchemaTableName parseTableName(String schemaTableName) { checkArgument(!isNullOrEmpty(schemaTableName), "schemaTableName is null or empty"); List<String> parts = Splitter.on('.').splitToList(schemaTableName); verify(parts.size() == 2, "Invalid schemaTableName: %s", schemaTableName); return new SchemaTableName(parts.get(0), parts.get(1)); }
Source:
public void cleanup() { long start = System.currentTimeMillis(); System.out.println("About to invoke cluster.cleanup()"); if (plaintextCluster != null) { plaintextCluster.cleanup(); } System.out.println("cluster.cleanup() took " + (System.currentTimeMillis() - start) + " ms."); }

Target:
public void cleanup() throws IOException { long start = System.currentTimeMillis(); System.out.println("About to invoke cluster.cleanup()"); if (plaintextCluster != null) { plaintextCluster.cleanup(); } System.out.println("cluster.cleanup() took " + (System.currentTimeMillis() - start) + " ms."); }
Source:
public T signalNext() throws InterruptedException { T element = nextT(); return signalNext(element); }

Target:
public T signalNext() throws InterruptedException { return signalNext(nextT()); }
Source:
public void generatedInterfaceHasDelegateMethod() { Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_GenericsTester.class); Set<String> originalMethods = extractNonStaticMethods(GenericsTester.class); generatedMethods.removeAll(originalMethods); assertThat(generatedMethods.size(), is(1)); assertThat(generatedMethods.iterator().next(), containsString("delegate")); }

Target:
public void generatedInterfaceHasDelegateMethod() { Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_GenericsTester.class); Set<String> originalMethods = TestingUtils.extractNonStaticMethods(GenericsTester.class); assertThat(Sets.difference(generatedMethods, originalMethods)).haveAtLeastOne( new Condition<>(string -> string.contains("delegate"), "contains the string 'delegate'")); }
Source:
protected boolean checkActiveVdsInStoragePool() { List<VDS> vdss = getVdsDAO().getAllForStoragePool(getParameters().getStoragePoolId()); for (VDS vds : vdss) { if (vds.getStatus() == VDSStatus.Up) { return true; } } addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_ACTIVE_HOST_IN_STORAGE_POOL); return false; }

Target:
protected boolean checkActiveVdsInStoragePool() { List<VDS> vdss = getVdsDAO().getAllForStoragePoolAndStatus(getParameters().getStoragePoolId(), VDSStatus.Up); if (vdss.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_ACTIVE_VDS_IN_STORAGE_POOL); return false; } return true; }
Source:
public MetricsSinksConfig(String metricsSinksConfigFilename, String overrideConfigFilename) throws FileNotFoundException { FileInputStream sinkConfigStream = new FileInputStream(new File(metricsSinksConfigFilename)); FileInputStream overrideStream = new FileInputStream(new File(overrideConfigFilename)); try { Yaml yaml = new Yaml(); Map<Object, Object> sinkConfig = (Map<Object, Object>) yaml.load(sinkConfigStream); Map<Object, Object> overrideConfig = (Map<Object, Object>) yaml.load(overrideStream); if (sinkConfig == null) { throw new RuntimeException("Could not parse metrics-sinks config file"); } if (overrideConfig == null) { throw new RuntimeException("Could not parse override config file"); } Map<Object, Object> allConfig = new HashMap<>(); allConfig.putAll(sinkConfig); allConfig.putAll(overrideConfig); for (String sinkId : TypeUtils.getListOfStrings(allConfig.get(CONFIG_KEY_METRICS_SINKS))) { sinksConfigs.put(sinkId, (Map<String, Object>) allConfig.get(sinkId)); } } finally { SysUtils.closeIgnoringExceptions(sinkConfigStream); SysUtils.closeIgnoringExceptions(overrideStream); } }

Target:
public MetricsSinksConfig(String metricsSinksConfigFilename, String overrideConfigFilename) throws IOException { Map<Object, Object> allConfig = new HashMap<>(); allConfig.putAll(readConfig(metricsSinksConfigFilename)); allConfig.putAll(readConfig(overrideConfigFilename)); if (allConfig.isEmpty()) { throw new RuntimeException("Missing required config 'sinks' for metrics manager"); } for (String sinkId : TypeUtils.getListOfStrings(allConfig.get(CONFIG_KEY_METRICS_SINKS))) { sinksConfigs.put(sinkId, (Map<String, Object>) allConfig.get(sinkId)); } }
Source:
private boolean setReleased() { do { LockState state = lockState; switch (state) { case WAITING: case AVAILABLE: case ACQUIRED: if (casState(state, LockState.RELEASED)) { cleanup(); notifyListeners(); return true; } break; case TIMED_OUT: case DEADLOCKED: if (casState(state, LockState.RELEASED)) { cleanup(); return true; } break; default: return false; } } while (true); }

Target:
private boolean setReleased() { do { LockState state = lockState; switch (state) { case WAITING: case ACQUIRED: if (casState(state, LockState.RELEASED)) { cleanup(); notifyListeners(); return true; } break; case TIMED_OUT: case DEADLOCKED: if (casState(state, LockState.RELEASED)) { cleanup(); return true; } break; default: return false; } } while (true); }
Source:
List<StudyInstance> convertToStudyInstances(final ModelMapper mapper, final List<org.generationcp.middleware.service.impl.study.StudyInstance> middlewareStudyInstances) { final List<StudyInstance> instances = new ArrayList(); for (final org.generationcp.middleware.service.impl.study.StudyInstance instance : middlewareStudyInstances) { final StudyInstance datasetInstance = mapper.map(instance, StudyInstance.class); datasetInstance.setCustomLocationAbbreviation(""); instances.add(datasetInstance); } return instances; }

Target:
List<StudyInstance> convertToStudyInstances(final ModelMapper mapper, final List<org.generationcp.middleware.service.impl.study.StudyInstance> middlewareStudyInstances) { final List<StudyInstance> instances = new ArrayList(); for (final org.generationcp.middleware.service.impl.study.StudyInstance instance : middlewareStudyInstances) { final StudyInstance datasetInstance = mapper.map(instance, StudyInstance.class); instances.add(datasetInstance); } return instances; }
Source:
public static void setupCluster() throws Exception { File zkTmpDir = IOUtils.createTempDir("zookeeper", "distrlog"); TMP_DIRS.add(zkTmpDir); Pair<ZooKeeperServerShim, Integer> serverAndPort = LocalDLMEmulator.runZookeeperOnAnyPort(zkTmpDir); zks = serverAndPort.getLeft(); zkPort = serverAndPort.getRight(); LOG.info("IKDEBUG num bookies is {}", numBookies); bkutil = LocalDLMEmulator.newBuilder() .numBookies(numBookies) .zkHost("127.0.0.1") .zkPort(zkPort) .serverConf(DLMTestUtil.loadTestBkConf()) .shouldStartZK(false) .build(); bkutil.start(); zkServers = "127.0.0.1:" + zkPort; Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("Uncaught exception at Thread : ", t.getName(), e); } }); }

Target:
public static void setupCluster() throws Exception { File zkTmpDir = IOUtils.createTempDir("zookeeper", "distrlog"); TMP_DIRS.add(zkTmpDir); Pair<ZooKeeperServerShim, Integer> serverAndPort = LocalDLMEmulator.runZookeeperOnAnyPort(zkTmpDir); zks = serverAndPort.getLeft(); zkPort = serverAndPort.getRight(); bkutil = LocalDLMEmulator.newBuilder() .numBookies(numBookies) .zkHost("127.0.0.1") .zkPort(zkPort) .serverConf(DLMTestUtil.loadTestBkConf()) .shouldStartZK(false) .build(); bkutil.start(); zkServers = "127.0.0.1:" + zkPort; Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("Uncaught exception at Thread : ", t.getName(), e); } }); }
Source:
public void testAcquireWithDependencies() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); DatastreamTaskImpl task0 = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter2 = mock(ZkAdapter.class); task0.setZkAdapter(mockZkAdapter2); when(mockZkAdapter2.checkIsTaskLocked(anyString(), anyString(), anyString())).thenReturn(true); task.addDependency(task0); task.acquire(Duration.ofMillis(60)); verify(mockZkAdapter, atLeastOnce()).waitForDependencies(any(DatastreamTaskImpl.class), any(Duration.class)); }

Target:
public void testAcquireWithDependencies() { Datastream stream = DatastreamTestUtils.createDatastream("dummy", "dummy", "dummy"); stream.getMetadata().put(DatastreamMetadataConstants.TASK_PREFIX, DatastreamTaskImpl.getTaskPrefix(stream)); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(stream)); ZkAdapter mockZkAdapter = mock(ZkAdapter.class); task.setZkAdapter(mockZkAdapter); task.addDependency(createDependencyTask(stream, true)); task.acquire(Duration.ofMillis(60)); verify(mockZkAdapter, atLeastOnce()).waitForDependencies(any(DatastreamTaskImpl.class), any(Duration.class)); }
Source:
void basicClear(RegionEventImpl regionEvent, boolean cacheWrite) { synchronized (clearLock) { final DistributedLockService lockService = getPartitionedRegionLockService(); try { lockService.lock("_clearOperation", -1, -1); } catch (IllegalStateException e) { lockCheckReadiness(); } try { if (cache.isCacheAtShutdownAll()) { throw cache.getCacheClosedException("Cache is shutting down"); } List<ClearPRMessage> clearMsgList = createClearPRMessages(); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); long then = 0; try { sendClearMsgByBucket(bucketId, clearPRMessage); } catch (PartitionOfflineException poe) { logger.info("PR.sendClearMsgByBucket encountered PartitionOfflineException at bucket " + bucketId, poe); } catch (Exception e) { logger.info("PR.sendClearMsgByBucket encountered exception at bucket " + bucketId, e); } if (logger.isDebugEnabled()) { long now = System.currentTimeMillis(); if (now - then > 10000) { logger.debug("PR.sendClearMsgByBucket for bucket took ms", bucketId, (now - then)); } } } } finally { try { lockService.unlock("_clearOperation"); } catch (IllegalStateException e) { lockCheckReadiness(); } } regionEvent.setEventType(EnumListenerEvent.AFTER_REGION_CLEAR); notifyBridgeClients(regionEvent); } }

Target:
void basicClear(RegionEventImpl regionEvent, boolean cacheWrite) { final boolean isDebugEnabled = logger.isDebugEnabled(); synchronized (clearLock) { final DistributedLockService lockService = getPartitionedRegionLockService(); try { lockService.lock("_clearOperation" + this.getFullPath().replace('/', '_'), -1, -1); } catch (IllegalStateException e) { lockCheckReadiness(); throw e; } try { if (cache.isCacheAtShutdownAll()) { throw cache.getCacheClosedException("Cache is shutting down"); } List<ClearPRMessage> clearMsgList = createClearPRMessages(); for (ClearPRMessage clearPRMessage : clearMsgList) { int bucketId = clearPRMessage.getBucketId(); checkReadiness(); long sendMessagesStartTime = 0; if (isDebugEnabled) { sendMessagesStartTime = System.currentTimeMillis(); } try { sendClearMsgByBucket(bucketId, clearPRMessage); } catch (PartitionOfflineException poe) { logger.info("PR.sendClearMsgByBucket encountered PartitionOfflineException at bucket " + bucketId, poe); } catch (Exception e) { logger.info("PR.sendClearMsgByBucket encountered exception at bucket " + bucketId, e); } if (isDebugEnabled) { long now = System.currentTimeMillis(); logger.debug("PR.sendClearMsgByBucket for bucket took ms", bucketId, (now - sendMessagesStartTime)); } } } finally { try { lockService.unlock("_clearOperation" + this.getFullPath().replace('/', '_')); } catch (IllegalStateException e) { lockCheckReadiness(); } } regionEvent.setEventType(EnumListenerEvent.AFTER_REGION_CLEAR); boolean hasListener = hasListener(); if (hasListener) { dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_CLEAR, regionEvent); } notifyBridgeClients(regionEvent); logger.info("Partitioned region finsihed clear operation.", this.getFullPath()); } }
Source:
void recipeHeatFurnace() { addRecipe(findItemStack("Stone Heat Furnace"), "BBB", "BIB", "BiB", Character.valueOf('B'), new ItemStack(Blocks.stone), Character.valueOf('i'), findItemStack("Copper Thermal Cable"), Character.valueOf('I'), findItemStack("Combustion Chamber")); addRecipe(findItemStack("Fuel Heat Furnace"), "IcI", "I I", "IiI", Character.valueOf('c'), findItemStack("Cheap Chip"), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('i'), findItemStack("Copper Thermal Cable")); }

Target:
void recipeHeatFurnace() { addRecipe(findItemStack("Stone Heat Furnace"), "BBB", "BIB", "BiB", Character.valueOf('B'), new ItemStack(Blocks.stone), Character.valueOf('i'), findItemStack("Copper Thermal Cable"), Character.valueOf('I'), findItemStack("Combustion Chamber")); addRecipe(findItemStack("Fuel Heat Furnace"), "IcI", "mCI", "IiI", Character.valueOf('c'), findItemStack("Cheap Chip"), Character.valueOf('m'), findItemStack("Electrical Motor"), Character.valueOf('C'), new ItemStack(Items.cauldron), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('i'), findItemStack("Copper Thermal Cable")); }
Source:
public void run() { List<String> errorList = new ArrayList<>(); List<Content> emptyDataSources = new ArrayList<>(); try { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_copyingImageFromTo(src.toString(), dest.toString())); FileUtils.copyDirectory(src, dest); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneCopying()); } catch (IOException ex) { String msg = Bundle.AddLogicalImageTask_failedToCopyDirectory(src.toString(), dest.toString()); logger.log(Level.SEVERE, msg); errorList.add(msg); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(ALERT_TXT)); String status = addReport(Paths.get(dest.toString(), ALERT_TXT), ALERT_TXT + " " + src.getName()); if (status != null) { errorList.add(status); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(ALERT_TXT)); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(USERS_TXT)); status = addReport(Paths.get(dest.toString(), USERS_TXT), USERS_TXT + " " + src.getName()); if (status != null) { errorList.add(status); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(USERS_TXT)); super.run(); }

Target:
public void run() { List<String> errorList = new ArrayList<>(); List<Content> emptyDataSources = new ArrayList<>(); try { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_copyingImageFromTo(src.toString(), dest.toString())); FileUtils.copyDirectory(src, dest); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneCopying()); } catch (IOException ex) { String msg = Bundle.AddLogicalImageTask_failedToCopyDirectory(src.toString(), dest.toString()); errorList.add(msg); logger.log(Level.SEVERE, String.format("Failed to copy directory {0} to {1}", src.toString(), dest.toString())); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(ALERT_TXT)); String status = addReport(Paths.get(dest.toString(), ALERT_TXT), ALERT_TXT + " " + src.getName()); if (status != null) { errorList.add(status); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(ALERT_TXT)); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(USERS_TXT)); status = addReport(Paths.get(dest.toString(), USERS_TXT), USERS_TXT + " " + src.getName()); if (status != null) { errorList.add(status); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); return; } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(USERS_TXT)); super.run(); }
Source:
void onSaveKeyPress(KeyPressEvent e) { if (e.getCharCode() == KeyCodes.KEY_ENTER) { e.stopPropagation(); } }

Target:
void onSaveKeyPress(KeyPressEvent e) { if (e.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { e.stopPropagation(); } }
Source:
private void addOffers(Campaign campaign, int num, int market, int unitType, String faction, int quality, int priceTarget) { if (faction == null) { faction = RandomFactionGenerator.getInstance().getEmployer(); } if (faction == null) { faction = campaign.getFactionCode(); market = MARKET_EMPLOYER; } UnitGeneratorParameters params = new UnitGeneratorParameters(); params.faction = faction; params.year = campaign.getCalendar().get(Calendar.YEAR); params.unitType = unitType; params.quality = quality; for (int i = 0; i < num; i++) { params.weightClass = getRandomWeight(unitType, faction, campaign.getCampaignOptions().getRegionalMechVariations()); params.missionRoles.clear(); MechSummary ms; if (unitType == UnitType.TANK) { params.movementModes = IUnitGenerator.MIXED_TANK_VTOL; params.missionRoles.add(MissionRole.MIXED_ARTILLERY); ms = campaign.getUnitGenerator().generate(params); } else { params.movementModes.clear(); ms = campaign.getUnitGenerator().generate(params); } if (ms != null) { if (campaign.getCampaignOptions().limitByYear() && campaign.getCalendar().get(Calendar.YEAR) < ms.getYear()) { continue; } if ((campaign.getCampaignOptions().allowClanPurchases() && ms.isClan()) || (campaign.getCampaignOptions().allowISPurchases() && !ms.isClan())) { int pct = 100 - (Compute.d6(2) - priceTarget) * 5; offers.add(new MarketOffer(market, unitType, ms.getWeightClass(), ms, pct)); } } } }

Target:
private void addOffers(Campaign campaign, int num, int market, int unitType, String faction, int quality, int priceTarget) { if (faction == null) { faction = RandomFactionGenerator.getInstance().getEmployer(); } if (faction == null) { faction = campaign.getFactionCode(); market = MARKET_EMPLOYER; } UnitGeneratorParameters params = new UnitGeneratorParameters(); params.setFaction(faction); params.setYear(campaign.getCalendar().get(Calendar.YEAR)); params.setUnitType(unitType); params.setQuality(quality); for (int i = 0; i < num; i++) { params.setWeightClass(getRandomWeight(unitType, faction, campaign.getCampaignOptions().getRegionalMechVariations())); params.clearMissionRoles(); MechSummary ms; if (unitType == UnitType.TANK) { params.setMovementModes(IUnitGenerator.MIXED_TANK_VTOL); params.addMissionRole(MissionRole.MIXED_ARTILLERY); ms = campaign.getUnitGenerator().generate(params); } else { params.clearMovementModes(); ms = campaign.getUnitGenerator().generate(params); } if (ms != null) { if (campaign.getCampaignOptions().limitByYear() && campaign.getCalendar().get(Calendar.YEAR) < ms.getYear()) { continue; } if ((campaign.getCampaignOptions().allowClanPurchases() && ms.isClan()) || (campaign.getCampaignOptions().allowISPurchases() && !ms.isClan())) { int pct = 100 - (Compute.d6(2) - priceTarget) * 5; offers.add(new MarketOffer(market, unitType, ms.getWeightClass(), ms, pct)); } } } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); selectionMap.put("ContentTree for Channel", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", ChannelContentTreePlayerActivity.class) ); selectionMap.put("ContentTree for Playlists", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", PlaylistListActivity.class) ); setContentView(R.layout.list_activity_layout); selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); for(String key : selectionMap.keySet()) { selectionAdapter.add(key); } selectionAdapter.notifyDataSetChanged(); ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); selectionListView.setAdapter(selectionAdapter); selectionListView.setOnItemClickListener(this); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); selectionMap = new LinkedHashMap<String, PlayerSelectionOption>(); selectionMap.put("ContentTree for Channel", new PlayerSelectionOption(CHANNEL_CODE, "c0cTkxOqALQviQIGAHWY5hP0q9gU", "<LINK_0>", ChannelContentTreePlayerActivity.class) ); selectionMap.put("Playlist API", new PlayerSelectionOption("", "", "<LINK_0>", PlaylistListActivity.class) ); setContentView(R.layout.list_activity_layout); selectionAdapter = new ArrayAdapter<String>(this, R.layout.list_activity_list_item); for(String key : selectionMap.keySet()) { selectionAdapter.add(key); } selectionAdapter.notifyDataSetChanged(); ListView selectionListView = (ListView) findViewById(R.id.mainActivityListView); selectionListView.setAdapter(selectionAdapter); selectionListView.setOnItemClickListener(this); }
Source:
public static void setTooltipOnElement(String tooltip, Element element) { if (tooltip!= null) { element.setTitle(tooltip); } }

Target:
public static void setTooltipOnElement(String tooltip, Element element) { if (tooltip!= null) { element.setTitle(tooltip); } else { element.setTitle(""); } }
Source:
void onCommandUndoExecuted(final @Observes CanvasCommandUndoneEvent commandUndoExecutedEvent) { CanvasHandler canvasHandler = commandUndoExecutedEvent.getCanvasHandler(); if (getSession().getCanvasHandler().equals(canvasHandler)) { checkNotNull("commandUndoExecutedEvent", commandUndoExecutedEvent); if (null != commandUndoExecutedEvent.getCommand()) { redoCommandHandler.onUndoCommandExecuted(commandUndoExecutedEvent.getCommand()); } checkState(); } }

Target:
void onCommandUndoExecuted(final @Observes CanvasCommandUndoneEvent commandUndoExecutedEvent) { checkNotNull("commandUndoExecutedEvent", commandUndoExecutedEvent); CanvasHandler canvasHandler = commandUndoExecutedEvent.getCanvasHandler(); if (getSession().getCanvasHandler().equals(canvasHandler)) { if (null != commandUndoExecutedEvent.getCommand()) { redoCommandHandler.onUndoCommandExecuted(commandUndoExecutedEvent.getCommand()); } checkState(); } }
Source:
public void showSurveysSyncSuccessfully() { btnCancel.setVisibility(View.INVISIBLE); dismissDialog(); Toast.makeText(getActivity(), "Sucessfully Synced", Toast.LENGTH_SHORT).show(); }

Target:
public void showSurveysSyncSuccessfully() { btnCancel.setVisibility(View.INVISIBLE); dismissDialog(); Toast.makeText(getActivity(), R.string.sync_success, Toast.LENGTH_SHORT).show(); }
Source:
public MbusChannelElementsResponseDto execute(final DlmsConnectionHolder conn, final DlmsDevice device, final MbusChannelElementsDto requestDto) throws ProtocolAdapterException { LOGGER.debug("retrieving mbus info on e-meter"); ChannelElementValuesDto bestMatch = null; final List<ChannelElementValuesDto> channelElements = new ArrayList<>(); for (short channel = FIRST_CHANNEL; channel < FIRST_CHANNEL + NR_OF_CHANNELS; channel++) { final List<GetResult> resultList = this.getMBusClientAttributeValues(conn, device, channel); final ChannelElementValuesDto channelValues = this.makeChannelElementValues(channel, resultList); channelElements.add(channelValues); if (FindMatchingChannelHelper.matches(requestDto, channelValues)) { bestMatch = channelValues; break; } } if (bestMatch == null) { bestMatch = FindMatchingChannelHelper.bestMatch(requestDto, channelElements); } if (bestMatch == null && requestDto.getPrimaryAddress() != null) { for (short channel = FIRST_CHANNEL; channel < FIRST_CHANNEL + NR_OF_CHANNELS; channel++) { final List<GetResult> resultList = this.getMBusClientAttributeValues(conn, device, channel); if ((long) resultList.get(INDEX_IDENTIFICATION_NUMBER).getResultData().getValue() == 0L) { bestMatch = new ChannelElementValuesDto(channel, requestDto.getPrimaryAddress(), requestDto.getMbusIdentificationNumber(), requestDto.getMbusManufacturerIdentification(), requestDto.getMbusVersion(), requestDto.getMbusDeviceTypeIdentification()); break; } } channelElements.set(bestMatch.getChannel() - 1, this.writeUpdatedMbus(conn, bestMatch, requestDto)); } return new MbusChannelElementsResponseDto(requestDto, bestMatch == null ? null : bestMatch.getChannel(), channelElements); }

Target:
public MbusChannelElementsResponseDto execute(final DlmsConnectionHolder conn, final DlmsDevice device, final MbusChannelElementsDto requestDto) throws ProtocolAdapterException { LOGGER.debug("retrieving mbus info on e-meter"); ChannelElementValuesDto bestMatch = null; final List<ChannelElementValuesDto> channelElements = new ArrayList<>(); for (short channel = FIRST_CHANNEL; channel < FIRST_CHANNEL + NR_OF_CHANNELS; channel++) { final List<GetResult> resultList = this.getMBusClientAttributeValues(conn, device, channel); final ChannelElementValuesDto channelValues = this.makeChannelElementValues(channel, resultList); channelElements.add(channelValues); if (FindMatchingChannelHelper.matches(requestDto, channelValues)) { bestMatch = channelValues; break; } } if (bestMatch == null) { bestMatch = FindMatchingChannelHelper.bestMatch(requestDto, channelElements); } if (bestMatch == null && requestDto.getPrimaryAddress() != null) { bestMatch = this.findEmptyChannel(conn, device, requestDto, bestMatch); if (bestMatch != null) { final ChannelElementValuesDto updatedChannel = this.writeUpdatedMbus(conn, requestDto, bestMatch.getChannel()); channelElements.set(bestMatch.getChannel() - 1, updatedChannel); } } return new MbusChannelElementsResponseDto(requestDto, bestMatch == null ? null : bestMatch.getChannel(), channelElements); }