auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static float getCompensatedMinSpaceLeft(SpaceWrapper wrapper) { return 1.1f * ((wrapper.getLast().getX() - wrapper.getFirst().getX()) / (wrapper.getLast() .getPreviousNodesCount() - wrapper.getFirst().getPreviousNodesCount()) ); }

Target:
static float getCompensatedMinSpaceLeft(SpaceWrapper wrapper) { return SPACE_COMPENSATION * ((wrapper.getLast().getX() - wrapper.getFirst().getX()) / (wrapper.getLast() .getPreviousNodesCount() - wrapper.getFirst().getPreviousNodesCount())); }
Source:
private static LauncherStatus run(final String[] args) throws IOException, InjectionException { final Configuration commandLineConf = parseCommandLine(args); final Injector commandLineInjector = Tang.Factory.getTang().newInjector(commandLineConf); final boolean onLocal = commandLineInjector.getNamedInstance(Parameters.OnLocal.class); final int splits = commandLineInjector.getNamedInstance(Parameters.Splits.class); final Configuration runTimeConf = onLocal ? getLocalRuntimeConfiguration(splits) : getYarnRuntimeConfiguration(); final Configuration driverConf = getDriverConfiguration(commandLineConf); final int timeout = commandLineInjector.getNamedInstance(Parameters.Timeout.class); final LauncherStatus status = DriverLauncher.getLauncher(runTimeConf).run(driverConf, timeout); return status; }

Target:
private static LauncherStatus run(final String[] args) throws IOException, InjectionException { final Configuration commandLineConf = parseCommandLine(args); final Injector commandLineInjector = Tang.Factory.getTang().newInjector(commandLineConf); final boolean onLocal = commandLineInjector.getNamedInstance(Parameters.OnLocal.class); final int splits = commandLineInjector.getNamedInstance(Parameters.Splits.class); final Configuration runTimeConf = onLocal ? getLocalRuntimeConfiguration(splits) : getYarnRuntimeConfiguration(); final Configuration driverConf = getDriverConfiguration(commandLineConf); final int timeout = commandLineInjector.getNamedInstance(Parameters.Timeout.class); return DriverLauncher.getLauncher(runTimeConf).run(driverConf, timeout); }
Source:
private ActionListener createWriteDataActionListener(final Class<? extends Analyzer<?>> analyzerClass, final String filenameExtension) { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final AnalysisJob copyAnalysisJob = _analysisJobBuilder.toAnalysisJob(false); final AnalysisJobBuilder copyAnalysisJobBuilder = new AnalysisJobBuilder( _analysisJobBuilder.getConfiguration(), copyAnalysisJob); final AnalyzerComponentBuilder<? extends Analyzer<?>> analyzer = copyAnalysisJobBuilder .addAnalyzer(analyzerClass); analyzer.addInputColumns(copyAnalysisJobBuilder.getAvailableInputColumns(Object.class)); final String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); final FileResource resource = createResource("datacleaner-" + formattedDate + "-output", filenameExtension); if (filenameExtension.equals(".xls") || filenameExtension.equals(".xlsx")) { final File file = resource.getFile(); analyzer.setConfiguredProperty("File", file); } else { analyzer.setConfiguredProperty("File", resource); } final ConfiguredPropertyDescriptor sheetNameProperty = analyzer.getDescriptor().getConfiguredProperty( "Sheet name"); if (sheetNameProperty != null) { analyzer.setConfiguredProperty(sheetNameProperty, "data"); } final RunAnalysisActionListener runAnalysis = new RunAnalysisActionListener(_dcModule, copyAnalysisJobBuilder); ExecuteJobWithoutAnalyzersDialog.this.close(); runAnalysis.run(); } }; }

Target:
private ActionListener createWriteDataActionListener(final Class<? extends Analyzer<?>> analyzerClass, final String filenameExtension) { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final AnalysisJob copyAnalysisJob = _analysisJobBuilder.toAnalysisJob(false); final AnalysisJobBuilder copyAnalysisJobBuilder = new AnalysisJobBuilder( _analysisJobBuilder.getConfiguration(), copyAnalysisJob); final AnalyzerComponentBuilder<? extends Analyzer<?>> analyzer = copyAnalysisJobBuilder .addAnalyzer(analyzerClass); analyzer.addInputColumns(copyAnalysisJobBuilder.getAvailableInputColumns(Object.class)); final String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); final FileResource resource = createResource("datacleaner-" + formattedDate + "-output", filenameExtension); if (analyzerClass == CreateExcelSpreadsheetAnalyzer.class) { final File file = resource.getFile(); analyzer.setConfiguredProperty("File", file); } else { analyzer.setConfiguredProperty("File", resource); } final ConfiguredPropertyDescriptor sheetNameProperty = analyzer.getDescriptor().getConfiguredProperty( "Sheet name"); if (sheetNameProperty != null) { analyzer.setConfiguredProperty(sheetNameProperty, "data"); } final RunAnalysisActionListener runAnalysis = new RunAnalysisActionListener(_dcModule, copyAnalysisJobBuilder); ExecuteJobWithoutAnalyzersDialog.this.close(); runAnalysis.run(); } }; }
Source:
AuthenticationResult getAccessToken() throws AuthenticationException { if (mTokenCacheAccessor == null) { return null; } TokenCacheItem tokenCacheItem = mTokenCacheAccessor.getRegularTokenCacheItemWithAT(mAuthRequest.getResource(), mAuthRequest.getClientId(), getUser()); if (tokenCacheItem == null && lookUpCachedTokenWithNoUserForADFS()) { tokenCacheItem = mTokenCacheAccessor.getRegularTokenCacheItemWithAT(mAuthRequest.getResource(), mAuthRequest.getClientId(), null); if (tokenCacheItem == null) { return tryMRRT(); } } if (isValidCache(tokenCacheItem)) { if (isUserMisMatch(tokenCacheItem)) { Logger.v(TAG, "User in retrieved token cache item does not match the user provided in the request."); throw new AuthenticationException(ADALError.AUTH_FAILED_USER_MISMATCH); } Logger.v(TAG, "Valid token cache item, return AT back."); return AuthenticationResult.createResult(tokenCacheItem); } return tryRT(); }

Target:
AuthenticationResult getAccessToken() throws AuthenticationException { if (mTokenCacheAccessor == null) { return null; } final TokenCacheItem accessTokenItem = mTokenCacheAccessor.getATFromCache(mAuthRequest.getResource(), mAuthRequest.getClientId(), mAuthRequest.getUserFromRequest()); if (accessTokenItem == null) { Logger.v(TAG, "No valid access token exists, try with refresh token."); return tryRT(); } Logger.v(TAG, "Return AT from cache."); return AuthenticationResult.createResult(accessTokenItem); }
Source:
private PercentType sendIncrease(int bulb, int rgbwSteps, String bridgeId) { logger.debug("milight: sendIncrease"); String messageBytes = null; switch (bulb) { case 0: case 1: case 2: case 3: case 4: messageBytes = "3C:00:55"; break; case 5: messageBytes = "23:00:55"; break; } int currentPercent = getCurrentState(bulb, bridgeId, BindingType.brightness).intValue(); int newPercent = currentPercent + 10; if (newPercent > 100) { newPercent = 100; } PercentType newValue = new PercentType(newPercent); if (bulb > 5) { int increasePercent = newPercent * (rgbwSteps - 2) / 100 + 2; messageBytes = "4E:" + Integer.toHexString(increasePercent) + ":55"; logger.debug("Bulb '{}' set to '{}' dimming Steps", bulb, rgbwSteps); } else if (bulb < 5) { newPercent = (int) Math.round( (Math.round(getCurrentState(bulb, bridgeId, BindingType.brightness).intValue() / 9.090909090909091) + 1) * 9.090909090909091); newValue = new PercentType(newPercent); logger.debug("milight: Bulb '{}' getting increased to '{}'", bulb, newPercent); } try { sendOn(bulb, bridgeId); Thread.sleep(100); } catch (InterruptedException e) { } sendMessage(messageBytes, bridgeId); setCurrentState(bulb, bridgeId, newValue, BindingType.brightness); return newValue; }

Target:
private PercentType sendIncrease(int bulb, int rgbwSteps, String bridgeId) { logger.debug("milight: sendIncrease"); String messageBytes = null; switch (bulb) { case 0: case 1: case 2: case 3: case 4: messageBytes = "3C:00:55"; break; case 5: messageBytes = "23:00:55"; break; } int currentPercent = getCurrentState(bulb, bridgeId, BindingType.brightness).intValue(); if (currentPercent == 0) { try { sendOn(bulb, bridgeId); Thread.sleep(100); } catch (InterruptedException e) { } } int newPercent = currentPercent + 10; if (newPercent > 100) { newPercent = 100; } PercentType newValue = new PercentType(newPercent); if (bulb > 5) { int increasePercent = newPercent * (rgbwSteps - 2) / 100 + 2; messageBytes = "4E:" + Integer.toHexString(increasePercent) + ":55"; logger.debug("Bulb '{}' set to '{}' dimming Steps", bulb, rgbwSteps); } else if (bulb < 5) { newPercent = (int) Math.round( (Math.round(getCurrentState(bulb, bridgeId, BindingType.brightness).intValue() / 9.090909090909091) + 1) * 9.090909090909091); newValue = new PercentType(newPercent); logger.debug("milight: Bulb '{}' getting increased to '{}'", bulb, newPercent); } sendMessage(messageBytes, bridgeId); setCurrentState(bulb, bridgeId, newValue, BindingType.brightness); return newValue; }
Source:
protected void doOKAction() { if (getOKAction().isEnabled()) { GoogleLogin login = GoogleLogin.getInstance(); Module selectedModule = myModuleComboBox.getSelectedModule(); String sdk = ""; String war = ""; AppEngineGradleFacet facet = AppEngineGradleFacet.getAppEngineFacetByModule(selectedModule); if (facet != null) { AppEngineConfigurationProperties model = facet.getConfiguration().getState(); sdk = model.APPENGINE_SDKROOT; war = model.WAR_DIR; } String client_secret = login.fetchOAuth2ClientSecret(); String client_id = login.fetchOAuth2ClientId(); String refresh_token = login.fetchOAuth2RefreshToken(); if (StringUtils.isEmptyOrNull(client_secret) || StringUtils.isEmptyOrNull(client_id) || StringUtils.isEmptyOrNull(refresh_token)) { LOG.error("StartUploading while logged in, but it doesn't have full credentials."); Messages.showErrorDialog(this.getPeer().getOwner(), "Login credentials are not valid.", "Login"); return; } if (Strings.isNullOrEmpty(sdk) || Strings.isNullOrEmpty(war) || Strings.isNullOrEmpty(myProjectId.getText()) || selectedModule == null) { LOG.error("StartUploading was called with bad module/sdk/war"); return; } close(OK_EXIT_CODE); new AppEngineUpdater(myProject, selectedModule, sdk, war, myProjectId.getText(), myVersion.getText(), client_secret, client_id, refresh_token).startUploading(); } }

Target:
protected void doOKAction() { if (getOKAction().isEnabled()) { GoogleLogin login = GoogleLogin.getInstance(); Module selectedModule = myModuleComboBox.getSelectedModule(); String sdk = ""; String war = ""; AppEngineGradleFacet facet = AppEngineGradleFacet.getAppEngineFacetByModule(selectedModule); if (facet != null) { AppEngineConfigurationProperties model = facet.getConfiguration().getState(); sdk = model.APPENGINE_SDKROOT; war = model.WAR_DIR; } String client_secret = login.fetchOAuth2ClientSecret(); String client_id = login.fetchOAuth2ClientId(); String refresh_token = login.fetchOAuth2RefreshToken(); if (StringUtils.isEmptyOrNull(client_secret) || StringUtils.isEmptyOrNull(client_id) || StringUtils.isEmptyOrNull(refresh_token)) { LOG.error("StartUploading while logged in, but it doesn't have full credentials."); Messages.showErrorDialog(this.getPeer().getOwner(), "Login credentials are not valid.", "Login"); return; } if (Strings.isNullOrEmpty(sdk) || Strings.isNullOrEmpty(war) || Strings.isNullOrEmpty(myProjectId.getText()) || selectedModule == null) { Messages.showErrorDialog(this.getPeer().getOwner(), "Could not deploy due to missing information (sdk/war/projectid).", "Deploy"); LOG.error("StartUploading was called with bad module/sdk/war"); return; } close(OK_EXIT_CODE); new AppEngineUpdater(myProject, selectedModule, sdk, war, myProjectId.getText(), myVersion.getText(), client_secret, client_id, refresh_token).startUploading(); } }
Source:
protected Bitmap doInBackground(OCFile... params) { file = params[0]; final String imageKey = String.valueOf(file.getRemoteId().hashCode()); Log_OC.d("Thumbnail", imageKey); Bitmap thumbnail = getBitmapFromDiskCache(imageKey); if (thumbnail == null) { Resources r = mContext.getResources(); int px = (int) Math.round(TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 150, r.getDisplayMetrics() )); if (file.isDown()){ Bitmap bitmap = BitmapFactory.decodeFile(file.getStoragePath()); if (bitmap != null) { thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); addBitmapToCache(imageKey, thumbnail); } } else { try { int status = -1; String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/100/100/"+URLEncoder.encode(file.getRemotePath(), "UTF-8").replaceAll("%2F", "/"); Log_OC.d("Thumbnail", "URI: " + uri); GetMethod get = new GetMethod(uri); status = client.executeMethod(get); if(status == HttpStatus.SC_OK) { byte[] bytes = get.getResponseBody(); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); if (thumbnail != null){ addBitmapToCache(imageKey, thumbnail); } } } catch(Exception e){ e.printStackTrace(); } } } return thumbnail; }

Target:
protected Bitmap doInBackground(OCFile... params) { file = params[0]; final String imageKey = String.valueOf(file.getRemoteId().hashCode()); Log_OC.d("Thumbnail", imageKey); Bitmap thumbnail = getBitmapFromDiskCache(imageKey); if (thumbnail == null) { Resources r = mContext.getResources(); int px = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics())); if (file.isDown()) { Bitmap bitmap = BitmapFactory.decodeFile(file.getStoragePath()); if (bitmap != null) { thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); addBitmapToCache(imageKey, thumbnail); } } else { try { int status = -1; String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" + px + "/" + px + "/" + Uri.encode(file.getRemotePath(), "/"); Log_OC.d("Thumbnail", "URI: " + uri); GetMethod get = new GetMethod(uri); status = client.executeMethod(get); if (status == HttpStatus.SC_OK) { byte[] bytes = get.getResponseBody(); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); if (thumbnail != null) { addBitmapToCache(imageKey, thumbnail); } } } catch (Exception e) { e.printStackTrace(); } } } return thumbnail; }
Source:
public Set<String> getUsersAsSet(AbstractBuild<?,?> build) { if (users == null || users.equals("") || build == null) return Collections.emptySet(); Set<String> set = new HashSet<String>(); for (String user : users.split(",")) { user = user.trim(); LOGGER.log(Level.FINER, "ManualCondition.getUsersAsSet(): user={0}", user); if (user.startsWith("$")){ user = user.substring(1); if (user.startsWith("{") && user.endsWith("}")) user = user.substring(1, user.length() -1); LOGGER.log(Level.INFO, "ManualCondition.getUsersAsSet(): build.getBuildVariableResolver().resolve(user=${0})={1}", new Object {user, build.getBuildVariableResolver().resolve(user)}); user = build.getBuildVariableResolver().resolve(user); } if (user != null && user.trim().length() > 0) set.add(user); } LOGGER.log(Level.INFO, "ManualCondition.getUsersAsSet(): return set={0}", set); return set; }

Target:
public Set<String> getUsersAsSet(AbstractBuild<?,?> build) { if (users == null || users.equals("")) return Collections.emptySet(); Set<String> set = new HashSet<String>(); for (String user : users.split(",")) { user = user.trim(); LOGGER.log(Level.FINER, "ManualCondition.getUsersAsSet(): user={0}", user); if (user.startsWith("$")){ user = user.substring(1); if (user.startsWith("{") && user.endsWith("}")) user = user.substring(1, user.length() -1); LOGGER.log(Level.INFO, "ManualCondition.getUsersAsSet(): build.getBuildVariableResolver().resolve(user=${0})={1}", new Object {user, build.getBuildVariableResolver().resolve(user)}); user = build.getBuildVariableResolver().resolve(user); } if (user != null && user.trim().length() > 0) set.add(user); } LOGGER.log(Level.INFO, "ManualCondition.getUsersAsSet(): return set={0}", set); return set; }
Source:
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { super.onServiceConnected(componentName, iBinder); getService().registeronServiceStateChangeListener(this); getService().registeronServiceStateChangeListener(mFolderListFragment); getService().registeronServiceStateChangeListener(mDeviceListFragment); }

Target:
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { super.onServiceConnected(componentName, iBinder); getService().registerOnServiceStateChangeListener(this); getService().registerOnServiceStateChangeListener(mFolderListFragment); getService().registerOnServiceStateChangeListener(mDeviceListFragment); }
Source:
public ConsumerGroupMetadata(String groupId, int generationId, String memberId, Optional<String> groupInstanceId) { this.groupId = groupId; this.generationId = generationId; this.memberId = memberId; this.groupInstanceId = groupInstanceId; }

Target:
public ConsumerGroupMetadata(String groupId, int generationId, String memberId, Optional<String> groupInstanceId) { this.groupId = Objects.requireNonNull(groupId, "group.id can't be null"); this.generationId = generationId; this.memberId = Objects.requireNonNull(memberId, "member.id can't be null"); this.groupInstanceId = Objects.requireNonNull(groupInstanceId, "group.instance.id can't be null"); }
Source:
private void validate() { if (this.getCloudID() == null) { throw new HelixException( "This Cloud Configuration is Invalid. The CloudID is missing from the config."); } if (this.getCloudProvider() == null) { throw new HelixException( "This Cloud Configuration is Invalid. The Cloud Provider is missing from the config."); } else if (this.getCloudProvider().equals(CloudProvider.CUSTOMIZED.name())) { if (this.getCloudInfoProcessorName() == null || this.getCloudInfoSources() == null || this.getCloudInfoSources().size() == 0) { throw new HelixException( "This Cloud Configuration is Invalid. CUSTOMIZED provider has been chosen without defining CloudInfoProcessorName or CloudInfoSources"); } } }

Target:
private void validate() { if (this.getCloudProvider() == null) { throw new HelixException( "This Cloud Configuration is Invalid. The Cloud Provider is missing from the config."); } else if (this.getCloudProvider().equals(CloudProvider.CUSTOMIZED.name())) { if (this.getCloudInfoProcessorName() == null || this.getCloudInfoSources() == null || this.getCloudInfoSources().size() == 0) { throw new HelixException( "This Cloud Configuration is Invalid. CUSTOMIZED provider has been chosen without defining CloudInfoProcessorName or CloudInfoSources"); } } }
Source:
public void Start() { if (!havePermission) { final SoundRecorder me = this; form.runOnUiThread(new Runnable() { @Override public void run() { form.askPermission(new BulkPermissionRequest(me, "AudioRecord", Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE) { @Override public void onGranted() { me.havePermission = true; me.Start(); } }); } }); return; } if (controller != null) { Log.i(TAG, "Start() called, but already recording to " + controller.file); return; } Log.i(TAG, "Start() called"); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_MEDIA_EXTERNAL_STORAGE_NOT_AVAILABLE); return; } try { controller = new RecordingController(savedRecording); } catch (PermissionException e) { form.dispatchPermissionDeniedEvent(this, "Start", e); return; } catch (Throwable t) { form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage()); return; } try { controller.start(); } catch (Throwable t) { controller = null; form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage()); return; } StartedRecording(); }

Target:
public void Start() { if (!havePermission) { final SoundRecorder me = this; form.runOnUiThread(new Runnable() { @Override public void run() { form.askPermission(new BulkPermissionRequest(me, "Start", Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE) { @Override public void onGranted() { me.havePermission = true; me.Start(); } }); } }); return; } if (controller != null) { Log.i(TAG, "Start() called, but already recording to " + controller.file); return; } Log.i(TAG, "Start() called"); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_MEDIA_EXTERNAL_STORAGE_NOT_AVAILABLE); return; } try { controller = new RecordingController(savedRecording); } catch (PermissionException e) { form.dispatchPermissionDeniedEvent(this, "Start", e); return; } catch (Throwable t) { form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage()); return; } try { controller.start(); } catch (Throwable t) { controller = null; form.dispatchErrorOccurredEvent( this, "Start", ErrorMessages.ERROR_SOUND_RECORDER_CANNOT_CREATE, t.getMessage()); return; } StartedRecording(); }
Source:
protected FileStrategyConfiguration ( final Types type, final Integer syncFileAfterRecords, final Duration syncFileAfterDuration, final String workingDir, final String publishDir) { this.type = type; this.syncDileAfterRecords = syncFileAfterRecords; this.syncFileAfterDuration = syncFileAfterDuration; this.workingDir = workingDir; this.publishDir = publishDir; }

Target:
private FileStrategyConfiguration ( final Types type, final Integer syncFileAfterRecords, final Duration syncFileAfterDuration, final String workingDir, final String publishDir) { this.type = type; this.syncFileAfterRecords = syncFileAfterRecords; this.syncFileAfterDuration = syncFileAfterDuration; this.workingDir = workingDir; this.publishDir = publishDir; }
Source:
public static void main(String[] args) throws Exception { Karyon.builder() .using(ArchaiusKaryonSuite.builder() .withConfigName("helloworld") .withApplicationOverrides(MapConfig.builder() .put("@appId", "Hello World!") .build() ) .build() ) .addProfile("local") .addModules( new ArchaiusLog4J2ConfigurationModule(), new ProvisionDebugModule(), new JettyModule(), new AdminServerModule(), new AdminUIServerModule(), new ArchaiusModule(), new ShutdownServerModule(), new JerseyServletModule() { @Override protected void configureServlets() { serve("/*").with(GuiceContainer.class); bind(GuiceContainer.class).asEagerSingleton(); bind(ArchaiusEndpoint.class).asEagerSingleton(); bind(HelloWorldApp.class).asEagerSingleton(); bind(HealthIndicator.class).to(FooServiceHealthIndicator.class); bind(LongDelayService.class).asEagerSingleton(); } @Override public String toString() { return "JerseyServletModule"; } }) .disable(GovernatorFeatures.SHUTDOWN_ON_ERROR) .startAndAwaitTermination(); }

Target:
public static void main(String[] args) throws Exception { Karyon .from(new ArchaiusKaryonModule() .withConfigName("helloworld") .withApplicationOverrides(MapConfig.builder() .put("@appId", "Hello World!") .build() ) ) .addProfile("local") .addModules( new ArchaiusLog4J2ConfigurationModule(), new ProvisionDebugModule(), new JettyModule(), new AdminServerModule(), new AdminUIServerModule(), new ShutdownServerModule(), new JerseyServletModule() { @Override protected void configureServlets() { serve("/REST/*").with(GuiceContainer.class); bind(GuiceContainer.class).asEagerSingleton(); bind(ArchaiusEndpoint.class).asEagerSingleton(); bind(HelloWorldApp.class).asEagerSingleton(); bind(HealthIndicator.class).to(FooServiceHealthIndicator.class); bind(LongDelayService.class).asEagerSingleton(); } @Override public String toString() { return "JerseyServletModule"; } } ) .disableFeature(KaryonFeatures.SHUTDOWN_ON_ERROR) .start() .awaitTermination(); }
Source:
public void the_user_clicks_on_the_button(String text) throws Throwable { List<WebElement> buttons = getDriver().findElements(By.tagName("button")); WebDriverWait webDriverWait = new WebDriverWait(getDriver(), TIMEOUT); WebElement elem = webDriverWait.until(elementToBeClickable( buttons.stream().filter(button -> button.getText().equals(text)).findFirst().get())); elem.click(); waitForAjax(); }

Target:
public void the_user_clicks_on_the_button(String text) { List<WebElement> buttons = getDriver().findElements(By.tagName("button")); WebElement element = DriverProvider.wait(getDriver()).until(elementToBeClickable( buttons.stream().filter(button -> button.getText().equals(text)).findFirst().get())); element.click(); waitForAjax(); }
Source:
public static void main(final String[] args) { AsyncDolphinLauncher.launch("MLRREEF", args, AsyncDolphinConfiguration.newBuilder() .setWorkerClass(MLRWorker.class) .setUpdaterClass(MLRUpdater.class) .setPreValueCodecClass(DenseVectorCodec.class) .setValueCodecClass(DenseVectorCodec.class) .setServerSerializerClass(DenseVectorSerializer.class) .setWorkerSerializerClass(MLRDataSerializer.class) .addParameterClass(MLRParameters.NumClasses.class) .addParameterClass(MLRParameters.NumFeatures.class) .addParameterClass(MLRParameters.InitialStepSize.class) .addParameterClass(MLRParameters.Lambda.class) .addParameterClass(MLRParameters.WorkerLogPeriod.class) .addParameterClass(MLRParameters.NumFeaturesPerPartition.class) .addParameterClass(MLRParameters.ModelGaussian.class) .addParameterClass(MLRParameters.DecayPeriod.class) .addParameterClass(MLRParameters.DecayRate.class) .addParameterClass(MLRParameters.TrainErrorDatasetSize.class) .addParameterClass(MLRParameters.NumBatchPerLossLog.class) .build()); }

Target:
public static void main(final String[] args) { AsyncDolphinLauncher.launch("MLRREEF", args, AsyncDolphinConfiguration.newBuilder() .setWorkerClass(MLRWorker.class) .setUpdaterClass(MLRUpdater.class) .setPreValueCodecClass(DenseVectorCodec.class) .setValueCodecClass(DenseVectorCodec.class) .setServerSerializerClass(DenseVectorSerializer.class) .setWorkerSerializerClass(MLRDataSerializer.class) .addParameterClass(NumClasses.class) .addParameterClass(NumFeatures.class) .addParameterClass(InitialStepSize.class) .addParameterClass(Lambda.class) .addParameterClass(NumFeaturesPerPartition.class) .addParameterClass(ModelGaussian.class) .addParameterClass(DecayPeriod.class) .addParameterClass(DecayRate.class) .addParameterClass(TrainErrorDatasetSize.class) .build()); }
Source:
public static void init() { String host = PropertiesManager.getValue(PropertiesManager.KEY_ELASTIC_HOST, "localhost"); Integer port = Convert.toInteger(PropertiesManager.getValue(PropertiesManager.KEY_ELASTIC_PORT, "9300")); try { LOG.log(Level.INFO, MessageFormat.format("Connecting to ElasticSearch at {0}", host + ":" + port)); client = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port)); } catch (UnknownHostException ex) { throw new OpenStorefrontRuntimeException("Unable to find elastic search server host", "Check configuration; Check Host and Port; property: " + PropertiesManager.KEY_ELASTIC_HOST + " current value: " + host); } updateFieldData(); }

Target:
public static void init() { String host = PropertiesManager.getValue(PropertiesManager.KEY_ELASTIC_HOST, "localhost"); Integer port = Convert.toInteger(PropertiesManager.getValue(PropertiesManager.KEY_ELASTIC_PORT, "9200")); lowLevelRestClient = RestClient.builder(new HttpHost(host, port, "http")).build(); client = new RestHighLevelClient(lowLevelRestClient); LOG.log(Level.INFO, MessageFormat.format("Connecting to ElasticSearch at {0}", host + ":" + port)); }
Source:
protected boolean set(EntityAgeable entity, Map<Key<?>, Object> keyValues) { int age = (Integer) keyValues.get(Keys.AGE); boolean baby = (Boolean) keyValues.get(Keys.BABY); boolean adult = (Boolean) keyValues.get(Keys.ADULT); if(baby) entity.setGrowingAge(-10); else entity.setGrowingAge(1); entity.setGrowingAge(age); return true; }

Target:
protected boolean set(EntityAgeable entity, Map<Key<?>, Object> keyValues) { int age = (Integer) keyValues.get(Keys.AGE); boolean adult = (Boolean) keyValues.get(Keys.IS_ADULT); if (adult) { entity.setGrowingAge(1); } else { entity.setGrowingAge(-1); } entity.setGrowingAge(age); return true; }
Source:
public String toString() { return Objects.toStringHelper("Block") .add("id", getId()) .add("name", getName()) .add("translation", getTranslation()) .add("class", getClass().getName()) .toString(); }

Target:
public String toString() { if (this.toString == null) { this.toString = SpongeCatalogType.toStringHelperTranslatable(this) .add("class", getClass().getName()) .toString(); } return this.toString; }
Source:
Packet parse(final Header header, final ByteBuf buffer, final PeerAccessor peerAccessor) throws InvalidPacketException; } interface Visitor { void visit(final InitiationPacket packet); void visit(final TerminationPacket packet); void visit(final PeerUpPacket packet); void visit(final PeerDownPacket packet); void visit(final StatisticsReportPacket packet); void visit(final RouteMonitoringPacket packet); void visit(final RouteMirroringPacket packet); void visit(final UnknownPacket packet); class Adapter implements Visitor { public void visit(RouteMonitoringPacket packet) public void visit(StatisticsReportPacket packet) public void visit(PeerDownPacket packet) public void visit(PeerUpPacket packet) public void visit(InitiationPacket packet) public void visit(TerminationPacket packet) public void visit(RouteMirroringPacket packet) public void visit(final UnknownPacket packet) } }

Target:
Packet parse(final Header header, final ByteBuf buffer, final PeerAccessor peerAccessor) throws InvalidPacketException; } interface Visitor { void visit(final InitiationPacket packet); void visit(final TerminationPacket packet); void visit(final PeerUpPacket packet); void visit(final PeerDownPacket packet); void visit(final StatisticsReportPacket packet); void visit(final RouteMonitoringPacket packet); void visit(final RouteMirroringPacket packet); void visit(final UnknownPacket packet); class Adapter implements Visitor { public void visit(final RouteMonitoringPacket packet) public void visit(final StatisticsReportPacket packet) public void visit(final PeerDownPacket packet) public void visit(final PeerUpPacket packet) public void visit(final InitiationPacket packet) public void visit(final TerminationPacket packet) public void visit(final RouteMirroringPacket packet) public void visit(final UnknownPacket packet) } }
Source:
public List<ExecutionYear> getValidExecutionYearsForUnit(Unit unit) { List<ScientificAreaUnit> scientificAreaUnits = unit.getSubUnits().stream() .filter(Unit::isScientificAreaUnit) .map(ScientificAreaUnit.class::cast) .sorted(ScientificAreaUnit.COMPARATOR_BY_NAME_AND_ID) .collect(toList()); HashSet<ExecutionYear> validExecutionYears = new HashSet<>(); final List<ExecutionYear> allExecutionYears = ExecutionYear.readExecutionYears(ExecutionYear.readFirstExecutionYear(), ExecutionYear.readLastExecutionYear()); for (ExecutionYear executionYear : allExecutionYears) { for (ScientificAreaUnit scientificAreaUnit : scientificAreaUnits) { final List<CompetenceCourseGroupUnit> competenceCourseGroupUnits = scientificAreaUnit.getCompetenceCourseGroupUnits(); for (CompetenceCourseGroupUnit competenceCourseGroupUnit : competenceCourseGroupUnits) { List<CompetenceCourse> competenceCoursesByExecutionYear = competenceCourseGroupUnit.getCompetenceCoursesByExecutionYear(executionYear); if (!competenceCoursesByExecutionYear.isEmpty()) { validExecutionYears.add(executionYear); } } } } return validExecutionYears.stream() .sorted(ExecutionYear.REVERSE_COMPARATOR_BY_YEAR) .collect(toList()); }

Target:
public List<ExecutionYear> getValidExecutionYearsForUnit(Unit unit) { HashSet<ExecutionYear> validExecutionYears = new HashSet<>(); final List<ExecutionYear> allExecutionYears = getAllExecutionYears(); unit.getSubUnits().stream() .filter(Unit::isScientificAreaUnit) .map(ScientificAreaUnit.class::cast) .map(scientificAreaUnit -> scientificAreaUnit.getCompetenceCourseGroupUnits()) .forEach(competenceCourseGroupUnits -> { allExecutionYears.stream() .forEach(executionYear -> { competenceCourseGroupUnits.stream() .forEach(competenceCourseGroupUnit -> { if (!competenceCourseGroupUnit.getCompetenceCoursesByExecutionYear(executionYear).isEmpty()) { validExecutionYears.add(executionYear); } }); }); }); return validExecutionYears.stream() .sorted(ExecutionYear.REVERSE_COMPARATOR_BY_YEAR) .collect(toList()); }
Source:
private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { throw new Exception(sender.hasMuteReason() ? tl("voiceSilencedReason", sender.getMuteReason()) : tl("voiceSilenced")); } if (!sender.isAuthorized("essentials.afk.message")) { throw new Exception(tl("noPermToAFKMessage")); } } user.setDisplayNick(); String msg = ""; String selfmsg = ""; if (!user.toggleAfk()) { if (!user.isHidden()) { msg = tl("userIsNotAway", user.getDisplayName()); selfmsg = tl("userIsNotAwaySelf"); } user.updateActivity(false); } else { if (!user.isHidden()) { if (message != null) { msg = tl("userIsAwayWithMessage", user.getDisplayName(), message); selfmsg = tl("userIsAwaySelfWithMessage", message); } else { msg = tl("userIsAway", user.getDisplayName()); selfmsg = tl("userIsAwaySelf"); } } user.setAfkMessage(message); } if (!msg.isEmpty()) { if (ess.getSettings().broadcastAfkMessage()) { ess.broadcastMessage(user, msg, Collections.singleton(user)); user.sendMessage(selfmsg); } else { user.sendMessage(selfmsg); } } user.setDisplayNick(); }

Target:
private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { throw new Exception(sender.hasMuteReason() ? tl("voiceSilencedReason", sender.getMuteReason()) : tl("voiceSilenced")); } if (!sender.isAuthorized("essentials.afk.message")) { throw new Exception(tl("noPermToAFKMessage")); } } user.setDisplayNick(); String msg = ""; String selfmsg = ""; if (!user.toggleAfk(AfkStatusChangeEvent.Cause.COMMAND)) { if (!user.isHidden()) { msg = tl("userIsNotAway", user.getDisplayName()); selfmsg = tl("userIsNotAwaySelf"); } user.updateActivity(false, AfkStatusChangeEvent.Cause.COMMAND); } else { if (!user.isHidden()) { if (message != null) { msg = tl("userIsAwayWithMessage", user.getDisplayName(), message); selfmsg = tl("userIsAwaySelfWithMessage", message); } else { msg = tl("userIsAway", user.getDisplayName()); selfmsg = tl("userIsAwaySelf"); } } user.setAfkMessage(message); } if (!msg.isEmpty() && ess.getSettings().broadcastAfkMessage()) { ess.broadcastMessage(user, msg, u -> u == user); } if (!selfmsg.isEmpty()) { user.sendMessage(selfmsg); } user.setDisplayNick(); }
Source:
public void shouldRaiseAlertIfResponseHasRemoteFileContentAndPayloadIsNullByteBased() throws HttpMalformedHeaderException { NullByteVulnerableServerHandler vulnServerHandler = new NullByteVulnerableServerHandler("/", "p", Tech.Linux) { protected String getContent(IHTTPSession session) { String value = getFirstParamValue(session, "p"); if (value.contains(NULL_BYTE_CHARACTER)) { return "<!doctype html><html itemscope=\"\" itemtype=\"<LINK_0>\" " + "lang=\"en-IN\"><head><meta charset=\"UTF-8\"><meta content=\"origin\" " + "name=\"referrer\"><meta content=\"/logos/doodles/2020/sir-john-tenniels-200th-birthday-6753651837108300.5-l.png\" " + "itemprop=\"image\"><meta content=\"origin\" name=\"referrer\"><title>Google</title> " + "</html>"; } else { return "<html></html>"; } } }; nano.addHandler(vulnServerHandler); rule.init(getHttpMessage("/?p=a"), parent); rule.setAttackStrength(AttackStrength.INSANE); rule.scan(); assertThat(alertsRaised, hasSize(1)); }

Target:
public void shouldRaiseAlertIfResponseHasRemoteFileContentAndPayloadIsNullByteBased() throws HttpMalformedHeaderException { NullByteVulnerableServerHandler vulnServerHandler = new NullByteVulnerableServerHandler("/", "p", Tech.Linux) { protected String getContent(IHTTPSession session) { String value = getFirstParamValue(session, "p"); if (value.contains(NULL_BYTE_CHARACTER)) { return "<html><title>Google</title></html>"; } else { return "<html></html>"; } } }; nano.addHandler(vulnServerHandler); rule.init(getHttpMessage("/?p=a"), parent); rule.setAttackStrength(AttackStrength.INSANE); rule.scan(); assertThat(alertsRaised, hasSize(1)); }
Source:
public void errorHandler_clientResetReported() { RealmUser user = SyncTestUtils.Companion.createTestUser(app); String url = "realm://objectserver.realm.io/default"; final SyncConfiguration config = configFactory.createSyncConfigurationBuilder(user) .clientResyncMode(ClientResyncMode.MANUAL) .errorHandler((session, error) -> { if (error.getErrorCode() != ErrorCode.CLIENT_RESET) { fail("Wrong error " + error.toString()); return; } final ClientResetRequiredError handler = (ClientResetRequiredError) error; String filePathFromError = handler.getOriginalFile().getAbsolutePath(); String filePathFromConfig = session.getConfiguration().getPath(); assertEquals(filePathFromError, filePathFromConfig); assertFalse(handler.getBackupFile().exists()); assertTrue(handler.getOriginalFile().exists()); looperThread.testComplete(); }) .build(); Realm realm = Realm.getInstance(config); looperThread.addTestRealm(realm); SyncManager syncService = user.getApp().getSyncService(); syncService.simulateClientReset(syncService.getSession((config))); }

Target:
public void errorHandler_clientResetReported() { RealmUser user = SyncTestUtils.createTestUser(app); String url = "realm://objectserver.realm.io/default"; final SyncConfiguration config = configFactory.createSyncConfigurationBuilder(user) .clientResyncMode(ClientResyncMode.MANUAL) .errorHandler((session, error) -> { if (error.getErrorCode() != ErrorCode.CLIENT_RESET) { fail("Wrong error " + error.toString()); return; } final ClientResetRequiredError handler = (ClientResetRequiredError) error; String filePathFromError = handler.getOriginalFile().getAbsolutePath(); String filePathFromConfig = session.getConfiguration().getPath(); assertEquals(filePathFromError, filePathFromConfig); assertFalse(handler.getBackupFile().exists()); assertTrue(handler.getOriginalFile().exists()); looperThread.testComplete(); }) .build(); Realm realm = Realm.getInstance(config); looperThread.addTestRealm(realm); RealmSync syncService = user.getApp().getSync(); syncService.simulateClientReset(syncService.getSession((config))); }
Source:
public GenericScriptEngineFactory() { for (javax.script.ScriptEngineFactory f : engineManager.getEngineFactories()) { logger.info("Supported script engine: for language with mimetypes {}", f.getEngineName(), f.getLanguageName(), f.getMimeTypes()); } }

Target:
public GenericScriptEngineFactory() { for (javax.script.ScriptEngineFactory f : engineManager.getEngineFactories()) { logger.info("Activated scripting support for {}", f.getLanguageName()); logger.debug( "Activated scripting support with engine {}({}) for {}({}) with mimetypes and file extensions {}", f.getEngineName(), f.getEngineVersion(), f.getLanguageName(), f.getLanguageVersion(), f.getMimeTypes(), f.getExtensions()); } }
Source:
private static Boolean hasSuspiciousContigs(final ReadCountCollection singleSampleTangentNormalized, final Map<String, Double> contigToMedian) { final List<String> allContigsPresent = retrieveAllContigsPresent(singleSampleTangentNormalized); for (String contig: allContigsPresent) { final ReadCountCollection oneContigReadCountCollection = singleSampleTangentNormalized.subsetTargets(singleSampleTangentNormalized.targets().stream().filter(t -> t.getContig().equals(contig)).collect(Collectors.toSet())); final RealMatrix counts = oneContigReadCountCollection.counts(); for (int i = 0; i < 4; i++) { final RealMatrix partitionCounts = counts.getSubMatrix(i * counts.getRowDimension() / 4, ((i + 1) * counts.getRowDimension() / 4) - 1, 0, 0); final double[] partitionArray = DoubleStream.of(partitionCounts.getColumn(0)).map(d -> Math.pow(2, d)).sorted().toArray(); double median = new Median().evaluate(partitionArray); final double medianShiftInCRSpace = contigToMedian.getOrDefault(contig, 1.0) - 1.0; median -= medianShiftInCRSpace; if ((median > AMP_THRESHOLD) || (median < DEL_THRESHOLD)) { logger.info("Suspicious contig: " + singleSampleTangentNormalized.columnNames().get(0) + " " + contig + " (" + median + " -- " + i + ")"); return true; } } } return false; }

Target:
private static Boolean hasSuspiciousContigs(final ReadCountCollection singleSampleTangentNormalized, final Map<String, Double> contigToMedian) { final List<String> allContigsPresent = retrieveAllContigsPresent(singleSampleTangentNormalized); for (String contig: allContigsPresent) { final ReadCountCollection oneContigReadCountCollection = singleSampleTangentNormalized.subsetTargets(singleSampleTangentNormalized.targets().stream().filter(t -> t.getContig().equals(contig)).collect(Collectors.toSet())); final RealMatrix countsAsMatrix = oneContigReadCountCollection.counts(); final RealVector counts = countsAsMatrix.getColumnVector(0); for (int i = 0; i < 4; i++) { final RealVector partitionCounts = counts.getSubVector(i * counts.getDimension() / 4, counts.getDimension() / 4); final double[] partitionArray = DoubleStream.of(partitionCounts.toArray()).map(d -> Math.pow(2, d)).sorted().toArray(); double median = new Median().evaluate(partitionArray); final double medianShiftInCRSpace = contigToMedian.getOrDefault(contig, 1.0) - 1.0; median -= medianShiftInCRSpace; if ((median > AMP_THRESHOLD) || (median < DEL_THRESHOLD)) { logger.info("Suspicious contig: " + singleSampleTangentNormalized.columnNames().get(0) + " " + contig + " (" + median + " -- " + i + ")"); return true; } } } return false; }
Source:
public static void main(String args[]) throws Exception { ZooKeeper zk = new ZooKeeper("localhost:2181", 30000, event -> { }); final String contextPath = "/staging"; final List<String> locks = zk.getChildren(contextPath + "/nakadi/locks", false); final List<String> subscriptions = zk.getChildren(contextPath + "/nakadi/subscriptions", false); System.out.println(locks.size() + " locks, " + subscriptions.size() + " subscriptions"); int notExists = 0; for (int i = 0; i < locks.size(); i++) { System.out.println((i * 100 / (locks.size() - 1)) + "%"); String lockName = locks.get(i); final String subscriptionId = lockName.substring(13); if (!subscriptions.contains(subscriptionId)) { ZKUtil.deleteRecursive(zk, contextPath + "/nakadi/locks/" + lockName); System.out.println("Removed lock for " + subscriptionId + " as it doesn't exist"); notExists++; } } System.out.println("Exist: " + (locks.size() - notExists) + ", Removed: " + notExists); }

Target:
public static void main(String args[]) throws Exception { ZooKeeper zk = new ZooKeeper("localhost:2181", 30000, event -> { }); final String contextPath = "/staging"; final List<String> locks = zk.getChildren(contextPath + "/nakadi/locks", false); System.out.println(locks.size() + "Waiting 70 seconds before fetching list of subscriptions..."); Thread.sleep(70000); final Set<String> subscriptions = new HashSet<>(zk.getChildren(contextPath + "/nakadi/subscriptions", false)); System.out.println(locks.size() + " locks, " + subscriptions.size() + " subscriptions"); int notExists = 0; for (int i = 0; i < locks.size(); i++) { String lockName = locks.get(i); final String subscriptionId = lockName.substring(13); if (!subscriptions.contains(subscriptionId)) { ZKUtil.deleteRecursive(zk, contextPath + "/nakadi/locks/" + lockName); System.out.println("Removed lock for " + subscriptionId + " as it doesn't exist"); notExists++; } System.out.println(((i + 1) * 100 / locks.size()) + "%"); } System.out.println("Exist: " + (locks.size() - notExists) + ", Removed: " + notExists); }
Source:
public void testWidthHeaderColumnTo0() { openVSM(); setNewHeaderColumnWidth(0); SWTBotTree treeTable = createCrossTable(); Display.getDefault().syncExec(new Runnable() { @Override public void run() { assertTrue("Header column size should be greater than 0 to be adapt to column content.", treeTable.widget.getColumn(0).getWidth() > 0); } }); }

Target:
public void testWidthHeaderColumnTo0() { openVSM(); setNewHeaderColumnWidth(0); SWTBotTree treeTable = createCrossTable(); Display.getDefault().syncExec(new Runnable() { @Override public void run() { assertTrue("Header column size should be greater than 0 to be adapted to column content.", treeTable.widget.getColumn(0).getWidth() > 0); } }); }
Source:
public JsonNode getBasePod(String podId) { String podURI = String.format( "%s/api/v1/namespaces/default/pods/%s", this.kubernetesURI, podId); HttpURLConnection conn = NetworkUtils.getHttpConnection(podURI); if (conn == null) { LOG.log(Level.SEVERE, "Failed to find k8s deployment API"); return null; } try { if (!NetworkUtils.sendHttpGetRequest(conn)) { LOG.log(Level.SEVERE, "Failed to send GET to k8s deployment API"); return null; } boolean success = NetworkUtils.checkHttpResponseCode(conn, HttpURLConnection.HTTP_OK); if (success) { LOG.log(Level.INFO, "Pulled existing pod from k8s"); byte[] bytes = NetworkUtils.readHttpResponse(conn); ObjectMapper mapper = new ObjectMapper(); JsonNode podDefinition = mapper.readTree(bytes); return podDefinition; } else { LOG.log(Level.SEVERE, "Failure to receive existing pod from k8s"); return null; } } catch (IOException ioe) { LOG.log(Level.SEVERE, "Unable to parse pod JSON"); return null; } finally { conn.disconnect(); } }

Target:
protected JsonNode getBasePod(String podId) throws IOException { String podURI = String.format( "%s/%s", this.baseUriPath, podId); HttpJsonClient jsonAPIClient = new HttpJsonClient(podURI); JsonNode result; try { result = jsonAPIClient.get(HttpURLConnection.HTTP_OK); } catch (IOException ioe) { throw ioe; } return result; }
Source:
public SpliceDefaultCompactor(final Configuration conf, final Store store, long smallestReadPoint) { super(conf, store); }

Target:
public SpliceDefaultCompactor(final Configuration conf, final Store store, long smallestReadPoint) { super(conf, store, smallestReadPoint); }
Source:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } } } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { if (volume.getName().equals(Config.<String> getValue(ConfigValues.GlusterMetaVolumeName))) { log.debug("Mounting gluster meta volume on nodes of cluster '{}'", cluster.getName()); acquireLock(cluster.getId()); try { mountMetaVolumeOnNodes(volume.getClusterId()); } catch (Exception e) { log.error("Error while mounting the gluster meta volume on nodes of cluster '{}': {}", cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } } } }

Target:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } } } }