auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void deleteTest() { String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; insertRow(user0); insertRow(user1); insertRow(user2); orientDBClient.delete(CLASS, user1); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); ODatabaseDocumentTx db = pool.acquire(); try { ODictionary<ORecord> dictionary = db.getDictionary(); assertNotNull("Assert user0 still exists", dictionary.get(user0)); assertNull("Assert user1 does not exist", dictionary.get(user1)); assertNotNull("Assert user2 still exists", dictionary.get(user2)); } finally { db.close(); } }

Target:
public void deleteTest() { String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; insertRow(user0); insertRow(user1); insertRow(user2); orientDBClient.delete(CLASS, user1); OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); try(ODatabaseDocumentTx db = pool.acquire()) { ODictionary<ORecord> dictionary = db.getDictionary(); assertNotNull("Assert user0 still exists", dictionary.get(user0)); assertNull("Assert user1 does not exist", dictionary.get(user1)); assertNotNull("Assert user2 still exists", dictionary.get(user2)); } }
Source:
public URI open(final URI address) throws IllegalAddressException { checkNoAuthority(address); checkNoQuery(address); if (!SCHEME.equalsIgnoreCase(address.getScheme())) { throw new IllegalAddressException( address, IllegalAddressException.Reason.INVALID_SCHEME, null); } final String keyIdentifier = extractFragment(address); if (!KEY_ID_REGEX.matcher(keyIdentifier).matches()) { throw new IllegalAddressException( address, IllegalAddressException.Reason.INVALID_FRAGMENT, null); } final String path = extractRawPath(address); try { final File dbFile = new File(new File("").toURI().resolve(path).normalize()); final File parent = dbFile.getParentFile(); final String filename = dbFile.getName(); if (dbFile.isFile() || (parent != null && parent.isDirectory() && !dbFile.isDirectory()) && DB_FILENAME_REGEX.matcher(filename).matches()) { final URI fileAddress = dbFile.toURI(); final URI finalAddress = URI.create(SCHEME + ':' + fileAddress.getRawPath() + '#' + address.getRawFragment()); Connection connection = DriverManager.getConnection("jdbc:sqlite:" + fileAddress.getPath()); Statement stmt = null; try { stmt = connection.createStatement(); stmt.executeUpdate( "CREATE TABLE IF NOT EXISTS Keys (" + "id VARCHAR(" + MAX_KEY_ID_LENGTH + ") PRIMARY KEY, " + "data BLOB NOT NULL, " + "modified DATETIME NOT NULL)"); } catch (SQLException ex) { try { connection.close(); } catch (Exception e) throw ex; } finally { try { stmt.close(); } catch (Exception e) } this.connection = connection; this.keyIdentifier = keyIdentifier; return finalAddress; } } catch (SQLException ex) { throw new IllegalAddressException( address, IllegalAddressException.Reason.DRIVER_SPECIFIC, ex); } catch (IllegalArgumentException ex) { } throw new IllegalAddressException(address, IllegalAddressException.Reason.INVALID_PATH, null); }

Target:
public URI open(final URI address) throws StoreException, IllegalAddressException { try { Class.forName("org.sqlite.JDBC").newInstance(); } catch (Exception ex) { throw new StoreException("SQLite JDBC not available.", ex); } checkNoAuthority(address); checkNoQuery(address); checkScheme(address); final String keyIdentifier = extractKeyIdentifier(address); final String path = extractRawPath(address); try { final File dbFile = new File(new File("").toURI().resolve(path).normalize()); final File parent = dbFile.getParentFile(); final String filename = dbFile.getName(); if (dbFile.isFile() || (parent != null && parent.isDirectory() && !dbFile.isDirectory()) && DB_FILENAME_REGEX.matcher(filename).matches()) { final URI fileAddress = dbFile.toURI(); final URI finalAddress = URI.create(SCHEME + ':' + fileAddress.getRawPath() + '#' + address.getRawFragment()); Connection connection = openConnection(fileAddress.getPath()); this.connection = connection; this.keyIdentifier = keyIdentifier; return finalAddress; } } catch (SQLException ex) { throw new IllegalAddressException( address, IllegalAddressException.Reason.DRIVER_SPECIFIC, ex); } catch (IllegalArgumentException ex) { } throw new IllegalAddressException(address, IllegalAddressException.Reason.INVALID_PATH, null); }
Source:
public final Response getOneSidedRelationships( @QueryParam("contentTypeId") final String contentTypeId, @QueryParam(PaginationUtil.PAGE) final int page, @QueryParam(PaginationUtil.PER_PAGE) @DefaultValue("-1") final int perPage, @Context final HttpServletRequest request) throws Throwable { Logger.debug(this, "Getting the possible relationships and content types"); final InitDataObject initData = this.webResource.init(null, true, request, true, null); final User user = initData.getUser(); final ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI(user); ContentType contentType; if (UtilMethods.isSet(contentTypeId)) { try { contentType = contentTypeAPI.find(contentTypeId); } catch (DotSecurityException | DotDataException e) { return ExceptionMapperUtil .createResponse(map("message", "Invalid Content Type"), "Invalid Content Type", Status.BAD_REQUEST); } } else { return ExceptionMapperUtil .createResponse(map("message", "Content Type ID is required"), "Content Type ID is required", Status.BAD_REQUEST); } final PaginationUtil paginationUtil = new PaginationUtil(new RelationshipPaginator(user)); try { final Map<String, Object> params = map(RelationshipPaginator.CONTENT_TYPE_PARAM, contentType); return paginationUtil.getPage(request, user, null, page, perPage, params); } catch (PaginationException e) { throw e.getCause(); } catch (JsonProcessingRuntimeException e) { Logger.error(this, e.getMessage(), e); return ExceptionMapperUtil.createResponse(e, Status.INTERNAL_SERVER_ERROR); } }

