auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void getPreAuthToken(ProgressIndicator indicator) { getPreAuthToken(result_, result_.getServerInfo(), indicator, new OperationWithInput<NewRSConnectAccountResult>() { @Override public void execute(NewRSConnectAccountResult input) { result_ = input; contents_.setClaimLink(result_.getServerInfo().getName(), result_.getPreAuthToken().getClaimUrl()); waitingForAuth_.setValue(true, true); contents_.showWaiting(); if (canSpawnAuthenticationWindow()) { NewWindowOptions options = new NewWindowOptions(); options.setName(AUTH_WINDOW_NAME); options.setAllowExternalNavigation(true); options.setShowDesktopToolbar(false); display_.openWebMinimalWindow( result_.getPreAuthToken().getClaimUrl(), false, 700, 800, options); } pollForAuthCompleted(); } }); }

Target:
private void getPreAuthToken(ProgressIndicator indicator) { getPreAuthToken(result_, result_.getServerInfo(), indicator, new OperationWithInput<NewRSConnectAccountResult>() { @Override public void execute(NewRSConnectAccountResult input) { result_ = input; contents_.setClaimLink(result_.getServerInfo().getName(), result_.getPreAuthToken().getClaimUrl()); waitingForAuth_.setValue(true, true); contents_.showWaiting(); if (canSpawnAuthenticationWindow()) { NewWindowOptions options = new NewWindowOptions(); options.setName(AUTH_WINDOW_NAME); options.setAllowExternalNavigation(true); options.setShowDesktopToolbar(false); display_.openWebMinimalWindow( result_.getPreAuthToken().getClaimUrl(), false, 700, 800, options); } else { Desktop.getFrame().browseUrl(result_.getPreAuthToken().getClaimUrl()); } pollForAuthCompleted(); } }); }
Source:
protected boolean shouldExpire(long threshold, long timestamp) { if (threshold > -1) { long currentTime = currentTimeMillis(); if (timestamp > currentTime || currentTime - timestamp > threshold) return true; } return false; }

Target:
public static boolean shouldExpire(long threshold, long timestamp) { if (threshold > -1 && timestamp > -1) { long currentTime = currentTimeMillis(); if (currentTime - timestamp > threshold) return true; } return false; }
Source:
synchronized boolean containsWatcher(String path, Watcher watcher) { PathIterator pathIterator = new PathIterator(path); while (pathIterator.hasNext()) { String localPath = pathIterator.next(); Map<Watcher, Type> watchers = watchTable.get(localPath); Type watcherType = (watchers != null) ? watchers.get(watcher) : null; if ((watcherType == Type.STANDARD) && !pathIterator.atParentPath()) { return true; } if (watcherType == Type.PERSISTENT) { return true; } } return false; }

Target:
synchronized boolean containsWatcher(String path, Watcher watcher) { PathParentIterator pathParentIterator = getPathParentIterator(path); for (String localPath : pathParentIterator.asIterable()) { Map<Watcher, Type> watchers = watchTable.get(localPath); Type watcherType = (watchers != null) ? watchers.get(watcher) : null; if ( !pathParentIterator.atParentPath() ) { if ( watcherType != null ) { return true; } } if (watcherType == Type.PERSISTENT_RECURSIVE) { return true; } } return false; }
Source:
public void testSampleExtremeCoverageVarianceWithoutRejectionFile(final List<SampleCoverageStats> sampleStats, final double min, final double max) throws IOException { final File samplesFile = createSampleStatsFile(sampleStats); final List<SampleCoverageStats> leftInSamples = sampleStats.stream() .filter(stats -> stats.variance >= min && stats.variance <= max) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); runCommandLine(new String[] { "-" + StandardArgumentDefinitions.INPUT_SHORT_NAME, samplesFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterSamples.MINIMUM_COVERAGE_VARIANCE_SHORT_NAME, String.valueOf(min), "-" + FilterSamples.MAXIMUM_COVERAGE_VARIANCE_SHORT_NAME, String.valueOf(max), }); checkLeftInTargets(leftInSamples, outputFile); }

Target:
public void testSampleExtremeCoverageVarianceWithoutRejectionFile(final List<SampleCoverageStats> sampleStats, final double min, final double max) throws IOException { final File samplesFile = createSampleStatsFile(sampleStats); final List<SampleCoverageStats> leftInSamples = sampleStats.stream() .filter(stats -> stats.variance >= min && stats.variance <= max) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); runCommandLine(new String[] { "-" + StandardArgumentDefinitions.INPUT_SHORT_NAME, samplesFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterSamples.MINIMUM_COVERAGE_VARIANCE_SHORT_NAME, String.valueOf(min), "-" + FilterSamples.MAXIMUM_COVERAGE_VARIANCE_SHORT_NAME, String.valueOf(max), }); checkLeftInSamples(leftInSamples, outputFile); }
Source:
public boolean execute(VeluxBridge bridge, int sceneNo) { logger.trace("execute({}) called.", sceneNo); RunScene bcp = bridge.bridgeAPI().runScene(); bcp.setSceneId(sceneNo); if ((bridge.bridgeCommunicate(bcp)) && (bcp.isCommunicationSuccessful())) { logger.debug("execute() finished successfully."); return true; } else { logger.trace("execute() finished with failure."); return false; } }

Target:
public boolean execute(VeluxBridge bridge, int sceneNo) { logger.trace("execute({}) called.", sceneNo); RunScene bcp = bridge.bridgeAPI().runScene(); bcp.setSceneId(sceneNo); if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) { logger.debug("execute() finished successfully."); return true; } else { logger.trace("execute() finished with failure."); return false; } }
Source:
public void addressesInHeadersAddedWithoutSlashes() throws IOException { final Socket socket = BkBasicTest.createMockSocket(); final AtomicReference<Request> ref = new AtomicReference<Request>(); new BkBasic( new Take() { @Override @SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes") public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { throw new RuntimeException(exc); } ref.set(req); return new RsEmpty(); } } ).accept(socket); final Request request = ref.get(); final RqHeaders.Smart smart = new RqHeaders.Smart( new RqHeaders.Base(request) ); MatcherAssert.assertThat( smart.single( "X-Takes-LocalAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( smart.single( "X-Takes-RemoteAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( new RqSocket(request).getLocalAddress(), Matchers.notNullValue() ); MatcherAssert.assertThat( new RqSocket(request).getRemoteAddress(), Matchers.notNullValue() ); }

Target:
public void addressesInHeadersAddedWithoutSlashes() throws IOException { final Socket socket = BkBasicTest.createMockSocket(); final AtomicReference<Request> ref = new AtomicReference<Request>(); new BkBasic( new Take() { @Override public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { throw new IllegalStateException(exc); } ref.set(req); return new RsEmpty(); } } ).accept(socket); final Request request = ref.get(); final RqHeaders.Smart smart = new RqHeaders.Smart( new RqHeaders.Base(request) ); MatcherAssert.assertThat( smart.single( "X-Takes-LocalAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( smart.single( "X-Takes-RemoteAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( new RqSocket(request).getLocalAddress(), Matchers.notNullValue() ); MatcherAssert.assertThat( new RqSocket(request).getRemoteAddress(), Matchers.notNullValue() ); }
Source:
private void restoreDialog() { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { try { dialogHeight = dialogSettings.getInt(DIALOG_HEIGHT); dialogWidth = dialogSettings.getInt(DIALOG_WIDTH); } catch (NumberFormatException e) { dialogHeight = -1; dialogWidth = -1; } String[] orderedProviders = dialogSettings.getArray(ORDERED_PROVIDERS); previousPicksList.addAll(Arrays.asList(new QuickAccessElement[orderedProviders.length])); isLoadingPreviousElements = true; refreshQuickAccessContents = new UIJob("Finish restoring quick access elements") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { boolean restoreUiElements = true; restoreDialogEntries(dialogSettings, restoreUiElements, monitor); quickAccessContents.refresh(quickAccessContents.filterText.getText()); List<QuickAccessElement> previousPicks = getLoadedPreviousPicks(); previousPicksList.clear(); previousPicksList.addAll(previousPicks); return Status.OK_STATUS; } }; refreshQuickAccessContents.setSystem(true); restoreDialogEntriesJob = Job.createSystem("Restore quick access elements", (IProgressMonitor monitor) -> { try { boolean restoreUiElements = false; restoreDialogEntries(dialogSettings, restoreUiElements, monitor); return Status.OK_STATUS; } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { isLoadingPreviousElements = false; refreshQuickAccessContents.schedule(); } }); restoreDialogEntriesJob.schedule(); } }

Target:
private void restoreDialog() { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { try { dialogHeight = dialogSettings.getInt(DIALOG_HEIGHT); dialogWidth = dialogSettings.getInt(DIALOG_WIDTH); } catch (NumberFormatException e) { dialogHeight = -1; dialogWidth = -1; } String[] orderedProviders = dialogSettings.getArray(ORDERED_PROVIDERS); previousPicksList.addAll(Arrays.asList(new QuickAccessElement[orderedProviders.length])); isLoadingPreviousElements = true; refreshQuickAccessContents = new UIJob("Finish restoring quick access elements") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { try { restoreDialogEntries(dialogSettings, true, monitor); quickAccessContents.refresh(quickAccessContents.filterText.getText()); List<QuickAccessElement> previousPicks = getLoadedPreviousPicks(); previousPicksList.clear(); previousPicksList.addAll(previousPicks); } finally { isLoadingPreviousElements = false; } return Status.OK_STATUS; } }; refreshQuickAccessContents.setSystem(true); restoreDialogEntriesJob = Job.createSystem("Restore quick access elements", (IProgressMonitor monitor) -> { try { restoreDialogEntries(dialogSettings, false, monitor); return Status.OK_STATUS; } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { refreshQuickAccessContents.schedule(); } }); restoreDialogEntriesJob.schedule(); } }
Source:
public String toString() { return "CachedDataRecordWithStats{" + "cachedValue=" + cachedValue + "} " + super.toString(); }

Target:
public String toString() { return "CachedDataRecordWithStats{" + "cachedValue=" + cachedValue + ", " + super.toString() + "} "; }
Source:
public void setMockMode_shouldNotRegisterDuplicateListeners() throws Exception { TestLocationListener listener = new TestLocationListener(); LocationRequest request = LocationRequest.create().setPriority(PRIORITY_HIGH_ACCURACY); api.setMockMode(true); api.requestLocationUpdates(request, listener); api.setMockMode(false); api.requestLocationUpdates(request, listener); assertThat(shadowLocationManager.getRequestLocationUpdateListeners()).hasSize(4); }

Target:
public void setMockMode_shouldNotRegisterDuplicateListeners() throws Exception { TestLocationListener listener = new TestLocationListener(); LocationRequest request = LocationRequest.create().setPriority(PRIORITY_HIGH_ACCURACY); api.setMockMode(true); api.requestLocationUpdates(request, listener); api.setMockMode(false); api.requestLocationUpdates(request, listener); assertThat(shadowLocationManager.getRequestLocationUpdateListeners()).hasSize(2); }
Source:
public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException { boolean authenticated = false; String authenticationScheme = null; String username = null; String password; List<String> authentication = request.getHttpHeaders().getRequestHeader("Authorization"); if (authentication != null && authentication.size() > 0) { for (String auth : authentication) { if (!auth.startsWith("Basic")) { continue; } String hash = auth.substring(6); try { byte[] decoded = Base64.decode(hash); String usernamePassword = new String(decoded); int colon = usernamePassword.indexOf(':'); if (colon > 0) { username = usernamePassword.substring(0, colon); password = usernamePassword.substring(colon + 1, usernamePassword.length()); authenticated = providerService.authenticate(username, password); authenticationScheme = SecurityContext.BASIC_AUTH; break; } } catch (IOException e) { log.log(Level.SEVERE, "Cannot encode authentication realm", e); } } } if (!authenticated) { MultivaluedMap<String, String> queryParams = request.getUri().getQueryParameters(); if (queryParams != null) { username = queryParams.getFirst("provider"); password = queryParams.getFirst("pwd"); if (username != null && !username.isEmpty() && password != null && !password.isEmpty()) { authenticated = providerService.authenticate(username, password); authenticationScheme = "CUSTOM"; } } } if (authenticated) { Principal principal = new SimplePrincipal(username); ResteasyProviderFactory.pushContext(SecurityContext.class, new CustomSecurityContext(principal, providerService.isSuperProvider(username), true, authenticationScheme)); log.log(Level.FINE, "Request authenticated. Username: {0}", username); } return null; }

Target:
public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException { boolean authenticated = false; String authenticationScheme = null; String username = null; String password; List<String> authentication = request.getHttpHeaders().getRequestHeader("Authorization"); if (authentication != null && authentication.size() > 0) { for (String auth : authentication) { if (!auth.startsWith("Basic")) { continue; } String hash = auth.substring(6); try { byte[] decoded = Base64.decode(hash); String usernamePassword = new String(decoded); int colon = usernamePassword.indexOf(':'); if (colon > 0) { username = usernamePassword.substring(0, colon); password = usernamePassword.substring(colon + 1, usernamePassword.length()); authenticated = providerService.authenticate(username, password); authenticationScheme = SecurityContext.BASIC_AUTH; break; } } catch (IOException e) { log.log(Level.SEVERE, "Cannot encode authentication realm", e); } } } if (authenticated) { Principal principal = new SimplePrincipal(username); ResteasyProviderFactory.pushContext(SecurityContext.class, new CustomSecurityContext(principal, providerService.isSuperProvider(username), true, authenticationScheme)); log.log(Level.FINE, "Request authenticated. Username: {0}", username); } return null; }
Source:
public void verifyShortWriteRequest() throws Exception { AbfsClient client = mock(AbfsClient.class); AbfsRestOperation op = mock(AbfsRestOperation.class); AbfsConfiguration abfsConf; final Configuration conf = new Configuration(); conf.set(accountKey1, accountValue1); abfsConf = new AbfsConfiguration(conf, accountName1); AbfsPerfTracker tracker = new AbfsPerfTracker("test", accountName1, abfsConf); when(client.getAbfsPerfTracker()).thenReturn(tracker); when(client.append(anyString(), any(byte[].class), any(AppendRequestParameters.class), any())).thenReturn(op); when(client.flush(anyString(), anyLong(), anyBoolean(), anyBoolean(), any())).thenReturn(op); AbfsOutputStream out = new AbfsOutputStream(client, null, PATH, 0, populateAbfsOutputStreamContext(BUFFER_SIZE, true, false, false)); final byte[] b = new byte[WRITE_SIZE]; new Random().nextBytes(b); out.write(b); out.hsync(); final byte[] b1 = new byte[2*WRITE_SIZE]; new Random().nextBytes(b1); out.write(b1); out.flush(); out.hflush(); out.hsync(); AppendRequestParameters firstReqParameters = new AppendRequestParameters( 0, 0, WRITE_SIZE, APPEND_MODE, false); AppendRequestParameters secondReqParameters = new AppendRequestParameters( WRITE_SIZE, 0, 2 * WRITE_SIZE, APPEND_MODE, false); verify(client, times(1)).append( eq(PATH), any(byte[].class), refEq(firstReqParameters), any()); verify(client, times(1)).append( eq(PATH), any(byte[].class), refEq(secondReqParameters), any()); }

Target:
public void verifyShortWriteRequest() throws Exception { AbfsClient client = mock(AbfsClient.class); AbfsRestOperation op = mock(AbfsRestOperation.class); AbfsConfiguration abfsConf; final Configuration conf = new Configuration(); conf.set(accountKey1, accountValue1); abfsConf = new AbfsConfiguration(conf, accountName1); AbfsPerfTracker tracker = new AbfsPerfTracker("test", accountName1, abfsConf); when(client.getAbfsPerfTracker()).thenReturn(tracker); when(client.append(anyString(), any(byte[].class), any(AppendRequestParameters.class), any())).thenReturn(op); when(client.flush(anyString(), anyLong(), anyBoolean(), anyBoolean(), any())).thenReturn(op); AbfsOutputStream out = new AbfsOutputStream(client, null, PATH, 0, populateAbfsOutputStreamContext(BUFFER_SIZE, true, false, false)); final byte[] b = new byte[WRITE_SIZE]; new Random().nextBytes(b); out.write(b); out.hsync(); final byte[] b1 = new byte[2*WRITE_SIZE]; new Random().nextBytes(b1); out.write(b1); out.flush(); out.hflush(); out.hsync(); AppendRequestParameters firstReqParameters = new AppendRequestParameters( 0, 0, WRITE_SIZE, APPEND_MODE, false); AppendRequestParameters secondReqParameters = new AppendRequestParameters( WRITE_SIZE, 0, 2 * WRITE_SIZE, APPEND_MODE, false); verify(client, times(1)).append( eq(PATH), any(byte[].class), refEq(firstReqParameters), any()); verify(client, times(1)).append( eq(PATH), any(byte[].class), refEq(secondReqParameters), any()); verify(client, times(2)).append( eq(PATH), any(byte[].class), any(), any()); }
Source:
public static String generateStringOfLength(int length, char character) { Assumption.assertTrue(length >= 0); char[] chars = new char[length]; Arrays.fill(chars, character); return new String(chars); }

Target:
public static String generateStringOfLength(int length, char character) { Assumption.assertTrue(length >= 0); return String.join("", Collections.nCopies(length, String.valueOf(character))); }
Source:
public static Stage getInjectorStage(final Stage defaultStage) { return Stage.valueOf(System.getProperty("stage", defaultStage.name()).toUpperCase()); }

Target:
public static Stage getInjectorStage(final Stage defaultStage) { return Stage.valueOf(System.getProperty("guice.stage", defaultStage.name()).toUpperCase()); }
Source:
private List<Image> generateImages(AmazonUnboxItem item) { if (item.getLargeImageUrl() == null) { return ImmutableList.of(); } Image image = new Image(item.getLargeImageUrl()); image.setType(ImageType.PRIMARY); image.setWidth(320); image.setHeight(240); image.setAspectRatio(ImageAspectRatio.FOUR_BY_THREE); image.setColor(ImageColor.COLOR); image.setMimeType(MimeType.IMAGE_JPG); return ImmutableList.of(image); }

Target:
private List<Image> generateImages(AmazonUnboxItem item) { if (Strings.isNullOrEmpty(item.getLargeImageUrl())) { return ImmutableList.of(); } Image image = new Image(item.getLargeImageUrl()); image.setType(ImageType.PRIMARY); image.setWidth(320); image.setHeight(240); image.setAspectRatio(ImageAspectRatio.FOUR_BY_THREE); image.setColor(ImageColor.COLOR); image.setMimeType(MimeType.IMAGE_JPG); return ImmutableList.of(image); }
Source:
private void testEditWithEmptyQuestionTextThenDeleteQuestionAction(int qnNumber) throws MaximumRetriesExceededException { ______TS("qn " + qnNumber + " edit the question with invalid input then delete question"); feedbackEditPage.clickEditQuestionButton(qnNumber); feedbackEditPage.fillQuestionTextBox("", qnNumber); feedbackEditPage.clickSaveExistingQuestionButton(qnNumber); String expectedString = "Please enter a valid question. The question text cannot be empty."; feedbackEditPage.verifyStatus(expectedString); feedbackEditPage.clickDeleteQuestionLink(qnNumber); feedbackEditPage.waitForConfirmationModalAndClickOk(); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_DELETED); assertNull(getFeedbackQuestion(courseId, feedbackSessionName, qnNumber)); }

Target:
private void testEditWithEmptyQuestionTextThenDeleteQuestionAction(int qnNumber) throws MaximumRetriesExceededException { ______TS("qn " + qnNumber + " edit the question with invalid input then delete question"); feedbackEditPage.clickEditQuestionButton(qnNumber); feedbackEditPage.fillQuestionTextBox("", qnNumber); feedbackEditPage.clickSaveExistingQuestionButton(qnNumber); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_TEXTINVALID); feedbackEditPage.clickDeleteQuestionLink(qnNumber); feedbackEditPage.waitForConfirmationModalAndClickOk(); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_DELETED); assertNull(getFeedbackQuestion(courseId, feedbackSessionName, qnNumber)); }
Source:
static public void generateParameterValueSet(ExpressionClassBuilder acb, int numberOfParameters, Vector parameterList) throws StandardException { if (numberOfParameters >= 0) { MethodBuilder constructor = acb.getConstructor(); boolean hasReturnParam = numberOfParameters > 0 ? ((ParameterNode)parameterList.get(0)).isReturnOutputParam() : false; constructor.pushThis(); constructor.push(numberOfParameters); constructor.push(hasReturnParam); constructor.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "setParameterValueSet", "void", 2); MethodBuilder executeMethod = acb.getExecuteMethod(); executeMethod.pushThis(); executeMethod.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "throwIfMissingParms", "void", 0); } }

