auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testLongFloorDivMod() { testFloorDivModL(123L, 456L); testFloorDivModL(456L, 123L); testFloorDivModL(369L, 123L); testFloorDivModL(1L, 0L); testFloorDivModL(Long.MAX_VALUE, 1L); testFloorDivModL(Long.MAX_VALUE, -1L); testFloorDivModL(Long.MIN_VALUE, -1L); testFloorDivModL(Long.MIN_VALUE, -1L); }

Target:
public void testLongFloorDivMod() { testFloorDivModL(123L, 456L); testFloorDivModL(456L, 123L); testFloorDivModL(369L, 123L); testFloorDivModL(1L, 0L); testFloorDivModL(Long.MAX_VALUE, 1L); testFloorDivModL(Long.MAX_VALUE, -1L); testFloorDivModL(Long.MIN_VALUE, 1L); testFloorDivModL(Long.MIN_VALUE, -1L); }
Source:
protected void cloneRepo(File destinationRepo, RepoRemoteBranchesPage remoteBranches) throws Exception { remoteBranches.assertRemoteBranches(SampleTestRepository.FIX, Constants.MASTER); remoteBranches.selectBranches(SampleTestRepository.FIX, Constants.MASTER); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destinationRepo.toString()); workingCopy.assertDirectory(destinationRepo.toString()); workingCopy.assertBranch(Constants.MASTER); workingCopy.assertRemoteName(Constants.DEFAULT_REMOTE_NAME); workingCopy.waitForCreate(); Repository repository = new RepositoryBuilder().setGitDir( new File(destinationRepo, Constants.DOT_GIT)).build(); assertNotNull(repository.resolve("origin/master")); assertEquals(repository.resolve("master"), repository .resolve("origin/master")); assertNotNull(repository.resolve( Constants.R_TAGS + SampleTestRepository.v1_0_name).name()); int refs = repository.getAllRefs().size(); assertTrue(refs >= 4); assertTrue(new File(destinationRepo, SampleTestRepository.A_txt_name) .exists()); DirCacheEntry fileEntry = null; DirCache dc = repository.lockDirCache(); fileEntry = dc.getEntry(SampleTestRepository.A_txt_name); dc.unlock(); assertNotNull(fileEntry); assertEquals(0, ResourcesPlugin.getWorkspace().getRoot().getProjects().length); }

Target:
protected void cloneRepo(File destinationRepo, RepoRemoteBranchesPage remoteBranches) throws Exception { remoteBranches.assertRemoteBranches(SampleTestRepository.FIX, Constants.MASTER); remoteBranches.selectBranches(SampleTestRepository.FIX, Constants.MASTER); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destinationRepo.toString()); workingCopy.assertDirectory(destinationRepo.toString()); workingCopy.assertBranch(Constants.MASTER); workingCopy.assertRemoteName(Constants.DEFAULT_REMOTE_NAME); workingCopy.waitForCreate(); Repository repository = FileRepositoryBuilder.create(new File( destinationRepo, Constants.DOT_GIT)); assertNotNull(repository.resolve("origin/master")); assertEquals(repository.resolve("master"), repository .resolve("origin/master")); assertNotNull(repository.resolve( Constants.R_TAGS + SampleTestRepository.v1_0_name).name()); int refs = repository.getAllRefs().size(); assertTrue(refs >= 4); assertTrue(new File(destinationRepo, SampleTestRepository.A_txt_name) .exists()); DirCacheEntry fileEntry = null; DirCache dc = repository.lockDirCache(); fileEntry = dc.getEntry(SampleTestRepository.A_txt_name); dc.unlock(); assertNotNull(fileEntry); assertEquals(0, ResourcesPlugin.getWorkspace().getRoot().getProjects().length); }
Source:
private boolean checkCondtionalExpression(Expression expression) { if(getExpressionWithoutParenthezis(expression).getNodeType() == ASTNode.METHOD_INVOCATION) { return true; } return false; }

Target:
private static boolean checkCondtionalExpression(Expression expression) { int nodeType= getExpressionWithoutParenthezis(expression).getNodeType(); if (nodeType == ASTNode.METHOD_INVOCATION || nodeType == ASTNode.POSTFIX_EXPRESSION || nodeType == ASTNode.PREFIX_EXPRESSION || nodeType == ASTNode.ASSIGNMENT) { return true; } return false; }
Source:
public static void AdjustElevationForForwardMovement(MovePath source) { if (!(source.getEntity().getMovementMode() == EntityMovementMode.VTOL)) { return; } Coords destinationCoords = source.getFinalCoords().translated(source.getFinalFacing()); IHex destHex = source.getGame().getBoard().getHex(destinationCoords); if (destHex == null) { return; } int entityElevation = source.getFinalElevation(); boolean canGoUp = source.getEntity().canGoUp(entityElevation, source.getFinalCoords()); if (!canGoUp) { return; } IHex srcHex = source.getGame().getBoard().getHex(source.getFinalCoords()); int absHeight = srcHex.getLevel() + entityElevation; int destElevation = absHeight - destHex.getLevel(); int safeElevation = destHex.maxTerrainFeatureElevation(false); while (destElevation <= safeElevation) { boolean noLanding = (destElevation >= 1); if (destHex.containsTerrain(Terrains.BLDG_ELEV)) { noLanding &= destElevation > (destHex.terrainLevel(Terrains.BLDG_ELEV) - destHex.depth()); } if (destHex.containsTerrain(Terrains.BRIDGE_ELEV)) { noLanding &= destElevation != destHex.terrainLevel(Terrains.BRIDGE_ELEV); } if (source.getEntity().isElevationValid(destElevation, destHex) && noLanding) { return; } source.addStep(MoveStepType.UP); if(!source.isMoveLegal()) { source.removeLastStep(); return; } destElevation++; } }

Target:
public static void AdjustElevationForForwardMovement(MovePath source) { if (source.getEntity().getMovementMode() != EntityMovementMode.VTOL) { return; } Coords destinationCoords = source.getFinalCoords().translated(source.getFinalFacing()); IHex destHex = source.getGame().getBoard().getHex(destinationCoords); if (destHex == null) { return; } int entityElevation = source.getFinalElevation(); boolean canGoUp = source.getEntity().canGoUp(entityElevation, source.getFinalCoords()); if (!canGoUp) { return; } IHex srcHex = source.getGame().getBoard().getHex(source.getFinalCoords()); int absHeight = srcHex.getLevel() + entityElevation; int destElevation = absHeight - destHex.getLevel(); int safeElevation = destHex.maxTerrainFeatureElevation(false); while (destElevation <= safeElevation) { boolean noLanding = (destElevation >= 1); if (destHex.containsTerrain(Terrains.BLDG_ELEV)) { noLanding &= destElevation > (destHex.terrainLevel(Terrains.BLDG_ELEV) - destHex.depth()); } if (destHex.containsTerrain(Terrains.BRIDGE_ELEV)) { noLanding &= destElevation != destHex.terrainLevel(Terrains.BRIDGE_ELEV); } if (source.getEntity().isElevationValid(destElevation, destHex) && noLanding) { return; } source.addStep(MoveStepType.UP); if(!source.isMoveLegal()) { source.removeLastStep(); return; } destElevation++; } }
Source:
public void write(byte[] buffer, int offset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, offset, byteCount); if (currentEntry == null) { throw new ZipException("No active entry"); } final long totalBytes = crc.tbytes + byteCount; if ((totalBytes > Zip64.MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE) && !currentEntryNeedsZip64) { throw new IOException("Zip entry size (" + totalBytes + " bytes) cannot be represented in the zip format (needs Zip64)"); } if (currentEntry.getMethod() == STORED) { out.write(buffer, offset, byteCount); } else { super.write(buffer, offset, byteCount); } crc.update(buffer, offset, byteCount); }

Target:
public void write(byte[] buffer, int offset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, offset, byteCount); if (currentEntry == null) { throw new ZipException("No active entry"); } final long totalBytes = crc.tbytes + byteCount; if ((totalBytes > Zip64.MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE) && !currentEntryNeedsZip64) { throw new IOException("Zip entry size (" + totalBytes + " bytes) cannot be represented in the zip format (needs Zip64)." + " Set the entry length using ZipEntry#setLength to use Zip64 where necessary."); } if (currentEntry.getMethod() == STORED) { out.write(buffer, offset, byteCount); } else { super.write(buffer, offset, byteCount); } crc.update(buffer, offset, byteCount); }
Source:
public static long geReleasedOnTimeForOngoingAppDownload() { if (CommCareApplication.instance().getCurrentApp() == null) { return 0; } return CommCareApplication.instance().getCurrentApp().getAppPreferences() .getLong(RELEASED_ON_TIME_FOR_ONGOING_APP_DOWNLOAD, 0); }

Target:
public static long geReleasedOnTimeForOngoingAppDownload() { if (CommCareApplication.instance().getCurrentApp() == null) { return 0; } long releasedOnTime = CommCareApplication.instance().getCurrentApp().getAppPreferences() .getLong(RELEASED_ON_TIME_FOR_ONGOING_APP_DOWNLOAD, 0); releasedOnTime = Math.min(releasedOnTime, new Date().getTime()); return releasedOnTime; }
Source:
default List<Pattern> getExcludedResponseHeaderPatterns() { return emptyList(); }

Target:
default List<Pattern> getExcludedResponseHeaderPatterns() { return Collections.emptyList(); }
Source:
private List<WebElement> getUnreadNotificationsForTitle(String title) { List<WebElement> notifications = new ArrayList<WebElement>(); for (int i = 0; i < this.notificationsList.size(); i++) { WebElement n = this.notificationsList.get(i); WebElement nTitle = n.findElement(By.cssSelector(".notification-message h4")); String text = nTitle.getText(); if (n != null && title.equals(nTitle.getText())) { notifications.add(n); } } return notifications; }

Target:
private List<WebElement> getUnreadNotificationsForTitle(String title) { List<WebElement> notifications = new ArrayList<WebElement>(); for (int i = 0; i < this.notificationsList.size(); i++) { WebElement n = this.notificationsList.get(i); WebElement nTitle = n.findElement(By.cssSelector(".notification-message h4")); String text = nTitle.getText(); if (n != null && text.equals(title)) { notifications.add(n); } } return notifications; }
Source:
public List<P4Head> getHeads(@NonNull TaskListener listener) throws Exception { List<String> paths = getIncludePaths(); HashSet<P4Head> list = new HashSet<P4Head>(); ConnectionHelper p4 = new ConnectionHelper(credential, listener); try { List<IFileSpec> specs = p4.getDirs(paths); for (IFileSpec s : specs) { String branch = s.getOriginalPathString(); Path depotPath = Paths.get(branch); String name = depotPath.getFileName().toString(); P4Head head = new P4Head(name, branch, false); list.add(head); } } finally { p4.disconnect(); } return new ArrayList<>(list); }

Target:
public List<P4Head> getHeads(@NonNull TaskListener listener) throws Exception { List<String> paths = getIncludePaths(); HashSet<P4Head> list = new HashSet<P4Head>(); ConnectionHelper p4 = new ConnectionHelper(credential, listener); List<IFileSpec> specs = p4.getDirs(paths); for (IFileSpec s : specs) { String branch = s.getOriginalPathString(); Path depotPath = Paths.get(branch); if (depotPath == null) { continue; } Path file = depotPath.getFileName(); if (file == null) { continue; } P4Head head = new P4Head(file.toString(), branch, false); list.add(head); } p4.disconnect(); return new ArrayList<>(list); }
Source:
public void testGetLunsToUpdateInDbDiffLunIdDiffPvId() { Guid lunFromVgLunId = Guid.newGuid(); List<LUNs> lunsToUpdateInDb = getLunsToUpdateInDb(lunFromVgLunId, Guid.newGuid(), Guid.newGuid(), Guid.newGuid()); assertTrue(Objects.equals( lunsToUpdateInDb.stream().map(LUNs::getLUNId).findFirst().orElse(null), lunFromVgLunId.toString())); }

Target:
public void testGetLunsToUpdateInDbDiffLunIdDiffPvId() { Guid lunFromVgLunId = Guid.newGuid(); List<LUNs> newLunsToSaveInDb = getLunsToUpdateInDb(lunFromVgLunId, Guid.newGuid(), Guid.newGuid(), Guid.newGuid()). get(command.saveNewLuns); assertLunIdInList(newLunsToSaveInDb, lunFromVgLunId); }
Source:
private void writeThenReadFile(FileSystem fs, Path path) throws IOException { byte[] data = dataset(1024, 'a', 'z'); writeDataset(fs, path, data, data.length, 1024 * 1024, true); ContractTestUtils.verifyFileContents(fs, path, data); }

Target:
private void writeThenReadFile(FileSystem fs, Path path) throws IOException { byte[] data = dataset(1024, 'a', 'z'); writeDataset(fs, path, data, data.length, 1024, true); ContractTestUtils.verifyFileContents(fs, path, data); }
Source:
ShowCasesDialog() { super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.ShowCasesDialog_title_text(), true); tableModel = new ShowCasesTableModel(); initComponents(); try { EamDb dbManager = EamDb.getInstance(); List<CorrelationCase> eamCases = dbManager.getCases(); for(CorrelationCase eamCase : eamCases) { tableModel.addEamCase(eamCase); } } catch (EamDbException ex) { Exceptions.printStackTrace(ex); } display(); }

Target:
ShowCasesDialog() { super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.ShowCasesDialog_title_text(), true); tableModel = new ShowCasesTableModel(); initComponents(); try { EamDb dbManager = EamDb.getInstance(); List<CorrelationCase> eamCases = dbManager.getCases(); for(CorrelationCase eamCase : eamCases) { tableModel.addEamCase(eamCase); } } catch (EamDbException ex) { logger.log(Level.SEVERE, "Error getting list of cases from database.", ex); } display(); }
Source:
public POSTrain(int iter, String configFile) throws IOException { this.iter = iter; rm = new POSConfigurator().getConfigFromFile(configFile); this.init(); }

Target:
public POSTrain(int iter, String configFile) throws IOException { this.iter = iter; rm = new POSConfigurator().getConfig(new ResourceManager(configFile)); this.init(); }
Source:
public TaskInfo<EntryType> map(int index, ResultSet resultSet, StatementContext context) throws SQLException { final TaskInfo taskInfo; try { TaskStatus status = getJsonMapper().readValue(resultSet.getBytes("status_payload"), getStatusType()); taskInfo = new TaskInfo( resultSet.getString("id"), DateTimes.of(resultSet.getString("created_date")), status, resultSet.getString("datasource"), getJsonMapper().readValue(resultSet.getBytes("payload"), getEntryType()) ); } catch (IOException e) { throw new SQLException(e); } return taskInfo; }

Target:
public TaskInfo<EntryType> map(int index, ResultSet resultSet, StatementContext context) throws SQLException { final TaskInfo<EntryType> taskInfo; try { TaskStatus status = getJsonMapper().readValue(resultSet.getBytes("status_payload"), getStatusType()); taskInfo = new TaskInfo<>( resultSet.getString("id"), DateTimes.of(resultSet.getString("created_date")), status, resultSet.getString("datasource"), getJsonMapper().readValue(resultSet.getBytes("payload"), getEntryType()) ); } catch (IOException e) { throw new SQLException(e); } return taskInfo; }
Source:
private void onBoardNew() { logger.info("Menu: Boards > New"); if (isCurrentOpenBoardDirty()) { promptToSaveCurrentBoard(); } newBoard(); }

Target:
private void onBoardNew() { logger.info("Menu: Boards > New"); if (isCurrentBoardDirty() && isUserAgreeableToSavingBorad()) { saveBoard(); logger.info("Changes to the current board saved."); } else { logger.info("User abandoned unsaved changes."); } newBoard(); }
Source:
public String getColumnReference(TimeGrain requestedGrain) { Preconditions.checkArgument(getSupportedGrains().stream() .anyMatch((grainDef -> grainDef.grain().equals(requestedGrain)))); TimeGrainDefinition definition = getSupportedGrains().stream() .filter(grainDef -> grainDef.grain().equals(requestedGrain)).findFirst().get(); return String.format(definition.expression(), getColumnReference()); }

Target:
public String getColumnReference(TimeGrain requestedGrain) { TimeGrainDefinition definition = getSupportedGrains().stream() .filter(grainDef -> grainDef.grain().equals(requestedGrain)) .findFirst() .orElseThrow(() -> new IllegalStateException("Requested time grain not supported.")); return String.format(definition.expression(), getColumnReference()); }
Source:
public void testRejectTransformersEAP_7_2_0() throws Exception { final PathAddress subsystemAddress = PathAddress.pathAddress(UndertowExtension.SUBSYSTEM_PATH); final PathAddress serverAddress = subsystemAddress.append(UndertowExtension.SERVER_PATH); final PathAddress hostAddress = serverAddress.append(UndertowExtension.HOST_PATH); PathAddress servletContainer = subsystemAddress.append(UndertowExtension.PATH_SERVLET_CONTAINER); PathAddress byteBufferPath = subsystemAddress.append(UndertowExtension.BYTE_BUFFER_POOL_PATH); doRejectTest(ModelTestControllerVersion.EAP_7_2_0, EAP7_2_0, new FailedOperationTransformationConfig() .addFailedAttribute(hostAddress.append(PathElement.pathElement(Constants.SETTING, "console-access-log")), FailedOperationTransformationConfig.REJECTED_RESOURCE) .addFailedAttribute(servletContainer, new FailedOperationTransformationConfig.NewAttributesConfig( ServletContainerDefinition.PRESERVE_PATH_ON_FORWARD )) ); }

Target:
public void testRejectTransformersEAP_7_2_0() throws Exception { final PathAddress subsystemAddress = PathAddress.pathAddress(UndertowExtension.SUBSYSTEM_PATH); final PathAddress serverAddress = subsystemAddress.append(UndertowExtension.SERVER_PATH); final PathAddress hostAddress = serverAddress.append(UndertowExtension.HOST_PATH); PathAddress servletContainer = subsystemAddress.append(UndertowExtension.PATH_SERVLET_CONTAINER); doRejectTest(ModelTestControllerVersion.EAP_7_2_0, EAP7_2_0, new FailedOperationTransformationConfig() .addFailedAttribute(hostAddress.append(PathElement.pathElement(Constants.SETTING, "console-access-log")), FailedOperationTransformationConfig.REJECTED_RESOURCE) .addFailedAttribute(servletContainer, new FailedOperationTransformationConfig.NewAttributesConfig( ServletContainerDefinition.PRESERVE_PATH_ON_FORWARD )) ); }
Source:
public CacheDataStoreImpl( int partId, String name, CacheDataRowStore rowStore, CacheDataTree dataTree ) { this.partId = partId; this.name = name; this.rowStore = rowStore; this.dataTree = dataTree; pCntr = grp.mvccEnabled() ? new PartitionMvccTxUpdateCounterImpl() : grp.hasAtomicCaches() ? new PartitionAtomicUpdateCounterImpl() : ctx.logger(PartitionTxUpdateCounterDebugWrapper.class).isDebugEnabled() ? new PartitionTxUpdateCounterDebugWrapper(grp, partId) : new PartitionTxUpdateCounterImpl(); }

Target:
public CacheDataStoreImpl( int partId, String name, CacheDataRowStore rowStore, CacheDataTree dataTree ) { this.partId = partId; this.name = name; this.rowStore = rowStore; this.dataTree = dataTree; if (grp.mvccEnabled()) pCntr = new PartitionMvccTxUpdateCounterImpl(); else if (grp.hasAtomicCaches() || !grp.persistenceEnabled()) pCntr = new PartitionAtomicUpdateCounterImpl(); else { pCntr = ctx.logger(PartitionTxUpdateCounterDebugWrapper.class).isDebugEnabled() ? new PartitionTxUpdateCounterDebugWrapper(grp, partId) : new PartitionTxUpdateCounterImpl(); } }
Source:
public MessageConsole getConsole(String packageName) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); String projectConsoleName = "rpmbuild" + '(' + packageName + ')'; MessageConsole ret = null; for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager() .getConsoles()) { if (cons.getName().equals(projectConsoleName)) { ret = (MessageConsole) cons; } } if (ret == null) { ret = new MessageConsole(projectConsoleName, null, null, true); } conMan.addConsoles(new IConsole[] { ret }); ret.clearConsole(); ret.activate(); return ret; }

Target:
public MessageConsole getConsole(String packageName) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); String projectConsoleName = NLS.bind(Messages.PrepareSources_consoleName, packageName); MessageConsole ret = null; for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager() .getConsoles()) { if (cons.getName().equals(projectConsoleName)) { ret = (MessageConsole) cons; } } if (ret == null) { ret = new MessageConsole(projectConsoleName, null, null, true); } conMan.addConsoles(new IConsole[] { ret }); ret.clearConsole(); ret.activate(); return ret; }
Source:
public void should_call_single_listener_on_verify() { RememberingListener listener = new RememberingListener(); ThreadSafeMockingProgress.mockingProgress().addListener(listener); Foo foo = mock(Foo.class); VerificationMode never = never(); verify(foo, never).doSomething(""); assertThatHasBeenNotified(listener, foo, never, invocationWanted); }

Target:
public void should_call_single_listener_on_verify() { Foo foo = mock(Foo.class); VerificationMode never = never(); verify(foo, never).doSomething(""); assertThat(listener).is(notifiedFor(foo, never, invocationWanted)); }
Source:
public void testFailureOnServerErrors() throws Exception { List<ServerErrorCode> serverErrors = new ArrayList<>(Arrays.asList(ServerErrorCode.values())); serverErrors.remove(ServerErrorCode.Blob_Deleted); serverErrors.remove(ServerErrorCode.Blob_Expired); serverErrors.remove(ServerErrorCode.No_Error); serverErrors.remove(ServerErrorCode.Blob_Authorization_Failure); serverErrors.remove(ServerErrorCode.Blob_Not_Found); for (ServerErrorCode serverErrorCode : serverErrors) { mockServerLayout.getMockServers().forEach(server -> server.setServerErrorForAllRequests(serverErrorCode)); assertOperationFailure(serverErrorCode == ServerErrorCode.Disk_Unavailable ? RouterErrorCode.AmbryUnavailable : RouterErrorCode.UnexpectedInternalError); } }

Target:
public void testFailureOnServerErrors() throws Exception { EnumSet<ServerErrorCode> serverErrors = EnumSet.complementOf( EnumSet.of(ServerErrorCode.Blob_Deleted, ServerErrorCode.Blob_Expired, ServerErrorCode.No_Error, ServerErrorCode.Blob_Authorization_Failure, ServerErrorCode.Blob_Not_Found)); for (ServerErrorCode serverErrorCode : serverErrors) { mockServerLayout.getMockServers().forEach(server -> server.setServerErrorForAllRequests(serverErrorCode)); assertOperationFailure(serverErrorCode == ServerErrorCode.Disk_Unavailable ? RouterErrorCode.AmbryUnavailable : RouterErrorCode.UnexpectedInternalError); } }
Source:
private InputStream getResourceStream(File file, String resourceName) { try { JarFile jarFile = (JarFile) jarFiles.get(file); if (jarFile == null && file.isDirectory()) { File resource = new File(file, resourceName); if (resource.exists()) { return Files.newInputStream(resource.toPath()); } } else { return (InputStream) storeAndConvert(jarFile, file, resourceName, (jar, entry) -> jar.getInputStream(entry)); } } catch (Exception e) { log("Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE); } return null; }

Target:
private InputStream getResourceStream(File file, String resourceName) { try { JarFile jarFile = (JarFile) jarFiles.get(file); if (jarFile == null && file.isDirectory()) { File resource = new File(file, resourceName); if (resource.exists()) { return Files.newInputStream(resource.toPath()); } } else { return storeAndConvert(jarFile, file, resourceName, JarFile::getInputStream); } } catch (Exception e) { log("Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage() + " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE); } return null; }
Source:
public static void main(final String[] args) throws Exception { final LobClient client = AsyncLobClient.createDefault(API_KEY); final String letterTemplate = Files.toString(ClientUtil.fileFromResource("letters/letter_template.html"), Charsets.UTF_8); final AddressRequest companyAddress = AddressRequest.builder() .name("Deluxe Virgina Realty") .line1("185 Berry St.") .line2("Ste 6600") .city("San Francisco") .state("CA") .zip("94107") .country("US") .build(); final String today = new SimpleDateFormat("MMMM d YYYY").format(new Date()); final CsvMapper mapper = new CsvMapper(); final CsvSchema schema = mapper.schemaFor(CsvLetter.class).withHeader(); final MappingIterator<CsvLetter> iterator = mapper.reader(CsvLetter.class).with(schema).readValues(fileFromResource("letters/input.csv")); while (iterator.hasNext()) { final CsvLetter letter = iterator.next(); final Map<String, String> data = new HashMap<String, String>(); data.put("date", today); data.put("name", letter.name); data.put("amountDue", letter.amount); final LetterRequest letterRequest = LetterRequest.builder() .to( AddressRequest.builder() .name(letter.name) .line1(letter.address1) .line2(letter.address2) .city(letter.city) .state(letter.state) .zip(letter.zip) .country("US") .build()) .from(companyAddress) .file(letterTemplate) .color(true) .data(data) .build(); try { final LetterResponse letterResponse = client.createLetter(letterRequest).get(); printResponse("Letter", letterResponse); } catch (final Exception e) { printResponse("Failed Letter", letter); } } }

Target:
public static void main(final String[] args) throws Exception { final LobClient client = AsyncLobClient.createDefault(API_KEY); final String letterTemplate = Files.toString(ClientUtil.fileFromResource("letters/letter_template.html"), Charsets.UTF_8); final AddressRequest companyAddress = AddressRequest.builder() .name("Deluxe Virgina Realty") .line1("185 Berry St.") .line2("Ste 6600") .city("San Francisco") .state("CA") .zip("94107") .country("US") .build(); final String today = new SimpleDateFormat("MMMM d YYYY").format(new Date()); final CsvMapper mapper = new CsvMapper(); final CsvSchema schema = mapper.schemaFor(CsvLetter.class).withHeader(); final MappingIterator<CsvLetter> iterator = mapper.reader(CsvLetter.class).with(schema).readValues(fileFromResource("letters/input.csv")); while (iterator.hasNext()) { final CsvLetter letter = iterator.next(); final Map<String, String> data = new HashMap<String, String>(); data.put("date", today); data.put("name", letter.name); data.put("amountDue", letter.amount); final LetterRequest letterRequest = LetterRequest.builder() .to( AddressRequest.builder() .name(letter.name) .line1(letter.address1) .line2(letter.address2) .city(letter.city) .state(letter.state) .zip(letter.zip) .country("US") .build()) .from(companyAddress) .file(letterTemplate) .color(true) .data(data) .build(); try { final LetterResponse letterResponse = client.createLetter(letterRequest).get(); printResponse("Letter", letterResponse); } catch (final Exception e) { printResponse("Failed Letter", letter); } } System.exit(0); }
Source:
void setUp() { closeWebDriver(); useProxy(true); }

Target:
void setUp() { useProxy(true); }
Source:
public void testDeleteProject() throws SQLException{ ProjectInfo projectInfo = new ProjectInfo(); projectInfo.name = "TEST_PROJECT_NAME"; projectInfo.displayName = "TEST_PROJECT_DISPLAYNAME"; projectInfo.common = "TEST_PROJECT_COMMON"; projectInfo.manager = "TEST_PROJECT_MANAGER"; projectInfo.attachFileSize = 2048L; long projectId = mProjectMapper.createProject(projectInfo.name, projectInfo); assertTrue(projectId > 0); mProjectMapper.deleteProject(projectId); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName(ProjectEnum.TABLE_NAME); valueSet.addEqualCondition(ProjectEnum.ID, projectId); String query = valueSet.getSelectQuery(); ResultSet resultSet = mControl.executeQuery(query); assertFalse(resultSet.first()); }

Target:
public void testDeleteProject() throws SQLException{ mProjectMapper.deleteProject(mProjectId); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName(ProjectEnum.TABLE_NAME); valueSet.addEqualCondition(ProjectEnum.ID, mProjectId); String query = valueSet.getSelectQuery(); ResultSet resultSet = mControl.executeQuery(query); assertFalse(resultSet.first()); }
Source:
public void handleMessage(final ObjectMessage message) throws JMSException { this.correlationUid = message.getJMSCorrelationID(); this.domain = message.getStringProperty(Constants.DOMAIN); this.domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); this.messageType = message.getJMSType(); this.organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); this.deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); this.ipAddress = message.getStringProperty(Constants.IP_ADDRESS); this.retryCount = message.getIntProperty(Constants.RETRY_COUNT); if (message.propertyExists(Constants.SCHEDULE_TIME)) { this.scheduleTime = message.getLongProperty(Constants.SCHEDULE_TIME); } this.messagePriority = message.getJMSPriority(); }

Target:
public void handleMessage(final ObjectMessage message) throws JMSException { this.correlationUid = message.getJMSCorrelationID(); this.domain = message.getStringProperty(Constants.DOMAIN); this.domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); this.messageType = message.getJMSType(); this.organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); this.deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); this.ipAddress = message.getStringProperty(Constants.IP_ADDRESS); this.retryCount = message.getIntProperty(Constants.RETRY_COUNT); this.messagePriority = message.getJMSPriority(); }
Source:
private static boolean isDefaultConstructor(Symbol symbol) { if (symbol.isMethodSymbol()) { Symbol.MethodSymbol methodSymbol = ((Symbol.MethodSymbol)symbol); if ("<init>".equals(methodSymbol.name())) { if (methodSymbol.declaration() != null) { return methodSymbol.declaration().parameters().isEmpty(); } else { return methodSymbol.parameterTypes().isEmpty(); } } } return false; }

Target:
private static boolean isDefaultConstructor(Symbol symbol) { if (symbol.isMethodSymbol()) { Symbol.MethodSymbol methodSymbol = (Symbol.MethodSymbol) symbol; if (CONSTRUCTOR_NAME.equals(methodSymbol.name())) { if (methodSymbol.declaration() != null) { return methodSymbol.declaration().parameters().isEmpty(); } else { return methodSymbol.parameterTypes().isEmpty(); } } } return false; }
Source:
protected boolean canDoAction() { boolean toReturn = false; if (IrsBrokerCommand.tryLockIrsProxyData(getStoragePool().getId())) { try { toReturn = performChecks(); } catch (Exception e) { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); toReturn = false; } finally { if (!toReturn) { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); } } } return toReturn; }

Target:
protected boolean canDoAction() { boolean toReturn = false; boolean isLockSucceded = true; if (VdcActionType.RecoveryStoragePool.equals(getActionType())) { isLockSucceded = IrsBrokerCommand.tryLockIrsProxyData(getStoragePool().getId()); } else { IrsBrokerCommand.lockIrsProxyData(getStoragePool().getId()); } if (isLockSucceded) { try { toReturn = performChecks(); } catch (Exception e) { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); toReturn = false; } finally { if (!toReturn) { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); } } } return toReturn; }
Source:
public void queryOneExistedObjectObservable() { final List<User> users = putUsersBlocking(3); final User expectedUser = users.get(0); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs(expectedUser.email()) .build()) .prepare() .createObservable(); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(500, TimeUnit.MILLISECONDS); testSubscriber.assertValueCount(1); testSubscriber.assertValue(expectedUser); testSubscriber.assertNoErrors(); testSubscriber.unsubscribe(); }

Target:
public void queryOneExistedObjectObservable() { final List<User> users = putUsersBlocking(3); final User expectedUser = users.get(0); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs(expectedUser.email()) .build()) .prepare() .createObservable() .take(1); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(5, SECONDS); testSubscriber.assertValue(expectedUser); testSubscriber.assertNoErrors(); testSubscriber.unsubscribe(); }
Source:
protected void appendAbbreviatedPackageFragment(IPackageFragment pack) { refreshPackageNameAbbreviation(); String pkgName= pack.getElementName(); if (fgPkgNameAbbreviation != null && fgPkgNameAbbreviation.length != 0) { for (PackageNameAbbreviation abbr : fgPkgNameAbbreviation) { String abbrPrefix= abbr.getPackagePrefix(); if (pkgName.startsWith(abbrPrefix)) { int abbrPrefixLength= abbrPrefix.length(); int pkgLength= pkgName.length(); if ((pkgLength != abbrPrefixLength) && (pkgName.charAt(abbrPrefixLength) != '.')) continue; fBuffer.append(abbr.getAbbreviation()); if (pkgLength > abbrPrefixLength) { fBuffer.append('.'); String remaining= pkgName.substring(abbrPrefixLength + 1); if (isPackageNameCompressionEnabled()) appendCompressedPackageFragment(remaining); else fBuffer.append(remaining); } return; } } } if (isPackageNameCompressionEnabled()) { appendCompressedPackageFragment(pkgName); } else { fBuffer.append(pkgName); } }

Target:
protected void appendAbbreviatedPackageFragment(IPackageFragment pack) { refreshPackageNameAbbreviation(); String pkgName= pack.getElementName(); if (fgPkgNameAbbreviation != null && fgPkgNameAbbreviation.length != 0) { for (PackageNameAbbreviation abbr : fgPkgNameAbbreviation) { String abbrPrefix= abbr.getPackagePrefix(); if (pkgName.startsWith(abbrPrefix)) { int abbrPrefixLength= abbrPrefix.length(); int pkgLength= pkgName.length(); if ((pkgLength != abbrPrefixLength) && (pkgName.charAt(abbrPrefixLength) != '.')) { continue; } fBuffer.append(abbr.getAbbreviation()); if (pkgLength > abbrPrefixLength) { fBuffer.append('.'); String remaining= pkgName.substring(abbrPrefixLength + 1); if (isPackageNameCompressionEnabled()) appendCompressedPackageFragment(remaining); else fBuffer.append(remaining); } return; } } } if (isPackageNameCompressionEnabled()) { appendCompressedPackageFragment(pkgName); } else { fBuffer.append(pkgName); } }
Source:
public void start() { decoderA.start(); decoderB.start(); boolean initialized = false; final List<String> ipAddresses = new ArrayList<String>(); try { final Enumeration<NetworkInterface> network = NetworkInterface.getNetworkInterfaces(); for (; network.hasMoreElements();) { final Enumeration<InetAddress> inet = network.nextElement().getInetAddresses(); for (; inet.hasMoreElements();) { ipAddresses.add(inet.nextElement().toString()); } } } catch (final SocketException error) { Logger.error(error); } for (String newAddress: ipAddresses) { final int lastLocation = newAddress.lastIndexOf('.'); String testAddress = "0"; if (lastLocation >= 0) { testAddress = newAddress.substring(1, lastLocation - 1); } if (broadcastIP.equals(testAddress)) { eventPublisher.emit(new VideoValueA(newAddress, config.portA())); eventPublisher.emit(new VideoValueB(newAddress, config.portB())); initialized = true; break; } } if (!initialized) { throw new IllegalStateException(); } }

Target:
public void start() { decoderA.start(); decoderB.start(); boolean initialized = false; final List<String> ipAddresses = new ArrayList<String>(); try { final Enumeration<NetworkInterface> network = NetworkInterface.getNetworkInterfaces(); while (network.hasMoreElements()) { final Enumeration<InetAddress> inet = network.nextElement().getInetAddresses(); while (inet.hasMoreElements()) { ipAddresses.add(inet.nextElement().toString()); } } } catch (final SocketException error) { Logger.error(error); } for (final String newAddress: ipAddresses) { final int lastLocation = newAddress.lastIndexOf('.'); if (lastLocation >= 0) { final String testAddress = newAddress.substring(1, lastLocation - 1); if (broadcastIP.equals(testAddress)) { eventPublisher.emit(new VideoValueA(newAddress, config.portA())); eventPublisher.emit(new VideoValueB(newAddress, config.portB())); initialized = true; break; } } } if (!initialized) { Logger.warn("Could not detect the IP of the runtime system"); } }
Source:
public void createTestData() throws Exception { Bundle b1 = Util.readELBundles()[0][0]; b1.generateUniqueBundle(); Bundle b2 = Util.readELBundles()[0][0]; b2.generateUniqueBundle(); Bundle b3 = Util.readELBundles()[0][0]; b3.generateUniqueBundle(); try { b1 = new Bundle(b1, cluster1.getEnvFileName(), cluster1.getPrefix()); b2 = new Bundle(b2, cluster2.getEnvFileName(), cluster2.getPrefix()); b3 = new Bundle(b3, cluster3.getEnvFileName(), cluster3.getPrefix()); String postFix = "/US/" + b2.getClusterHelper().getColo().split("=")[1]; HadoopUtil.deleteDirIfExists(baseTestDir, cluster2FS); Util.lateDataReplenish(cluster2, 80, 1, baseTestDir, postFix); postFix = "/UK/" + b3.getClusterHelper().getColo().split("=")[1]; HadoopUtil.deleteDirIfExists(baseTestDir, cluster3FS); Util.lateDataReplenish(cluster3, 80, 1, baseTestDir, postFix); } finally { b1.deleteBundle(prism); b2.deleteBundle(prism); b3.deleteBundle(prism); } }

Target:
public void createTestData() throws Exception { Bundle b1 = Util.readELBundles()[0][0]; b1.generateUniqueBundle(); Bundle b2 = Util.readELBundles()[0][0]; b2.generateUniqueBundle(); Bundle b3 = Util.readELBundles()[0][0]; b3.generateUniqueBundle(); try { b1 = new Bundle(b1, cluster1.getEnvFileName(), cluster1.getPrefix()); b2 = new Bundle(b2, cluster2.getEnvFileName(), cluster2.getPrefix()); b3 = new Bundle(b3, cluster3.getEnvFileName(), cluster3.getPrefix()); String postFix = "/US/" + b2.getClusterHelper().getColoName(); HadoopUtil.deleteDirIfExists(baseTestDir, cluster2FS); Util.lateDataReplenish(cluster2, 80, 1, baseTestDir, postFix); postFix = "/UK/" + b3.getClusterHelper().getColoName(); HadoopUtil.deleteDirIfExists(baseTestDir, cluster3FS); Util.lateDataReplenish(cluster3, 80, 1, baseTestDir, postFix); } finally { removeBundles(b1, b2, b3); } }
Source:
public List<RichMember> findRichMembersWithAttributesInVo(PerunSession sess, Vo vo, String searchString, List<String> attrsNames) throws InternalErrorException { List<RichMember> list = findRichMembersInVo(sess, vo, searchString); List<AttributeDefinition> attrsDefs = new ArrayList<>(); for (String attrsName : attrsNames) { try { attrsDefs.add(getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrsName)); } catch (AttributeNotExistsException e) { throw new InternalErrorException("Attribute with given name: '" + attrsName + "' does not exist", e); } } return convertMembersToRichMembersWithAttributes(sess, list, attrsDefs); }

Target:
public List<RichMember> findRichMembersWithAttributesInVo(PerunSession sess, Vo vo, String searchString, List<String> attrsNames) throws InternalErrorException { List<RichMember> list = findRichMembersInVo(sess, vo, searchString); List<AttributeDefinition> attrsDefs = new ArrayList<>(); for (String attrsName : attrsNames) { try { attrsDefs.add(getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrsName)); } catch (AttributeNotExistsException e) { } } return convertMembersToRichMembersWithAttributes(sess, list, attrsDefs); }
Source:
public void load(final String text) { fTestFiles.clear(); fVariables.clear(); fCodeFragments.clear(); fFlags.clear(); try { final XMLMemento memento = XMLMemento.createReadRoot(new StringReader(text)); final IMemento testsNode = memento.getChild(XML_NODE_TESTFILES); if (testsNode != null) { for (final IMemento node : testsNode.getChildren(XML_NODE_TESTFILE)) fTestFiles.add(node.getTextData()); } final IMemento variablesNode = memento.getChild(XML_NODE_VARIABLES); if (variablesNode != null) { for (final IMemento node : variablesNode.getChildren(XML_NODE_VARIABLE)) { String pathVariable = node.getString(XML_ATTRIBUTE_PATH); final IPath path = (pathVariable == null) ? Path.ROOT : new Path(pathVariable); if (pathVariable == null) pathVariable = Path.ROOT.toString(); fVariables.add(new Variable(node.getString(XML_ATTRIBUTE_NAME), node.getTextData(), node.getString(XML_ATTRIBUTE_DESCRIPTION), path)); } } final IMemento codeFragmentsNode = memento.getChild(XML_NODE_CODE_FRAGMENTS); if (codeFragmentsNode != null) { for (final IMemento node : codeFragmentsNode.getChildren(XML_NODE_CODE_FRAGMENT)) fCodeFragments.put(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento flagsNode = memento.getChild(XML_NODE_FLAGS); if (flagsNode != null) { for (final IMemento node : flagsNode.getChildren(XML_NODE_FLAG)) setFlag(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento descriptionNode = memento.getChild(XML_NODE_DESCRIPTION); fDescription = (descriptionNode != null) ? descriptionNode.getTextData() : ""; fDirty = false; } catch (final WorkbenchException e) { } }

Target:
public void load(final String text) { fTestFiles.clear(); fVariables.clear(); fCodeFragments.clear(); fFlags.clear(); try { final XMLMemento memento = XMLMemento.createReadRoot(new StringReader(text)); final IMemento testsNode = memento.getChild(XML_NODE_TESTFILES); if (testsNode != null) { for (final IMemento node : testsNode.getChildren(XML_NODE_TESTFILE)) fTestFiles.add(node.getTextData()); } final IMemento variablesNode = memento.getChild(XML_NODE_VARIABLES); if (variablesNode != null) { for (final IMemento node : variablesNode.getChildren(XML_NODE_VARIABLE)) { final String pathVariable = node.getString(XML_ATTRIBUTE_PATH); final IPath path = (pathVariable == null) ? Path.ROOT : new Path(pathVariable); fVariables.add(new Variable(node.getString(XML_ATTRIBUTE_NAME), node.getTextData(), node.getString(XML_ATTRIBUTE_DESCRIPTION), path)); } } final IMemento codeFragmentsNode = memento.getChild(XML_NODE_CODE_FRAGMENTS); if (codeFragmentsNode != null) { for (final IMemento node : codeFragmentsNode.getChildren(XML_NODE_CODE_FRAGMENT)) fCodeFragments.put(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento flagsNode = memento.getChild(XML_NODE_FLAGS); if (flagsNode != null) { for (final IMemento node : flagsNode.getChildren(XML_NODE_FLAG)) setFlag(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento descriptionNode = memento.getChild(XML_NODE_DESCRIPTION); fDescription = (descriptionNode != null) ? descriptionNode.getTextData() : ""; fDirty = false; } catch (final WorkbenchException e) { } }
Source:
private void enableCancelButton() { showCancelButton = true; publishCancelDialogUpdate(); }

Target:
private void enableCancelButton() { isCancelable = true; publishCancelDialogUpdate(); }
Source:
public static boolean supportedInConfig(ConfigValues feature, Version version, ArchitectureType arch) { Map<String, String> archOptions = Config.<Map>getValue(feature, version.getValue()); if (archOptions != null) { String val = archOptions.get(arch.name()); if (val == null) { val = archOptions.get(arch.getFamily().name()); } return Boolean.parseBoolean(val); } return false; }

Target:
public static boolean supportedInConfig(ConfigValues feature, Version version, ArchitectureType arch) { Map<String, String> archOptions = Config.<Map>getValue(feature, version.getValue()); return Boolean.parseBoolean(archOptions.getOrDefault(arch.name(), archOptions.get(arch.getFamily().name()))); }
Source:
private void retrieve() { int persistedLinesFromCursor = Integer.parseInt(propertiesComponent.getValue( RefreshAction.LINES_FROM_CURSOR, String.valueOf(RefreshAction.LINES_FROM_CURSOR_DEFAULT_VALUE))); int persistedResultSize = Integer.parseInt(propertiesComponent.getValue( RefreshAction.SIZE, String.valueOf(RefreshAction.SIZE_DEFAULT_VALUE))); int persistedTopCount = Integer.parseInt(propertiesComponent.getValue( RefreshAction.TOP_COUNT, String.valueOf(RefreshAction.TOP_COUNT_DEFAULT_VALUE))); if (isWithInLimits(persistedLinesFromCursor, LimitsPanel.LINES_FROM_CURSOR_MIN, LimitsPanel.LINES_FROM_CURSOR_MAX)) { this.setLinesFromCursor(persistedLinesFromCursor); } else { this.setLinesFromCursor(RefreshAction.LINES_FROM_CURSOR_DEFAULT_VALUE); } if (isWithInLimits(persistedResultSize, LimitsPanel.MIN, LimitsPanel.RESULT_SIZE_MAX)) { this.setResultSize(persistedResultSize); } else { this.setResultSize(RefreshAction.SIZE_DEFAULT_VALUE); } if (isWithInLimits(persistedTopCount, LimitsPanel.MIN, LimitsPanel.TOP_COUNT_MAX)) { this.setTopCount(persistedTopCount); } else { this.setTopCount(RefreshAction.TOP_COUNT_DEFAULT_VALUE); } }

Target:
private void retrieve() { int persistedLinesFromCursor = Integer.parseInt(propertiesComponent.getValue( RefreshAction.LINES_FROM_CURSOR, String.valueOf(RefreshAction.LINES_FROM_CURSOR_DEFAULT_VALUE))); int persistedResultSize = Integer.parseInt(propertiesComponent.getValue( RefreshAction.SIZE, String.valueOf(RefreshAction.SIZE_DEFAULT_VALUE))); int persistedTopCount = Integer.parseInt(propertiesComponent.getValue( RefreshAction.TOP_COUNT, String.valueOf(RefreshAction.TOP_COUNT_DEFAULT_VALUE))); this.setLinesFromCursor(getValueBasedOnLimits(persistedLinesFromCursor, LimitsPanel.LINES_FROM_CURSOR_MIN, LimitsPanel.LINES_FROM_CURSOR_MAX, RefreshAction.LINES_FROM_CURSOR_DEFAULT_VALUE)); this.setResultSize(getValueBasedOnLimits(persistedResultSize, LimitsPanel.MIN, LimitsPanel.RESULT_SIZE_MAX, RefreshAction.SIZE_DEFAULT_VALUE)); this.setTopCount(getValueBasedOnLimits(persistedTopCount, LimitsPanel.MIN, LimitsPanel.TOP_COUNT_MAX, RefreshAction.TOP_COUNT_DEFAULT_VALUE)); }
Source:
private void cancelAllNotifications() { if (DBG) log("cancelAllNotifications"); NotificationManager notificationManager = (NotificationManager) mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE); if (SubscriptionManager.isValidSubscriptionId(mPrevSubId)) { notificationManager.cancel(Integer.toString(mPrevSubId), PS_NOTIFICATION); notificationManager.cancel(Integer.toString(mPrevSubId), CS_NOTIFICATION); notificationManager.cancel(Integer.toString(mPrevSubId), CS_REJECT_CAUSE_NOTIFICATION); } }

Target:
private void cancelAllNotifications() { if (DBG) log("cancelAllNotifications: mPrevSubId=" + mPrevSubId); NotificationManager notificationManager = (NotificationManager) mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE); if (SubscriptionManager.isValidSubscriptionId(mPrevSubId)) { notificationManager.cancel(Integer.toString(mPrevSubId), PS_NOTIFICATION); notificationManager.cancel(Integer.toString(mPrevSubId), CS_NOTIFICATION); notificationManager.cancel(Integer.toString(mPrevSubId), CS_REJECT_CAUSE_NOTIFICATION); } }
Source:
private String getASGAccount(String asgName) { Applications apps = PeerAwareInstanceRegistry.getInstance().getApplications(false); for (Application app : apps.getRegisteredApplications()) { for (InstanceInfo instanceInfo : app.getInstances()) { String thisAsgName = instanceInfo.getASGName(); if (thisAsgName != null && thisAsgName.equals(asgName)) { return ((AmazonInfo) instanceInfo.getDataCenterInfo()).get(MetaDataKey.accountId); } } } logger.error("Couldn't get the ASG account for " + asgName); return accountId; }

Target:
private String getASGAccount(String asgName) { Applications apps = PeerAwareInstanceRegistry.getInstance().getApplications(false); for (Application app : apps.getRegisteredApplications()) { for (InstanceInfo instanceInfo : app.getInstances()) { String thisAsgName = instanceInfo.getASGName(); if (thisAsgName != null && thisAsgName.equals(asgName)) { String accountId = ((AmazonInfo) instanceInfo.getDataCenterInfo()).get(MetaDataKey.accountId); if (accountId != null) { return accountId; } } } } logger.error("Couldn't get the ASG account for " + asgName); return accountId; }
Source:
private void putReadersUpdate(int backups) throws Exception { final int SRVS = 3; startGrids(SRVS); awaitPartitionMapExchange(); Ignite srv = ignite(0); srv.createCache(cacheConfiguration(backups)); Ignite client1 = startClientGrid(SRVS); IgniteCache<Object, Object> cache1 = client1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>()); Integer key = primaryKey(srv.cache(DEFAULT_CACHE_NAME)); Ignite client2 = startGrid(SRVS + 1); IgniteCache<Object, Object> cache2 = client2.cache(DEFAULT_CACHE_NAME); cache1.put(key, 1); cache2.put(key, 2); checkCacheData(F.asMap(key, 2), DEFAULT_CACHE_NAME); int val = 10; for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { try (Transaction tx = client2.transactions().txStart(concurrency, isolation)) { cache2.put(key, val); tx.commit(); } checkCacheData(F.asMap(key, val), DEFAULT_CACHE_NAME); val++; } } }

Target:
private void putReadersUpdate(int backups) throws Exception { final int SRVS = 3; startGrids(SRVS); awaitPartitionMapExchange(); Ignite srv = ignite(0); srv.createCache(cacheConfiguration(backups)); Ignite client1 = startClientGrid(SRVS); IgniteCache<Object, Object> cache1 = client1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>()); Integer key = primaryKey(srv.cache(DEFAULT_CACHE_NAME)); Ignite client2 = startClientGrid(SRVS + 1); IgniteCache<Object, Object> cache2 = client2.cache(DEFAULT_CACHE_NAME); cache1.put(key, 1); cache2.put(key, 2); checkCacheData(F.asMap(key, 2), DEFAULT_CACHE_NAME); int val = 10; for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { try (Transaction tx = client2.transactions().txStart(concurrency, isolation)) { cache2.put(key, val); tx.commit(); } checkCacheData(F.asMap(key, val), DEFAULT_CACHE_NAME); val++; } } }