Target:
public final Response getOneSidedRelationships( @QueryParam("contentTypeId") final String contentTypeId, @QueryParam(PaginationUtil.PAGE) final int page, @QueryParam(PaginationUtil.PER_PAGE) @DefaultValue("-1") final int perPage, @Context final HttpServletRequest request) throws Throwable { Logger.debug(this, "Getting the possible relationships for content type " + contentTypeId); final InitDataObject initData = this.webResource.init(null, true, request, true, null); final User user = initData.getUser(); final ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI(user); ContentType contentType; if (UtilMethods.isSet(contentTypeId)) { try { contentType = contentTypeAPI.find(contentTypeId); } catch (DotSecurityException | DotDataException e) { Logger.error(this, e.getMessage(), e); return ExceptionMapperUtil .createResponse(map("message", "Invalid Content Type"), "Invalid Content Type", Status.BAD_REQUEST); } } else { return ExceptionMapperUtil .createResponse(map("message", "Content Type ID is required"), "Content Type ID is required", Status.BAD_REQUEST); } final PaginationUtil paginationUtil = new PaginationUtil(new RelationshipPaginator(user)); try { final Map<String, Object> params = map(RelationshipPaginator.CONTENT_TYPE_PARAM, contentType); return paginationUtil.getPage(request, user, null, page, perPage, params); } catch (JsonProcessingRuntimeException e) { Logger.error(this, e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }
Source:
public void onConnectivityEvent(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus) { RCLogger.i(TAG, "onConnectivityEvent(): id: " + jobId + ", connectivityStatus: " + connectivityStatus); cachedConnectivityStatus = connectivityStatus; storageManagerPreferences = new StorageManagerPreferences(this); boolean pushEnabled = storageManagerPreferences.getBoolean(ParameterKeys.PUSH_NOTIFICATIONS_ENABLE_PUSH_FOR_ACCOUNT, false); String binding = storageManagerPreferences.getString(FcmConfigurationHandler.FCM_BINDING, null); boolean registeredForPush = binding!=null; if (state == DeviceState.OFFLINE && connectivityStatus != RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone){ if (pushEnabled && registeredForPush) { state = DeviceState.READY; } } if (state != DeviceState.OFFLINE && connectivityStatus == RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone) { state = DeviceState.OFFLINE; } if (isAttached()) { this.listener.onConnectivityUpdate(this, connectivityStatus); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onConnectivityUpdate(): " + connectivityStatus); } }

Target:
public void onConnectivityEvent(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus) { RCLogger.i(TAG, "onConnectivityEvent(): id: " + jobId + ", connectivityStatus: " + connectivityStatus); cachedConnectivityStatus = connectivityStatus; storageManagerPreferences = new StorageManagerPreferences(this); boolean pushEnabled = storageManagerPreferences.getBoolean(ParameterKeys.PUSH_NOTIFICATIONS_ENABLE_PUSH_FOR_ACCOUNT, false); String binding = storageManagerPreferences.getString(FcmConfigurationHandler.FCM_BINDING, null); boolean registeredForPush = binding!=null; if (state == DeviceState.OFFLINE && connectivityStatus != RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone){ if (pushEnabled && registeredForPush) { state = DeviceState.READY; } else if (!pushEnabled) { state = DeviceState.READY; } } if (state != DeviceState.OFFLINE && connectivityStatus == RCDeviceListener.RCConnectivityStatus.RCConnectivityStatusNone) { state = DeviceState.OFFLINE; } if (isAttached()) { this.listener.onConnectivityUpdate(this, connectivityStatus); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onConnectivityUpdate(): " + connectivityStatus); } }
Source:
public <T> void onPostExecute(Callable<T> task) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; postInject(bm, task); if(task instanceof DefaultExecutorService.RunnableAdapter) { postInject(bm, ((DefaultExecutorService.RunnableAdapter) task).getTask()); } } finally { ContextInputCache.clean(); } }

Target:
public <T> void onPostExecute(Callable<T> task) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; postInject(bm, task); if (task instanceof RunnableAdapter) { postInject(bm, ((RunnableAdapter) task).getTask()); } } finally { ContextInputCache.clean(); } }
Source:
public static String removeAndRestoreDataBundle(DataBundle dataBundle) { removeDataBundle(dataBundle); ResponseBodyAndCode putRequestOutput = executePostRequest(Const.ResourceURIs.DATABUNDLE, null, JsonUtils.toJson(dataBundle)); if (putRequestOutput.responseCode == HttpStatus.SC_OK) { return putRequestOutput.responseBody; } return Const.StatusCodes.BACKDOOR_STATUS_FAILURE; }

Target:
public static String removeAndRestoreDataBundle(DataBundle dataBundle) throws HttpRequestFailedException { removeDataBundle(dataBundle); ResponseBodyAndCode putRequestOutput = executePostRequest(Const.ResourceURIs.DATABUNDLE, null, JsonUtils.toJson(dataBundle)); if (putRequestOutput.responseCode == HttpStatus.SC_OK) { return putRequestOutput.responseBody; } throw new HttpRequestFailedException("Request failed with status code: " + putRequestOutput.responseCode); }
Source:
public void testSaveAndScroll() throws Exception { NXAuditEventsService audit = (NXAuditEventsService) Framework.getRuntime() .getComponent(NXAuditEventsService.NAME); Assert.assertNotNull(audit); ESAuditBackend esBackend = (ESAuditBackend) audit.getBackend(); List<String> jsonEntries = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 42; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put("eventId", "idForAuditStorage"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } esBackend.append(jsonEntries); LogEntryGen.flushAndSync(); AuditQueryBuilder builder = new AuditQueryBuilder().predicates(Predicates.eq("eventId", "idForAuditStorage")); List<LogEntry> logs = esBackend.queryLogs(builder); assertEquals(42, logs.size()); ScrollResult scrollResult = esBackend.scroll(builder, 5, 10); assertEquals(5, scrollResult.getResultIds().size()); int total = 0; while (scrollResult.hasResults()) { List<String> ids = scrollResult.getResultIds(); ids.forEach(id -> assertFalse(id.isEmpty())); total += ids.size(); scrollResult = esBackend.scroll(scrollResult.getScrollId()); } assertEquals(42, total); }

Target:
public void testSaveAndScroll() throws Exception { NXAuditEventsService audit = (NXAuditEventsService) Framework.getRuntime() .getComponent(NXAuditEventsService.NAME); Assert.assertNotNull(audit); ESAuditBackend esBackend = (ESAuditBackend) audit.getBackend(); List<String> jsonEntries = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 42; i++) { ObjectNode logEntryJson = mapper.createObjectNode(); logEntryJson.put("eventId", "idForAuditStorage"); jsonEntries.add(mapper.writeValueAsString(logEntryJson)); } esBackend.append(jsonEntries); LogEntryGen.flushAndSync(); AuditQueryBuilder builder = new AuditQueryBuilder().predicates(Predicates.eq("eventId", "idForAuditStorage")); List<LogEntry> logs = esBackend.queryLogs(builder); Assert.assertEquals(42, logs.size()); ScrollResult scrollResult = esBackend.scroll(builder, 5, 10); int total = 0; while (scrollResult.hasResults()) { Assert.assertTrue(scrollResult.getResultIds().size() <= 5); List<String> ids = scrollResult.getResultIds(); ids.forEach(id -> Assert.assertFalse(id.isEmpty())); total += ids.size(); scrollResult = esBackend.scroll(scrollResult.getScrollId()); } Assert.assertEquals(42, total); }
Source:
public void checkBuild(String uri, ExprList args) { if ( args.isEmpty() ) throw new ExprBuildException("fn:apply: no function to call (minimum number of args is one)"); }

Target:
public void checkBuild(String uri, ExprList args) { if ( args.isEmpty() ) throw new ExprException("fn:apply: no function to call (minimum number of args is one)"); }
Source:
public static IndexCoordinates of(String... indexNames) { Assert.notNull(indexNames,"indexNames must not be null"); return new IndexCoordinates(indexNames); }

Target:
public static IndexCoordinates of(String... indexNames) { Assert.notNull(indexNames, "indexNames must not be null"); return new IndexCoordinates(indexNames, null); }
Source:
private TranslationFormat readTranslationFormat() { String formatStr = manifest.getString("format"); TranslationFormat format = TranslationFormat.get(formatStr); if(null == format) { if ((Resource.Type.UNLOCKED_DYNAMIC_BIBLE == resourceType) || (Resource.Type.UNLOCKED_LITERAL_BIBLE == resourceType)) { return TranslationFormat.USX; } else { return TranslationFormat.USFM; } } return format; }

Target:
private TranslationFormat readTranslationFormat() { TranslationFormat format = fetchTranslationFormat(manifest); if(null == format) { TranslationType translationType = fetchTranslationType(manifest); if(translationType != TranslationType.TEXT) { return TranslationFormat.MARKDOWN; } else { String projectIdStr = fetchProjectID(manifest); if("obs".equalsIgnoreCase(projectIdStr)) { return TranslationFormat.MARKDOWN; } return TranslationFormat.USFM; } } return format; }
Source:
protected ISourceContainer[] createSourceContainers() throws CoreException { List<ISourceContainer> result = new LinkedList<ISourceContainer>(); ILaunchConfiguration config = getLaunchConfiguration(); Set<String> projectsAdded = new HashSet<>(); try { Project project = LaunchUtils.getBndProject(config); if (project != null) { Collection<Container> runbundles = project.getRunbundles(); for (Container runbundle : runbundles) { if (runbundle.getType() == TYPE.PROJECT) { String targetProjName = runbundle.getProject().getName(); if (projectsAdded.contains(targetProjName)) continue; projectsAdded.add(targetProjName); IProject targetProj = ResourcesPlugin.getWorkspace().getRoot().getProject(targetProjName); if (targetProj != null) { IJavaProject targetJavaProj = JavaCore.create(targetProj); result.add(new JavaProjectSourceContainer(targetJavaProj)); } } else if (runbundle.getType() == TYPE.REPO) { IPath bundlePath = Central.toPath(runbundle.getFile()); if (bundlePath != null) { IFile bundleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bundlePath); if (bundleFile != null) { ArchiveSourceContainer tempArchiveCont = new ArchiveSourceContainer(bundleFile, false); result.add(tempArchiveCont); } } } } } } catch (Exception e) { logger.logError("Error querying bnd dependency source containers.", e); } return result.toArray(new ISourceContainer[0]); }

Target:
protected ISourceContainer[] createSourceContainers() throws CoreException { List<ISourceContainer> result = new LinkedList<ISourceContainer>(); ILaunchConfiguration config = getLaunchConfiguration(); Set<String> projectsAdded = new HashSet<>(); try { Project project = LaunchUtils.getBndProject(config); if (project != null) { Collection<Container> runbundles = project.getRunbundles(); for (Container runbundle : runbundles) { if (runbundle.getType() == TYPE.PROJECT) { String targetProjName = runbundle.getProject().getName(); if (projectsAdded.add(targetProjName)) { IProject targetProj = ResourcesPlugin.getWorkspace().getRoot().getProject(targetProjName); if (targetProj != null) { IJavaProject targetJavaProj = JavaCore.create(targetProj); result.add(new JavaProjectSourceContainer(targetJavaProj)); } } } else if (runbundle.getType() == TYPE.REPO) { IPath bundlePath = Central.toPath(runbundle.getFile()); if (bundlePath != null) { IFile bundleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bundlePath); if (bundleFile != null) { ArchiveSourceContainer tempArchiveCont = new ArchiveSourceContainer(bundleFile, false); result.add(tempArchiveCont); } } } } } } catch (Exception e) { logger.logError("Error querying bnd dependency source containers.", e); } return result.toArray(new ISourceContainer[0]); }
Source:
public String localize(final String errorMsg, final Locale requestLocale) { String localizedErrorMsg = errorMsg; ResourceBundle resourceBundle = getResourceBundle(requestLocale == null ? Locale.getDefault() : requestLocale); if (resourceBundle != null && resourceBundle.containsKey(errorMsg)) { localizedErrorMsg = resourceBundle.getString(errorMsg); } return localizedErrorMsg; }

Target:
public String localize(final String errorMsg, final Locale requestLocale) { String localizedErrorMsg = errorMsg; ResourceBundle resourceBundle = getResourceBundle(requestLocale == null ? defaultLocale : requestLocale); if (resourceBundle != null && resourceBundle.containsKey(errorMsg)) { localizedErrorMsg = resourceBundle.getString(errorMsg); } return localizedErrorMsg; }
Source:
private void showSearchResults() { if (mSearchResults.isEmpty()) { mRecyclerView.setAdapter(null); updateEmptyView(EmptyViewMessageType.NO_CONTENT); return; } PostsListAdapter adapter = new PostsListAdapter(getActivity(), mSite, mIsPage); adapter.setOnLoadMoreListener(this); adapter.setOnPostSelectedListener(this); adapter.setPosts(mSearchResults); adapter.setOnPostButtonClickListener(this); mRecyclerView.setAdapter(adapter); hideEmptyView(); }

Target:
private void showSearchResults() { if (mSearchResults.isEmpty()) { mRecyclerView.setAdapter(null); updateEmptyView(EmptyViewMessageType.NO_CONTENT); return; } mSearchListAdapter = new PostsListAdapter(getActivity(), mSite, mIsPage); mSearchListAdapter.setOnLoadMoreListener(this); mSearchListAdapter.setOnPostSelectedListener(this); mSearchListAdapter.setPosts(mSearchResults); mSearchListAdapter.setOnPostButtonClickListener(this); mRecyclerView.setAdapter(mSearchListAdapter); hideEmptyView(); }
Source:
public void traceStop() { Log.v(TAG, "Stopping perfetto trace."); if (!isTracingOn()) { Log.w(TAG, "No trace appears to be in progress. Stopping perfetto trace may not work."); } String cmd = "perfetto --stop --attach=" + PERFETTO_TAG; try { Process process = TraceUtils.exec(cmd); new Logger("traceStop:stderr", process.getErrorStream()); new Logger("traceStop:stdout", process.getInputStream()); if (process.waitFor() != 0) { Log.e(TAG, "perfetto traceStop failed with: " + process.exitValue()); } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void traceStop() { Log.v(TAG, "Stopping perfetto trace."); if (!isTracingOn()) { Log.w(TAG, "No trace appears to be in progress. Stopping perfetto trace may not work."); } String cmd = "perfetto --stop --attach=" + PERFETTO_TAG; try { Process process = TraceUtils.exec(cmd); if (process.waitFor() != 0) { Log.e(TAG, "perfetto traceStop failed with: " + process.exitValue()); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
void transferChromeOptionPreferencesFromSystemPropsToDriverNoAssignmentStatement() { System.setProperty(CHROME_OPTIONS_PREFS, "key1=1,key2"); ChromeOptions chromeOptions = new ChromeDriverFactory().createChromeOptions(config, proxy); Map<String, Object> prefsMap = getBrowserLaunchPrefs(ChromeOptions.CAPABILITY, chromeOptions); assertThat(prefsMap).hasSize(3); assertThat(prefsMap).containsEntry("key1", 1); assertThat(prefsMap).containsEntry("credentials_enable_service", false); assertThat(prefsMap).containsEntry("download.default_directory", new File("/blah/downloads").getAbsolutePath()); }

Target:
void transferChromeOptionPreferencesFromSystemPropsToDriverNoAssignmentStatement() { System.setProperty(CHROME_OPTIONS_PREFS, "key1=1,key2"); ChromeOptions chromeOptions = new ChromeDriverFactory().createChromeOptions(config, proxy); Map<String, Object> prefsMap = getBrowserLaunchPrefs(ChromeOptions.CAPABILITY, chromeOptions); assertThat(prefsMap).containsEntry("key1", 1); assertThat(prefsMap).doesNotContainKey("key2"); }
Source:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (Guid.Empty.equals(getVmToAttach(getParameters().getVmPoolId()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDao().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } int limit = DbFacade.getInstance().getVmPoolDao().get(getVmPoolId()).getMaxAssignedVmsPerUser(); if (vmCount >= limit) { addCanDoActionMessage(VdcBllMessages.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (Guid.Empty.equals(getVmToAttach(getParameters().getVmPoolId()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = getVmDAO().getAllForUser(getAdUserId()); int vmCount = 0; for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { vmCount++; } } int limit = getVmPool().getMaxAssignedVmsPerUser(); if (vmCount >= limit) { addCanDoActionMessage(VdcBllMessages.VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL); returnValue = false; } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }
Source:
public static CompressionCodec getCompressionCodec(TextInputFormat inputFormat, Path file) throws NoSuchFieldException, IllegalAccessException { if (inputFormat == null || file == null) { return null; } Field field = inputFormat.getClass().getDeclaredField("compressionCodecs"); if (field == null) { return null; } field.setAccessible(true); CompressionCodecFactory compressionCodecs = (CompressionCodecFactory) field.get(inputFormat); return compressionCodecs.getCodec(file); }

Target:
public static Optional<CompressionCodec> getCompressionCodec(TextInputFormat inputFormat, Path file) throws NoSuchFieldException, IllegalAccessException { if (inputFormat == null || file == null) { return Optional.empty(); } Field field = inputFormat.getClass().getDeclaredField("compressionCodecs"); if (field == null) { return Optional.empty(); } field.setAccessible(true); CompressionCodecFactory compressionCodecs = (CompressionCodecFactory) field.get(inputFormat); return Optional.of(compressionCodecs.getCodec(file)); }
Source:
public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(64); CurrencyAmount base = product.getBaseCurrencyAmount(); CurrencyAmount counter = product.getCounterCurrencyAmount(); buf.append(SummarizerUtils.fx(base, counter)); buf.append(" : "); buf.append(SummarizerUtils.date(product.getPaymentDate())); CurrencyPair currencyPair = product.getCurrencyPair(); return SummarizerUtils.summary( this, ProductType.FX_SINGLE, buf.toString(), currencyPair.getBase(), currencyPair.getCounter()); }

Target:
public PortfolioItemSummary summarize() { StringBuilder buf = new StringBuilder(64); CurrencyAmount base = product.getBaseCurrencyAmount(); CurrencyAmount counter = product.getCounterCurrencyAmount(); buf.append(SummarizerUtils.fx(base, counter)); buf.append(" : "); buf.append(SummarizerUtils.date(product.getPaymentDate())); return SummarizerUtils.summary( this, ProductType.FX_SINGLE, buf.toString(), base.getCurrency(), counter.getCurrency()); }
Source:
public void onRootGrowth(DelayedActionTriggeredEvent event, EntityRef rootEntity, LogComponent logComponent, RootComponent rootComponent) { if(!rootComponent.alive || rootComponent.growthStage+1 == rootComponent.growthStages.size()) { return; } rootComponent.growthStage++; if(canGenerateTree(rootEntity)) { rootEntity.addOrSaveComponent(rootComponent); destroyTree(rootEntity, logComponent.location); generateTree(rootEntity); if(rootComponent.growthStage+1 < rootComponent.growthStages.size()) { TreeGrowthStage nextStage = rootComponent.growthStages.get(rootComponent.growthStage+1); resetDelay(rootEntity, nextStage.minTime, nextStage.maxTime); } } }

Target:
public void onRootGrowth(DelayedActionTriggeredEvent event, EntityRef rootEntity, LogComponent logComponent, RootComponent rootComponent) { if(!rootComponent.alive || rootComponent.growthStage+1 == rootComponent.growthStages.size() || !event.getActionId().equals("SimpleFarming:" + rootEntity.getId() + ":Growth")) { return; } rootComponent.growthStage++; if(canGenerateTree(rootEntity)) { rootEntity.addOrSaveComponent(rootComponent); destroyTree(rootEntity, logComponent.location); generateTree(rootEntity); if(rootComponent.growthStage+1 < rootComponent.growthStages.size()) { TreeGrowthStage nextStage = rootComponent.growthStages.get(rootComponent.growthStage+1); resetDelay(rootEntity, nextStage.minTime, nextStage.maxTime); } } }
Source:
protected String addToAuditLogErrorMessage(String connection, String errorCode, List<storage_server_connections> connections, LUNs lun) { AuditLogableBase logable = new AuditLogableBase(); String connectionField = getConnectionDescription(connections, connection) + (lun == null ? "" : " (LUN " + lun.getLUN_id() + ")"); logable.AddCustomValue("Connection", connectionField); String translatedError = getTranslatedStorageError(errorCode); logable.AddCustomValue("ErrorCode", translatedError); AuditLogDirector.log(logable, AuditLogType.STORAGE_DOMAIN_ERROR); return connectionField; }

Target:
protected String addToAuditLogErrorMessage(String connection, String errorCode, List<storage_server_connections> connections, LUNs lun) { AuditLogableBase logable = new AuditLogableBase(); String connectionField = getConnectionDescription(connections, connection) + (lun == null ? "" : " (LUN " + lun.getLUN_id() + ")"); logable.AddCustomValue("Connection", connectionField); String translatedError = getTranslatedStorageError(errorCode); logable.AddCustomValue("ErrorMessage", translatedError); AuditLogDirector.log(logable, AuditLogType.STORAGE_DOMAIN_ERROR); return connectionField; }
Source:
private void testNotifyVisibilityChange(boolean isStandalone) { final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent("perspectiveId", false)); verify(presenter, times(1)).onPerspectiveVisibilityChange(any()); }

Target:
private void testNotifyVisibilityChange(boolean isStandalone) { final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent("perspectiveId", false)); verify(presenter).onPerspectiveVisibilityChange(any()); }
Source:
private PDU createPDU(SnmpTrapInfo snmpTrapInfo) { PDU trap = new PDU(); trap.setType(PDU.TRAP); int alertType = snmpTrapInfo.getAlertType() + 1; if (alertType > 0) { trap.add(new VariableBinding(SnmpConstants.sysUpTime, new OctetString(new Date().toString()))); trap.add(new VariableBinding(SnmpConstants.snmpTrapOID, getOID(CsSnmpConstants.TRAPS_PREFIX + alertType))); if (snmpTrapInfo.getDataCenterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID), new UnsignedInteger32(snmpTrapInfo.getDataCenterId()))); } if (snmpTrapInfo.getPodId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID), new UnsignedInteger32(snmpTrapInfo.getPodId()))); } if (snmpTrapInfo.getClusterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID), new UnsignedInteger32(snmpTrapInfo.getClusterId()))); } if (snmpTrapInfo.getMessage() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE), new OctetString(snmpTrapInfo.getMessage()))); } else { throw new CloudRuntimeException(" What is the use of alert without message "); } if (snmpTrapInfo.getGenerationTime() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME), new OctetString(snmpTrapInfo.getGenerationTime().toString()))); } else { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME))); } } else { throw new CloudRuntimeException(" Invalid alert Type "); } return trap; }

Target:
private PDU createPDU(SnmpTrapInfo snmpTrapInfo) { PDU trap = new PDU(); trap.setType(PDU.TRAP); int alertType = snmpTrapInfo.getAlertType() + 1; if (alertType > 0) { long sysUpTimeTicks = ManagementFactory.getRuntimeMXBean().getUptime() / 10; trap.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(sysUpTimeTicks))); trap.add(new VariableBinding(SnmpConstants.snmpTrapOID, getOID(CsSnmpConstants.TRAPS_PREFIX + alertType))); if (snmpTrapInfo.getDataCenterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID), new UnsignedInteger32(snmpTrapInfo.getDataCenterId()))); } if (snmpTrapInfo.getPodId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID), new UnsignedInteger32(snmpTrapInfo.getPodId()))); } if (snmpTrapInfo.getClusterId() != 0) { trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID), new UnsignedInteger32(snmpTrapInfo.getClusterId()))); } if (snmpTrapInfo.getMessage() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE), new OctetString(snmpTrapInfo.getMessage()))); } else { throw new CloudRuntimeException(" What is the use of alert without message "); } if (snmpTrapInfo.getGenerationTime() != null) { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME), new OctetString(snmpTrapInfo.getGenerationTime().toString()))); } else { trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME))); } } else { throw new CloudRuntimeException(" Invalid alert Type "); } return trap; }
Source:
public void error_missingIndexBackend_emptyString() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default for all indexes" ); holder.startBuilding( "indexName", false ); verifyAll(); }

Target:
public void error_missingIndexBackend_emptyString() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( (Optional) Optional.of( "" ) ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default value for all indexes" ); holder.startBuilding( "indexName", false ); verifyAll(); }
Source:
private BasePanel addNewDatabase(ParserResult result, final Path file, boolean raisePanel) { BibDatabase database = result.getDatabase(); if (result.hasWarnings()) { JabRefExecutorService.INSTANCE .execute(() -> ParserResultWarningDialog.showParserResultWarningDialog(result, frame)); } if (Objects.nonNull(file)) { frame.getDialogService().notify(Localization.lang("Opened library") + " '" + file.toString() + "' " + Localization.lang("with") + " " + database.getEntryCount() + " " + Localization.lang("entries") + "."); } return DefaultTaskExecutor.runInJavaFXThread(() -> { BasePanel basePanel = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), result.getDatabaseContext(), ExternalFileTypes.getInstance()); frame.addTab(basePanel, raisePanel); return basePanel; }); }

Target:
private BasePanel addNewDatabase(ParserResult result, final Path file, boolean raisePanel) { BibDatabase database = result.getDatabase(); if (result.hasWarnings()) { ParserResultWarningDialog.showParserResultWarningDialog(result, frame); } if (Objects.nonNull(file)) { dialogService.notify(Localization.lang("Opened library") + " '" + file.toString() + "' " + Localization.lang("with") + " " + database.getEntryCount() + " " + Localization.lang("entries") + "."); } BasePanel basePanel = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), result.getDatabaseContext(), ExternalFileTypes.getInstance()); frame.addTab(basePanel, raisePanel); return basePanel; }
Source:
public Collection<Obj> getObjsByUris(Project project, Collection<String> uris) { notNull(project, "project"); notNull(project.getId(), "project.id"); notNull(uris, "uris"); try { final BulkGet result = restTemplate.postForObject(BulkGet.URI, new BulkGetUris(uris), BulkGet.class, project.getId()); if (result != null) { return result.getItems(); } else { throw new GoodDataException("empty response from API call"); } } catch (RestClientException e) { throw new GoodDataException("Unable to get objects. Some of the supplied URIs may be malformed."); } }

