auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JAXBProcessInstanceList processInstancesDataTable(Properties properties) throws Throwable { logger.debug("processInstancesDataTable"); final String configId = properties.getProperty("configId"); final BpmWidgetInfo bpmWidgetInfo = bpmWidgetInfoManager.getBpmWidgetInfo(Integer.parseInt(configId)); final String information = bpmWidgetInfo.getInformationDraft(); final ApsProperties config = new ApsProperties(); try { if (null != configId) { try { if (StringUtils.isNotEmpty(information)) { try { config.loadFromXml(information); } catch (IOException e) { logger.error("Error load configuration ", e.getMessage()); } final JAXBProcessInstanceList processList = new JAXBProcessInstanceList(); this.setElementDatatableFieldDefinition(config, processList); config.loadFromXml(information); String knowledgetSource = (String) config.get(KieBpmSystemConstants.WIDGET_INFO_PROP_KIE_SOURCE_ID); KieBpmConfig bpmConfig = this.getKieFormManager().getKieServerConfigurations().get(knowledgetSource); this.setElementList(bpmConfig, config, processList); processList.setContainerId(config.getProperty("containerId")); processList.setProcessId(config.getProperty("processId")); return processList; } } catch (ApsSystemException e) { logger.error("Error {}", e); } } return null; } catch (Throwable t) { logger.error("Failed to get process instances data table ",t); throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR, NO_ERROR_GETTING_THE_LIST_OF_PROCESSES, Response.Status.INTERNAL_SERVER_ERROR); } }

Target:
public JAXBProcessInstanceList processInstancesDataTable(Properties properties) throws Throwable { final String configId = properties.getProperty("configId"); final BpmWidgetInfo bpmWidgetInfo = bpmWidgetInfoManager.getBpmWidgetInfo(Integer.parseInt(configId)); final String information = bpmWidgetInfo.getInformationDraft(); final ApsProperties config = new ApsProperties(); try { if (null != configId) { try { if (StringUtils.isNotEmpty(information)) { try { config.loadFromXml(information); } catch (IOException e) { logger.error("Error load configuration ", e.getMessage()); } final JAXBProcessInstanceList processList = new JAXBProcessInstanceList(); this.setElementDatatableFieldDefinition(config, processList); config.loadFromXml(information); String knowledgetSource = (String) config.get(KieBpmSystemConstants.WIDGET_INFO_PROP_KIE_SOURCE_ID); KieBpmConfig bpmConfig = this.getKieFormManager().getKieServerConfigurations().get(knowledgetSource); this.setElementList(bpmConfig, config, processList); processList.setContainerId(config.getProperty("containerId")); processList.setProcessId(config.getProperty("processId")); return processList; } } catch (ApsSystemException e) { logger.error("Error {}", e); } } return null; } catch (Throwable t) { logger.error("Failed to get process instances data table ",t); throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR, NO_ERROR_GETTING_THE_LIST_OF_PROCESSES, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
public ParseTexDialogView(BibDatabaseContext databaseContext) { this.databaseContext = databaseContext; this.setTitle(Localization.lang("LaTeX integration tools")); ViewLoader.view(this) .load() .setAsDialogPane(this); Button parseButton = (Button) this.getDialogPane().lookupButton(parseButtonType); parseButton.disableProperty().bindBidirectional(viewModel.noFilesFoundProperty()); setResultConverter(button -> { if (button == parseButtonType) { viewModel.parse(); } return null; }); }

Target:
public ParseTexDialogView(BibDatabaseContext databaseContext) { this.databaseContext = databaseContext; this.validationVisualizer = new ControlsFxVisualizer(); this.setTitle(Localization.lang("LaTeX references search")); ViewLoader.view(this) .load() .setAsDialogPane(this); ControlHelper.setAction(parseButtonType, getDialogPane(), event -> viewModel.parseButtonClicked()); Button parseButton = (Button) getDialogPane().lookupButton(parseButtonType); parseButton.disableProperty().bind(viewModel.noFilesFoundProperty().or( Bindings.isEmpty(viewModel.getCheckedFileList()))); }
Source:
private RelatedArtifactChangedColumn() { super(WorldXViewerFactory.COLUMN_NAMESPACE + ".RelatedArtifactChangedColumn", "Related Artifact Changed", 75, SWT.LEFT, true, SortDataType.String, false, "Commited - baseline/commited branch \nUnmodified - Related artifact has not changed " + "\n<date> - Related artifact has been modified after task at the specified date \nEmpty - There is no related artifact"); }

Target:
private RelatedArtifactChangedColumn() { super(WorldXViewerFactory.COLUMN_NAMESPACE + ".RelatedArtifactChangedColumn", "Related Artifact Changed", 75, SWT.LEFT, true, SortDataType.String, false, "Committed - baseline/commited branch \nUnmodified - Related artifact has not changed " + "\n<date> - Related artifact has been modified after task at the specified date \nEmpty - There is no related artifact"); }
Source:
private List<AppInfo> getAppsFromPackageAndConfig(AppPackage ap, ConfigPackage cp, String configApps) { if (cp == null || configApps == null || !(configApps.equals(CONFIG_INCLUSIVE) || configApps.equals(CONFIG_EXCLUSIVE))) { return ap.getApplications(); } File src = new File(cp.tempDirectory(), "app"); File dest = new File(ap.tempDirectory(), "app"); if (!src.exists()) { return ap.getApplications(); } if (configApps.equals(CONFIG_EXCLUSIVE)) { for (File app : dest.listFiles()) { if (app.getName().endsWith("json")) { FileUtils.deleteQuietly(new File(dest, app.getName())); } } } else { for (File app : src.listFiles()) { FileUtils.deleteQuietly(new File(dest, app.getName())); } } for (File app : src.listFiles()) { try { FileUtils.moveFileToDirectory(app, dest, true); } catch (IOException e) { LOG.warn("Application from the config file failed while processing.", app.getName()); } } try { FileUtils.deleteDirectory(src); } catch (IOException e) { LOG.warn("Failed to delete the Config Apps folder"); } ap.processAppDirectory(configApps.equals(CONFIG_EXCLUSIVE)); return ap.getApplications(); }

Target:
private List<AppInfo> getAppsFromPackageAndConfig(AppPackage ap, ConfigPackage cp, String configApps) { if (cp == null || configApps == null || !(configApps.equals(CONFIG_INCLUSIVE) || configApps.equals(CONFIG_EXCLUSIVE))) { return ap.getApplications(); } File src = new File(cp.tempDirectory(), "app"); File dest = new File(ap.tempDirectory(), "app"); if (!src.exists()) { return ap.getApplications(); } if (configApps.equals(CONFIG_EXCLUSIVE)) { for (File file : dest.listFiles()) { if (file.getName().endsWith(".json")) { FileUtils.deleteQuietly(new File(dest, file.getName())); } } } else { for (File file : src.listFiles()) { FileUtils.deleteQuietly(new File(dest, file.getName())); } } for (File file : src.listFiles()) { try { FileUtils.moveFileToDirectory(file, dest, true); } catch (IOException e) { LOG.warn("Application from the config file failed while processing.", file.getName()); } } try { FileUtils.deleteDirectory(src); } catch (IOException e) { LOG.warn("Failed to delete the Config Apps folder"); } ap.processAppDirectory(configApps.equals(CONFIG_EXCLUSIVE)); return ap.getApplications(); }
Source:
public static synchronized void cleanup() throws IOException { System.out.println("deleting dirs"); for(File dir : allDirsCreated) { System.err.println("cleaning up " + dir.getCanonicalPath()); recursivelyDelete(dir); } allDirsCreated.clear(); }

Target:
public static synchronized void cleanup() throws IOException { for (File dir : allDirsCreated) { recursivelyDelete(dir); } allDirsCreated.clear(); }
Source:
private void initPopupCloseOverlay() { if (DEBUG) Log.d(TAG, "initPopupCloseOverlay() called"); if (closeOverlayView != null) return; closeOverlayView = View.inflate(service, R.layout.player_popup_close_overlay, null); closeOverlayButton = closeOverlayView.findViewById(R.id.closeButton); final int layoutParamType = Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O ? WindowManager.LayoutParams.TYPE_PHONE : WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; final int flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; WindowManager.LayoutParams closeOverlayLayoutParams = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, layoutParamType, flags, PixelFormat.TRANSLUCENT); closeOverlayLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; closeOverlayLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; closeOverlayButton.setVisibility(View.GONE); windowManager.addView(closeOverlayView, closeOverlayLayoutParams); }

Target:
private void initPopupCloseOverlay() { if (DEBUG) { Log.d(TAG, "initPopupCloseOverlay() called"); } if (closeOverlayView != null) { return; } closeOverlayView = View.inflate(service, R.layout.player_popup_close_overlay, null); closeOverlayButton = closeOverlayView.findViewById(R.id.closeButton); final int flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; final WindowManager.LayoutParams closeOverlayLayoutParams = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, popupLayoutParamType(), flags, PixelFormat.TRANSLUCENT); closeOverlayLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; closeOverlayLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; closeOverlayButton.setVisibility(View.GONE); windowManager.addView(closeOverlayView, closeOverlayLayoutParams); }
Source:
public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = new CPPASTLiteralExpression(fKind, this.getValue(), fNumericCompilerSuffixes); copy.fStringLiteralSize = fStringLiteralSize; copy.fEvaluation = fEvaluation; copy.fUserDefinedLiteralOperator = fUserDefinedLiteralOperator; copy.fImplicitNames = fImplicitNames; return copy(copy, style); }

Target:
public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = new CPPASTLiteralExpression(fKind, getValue().clone(), fNumericCompilerSuffixes); copy.fStringLiteralSize = fStringLiteralSize; copy.fEvaluation = fEvaluation; copy.fUserDefinedLiteralOperator = fUserDefinedLiteralOperator; copy.fImplicitNames = fImplicitNames; return copy(copy, style); }
Source:
public static Optional<AddOn> createAddOn(Path file) { try { return Optional.of(new AddOn(file)); } catch (AddOn.InvalidAddOnException e) { if (logger.isDebugEnabled() || Constant.isDevMode()) { logger.warn("Invalid add-on: " + file.toString(), e); } else { logger.warn("Invalid add-on: " + file.toString()); } } catch (Exception e) { logger.error("Failed to create an add-on from: " + file.toString(), e); } return Optional.empty(); }

Target:
public static Optional<AddOn> createAddOn(Path file) { try { return Optional.of(new AddOn(file)); } catch (AddOn.InvalidAddOnException e) { String logMessage = "Invalid add-on: " + file.toString() + "."; if (logger.isDebugEnabled() || Constant.isDevMode()) { logger.warn(logMessage, e); } else { logger.warn(logMessage + " " + e.getMessage()); } } catch (Exception e) { logger.error("Failed to create an add-on from: " + file.toString(), e); } return Optional.empty(); }
Source:
public StatusDTO setKeycloakAuthUrl(String keycloakAuthUrl) { this.keycloakAuthUrl = keycloakAuthUrl; return this; }

