auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected HealthCheckResult doCheckInternal() { String registryName = options.getMetricsScope(); List<String> metricNames = new ArrayList<>(Arrays.asList(options.getMetricName().split(","))); metricNames.removeAll(Arrays.asList("", null)); MetricsService metricsService = Globals.getDefaultBaseServiceLocator().getService(MetricsService.class); if (registryName.equalsIgnoreCase("application")) { registryName = options.getMetricsApplicationName(); } HealthCheckResult result = new HealthCheckResult(); List<String> metrics = collectMetrics(metricsService.getRegistry(registryName), metricNames); result.add(new HealthCheckResultEntry(metrics.isEmpty() ? WARNING : GOOD, metrics.isEmpty() ? "The metric you entered doesn't exist under " + registryName : metrics.stream().map(Object::toString).collect(Collectors.joining()))); return result; }

Target:
protected HealthCheckResult doCheckInternal() { List<MonitoredMetric> monitoredMetrics = options.getMonitoredMetrics(); HealthCheckResult result = new HealthCheckResult(); try { if (monitoredMetrics != null && !monitoredMetrics.isEmpty()) { final String data = write(); result.add(new HealthCheckResultEntry(data.isEmpty() ? WARNING : GOOD, data.isEmpty() ? "The metrics you have added for monitoring doesn't exist" : data)); } else { result.add(new HealthCheckResultEntry(CRITICAL, "No metric has been added for monitoring.")); } } catch (IOException ex) { result.add(new HealthCheckResultEntry(CRITICAL, "Failed to write metrics to stream.")); } return result; }
Source:
GenericPreference getPreference(String filePath) { String productID = ""; String userID = ""; Float score = 0.0f; BufferedReader reader; try { reader = new BufferedReader(new FileReader(filePath)); String line = reader.readLine(); while (line != null) { if (line.startsWith("product/productId:")) productID = line.split(" ")[1]; if (line.startsWith("review/userId:")) userID = line.split(" ")[1]; if (line.startsWith("review/score:")) { score = Float.parseFloat(line.split(" ")[1]); addPreference(userID, productID, score); } line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } return null; }

Target:
GenericPreference getPreference(String filePath) { String productID = ""; String userID = ""; Float score = 0.0f; try { BufferedReader reader = new BufferedReader(new FileReader(filePath)); String line = reader.readLine(); while (line != null) { if (line.startsWith("product/productId:")) productID = line.split(" ")[1]; if (line.startsWith("review/userId:")) userID = line.split(" ")[1]; if (line.startsWith("review/score:")) { score = Float.parseFloat(line.split(" ")[1]); addPreference(userID, productID, score); } line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } return null; }
Source:
public Airing[] getRelatedAirings(DBObject[] allAirs, boolean controlCPUUsage, boolean ignoreDisabledFlag, boolean legacyKeyword, Map<Integer, Airing[]> airingMap, Carny.CarnyCache cache, StringBuilder sbCache) { if (allAirs == null) return Pooler.EMPTY_AIRING_ARRAY; if (sbCache == null) sbCache = new StringBuilder(); List<Airing> rv = null; if (cache == null) rv = new ArrayList<Airing>(); else cache.airWorkCache.clear(); boolean keywordTest = !legacyKeyword && (this.agentMask&(KEYWORD_MASK)) == (KEYWORD_MASK); if(keywordTest) { Show[] shows = wiz.searchShowsByKeyword(getKeyword()); for (Show show : shows) { Airing[] airings = wiz.getAirings(show, 0); for (Airing a : airings) { if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) { if (cache != null) cache.airWorkCache.add(a); else rv.add(a); } } } } else { if (cache != null) { optimizedFollowsTrend(true, controlCPUUsage, false, ignoreDisabledFlag, airingMap, allAirs, cache, false, "allAirs"); } else { for (int i = 0; i < allAirs.length; i++) { Airing a = (Airing) allAirs[i]; if (a == null) continue; if (followsTrend(a, true, sbCache)) rv.add(a); if ((i % CPU_CONTROL_MOD_COUNT) == 0 && controlCPUUsage) try {Thread.sleep(Carny.SLEEP_PERIOD);} catch (Exception e) } } } return cache != null ? Pooler.EMPTY_AIRING_ARRAY : rv.toArray(Pooler.EMPTY_AIRING_ARRAY); }

Target:
public Airing[] getRelatedAirings(DBObject[] allAirs, boolean controlCPUUsage, boolean ignoreDisabledFlag, boolean legacyKeyword, Map<Integer, Airing[]> airingMap, Carny.CarnyCache cache, StringBuilder sbCache) { if (allAirs == null) return Pooler.EMPTY_AIRING_ARRAY; if (sbCache == null) sbCache = new StringBuilder(); List<Airing> rv = null; if (cache == null) rv = new ArrayList<Airing>(); else cache.airWorkCache.clear(); boolean keywordTest = !legacyKeyword && (this.agentMask&(KEYWORD_MASK)) == (KEYWORD_MASK); if(keywordTest) { Show[] shows = wiz.searchShowsByKeyword(getKeyword()); for (Show show : shows) { Airing[] airings = wiz.getAirings(show, 0); if (cache != null) cache.airWorkCache.ensureAddCapacity(airings.length); for (Airing a : airings) { if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) { if (cache != null) cache.airWorkCache.add(a); else rv.add(a); } } } } else { if (cache != null) { optimizedFollowsTrend(true, controlCPUUsage, false, ignoreDisabledFlag, airingMap, allAirs, cache, "allAirs"); } else { for (int i = 0; i < allAirs.length; i++) { Airing a = (Airing) allAirs[i]; if (a == null) continue; if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) rv.add(a); if ((i % CPU_CONTROL_MOD_COUNT) == 0 && controlCPUUsage) try {Thread.sleep(Carny.SLEEP_PERIOD);} catch (Exception e) } } } return cache != null ? Pooler.EMPTY_AIRING_ARRAY : rv.toArray(Pooler.EMPTY_AIRING_ARRAY); }
Source:
private void setFault(CompletionTime completionTime, List<BinaryAnnotation> binaryAnnotations) { List<HttpCodesUtil.HttpCode> errorCodes = HttpCodesUtil.getClientOrServerErrors(HttpCodesUtil.getHttpStatusCode(binaryAnnotations)); if (errorCodes.size() > 0) { completionTime.setFault(errorCodes.iterator().next().getDescription()); } }

Target:
private void setFault(CompletionTime completionTime, List<BinaryAnnotation> binaryAnnotations) { List<HttpCodesUtil.HttpCode> errorCodes = HttpCodesUtil.getClientOrServerErrors(HttpCodesUtil.getHttpStatusCodes(binaryAnnotations)); if (errorCodes.size() > 0) { HttpCodesUtil.HttpCode errorCode = errorCodes.iterator().next(); completionTime.setFault(errorCode.getDescription()); completionTime.getProperties().add(new Property("http.status_code", String.valueOf(errorCode.getCode()))); } }
Source:
private boolean haveNotExpiredFailedDestination(URI uri) { if(!failedDestinations.containsKey(uri)) return false; else { long failureTimestamp = failedDestinations.get(uri); long delta = System.currentTimeMillis() - failureTimestamp; return delta < 5000; } }

Target:
private boolean haveNotExpiredFailedDestination(URI uri) { if(!failedDestinations.containsKey(uri)) return false; else { long failureTimestamp = failedDestinations.get(uri); long delta = System.nanoTime() - failureTimestamp; return delta < DESTINATION_RECHECK_INTERVAL; } }
Source:
private @Nullable Collection<@NonNull ISegment> getSegmentStore(long start, long end) { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; if (segmentStoreProviderModule == null) { return null; } ITmfTrace trace = getTrace(); if (!(segmentStoreProviderModule instanceof ISegmentStoreProvider) || (trace == null)) { return Collections.EMPTY_LIST; } segmentStoreProviderModule.waitForCompletion(); @Nullable ISegmentStore<@NonNull ISegment> segmentStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); return segmentStore != null ? start != TmfTimeRange.ETERNITY.getStartTime().toNanos() || end != TmfTimeRange.ETERNITY.getEndTime().toNanos() ? (Collection<@NonNull ISegment>) segmentStore.getIntersectingElements(start, end) : segmentStore : Collections.EMPTY_LIST; }

Target:
private @Nullable Collection<@NonNull ISegment> getSegmentStore(long start, long end) { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; if (!(segmentStoreProviderModule instanceof ISegmentStoreProvider)) { return null; } segmentStoreProviderModule.waitForCompletion(); @Nullable ISegmentStore<@NonNull ISegment> segmentStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); return segmentStore != null ? start != TmfTimeRange.ETERNITY.getStartTime().toNanos() || end != TmfTimeRange.ETERNITY.getEndTime().toNanos() ? (Collection<@NonNull ISegment>) segmentStore.getIntersectingElements(start, end) : segmentStore : Collections.EMPTY_LIST; }
Source:
public void setStartDate(Date startDate) { this.startDate = startDate; }

Target:
public void setStartDate(Date startDate) { this.startDate = startDate == null ? null : new Date(startDate.getTime()); }
Source:
public void run(RefactoringWizard wizard, Shell parent) { try { RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation( wizard); DeleteQ7ElementProcessor processor = (DeleteQ7ElementProcessor) wizard.getRefactoring() .getAdapter(DeleteQ7ElementProcessor.class); if (processor == null || (processor != null && checkWritableRefrences(processor))) { operation.run(parent, wizard.getWindowTitle()); } } catch (InterruptedException exception) { } }

Target:
public void run(RefactoringWizard wizard, Shell parent) { try { RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation( wizard); operation.run(parent, wizard.getWindowTitle()); } catch (InterruptedException exception) { } }
Source:
protected Filter.FilterResults performFiltering(CharSequence constraint) { String filterString = constraint.toString().toLowerCase(); final ArrayList<T> list = new ArrayList<T>(rowValueList.size()); for (T item : rowValueList) { for (ListItemFilter filterCriteria : filterItemList) { if (filterCriteria.passes(item, filterString)) { list.add(item); } } } FilterResults results = new FilterResults(); results.values = list; results.count = list.size(); return results; }

