auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void assertAmbiguous() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/foo/{bar}/{fooName}/status", 10); urlPatternMap.put("/foo/{bar}/operate/{metrics}", 11); MappingContext<Integer> mappingContext = urlPatternMap.match("/foo/barValue/operate/status"); assertNotNull(mappingContext); assertEquals("/foo/{bar}/operate/{metrics}", mappingContext.pattern()); assertEquals(Integer.valueOf(11), mappingContext.payload()); }

Target:
public void assertAmbiguous() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/foo/{bar}/{fooName}/status", 10); urlPatternMap.put("/foo/{bar}/operate/{metrics}", 11); MappingContext<Integer> mappingContext = urlPatternMap.match("/foo/barValue/operate/status"); assertNotNull(mappingContext); assertThat(mappingContext.pattern(), is("/foo/{bar}/operate/{metrics}")); assertThat(mappingContext.payload(), is(11)); }
Source:
private static void extractToDirectory(File directory, JarInputStream input) throws IOException { File manifestFile = new File(directory, JarFile.MANIFEST_NAME); manifestFile.getParentFile().mkdirs(); input.getManifest().write(new FileOutputStream(manifestFile)); JarEntry entry = input.getNextJarEntry(); while (entry != null) { File newFile = new File(directory, entry.getName()); if (entry.isDirectory()) { newFile.mkdirs(); } else { FileOutputStream fileoutputstream = new FileOutputStream(newFile); IOUtils.copy(input, fileoutputstream); fileoutputstream.close(); } input.closeEntry(); entry = input.getNextJarEntry(); } }

Target:
private static void extractToDirectory(File directory, JarInputStream input) throws IOException { File manifestFile = new File(directory, JarFile.MANIFEST_NAME); manifestFile.getParentFile().mkdirs(); try (FileOutputStream output = new FileOutputStream(manifestFile)) { input.getManifest().write(output); } JarEntry entry = input.getNextJarEntry(); while (entry != null) { File newFile = new File(directory, entry.getName()); if (entry.isDirectory()) { newFile.mkdirs(); } else { try (FileOutputStream output = new FileOutputStream(newFile)) { IOUtils.copy(input, output); } } input.closeEntry(); entry = input.getNextJarEntry(); } }
Source:
public String getRpmRevision() { return this.rpmRevison; }

Target:
public String getRpmRevision() { return this.rpmRevision; }
Source:
private Project getProjectFromSession() { ISarosSession currentSession = sarosSession; if (currentSession == null) { return null; } SharedIDEContext sharedIDEContext = currentSession.getComponent(SharedIDEContext.class); if (!sharedIDEContext.isInitialized()) { return null; } return sharedIDEContext.getProject(); }

Target:
private Project getProjectFromSession() { ISarosSession currentSession = sarosSession; if (currentSession == null) { return null; } SharedIDEContext sharedIDEContext = currentSession.getComponent(SharedIDEContext.class); if (sharedIDEContext == null || !sharedIDEContext.isInitialized()) { return null; } return sharedIDEContext.getProject(); }
Source:
public CacheCollection<V> values(EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { return new ValueCacheCollection<>(this, cacheEntrySet(explicitFlags, explicitClassLoader)); }

Target:
CacheCollection<V> values(EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { return new ValueCacheCollection<>(this, cacheEntrySet(explicitFlags, explicitClassLoader)); }
Source:
protected void store(A aggregate) { Write<I> operation = Write.<I>operation() .into(this) .write(aggregate) .prepare(); operation.perform(); }

Target:
protected void store(A aggregate) { Write<I> operation = Write.operationFor(this, aggregate); operation.perform(); }
Source:
protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = (AdvancedScrollingGraphicalViewer) getGraphicalViewer(); ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }

Target:
protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = getGraphicalViewer(); ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }
Source:
public UserSession signIn(Study study, CriteriaContext context, SignIn signIn) throws EntityNotFoundException { checkNotNull(study); checkNotNull(context); checkNotNull(signIn); Validate.entityThrowingException(SignInValidator.PASSWORD_SIGNIN, signIn); Account account = accountDao.authenticate(study, signIn); if (intentService.registerIntentToParticipate(study, account)) { account = accountDao.getAccount(AccountId.forId(study.getIdentifier(), account.getId())); } UserSession session = getSessionFromAccount(study, context, account); cacheProvider.setUserSession(session); if (!session.doesConsent() && !session.isInRole(Roles.ADMINISTRATIVE_ROLES)) { throw new ConsentRequiredException(session); } return session; }

Target:
public UserSession signIn(Study study, CriteriaContext context, SignIn signIn) throws EntityNotFoundException { checkNotNull(study); checkNotNull(context); checkNotNull(signIn); Validate.entityThrowingException(SignInValidator.PASSWORD_SIGNIN, signIn); Account account = accountDao.authenticate(study, signIn); UserSession session = getSessionFromAccount(study, context, account); if (!session.doesConsent() && intentService.registerIntentToParticipate(study, account)) { AccountId accountId = AccountId.forId(study.getIdentifier(), account.getId()); account = accountDao.getAccount(accountId); session = getSessionFromAccount(study, context, account); } cacheProvider.setUserSession(session); if (!session.doesConsent() && !session.isInRole(Roles.ADMINISTRATIVE_ROLES)) { throw new ConsentRequiredException(session); } return session; }
Source:
public void previous() { if (currentStation != null) new GetRealLinkAndPlayTask(itsContext, currentStation, itsBinder).execute(); }

Target:
public void previous() { RadioDroidApp radioDroidApp = (RadioDroidApp) getApplication(); DataRadioStation station = radioDroidApp.getFavouriteManager().getPreviousById(currentStation.StationUuid); if (station != null) { Utils.Play(radioDroidApp, station, itsContext, false); } }
Source:
protected boolean validateShareableDisk() { if (DiskStorageType.IMAGE != _oldDisk.getDiskStorageType()) { return true; } boolean isDiskUpdatedToShareable = getParameters().getDiskInfo().isShareable(); boolean isDiskShareable = _oldDisk.isShareable(); if (!isDiskShareable && isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(null); _oldDisk.setAllowSnapshot(Boolean.FALSE); List<DiskImage> diskImageList = getDiskImageDao().getAllSnapshotsForImageGroup(_oldDisk.getId()); if ((diskImageList.size() > 1) || getParameters().getDiskInfo().isBoot() || !Guid.Empty.equals(((DiskImage)_oldDisk).getit_guid())) { addCanDoActionMessage(VdcBllMessages.SHAREABLE_DISK_IS_NOT_SUPPORTED_FOR_DISK); return false; } } else if (isDiskShareable && !isDiskUpdatedToShareable) { VM vm = getVmDAO().getForImageGroup(_oldDisk.getId()); if (vm != null) { ((DiskImage)_oldDisk).setvm_snapshot_id(dbFacade.getSnapshotDao().getId(vm.getId(), SnapshotType.ACTIVE).getValue()); } _oldDisk.setAllowSnapshot(Boolean.TRUE); } if (ImagesHandler.isVmInPreview(getVmId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); return false; } return true; }

Target:
protected boolean validateShareableDisk() { if (DiskStorageType.IMAGE != _oldDisk.getDiskStorageType()) { return true; } boolean isDiskUpdatedToShareable = getParameters().getDiskInfo().isShareable(); boolean isDiskShareable = _oldDisk.isShareable(); if (ImagesHandler.isVmInPreview(getVmId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); return false; } if (!isDiskShareable && isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(null); List<DiskImage> diskImageList = getDiskImageDao().getAllSnapshotsForImageGroup(_oldDisk.getId()); if ((diskImageList.size() > 1) || getParameters().getDiskInfo().isBoot() || !Guid.Empty.equals(((DiskImage)_oldDisk).getit_guid())) { addCanDoActionMessage(VdcBllMessages.SHAREABLE_DISK_IS_NOT_SUPPORTED_FOR_DISK); return false; } _oldDisk.setAllowSnapshot(Boolean.FALSE); } else if (isDiskShareable && !isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(dbFacade.getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE).getValue()); _oldDisk.setAllowSnapshot(Boolean.TRUE); } return true; }
Source:
public static void assumeJavaVersion(JavaVersion version) { assumeThat( "java.specification.version: ", SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) ); }

Target:
public static void assumeJavaVersion( JavaVersion version ) { assumeTrue( "java.specification.version: " + JAVA_SPECIFICATION_VERSION, SystemUtils.isJavaVersionAtLeast( version ) ); }
Source:
public void handleConnectionsWithoutOriginInTheRequest() throws Exception { final Take take = new TkFake(new RsText()); final Take cors = new TkCORS(take); final RsPrint response = new RsPrint(cors.act(new RqFake())); final String head = response.printHead(); MatcherAssert.assertThat( "Invalid HTTP status for a request without origin.", head, Matchers.containsString(Response.HTTP_STATUS_200) ); }

Target:
public void handleConnectionsWithoutOriginInTheRequest() throws Exception { MatcherAssert.assertThat( "It was expected to receive a 403 error.", new TkCORS( new TkFixed(new RsText()), "<LINK_0>", "<LINK_1>" ).act(new RqFake()), new HmRsStatus(Matchers.equalTo(HttpURLConnection.HTTP_FORBIDDEN)) ); }
Source:
public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(m_def.getName()).append(Tokens.T_OPENBRACKET); switch (m_def.getId()) { case FunctionId.FUNC_VOLT_SINCE_EPOCH: case FunctionId.FUNC_VOLT_TO_TIMESTAMP: case FunctionId.FUNC_VOLT_TRUNCATE_TIMESTAMP: { int timeUnit = ((Number) nodes[0].valueData).intValue(); sb.append(Tokens.getKeyword(timeUnit)); break; } default: sb.append(nodes[0].getSQL()); break; } for (int ii = 1; ii < nodes.length; ii++) { if (nodes[ii] != null) { sb.append(Tokens.T_COMMA).append(nodes[ii].getSQL()); } else { assert (ii == 2); assert (m_def.getId() == FunctionId.FUNC_VOLT_REGEXP_POSITION); } } sb.append(Tokens.T_CLOSEBRACKET); return sb.toString(); }

Target:
public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(m_def.getName()).append(Tokens.T_OPENBRACKET); switch (m_def.getId()) { case FunctionId.FUNC_VOLT_SINCE_EPOCH: case FunctionId.FUNC_VOLT_TO_TIMESTAMP: case FunctionId.FUNC_VOLT_TRUNCATE_TIMESTAMP: { int timeUnit = ((Number) nodes[0].valueData).intValue(); sb.append(Tokens.getKeyword(timeUnit)); break; } default: sb.append(nodes[0].getSQL()); break; } for (int ii = 1; ii < nodes.length; ii++) { if (nodes[ii] != null) { sb.append(Tokens.T_COMMA).append(nodes[ii].getSQL()); } else { } } sb.append(Tokens.T_CLOSEBRACKET); return sb.toString(); }
Source:
public JFrameTextView(GameController gc){ gc.setView(this); frame = new JFrame("Bomberman"); frame.setLayout(new BorderLayout()); frame.setSize(FRAME_SIZE); textArea = new TextArea(); textArea.setFont(new Font("monospaced", Font.PLAIN, GRID_TEXT_SIZE)); textArea.setEditable(false); frame.add(textArea, BorderLayout.CENTER); console = new TextArea(); console.setSize(FRAME_SIZE.width, FRAME_SIZE.height / 10); console.setEditable(false); frame.add(console, BorderLayout.SOUTH); frame.setVisible(true); }

Target:
public JFrameTextView(GameController gc){ gc.setView(this); frame = new JFrame("Bomberman"); frame.setLayout(new BorderLayout()); frame.setSize(FRAME_SIZE); textArea = new TextArea(); textArea.setFont(new Font("monospaced", Font.PLAIN, GRID_TEXT_SIZE)); textArea.setEditable(false); frame.add(textArea, BorderLayout.CENTER); console = new TextArea(); console.setEditable(false); frame.add(console, BorderLayout.SOUTH); frame.setVisible(true); }
Source:
public VDS getValue(S object) { if (object instanceof VDS){ return (VDS) object; } if (object instanceof PairQueryable){ if (((PairQueryable<?, ?>) object).getSecond() instanceof VDS) { return (VDS) ((PairQueryable<?, ?>) object).getSecond(); } } return null; }

Target:
public VDS getValue(S object) { if (object instanceof VDS){ return (VDS) object; } return null; }
Source:
protected void loadMountTableConfigs(URI uri, Configuration conf) throws IOException { String mountTableConfigPath = conf.get(Constants.CONFIG_VIEWFS_MOUNTTABLE_PATH); if (null != mountTableConfigPath) { MountTableConfigLoader loader = new HCFSMountTableConfigLoader(); loader.load(mountTableConfigPath, conf); } else { if (LOG.isDebugEnabled()) { LOG.debug( "Missing configuration for fs.viewfs.mounttable.path. Proceeding" + "with core-site.xml mount-table information if avaialable."); } } }

Target:
protected void loadMountTableConfigs(URI uri, Configuration conf) throws IOException { String mountTableConfigPath = conf.get(Constants.CONFIG_VIEWFS_MOUNTTABLE_PATH); if (null != mountTableConfigPath) { MountTableConfigLoader loader = new HCFSMountTableConfigLoader(); loader.load(mountTableConfigPath, conf); } else { if (LOG.isDebugEnabled()) { LOG.debug( "Missing configuration for fs.viewfs.mounttable.path. Proceeding" + "with core-site.xml mount-table information if available."); } } }
Source:
public ContentRetriever instantiate(Map<String, String> parameters) { try { return new ClasspathContentRetriever(); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public ContentRetriever instantiate(Map<String, String> parameters) { return new ClasspathContentRetriever(); }
Source:
public void testAddOperationWithCredentialReferenceWithClearTextOnly() throws Exception { try { String password = "secret"; addKeyStoreWithCredentialReference(KS_NAME, null, null, "secret", false, false); assertEquals(password, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertEquals(null, readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }

Target:
public void testAddOperationWithCredentialReferenceWithClearTextOnly() throws Exception { try { String password = "secret"; addKeyStoreWithCredentialReference(KS_NAME, null, null, password, false, false); assertEquals(password, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertNull(readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }
Source:
public List<ERepositoryObjectType> getTypes() { List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>(); toReturn.add(ERepositoryObjectType.PROCESS); return toReturn; }

Target:
public List<ERepositoryObjectType> getTypes() { List<ERepositoryObjectType> toReturn = new ArrayList<>(); toReturn.add(ERepositoryObjectType.PROCESS); return toReturn; }
Source:
public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull(repository.findRef(Constants.R_HEADS + DEVELOP_BRANCH)); }

Target:
public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull(repository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH)); }
Source:
private SetupInfo setup(String tableName, String indexName, String columns, String indexColumns, String pk, String includeColumns) throws Exception{ Connection conn = DriverManager.getConnection(getUrl()); String fullTableName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""),SchemaUtil.normalizeIdentifier(tableName)); String fullIndexName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""),SchemaUtil.normalizeIdentifier(indexName)); String str1 = String.format("CREATE TABLE %1$s (%2$s CONSTRAINT pk PRIMARY KEY (%3$s)) COLUMN_ENCODED_BYTES=0", fullTableName, columns, pk); conn.createStatement().execute(str1); String str2 = String.format("CREATE INDEX %1$s ON %2$s (%3$s)", fullIndexName, fullTableName, indexColumns); if (!includeColumns.isEmpty()) str2 += " INCLUDE (" + includeColumns + ")"; conn.createStatement().execute(str2); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); PTable pIndexTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullIndexName)); PTable pDataTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullTableName)); IndexMaintainer im = pIndexTable.getIndexMaintainer(pDataTable,pconn); SetupInfo info = new SetupInfo(); info.indexMaintainer = im; info.pDataTable = pDataTable; return info; }

Target:
private SetupInfo setup(String tableName, String indexName, String columns, String indexColumns, String pk, String includeColumns) throws Exception { try(Connection conn = DriverManager.getConnection(getUrl())) { String fullTableName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""), SchemaUtil.normalizeIdentifier(tableName)); String fullIndexName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""), SchemaUtil.normalizeIdentifier(indexName)); String str1 = String.format("CREATE TABLE %1$s (%2$s CONSTRAINT pk PRIMARY KEY (%3$s)) COLUMN_ENCODED_BYTES=0", fullTableName, columns, pk); conn.createStatement().execute(str1); String str2 = String.format("CREATE INDEX %1$s ON %2$s (%3$s)", fullIndexName, fullTableName, indexColumns); if (!includeColumns.isEmpty()) str2 += " INCLUDE (" + includeColumns + ")"; conn.createStatement().execute(str2); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); PTable pIndexTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullIndexName)); PTable pDataTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullTableName)); IndexMaintainer im = pIndexTable.getIndexMaintainer(pDataTable, pconn); SetupInfo info = new SetupInfo(); info.indexMaintainer = im; info.pDataTable = pDataTable; return info; } }
Source:
public PhoenixResultSet executeQuery() throws SQLException { throw new SQLExceptionInfo.Builder(SQLExceptionCodeEnum.INTERNAL_ERROR) .setMessage("executeQuery may not be used for delete: " + this).build().buildException(); }

Target:
public PhoenixResultSet executeQuery() throws SQLException { throw new ExecuteQueryNotApplicableException("delete", this.toString()); }
Source:
protected boolean moveToState(STATE to) { if (state.get() == to) { return false; } return moveToState(state.get(), to); }

Target:
protected void moveToState(STATE to) { if (state.get() != to) { moveToState(state.get(), to); } }
Source:
public void testShellExecuteEx() { try { File f = createTempFile(); f.deleteOnExit(); SHELLEXECUTEINFO lpExecInfo = new SHELLEXECUTEINFO(); lpExecInfo.lpVerb = new WString("0p3n"); lpExecInfo.nShow = User32.SW_SHOWDEFAULT; lpExecInfo.fMask = Shell32.SEE_MASK_NOCLOSEPROCESS | Shell32.SEE_MASK_FLAG_NO_UI; lpExecInfo.lpFile = new WString(f.getAbsolutePath()); assertFalse(Shell32.INSTANCE.ShellExecuteEx(lpExecInfo)); assertTrue(Native.getLastError() == W32Errors.ERROR_NO_ASSOCIATION); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void testShellExecuteEx() { File file = new File(System.getProperty("java.io.tmpdir"), System.nanoTime() + ".txt"); try { try { fillTempFile(file); } catch (IOException e) { throw new RuntimeException(e); } SHELLEXECUTEINFO lpExecInfo = new SHELLEXECUTEINFO(); lpExecInfo.lpVerb = "0p3n"; lpExecInfo.nShow = User32.SW_SHOWDEFAULT; lpExecInfo.fMask = Shell32.SEE_MASK_NOCLOSEPROCESS | Shell32.SEE_MASK_FLAG_NO_UI; lpExecInfo.lpFile = file.getAbsolutePath(); assertFalse("ShellExecuteEx should have returned false - action verb was bogus.", Shell32.INSTANCE.ShellExecuteEx(lpExecInfo)); assertEquals("GetLastError() should have been set to ERROR_NO_ASSOCIATION because of bogus action", W32Errors.ERROR_NO_ASSOCIATION, Native.getLastError()); } finally { if (file.exists()) { file.delete(); } } }
Source:
public void canDisableVirtioScsiFail() { Disk disk = new DiskImage(); DiskVmElement dve = new DiskVmElement(disk.getId(), vm.getId()); dve.setDiskInterface(DiskInterface.VirtIO_SCSI); disk.setDiskVmElements(Collections.singletonList(dve)); when(DbFacade.getInstance().getVmNetworkInterfaceDao()).thenReturn(vmNetworkInterfaceDao); assertThat(validator.canDisableVirtioScsi(Collections.singletonList(disk)), failsWith(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS)); }

Target:
public void canDisableVirtioScsiFail() { Disk disk = new DiskImage(); DiskVmElement dve = new DiskVmElement(disk.getId(), vm.getId()); dve.setDiskInterface(DiskInterface.VirtIO_SCSI); disk.setDiskVmElements(Collections.singletonList(dve)); assertThat(validator.canDisableVirtioScsi(Collections.singletonList(disk)), failsWith(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS)); }
Source:
private FieldSearchFilter[] createSearchFilters(String type, RestListRequest requestList) { List<FieldSearchFilter> filters = new ArrayList<>(); filters.add( new FieldSearchFilter(IResourceManager.RESOURCE_TYPE_FILTER_KEY, type, false) ); for (Filter filter : Optional.ofNullable(requestList.getFilters()).orElse(new Filter[]{})) { String attr; boolean useLikeOption = false; switch (filter.getAttribute()) { case "name": attr = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; useLikeOption = true; break; case "description": attr = IResourceManager.RESOURCE_DESCR_FILTER_KEY; useLikeOption = true; break; case "createdAt": attr = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; break; case "updatedAt": attr = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; break; case "group": attr = IResourceManager.RESOURCE_MAIN_GROUP_FILTER_KEY; break; default: continue; } filters.add( new FieldSearchFilter(attr, filter.getValue(), useLikeOption) ); } filters.add(createOrderFilter(requestList)); return filters.stream().toArray(FieldSearchFilter[]::new); }

Target:
private FieldSearchFilter[] createSearchFilters(String type, RestListRequest requestList) { List<FieldSearchFilter> filters = new ArrayList<>(); filters.add( new FieldSearchFilter(IResourceManager.RESOURCE_TYPE_FILTER_KEY, type, false) ); for (Filter filter : Optional.ofNullable(requestList.getFilters()).orElse(new Filter[]{})) { String attr; boolean useLikeOption = false; switch (filter.getAttribute()) { case "name": attr = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; useLikeOption = true; break; case "description": attr = IResourceManager.RESOURCE_DESCR_FILTER_KEY; useLikeOption = true; break; case "createdAt": attr = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; break; case "updatedAt": attr = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; break; case "group": attr = IResourceManager.RESOURCE_MAIN_GROUP_FILTER_KEY; break; default: log.warn("Invalid filter attribute: " + filter.getAttribute()); continue; } filters.add( new FieldSearchFilter(attr, filter.getValue(), useLikeOption) ); } filters.add(createOrderFilter(requestList)); return filters.stream().toArray(FieldSearchFilter[]::new); }
Source:
public void testErrorPrecedenceWithBlobDeletedAndExpiredCase() throws Exception { doPut(); ServerErrorCode[] serverErrorCodesToTest = {ServerErrorCode.Blob_Deleted, ServerErrorCode.Blob_Expired}; RouterErrorCode[] routerErrorCodesToExpect = {RouterErrorCode.BlobDeleted, RouterErrorCode.BlobExpired}; for (int i = 0; i < serverErrorCodesToTest.length; i++) { int indexToSetCustomError = random.nextInt(replicasCount); ServerErrorCode[] serverErrorCodesInOrder = new ServerErrorCode[9]; for (int j = 0; j < serverErrorCodesInOrder.length; j++) { if (j == indexToSetCustomError) { serverErrorCodesInOrder[j] = serverErrorCodesToTest[i]; } else { serverErrorCodesInOrder[j] = ServerErrorCode.Blob_Not_Found; } } testErrorPrecedence(serverErrorCodesInOrder, routerErrorCodesToExpect[i]); } }

Target:
public void testErrorPrecedenceWithBlobDeletedAndExpiredCase() throws Exception { doPut(); Map<ServerErrorCode, RouterErrorCode> serverErrorToRouterError = new HashMap<>(); serverErrorToRouterError.put(ServerErrorCode.Blob_Deleted, RouterErrorCode.BlobDeleted); serverErrorToRouterError.put(ServerErrorCode.Blob_Expired, RouterErrorCode.BlobExpired); for (Map.Entry<ServerErrorCode, RouterErrorCode> entry : serverErrorToRouterError.entrySet()) { int indexToSetCustomError = random.nextInt(replicasCount); ServerErrorCode[] serverErrorCodesInOrder = new ServerErrorCode[9]; for (int j = 0; j < serverErrorCodesInOrder.length; j++) { if (j == indexToSetCustomError) { serverErrorCodesInOrder[j] = entry.getKey(); } else { serverErrorCodesInOrder[j] = ServerErrorCode.Blob_Not_Found; } } testErrorPrecedence(serverErrorCodesInOrder, entry.getValue()); } }
Source:
protected ExpectedBehaviour getExpectedBehaviour() { if (!excNumberDefined) return ExpectedBehaviour.ANY_EXCEPTION; return ExpectedBehaviour.SPECIFIC_EXCEPTION; }

Target:
protected ExpectedBehaviour getExpectedBehaviour() { return excNumberDefined ? SPECIFIC_EXCEPTION : ANY_EXCEPTION; }
Source:
private void createColumns() { if (!fColumnsCreated) { createColumn(Messages.LatencyTableViewer_startTime, new LatencyTableColumnLabelProvider() { @Override public String getTextFoITimeRange(ISegment input) { return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getStart())); } }, SegmentComparators.INTERVAL_START_COMPARATOR); createColumn(Messages.LatencyTableViewer_endTime, new LatencyTableColumnLabelProvider() { @Override public String getTextFoITimeRange(ISegment input) { return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getEnd())); } }, SegmentComparators.INTERVAL_END_COMPARATOR); createColumn(Messages.LatencyTableViewer_duration, new LatencyTableColumnLabelProvider() { @Override public String getTextFoITimeRange(ISegment input) { return NonNullUtils.nullToEmptyString(Long.toString(input.getLength())); } }, SegmentComparators.INTERVAL_LENGTH_COMPARATOR); LatencyAnalysis analysis = getAnalysisModule(); if (analysis != null) { for (final ISegmentAspect aspect : analysis.getSegmentAspects()) { createColumn(aspect.getName(), new LatencyTableColumnLabelProvider() { @Override public String getTextFoITimeRange(ISegment input) { return NonNullUtils.nullToEmptyString(aspect.resolve(input)); } }, null); } } fColumnsCreated = true; } }

Target:
private void createColumns() { createColumn(Messages.LatencyTableViewer_startTime, new LatencyTableColumnLabelProvider() { @Override public String getTextForSegment(ISegment input) { return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getStart())); } }, SegmentComparators.INTERVAL_START_COMPARATOR); createColumn(Messages.LatencyTableViewer_endTime, new LatencyTableColumnLabelProvider() { @Override public String getTextForSegment(ISegment input) { return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getEnd())); } }, SegmentComparators.INTERVAL_END_COMPARATOR); createColumn(Messages.LatencyTableViewer_duration, new LatencyTableColumnLabelProvider() { @Override public String getTextForSegment(ISegment input) { return NonNullUtils.nullToEmptyString(Long.toString(input.getLength())); } }, SegmentComparators.INTERVAL_LENGTH_COMPARATOR); }
Source:
public Class classForName(String className, Map context) throws ClassNotFoundException { Class result = null; if ((result = (Class)classes.get(className)) == null) { try { result = Class.forName(className); } catch (ClassNotFoundException ex) { if (className.indexOf('.') == -1) { result = Class.forName("java.lang." + className); classes.put("java.lang." + className, result); } } if (result != null) { classes.put(className, result); } } return result; }

Target:
public Class classForName(String className, Map context) throws ClassNotFoundException { Class result = classes.get(className); if (result != null) { return result; } result = (className.indexOf('.') == -1) ? Class.forName("java.lang." + className) : Class.forName(className); classes.put(className, result); return result; }
Source:
public void doExtraction(OperationLogger logger, URI source, RoughArtifactCollector collector, String documentApplicabilty) throws IOException { InputStream rawHtml = null; try { String fileName = "file://" + source.getPath(); uriDirectoryName = fileName.substring(0, fileName.lastIndexOf('/') + 1); postProcessGuids.clear(); rawHtml = source.toURL().openStream(); DoorsTableRowCollector rowCollector = new DoorsTableRowCollector(this); Document doc = Jsoup.parse(rawHtml, "UTF-8", ""); Element body = doc.body(); for (Node cNodes : body.childNodes()) { for (Node subNodes : cNodes.childNodes()) { if (subNodes.nodeName().compareTo("tbody") == 0) { for (Node tableRow : subNodes.childNodes()) { if (tableRow instanceof Element) { rowCollector.addRawRow(tableRow); } } } } } rowCollector.createArtifacts(collector); } catch (Exception ex) { logger.log(ex); } finally { if (rawHtml != null) { rawHtml.close(); } } }

Target:
public void doExtraction(OperationLogger logger, URI source, RoughArtifactCollector collector, String documentApplicabilty) throws IOException { InputStream htmlStream = null; try { String fileName = "file://" + source.getPath(); uriDirectoryName = fileName.substring(0, fileName.lastIndexOf('/') + 1); postProcessGuids.clear(); this.logger = logger; htmlStream = source.toURL().openStream(); DoorsTableRowCollector rowCollector = new DoorsTableRowCollector(this); Document doc = Jsoup.parse(htmlStream, "UTF-8", ""); Element body = doc.body(); for (Node cNodes : body.childNodes()) { for (Node subNodes : cNodes.childNodes()) { if (subNodes.nodeName().compareTo("tbody") == 0) { for (Node tableRow : subNodes.childNodes()) { if (tableRow instanceof Element) { rowCollector.addRawRow(tableRow); } } } } } rowCollector.createArtifacts(collector); } catch (Exception ex) { logger.log(ex); } finally { Lib.close(htmlStream); } }
Source:
protected void init() { cluster = clusterDao.get(getParameters().getClusterId()); }

Target:
protected void init() { super.setClusterId(getParameters().getClusterId()); cluster = getCluster(); }
Source:
public void init() throws ServletException { try { caps |= Authn.Capabilities.class.getField(AUTHENTICATE_NEGOTIATE_INTERACTIVE).getLong(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { log.error("Error calculating authn capabilities while accessing constant {}", AUTHENTICATE_NEGOTIATE_INTERACTIVE); } final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }

Target:
public void init() throws ServletException { caps |= Authn.Capabilities.AUTHENTICATE_NEGOTIATE_INTERACTIVE | Authn.Capabilities.AUTHENTICATE_NEGOTIATE_NON_INTERACTIVE; final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }
Source:
private void init() { if (mMediaPlayerList != null) { Log.wtfStack(TAG, "init: The service has already been initialized"); return; } mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); sDeviceMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); mMediaPlayerList = new MediaPlayerList(Looper.myLooper(), this); mNativeInterface = AvrcpNativeInterface.getInterface(); mNativeInterface.init(AvrcpTargetService.this); }

Target:
private void init() { }
Source:
public void deleteDtoLogicallyByIdShouldDeletedLogicallyWhenChannelEntityExists() throws ObjectNotFoundException { ArgumentCaptor<ApplicationEntity> applicationsEntityArgumentCaptor = ArgumentCaptor.forClass(ApplicationEntity.class); given(this.applicationsRepository.findOne(APPLICATION_ID)).willReturn(applicationEntity); this.applicationsService.deleteDtoLogicallyById(APPLICATION_ID); verify(applicationsRepository).saveAndFlush(applicationsEntityArgumentCaptor.capture()); assertThat(applicationEntity, equalTo(applicationsEntityArgumentCaptor.getValue())); then(applicationsRepository).should().findOne(APPLICATION_ID); then(applicationsRepository).should().saveAndFlush(applicationEntity); }

Target:
public void deleteDtoLogicallyByIdShouldDeletedLogicallyWhenChannelEntityExists() throws ObjectNotFoundException { ArgumentCaptor<ApplicationEntity> applicationsEntityArgumentCaptor = ArgumentCaptor.forClass(ApplicationEntity.class); given(this.applicationsRepository.findOne(APPLICATION_ID)).willReturn(applicationEntity); this.applicationsService.deleteDtoLogicallyById(APPLICATION_ID); verify(applicationsRepository).saveAndFlush(applicationsEntityArgumentCaptor.capture()); assertThat(applicationEntity, equalTo(applicationsEntityArgumentCaptor.getValue())); then(applicationsRepository).should().findOne(APPLICATION_ID); then(applicationsRepository).should().saveAndFlush(applicationEntity); assertThat(applicationEntity.isDeleted(), is(true)); }
Source:
public DatasetDescriptor build() { ValidationException.check(schema != null, "Descriptor schema is required and cannot be null"); if (partitionStrategy == null) { if (PartitionStrategyParser.hasEmbeddedStrategy(schema)) { this.partitionStrategy = PartitionStrategyParser.parseFromSchema(schema); } } if (columnMapping == null) { if (ColumnMappingParser.hasEmbeddedColumnMapping(schema)) { this.columnMapping = ColumnMappingParser.parseFromSchema(schema); } else if (ColumnMappingParser.hasEmbeddedFieldMappings(schema)) { this.columnMapping = ColumnMappingParser.parseFromSchemaFields(schema); if (partitionStrategy == null) { this.partitionStrategy = buildPartitionStrategyForKeyMappings( ColumnMappingParser.parseKeyMappingsFromSchemaFields(schema)); } } } if (columnMapping == null && copiedMapping != null) { columnMapping = copiedMapping; } if(EntityPropertiesParser.hasEmbeddedProperties(schema)) { Map<String, String> schemaProperties = EntityPropertiesParser .parseFromSchema(schema); for (Map.Entry<String, String> propertySchemaEntry : schemaProperties .entrySet()) { if (!properties.containsKey(propertySchemaEntry.getKey())) { properties.put(propertySchemaEntry.getKey(), propertySchemaEntry.getValue()); } } } checkPartitionStrategy(schema, partitionStrategy); checkColumnMappings(schema, partitionStrategy, columnMapping); return new DatasetDescriptor( schema, schemaUri, format, location, properties, partitionStrategy, columnMapping, compressionType); }

Target:
public DatasetDescriptor build() { ValidationException.check(schema != null, "Descriptor schema is required and cannot be null"); if (partitionStrategy == null) { if (PartitionStrategyParser.hasEmbeddedStrategy(schema)) { this.partitionStrategy = PartitionStrategyParser.parseFromSchema(schema); } } if (columnMapping == null) { if (ColumnMappingParser.hasEmbeddedColumnMapping(schema)) { this.columnMapping = ColumnMappingParser.parseFromSchema(schema); } else if (ColumnMappingParser.hasEmbeddedFieldMappings(schema)) { this.columnMapping = ColumnMappingParser.parseFromSchemaFields(schema); if (partitionStrategy == null) { this.partitionStrategy = buildPartitionStrategyForKeyMappings( ColumnMappingParser.parseKeyMappingsFromSchemaFields(schema)); } } } if (columnMapping == null && copiedMapping != null) { columnMapping = copiedMapping; } checkPartitionStrategy(schema, partitionStrategy); checkColumnMappings(schema, partitionStrategy, columnMapping); return new DatasetDescriptor( schema, schemaUri, format, location, properties, partitionStrategy, columnMapping, compressionType); }
Source:
public static void main(String[] args) { try { doMain(args); System.exit(0); } catch (JamesCliException e) { failWithMessage(e.getMessage()); } catch (ParseException e) { failWithMessage("Error parsing command line : " + e.getMessage()); } catch (IOException ioe) { failWithMessage("Error connecting to remote JMX agent : " + ioe.getMessage()); } catch (Exception e) { LOG.error("Error on command: {}", e.toString()); failWithMessage("Error " + e.getClass() + " while executing command:" + e.getMessage()); } }

Target:
public static void main(String[] args) { try { doMain(args); System.exit(0); } catch (JamesCliException e) { failWithMessage(e.getMessage()); } catch (ParseException e) { failWithMessage("Error parsing command line : " + e.getMessage()); } catch (IOException ioe) { failWithMessage("Error connecting to remote JMX agent : " + ioe.getMessage()); } catch (Exception e) { LOG.error("Error while playing command", e); failWithMessage("Error " + e.getClass() + " while executing command:" + e.getMessage()); } }
Source:
public void test_setForegroundLorg_eclipse_swt_graphics_Color() { Color color = new Color(control.getDisplay(), 255, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); control.setForeground(null); assertFalse(control.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); boolean GTK3 = gtkVersion.substring(0, 1) == "3" ? true : false; Color bg = new Color(control.getDisplay(), 0, 255, 0); control.setForeground(color); control.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for " + control, color, control.getForeground()); assertEquals("Setting a background onto a widget with a foreground failed for " + control, bg, control.getBackground()); if (GTK3) { color = new Color (control.getDisplay(), 255, 0, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); assertEquals("Setting a background onto a widget with a foreground failed for " + control, bg, control.getBackground()); } } color.dispose(); }

Target:
public void test_setForegroundLorg_eclipse_swt_graphics_Color() { Color color = new Color(control.getDisplay(), 255, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); control.setForeground(null); assertFalse(control.getForeground().equals(color)); if ("gtk".equals(SWT.getPlatform ())) { Color bg = new Color(control.getDisplay(), 0, 255, 0); control.setForeground(color); control.setBackground(bg); assertEquals("Setting a background disrupted the foreground color for " + control, color, control.getForeground()); assertEquals("Setting a background onto a widget with a foreground failed for " + control, bg, control.getBackground()); if (SwtTestUtil.GTK3) { color = new Color (control.getDisplay(), 255, 0, 0, 0); control.setForeground(color); assertEquals(color, control.getForeground()); assertEquals("Setting a background onto a widget with a foreground failed for " + control, bg, control.getBackground()); } } color.dispose(); }
Source:
private void revokeUnauthToken(HeaderCacheElement oldToken) { synchronized (lock) { if (headerCache == oldToken) { headerCache = EMPTY_HEADER; } else { LOG.info("Skipping revoke, since the revoked token has already changed"); } } }

Target:
private void revokeUnauthToken(HeaderCacheElement oldToken) { synchronized (lock) { if (headerCache == oldToken) { LOG.warn("Got unauthenticated response from server, revoking the current token"); headerCache = EMPTY_HEADER; } else { LOG.info("Skipping revoke, since the revoked token has already changed"); } } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.actionStartVisit: if (OpenMRS.getInstance().getSyncState()) { ((PatientDashboardVisitsPresenter) mPresenter).syncVisits(); } else { ToastUtil.notify("Active patient visit cannot be started in offline mode"); } break; default: break; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.actionStartVisit: if (OpenMRS.getInstance().getSyncState()) { ((PatientDashboardVisitsPresenter) mPresenter).syncVisits(); } else { ToastUtil.notify(getString(R.string.offline_mode_not_supported)); } break; default: break; } return super.onOptionsItemSelected(item); }
Source:
protected List<ServiceName> installServices(OperationContext context, NativeInterfaceCommonPolicy commonPolicy, ModelNode model) throws OperationFailedException { populateHostControllerInfo(hostControllerInfo, context, model); final ServiceTarget serviceTarget = context.getServiceTarget(); final boolean onDemand = context.isBooting(); NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), context.getServiceRegistry(false), onDemand); OptionMap options = createConnectorOptions(commonPolicy); final ServiceName nativeManagementInterfaceBinding = NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(hostControllerInfo.getNativeManagementInterface()); final String securityRealm = commonPolicy.getSecurityRealm(); if (securityRealm == null) { ROOT_LOGGER.nativeManagementInterfaceIsUnsecured(); } NativeManagementServices.installManagementWorkerService(serviceTarget, context.getServiceRegistry(false)); ManagementRemotingServices.installDomainConnectorServices(serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT, nativeManagementInterfaceBinding, hostControllerInfo.getNativeManagementPort(), securityRealm, options); return Arrays.asList(ManagementRemotingServices.MANAGEMENT_ENDPOINT, UndertowHttpManagementService.SERVICE_NAME); }

Target:
protected List<ServiceName> installServices(OperationContext context, NativeInterfaceCommonPolicy commonPolicy, ModelNode model) throws OperationFailedException { populateHostControllerInfo(hostControllerInfo, context, model); final ServiceTarget serviceTarget = context.getServiceTarget(); final boolean onDemand = context.isBooting(); NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), context.getServiceRegistry(false), onDemand); OptionMap options = createConnectorOptions(commonPolicy); final ServiceName nativeManagementInterfaceBinding = NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(hostControllerInfo.getNativeManagementInterface()); final String securityRealm = commonPolicy.getSecurityRealm(); if (securityRealm == null) { ROOT_LOGGER.nativeManagementInterfaceIsUnsecured(); } NativeManagementServices.installManagementWorkerService(serviceTarget, context.getServiceRegistry(false)); ManagementRemotingServices.installDomainConnectorServices(serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT, nativeManagementInterfaceBinding, hostControllerInfo.getNativeManagementPort(), securityRealm, options); return Arrays.asList(REMOTING_BASE.append("server", MANAGEMENT_CONNECTOR), nativeManagementInterfaceBinding); }
Source:
private boolean groupAndValueMatches(long groupId, Block block, int position, int nodePointer, int valuePosition) { long groupIdExisting = groupIds.get(nodePointer); return groupIdExisting == groupId && type.equalTo(block, position, values, valuePosition); }

Target:
private boolean groupAndValueMatches(long groupId, Block block, int position, int nodePointer, int valuePosition) { long existingGroupId = groupIds.get(nodePointer); return existingGroupId == groupId && type.equalTo(block, position, values, valuePosition); }
Source:
public List<StudentAttributes> getAllCourseStudents() { List<StudentAttributes> list = new LinkedList<StudentAttributes>(); List<CourseStudent> entities = getCourseStudentEntities(); Iterator<CourseStudent> it = entities.iterator(); while (it.hasNext()) { CourseStudent student = it.next(); if (!JDOHelper.isDeleted(student)) { list.add(new StudentAttributes(student)); } } return list; }

Target:
public List<StudentAttributes> getAllCourseStudents() { List<StudentAttributes> list = new LinkedList<StudentAttributes>(); List<CourseStudent> entities = getCourseStudentEntities(); for (CourseStudent student : entities) { if (!JDOHelper.isDeleted(student)) { list.add(new StudentAttributes(student)); } } return list; }
Source:
static List<String> getInputFieldValue(StructuredRecord input, String inputField, Splitter splitter) { List<String> text = new ArrayList<>(); Schema schema = input.getSchema().getField(inputField).getSchema(); Schema.Type type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); if (type.equals(Schema.Type.ARRAY)) { schema = schema.getComponentSchema(); type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); if (type.equals(Schema.Type.STRING)) { text = input.get(inputField); } else { throw new IllegalArgumentException( String.format("Field to be used for text based feature generation should be of type string, nullable " + "string or array of strings or nullable string. But was ARRAY of %s for field %s.", schema.getComponentSchema(), inputField)); } } else if (type.equals(Schema.Type.STRING)) { if (inputField != null) { text = Lists.newArrayList(splitter.split((String) input.get(inputField))); } } return text; }

Target:
static List<String> getInputFieldValue(StructuredRecord input, String inputField, Splitter splitter) { List<String> text = new ArrayList<>(); Schema schema = input.getSchema().getField(inputField).getSchema(); Schema.Type type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); try { if (type == Schema.Type.ARRAY) { Object value = input.get(inputField); if (value instanceof List) { text = input.get(inputField); } else { text = Lists.newArrayList((String[]) value); } } else { String value = input.get(inputField); if (value != null) { text = Lists.newArrayList(splitter.split(value)); } } } catch (ClassCastException e) { throw new IllegalArgumentException(String.format("Schema type mismatch for field %s. Please make sure the " + "value to be used for feature generation is an array of " + "string or a string.", inputField), e); } return text; }
Source:
public Optional<TYPE> first() { Optional result = Optional.empty(); List<TYPE> list = first(1).asList(); if(!list.isEmpty()) { result = Optional.of(list.get(0)); } return result; }

Target:
public Optional<TYPE> first() { Iterator<TYPE> resultIterator = first(1).iterator(); return resultIterator.hasNext() ? Optional.of(resultIterator.next()) : Optional.empty(); }