Target:
static public void generateParameterValueSet(ExpressionClassBuilder acb, int numberOfParameters, Vector parameterList) throws StandardException { assert numberOfParameters >= 0; MethodBuilder constructor = acb.getConstructor(); boolean hasReturnParam = numberOfParameters > 0 && ((ParameterNode)parameterList.get(0)).isReturnOutputParam(); constructor.pushThis(); constructor.push(numberOfParameters); constructor.push(hasReturnParam); constructor.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "setParameterValueSet", "void", 2); MethodBuilder executeMethod = acb.getExecuteMethod(); executeMethod.pushThis(); executeMethod.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "throwIfMissingParms", "void", 0); }
Source:
public Image getImage(Object element) { if (element instanceof OpenShiftProjectUIModel) { return OpenShiftImages.PROJECT_IMG; } else if (element instanceof Deployment) { return OpenShiftImages.SERVICE_IMG; } else if (element instanceof IResource || element instanceof IResourceUIModel) { IResource resource = element instanceof IResourceUIModel ? ((IResourceUIModel)element).getResource() : (IResource) element; switch (resource.getKind()) { case ResourceKind.BUILD: return OpenShiftImages.BUILD_IMG; case ResourceKind.BUILD_CONFIG: return OpenShiftImages.BUILDCONFIG_IMG; case ResourceKind.IMAGE_STREAM: return OpenShiftImages.IMAGE_IMG; case ResourceKind.POD: return OpenShiftImages.BLOCKS_IMG; case ResourceKind.PROJECT: return OpenShiftImages.PROJECT_IMG; case ResourceKind.ROUTE: return OpenShiftImages.ROUTE_IMG; case ResourceKind.SERVICE: return OpenShiftImages.SERVICE_IMG; default: return OpenShiftCommonImages.FILE; } } else { return super.getImage(element); } }