Target:
protected Filter.FilterResults performFiltering(CharSequence constraint) { String filterString = constraint.toString().toLowerCase(); final ArrayList<T> list = new ArrayList<T>(); for (T item : rowValueList) { if (listItemFilter.passes(item, filterString)) { list.add(item); } } FilterResults results = new FilterResults(); results.values = list; results.count = list.size(); return results; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.stats_loading_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setTitle(R.string.stats); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } String action = getIntent().getAction(); Uri uri = getIntent().getData(); AnalyticsUtils.trackWithDeepLinkData(AnalyticsTracker.Stat.DEEP_LINKED, action, uri); if (Intent.ACTION_VIEW.equals(action) && uri != null) { reason = uri.getQueryParameter("reason"); source = Source.fromString(uri.getQueryParameter("source")); if (mAccountStore.hasAccessToken()) { trackSuccess(source); if (source == Source.STATS) { showStats(); } else { finish(); } } else { Intent loginIntent = new Intent(this, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); this.startActivityForResult(loginIntent, JETPACK_LOGIN); } } else { finish(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.stats_loading_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setTitle(R.string.stats); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } String action = getIntent().getAction(); Uri uri = getIntent().getData(); AnalyticsUtils.trackWithDeepLinkData(Stat.DEEP_LINKED, action, uri); if (Intent.ACTION_VIEW.equals(action) && uri != null) { mReason = uri.getQueryParameter(REASON_PARAM); mSource = Source.fromString(uri.getQueryParameter(SOURCE_PARAM)); if (mAccountStore.hasAccessToken()) { trackResult(); finishAndGoBackToSource(); } else { Intent loginIntent = new Intent(this, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); this.startActivityForResult(loginIntent, JETPACK_LOGIN); } } else { finish(); } }
Source:
public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() { final Capabilities capabilities = new Capabilities(false, true); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")) .thenReturn("<div>This is a agent status report snippet.</div>"); final String pluginStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id"); assertThat(pluginStatusReport, is("<div>This is a agent status report snippet.</div>")); }

Target:
public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() { final Capabilities capabilities = new Capabilities(false, true); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")) .thenReturn("<div>This is a agent status report snippet.</div>"); final String agentStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id"); assertThat(agentStatusReport, is("<div>This is a agent status report snippet.</div>")); }
Source:
protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { if (caught instanceof RemoteJsonException && !isFirst) { historyTable.enableAll(true); showPatch(false); } else { super.onFailure(caught); } } } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }

Target:
protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { super.onFailure(caught); } } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }
Source:
public String render() { TypeSpec.Builder tableFactory = TypeSpec.classBuilder(getClassName()) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addAnnotation(AnnotationSpec.builder(Generated.class) .addMember("value", "$S", TableFactoryRenderer.class.getName()) .build()); for (FieldSpec field : getFields()) { tableFactory.addField(field); } for (TypeSpec subType : getSubTypes()) { tableFactory.addType(subType); } for (MethodSpec method : getConstructors()) { tableFactory.addMethod(method); } for (MethodSpec method : getMethods()) { tableFactory.addMethod(method); } JavaFile javaFile = JavaFile.builder(packageName, tableFactory.build()) .indent(" ") .build(); return javaFile.toString(); }

Target:
public String render() { TypeSpec.Builder tableFactory = TypeSpec.classBuilder(getClassName()) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addAnnotation(AnnotationSpec.builder(Generated.class) .addMember("value", "$S", TableFactoryRenderer.class.getName()) .build()); buildFactory(this::getFields, tableFactory::addField); buildFactory(this::getSubTypes, tableFactory::addType); buildFactory(this::getConstructors, tableFactory::addMethod); buildFactory(this::getMethods, tableFactory::addMethod); JavaFile javaFile = JavaFile.builder(packageName, tableFactory.build()) .indent(" ") .build(); return javaFile.toString(); }
Source:
KafkaConsumer cqlContentBootstrapWorker() { ContentBootstrapWorker worker = ContentBootstrapWorker.create( persistence.legacyContentResolver(), persistence.cqlContentStore(), metricsModule.metrics().timer("CqlContentBootstrapWorker"), metricsModule.metrics().meter("CqlContentBootstrapWorker.notWritten"), metricsModule.metrics().meter("CqlContentBootstrapWorker.errorRate") ); return bootstrapQueueFactory() .createConsumer( worker, new EntityUpdatedLegacyMessageSerializer(), contentChanges, "CqlContentBootstrap" ) .withConsumerSystem(consumerSystem) .withDefaultConsumers(contentChangesNumOfConsumers) .withMaxConsumers(contentChangesNumOfConsumers) .withPersistentRetryPolicy(persistence.databasedWriteMongo()) .build(); }

Target:
KafkaConsumer cqlContentBootstrapWorker() { ContentBootstrapWorker worker = ContentBootstrapWorker.create( persistence.legacyContentResolver(), persistence.cqlContentStore(), metricsModule.metrics().timer("CqlContentBootstrapWorker"), metricsModule.metrics().meter("CqlContentBootstrapWorker.notWritten"), metricsModule.metrics().meter("CqlContentBootstrapWorker.errorRate") ); return bootstrapQueueFactory() .createConsumer( worker, new EntityUpdatedLegacyMessageSerializer(), contentChanges, "CqlContentBootstrap" ) .withConsumerSystem(consumerSystem) .withDefaultConsumers(cqlContentChangesNumOfConsumers) .withMaxConsumers(cqlContentChangesNumOfConsumers) .withPersistentRetryPolicy(persistence.databasedWriteMongo()) .build(); }
Source:
String convert(Blob blob) { if (blob.getLength() == 0L) { return ""; } try (InputStream stream = blob.getStream()) { Xml2TextHandler xml2text = new Xml2TextHandler(); return xml2text.parse(stream); } catch (IOException | SAXException | ParserConfigurationException e) { throw new ConversionException("Error during XML2Text conversion", e, blob); } }

Target:
protected String convert(Blob blob) { if (blob.getLength() == 0L) { return ""; } try (InputStream stream = blob.getStream()) { Xml2TextHandler xml2text = new Xml2TextHandler(); return xml2text.parse(stream); } catch (IOException | SAXException | ParserConfigurationException e) { throw new ConversionException("Error during XML2Text conversion", blob, e); } }
Source:
void asyncDiscardCheckpointAndCountCheckpoint(ThrowingConsumer<CompletedCheckpoint, Exception> discardCallback, Executor executor){ cleanCallback.accept(() -> { try { discardCallback.accept(this); } catch (Exception e) { LOG.warn("Could not discard completed checkpoint {}.", checkpointID, e); } }, checkpointCleaningFinishedCallback, executor); }

Target:
void asyncDiscardCheckpointAndCountCheckpoint(ThrowingConsumer<CompletedCheckpoint, Exception> discardCallback, Executor executor){ cleanupCallback.accept(() -> { try { discardCallback.accept(this); } catch (Exception e) { LOG.warn("Could not discard completed checkpoint {}.", checkpointID, e); } }, cleanupFinishedCallback, executor); }
Source:
public void activate() { logger.info("Activate DSC Alarm"); }

Target:
public void activate() { logger.debug("Activate DSC Alarm"); }
Source:
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { OGCGeometry leftGeometry = deserialize(leftBlock.getSlice(leftPosition, 0, leftBlock.getSliceLength(leftPosition))); OGCGeometry rightGeometry = deserialize(rightBlock.getSlice(rightPosition, 0, rightBlock.getSliceLength(rightPosition))); return leftGeometry.Equals(rightGeometry); }

Target:
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { if (leftBlock.isNull(leftPosition)) { return rightBlock.isNull(rightPosition); } if (rightBlock.isNull(rightPosition)) { return false; } OGCGeometry leftGeometry = deserialize(leftBlock.getSlice(leftPosition, 0, leftBlock.getSliceLength(leftPosition))); OGCGeometry rightGeometry = deserialize(rightBlock.getSlice(rightPosition, 0, rightBlock.getSliceLength(rightPosition))); return leftGeometry.Equals(rightGeometry); }
Source:
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, Set<TaskStatus> statusFilter, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { String userName = null; if (mytasks) { userName = frontendState.checkPermission("frontendState", "You do not have permission to use frontendState") .getUsername(); } return dbManager.getTaskStates(from, to, taskTag, offset, limit, userName, statusFilter, sortParams); }

Target:
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, Set<TaskStatus> statusFilter, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { String userName = null; if (mytasks) { userName = frontendState.checkPermission("getTaskStates", "You do not have permission to use frontendState") .getUsername(); } return dbManager.getTaskStates(from, to, taskTag, offset, limit, userName, statusFilter, sortParams); }
Source:
public void testBrokenSymlinkAttributes() throws Exception { if (!canCreateSymLinks()) return; makeLinkStructure(); ensureDoesNotExist(aDir); ensureDoesNotExist(aFile); fetchFileInfos(); assertFalse(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertFalse(illFile.exists()); assertFalse(illFile.isDirectory()); assertFalse(ilDir.exists()); assertFalse(ilDir.isDirectory()); assertFalse(illDir.exists()); assertFalse(illDir.isDirectory()); assertEquals(ilFile.getLastModified(), 0); assertEquals(ilFile.getLength(), 0); assertEquals(ilDir.getLastModified(), 0); assertEquals(ilDir.getLength(), 0); assertEquals(illFile.getLastModified(), 0); assertEquals(illFile.getLength(), 0); assertEquals(illDir.getLastModified(), 0); assertEquals(illDir.getLength(), 0); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }

Target:
public void testBrokenSymlinkAttributes() { if (!canCreateSymLinks()) return; makeLinkStructure(); ensureDoesNotExist(aDir); ensureDoesNotExist(aFile); fetchFileInfos(); assertFalse(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertFalse(illFile.exists()); assertFalse(illFile.isDirectory()); assertFalse(ilDir.exists()); assertFalse(ilDir.isDirectory()); assertFalse(illDir.exists()); assertFalse(illDir.isDirectory()); assertEquals(ilFile.getLastModified(), 0); assertEquals(ilFile.getLength(), 0); assertEquals(ilDir.getLastModified(), 0); assertEquals(ilDir.getLength(), 0); assertEquals(illFile.getLastModified(), 0); assertEquals(illFile.getLength(), 0); assertEquals(illDir.getLastModified(), 0); assertEquals(illDir.getLength(), 0); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }
Source:
public boolean doIsTablePresent(Connection conn, String tablesTable, String schemaColumn, String tableNameColumn, String schemaName, String tableName) throws JdbcException { boolean isPresent = Boolean.FALSE; if (StringUtils.isNotEmpty(schemaName)) { if (StringUtils.isNotEmpty(schemaColumn)) { isPresent = this.isTablePresent(conn, tablesTable, schemaColumn); } else { throw new JdbcException("no schemaColumn present in table +tablesTable+ to test for presence of table +tableName+ in schema ["+schemaName+"]"); } } try { isPresent = this.isTablePresent(conn, tablesTable); } catch (Exception e) { log.warn("could not determine presence of table ["+tableName+"]",e); } return isPresent; }

Target:
protected boolean doIsTablePresent(Connection conn, String tablesTable, String schemaColumn, String tableNameColumn, String schemaName, String tableName) throws JdbcException { String query="select count(*) from "+tablesTable+" where upper("+tableNameColumn+")=?"; if (StringUtils.isNotEmpty(schemaName)) { if (StringUtils.isNotEmpty(schemaColumn)) { query+=" and upper("+schemaColumn+")='"+schemaName.toUpperCase()+"'"; } else { throw new JdbcException("no schemaColumn present in table +tablesTable+ to test for presence of table +tableName+ in schema ["+schemaName+"]"); } } try { return JdbcUtil.executeIntQuery(conn, query, tableName.toUpperCase())>=1; } catch (Exception e) { log.warn("could not determine presence of table ["+tableName+"]",e); return false; } }
Source:
void handlePriorityChange(StreamPriority streamPriority) { System.out.println(getClass().getName() + ".handlePriorityChange(" + streamPriority + ")"); synchronized (conn) { Handler<StreamPriority> handler = streamPriorityHandler; if (handler != null) { if(streamPriority != null && !streamPriority.equals(getStreamPriority())) { setStreamPriority(streamPriority); handler.handle(streamPriority); } } } }

Target:
void handlePriorityChange(StreamPriority streamPriority) { Handler<StreamPriority> handler; boolean priorityChanged = false; synchronized (conn) { handler = streamPriorityHandler; if(streamPriority != null && !streamPriority.equals(streamPriority())) { priority(streamPriority); priorityChanged = true; } } if (handler != null && priorityChanged) { handler.handle(streamPriority); } }
Source:
public static String encodeTo(String url, String text) { text = text.replace('\n', ' '); try { return new ModelHyperlinkNote(url,text.length()).encode()+text; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to serialize "+ModelHyperlinkNote.class,e); return text; } }

Target:
public static String encodeTo(String url, String text) { return HyperlinkNote.encodeTo(url, text, ModelHyperlinkNote::new); }
Source:
public CouchDBMapping build() { if (mapping.getDatabaseName() == null) throw new IllegalStateException("A collection is not specified"); return mapping; }

Target:
public CouchDBMapping build() { if (mapping.getDatabaseName() == null) { LOG.error("A collection is not specified"); throw new IllegalStateException("A collection is not specified"); } return mapping; }
Source:
public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); this.message = parameters.getString("message"); this.randomizedMessages = parameters.getStringList("randomized_messages"); this.translateAltColorCodes = parameters.getBoolean("translate_alt_color_codes", true); this.altColorCode = parameters.getString("alt_color_code", "&").charAt(0); }

Target:
public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); this.message = context.getMessage(parameters.getString("message"), translate(parameters.getString("message"))); List<String> l = parameters.getStringList("randomized_messages"); if (!l.isEmpty()) this.message = translate(l.get(context.getRandom().nextInt(l.size()))); }
Source:
public void populateOptions(WidgetConfig config, CodedWidget widget) { List<Indicator> l = null; String tag = config.getAttributeValue("tag", null); if (tag != null) { l = Context.getService(IndicatorService.class).getDefinitionsByTag(tag); } else { l = Context.getService(IndicatorService.class).getAllDefinitions(false); } for (Indicator d : l) { if (d instanceof CohortIndicator) { widget.addOption(new Option(d.getUuid(), d.getName(), null, d), config); } } }

Target:
public void populateOptions(WidgetConfig config, CodedWidget widget) { List<Indicator> listOfAllIndicators = null; String tag = config.getAttributeValue("tag", null); if (tag != null) { listOfAllIndicators = Context.getService(IndicatorService.class).getDefinitionsByTag(tag); } else { listOfAllIndicators = Context.getService(IndicatorService.class).getAllDefinitions(false); } for (Indicator indicator : listOfAllIndicators) { if (indicator instanceof CohortIndicator) { widget.addOption(new Option(indicator.getUuid(), indicator.getName(), null, indicator), config); } } }
Source:
public URI uploadPackage() throws UploaderException { boolean fileExists = new File(topologyPackageLocation).isFile(); if (!fileExists) { throw new UploaderException( String.format("Topology file %s does not exist.", topologyPackageLocation)); } Path filePath = Paths.get(destTopologyFile); File parentDirectory = filePath.getParent().toFile(); assert parentDirectory != null; if (!parentDirectory.exists()) { LOG.fine("The working directory does not exist; creating it."); if (!parentDirectory.mkdirs()) { throw new UploaderException( String.format("Failed to create directory: %s", parentDirectory.getPath())); } } fileExists = new File(filePath.toString()).isFile(); if (fileExists) { LOG.fine("Target topology file " + filePath.toString() + " exists, overwriting..."); } LOG.fine("Copying topology " + topologyPackageLocation + " package to target working directory " + filePath.toString()); Path source = Paths.get(topologyPackageLocation); try { CopyOption[] options = new CopyOption[]{StandardCopyOption.REPLACE_EXISTING}; Files.copy(source, filePath, options); } catch (IOException ex) { throw new UploaderException( String.format("Unable to copy: %s %s", source.toString(), ex)); } return getUri(destTopologyFile); }