Target:
public KeycloakStatusDTO setKeycloakAuthUrl(String keycloakAuthUrl) { this.keycloakAuthUrl = keycloakAuthUrl; return this; }
Source:
private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } LOGGER.info(NLS.bind("Extracting OpenShift archive {0}.", fileName)); String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); FileHelper.createDirectory(new File(extractedDirectory)); FileHelper.unzipFile(new File(fileName), new File(extractedDirectory)); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }

Target:
private String extractArchive(String fileName, File outputDirectory) { if (StringUtils.isEmpty(fileName)) { return null; } LOGGER.info(NLS.bind("Extracting OpenShift archive {0}.", fileName)); String extractedDirectory = null; if (fileName.endsWith(SUFFIX_ZIP)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_ZIP); FileHelper.unzipFile(new File(fileName), outputDirectory); } else if (fileName.endsWith(SUFFIX_TAR_GZ)) { extractedDirectory = StringUtils.chomp(fileName, SUFFIX_TAR_GZ); FileHelper.extractTarGz(new File(fileName), outputDirectory); } return extractedDirectory; }
Source:
private void requestLocationUpdates(Set<String> providers) { Context context = CommCareApplication._().getApplicationContext(); if (providers.isEmpty() && (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mLocationManager.removeUpdates(PollSensorAction.this); return; } for (String provider : providers) { if ((provider.equals(LocationManager.GPS_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) || (provider.equals(LocationManager.NETWORK_PROVIDER) && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mLocationManager.requestLocationUpdates(provider, 0, 0, PollSensorAction.this); } } Timer timeout = new Timer(); timeout.schedule(new StopPollingTask(), GeoUtils.MAXIMUM_WAIT); }

Target:
private void requestLocationUpdates(Set<String> providers) { if (providers.isEmpty() && hasLocationPerms()) { mLocationManager.removeUpdates(PollSensorAction.this); return; } for (String provider : providers) { if (hasLocationPerms()) { mLocationManager.requestLocationUpdates(provider, 0, 0, PollSensorAction.this); } } Timer timeout = new Timer(); timeout.schedule(new StopPollingTask(), GeoUtils.MAXIMUM_WAIT); }
Source:
public List<ServiceTaskSummary> getEnabledServiceTasks() { return repoService.getServices().stream() .filter(service -> service.isEnabled()) .map(repoData -> new ServiceTaskSummary(repoData.getId(), "fa fa-cogs", repoData.getName(), repoData.getDescription(), repoData.getActiontitle(), repoData.isEnabled(), repoData.getInstalledOn())) .collect(Collectors.toList()); }

Target:
public List<ServiceTaskSummary> getEnabledServiceTasks() { return repoService.getServices().stream() .filter(service -> service.isEnabled()) .map(repoData -> new ServiceTaskSummary(repoData.getId(), "fa fa-cogs", repoData.getName(), repoData.getDescription(), repoData.getActiontitle(), repoData.isEnabled(), repoData.getInstalledOn())) .sorted((service, service2) -> service.getName().compareTo(service2.getName())) .collect(Collectors.toList()); }
Source:
protected void createAndDispatchStackFrameSwitchedEvent(String tid, String frameId) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); IFrameDMContext frameDmc = ((MIStack)(stackService)).createFrameDMContext(execDmc, Integer.parseInt(frameId)); AbstractDMEvent<IFrameDMContext> event = null; event = new StackFrameSwitchedEvent(frameDmc); fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); }

Target:
protected void createAndDispatchStackFrameSwitchedEvent(String tid, String frameId) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); IFrameDMContext frameDmc = ((MIStack)(stackService)).createFrameDMContext(execDmc, Integer.parseInt(frameId)); fCommandControl.getSession().dispatchEvent(new StackFrameSwitchedEvent(frameDmc), fCommandControl.getProperties()); }
Source:
public static Map<String, SavedAttachment> findExistingAttachments( Map<String, ? extends Attachment> attachments) { Map<String, SavedAttachment> list = new HashMap<String, SavedAttachment>(); for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) { if (a instanceof SavedAttachment) { list.put(a.getKey(), (SavedAttachment)a.getValue()); } } return list; }

Target:
public static Map<String, SavedAttachment> findExistingAttachments( Map<String, ? extends Attachment> attachments) { Map<String, SavedAttachment> existingAttachments = new HashMap<String, SavedAttachment>(); for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) { if (a instanceof SavedAttachment) { existingAttachments.put(a.getKey(), (SavedAttachment)a.getValue()); } } return existingAttachments; }
Source:
private void visitProperties(ObjectType objType, boolean isStatic, Set<String> skipNames) { boolean hasPrivateProps = false; for (String propName : getSortedPropertyNames(objType)) { if (skipNames.contains(propName)) continue; if ("prototype".equals(propName) || "superClass_".equals(propName) || "constructor".equals(propName)) { continue; } if (isPrivate(objType.getOwnPropertyJSDocInfo(propName))) { hasPrivateProps = true; continue; } visitProperty(propName, objType, isStatic); } if (hasPrivateProps) { if (isStatic) { emit("private static noClassSideStructuralTyping_: any;"); } else { emit("private noStructuralTyping_: any;"); } emitBreak(); } }