Target:
public Image getImage(Object element) { if (element instanceof IProjectAdapter) { return OpenShiftImages.PROJECT_IMG; } else if (element instanceof Deployment) { return OpenShiftImages.SERVICE_IMG; } else if(element instanceof NewProjectLinkNode) { return OpenShiftImages.PROJECT_NEW_IMG; } else if (element instanceof IResource || element instanceof IResourceUIModel) { IResource resource = element instanceof IResourceUIModel ? ((IResourceUIModel)element).getResource() : (IResource) element; switch (resource.getKind()) { case ResourceKind.BUILD: return OpenShiftImages.BUILD_IMG; case ResourceKind.BUILD_CONFIG: return OpenShiftImages.BUILDCONFIG_IMG; case ResourceKind.IMAGE_STREAM: return OpenShiftImages.IMAGE_IMG; case ResourceKind.POD: return OpenShiftImages.BLOCKS_IMG; case ResourceKind.PROJECT: return OpenShiftImages.PROJECT_IMG; case ResourceKind.ROUTE: return OpenShiftImages.ROUTE_IMG; case ResourceKind.SERVICE: return OpenShiftImages.SERVICE_IMG; default: return OpenShiftCommonImages.FILE; } } else { return super.getImage(element); } }
Source:
public static String collectionToCommaDelimitedString(Collection<String> list) { if (list == null || list.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); final Iterator<String> it = list.iterator(); while (it.hasNext()) { sb.append(it.next()); if (it.hasNext()) { sb.append(", "); } } return sb.toString(); }

Target:
public static String collectionToCommaDelimitedString(Collection<String> list) { return StringUtils.collectionToCommaDelimitedString(list); }
Source:
public void writeExternal( ObjectOutput out ) throws IOException { out.writeUTF( filePath ); out.writeObject( createdDate ); out.writeObject( lastModifiedDate ); out.writeObject( firstBlock ); out.writeObject( metadataMap ); out.writeObject( lockMap ); }

Target:
public void writeExternal( ObjectOutput out ) throws IOException { out.writeUTF( filePath ); out.writeBoolean( directory ); out.writeObject( createdDate ); out.writeObject( lastModifiedDate ); out.writeInt( blockSize ); out.writeObject( metadataMap ); out.writeObject( lockMap ); out.writeObject( firstBlock ); }
Source:
public void canFormat() { final GenieDateFormat format = new GenieDateFormat(); final Date zero = new Date(0); final StringBuffer buffer = new StringBuffer(); final FieldPosition pos = Mockito.mock(FieldPosition.class); Assert.assertThat(format.format(zero, buffer, pos).toString(), Matchers.is("1970-01-01T00:00:00.000+0000")); }

Target:
public void canFormat() { final GenieDateFormat format = new GenieDateFormat(); final Date zero = new Date(0); final StringBuffer buffer = new StringBuffer(); final FieldPosition pos = Mockito.mock(FieldPosition.class); Assert.assertThat(format.format(zero, buffer, pos).toString(), Matchers.is("1970-01-01T00:00:00.000Z")); }
Source:
public final Driver newInstance( URI uri, AuthToken authToken, RoutingSettings routingSettings, RetrySettings retrySettings, Config config ) { authToken = authToken == null ? AuthTokens.none() : authToken; BoltServerAddress address = new BoltServerAddress( uri ); RoutingSettings newRoutingSettings = routingSettings.withRoutingContext( new RoutingContext( uri ) ); SecurityPlan securityPlan = createSecurityPlan( address, config ); InternalLoggerFactory.setDefaultFactory( new NettyLogging( config.logging() ) ); Bootstrap bootstrap = createBootstrap(); EventExecutorGroup eventExecutorGroup = bootstrap.config().group(); RetryLogic retryLogic = createRetryLogic( retrySettings, eventExecutorGroup, config.logging() ); InternalAbstractDriverMetrics metrics = createDriverMetrics( config ); ConnectionPool connectionPool = createConnectionPool( authToken, securityPlan, bootstrap, metrics, config ); InternalDriver driver = createDriver( uri, address, connectionPool, config, newRoutingSettings, eventExecutorGroup, securityPlan, retryLogic ); driver.driverMetrics( metrics ); verifyConnectivity( driver, connectionPool, config ); return driver; }

Target:
public final Driver newInstance( URI uri, AuthToken authToken, RoutingSettings routingSettings, RetrySettings retrySettings, Config config ) { authToken = authToken == null ? AuthTokens.none() : authToken; BoltServerAddress address = new BoltServerAddress( uri ); RoutingSettings newRoutingSettings = routingSettings.withRoutingContext( new RoutingContext( uri ) ); SecurityPlan securityPlan = createSecurityPlan( address, config ); InternalLoggerFactory.setDefaultFactory( new NettyLogging( config.logging() ) ); Bootstrap bootstrap = createBootstrap(); EventExecutorGroup eventExecutorGroup = bootstrap.config().group(); RetryLogic retryLogic = createRetryLogic( retrySettings, eventExecutorGroup, config.logging() ); InternalAbstractMetrics metrics = createDriverMetrics( config ); ConnectionPool connectionPool = createConnectionPool( authToken, securityPlan, bootstrap, metrics, config ); InternalDriver driver = createDriver( uri, securityPlan, address, connectionPool, eventExecutorGroup, newRoutingSettings, retryLogic, metrics, config ); verifyConnectivity( driver, connectionPool, config ); return driver; }
Source:
private void getDoubleBufferGraphics( final Display display, GC gc, int minWidth, int minHeight ) { IPreferenceStore store = UiPlugin.getDefault().getPreferenceStore(); boolean useAdvancedGraphics = store.getBoolean(org.locationtech.udig.ui.preferences.PreferenceConstants.P_ADVANCED_GRAPHICS); AffineTransform viewportTrsf = this.renderManager.getMapInternal().getViewportModel().worldToScreenTransform(); if (viewportTrsf.equals(this.backBufferTrsf)) { viewportTrsf = new AffineTransform(); } else { try { viewportTrsf.concatenate(this.backBufferTrsf.createInverse()); } catch (NoninvertibleTransformException ex) { System.out.println(ex); viewportTrsf = new AffineTransform(); } } if ((getStyle()&SWT.DOUBLE_BUFFERED)==0){ if (buffer == null) { buffer = new Image(display, displaySize.width, displaySize.height); } ViewportGraphics swtGraphics = null; if (useAdvancedGraphics) { swtGraphics = new SWTGraphics(buffer, display); } else { swtGraphics = new NonAdvancedSWTGraphics(buffer, display); } painter.paint(swtGraphics, swtImage, viewportTrsf, minWidth, minHeight); swtGraphics.dispose(); gc.drawImage(buffer, 0, 0); }else{ ViewportGraphics swtGraphics = null; if (useAdvancedGraphics) { swtGraphics = new SWTGraphics(gc, display); } else { swtGraphics = new NonAdvancedSWTGraphics(gc, display, null); } painter.paint(swtGraphics, swtImage, viewportTrsf, minWidth, minHeight); swtGraphics.dispose(); } }

Target:
private void getDoubleBufferGraphics( final Display display, GC gc, int minWidth, int minHeight ) { IPreferenceStore store = UiPlugin.getDefault().getPreferenceStore(); boolean useAdvancedGraphics = store.getBoolean(org.locationtech.udig.ui.preferences.PreferenceConstants.P_ADVANCED_GRAPHICS); AffineTransform viewportTrsf = getSwtImageToViewportTransform(); if ((getStyle()&SWT.DOUBLE_BUFFERED)==0){ if (buffer == null) { buffer = new Image(display, displaySize.width, displaySize.height); } ViewportGraphics swtGraphics = null; if (useAdvancedGraphics) { swtGraphics = new SWTGraphics(buffer, display); } else { swtGraphics = new NonAdvancedSWTGraphics(buffer, display); } painter.paint(swtGraphics, swtImage, viewportTrsf, minWidth, minHeight); swtGraphics.dispose(); gc.drawImage(buffer, 0, 0); }else{ ViewportGraphics swtGraphics = null; if (useAdvancedGraphics) { swtGraphics = new SWTGraphics(gc, display); } else { swtGraphics = new NonAdvancedSWTGraphics(gc, display, null); } painter.paint(swtGraphics, swtImage, viewportTrsf, minWidth, minHeight); swtGraphics.dispose(); } }
Source:
public TerminalSession getTerminalAtIndex(int i) { Widget widget = terminalSessionsPanel_.getWidget(i); if (widget != null) { return (TerminalSession)widget; } return null; }

Target:
public TerminalSession getTerminalAtIndex(int i) { Widget widget = terminalSessionsPanel_.getWidget(i); if (widget instanceof TerminalSession) { return (TerminalSession)widget; } return null; }
Source:
public void setProperty(String name, String value) { if (name != null && value != null) { this.properties.put(name, value); } }

Target:
public void setProperty(String name, String value) { if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) { this.properties.put(name, value); } }
Source:
public void onPartialResult(String text) { result = text; AfterGettingText(result); }

Target:
public void onPartialResult(String text) { result = text; AfterGettingText(result, true); }
Source:
public synchronized boolean record(final SAMRecord rec) { if (null == rec.getHeader() || rec.getReferenceIndex() == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { return record(null, 0); } else { return record(rec.getReferenceName(), rec.getAlignmentStart()); } }

Target:
public synchronized boolean record(final SAMRecord rec) { if (SAMRecord.NO_ALIGNMENT_REFERENCE_NAME.equals(rec.getReferenceName())) { return record(null, 0); } else { return record(rec.getReferenceName(), rec.getAlignmentStart()); } }
Source:
private JobDescriptor parseJobDescriptor() { JobDescriptor jd = null; if (tokens.peek(0, TokenKind.IDENTIFIER)) { if (tokens.peek(1, TokenKind.IDENTIFIER)) { jd = parseJobDefinition(); } else if (tokens.peek(1, TokenKind.DOUBLE_MINUS)) { tokens.raiseException(tokens.peek(1).startpos, JobDSLMessage.MISSING_JOB_NAME_IN_INLINEJOBDEF); } else { jd = new JobReference(tokens.eat(TokenKind.IDENTIFIER)); } } if (tokens.peek(TokenKind.PIPE)) { List<Transition> transitions = parseTransitions(); jd.setTransitions(transitions); } return jd; }

Target:
private JobDescriptor parseJobDescriptor() { JobDescriptor jd = null; if (tokens.peek(0, TokenKind.IDENTIFIER)) { if (tokens.peek(1, TokenKind.IDENTIFIER)) { jd = parseJobDefinition(); } else if (tokens.peek(1, TokenKind.DOUBLE_MINUS)) { tokens.raiseException(tokens.peek(1).startpos, JobDSLMessage.MISSING_JOB_NAME_IN_INLINEJOBDEF); } else { jd = new JobReference(tokens.eat(TokenKind.IDENTIFIER)); } } if (jd == null) { Token t = tokens.peek(); tokens.raiseException(t == null ? 0 : t.startpos, JobDSLMessage.EXPECTED_JOB_REF_OR_DEF); } if (tokens.peek(TokenKind.PIPE)) { List<Transition> transitions = parseTransitions(); jd.setTransitions(transitions); } return jd; }
Source:
void readSha1() { rev.Sha1 = bufferContents(); }

Target:
void readSha1() { String sha1 = bufferContents(); if (rev != null) { rev.Sha1 = sha1; } else if (page != null) { } else { throw new IllegalArgumentException("Unexpected <id> outside a <revision>"); } }
Source:
public static void run(String username, String password, String account, String label, String product) throws InterruptedException { BlockingQueue<String> queue = new LinkedBlockingQueue<String>(10000); BasicAuth auth = new BasicAuth(username, password); EnterpriseStreamingEndpoint endpoint = new EnterpriseStreamingEndpoint(account, product, label); Client client = new ClientBuilder() .name("PowerTrackClient-01") .hosts(Constants.ENTERPRISE_STREAM_HOST) .endpoint(endpoint) .authentication(auth) .processor(new SimpleStringProcessor(queue)) .build(); client.connect(); for (int msgRead = 0; msgRead < 1000; msgRead++) { String msg = queue.take(); System.out.println(msg); } client.stop(); }

Target:
public static void run(String username, String password, String account, String label, String product) throws InterruptedException { BlockingQueue<String> queue = new LinkedBlockingQueue<String>(10000); BasicAuth auth = new BasicAuth(username, password); RealTimeEnterpriseStreamingEndpoint endpoint = new RealTimeEnterpriseStreamingEndpoint(account, product, label); Client client = new ClientBuilder() .name("PowerTrackClient-01") .hosts(Constants.ENTERPRISE_STREAM_HOST) .endpoint(endpoint) .authentication(auth) .processor(new LineStringProcessor(queue)) .build(); client.connect(); for (int msgRead = 0; msgRead < 1000; msgRead++) { String msg = queue.take(); System.out.println(msg); } client.stop(); }
Source:
private static boolean hasHeader(TagNode node) { if (node.getChildren().stream().anyMatch(TableWithoutHeaderCheck::isTableHeader)) { return true; } else { return node.getChildren().stream().filter(child -> !isTable(child)).anyMatch(TableWithoutHeaderCheck::hasHeader); } }

Target:
private static boolean hasHeader(TagNode node) { return node.getChildren().stream().anyMatch(TableWithoutHeaderCheck::isTableHeader) || node.getChildren().stream().filter(child -> !isTable(child)).anyMatch(TableWithoutHeaderCheck::hasHeader); }
Source:
public void run() { log.info("Running job {}", getClass().getSimpleName()); for (final String account : allAccountIds.get()) { for (final String region : jobsProperties.getWhitelistedRegions()) { try { log.info("Scanning public EC2 instances for {}/{}", account, region); final AmazonEC2Client ec2Client = clientProvider.getClient( AmazonEC2Client.class, account, getRegion(fromName(region))); Optional<String> nextToken = empty(); do { final DescribeInstancesRequest request = new DescribeInstancesRequest(); if (nextToken.isPresent()) { request.setNextToken(nextToken.get()); } else { request.withFilters( new Filter("ip-address").withValues("*"), new Filter("instance-state-name").withValues("running")); } final DescribeInstancesResult result = ec2Client.describeInstances(request); nextToken = Optional.ofNullable(result.getNextToken()); for (final Reservation reservation : result.getReservations()) { for (final Instance instance : reservation.getInstances()) { processInstance(account, region, instance); } } } while (nextToken.isPresent()); } catch (final AmazonServiceException a) { if (a.getErrorCode().equals("RequestLimitExceeded")) { log.warn("RequestLimitExceeded for account: {}", account); } else { log.error(a.getMessage(), a); } } } } }

Target:
public void run() { log.info("Running job {}", getClass().getSimpleName()); for (final String account : allAccountIds.get()) { for (final String region : jobsProperties.getWhitelistedRegions()) { try { log.info("Scanning public EC2 instances for {}/{}", account, region); final AmazonEC2Client ec2Client = clientProvider.getClient( AmazonEC2Client.class, account, getRegion(fromName(region))); Optional<String> nextToken = empty(); do { final DescribeInstancesRequest request = new DescribeInstancesRequest(); if (nextToken.isPresent()) { request.setNextToken(nextToken.get()); } else { request.withFilters( new Filter("ip-address").withValues("*"), new Filter("instance-state-name").withValues("running")); } final DescribeInstancesResult result = ec2Client.describeInstances(request); nextToken = Optional.ofNullable(trimToNull(result.getNextToken())); for (final Reservation reservation : result.getReservations()) { for (final Instance instance : reservation.getInstances()) { processInstance(account, region, instance); } } } while (nextToken.isPresent()); } catch (final AmazonServiceException a) { if (a.getErrorCode().equals("RequestLimitExceeded")) { log.warn("RequestLimitExceeded for account: {}", account); } else { log.error(a.getMessage(), a); } } } } }
Source:
private void recordValues() { FateMetricValues measurement = metricValues.get(); currentFateOps.set(measurement.getCurrentFateOps()); zkChildFateOpsTotal.set(measurement.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(measurement.getZkConnectionErrors()); Map<String,Long> states = measurement.getTxStateCounters(); states.forEach((key, value) -> { MutableGaugeLong v = fateTypeCounts.get(key); if (v != null) { v.set(value); } else { v = super.getRegistry().newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value); fateTypeCounts.put(key, v); } }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = measurement.getOpTypeCounters(); opTypes.forEach((key, value) -> { MutableGaugeLong g = fateOpCounts.get(key); if (g != null) { g.set(value); } else { g = super.getRegistry().newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value); } fateOpCounts.put(key, g); }); }

Target:
private void recordValues() { currentFateOps.set(metricValues.getCurrentFateOps()); zkChildFateOpsTotal.set(metricValues.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(metricValues.getZkConnectionErrors()); Map<String,Long> states = metricValues.getTxStateCounters(); states.forEach((key, value) -> { MutableGaugeLong v = fateTypeCounts.get(key); if (v != null) { v.set(value); } else { v = super.getRegistry().newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value); fateTypeCounts.put(key, v); } }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = metricValues.getOpTypeCounters(); log.info("OP Counts Before: prev {}, updates {}", fateOpCounts, opTypes); opTypes.forEach((key, value) -> { MutableGaugeLong g = fateOpCounts.get(key); if (g != null) { g.set(value); } else { g = super.getRegistry().newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value); fateOpCounts.put(key, g); } }); log.info("OP Counts After: prev {}, updates {}", fateOpCounts, opTypes); }
Source:
private void waitForTable(int nbOfRows) { SWTBotUtils.waitUntil(expected -> { UIThreadRunnable.syncExec(() -> { fTableViewer.refresh(); }); return fTableBot.rowCount() == expected; }, nbOfRows, "Unable to refresh the table"); }

Target:
private void waitForTable(int nbOfRows) { SWTBotUtils.waitUntil(tableBot -> { UIThreadRunnable.syncExec(() -> { fTableViewer.refresh(); }); return tableBot.rowCount() == nbOfRows; }, fTableBot, "Unable to refresh the table"); }
Source:
public ByteBufferImpl(byte[] buf, int offset, int length) { this.buf = buf; this.offset = offset; this.length = length; }

Target:
public ByteBufferImpl(byte[] buf, int offset, int length) { if (buf == null) throw new IllegalArgumentException("Null buff not allowed!"); if (buf.length < offset + length) throw new IllegalArgumentException("Incorrect arguments: buff.length" + buf.length + ", offset=" + offset +", length="+ length); this.buf = buf; this.offset = offset; this.length = length; }
Source:
public void registerCacheEntryListener(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean addToConfig) { ensureOpen(); if (cacheEntryListenerConfiguration == null) { throw new NullPointerException("CacheEntryListenerConfiguration can't be null"); } CacheEventListenerAdaptor<K, V> adaptor = new CacheEventListenerAdaptor<>(this, cacheEntryListenerConfiguration, getSerializationService()); EventHandler handler = createHandler(adaptor); UUID regId = getContext().getListenerService().registerListener(createCacheEntryListenerCodec(nameWithPrefix), handler); if (addToConfig) { cacheConfig.addCacheEntryListenerConfiguration(cacheEntryListenerConfiguration); } addListenerLocally(regId, cacheEntryListenerConfiguration, adaptor); if (addToConfig) { updateCacheListenerConfigOnOtherNodes(cacheEntryListenerConfiguration, true); } }

Target:
public void registerCacheEntryListener(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean addToConfig) { ensureOpen(); if (cacheEntryListenerConfiguration == null) { throw new NullPointerException("CacheEntryListenerConfiguration can't be null"); } CacheEventListenerAdaptor<K, V> adaptor = new CacheEventListenerAdaptor<>(this, cacheEntryListenerConfiguration, getSerializationService()); UUID regId = getContext().getListenerService() .registerListener(createCacheEntryListenerCodec(nameWithPrefix), createHandler(adaptor)); if (addToConfig) { cacheConfig.addCacheEntryListenerConfiguration(cacheEntryListenerConfiguration); } addListenerLocally(regId, cacheEntryListenerConfiguration, adaptor); if (addToConfig) { updateCacheListenerConfigOnOtherNodes(cacheEntryListenerConfiguration, true); } }
Source:
public void testTagsAddition() throws Throwable { final TableName exportTable = TableName.valueOf(name.getMethodName()); TableDescriptor desc = TableDescriptorBuilder .newBuilder(exportTable) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILYA) .setMaxVersions(5) .setKeepDeletedCells(KeepDeletedCells.TRUE) .build()) .setCoprocessor(MetadataController.class.getName()) .build(); UTIL.getAdmin().createTable(desc); Table exportT = UTIL.getConnection().getTable(exportTable); Put p = new Put(ROW1); p.addColumn(FAMILYA, QUAL, now, QUAL); exportT.put(p); Delete d = new Delete(ROW1, now+3); d.setAttribute(TEST_ATTR, Bytes.toBytes(TEST_TAG)); exportT.delete(d); String[] args = new String[] { "-D" + ExportUtils.RAW_SCAN + "=true", "-Dhbase.client.rpc.codec=org.apache.hadoop.hbase.codec.KeyValueCodecWithTags", exportTable.getNameAsString(), FQ_OUTPUT_DIR, "1000", }; assertTrue(runExport(args)); final TableName importTable = TableName.valueOf("importWithTestTagsAddition"); TableDescriptor importTableDesc = TableDescriptorBuilder .newBuilder(importTable) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILYA) .setMaxVersions(5) .setKeepDeletedCells(KeepDeletedCells.TRUE) .build()) .setCoprocessor(MetadataController.class.getName()) .build(); UTIL.getAdmin().createTable(importTableDesc); args = new String[] { "-Dhbase.client.rpc.codec=org.apache.hadoop.hbase.codec.KeyValueCodecWithTags", importTable.getNameAsString(), FQ_OUTPUT_DIR }; assertTrue(runImport(args)); assertTagExists(exportTable); assertTagExists(importTable); }

Target:
public void testTagsAddition() throws Throwable { final TableName exportTable = TableName.valueOf(name.getMethodName()); TableDescriptor desc = TableDescriptorBuilder .newBuilder(exportTable) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILYA) .setMaxVersions(5) .setKeepDeletedCells(KeepDeletedCells.TRUE) .build()) .setCoprocessor(MetadataController.class.getName()) .build(); UTIL.getAdmin().createTable(desc); Table exportT = UTIL.getConnection().getTable(exportTable); Put p = new Put(ROW1); p.addColumn(FAMILYA, QUAL, now, QUAL); exportT.put(p); Delete d = new Delete(ROW1, now+3); d.setAttribute(TEST_ATTR, Bytes.toBytes(TEST_TAG)); exportT.delete(d); String[] args = new String[] { "-D" + ExportUtils.RAW_SCAN + "=true", "-Dhbase.client.rpc.codec=org.apache.hadoop.hbase.codec.KeyValueCodecWithTags", exportTable.getNameAsString(), FQ_OUTPUT_DIR, "1000", }; assertTrue(runExport(args)); assertTagExists(exportTable); final TableName importTable = TableName.valueOf("importWithTestTagsAddition"); TableDescriptor importTableDesc = TableDescriptorBuilder .newBuilder(importTable) .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILYA) .setMaxVersions(5) .setKeepDeletedCells(KeepDeletedCells.TRUE) .build()) .setCoprocessor(MetadataController.class.getName()) .build(); UTIL.getAdmin().createTable(importTableDesc); args = new String[] { "-Dhbase.client.rpc.codec=org.apache.hadoop.hbase.codec.KeyValueCodecWithTags", importTable.getNameAsString(), FQ_OUTPUT_DIR }; assertTrue(runImport(args)); assertTagExists(importTable); }
Source:
public void unlockSettingsCodeSnippet() { ConfigurationClient configurationClient = createSyncConfigurationClient(); ConfigurationSetting result = configurationClient.setReadOnly("prodDBConnection", "westUS"); System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnly#string-string ConfigurationSetting resultSetting = configurationClient .setReadOnly(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")); System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnly#ConfigurationSetting Response<ConfigurationSetting> responseSetting = configurationClient .setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS"), new Context(key2, value2)); System.out .printf("Key: %s, Value: %s", responseSetting.getValue().getKey(), responseSetting.getValue().getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnlyWithResponse#ConfigurationSetting-Context }

Target:
public void unlockSettingsCodeSnippet() { ConfigurationClient configurationClient = createSyncConfigurationClient(); ConfigurationSetting result = configurationClient.setReadOnly("prodDBConnection", "westUS"); System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnly#string-string ConfigurationSetting resultSetting = configurationClient.setReadOnlyWithResponse( new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS"), Context.NONE).getValue(); System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnly#ConfigurationSetting Response<ConfigurationSetting> responseSetting = configurationClient .setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS"), false, new Context(key2, value2)); System.out.printf("Key: %s, Value: %s", responseSetting.getValue().getKey(), responseSetting.getValue().getValue()); END: com.azure.data.applicationconfig.configurationclient.clearReadOnlyWithResponse#ConfigurationSetting-Context }