Target:
public Collection<Obj> getObjsByUris(Project project, Collection<String> uris) { notNull(project, "project"); notNull(project.getId(), "project.id"); notNull(uris, "uris"); try { final BulkGet result = restTemplate.postForObject(BulkGet.URI, new BulkGetUris(uris), BulkGet.class, project.getId()); if (result != null) { return result.getItems(); } else { throw new GoodDataException("Received empty response from API call."); } } catch (RestClientException e) { throw new GoodDataException("Unable to get objects. Some of the supplied URIs may be malformed.", e); } }
Source:
private String createSpiceInvocationInfo() { return createKeyValHtmlRows( constants.auto(), constants.spiceInvokeAuto(), constants.nativeClient(), constants.consoleInvokeNative(), constants.browserPlugin(), constants.spiceInvokePlugin(), constants.spiceHtml5(), constants.spiceInvokeHtml5() ); }

Target:
private String createSpiceInvocationInfo() { return new KeyValueHtmlRowMaker(constants.auto(), constants.spiceInvokeAuto()) .append(constants.nativeClient(), constants.consoleInvokeNative()) .append(constants.browserPlugin(), constants.spiceInvokePlugin()) .append(constants.spiceHtml5(), constants.spiceInvokeHtml5()).toString(); }
Source:
public void getCardByIdShouldReturnTheCardWithId() throws Exception { final AtomicReference<Card> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); User user = Fixtures.loadUser(); BitreserveRestAdapter mockRestDapter = new BitreserveRestAdapter("foobar"); mockRestDapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{ \"id\": \"FOOBAR\" }"; bodyRefRequest.set(request); return new Response("some/url", 200, "reason", new ArrayList<retrofit.client.Header>() { { add(new retrofit.client.Header("foo", "bar")); } }, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); user.setBitreserveRestAdapter(mockRestDapter); user.getCardById("FOOBAR").then(new PromiseAction<Card>() { @Override public void call(Card card) { bodyRefResponse.set(card); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); Card cardResponse = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(cardResponse.getId(), "FOOBAR"); }

Target:
public void getCardByIdShouldReturnTheCardWithId() throws Exception { final AtomicReference<Card> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); User user = Fixtures.loadUser(); BitreserveRestAdapter mockRestAdapter = new BitreserveRestAdapter("foobar"); mockRestAdapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{ \"id\": \"FOOBAR\" }"; bodyRefRequest.set(request); return new Response("some/url", 200, "reason", new ArrayList<retrofit.client.Header>(), new TypedByteArray("application/json", responseString.getBytes())); } }).build()); user.setBitreserveRestAdapter(mockRestAdapter); user.getCardById("FOOBAR").then(new PromiseAction<Card>() { @Override public void call(Card card) { bodyRefResponse.set(card); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); Card card = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertEquals(card.getId(), "FOOBAR"); }
Source:
private void subscribeToNewNode() { NodeConnection cxn = null; synchronized (Distributer.this) { m_subscribedConnection = null; if (!m_connections.isEmpty()) { cxn = m_connections.get(new Random().nextInt(m_connections.size())); m_subscriptionRequestPending = true; m_subscribedConnection = cxn; } else { return; } } if (m_shutdown.get()) { return; } try { ProcedureInvocation spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Subscribe", "TOPOLOGY"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new SubscribeCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Statistics", "TOPO", 0); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new TopoUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); if (!m_fetchedCatalog) { spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@SystemCatalog", "PROCEDURES"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new ProcUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); } refreshPartitionKeys(true); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void subscribeToNewNode() { if (m_shutdown.get()) { return; } NodeConnection cxn = null; synchronized (Distributer.this) { m_subscribedConnection = null; if (!m_connections.isEmpty()) { cxn = m_connections.get(new Random().nextInt(m_connections.size())); m_subscriptionRequestPending = true; m_subscribedConnection = cxn; } else { return; } } try { ProcedureInvocation spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Subscribe", "TOPOLOGY"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new SubscribeCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@Statistics", "TOPO", 0); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new TopoUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); if (!m_fetchedCatalog) { spi = new ProcedureInvocation(m_sysHandle.getAndDecrement(), "@SystemCatalog", "PROCEDURES"); cxn.createWork(System.nanoTime(), spi.getHandle(), spi.getProcName(), serializeSPI(spi), new ProcUpdateCallback(), true, USE_DEFAULT_CLIENT_TIMEOUT); } refreshPartitionKeys(true); } catch (Exception e) { e.printStackTrace(); } }
Source:
public QueryBatcherImpl onUrisReady(QueryBatchListener listener) { if ( listener == null ) throw new IllegalArgumentException("listener must not be null"); if(resultsSoFar.longValue()< getMaxUris()) { urisReadyListeners.add(listener); return this; } return null; }

Target:
public QueryBatcherImpl onUrisReady(QueryBatchListener listener) { if ( listener == null ) throw new IllegalArgumentException("listener must not be null"); urisReadyListeners.add(listener); return this; }
Source:
protected GoExecutor createExecutor(@NotNull Project project, @Nullable Module module, @NotNull String title, @NotNull String filePath) { VirtualFile executable = getExecutable(project, module); assert executable != null; File file = new File(filePath); if(!file.isDirectory()) { file = file.getParentFile(); } String path = file.getPath(); return GoExecutor.in(project, module).withExePath(executable.getPath()).withParameters("-e", "-a", "-v", path ).showOutputOnError(); }

Target:
protected GoExecutor createExecutor(@NotNull Project project, @Nullable Module module, @NotNull String title, @NotNull String filePath) { VirtualFile executable = getExecutable(project, module); assert executable != null; return GoExecutor.in(project, module).withExePath(executable.getPath()).withParameters("-e", "-a", "-v", filePath).showOutputOnError(); }
Source:
public void runWhenReady(CallbackType type, final Runnable runnable) { final Runnable wrappringRunnable; switch (type) { case IN_UI_SYNC: wrappringRunnable = new Runnable() { public void run() { SWTUtil.safeSyncExec(runnable); } }; break; case IN_UI_ASYNC: wrappringRunnable = new Runnable() { public void run() { SWTUtil.safeAsyncExec(runnable); } }; break; default: wrappringRunnable = runnable; break; } synchronized(isFetchingGroup) { if (isFetchingGroup.get()) { addFetchingListener(new FetchingListener() { @Override public boolean doneFetching() { wrappringRunnable.run(); return true; } }); } else { wrappringRunnable.run(); } } }

Target:
public void runWhenReady(CallbackType type, final Runnable runnable) { synchronized(isFetchingGroup) { if (isFetchingGroup.get()) { callbacks.add(new CallbackHolder(runnable, type)); } else { run(runnable, type); } } }
Source:
public boolean isValidBuildCause(PipelineConfig pipelineConfig, BuildCause buildCause) { for (MaterialRevision materialRevision : buildCause.getMaterialRevisions()) { if (materialRevision.isChanged()) { if (materialRevision.getMaterial() instanceof DependencyMaterial) { boolean skipSchedulingOnChange = ((DependencyMaterial) (materialRevision.getMaterial())).skipSchedulingOnChange(); return !skipSchedulingOnChange; } return true; } } return false; }

Target:
public boolean isValidBuildCause(PipelineConfig pipelineConfig, BuildCause buildCause) { for (MaterialRevision materialRevision : buildCause.getMaterialRevisions()) { if (materialRevision.isChanged() && !materialRevision.shouldIgnoreForScheduling()) { return true; } } return false; }
Source:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleConfiguration) { SimpleConfiguration sc = (SimpleConfiguration) o; return this.toString().equals(sc.toString()); } return false; }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleConfiguration) { Map<String, String> th = this.toMap(); Map<String, String> sc = ((SimpleConfiguration) o).toMap(); if (th.size() == sc.size()) { return th.entrySet().equals(sc.entrySet()); } } return false; }
Source:
private String getRootNode() { if (fHosts.size() == 0) { return null; } return fHosts.iterator().next(); }

Target:
private String getRootNode() { if (fHosts.size() == 0) { return null; } return fHosts.first(); }
Source:
public void bindMargins() { this.marginProperty().bind(Bindings.createDoubleBinding(() -> children.stream() .collect(Collectors.summingDouble(AbstractNode::getMargin)), children.stream() .map(AbstractNode::marginProperty).toArray(DoubleProperty[]::new))); }

Target:
protected void bindMargins() { this.marginProperty().bind(Bindings.createDoubleBinding(() -> children.stream() .collect(Collectors.summingDouble(AbstractNode::getMargin)), children.stream() .map(AbstractNode::marginProperty).toArray(DoubleProperty[]::new))); }
Source:
private void decodeErrorResponse(ChannelHandlerContext ctx, ErrorFrame msg, List<Object> out) { assert this.messageMap.get(msg.getId()) == null; assert this.defragmentationState.get(msg.getId()) == null; this.messageMap.put(msg.getId(), new ErrorResponse( msg.getId(), msg.getType(), msg.getMessage() )); }

Target:
private void decodeErrorResponse(ChannelHandlerContext ctx, ErrorFrame msg, List<Object> out) { this.messageMap.put(msg.getId(), new ErrorResponse( msg.getId(), msg.getType(), msg.getMessage() )); }
Source:
public void reset() { initCalled = rebuildingCalled = rebuiltCalled = noIndexCalled = corruptedIndex = false; }

Target:
public void reset() { initCalled = false; rebuildingCalled = false; rebuiltCalled = false; noIndexCalled = false; corruptedIndex = false; }
Source:
private boolean isValidPathImageFiles(DocStructInterface phys, PrefsInterface myPrefs) { try { MetadataTypeInterface mdt = UghHelper.getMetadataType(myPrefs, "pathimagefiles"); List<? extends MetadataInterface> allMetadata = phys.getAllMetadataByType(mdt); if (allMetadata != null && allMetadata.size() > 0) { return true; } else { Helper.setFehlerMeldung(this.process.getTitle() + ": " + "Can not verify, image path is not set", ""); return false; } } catch (UghHelperException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(this.process.getTitle() + ": " + "Verify aborted, error: ", e.getMessage()); return false; } }

Target:
private boolean isValidPathImageFiles(DocStructInterface phys, PrefsInterface myPrefs) { try { MetadataTypeInterface mdt = UghHelper.getMetadataType(myPrefs, "pathimagefiles"); List<? extends MetadataInterface> allMetadata = phys.getAllMetadataByType(mdt); if (allMetadata != null && allMetadata.size() > 0) { return true; } else { Helper.setFehlerMeldung(this.process.getTitle() + ": " + "Can not verify, image path is not set", ""); return false; } } catch (UghHelperException e) { Helper.setErrorMessage(this.process.getTitle() + ": " + "Verify aborted, error: ", e.getMessage(), logger, e); return false; } }