Target:
private void visitProperties(ObjectType objType, boolean isStatic, Set<String> skipNames) { for (String propName : getSortedPropertyNames(objType)) { if (skipNames.contains(propName)) continue; if ("prototype".equals(propName) || "superClass_".equals(propName) || "constructor".equals(propName)) { continue; } visitProperty(propName, objType, isStatic); } }
Source:
public boolean getWifiOnlySync() { return mSharedPreferences.getBoolean(Pref.ENABLE_WIFI_SYNC_ONLY, false); }

Target:
public boolean getWifiOnlySync() { return mSharedPreferences.getBoolean(Pref.ENABLE_WIFI_SYNC_ONLY, true); }
Source:
public void onCompletion(BlobInfo result, Exception exception) { ReadableStreamChannel response = null; try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { setBlobPropertiesResponseHeaders(result); Map<String, String> userMetadata = RestUtils.buildUserMetadata(result.getUserMetadata()); if (userMetadata == null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, "application/octet-stream"); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, result.getUserMetadata().length); response = new ByteBufferRSC(ByteBuffer.wrap(result.getUserMetadata())); } else { setUserMetadataHeaders(userMetadata, restResponseChannel); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); response = new ByteBufferRSC(MockBlobStorageService.EMPTY_BUFFER); } } else if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } } catch (Exception e) { exception = exception == null ? e : exception; } finally { mockBlobStorageService.handleResponse(restRequest, restResponseChannel, response, exception); } }

Target:
public void onCompletion(BlobInfo result, Exception exception) { ReadableStreamChannel response = null; try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { setBlobPropertiesResponseHeaders(result); } else if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } } catch (Exception e) { exception = exception == null ? e : exception; } finally { mockBlobStorageService.handleResponse(restRequest, restResponseChannel, response, exception); } }
Source:
public EnsembleProvider makeEnsembleProvider(CuratorConfig config, ExhibitorConfig exConfig) { if (exConfig.getHosts().isEmpty()) { return new FixedEnsembleProvider(config.getZkHosts()); } final Function<Void, Void> exitFunction = new Function<Void, Void>() { @Override public Void apply(Void aVoid) { log.error("Zookeeper can't be reached, forcefully stopping virtual machine..."); System.exit(1); return null; } }; return new ExhibitorEnsembleProvider( new Exhibitors( exConfig.getHosts(), exConfig.getRestPort(), newBackupProvider(config.getZkHosts()) ), new DefaultExhibitorRestClient(exConfig.getUseSsl()), exConfig.getRestUriPath(), exConfig.getPollingMs(), config.getQuitOnConnectFail() ? new BoundedExponentialBackoffRetryWithQuit(exitFunction, BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES) : new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES) ) { @Override public void start() throws Exception { log.info("Poll the list of zookeeper servers for initial ensemble"); this.pollForInitialEnsemble(); super.start(); } }; }

Target:
public EnsembleProvider makeEnsembleProvider(CuratorConfig config, ExhibitorConfig exConfig) { if (exConfig.getHosts().isEmpty()) { return new FixedEnsembleProvider(config.getZkHosts()); } RetryPolicy retryPolicy; if (config.getTerminateDruidProcessOnConnectFail()) { final Runnable exitRunner = () -> { try { log.error("Zookeeper can't be reached, forcefully stopping virtual machine..."); } finally { System.exit(1); } }; retryPolicy = new BoundedExponentialBackoffRetryWithQuit( exitRunner, BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES ); } else { retryPolicy = new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES); } return new ExhibitorEnsembleProvider( new Exhibitors( exConfig.getHosts(), exConfig.getRestPort(), newBackupProvider(config.getZkHosts()) ), new DefaultExhibitorRestClient(exConfig.getUseSsl()), exConfig.getRestUriPath(), exConfig.getPollingMs(), retryPolicy ) { @Override public void start() throws Exception { log.info("Poll the list of zookeeper servers for initial ensemble"); this.pollForInitialEnsemble(); super.start(); } }; }
Source:
public ActionModeWrapper performGoBack() { onView(withId(R.id.action_mode_close_button)).perform(click()); return this; }

Target:
public void performGoBack() { onView(NAVIGATE_UP_MATCHER).perform(click()); }
Source:
private void setToolbarForCurrentFragment() { Fragment fragment = ((NavTabViewPagerAdapter) viewPager.getAdapter()).getCurrentFragment(); if (fragment instanceof MainActivityToolbarProvider) { getAppCompatActivity().setSupportActionBar(((MainActivityToolbarProvider) fragment).getToolbar()); toolbarContainer.setVisibility(View.GONE); } else { toolbarContainer.setVisibility(View.VISIBLE); getAppCompatActivity().setSupportActionBar(toolbar); } getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(false); if (fragment instanceof HistoryFragment) { toolbar.setTitle(R.string.nav_item_history); } else if (fragment instanceof ReadingListsFragment) { toolbar.setTitle(R.string.nav_item_reading_lists); } else if (fragment instanceof NearbyFragment) { toolbar.setTitle(R.string.nav_item_nearby); } }

Target:
private void setToolbarForCurrentFragment() { Fragment fragment = ((NavTabViewPagerAdapter) viewPager.getAdapter()).getCurrentFragment(); if (fragment instanceof MainActivityToolbarProvider) { getAppCompatActivity().setSupportActionBar(((MainActivityToolbarProvider) fragment).getToolbar()); toolbarContainer.setVisibility(View.GONE); } else { toolbarContainer.setVisibility(View.VISIBLE); getAppCompatActivity().setSupportActionBar(toolbar); } getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(false); }
Source:
protected DataInfo buildInference(float confidenceLevel, String inferenceProvenance) throws TrustLevelThresholdExceededException { float currentTrustLevel = new ConfidenceLevelConverter().convertToTrustLevel(confidenceLevel); if (trustLevelThreshold == null || currentTrustLevel >= trustLevelThreshold) { if (StringUtils.isNotBlank(inferenceProvenance)) { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel), inferenceProvenance); } else { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel)); } } else { throw new TrustLevelThresholdExceededException(); } }

Target:
protected DataInfo buildInference(float confidenceLevel, String inferenceProvenance) throws TrustLevelThresholdExceededException { float currentTrustLevel = ConfidenceAndTrustLevelConversionUtils.confidenceLevelToTrustLevel(confidenceLevel); if (trustLevelThreshold == null || currentTrustLevel >= trustLevelThreshold) { if (StringUtils.isNotBlank(inferenceProvenance)) { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel), inferenceProvenance); } else { return buildInferenceForTrustLevel(BuilderModuleHelper.getDecimalFormat().format(currentTrustLevel)); } } else { throw new TrustLevelThresholdExceededException(); } }
Source:
public void shouldSaveAnIdentifierPool() throws Exception { long initialIdentifierSourceCount = getAllCount(); SimpleObject identifierSource = new SimpleObject(); identifierSource.add("name", "test identifier pool"); identifierSource.add("description", "test identifier pool"); identifierSource.add("batchSize", "500"); identifierSource.add("minPoolSize", "5"); identifierSource.add("sequential", "true"); identifierSource.add("refillWithScheduledTask", "true"); identifierSource.add("sourceUuid", getUuid()); identifierSource.add("identifierType", IDENTIFIER_TYPE_UUID); identifierSource.add("sourceType", IDENTIFIER_POOL_SOURCE_TYPE); String jsonIdentifierSource = new ObjectMapper().writeValueAsString(identifierSource); MockHttpServletRequest req = newPostRequest(getURI(), jsonIdentifierSource); handle(req); IdentifierPool generatedIdentifierSource = (IdentifierPool) service.getAllIdentifierSources(false).get(7); assertEquals(generatedIdentifierSource.getName(), "test identifier pool"); assertEquals(generatedIdentifierSource.getDescription(), "test identifier pool"); assertEquals(generatedIdentifierSource.getBatchSize(), Integer.parseInt("500")); assertEquals(generatedIdentifierSource.getMinPoolSize(), Integer.parseInt("5")); assertTrue(generatedIdentifierSource.isSequential()); assertTrue(generatedIdentifierSource.isRefillWithScheduledTask()); assertEquals(generatedIdentifierSource.getSource().getUuid(), getUuid()); assertEquals(initialIdentifierSourceCount + 1, getAllCount()); }

Target:
public void shouldSaveAnIdentifierPool() throws Exception { long initialIdentifierSourceCount = getAllCount(); SimpleObject identifierSource = new SimpleObject(); identifierSource.add("name", "test identifier pool"); identifierSource.add("description", "This is a test description for the identifier pool"); identifierSource.add("batchSize", "50"); identifierSource.add("minPoolSize", "5"); identifierSource.add("sequential", "true"); identifierSource.add("refill", "true"); identifierSource.add("sourceUuid", getUuid()); identifierSource.add("identifierType", IDENTIFIER_TYPE_UUID); identifierSource.add("sourceType", IDENTIFIER_POOL_SOURCE_TYPE); String jsonIdentifierSource = new ObjectMapper().writeValueAsString(identifierSource); MockHttpServletRequest req = newPostRequest(getURI(), jsonIdentifierSource); SimpleObject newIdentifierSource = deserialize(handle(req)); String newIdentifierSourceUuid = PropertyUtils.getProperty(newIdentifierSource, "uuid").toString(); IdentifierPool generatedIdentifierSource = (IdentifierPool) service.getIdentifierSourceByUuid(newIdentifierSourceUuid); assertEquals(newIdentifierSourceUuid, generatedIdentifierSource.getUuid()); assertEquals(generatedIdentifierSource.getName(), "test identifier pool"); assertEquals(generatedIdentifierSource.getDescription(), "This is a test description for the identifier pool"); assertEquals(generatedIdentifierSource.getBatchSize(), Integer.parseInt("50")); assertEquals(generatedIdentifierSource.getMinPoolSize(), Integer.parseInt("5")); assertEquals(generatedIdentifierSource.getSource().getUuid(), getUuid()); assertEquals(initialIdentifierSourceCount + 1, getAllCount()); }
Source:
public void onEventMainThread(DiscussionCommentPostedEvent event) { if (!hasMorePages) { if (null != event.getParent() && event.getParent().getIdentifier().equals(discussionResponse.getIdentifier())) { ((BaseFragmentActivity)getActivity()).showInfoMessage(getString(R.string.discussion_comment_posted)); discussionCommentsAdapter.insertCommentAtEnd(event.getComment()); discussionCommentsListView.smoothScrollToPosition(discussionCommentsAdapter.getItemCount() - 1); } } }

Target:
public void onEventMainThread(DiscussionCommentPostedEvent event) { if (null != event.getParent() && event.getParent().getIdentifier().equals(discussionResponse.getIdentifier())) { ((BaseFragmentActivity) getActivity()).showInfoMessage(getString(R.string.discussion_comment_posted)); if (!hasMorePages) { discussionCommentsAdapter.insertCommentAtEnd(event.getComment()); discussionCommentsListView.smoothScrollToPosition(discussionCommentsAdapter.getItemCount() - 1); } } }
Source:
public boolean compatibleWith(Version that) { if (that == null) return false; String[] thisParts = this.version.split("\\."); String[] thatParts = that.version.split("\\."); int length = Math.max(thisParts.length, thatParts.length); for (int i = 0; i < length; i++) { int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0; int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0; switch (i) { case 0: { if (thisPart != thatPart) return false; } case 1: { if (thisPart < thatPart) return false; } case 2: { } } } return true; }

Target:
public boolean compatibleWith(Version that) { if (that == null) return false; String[] thisParts = this.version.split("\\."); String[] thatParts = that.version.split("\\."); int length = Math.max(thisParts.length, thatParts.length); for (int i = 0; i < length; i++) { int thisPart = i < thisParts.length ? Integer.parseInt(thisParts[i]) : 0; int thatPart = i < thatParts.length ? Integer.parseInt(thatParts[i]) : 0; switch (i) { case 0: { if (thisPart != thatPart) return false; } break; case 1: { if (thisPart < thatPart) return false; } break; case 2: { } break; } } return true; }
Source:
public void enableWifiConnectivityManager(boolean enabled) { enforceConnectivityInternalPermission(); mLog.trace("enableWifiConnectivityManager uid=%").c(Binder.getCallingUid()).flush(); mWifiStateMachine.enableWifiConnectivityManager(enabled); }

Target:
public void enableWifiConnectivityManager(boolean enabled) { enforceConnectivityInternalPermission(); mLog.trace("enableWifiConnectivityManager uid=% enabled=%") .c(Binder.getCallingUid()) .c(enabled ? "true" : "false").flush(); mWifiStateMachine.enableWifiConnectivityManager(enabled); }
Source:
private void updatePortDecoration() { if (portWarningDecorator == null) { Image fieldDecorationWarningImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); portWarningDecorator = new ControlDecoration(portText.getTextControl(), SWT.RIGHT | SWT.CENTER); portWarningDecorator.setMarginWidth(1); portWarningDecorator.setImage(fieldDecorationWarningImage); portWarningDecorator.setDescriptionText(Messages.getString("CassandraConnForm.port.instruction")); } if (CassandraConnectionUtil.isOldVersion(getConnection())) { portWarningDecorator.hide(); } else { portWarningDecorator.show(); } String dbVersion = getConnection().getAttributes().get(INoSQLCommonAttributes.DB_VERSION); if (ICassandraConstants.DBVERSIONS[2].equals(dbVersion)) { if (ICassandraConstants.API_TYPES[0].equals(repositoryTranslator.getLabel(apiTypeCombo.getText()))) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } } else if (ICassandraConstants.DBVERSIONS[0].equals(dbVersion) || ICassandraConstants.DBVERSIONS[1].equals(dbVersion)) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } }

Target:
private void updatePortDecoration() { if (portWarningDecorator == null) { Image fieldDecorationWarningImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); portWarningDecorator = new ControlDecoration(portText.getTextControl(), SWT.RIGHT | SWT.CENTER); portWarningDecorator.setMarginWidth(1); portWarningDecorator.setImage(fieldDecorationWarningImage); portWarningDecorator.setDescriptionText(Messages.getString("CassandraConnForm.port.instruction")); } if (CassandraConnectionUtil.isOldVersion(getConnection())) { portWarningDecorator.hide(); } else { portWarningDecorator.show(); } String dbVersion = getConnection().getAttributes().get(INoSQLCommonAttributes.DB_VERSION); if (ICassandraConstants.DB_VERSION_CASSANDRA_2_0_0.equals(dbVersion)) { if (ICassandraConstants.API_TYPE_DATASTAX.equals(repositoryTranslator.getLabel(apiTypeCombo.getText()))) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } } else if (ICassandraConstants.DB_VERSION_CASSANDRA_3_0.equals(dbVersion) || ICassandraConstants.DB_VERSION_CASSANDRA_2_2.equals(dbVersion)) { portText.setText(ICassandraConstants.DATASTAX_PORT); } else { portText.setText(ICassandraConstants.DEFAULT_PORT); } }
Source:
public HttpTraceImportOperation(String sourceUrl, TmfTraceFolder destFolder) { fSourceUrl = new ArrayList<>(); fSourceUrl.add(sourceUrl); fDestinationFolder = destFolder; }

Target:
public HttpTraceImportOperation(String sourceUrl, TmfTraceFolder destFolder) { fSourceUrl = Collections.singletonList(sourceUrl); fDestinationFolder = destFolder; }
Source:
protected IJavaElement[] filter(IJavaElement[] children) { boolean initializers= false; for (IJavaElement child : children) { if (matches(child)) { initializers= true; break; } } if (!initializers) return children; ArrayList<IJavaElement> v= new ArrayList<>(); for (IJavaElement child : children) { if (matches(child)) { continue; } v.add(child); } IJavaElement[] result= new IJavaElement[v.size()]; v.toArray(result); return result; }

Target:
protected IJavaElement[] filter(IJavaElement[] children) { boolean initializers= false; for (IJavaElement child : children) { if (matches(child)) { initializers= true; break; } } if (!initializers) return children; ArrayList<IJavaElement> v= new ArrayList<>(); for (IJavaElement child : children) { if (matches(child)) { continue; } v.add(child); } return v.toArray(new IJavaElement[v.size()]); }
Source:
public void cleanup() throws DBException { super.cleanup(); synchronized (RocksDBClient.class) { try { if (references == 1) { for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getHandle().close(); } rocksDb.close(); rocksDb = null; dbOptions.close(); dbOptions = null; for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getOptions().close(); } saveColumnFamilyNames(); COLUMN_FAMILIES.clear(); rocksdbDir = null; } } catch (final IOException e) { throw new DBException(e); } finally { references--; } } }

