auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AppsDataPair loadInBackground() { List<ApplicationInfo> apps = packageManager.getInstalledApplications( PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS); if (apps == null) return new AppsDataPair(Collections.emptyList(), Collections.emptyList()); mApps = new AppsDataPair(new ArrayList<>(apps.size()), new ArrayList<>(apps.size())); for (ApplicationInfo object : apps) { if (object.sourceDir != null) { File sourceDir = new File(object.sourceDir); String label = object.loadLabel(packageManager).toString(); PackageInfo info; try { info = packageManager.getPackageInfo(object.packageName, 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); info = null; } AppDataParcelable elem = new AppDataParcelable( label == null ? object.packageName : label, object.sourceDir, object.packageName, object.flags + "_" + (info != null ? info.versionName : ""), Formatter.formatFileSize(getContext(), sourceDir.length()), sourceDir.length(), sourceDir.lastModified(), null); mApps.first.add(elem); Collections.sort(mApps.first, new AppDataParcelable.AppDataSorter(sortBy, asc)); for (AppDataParcelable p : mApps.first) { mApps.second.add(p.path); } } else { Log.w(TAG, "App " + object.packageName + " has null sourceDir"); } } return mApps; }

Target:
public AppsDataPair loadInBackground() { List<ApplicationInfo> apps = packageManager.getInstalledApplications( PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS); if (apps == null) return new AppsDataPair(Collections.emptyList(), Collections.emptyList()); mApps = new AppsDataPair(new ArrayList<>(apps.size()), new ArrayList<>(apps.size())); for (ApplicationInfo object : apps) { if (object.sourceDir == null) { continue; } File sourceDir = new File(object.sourceDir); String label = object.loadLabel(packageManager).toString(); PackageInfo info; try { info = packageManager.getPackageInfo(object.packageName, 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); info = null; } AppDataParcelable elem = new AppDataParcelable( label == null ? object.packageName : label, object.sourceDir, object.packageName, object.flags + "_" + (info != null ? info.versionName : ""), Formatter.formatFileSize(getContext(), sourceDir.length()), sourceDir.length(), sourceDir.lastModified(), null); mApps.first.add(elem); Collections.sort(mApps.first, new AppDataParcelable.AppDataSorter(sortBy, asc)); for (AppDataParcelable p : mApps.first) { mApps.second.add(p.path); } } return mApps; }
Source:
private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); cPUEditor.setVisible(false); } }

Target:
private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); } }
Source:
public void testAddObectSpecificData() throws UnsupportedEncodingException { itemEventProcessor.configurationService = configurationService; when(configurationService.getProperty(any(String.class))).thenReturn("demo.dspace.org"); when(item.getHandle()).thenReturn("123456789/1"); String result = itemEventProcessor.addObjectSpecificData("existing-string", item); assertThat(result, is("existing-string&svc_dat=demo.dspace.org%2Fhandle%2F123456789%2F1&rft_dat=Investigation")); }

Target:
public void testAddObectSpecificData() throws UnsupportedEncodingException { itemEventProcessor.configurationService = configurationService; when(item.getHandle()).thenReturn("123456789/1"); String result = itemEventProcessor.addObjectSpecificData("existing-string", item); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fhandle%2F123456789%2F1&rft_dat=Investigation")); }
Source:
public synchronized void trimCache(CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("trimCache: Starting cache eviction"); if (trimMark < msg.getPayload()) { trimMark = msg.getPayload(); } cache.invalidateUpTo(trimMark); r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }

Target:
public synchronized void trimCache(CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("trimCache: Starting cache eviction"); if (trimMark < msg.getPayload()) { trimMark = msg.getPayload(); cache.invalidateUpTo(trimMark); } r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); }
Source:
public void dispose() { if (ksession != null) { abortProcessInstances(ksession); ksession.dispose(); ksession = null; } if (ksession2 != null) { ksession2.dispose(); ksession2 = null; } }

Target:
public void dispose() { if (ksession != null) { abortProcessInstances(ksession); ksession.dispose(); ksession = null; } }
Source:
public Void call() throws Exception { StoredConfig cfg = null; if (repository == null) cfg = loadUserConfig(); else cfg = repository.getConfig(); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); ProcessBuilder builder = FS.DETECTED.runInShell("git", repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }

Target:
public Void call() throws Exception { StoredConfig cfg = null; if (repository == null) { cfg = loadUserConfig(); } else { cfg = repository.getConfig(); } cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); ProcessBuilder builder = FS.DETECTED.runInShell("git", repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }
Source:
private FilterPredicate buildFilter(Expression e) { if (e instanceof BinaryExpression) { Expression lhs = ((BinaryExpression) e).getLhs(); Expression rhs = ((BinaryExpression) e).getRhs(); switch (e.getOpType()) { case OP_EQ: return eq(getColumn((Column) lhs), getValue(rhs)); case OP_GT: return gt(getColumn((Column) lhs), getValue(rhs)); case OP_GE: return gtEq(getColumn((Column) lhs), getValue(rhs)); case OP_LT: return lt(getColumn((Column) lhs), getValue(rhs)); case OP_LE: return ltEq(getColumn((Column) lhs), getValue(rhs)); case OP_AND: return and(buildFilter(lhs), buildFilter(rhs)); case OP_OR: return or(buildFilter(lhs), buildFilter(rhs)); } } return null; }

Target:
private FilterPredicate buildFilter(Expression e) { if (e instanceof BinaryExpression) { Expression lhs = ((BinaryExpression) e).getLhs(); Expression rhs = ((BinaryExpression) e).getRhs(); OpType op = e.getOpType(); FilterPredicate lfp; FilterPredicate rfp; switch (op) { case OP_AND: lfp = buildFilter(lhs); rfp = buildFilter(rhs); if (lfp == null || rfp == null) { return null; } return and(lfp, rfp); case OP_OR: lfp = buildFilter(lhs); rfp = buildFilter(rhs); if (lfp == null || rfp == null) { return null; } return or(lfp, rfp); } if (lhs instanceof Column && rhs instanceof Const) { return buildFilter(op, (Column) lhs, (Const) rhs); } else if (lhs instanceof Const && rhs instanceof Column) { return buildFilter(op, (Column) rhs, (Const) lhs); } } return null; }
Source:
public boolean matches(RelOptRuleCall call) { Filter filter = call.rel(0); if (filter.getCondition() == null) { return false; } TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); if (tableSourceTable == null){ return false; } DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); if (!(dynamicTableSource instanceof SupportsPartitionPushDown)) { return false; } Optional<List<Map<String, String>>> partitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); return partitions.isPresent() && !partitions.get().isEmpty() && !Arrays.stream(tableSourceTable.extraDigests()).anyMatch(digest -> digest.startsWith("source: [partitions=")); }

Target:
public boolean matches(RelOptRuleCall call) { Filter filter = call.rel(0); if (filter.getCondition() == null) { return false; } TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); if (tableSourceTable == null) { return false; } DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); if (!(dynamicTableSource instanceof SupportsPartitionPushDown)) { return false; } CatalogTable catalogTable = tableSourceTable.catalogTable(); if (!catalogTable.isPartitioned() || catalogTable.getPartitionKeys().isEmpty()) { return false; } return Arrays.stream(tableSourceTable.extraDigests()).noneMatch(digest -> digest.startsWith("partitions=[")); }
Source:
public void initialize() { logger.debug("Initializing WemoBridgeHandler"); Configuration configuration = getConfig(); if (configuration.get(UDN) != null) { logger.trace("Initializing WemoBridgeHandler for UDN '{}'", configuration.get(UDN)); super.initialize(); for (Thing thing : getThing().getThings()) { ThingHandler handler = thing.getHandler(); if (handler != null) { handler.initialize(); } } } else { logger.debug("Cannot initalize WemoBridgeHandler. UDN not set."); } }

Target:
public void initialize() { logger.debug("Initializing WemoBridgeHandler"); Configuration configuration = getConfig(); if (configuration.get(UDN) != null) { logger.trace("Initializing WemoBridgeHandler for UDN '{}'", configuration.get(UDN)); super.initialize(); Bridge bridge = this.getThing(); for (Thing thing : bridge.getThings()) { ((WemoLightHandler) thing.getHandler()).bridgeHandlerInitialized(this, bridge); } } else { logger.debug("Cannot initalize WemoBridgeHandler. UDN not set."); } }
Source:
public void testBuildPartionPriorityKey(){ List<String> pKeys = new ArrayList<>(); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, pKeys, POSITION); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); List<String> partitionColumns = Arrays.asList("subject_id", "sharding_value","id"); String partitionKey = rowMap.buildPartionPriorityKey(partitionColumns); Assert.assertEquals("9001", partitionKey); }

Target:
public void testBuildPartionPriorityKey(){ List<String> pKeys = new ArrayList<>(); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, pKeys, POSITION); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); List<String> partitionColumns = Arrays.asList("subject_id", "sharding_value","id"); String partitionKey = rowMap.buildPartitionPriorityKey(partitionColumns); Assert.assertEquals("9001", partitionKey); }
Source:
public void setFormattedResponseData(String data) throws Exception { if(data!=null && !data.equals("") && responseContentType!= null && responseContentType.toLowerCase().indexOf("application/json")!=-1){ ObjectMapper objectMapper = new ObjectMapper(); ObjectWriter writer = objectMapper.defaultPrettyPrintingWriter(); Object json = objectMapper.readValue(data, Object.class); this.formattedResponseData = writer.withView(ViewFilters.Default.class).writeValueAsString(json); } else{ this.formattedResponseData = data; } }

Target:
public void setFormattedResponseData(String data) throws Exception { this.formattedResponseData = data; if(data!=null && !data.equals("") && responseContentType != null && responseContentType.toLowerCase().indexOf("application/json") != -1){ try { ObjectMapper objectMapper = new ObjectMapper(); ObjectWriter writer = objectMapper.defaultPrettyPrintingWriter(); Object json = objectMapper.readValue(data, Object.class); this.formattedResponseData = writer.withView(ViewFilters.Default.class).writeValueAsString(json); } catch (JsonParseException jpe) { } } }
Source:
protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); jenkins.checkPermission(Jenkins.ADMINISTER); PluginManager manager = jenkins.getPluginManager(); List<PluginWrapper> pluginsToEnable = pluginNames.stream() .flatMap(pluginName -> getPluginsToEnable(manager, pluginName)) .collect(toList()); for (PluginWrapper plugin : pluginsToEnable) { stdout.println(String.format("Enabling plugin `%s' (%s)", plugin.getShortName(), plugin.getVersion())); plugin.enable(); } if (restart) { jenkins.safeRestart(); } return 0; }

Target:
protected int run() throws Exception { Jenkins jenkins = Jenkins.get(); jenkins.checkPermission(Jenkins.ADMINISTER); PluginManager manager = jenkins.getPluginManager(); for (String pluginName : pluginNames) { enablePlugin(manager, pluginName); } if (restart) { jenkins.safeRestart(); } return 0; }
Source:
private void verifyAmazonUnitShownAboveFooter() { waitForElementByElementLocatedBy(slotAboveFooterEcommerce); Assertion.assertTrue(checkIfElementOnPage(slotAboveFooterEcommerce)); PageObjectLogging .log("verifyAmazonUnitShownAboveFooter", "Amazon unit is visible above footer", true); }

Target:
private void verifyAmazonUnitShownAboveFooter() { waitForElementByElementLocatedBy(slotAboveFooterAmazon); Assertion.assertTrue(checkIfElementOnPage(slotAboveFooterAmazon)); PageObjectLogging .log("verifyAmazonUnitShownAboveFooter", "Amazon unit is visible above footer", true); }
Source:
public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { return false; } HostLocation location = (HostLocation) obj; return location.getDataCenter().equals(this.dataCenter) && location.getRack().equals(this.rack) && location.getPhysicalHost().equals(this.physicalHost); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != getClass()) { return false; } HostLocation location = (HostLocation) obj; return location.getDataCenter().equals(this.dataCenter) && location.getRack().equals(this.rack) && location.getPhysicalHost().equals(this.physicalHost); }
Source:
public BoundingBox getBoundingBox() { double width = 0; String[] lines = textSupplier.get().split("\\r?\\n"); for (int i = 1; i < lines.length; i++) { double w = getBoundingBoxForString(lines[i]).getWidth(); width = Math.max(width, w); } double height = getBoundingBoxForString(textSupplier.get()).getHeight(); height = height * lines.length; return new BoundingBox().addX(0).addX(width).addY(0).addY(height); }

Target:
public BoundingBox getBoundingBox() { double width = 0; final String text = textSupplier.get(); if (text == null || text.isEmpty()) { return new BoundingBox(); } final String[] lines = text.split("\\r?\\n"); for (String line : lines) { double w = getBoundingBoxForString(line).getWidth(); width = Math.max(width, w); } double height = getBoundingBoxForString(text).getHeight(); height = height * lines.length; return new BoundingBox().addX(0).addX(width).addY(0).addY(height); }
Source:
static ConstitutionalTribunalJudgment createSimpleCtJudgment(){ ConstitutionalTribunalJudgment judgment = new ConstitutionalTribunalJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); judgment.getSourceInfo().setSourceCode(SourceCode.SUPREME_COURT); judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }

Target:
static ConstitutionalTribunalJudgment createSimpleCtJudgment(){ ConstitutionalTribunalJudgment judgment = new ConstitutionalTribunalJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); judgment.getSourceInfo().setSourceCode(SourceCode.CONSTITUTIONAL_TRIBUNAL); judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }
Source:
public AddQuotaCommand(T parameters) { super(parameters); setStoragePoolId(parameters.getStoragePoolId()); }

Target:
public AddQuotaCommand(T parameters) { super(parameters); }
Source:
public SqlNode getExpr() { return expr; }

Target:
public Optional<SqlNode> getExpr() { return Optional.ofNullable(expr); }
Source:
public void pruningStrategyShouldBeDynamic() throws IOException { CheckPointer checkPointer = db.getDependencyResolver().resolveDependency( CheckPointer.class ); Config config = db.getDependencyResolver().resolveDependency( Config.class ); FileSystemAbstraction fs = db.getDependencyResolver().resolveDependency( FileSystemAbstraction.class ); LogFiles logFiles = LogFilesBuilder.builder( db.getStoreDir(), fs ) .withLogVersionRepository( new SimpleLogVersionRepository() ) .withLastCommittedTransactionIdSupplier( () -> 1 ) .withTransactionIdStore( new SimpleTransactionIdStore() ).build(); writeTransactionsAndRotateTwice(); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 3 ) ); config.updateDynamicSetting( keep_logical_logs.name(), "false", "test" ); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 2 ) ); }

Target:
public void pruningStrategyShouldBeDynamic() throws IOException { CheckPointer checkPointer = getInstanceFromDb( CheckPointer.class ); Config config = getInstanceFromDb( Config.class ); FileSystemAbstraction fs = getInstanceFromDb( FileSystemAbstraction.class ); LogFiles logFiles = LogFilesBuilder.builder( db.getStoreDir(), fs ) .withLogVersionRepository( new SimpleLogVersionRepository() ) .withLastCommittedTransactionIdSupplier( () -> 1 ) .withTransactionIdStore( new SimpleTransactionIdStore() ).build(); writeTransactionsAndRotateTwice(); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 3 ) ); config.updateDynamicSetting( keep_logical_logs.name(), "false", "test" ); checkPointer.forceCheckPoint( triggerInfo ); assertThat( countTransactionLogs( logFiles ), is( 2 ) ); }
Source:
private void connect() { logger.debug("Connecting to LIRC"); try { if (connector != null) { connector.disconnect(); } if (configuration.getHost() != null && connector == null) { connector = new LIRCConnector(); } if (connector != null) { connector.connect(configuration); connector.addEventListener(eventListener); updateStatus(ThingStatus.ONLINE); startDeviceDiscovery(); } } catch (UnknownHostException e) { logger.error("Connection to LIRC failed: unknown host"); } catch (IOException e) { logger.error("Connection to LIRC failed", e); } }

Target:
private void connect() { logger.debug("Connecting to LIRC"); try { if (connector != null) { connector.disconnect(); } if (configuration.getHost() != null && connector == null) { connector = new LIRCConnector(); } if (connector != null) { connector.connect(configuration); connector.addEventListener(eventListener); updateStatus(ThingStatus.ONLINE); startDeviceDiscovery(); } } catch (UnknownHostException e) { logger.error("Connection to LIRC failed: unknown host"); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Unknown Host"); } catch (IOException e) { logger.error("Connection to LIRC failed", e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); } }
Source:
boolean remove(JobTreeElement jte) { boolean fire = false; boolean removed = false; synchronized (keptjobinfos) { if (keptjobinfos.remove(jte)) { removed = true; finishedTime.remove(jte); disposeAction(jte); JobTreeElement jtes[] = keptjobinfos .toArray(new JobTreeElement[keptjobinfos.size()]); for (JobTreeElement jte2 : jtes) { JobTreeElement parent = (JobTreeElement) jte2 .getParent(); if (parent != null) { if (parent == jte || parent.getParent() == jte) { if (keptjobinfos.remove(jte2)) { disposeAction(jte2); } finishedTime.remove(jte2); } } } fire = true; } } if (fire) { Object l[] = getListeners(); for (Object element : l) { KeptJobsListener jv = (KeptJobsListener) element; jv.removed(jte); } } return removed; }

Target:
boolean remove(JobTreeElement jte) { boolean fire = false; boolean removed = false; synchronized (keptjobinfos) { if (keptjobinfos.remove(jte)) { removed = true; finishedTime.remove(jte); disposeAction(jte); JobTreeElement jobTreeElements[] = keptjobinfos .toArray(new JobTreeElement[keptjobinfos.size()]); for (JobTreeElement jobTreeElement : jobTreeElements) { JobTreeElement parent = (JobTreeElement) jobTreeElement .getParent(); if (parent != null) { if (parent == jte || parent.getParent() == jte) { if (keptjobinfos.remove(jobTreeElement)) { disposeAction(jobTreeElement); } finishedTime.remove(jobTreeElement); } } } fire = true; } } if (fire) { Object l[] = getListeners(); for (Object element : l) { KeptJobsListener jv = (KeptJobsListener) element; jv.removed(jte); } } return removed; }
Source:
public void setKey(@Nullable Object key) { Validate.notNull(key, "key cannot be null"); _key = key; }

Target:
public void setKey(@Nullable Object key) { _key = key; }
Source:
public void shouldShowAllMusicsAsXML() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsXML(); assertThat(result.serializedResult(), is("<list>\n" + " <musicBuilder>\n" + " <id>1</id>\n" + " <title>Some Music</title>\n" + " <description>Some description</description>\n" + " <type>ROCK</type>\n" + " </musicBuilder>\n" + "</list>")); }

Target:
public void shouldShowAllMusicsAsXML() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsXML(); assertThat(result.serializedResult(), is("<list>\n" + " <music>\n" + " <id>1</id>\n" + " <title>Some Music</title>\n" + " <description>Some description</description>\n" + " <type>ROCK</type>\n" + " </music>\n" + "</list>")); }
Source:
private static String firstInvalidSegment(String[] value) { if (value == null) { return null; } for (String element : value) { if (!validSegment(element)) { return element; } } return null; }

Target:
private static String firstInvalidSegment(String[] value) { if (value == null) { return null; } for (String segment : value) { if (!validSegment(segment)) { return segment; } } return null; }
Source:
void tryCleanup() { if (!staging.isPresent()) { return; } String bucket = staging.get().getBucket(); ListObjectsRequest req = new ListObjectsRequest() .withBucketName(bucket) .withPrefix(staging.get().getKey()); do { ObjectListing res = s3.listObjects(req); String[] keys = res.getObjectSummaries().stream() .map(S3ObjectSummary::getKey) .toArray(String[]::new); for (String key : keys) { logger.info("Removing s3://{}/{}", bucket, key); } s3.deleteObjects(new DeleteObjectsRequest(bucket).withKeys(keys)); req.setMarker(res.getMarker()); } while (req.getMarker() != null); }

Target:
void tryCleanup() { if (!staging.isPresent()) { return; } String bucket = staging.get().getBucket(); ListObjectsRequest req = new ListObjectsRequest() .withBucketName(bucket) .withPrefix(staging.get().getKey()); do { ObjectListing res = s3.listObjects(req); String[] keys = res.getObjectSummaries().stream() .map(S3ObjectSummary::getKey) .toArray(String[]::new); for (String key : keys) { logger.info("Removing s3://{}/{}", bucket, key); } try { RetryExecutor.retryExecutor() .withRetryLimit(3) .withInitialRetryWait(100) .retryIf(e -> !(e instanceof AmazonServiceException) || !Aws.isDeterministicException((AmazonServiceException) e)) .run(() -> s3.deleteObjects(new DeleteObjectsRequest(bucket).withKeys(keys))); } catch (RetryExecutor.RetryGiveupException e) { logger.info("Failed to delete staging files in {}", staging.get(), e.getCause()); } req.setMarker(res.getMarker()); } while (req.getMarker() != null); }
Source:
void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId()); if (session == null) { return storageDomainDR.getGeoRepSessionId().toString(); } else { return session.getSlaveHostName() + "::" + session.getSlaveVolumeName(); } } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression()); return schedule.toString(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }

Target:
void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId()); if (session == null) { return storageDomainDR.getGeoRepSessionId().toString(); } else { return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName()); } } }; getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px"); AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() { @Override public String getValue(StorageDomainDR storageDomainDR) { StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression()); return schedule.toString(); } }; getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px"); getTable().addActionButton(new WebAdminButtonDefinition<StorageDomainDR>(constants.newDRSetup()) { @Override protected UICommand resolveCommand() { return getDetailModel().getNewCommand(); } }); }
Source:
public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = mapper.orElseGet(() -> new ObjectMapper()).convertValue(this, new TypeReference<Map<String, String>>(){}); if ( !Boolean.parseBoolean(map.get("keyStore")) ) { map.remove("keyStore"); } return map; }

Target:
public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = mapper.orElseGet(ObjectMapper::new).convertValue(this, new TypeReference<Map<String, String>>(){}); if ( !Boolean.parseBoolean(map.get("keyStore")) ) { map.remove("keyStore"); } return map; }
Source:
public String toString() { return new ToStringBuilder(this) .append("endKey", endKey) .append("timestamp", timestamp) .toString(); }

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("endKey", endKey) .append("timestamp", timestamp) .toString(); }
Source:
public <I,O> boolean andThenFunction(IntegrationFlowBuilder flowBuilder, MessageChannel outputChannel) { if (StringUtils.hasText(this.functionProperties.getName())) { FunctionInvoker<I,O> functionInvoker = new FunctionInvoker<>(this.functionProperties.getName(), this.functionCatalog, this.functionInspector, this.messageConverterFactory); subscribeToInput(functionInvoker, flowBuilder.toReactivePublisher(), message -> outputChannel.send(message)); return true; } return false; }

Target:
public <I,O> boolean andThenFunction(IntegrationFlowBuilder flowBuilder, MessageChannel outputChannel) { if (StringUtils.hasText(this.functionProperties.getName())) { FunctionInvoker<I,O> functionInvoker = new FunctionInvoker<>(this.functionProperties.getName(), this.functionCatalog, this.functionInspector, this.messageConverterFactory); subscribeToInput(functionInvoker, flowBuilder.toReactivePublisher(), outputChannel::send); return true; } return false; }
Source:
public void authenticateUserShouldReturnTheAuthenticationResponse() throws Exception { String responseString = "{" + "\"access_token\": \"foo\"," + "\"description\": \"bar\"," + "\"expires_in\": null" + "}"; MockRestAdapter<AuthenticationResponse> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, AuthenticationResponse>() { @Override public Promise<AuthenticationResponse> call(BitreserveRestAdapter adapter) { BitreserveClient client = new BitreserveClient("foobar"); client.getToken().setBitreserveRestAdapter(adapter); return client.authenticateUser("otp", "user", "password", new AuthenticationRequest("description")); } }); AuthenticationResponse authenticationResponse = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().get(0).getName(), "X-Bitreserve-OTP"); Assert.assertEquals(request.getHeaders().get(0).getValue(), "otp"); Assert.assertEquals(request.getHeaders().get(1).getName(), "Authorization"); Assert.assertEquals(request.getHeaders().get(1).getValue(), "Basic dXNlcjpwYXNzd29yZA=="); Assert.assertEquals(request.getMethod(), "POST"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(authenticationResponse.getAccessToken(), "foo"); Assert.assertEquals(authenticationResponse.getDescription(), "bar"); Assert.assertNull(authenticationResponse.getExpiresIn()); }

Target:
public void authenticateUserShouldReturnTheAuthenticationResponse() throws Exception { String responseString = "{ \"access_token\": \"foo\", \"description\": \"bar\", \"expires\": null }"; MockRestAdapter<AuthenticationResponse> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, AuthenticationResponse>() { @Override public Promise<AuthenticationResponse> call(BitreserveRestAdapter adapter) { BitreserveClient client = new BitreserveClient("foobar"); client.getToken().setBitreserveRestAdapter(adapter); return client.authenticateUser("otp", "user", "password", new AuthenticationRequest("description")); } }); AuthenticationResponse authenticationResponse = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().get(0).getName(), "X-Bitreserve-OTP"); Assert.assertEquals(request.getHeaders().get(0).getValue(), "otp"); Assert.assertEquals(request.getHeaders().get(1).getName(), "Authorization"); Assert.assertEquals(request.getHeaders().get(1).getValue(), "Basic dXNlcjpwYXNzd29yZA=="); Assert.assertEquals(request.getMethod(), "POST"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(authenticationResponse.getAccessToken(), "foo"); Assert.assertEquals(authenticationResponse.getDescription(), "bar"); Assert.assertNull(authenticationResponse.getExpiresIn()); }
Source:
public InputStream getStream(URL uri) throws IOException { Cache<URL, AudioStreamCache> cache = getCache(); AudioStreamCache stream = cache.get(uri); if (stream == null) { stream = new AudioStreamCache(uri); AudioStreamCache exists = cache.putIfAbsent(uri, stream); if (exists != null) { stream = exists; } } return new ByteArrayInputStream(stream.getBytes()); }

Target:
public InputStream getStream(URL uri) throws IOException { Cache<URL, ByteStreamCache> cache = getCache(); ByteStreamCache stream = cache.get(uri); if (stream == null) { stream = new ByteStreamCache(); ByteStreamCache exists = cache.putIfAbsent(uri, stream); if (exists != null) { stream = exists; } } return new ByteArrayInputStream(stream.getBytes(uri, sizeChangedListener)); }
Source:
public void exitsSuccessfully() throws IOException { final MemberProfileJson memberprofilejson = Mockito.mock(MemberProfileJson.class); Mockito.when( memberprofilejson.fetch( Mockito.anyString(), Mockito.anyString(), Mockito.any(Href.class) ) ).thenReturn( Json.createReader( new FileInputStream( PsLinkedinTest.class.getResource( "linkedinTestUser.json" ).getPath() ) ).readObject() ); final Response response = new RsWithStatus( new RsWithType( new RsWithBody("<html>This is test response</html>"), "text/html" ), HttpURLConnection.HTTP_OK ); MatcherAssert.assertThat( new PsLinkedin( memberprofilejson ).exit(response, Mockito.mock(Identity.class)), Matchers.is(response) ); }

Target:
public void exitsSuccessfully() throws IOException { final Response response = new RsWithStatus( new RsWithType( new RsWithBody("<html>This is test response</html>"), "text/html" ), HttpURLConnection.HTTP_OK ); MatcherAssert.assertThat( new PsLinkedin("someApp", "someTestKey") .exit(response, Mockito.mock(Identity.class)), Matchers.is(response) ); }
Source:
private void setNetworkStats(HWNetworkStore netstore) { String txBytesPath, rxBytesPath, txPacketsPath, rxPacketsPath; List<String> read; txBytesPath = "/sys/class/net/" + netstore.getName() + "/statistics/tx_bytes"; rxBytesPath = "/sys/class/net/" + netstore.getName() + "/statistics/rx_bytes"; txPacketsPath = "/sys/class/net/" + netstore.getName() + "/statistics/tx_packets"; rxPacketsPath = "/sys/class/net/" + netstore.getName() + "/statistics/rx_packets"; try { read = FileUtil.readFile(txBytesPath); netstore.setBytesSent(Long.parseLong(read.get(0))); read = FileUtil.readFile(rxBytesPath); netstore.setBytesRecv(Long.parseLong(read.get(0))); read = FileUtil.readFile(txPacketsPath); netstore.setPacketsSent(Long.parseLong(read.get(0))); read = FileUtil.readFile(rxPacketsPath); netstore.setPacketsRecv(Long.parseLong(read.get(0))); } catch (IOException ex) { LOG.error("Error when retrieving network statistics for interface " + netstore.getName()); LOG.debug("Error message: " + ex.getMessage()); } }

Target:
private void setNetworkStats(HWNetworkStore netstore) { String txBytesPath, rxBytesPath, txPacketsPath, rxPacketsPath, speed; txBytesPath = String.format("/sys/class/net/%s/statistics/tx_bytes", netstore.getName()); rxBytesPath = String.format("/sys/class/net/%s/statistics/rx_bytes", netstore.getName()); txPacketsPath = String.format("/sys/class/net/%s/statistics/tx_packets", netstore.getName()); rxPacketsPath = String.format("/sys/class/net/%s/statistics/rx_packets", netstore.getName()); speed = String.format("/sys/class/net/%s/speed", netstore.getName()); netstore.setBytesSent(this.readFile(txBytesPath)); netstore.setBytesRecv(this.readFile(rxBytesPath)); netstore.setPacketsSent(this.readFile(txPacketsPath)); netstore.setPacketsRecv(this.readFile(rxPacketsPath)); netstore.setSpeed(this.readFile(speed)); }
Source:
private RevisionInfo resolveRevisionToDisplay(ChangeInfo info) { if (revision == null) { revision = info.current_revision(); } else if (!info.revisions().containsKey(revision)) { JsArray<RevisionInfo> list = info.revisions().values(); for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); if (revision.equals(String.valueOf(r._number()))) { revision = r.name(); break; } } } if (revision != null) { return info.revision(revision); } else { JsArray<RevisionInfo> revisions = info.revisions().values(); if (revisions.length() > 0) { RevisionInfo.sortRevisionInfoByNumber(revisions); RevisionInfo rev = revisions.get(revisions.length() - 1); revision = rev.name(); return rev; } else { new ErrorDialog( Resources.M.changeWithNoRevisions(info.legacy_id().get())).center(); throw new IllegalStateException("no revision, cannot proceed"); } } }

Target:
private RevisionInfo resolveRevisionToDisplay(ChangeInfo info) { if (revision == null) { revision = info.current_revision(); } else if (!info.revisions().containsKey(revision)) { JsArray<RevisionInfo> list = info.revisions().values(); for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); if (revision.equals(String.valueOf(r._number()))) { revision = r.name(); break; } } } RevisionInfo rev = revision != null ? info.revision(revision) : null; if (rev != null) { return rev; } JsArray<RevisionInfo> revisions = info.revisions().values(); if (revisions.length() > 0) { RevisionInfo.sortRevisionInfoByNumber(revisions); rev = revisions.get(revisions.length() - 1); revision = rev.name(); return rev; } else { new ErrorDialog( Resources.M.changeWithNoRevisions(info.legacy_id().get())).center(); throw new IllegalStateException("no revision, cannot proceed"); } }
Source:
public long getEstimatedSize() { return INSTANCE_SIZE + values.getRetainedSizeInBytes() + counts.sizeOf() + valueStore.getEstimatedSize() + nextPointers.sizeOf() + headPointers.sizeOf() + buckets.sizeOf() + groupIds.sizeOf(); }

Target:
public long getEstimatedSize() { return INSTANCE_SIZE + counts.sizeOf() + groupIds.sizeOf() + nextPointers.sizeOf() + valuePositions.sizeOf() + valueAndGroupHashes.sizeOf() + buckets.sizeOf() + values.getRetainedSizeInBytes() + valueStore.getEstimatedSize() + headPointers.sizeOf(); }
Source:
void request() throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; <DTO> DTO request(@NotNull Class<DTO> dtoInterface) throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; String requestString() throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; Map<String, String> requestProperties() throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; <DTO> List<DTO> requestList(@NotNull Class<DTO> dtoInterface) throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; <T> T request(@NotNull Class<T> clazz, @Nullable Type typeOfT) throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; default HttpJsonRequest useGetMethod() { return setMethod(HttpMethod.GET); }

Target:
HttpJsonResponse request() throws IOException, ServerException, UnauthorizedException, ForbiddenException, NotFoundException, ConflictException, BadRequestException; default HttpJsonRequest useGetMethod() { return setMethod(HttpMethod.GET); }
Source:
public List<ByteBuffer> sliceBuffers(long len) throws EOFException { if (len <= 0) { return Collections.emptyList(); } if (current == null) { throw new EOFException(); } List<ByteBuffer> buffers = new ArrayList<>(); int bytesAccumulated = 0; while (bytesAccumulated < len) { if (current.remaining() > 0) { int bufLen = (int) Math.min(len - bytesAccumulated, current.remaining()); ByteBuffer slice = current.duplicate(); slice.limit(slice.position() + bufLen); buffers.add(slice); bytesAccumulated += bufLen; current.position(current.position() + bufLen); this.position += bufLen; } else if (!nextBuffer()) { throw new EOFException(); } } return buffers; }

Target:
public List<ByteBuffer> sliceBuffers(long len) throws EOFException { if (len <= 0) { return Collections.emptyList(); } if (current == null) { throw new EOFException(); } List<ByteBuffer> buffers = new ArrayList<>(); long bytesAccumulated = 0; while (bytesAccumulated < len) { if (current.remaining() > 0) { int bufLen = (int) Math.min(len - bytesAccumulated, current.remaining()); ByteBuffer slice = current.duplicate(); slice.limit(slice.position() + bufLen); buffers.add(slice); bytesAccumulated += bufLen; current.position(current.position() + bufLen); this.position += bufLen; } else if (!nextBuffer()) { throw new EOFException(); } } return buffers; }
Source:
public String getDescription() { return "Dropping an Association to generate a CreateLinkAction"; }

Target:
public String getDescription() { return Messages.AssociationToCreateLinkActionDropStrategy_Description; }
Source:
public R visitInsert(Insert<?> node, C context) { node.table().accept(this, context); if (node.subQuery() != null) { node.subQuery().accept(this, context); } return null; }

Target:
public R visitInsert(Insert<?> node, C context) { node.table().accept(this, context); node.insertSource().accept(this, context); return null; }
Source:
public void revertChanges() { view.setName(preferencesManager.getValue(COMMITTER_NAME)); view.setEmail(preferencesManager.getValue(COMMITTER_EMAIL)); dirty = false; }

Target:
public void revertChanges() { name = firstNonNull(preferencesManager.getValue(COMMITTER_NAME), DEFAULT_COMMITTER_NAME); email = firstNonNull(preferencesManager.getValue(COMMITTER_EMAIL), DEFAULT_COMMITTER_EMAIL); view.setName(name); view.setEmail(email); dirty = false; }
Source:
public RelDataType getRowType(RelDataTypeFactory relDataTypeFactory) { return endpoint.getRowType(relDataTypeFactory); }

Target:
public RelDataType getRowType(RelDataTypeFactory relDataTypeFactory) { if (rowType == null) { rowType = endpoint.getRowType(relDataTypeFactory); } return rowType; }
Source:
public String getUrlFromInternalLinkaAfterPageIsLoaded() { wait.forElementPresent(By.cssSelector(".header-title")); return driver.getCurrentUrl(); }

Target:
public String getUrlFromInternalLinkaAfterPageIsLoaded() { wait.forElementVisible(headerTitle); return driver.getCurrentUrl(); }
Source:
public void testProjectNameInAFolderDisplayName() throws Exception { final String projectName1 = "job-1"; final String displayName1 = "job-1"; final String projectName2 = "job-2"; final String displayName2 = "my-folder-1 job-2"; FreeStyleProject project1 = j.createFreeStyleProject(projectName1); project1.setDisplayName(displayName1); FreeStyleProject project2 = j.createFolder("my-folder-1").createProject(FreeStyleProject.class, projectName2); project2.setDisplayName(displayName2); WebClient wc = j.createWebClient(); Page result = wc.goTo("job/my-folder-1/search/suggest?query=" + projectName2, "application/json"); assertNotNull(result); j.assertGoodStatus(result); String content = result.getWebResponse().getContentAsString(); JSONObject jsonContent = (JSONObject)JSONSerializer.toJSON(content); assertNotNull(jsonContent); JSONArray jsonArray = jsonContent.getJSONArray("suggestions"); assertNotNull(jsonArray); assertEquals(1, jsonArray.size()); boolean foundDisplayName = false; for(Object suggestion : jsonArray) { JSONObject jsonSuggestion = (JSONObject)suggestion; String name = (String)jsonSuggestion.get("name"); if(displayName2.equals(name)) { foundDisplayName = true; } } assertTrue(foundDisplayName); }

Target:
public void testProjectNameInAFolderDisplayName() throws Exception { final String projectName1 = "job-1"; final String displayName1 = "job-1 display"; final String projectName2 = "job-2"; final String displayName2 = "my-folder-1 job-2"; FreeStyleProject project1 = j.createFreeStyleProject(projectName1); project1.setDisplayName(displayName1); MockFolder myMockFolder = j.createFolder("my-folder-1"); FreeStyleProject project2 = myMockFolder.createProject(FreeStyleProject.class, projectName2); project2.setDisplayName(displayName2); WebClient wc = j.createWebClient(); Page result = wc.goTo(myMockFolder.getUrl() + "search/suggest?query=" + projectName2, "application/json"); assertNotNull(result); j.assertGoodStatus(result); String content = result.getWebResponse().getContentAsString(); JSONObject jsonContent = (JSONObject)JSONSerializer.toJSON(content); assertNotNull(jsonContent); JSONArray jsonArray = jsonContent.getJSONArray("suggestions"); assertNotNull(jsonArray); assertEquals(1, jsonArray.size()); boolean foundDisplayName = false; for(Object suggestion : jsonArray) { JSONObject jsonSuggestion = (JSONObject)suggestion; String name = (String)jsonSuggestion.get("name"); if(displayName2.equals(name)) { foundDisplayName = true; } } assertTrue(foundDisplayName); }
Source:
private boolean signalIsForUs(ITmfTrace sender) { for (ITmfTrace childtrace : TmfTraceManager.getTraceSet(sender)) { if (sp.getTrace() == childtrace) { return true; } } return false; }

Target:
private boolean signalIsForUs(ITmfTrace sender) { if (sender == sp.getTrace()) { return true; } else if (sender instanceof TmfExperiment) { for (ITmfTrace childtrace : TmfTraceManager.getTraceSet(sender)) { if (sp.getTrace() == childtrace) { return true; } } } return false; }
Source:
public EAttribute[] getImagePathAttributes() { EAttribute[] attrs = {DescriptionPackage.eINSTANCE.getLayer_Icon(), StylePackage.eINSTANCE.getWorkspaceImageDescription_WorkspacePath(), ToolPackage.eINSTANCE.getContainerCreationDescription_IconPath(), ToolPackage.eINSTANCE.getEdgeCreationDescription_IconPath(), ToolPackage.eINSTANCE.getNodeCreationDescription_IconPath(), ToolPackage.eINSTANCE.getToolSection_Icon()}; return attrs; }

Target:
public EAttribute[] getImagePathAttributes() { return attrs; }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_FACILITY_ATTR_DEF); attr.setFriendlyName("login_namespace"); attr.setDisplayName("Login namespace"); attr.setType(String.class.getName()); attr.setDescription("All available home mount points."); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_FACILITY_ATTR_DEF); attr.setFriendlyName("login_namespace"); attr.setDisplayName("Login namespace"); attr.setType(String.class.getName()); attr.setDescription("Namespace for logins which can use specific facility."); return attr; }
Source:
public URI getProcessSubTypeURI(Integer processId, String processTitle, URI processDataDirectory, ProcessSubType processSubType, String resourceName) { if (processDataDirectory == null) { try { ProcessService processService = getProcessService(); Process process = processService.getById(processId); processDataDirectory = processService.getProcessDataDirectory(process); } catch (DAOException e) { processDataDirectory = URI.create(String.valueOf(processId)); } } if (resourceName == null) { resourceName = ""; } return fileManagement.getProcessSubTypeUri(processDataDirectory, processTitle, processSubType, resourceName); }

Target:
public URI getProcessSubTypeURI(Integer processId, String processTitle, URI processDataDirectory, ProcessSubType processSubType, String resourceName) { if (Objects.isNull(processDataDirectory)) { try { Process process = ServiceManager.getProcessService().getById(processId); processDataDirectory = ServiceManager.getProcessService().getProcessDataDirectory(process); } catch (DAOException e) { processDataDirectory = URI.create(String.valueOf(processId)); } } if (Objects.isNull(resourceName)) { resourceName = ""; } return fileManagementModule.getProcessSubTypeUri(processDataDirectory, processTitle, processSubType, resourceName); }
Source:
static String spliceOrAppendString(final String destination, final String toInsert, final int insertIdx) { if (insertIdx <= destination.length()) { return destination.substring(0, insertIdx) + toInsert + destination.substring(insertIdx); } else { if (destination.length() > 0 && destination.charAt(destination.length()-1) == '*') { return destination; } else { return destination + toInsert; } } }

Target:
static String spliceOrAppendString(final String destination, final String toInsert, final int insertIdx) { if (insertIdx <= destination.length()) { return destination.substring(0, insertIdx) + toInsert + destination.substring(insertIdx); } else { if (destination.length() > 0 && destination.substring(destination.length()-1).equals(Allele.SPAN_DEL_STRING)) { return destination; } else { return destination + toInsert; } } }
Source:
public void creationOf${bindingIdCamelCase}Handler() { assertThat(bridge.getHandler(), is(nullValue())); managedThingProvider.add(bridge); waitForAssert(() -> assertThat(managedThingProvider.get(bridge.getUID()), is(notNullValue()))); }

Target:
public void creationOf${bindingIdCamelCase}Handler() { assertNull(bridge.getHandler()); managedThingProvider.add(bridge); waitForAssert(() -> assertNotNull(managedThingProvider.get(bridge.getUID()))); }