Target:
public URI uploadPackage() throws UploaderException { boolean fileExists = new File(topologyPackageLocation).isFile(); if (!fileExists) { throw new UploaderException( String.format("Topology package does not exist at '%s'", topologyPackageLocation)); } Path filePath = Paths.get(destTopologyFile); File parentDirectory = filePath.getParent().toFile(); assert parentDirectory != null; if (!parentDirectory.exists()) { LOG.fine(String.format( "Working directory does not exist. Creating it now at %s", parentDirectory.getPath())); if (!parentDirectory.mkdirs()) { throw new UploaderException( String.format("Failed to create directory for topology package at %s", parentDirectory.getPath())); } } fileExists = new File(filePath.toString()).isFile(); if (fileExists) { LOG.fine(String.format("Target topology package already exists at '%s'. Overwriting it now", filePath.toString())); } LOG.fine(String.format("Copying topology package at '%s' to target working directory '%s'", topologyPackageLocation, filePath.toString())); Path source = Paths.get(topologyPackageLocation); try { CopyOption[] options = new CopyOption[]{StandardCopyOption.REPLACE_EXISTING}; Files.copy(source, filePath, options); } catch (IOException e) { throw new UploaderException( String.format("Unable to copy topology file from '%s' to '%s'", source, filePath), e); } return getUri(destTopologyFile); }
Source:
public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); checkConfig.addAttribute("ignoreLines", ""); verify(checkConfig, getPath("InputHeaderBlankLines.java")); }

Target:
public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); verify(checkConfig, getPath("InputHeaderBlankLines.java")); }
Source:
public AnnouncementCardView(Context context) { super(context); inflate(getContext(), R.layout.view_card_announcement, this); ButterKnife.bind(this); }

Target:
public AnnouncementCardView(Context context) { super(context); inflate(context, R.layout.view_card_announcement, this); ButterKnife.bind(this); }
Source:
public void testSelectFloorOnTimeWithFilterOnFloorOnTime() { final String sql = "Select floor(\"__time\" to YEAR) as t from \"wikiticker\" " + "where floor(\"__time\" to YEAR) >= '2006-10-01 00:00:00 UTC' order by t limit 1"; final String druidQueryPart1 = "filter\":{\"type\":\"bound\",\"dimension\":\"__time\"," + "\"lower\":\"2006-10-01T00:00:00.000Z\",\"lowerStrict\":false," + "\"ordering\":\"lexicographic\",\"extractionFn\":{\"type\":\"timeFormat\"," + "\"format\":\"yyyy-MM-dd"; final String druidQueryPart2 = "\"granularity\":\"year\",\"timeZone\":\"UTC\"," + "\"locale\":\"en-US\"}},\"dimensions\":[],\"metrics\":[],\"granularity\":\"all\""; sql(sql, WIKI_AUTO2).queryContains(druidChecker(druidQueryPart1, druidQueryPart2)) .returnsOrdered("T=1420070400000"); }

Target:
public void testSelectFloorOnTimeWithFilterOnFloorOnTime() { final String sql = "Select cast(floor(\"timestamp\" to MONTH) as timestamp) as t from " + "\"foodmart\" where floor(\"timestamp\" to MONTH) >= '1997-05-01 00:00:00 UTC' order by t" + " limit 1"; final String druidQueryPart1 = "filter\":{\"type\":\"bound\",\"dimension\":\"__time\"," + "\"lower\":\"1997-05-01T00:00:00.000Z\",\"lowerStrict\":false," + "\"ordering\":\"lexicographic\",\"extractionFn\":{\"type\":\"timeFormat\"," + "\"format\":\"yyyy-MM-dd"; final String druidQueryPart2 = "\"granularity\":\"month\",\"timeZone\":\"UTC\"," + "\"locale\":\"en-US\"}},\"columns\":[\"__time\"],\"granularity\":\"all\""; sql(sql, FOODMART).queryContains(druidChecker(druidQueryPart1, druidQueryPart2)) .returnsOrdered("T=1997-05-01 00:00:00"); }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (!getHelper().isPage200(msg)) { return; } String uri = msg.getRequestHeader().getURI().toString(); if (!msg.getResponseHeader().isImage() && !msg.getRequestHeader().isCss() && !msg.getResponseHeader().isCss()) { Repo repo = getRepo(); if (repo == null) { return; } Result result = getRepo().scanJS(msg); if (result == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("\tNo vulnerabilities found in record " + id + " with URL " + uri); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "\tVulnerabilities found in record " + id + " with URL:" + uri + " ,name:" + ((result.getFilename() == null) ? "" : result.getFilename()) + " and version:" + result.getVersion() + ", more info at:" + result.getInfo()); } String otherInfo = getDetails(Result.CVE, result.getInfo()); if (result.hasOtherInfo()) { otherInfo = otherInfo + result.getOtherinfo(); } buildAlert(result, otherInfo).raise(); } } }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (!getHelper().isPage200(msg) || getRepo() == null) { return; } String uri = msg.getRequestHeader().getURI().toString(); if (!msg.getResponseHeader().isImage() && !msg.getRequestHeader().isCss() && !msg.getResponseHeader().isCss()) { Result result = getRepo().scanJS(msg); if (result == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("\tNo vulnerabilities found in record " + id + " with URL " + uri); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "\tVulnerabilities found in record " + id + " with URL:" + uri + " ,name:" + ((result.getFilename() == null) ? "" : result.getFilename()) + " and version:" + result.getVersion() + ", more info at:" + result.getInfo()); } String otherInfo = getDetails(Result.CVE, result.getInfo()); if (result.hasOtherInfo()) { otherInfo = otherInfo + result.getOtherinfo(); } buildAlert(result, otherInfo).raise(); } } }
Source:
public static void xmlClose(IBuffer result, String indent, String tag, String comment) { result.append(indent).append("</").append(tag).append(">") .append(Strings.isNotNullAndNotEmpty(comment) ? comment : "") .append(EOL); }

Target:
public static void xmlClose(IBuffer result, String indent, String tag, String comment) { result.append(indent).append("</").append(tag).append(">") .append(Strings.getValueOrEmpty(comment)) .append(EOL); }
Source:
public void execute(JobExecutionContext context) throws JobExecutionException { try { startManagedResources(); if(this.consumer instanceof ScheduledComponent) { JobDetail jobDetail = ((ScheduledComponent<JobDetail>)consumer).getJobDetail(); Trigger trigger = newTrigger() .withIdentity(triggerKey(jobDetail.getKey().getName(), jobDetail.getKey().getGroup() )) .startNow() .withSchedule(simpleSchedule().withMisfireHandlingInstructionNextWithRemainingCount()) .build(); Date scheduledDate = scheduler.scheduleJob(jobDetail, trigger); if(logger.isDebugEnabled()) { logger.debug("RecoveryManager scheduled callback on consumer flow [" + trigger.getKey().getName() + "] module [" + trigger.getKey().getGroup() + "] for [" + scheduledDate + "]"); } } else { this.consumer.start(); if(!isEventBaseRecovery) { recoveryAttempts = 0; } } } catch(Throwable throwable) { this.recover(this.previousComponentName, throwable); } }

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { try { startManagedResources(); if(this.consumer instanceof ScheduledComponent) { JobDetail jobDetail = ((ScheduledComponent<JobDetail>)consumer).getJobDetail(); Trigger trigger = newTrigger() .withIdentity(triggerKey(jobDetail.getKey().getName(), jobDetail.getKey().getGroup() )) .startNow() .withSchedule(simpleSchedule().withMisfireHandlingInstructionNextWithRemainingCount()) .build(); Date scheduledDate = scheduler.scheduleJob(jobDetail, trigger); if(logger.isDebugEnabled()) { logger.debug("RecoveryManager scheduled callback on consumer flow [" + trigger.getKey().getName() + "] module [" + trigger.getKey().getGroup() + "] for [" + scheduledDate + "]"); } } else { this.consumer.start(); } if(!isEventBaseRecovery) { cancelAll(); } } catch(Throwable throwable) { this.recover(this.previousComponentName, throwable); } }
Source:
private void updateTransactionsWithRetry(long paymentRequestId, long retries) { try { setCreatedDateOnTransactions(paymentRequestId); } catch (Exception exc) { if (retries < 3) { logger.error("Problem migrating [" + paymentRequestId + "] " + exc.getMessage() + " retry count [" + retries + "]"); updateTransactionsWithRetry(paymentRequestId, retries + 1); } else { throw exc; } } }

Target:
private void updateTransactionsWithRetry(long paymentRequestId, long retries) { try { setCreatedDateOnTransactions(paymentRequestId); } catch (Exception exc) { if (retries < 3) { logger.error("Problem migrating [" + paymentRequestId + "] " + " retry count [" + retries + "]", exc ); updateTransactionsWithRetry(paymentRequestId, retries + 1); } else { throw exc; } } }
Source:
public static boolean isNetworkActive(Context context) { boolean isNetworkActive = true; ConnectivityManager cm = (ConnectivityManager)context. getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); if (activeNetwork == null || (activeNetwork!= null && !activeNetwork.isConnectedOrConnecting())) { isNetworkActive = false; } return isNetworkActive; }

Target:
public static boolean isNetworkActive(Context context) { ConnectivityManager cm = (ConnectivityManager)context. getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return (activeNetwork != null && activeNetwork.isConnectedOrConnecting()); }
Source:
public void commit(final Xid xid, final boolean arg1) throws XAException { System.out.println("DummyXAResource commit() called, fault: " + fault + " xid: " + xid); commitCalled = true; commitRequests += 1; if (fault != null) { if (fault.equals(faultType.EX)) { throw new XAException(XAException.XA_RBTRANSIENT); } else if (fault.equals(faultType.HALT)) { recoveryXids = new Xid[1]; recoveryXids[0] = xid; Runtime.getRuntime().halt(1); } } }

Target:
public void commit(final Xid xid, final boolean arg1) throws XAException { System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource XA_COMMIT [" + xid + "] with fault " + fault); commitRequests += 1; if (fault != null) { if (fault.equals(faultType.HALT)) { Runtime.getRuntime().halt(1); } } System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource commitRequests = " + commitRequests); if (file != null) { if (!file.delete()) { throw new XAException(XAException.XA_RETRY); } } this.xid = null; }
Source:
private void checkSnapshotReadiness(AuthenticatedContext ac, AmazonEC2Client client, CreateSnapshotResult snapshotResult) { Waiter<DescribeSnapshotsRequest> snapshotWaiter = client.waiters().snapshotCompleted(); DescribeSnapshotsRequest describeSnapshotsRequest = new DescribeSnapshotsRequest().withSnapshotIds(snapshotResult.getSnapshot().getSnapshotId()); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(ac.getCloudContext().getId()); run(snapshotWaiter, describeSnapshotsRequest, stackCancellationCheck, "Snapshot creation failed"); }

Target:
private void checkSnapshotReadiness(AuthenticatedContext ac, AmazonEC2Client client, CreateSnapshotResult snapshotResult) { Waiter<DescribeSnapshotsRequest> snapshotWaiter = client.waiters().snapshotCompleted(); DescribeSnapshotsRequest describeSnapshotsRequest = new DescribeSnapshotsRequest().withSnapshotIds(snapshotResult.getSnapshot().getSnapshotId()); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(ac.getCloudContext().getId()); run(snapshotWaiter, describeSnapshotsRequest, stackCancellationCheck, String.format("Snapshot creation failed (snapshot id: %s)", snapshotResult.getSnapshot().getSnapshotId())); }
Source:
public ArrayList<IPartWork> getSalvageableParts(boolean onlyNotBeingWorkedOn) { ArrayList<IPartWork> salvageParts = new ArrayList<IPartWork>(); for(Part part: parts) { if(part.isSalvaging() && (!onlyNotBeingWorkedOn || (onlyNotBeingWorkedOn && !part.isBeingWorkedOn()))) { salvageParts.add(part); } } for (PodSpace pod : podSpace) { if (pod.hasSalvageableParts() && (!onlyNotBeingWorkedOn || (onlyNotBeingWorkedOn && !pod.isBeingWorkedOn()))) { salvageParts.add(pod); } } return salvageParts; }

Target:
public ArrayList<IPartWork> getSalvageableParts(boolean onlyNotBeingWorkedOn) { ArrayList<IPartWork> salvageParts = new ArrayList<IPartWork>(); for(Part part: parts) { if(part.isSalvaging() && isPartAvailableForRepairs(part, onlyNotBeingWorkedOn)) { salvageParts.add(part); } } for (PodSpace pod : podSpace) { if (pod.hasSalvageableParts() && isPartAvailableForRepairs(pod, onlyNotBeingWorkedOn)) { salvageParts.add(pod); } } return salvageParts; }
Source:
public String relationship() { if (relationship == null) { initRelationship(); } return relationship.orElse(null); }

Target:
public String relationship() { Optional<String> localRelationshipType = relationshipType; if (localRelationshipType == null) { synchronized (this) { localRelationshipType = relationshipType; if (localRelationshipType == null) { localRelationshipType = initRelationship(); relationshipType = localRelationshipType; } } } return localRelationshipType.orElse(null); }
Source:
public static void createSecret(KubernetesClient client, String namespace) { Secret secret = new SecretBuilder() .withStringData(ImmutableMap.of(SECRET_KEY, CONTAINER_ENV_VAR_FROM_SECRET_VALUE)).withNewMetadata() .withName("container-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created container secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, POD_ENV_VAR_FROM_SECRET_VALUE)) .withNewMetadata().withName("pod-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, EMPTY_POD_ENV_VAR_FROM_SECRET_VALUE)) .withNewMetadata().withName("empty-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); }

Target:
public static void createSecret(KubernetesClient client, String namespace) { Secret secret = new SecretBuilder() .withStringData(ImmutableMap.of(SECRET_KEY, CONTAINER_ENV_VAR_FROM_SECRET_VALUE)).withNewMetadata() .withName("container-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created container secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, POD_ENV_VAR_FROM_SECRET_VALUE)) .withNewMetadata().withName("pod-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, "")) .withNewMetadata().withName("empty-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); }
Source:
public void shouldSetModel() throws Exception { ModelAndView responseModel = authorizationController.login(false, request, response); Map<String, Object> modelMap = responseModel.getModel(); assertEquals(modelMap.get("login_error"), false); assertEquals(modelMap.get("l"), localizer); assertEquals(modelMap.get("authentication_plugin_registry"), authenticationPluginRegistry); }

Target:
public void shouldSetModel() throws Exception { ModelAndView responseModel = authorizationController.login(false, response); Map<String, Object> modelMap = new ModelMap() {{ put("login_error", false); put("l", localizer); put("authentication_plugin_registry", authenticationPluginRegistry); }}; Map<String, Object> responseModelMap = responseModel.getModel(); assertThat(responseModelMap, is(modelMap)); }
Source:
public State getWizardState() { return new State(isWizardClosed() ? InnerState.CLOSED : InnerState.OPEN); }

Target:
private State getWizardState() { return new State(isWizardClosed() ? InnerState.CLOSED : InnerState.OPEN); }