Target:
public void cleanup() throws DBException { super.cleanup(); synchronized (RocksDBClient.class) { try { if (references == 1) { for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getHandle().close(); } rocksDb.close(); rocksDb = null; dbOptions.close(); dbOptions = null; for (final ColumnFamily cf : COLUMN_FAMILIES.values()) { cf.getOptions().close(); } saveColumnFamilyNames(); COLUMN_FAMILIES.clear(); rocksDbDir = null; } } catch (final IOException e) { throw new DBException(e); } finally { references--; } } }
Source:
private List<ResolveInfo> filterResolvedServices(List<ResolveInfo> resolveInfoList, int flags) { if ((flags & PackageManager.MATCH_ALL) == PackageManager.MATCH_ALL) { return resolveInfoList; } resolveInfoList = new ArrayList<>(resolveInfoList); for (Iterator<ResolveInfo> iterator = resolveInfoList.iterator(); iterator.hasNext();) { ResolveInfo resolveInfo = iterator.next(); if ((flags & PackageManager.MATCH_SYSTEM_ONLY) == PackageManager.MATCH_SYSTEM_ONLY) { if (resolveInfo.serviceInfo == null || resolveInfo.serviceInfo.applicationInfo == null) { iterator.remove(); } else { final int applicationFlags = resolveInfo.serviceInfo.applicationInfo.flags; if ((applicationFlags & ApplicationInfo.FLAG_SYSTEM) != ApplicationInfo.FLAG_SYSTEM) { iterator.remove(); } } } else if (((flags & PackageManager.MATCH_DISABLED_COMPONENTS) != PackageManager.MATCH_DISABLED_COMPONENTS) && isValidComponentInfo(resolveInfo.serviceInfo)) { ComponentName componentName = new ComponentName( resolveInfo.serviceInfo.applicationInfo.packageName, resolveInfo.serviceInfo.name); if ((getComponentEnabledSetting(componentName) & PackageManager.COMPONENT_ENABLED_STATE_DISABLED) != 0) { iterator.remove(); } } } return resolveInfoList; }

Target:
private List<ResolveInfo> filterResolvedServices(List<ResolveInfo> resolveInfoList, int flags) { if (isFlagSet(flags, PackageManager.MATCH_ALL)) { return resolveInfoList; } resolveInfoList = new ArrayList<>(resolveInfoList); for (Iterator<ResolveInfo> iterator = resolveInfoList.iterator(); iterator.hasNext(); ) { ResolveInfo resolveInfo = iterator.next(); if (isFlagSet(flags, PackageManager.MATCH_SYSTEM_ONLY)) { if (resolveInfo.serviceInfo == null || resolveInfo.serviceInfo.applicationInfo == null) { iterator.remove(); } else { final int applicationFlags = resolveInfo.serviceInfo.applicationInfo.flags; if ((applicationFlags & ApplicationInfo.FLAG_SYSTEM) != ApplicationInfo.FLAG_SYSTEM) { iterator.remove(); } } } else if (!isFlagSet(flags, PackageManager.MATCH_DISABLED_COMPONENTS) && resolveInfo != null && isValidComponentInfo(resolveInfo.serviceInfo)) { ComponentName componentName = new ComponentName( resolveInfo.serviceInfo.applicationInfo.packageName, resolveInfo.serviceInfo.name); if ((getComponentEnabledSetting(componentName) & PackageManager.COMPONENT_ENABLED_STATE_DISABLED) != 0) { iterator.remove(); } } } return resolveInfoList; }
Source:
private Mono<Response<BlockBlobItem>> determineUploadFullOrChunked(final Flux<ByteBuffer> data, final Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunks, final BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlob) { final long chunkedUploadRequirement = 4 * Constants.MB; final long[] bufferedDataSize = {0}; final LinkedList<ByteBuffer> cachedBuffers = new LinkedList<>(); return data .windowUntil(buffer -> { if (bufferedDataSize[0] > chunkedUploadRequirement) { return false; } else { bufferedDataSize[0] += buffer.remaining(); if (bufferedDataSize[0] > chunkedUploadRequirement) { return true; } else { ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.position(0); cachedBuffers.add(cachedBuffer); return false; } } }, true) .buffer(2) .next() .flatMap(fluxes -> { if (fluxes.size() == 1) { return uploadFullBlob.apply(Flux.fromIterable(cachedBuffers), bufferedDataSize[0]); } else { return uploadInChunks.apply(dequeuingFlux(cachedBuffers).concatWith(fluxes.get(1))); } }); }

Target:
private Mono<Response<BlockBlobItem>> determineUploadFullOrChunked(final Flux<ByteBuffer> data, final Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunks, final BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlob) { final long[] bufferedDataSize = {0}; final LinkedList<ByteBuffer> cachedBuffers = new LinkedList<>(); return data .filter(ByteBuffer::hasRemaining) .windowUntil(buffer -> { if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { return false; } else { bufferedDataSize[0] += buffer.remaining(); if (bufferedDataSize[0] > CHUNKED_UPLOAD_REQUIREMENT) { return true; } else { ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); return false; } } }, true) .buffer(2) .next() .flatMap(fluxes -> { if (fluxes.size() == 1) { return uploadFullBlob.apply(Flux.fromIterable(cachedBuffers), bufferedDataSize[0]); } else { return uploadInChunks.apply(dequeuingFlux(cachedBuffers).concatWith(fluxes.get(1))); } }) .switchIfEmpty(uploadFullBlob.apply(Flux.empty(), 0L)); }
Source:
public void testContinuousUnary() { Expression expression = new Expression("++1"); Assert.assertEquals(expression.eval().intValue(), 1); expression = new Expression("--1"); Assert.assertEquals(expression.eval().intValue(), 1); expression = new Expression("+-1"); Assert.assertEquals(expression.eval().intValue(), -1); expression = new Expression("-+1"); Assert.assertEquals(expression.eval().intValue(), -1); expression = new Expression("1-+1"); Assert.assertEquals(expression.eval().intValue(), 0); }

Target:
public void testContinuousUnary() { Expression expression = new Expression("++1"); Assert.assertEquals(1, expression.eval().intValue()); expression = new Expression("--1"); Assert.assertEquals(1, expression.eval().intValue()); expression = new Expression("+-1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("-+1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("1-+1"); Assert.assertEquals(0, expression.eval().intValue()); expression = new Expression("-+---+++--++-1"); Assert.assertEquals(-1, expression.eval().intValue()); expression = new Expression("1--++++---2+-+----1"); Assert.assertEquals(-2, expression.eval().intValue()); }
Source:
private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, List<ExtKey> ignore, String title, String indent) { if (extMap != null) { log.debug("{}{}: {}", indent, title, extMap); Collection<ExtKey> keys = new HashSet(extMap.keySet()); if (module.argModuleMap.get("key") != null) { Collection<ExtKey> k = new HashSet<>(); for (String uuid : (List<String>)module.argModuleMap.get("key")) { k.add(new ExtKey("Unknown", Object.class, uuid)); } keys.retainAll(k); } for (ExtKey key : keys) { if (ignore.contains(key)) { continue; } if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { continue; } module.output( ((String)module.argModuleMap.get("format")).replace( "{key}", key.getUuid().getUuid().toString() ).replace( "{name}", key.getUuid().getName() ).replace( "{value}", (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extMap.get(key).toString() ), indent ); } } }

Target:
private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, List<ExtKey> ignore, String title, String indent) { if (extMap != null) { log.debug("{}{}: {}", indent, title, extMap); Collection<ExtKey> keys = new HashSet<>(extMap.keySet()); if (module.argModuleMap.get("key") != null) { Collection<ExtKey> k = new HashSet<>(); for (String uuid : (List<String>)module.argModuleMap.get("key")) { k.add(new ExtKey("Unknown", Object.class, uuid)); } keys.retainAll(k); } for (ExtKey key : keys) { if (ignore.contains(key)) { continue; } if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { continue; } module.output( ((String)module.argModuleMap.get("format")).replace( "{key}", key.getUuid().getUuid().toString() ).replace( "{name}", key.getUuid().getName() ).replace( "{value}", (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extMap.get(key).toString() ), indent ); } } }
Source:
public void returnsCorrectLengthWithTempFile() throws Exception { final byte[] bytes = new Utf8String("TempFile returnsCorrectLength!").asBytes(); MatcherAssert.assertThat( "TempFile doesn't provide correct number of bytes", new LengthOf( new Body.TempFile(new Body.ByteArray(bytes)) ).intValue(), new IsEqual<>(bytes.length) ); }

Target:
public void returnsCorrectLengthWithTempFile() throws Exception { final byte[] bytes = new Utf8String("TempFile returnsCorrectLength!").asBytes(); MatcherAssert.assertThat( "Body content of Body.TempFile doesn't have the correct length", new LengthOf( new Body.TempFile(new Body.ByteArray(bytes)) ).intValue(), new IsEqual<>(bytes.length) ); }
Source:
void assertArrayEqualsDifferentNestedObjectArrays() { try { assertArrayEquals( new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { false, true } } } }, new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { true, false } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [2][1][1][0], expected: <false> but was: <true>"); } Object[] differentElement = new Object[] {}; try { assertArrayEquals(new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { 5 } } } }, new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { differentElement } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [3][0][1][0], expected: <5> but was: <" + Arrays.toString(differentElement) + ">"); } }

Target:
void assertArrayEqualsDifferentNestedObjectArrays() { try { assertArrayEquals( new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { false, true } } } }, new Object[] { 1, 2, new Object[] { 3, new Object[] { 4, new boolean[] { true, false } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [2][1][1][0], expected: <false> but was: <true>"); } try { assertArrayEquals(new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { 5 } } } }, new Object[] { 1, 2, 3, new Object[] { new Object[] { 4, new Object[] { new Object[] } } } }); expectAssertionFailedError(); } catch (AssertionFailedError ex) { assertMessageEquals(ex, "array contents differ at index [3][0][1][0], expected: <5> but was: <[]>"); } }
Source:
public V get(Object key) { V value = super.get(key); if (value == null) { try { Thread.dumpStack(); value = loadFromCacheLoader((K) key); System.out.println(String.format("foobar k: %s v: %s ", key, value)); } catch (ClassCastException ex) { } } return value; }

Target:
public V get(Object key) { V value = super.get(key); if (value == null) { try { value = loadFromCacheLoader((K) key); } catch (ClassCastException ex) { } } return value; }
Source:
public void executeCommand() { boolean mergeSucceeded = false; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeSucceeded = true; } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeSucceeded = true; } } finally { if (mergeSucceeded) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }

Target:
public void executeCommand() { boolean mergeRunning = false; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeRunning = true; } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeRunning = true; } } finally { if (mergeRunning) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }