auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<Object> getInputFields(IndexedRecord inputRecord, String columnName) { if (!columnName.startsWith(".")) columnName = "." + columnName; Try<scala.collection.immutable.List<Evaluator.Ctx>> result = wandou.avpath.package$.MODULE$.select(inputRecord, columnName); List<Object> values = new ArrayList<Object>(); if (result.isSuccess()) { for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) { values.add(ctx.value()); } } else { throw TalendRuntimeException.createUnexpectedException(result.failed().get()); } return values; }

Target:
private List<Object> getInputFields(IndexedRecord inputRecord, String columnName) { if (!columnName.startsWith(".")) columnName = "." + columnName; Try<scala.collection.immutable.List<Evaluator.Ctx>> result = wandou.avpath.package$.MODULE$.select(inputRecord, columnName); List<Object> values = new ArrayList<Object>(); if (result.isSuccess()) { for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) { values.add(ctx.value()); } } else { Throwable t = result.failed().get(); throw ProcessingErrorCode.createAvpathSyntaxError(t, columnName, -1); } return values; }
Source:
public void setUp() throws Exception { SqlTestUtils.deleteDatabase(username); sandbox = SqlSandboxUtils.getStaticStorage(username); ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().getResourceAsStream("ipm_restore.xml"), sandbox); sandbox = null; }

Target:
public void setUp() throws Exception { sandbox = SqlSandboxUtils.getStaticStorage(username); PrototypeFactory.setStaticHasher(new ClassNameHasher()); ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().getResourceAsStream("ipm_restore.xml"), sandbox); sandbox = null; }
Source:
private void handleUtterance(Session session, String query, Response response) { session.updateContext(); Example.Builder b = new Example.Builder(); b.setId("session:" + session.id); b.setUtterance(query); b.setContext(session.context); Example ex = b.createExample(); ex.preprocess(); ParserState state; state = builder.parser.parse(builder.params, ex, false); response.ex = ex; ex.logWithoutContext(); if (ex.predDerivations.size() > 0) { response.candidateIndex = 0; printDerivation(response.getDerivation()); } session.updateContext(ex, opts.contextMaxExchanges); }

Target:
private void handleUtterance(Session session, String query, Response response) { session.updateContext(); Example.Builder b = new Example.Builder(); b.setId("session:" + session.id); b.setUtterance(query); b.setContext(session.context); Example ex = b.createExample(); ex.preprocess(); builder.parser.parse(builder.params, ex, false); response.ex = ex; ex.logWithoutContext(); if (ex.predDerivations.size() > 0) { response.candidateIndex = 0; printDerivation(response.getDerivation()); } session.updateContext(ex, opts.contextMaxExchanges); }
Source:
public void addEvent(ITimeEvent event) { if (!(event instanceof TimeLineEvent)) { throw new IllegalArgumentException("Needs to be a TimeLineEvent"); } super.addEvent(event); }

Target:
public void addEvent(ITimeEvent event) { isValidEvent(event); super.addEvent(event); }
Source:
private void addSuggestion(Map map, Account account, AccountInfo info, Boolean active) { if(active != null) { if(active.booleanValue() != account.isActive()) { return; } } map.put(account.getId(), info); }

Target:
private void addSuggestion(Map map, Account account, AccountInfo info, Boolean active) { if (active == null || active == account.isActive()) { map.put(account.getId(), info); } }
Source:
static ImmutableHolidayCalendar generateSydney() { List<LocalDate> holidays = new ArrayList<>(0); return ImmutableHolidayCalendar.of(HolidayCalendarId.of("AUSY"), holidays, SATURDAY, SUNDAY); }

Target:
static ImmutableHolidayCalendar generateSydney() { List<LocalDate> holidays = new ArrayList<>(2000); for (int year = 1950; year <= 2099; year++) { holidays.add(bumpToMon(date(year, 1, 1))); holidays.add(bumpToMon(date(year, 1, 26))); holidays.add(easter(year).minusDays(2)); holidays.add(easter(year).plusDays(1)); holidays.add(date(year, 4, 25)); holidays.add(first(year, 6).with(dayOfWeekInMonth(2, MONDAY))); holidays.add(first(year, 8).with(dayOfWeekInMonth(1, MONDAY))); holidays.add(first(year, 10).with(dayOfWeekInMonth(1, MONDAY))); holidays.add(christmas(year)); holidays.add(boxingDay(year)); } removeSatSun(holidays); return ImmutableHolidayCalendar.of(HolidayCalendarId.of("AUSY"), holidays, SATURDAY, SUNDAY); }
Source:
public Expression visitLeave(JsonPathAsTextParseNode node, List<Expression> children) throws SQLException { if(!(PJson.INSTANCE.isComparableTo(children.get(0).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } if(!(PVarchar.INSTANCE.isComparableTo(children.get(1).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } LiteralExpression rhs=(LiteralExpression)children.get(1); String v=(String)rhs.getValue(); if(!v.startsWith("{")||!v.endsWith("}")){ throw new SQLExceptionInfo.Builder(SQLExceptionCode.JSON_PATH_ERROR).build().buildException(); } Expression expression = new JsonPathAsTextExpression(children); return wrapGroupByExpression(expression); }

Target:
public Expression visitLeave(JsonPathAsTextParseNode node, List<Expression> children) throws SQLException { if(!(PJson.INSTANCE.isComparableTo(children.get(0).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } if(children.get(1).getDataType()!=PVarcharArray.INSTANCE){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } Expression expression = new JsonPathAsTextExpression(children); return wrapGroupByExpression(expression); }
Source:
@Deprecated @Restricted(DoNotUse.class) @RestrictedSince("2.0") public String getInstallation() { for (SCMSourceTrait t: traits) { if (t instanceof MercurialInstallationSCMSourceTrait) { return ((MercurialInstallationSCMSourceTrait) t).getInstallation(); } } return null; }

Target:
@Deprecated @Restricted(DoNotUse.class) @RestrictedSince("2.0") public String getInstallation() { MercurialInstallationSCMSourceTrait t = getTrait(MercurialInstallationSCMSourceTrait.class); return t != null ? t.getInstallation() : null; }
Source:
public void getApexDFSRootDirScheme() throws Exception { Configuration conf = new Configuration(false); conf.set(StramClientUtils.APEX_APP_DFS_ROOT_DIR, "file:/p/q/r"); conf.setBoolean(StramUserLogin.DT_APP_PATH_IMPERSONATED, false); UserGroupInformation testUser = UserGroupInformation.createUserForTesting("testUser1", new String[]{""}); spy(UserGroupInformation.class); doReturn(testUser).when(UserGroupInformation.class, "getLoginUser"); FileSystem fs = FileSystem.newInstance(conf); Path path = StramClientUtils.getApexDFSRootDir(fs, conf); Assert.assertEquals(fs.getHomeDirectory() + "/datatorrent", path.toString()); Assert.assertNull(conf.get(StramClientUtils.DT_DFS_ROOT_DIR)); Assert.assertEquals("file:/p/q/r", conf.get(StramClientUtils.APEX_APP_DFS_ROOT_DIR)); }

Target:
public void getApexDFSRootDirScheme() throws Exception { Configuration conf = new Configuration(false); conf.set(StramClientUtils.APEX_APP_DFS_ROOT_DIR, "file:/p/q/r"); conf.setBoolean(StramUserLogin.DT_APP_PATH_IMPERSONATED, false); setupLoginTestUser(); FileSystem fs = FileSystem.newInstance(conf); Path path = StramClientUtils.getApexDFSRootDir(fs, conf); Assert.assertEquals(fs.getHomeDirectory() + "/datatorrent", path.toString()); Assert.assertNull(conf.get(StramClientUtils.DT_DFS_ROOT_DIR)); Assert.assertEquals("file:/p/q/r", conf.get(StramClientUtils.APEX_APP_DFS_ROOT_DIR)); }
Source:
public AdvancedJoystickButton getifAvailable(int buttonNumber) { if (buttonNumber < 1 || buttonNumber > maxButtons) { String message = "button " + buttonNumber + " is out of range!"; return getMockButton(message); } if (buttonMap.containsKey(buttonNumber)) { return buttonMap.remove(buttonNumber); } else { String message = "button " + buttonNumber + " is already used! Cannot be used twice!"; return getMockButton(message); } }

Target:
public AdvancedJoystickButton getifAvailable(int buttonNumber) { if (buttonNumber < 1 || buttonNumber > maxButtons) { return handleInvalidButton("button " + buttonNumber + " is out of range!"); } if (buttonMap.containsKey(buttonNumber)) { return buttonMap.remove(buttonNumber); } else { return handleInvalidButton("button " + buttonNumber + " is already used! Cannot be used twice!"); } }
Source:
private boolean isBaseSnapshotDisk() { return getNewDisk().isDiskSnapshot() && ((DiskImage) getNewDisk()).getImage().getVolumeFormat() == VolumeFormat.RAW; }

Target:
private boolean isBaseSnapshotDisk() { return getNewDisk().isDiskSnapshot() && ((DiskImage) getNewDisk()).getImage().getVolumeFormat() != VolumeFormat.COW; }
Source:
public void checkWebNodejsSimpleProjectCommands() { consoles.executeCommandFromProjectExplorer( WEB_NODEJS_SIMPLE, BUILD_GOAL, INSTALL_DEPENDENCIES_COMMAND_ITEM.getItem(WEB_NODEJS_SIMPLE), "bower_components/angular"); consoles.executeCommandFromProjectExplorer( WEB_NODEJS_SIMPLE, RUN_GOAL, RUN_COMMAND_ITEM.getItem(WEB_NODEJS_SIMPLE), "Started connect web server"); consoles.checkWebElementVisibilityAtPreviewPage( By.xpath(" consoles.closeProcessTabWithAskDialog(RUN_COMMAND_ITEM.getItem(WEB_NODEJS_SIMPLE)); }

Target:
public void checkWebNodejsSimpleProjectCommands() { By textOnPreviewPage = By.xpath(" consoles.executeCommandFromProjectExplorer( WEB_NODE_JS_PROJECT, BUILD_GOAL, INSTALL_DEPENDENCIES_COMMAND_ITEM.getItem(WEB_NODE_JS_PROJECT), "bower_components/angular"); consoles.executeCommandFromProjectExplorer( WEB_NODE_JS_PROJECT, RUN_GOAL, RUN_COMMAND_ITEM.getItem(WEB_NODE_JS_PROJECT), "Started connect web server"); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog(RUN_COMMAND_ITEM.getItem(WEB_NODE_JS_PROJECT)); }
Source:
private void createProject() throws RepositoryNotFoundException, OrmException, IOException, Failure { final PerformCreateProject perfCreateProject = performCreateProject.create(projectName, ownerIds, newParent, projectDescription, submitType, contributorAgreements, signedOffBy, permissionsOnly, branch); final StringBuilder err = perfCreateProject.createProject(); if (err.length() > 0) { throw new Failure(1, err.toString()); } }

Target:
private void createProject() throws RepositoryNotFoundException, OrmException, IOException, Failure { final CreateProjectArgs args = new CreateProjectArgs(); args.setProjectName(projectName); args.setOwnerIds(ownerIds); args.setNewParent(newParent); args.setProjectDescription(projectDescription); args.setSubmitType(submitType); args.setContributorAgreements(contributorAgreements); args.setSignedOffBy(signedOffBy); args.setPermissionsOnly(permissionsOnly); args.setBranch(branch); args.setContentMerge(contentMerge); args.setChangeIdRequired(requireChangeID); final PerformCreateProject perfCreateProject = performCreateProject.create(args); try { perfCreateProject.createProject(); } catch (CreateProjectParamsException e) { throw new Failure(1, e.getMessage()); } }
Source:
public void sanitizeForSaving() { this.commentText = Sanitizer.sanitizeTextField(this.commentText); this.commentText = Sanitizer.sanitizeForRichText(this.commentText); }

Target:
public void sanitizeForSaving() { this.commentText = Sanitizer.sanitizeForRichText(this.commentText); }
Source:
public ReceivePacket( XBee64BitAddress sourceAddress64, XBee16BitAddress sourceAddress16, int receiveOptions, byte[] receivedData){ super(XBeeAPIType.RECEIVE_PACKET); this.sourceAddress64 = sourceAddress64; this.sourceAddress16 = sourceAddress16; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }

Target:
public ReceivePacket(XBee64BitAddress sourceAddress64, XBee16BitAddress sourceAddress16, int receiveOptions, byte[] receivedData){ super(APIFrameType.RECEIVE_PACKET); if (sourceAddress64 == null) throw new NullPointerException("64-bit source address cannot be null."); if (sourceAddress16 == null) throw new NullPointerException("16-bit source address cannot be null."); if (receiveOptions < 0 || receiveOptions > 255) throw new IllegalArgumentException("Receive options value must be between 0 and 255."); this.sourceAddress64 = sourceAddress64; this.sourceAddress16 = sourceAddress16; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }
Source:
public void testPutJsonQueryEntity() throws Exception { String cacheName = "person"; Person simple = new Person(100, "John", "Doe", 10000); putObject(cacheName, "300", simple); String ret = content(cacheName, GridRestCommand.CACHE_GET, "keyType", "int", "key", "300" ); info("Get command result: " + ret); checkJson(ret, simple); JsonNode val = queryObject( cacheName, "type", Person.class.getSimpleName(), "pageSize", "1", "qry", "orgId = ?", "arg1", String.valueOf(simple.getOrganizationId()) ); assertEquals(simple.getOrganizationId().intValue(), val.get("orgId").intValue()); assertEquals(simple.getSalary(), val.get("salary").doubleValue()); assertEquals(simple.getFirstName(), val.get("firstName").textValue()); assertEquals(simple.getLastName(), val.get("lastName").textValue()); initCache(); }

Target:
public void testPutJsonQueryEntity() throws Exception { String cacheName = "person"; Person simple = new Person(100, "John", "Doe", 10000); try { putObject(cacheName, "300", simple); String ret = content(cacheName, GridRestCommand.CACHE_GET, "keyType", "int", "key", "300"); info("Get command result: " + ret); checkJson(ret, simple); JsonNode val = queryObject( cacheName, GridRestCommand.EXECUTE_SQL_QUERY, "type", Person.class.getSimpleName(), "pageSize", "1", "qry", "orgId = ?", "arg1", String.valueOf(simple.getOrganizationId()) ); assertEquals(simple.getOrganizationId().intValue(), val.get("orgId").intValue()); assertEquals(simple.getSalary(), val.get("salary").doubleValue()); assertEquals(simple.getFirstName(), val.get("firstName").textValue()); assertEquals(simple.getLastName(), val.get("lastName").textValue()); } finally { grid(0).cache(cacheName).remove(300); } }
Source:
public synchronized void start() { super.start(); try { createStreamClient(); } catch (Exception e) { LOG.error("Unable to create Stream client by name: for host: {}, port: {}. Reason: ", new Object[]{streamName, host, port, e.getMessage(), e}); closeWriterQuietly(); closeClientQuietly(); } LOG.info("StreamSink started.", getName()); }

Target:
public synchronized void start() { try { createStreamClient(); } catch (Throwable t) { LOG.error("Unable to create Stream client by name: for host: {}, port: {}. Reason: ", new Object[]{streamName, host, port, t.getMessage(), t}); closeWriterQuietly(); closeClientQuietly(); return; } super.start(); LOG.info("StreamSink started.", getName()); }
Source:
public Mono<Void> inspect(HealthMonitoringRecord record) { return Mono.fromRunnable(() -> { if (record.getSeverity() == HealthMonitoringRecord.HealthSeverity.ERROR) { logger.error("Unhealthiness detected in the operation %s for %s.", record.operation.name(), record.lease.getId(), record.throwable); } }); }

Target:
public Mono<Void> inspect(HealthMonitoringRecord record) { return Mono.fromRunnable(() -> { if (record.getSeverity() == HealthMonitoringRecord.HealthSeverity.ERROR) { logger.error("Unhealthiness detected in the operation for {}.", record.operation.name(), record.lease.getId(), record.throwable); } }); }
Source:
public void testUpdateQuotaRecords() { UsageVO usageVO = new UsageVO(); usageVO.setId(100L); usageVO.setQuotaCalculated(0); usageVO.setUsageType(UsageTypes.NETWORK_BYTES_SENT); usageVO.setRawUsage(9000000000.0); usageVO.setSize(1010101010L); QuotaTariffVO tariffVO = new QuotaTariffVO(); tariffVO.setCurrencyValue(new BigDecimal(1)); Mockito.when(quotaTariffDao.findTariffPlanByUsageType(Mockito.anyInt(), Mockito.any(Date.class))).thenReturn(tariffVO); quotaManager.updateQuotaNetwork(usageVO, UsageTypes.NETWORK_BYTES_SENT); quotaManager.updateQuotaAllocatedVMUsage(usageVO, new BigDecimal(0.5)); quotaManager.updateQuotaDiskUsage(usageVO, new BigDecimal(0.5), UsageTypes.VOLUME); quotaManager.updateQuotaRaw(usageVO, new BigDecimal(0.5), UsageTypes.VPN_USERS); Mockito.verify(quotaUsageDao, Mockito.times(4)).persistQuotaUsage(Mockito.any(QuotaUsageVO.class)); Mockito.verify(usageDao, Mockito.times(4)).persistUsage(Mockito.any(UsageVO.class)); }

Target:
public void testUpdateQuotaRecords() { UsageVO usageVO = new UsageVO(); usageVO.setId(100L); usageVO.setQuotaCalculated(0); usageVO.setUsageType(UsageTypes.NETWORK_BYTES_SENT); usageVO.setRawUsage(9000000000.0); usageVO.setSize(1010101010L); QuotaTariffVO tariffVO = new QuotaTariffVO(); tariffVO.setCurrencyValue(new BigDecimal(1)); Mockito.when(quotaTariffDao.findTariffPlanByUsageType(Mockito.anyInt(), Mockito.any(Date.class))).thenReturn(tariffVO); QuotaUsageVO qu = quotaManager.updateQuotaNetwork(usageVO, UsageTypes.NETWORK_BYTES_SENT); assertTrue(qu.getQuotaUsed().compareTo(BigDecimal.ZERO) > 0); qu = quotaManager.updateQuotaAllocatedVMUsage(usageVO, new BigDecimal(0.5)); assertTrue(qu.getQuotaUsed().compareTo(BigDecimal.ZERO) > 0); qu = quotaManager.updateQuotaDiskUsage(usageVO, new BigDecimal(0.5), UsageTypes.VOLUME); assertTrue(qu.getQuotaUsed().compareTo(BigDecimal.ZERO) > 0); qu = quotaManager.updateQuotaRaw(usageVO, new BigDecimal(0.5), UsageTypes.VPN_USERS); assertTrue(qu.getQuotaUsed().compareTo(BigDecimal.ZERO) > 0); Mockito.verify(quotaUsageDao, Mockito.times(4)).persistQuotaUsage(Mockito.any(QuotaUsageVO.class)); Mockito.verify(usageDao, Mockito.times(4)).persistUsage(Mockito.any(UsageVO.class)); }
Source:
public boolean containsAll(Collection<?> c) { return fInnerElements.values().containsAll(c); }

Target:
public boolean containsAll(Collection<?> c) { Collection<?> nonNullCollection = c; if (nonNullCollection.contains(null)) { if(!contains(null)) { return false; } nonNullCollection = c.stream().filter(Objects::nonNull).collect(Collectors.toList()); } return fInnerElements.values().containsAll(nonNullCollection); }
Source:
static FilePath secretsDir(FilePath workspace) { Computer computer = workspace.toComputer(); Node node = computer == null ? null : computer.getNode(); FilePath root = node == null ? workspace : node.getRootPath(); return root.child("secretFiles"); }

Target:
static FilePath secretsDir(FilePath workspace) { return tempDir(workspace).child("secretFiles"); }
Source:
public String getTaskForm(String containerId, Long taskId, String language) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.TASK_INSTANCE_ID, taskId); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + TASK_FORM_GET_URI, valuesMap) + "?lang=" + language); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "FormService", "getFormDisplayTask", new Object[]{taskId, language, true} )) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM-UI", containerId ).getResponses().get(0); throwExceptionOnFailure(response); return response.getResult(); } }

Target:
public String getTaskForm(String containerId, Long taskId, String language) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.TASK_INSTANCE_ID, taskId); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + TASK_FORM_GET_URI, valuesMap) + "?lang=" + language + "&filter=true"); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "FormService", "getFormDisplayTask", new Object[]{taskId, language, true} )) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM-UI", containerId ).getResponses().get(0); throwExceptionOnFailure(response); return response.getResult(); } }
Source:
public Response putCredentials(String message) throws IOException { Map<String, String> messageMap = gson.fromJson(message, new TypeToken<Map<String, String>>(){}.getType()); String entity = messageMap.get("entity"); String username = messageMap.get("username"); String password = messageMap.get("password"); if (entity == null || username == null || password == null) { return new JsonResponse(Status.INTERNAL_SERVER_ERROR, "", "").build(); } String user = SecurityUtils.getPrincipal(); logger.info("Update credentials for user entity {}", user, entity); UserCredentials uc = credentials.getUserCredentials(user); uc.putUsernamePassword(entity, new UsernamePassword(username, password)); credentials.putUserCredentials(user, uc); return new JsonResponse(Status.OK, "", "").build(); }

Target:
public Response putCredentials(String message) throws IOException { Map<String, String> messageMap = gson.fromJson(message, new TypeToken<Map<String, String>>(){}.getType()); String entity = messageMap.get("entity"); String username = messageMap.get("username"); String password = messageMap.get("password"); if (entity == null || username == null || password == null) { return new JsonResponse(Status.BAD_REQUEST, "", "").build(); } String user = SecurityUtils.getPrincipal(); logger.info("Update credentials for user entity {}", user, entity); UserCredentials uc = credentials.getUserCredentials(user); uc.putUsernamePassword(entity, new UsernamePassword(username, password)); credentials.putUserCredentials(user, uc); return new JsonResponse(Status.OK, "", "").build(); }
Source:
public View getView(int index, View view, ViewGroup arg2) { MKOLUpdateElement e = (MKOLUpdateElement) getItem(index); if (currentView == null) { currentView = View.inflate(BaiduMapOfflineMapPreference.this.getContext(), R.layout.list_baidumap_offline_localmap_item, null); } view = currentView; initViewItem(view, e); return view; }

Target:
public View getView(int index, View view, ViewGroup arg2) { MKOLUpdateElement e = (MKOLUpdateElement) getItem(index); if (view == null) { view = View.inflate(BaiduMapOfflineMapPreference.this.getContext(), R.layout.list_baidumap_offline_localmap_item, null); } initViewItem(view, e); return view; }
Source:
private void run() { logger.info("Creating presenter started..."); createPackageHierachyIndex(); createNameTokensPackage(); try { createNametokensClass(); } catch (Exception e) { failedStep = true; e.printStackTrace(); } try { fetchPresenterTemplates(); } catch (Exception e) { e.printStackTrace(); return; } createNameTokensFieldAndMethods(); createPresenterPackage(); createPresenterModule(); createPresenter(); createPresenterUiHandlers(); createPresenterView(); createPresenterViewUi(); createPresenterModuleLinkForGin(); logger.info("...Creating presenter finished."); }

Target:
private void run() { logger.info("Creating presenter started..."); createPackageHierachyIndex(); createNameTokensPackage(); try { createNametokensClass(); } catch (Exception e) { error("Could not create or find the name tokens file 'NameTokens.java': Error: " + e.toString()); failedStep = true; e.printStackTrace(); } try { fetchPresenterTemplates(); } catch (Exception e) { error("Could not fetch the nested presenter templates: Error: " + e.toString()); e.printStackTrace(); return; } createNameTokensFieldAndMethods(); createPresenterPackage(); createPresenterModule(); createPresenter(); createPresenterUiHandlers(); createPresenterView(); createPresenterViewUi(); createPresenterModuleLinkForGin(); logger.info("...Creating presenter finished."); }
Source:
public void close() { if (containerContext != null) { containerContext.close(); if (moduleDeployer != null) { ConfigurableApplicationContext moduleCommon = moduleDeployer.getCommonContext(); if (moduleCommon != null) { moduleCommon.close(); } } } if (adminContext != null) { adminContext.close(); ApplicationContext parent = adminContext.getParent(); if (parent instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) parent).close(); } } }

Target:
public void close() { if (containerContext != null) { containerContext.close(); } if (adminContext != null) { adminContext.close(); ApplicationContext parent = adminContext.getParent(); if (parent instanceof ConfigurableApplicationContext) { ((ConfigurableApplicationContext) parent).close(); } } }
Source:
protected Scope visitUnion(Union node, Optional<Scope> scope) { if (!node.isDistinct().isPresent()) { warningCollector.add(new PrestoWarning(PARSER_WARNING, "UNION specified without ALL or DISTINCT")); } return visitSetOperation(node, scope); }

Target:
protected Scope visitUnion(Union node, Optional<Scope> scope) { if (!node.isDistinct().isPresent()) { warningCollector.add(new PrestoWarning(PARSER_WARNING, "UNION specified without ALL or DISTINCT" + " keyword is equivalent to UNION DISTINCT, which is computationally expensive. " + "Consider using UNION ALL when possible, or specifically add keyword DISTINCT to stop " + "getting this warning")); } return visitSetOperation(node, scope); }
Source:
protected void initVm() { VmHandler.updateDisksFromDb(getVm()); getVm().setKvmEnable(getParameters().getKvmEnable()); getVm().setRunAndPause(getParameters().getRunAndPause() == null ? getVm().isRunAndPause() : getParameters().getRunAndPause()); getVm().setAcpiEnable(getParameters().getAcpiEnable()); getVm().setConsoleUserId(null); getParameters().setRunAsStateless(getParameters().getRunAsStateless() != null ? getParameters().getRunAsStateless() : getVm().isStateless()); getVm().setDisplayType(getParameters().getUseVnc() == null ? getVm().getDefaultDisplayType() : (getParameters().getUseVnc() ? DisplayType.vnc : DisplayType.qxl)); if (getParameters().getVncKeyboardLayout() == null) { getVm().setVncKeyboardLayout(getVm().getDefaultVncKeyboardLayout()); } else { getVm().setVncKeyboardLayout(getParameters().getVncKeyboardLayout()); } if (getParameters().getInitializationType() == null) { if (!getVm().isInitialized()) { getVm().setInitializationType(osRepository.isWindows(getVm().getVmOsId()) ? InitializationType.Sysprep : InitializationType.None); } } else { getVm().setInitializationType(getParameters().getInitializationType()); } if (!StringUtils.isEmpty(getParameters().getFloppyPath())) { getVmStaticDAO().update(getVm().getStaticData()); } getVm().setVdsGroupCpuFlagsData( CpuFlagsManagerHandler.GetVDSVerbDataByCpuName(getVm().getVdsGroupCpuName(), getVm() .getVdsGroupCompatibilityVersion())); }

Target:
protected void initVm() { VmHandler.updateDisksFromDb(getVm()); getVm().setKvmEnable(getParameters().getKvmEnable()); getVm().setRunAndPause(getParameters().getRunAndPause() == null ? getVm().isRunAndPause() : getParameters().getRunAndPause()); getVm().setAcpiEnable(getParameters().getAcpiEnable()); getVm().setConsoleUserId(null); getParameters().setRunAsStateless(getParameters().getRunAsStateless() != null ? getParameters().getRunAsStateless() : getVm().isStateless()); getVm().setDisplayType(getParameters().getUseVnc() == null ? getVm().getDefaultDisplayType() : (getParameters().getUseVnc() ? DisplayType.vnc : DisplayType.qxl)); if (getParameters().getInitializationType() == null) { if (!getVm().isInitialized()) { getVm().setInitializationType(osRepository.isWindows(getVm().getVmOsId()) ? InitializationType.Sysprep : InitializationType.None); } } else { getVm().setInitializationType(getParameters().getInitializationType()); } if (!StringUtils.isEmpty(getParameters().getFloppyPath())) { getVmStaticDAO().update(getVm().getStaticData()); } getVm().setVdsGroupCpuFlagsData( CpuFlagsManagerHandler.GetVDSVerbDataByCpuName(getVm().getVdsGroupCpuName(), getVm() .getVdsGroupCompatibilityVersion())); }
Source:
public void testStartScannerNotExistingContainer() { ServerTemplate serverTemplate = createServerTemplate(); ContainerSpec container = new ContainerSpec("not-existing", "not-existing", serverTemplate, RELEASE_ID, KieContainerStatus.STARTED, null); try { controllerClient.startScanner(container, 1000L); fail("Should throw exception about container not found."); } catch (KieServerControllerClientException e) { assertNotFoundException((T) e); assertEquals("No container spec found for id not-existing", e.getMessage()); } }

Target:
public void testStartScannerNotExistingContainer() { ServerTemplate serverTemplate = createServerTemplate(); ContainerSpec container = new ContainerSpec("not-existing", "not-existing", serverTemplate, RELEASE_ID, KieContainerStatus.STARTED, null); try { controllerClient.startScanner(container, 1000L); fail("Should throw exception about container not found."); } catch (KieServerControllerClientException e) { assertNotFoundException((T) e); assertThat(e.getMessage()).endsWith("No container spec found for id not-existing"); } }
Source:
private static int confirmLfsInstall() { MessageDialog dialog = new MessageDialog(null, UIText.ConfigurationChecker_installLfsTitle, null, UIText.ConfigurationChecker_installLfsMessage, MessageDialog.QUESTION, 0, UIText.ConfigurationChecker_installLfsYes, UIText.ConfigurationChecker_installLfsNo, UIText.ConfigurationChecker_installLfsDontAsk); return dialog.open(); }

Target:
private static int confirmLfsInstall() { MessageDialog dialog = new MessageDialog(null, UIText.ConfigurationChecker_installLfsTitle, null, UIText.ConfigurationChecker_installLfsMessage, MessageDialog.QUESTION, new String[] { UIText.ConfigurationChecker_installLfsYes, UIText.ConfigurationChecker_installLfsNo, UIText.ConfigurationChecker_installLfsDontAsk }, 0); return dialog.open(); }
Source:
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String sessionId = (String) request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (sessionId == null) { throw new ServletException("Engine session missing"); } Current current = new Current(); current.setSessionId(sessionId); current.setApplicationMode(findApplicationMode(sessionId)); current.setUser(findPrincipal(sessionId)); current.setRoot(getRoot(request)); current.setPrefix(getPrefix(request)); current.setPath(getPath(request)); current.setBackend(backend); fromRequest(request, response, current); CurrentManager.put(current); try { chain.doFilter(request, response); } finally { CurrentManager.remove(); } }

Target:
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String sessionId = (String) request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (sessionId == null) { throw new ServletException("Engine session missing"); } Current current = new Current(); current.setSessionId(sessionId); current.setApplicationMode(findApplicationMode(sessionId)); current.setUser(findPrincipal(sessionId)); current.setRoot(getRoot(request)); current.setPrefix(getPrefix(request)); current.setPath(getPath(request)); current.setBackend(backend); String correlationId = getCorrelationId(request); current.getParameters().put(CORRELATION_ID_PARAM, correlationId); response.setHeader(CORRELATION_ID_HEADER, correlationId); CurrentManager.put(current); try { chain.doFilter(request, response); } finally { CurrentManager.remove(); } }
Source:
public void testMethodRefs() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope( TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Llambda/MethodRefs"); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false); Function<String, MethodReference> getTargetRef = (klass) -> { return MethodReference.findOrCreate( TypeReference.findOrCreate( ClassLoaderReference.Application, "Llambda/MethodRefs$" + klass), Atom.findOrCreateUnicodeAtom("target"), Descriptor.findOrCreateUTF8("()V")); }; System.out.println(cg); Assert.assertEquals( "expected C1.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C1")).size()); Assert.assertEquals( "expected C2.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C2")).size()); Assert.assertEquals( "expected C3.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C3")).size()); Assert.assertEquals( "expected C4.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C4")).size()); Assert.assertEquals( "expected C5.target() to *not* be reachable", 0, cg.getNodes(getTargetRef.apply("C5")).size()); }

Target:
public void testMethodRefs() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope( TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Llambda/MethodRefs"); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false); Function<String, MethodReference> getTargetRef = (klass) -> MethodReference.findOrCreate( TypeReference.findOrCreate( ClassLoaderReference.Application, "Llambda/MethodRefs$" + klass), Atom.findOrCreateUnicodeAtom("target"), Descriptor.findOrCreateUTF8("()V")); System.out.println(cg); Assert.assertEquals( "expected C1.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C1")).size()); Assert.assertEquals( "expected C2.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C2")).size()); Assert.assertEquals( "expected C3.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C3")).size()); Assert.assertEquals( "expected C4.target() to be reachable", 1, cg.getNodes(getTargetRef.apply("C4")).size()); Assert.assertEquals( "expected C5.target() to *not* be reachable", 0, cg.getNodes(getTargetRef.apply("C5")).size()); }
Source:
public List<DirectoryEntry> getCurrentPage() { Object[] parameters = getParameters(); if (parameters == null || parameters.length > 1) { throw new IllegalStateException("Invalid Parameters"); } if (!(parameters[0] instanceof Directory)) { throw new IllegalStateException("Provided Parameter is not a Directory"); } Directory directory = (Directory) parameters[0]; try (Session session = directory.getSession()) { return session.query(Collections.emptyMap() , Collections.emptySet() , Collections.emptyMap() , false , Long.valueOf(getPageSize()).intValue() , Long.valueOf(getCurrentPageOffset()).intValue()) .stream() .map((dir) -> new DirectoryEntry(directory.getName(), dir)) .collect(Collectors.toList()); } }

Target:
public List<DirectoryEntry> getCurrentPage() { Object[] parameters = getParameters(); if (parameters == null || parameters.length > 1) { throw new IllegalStateException("Invalid parameters: " + Arrays.toString(parameters)); } if (!(parameters[0] instanceof Directory)) { throw new IllegalStateException("Provided parameter is not a Directory: " + parameters[0]); } Directory directory = (Directory) parameters[0]; try (Session session = directory.getSession()) { return session.query(Collections.emptyMap(), Collections.emptySet(), Collections.emptyMap(), false, (int) getPageSize(), (int) getCurrentPageOffset()) .stream() .map(dir -> new DirectoryEntry(directory.getName(), dir)) .collect(Collectors.toList()); } }
Source:
public TransientState(IStateHistoryBackend backend) { this.fBackend = backend; fIsActive = true; fOngoingStateInfo = new ArrayList<>(); fOngoingStateStartTimes = new ArrayList<>(); fStateValueTypes = new ArrayList<>(); fLatestTime = backend.getStartTime(); }

Target:
public TransientState(IStateHistoryBackend backend) { fBackend = backend; fIsActive = true; fOngoingStateInfo = new ArrayList<>(); fOngoingStateStartTimes = new ArrayList<>(); fStateValueTypes = new ArrayList<>(); fLatestTime = backend.getStartTime(); }
Source:
public void throwsWhenPreprocessingConfigWithKeyspaceAndDifferentNamespace() { assertThatThrownBy( () -> CassandraAtlasDbFactory.preprocessKvsConfig(CONFIG_WITH_KEYSPACE, Optional.of(KEYSPACE))) .isInstanceOf(IllegalArgumentException.class); }

Target:
public void throwsWhenPreprocessingConfigWithKeyspaceAndDifferentNamespace() { assertThatThrownBy( () -> CassandraAtlasDbFactory.preprocessKvsConfig(CONFIG_WITH_KEYSPACE, Optional.of(KEYSPACE_2))) .isInstanceOf(IllegalArgumentException.class); }
Source:
public void select_shoud_return_false_when_notAConnector(){ Task task = ProcessFactory.eINSTANCE.createTask(); assertFalse(onFinishFilter.select(viewer, null, task)); }

Target:
public void select_shoud_return_false_when_notAConnector() { final ConnectorEventFilter onFinishFilter = createConnectorEventFilter(); assertFalse(onFinishFilter.select(viewer, null, aTask().build())); }
Source:
public void shouldReturnAPIExceptionWhenObsIsNull(){ ObsService os = Context.getObsService(); Obs o = os.saveObs(null,"Null Obs"); }

Target:
public void shouldReturnAPIExceptionWhenObsIsNull(){ expectedException.expect(APIException.class); expectedException.expectMessage(Context.getMessageSourceService().getMessage("Obs.error.cannot.be.null")); ObsService os = Context.getObsService(); Obs o = os.saveObs(null,"Null Obs"); }
Source:
public ItineraryFilter build() { List<ItineraryFilter> filters = new ArrayList<>(); filters.add(new LongTransitWalkingFilter()); filters.add(new GroupByFilter<>( "groupBy-legs-filter-on-cost", it -> new GroupByLongestLegsId(it, groupByP), new SortOnGeneralizedCost(groupByTransferCost), minLimit )); if (latestDepartureTimeLimit != null) { filters.add(new LatestDepartureTimeFilter(latestDepartureTimeLimit)); } filters.add(new SortOnWalkingArrivalAndDeparture()); if (maxLimit >= minLimit) { filters.add(new MaxLimitFilter("MAX", maxLimit)); } if(debug) { filters = addDebugWrppers(filters); } return new FilterChain(filters); }

Target:
public ItineraryFilter build() { List<ItineraryFilter> filters = new ArrayList<>(); filters.add(new LongTransitWalkingFilter()); filters.add(new GroupByFilter<>( "groupBy-legs-filter-on-cost", it -> new GroupByLongestLegsId(it, groupByP), new SortOnGeneralizedCost(groupByTransferCost), minLimit )); if (latestDepartureTimeLimit != null) { filters.add(new LatestDepartureTimeFilter(latestDepartureTimeLimit)); } filters.add(new OtpDefaultSortOrder(arriveBy)); if (maxLimit >= minLimit) { filters.add(new MaxLimitFilter("MAX", maxLimit, maxLimitReachedSubscriber)); } if(debug) { filters = addDebugWrappers(filters); } return new FilterChain(filters); }
Source:
private List<ScmFile> getChangedFiles( File gitlog, URI relativeRepoPath ) throws IOException { GitStatusConsumer consumer = new GitStatusConsumer( new DefaultLog(), null, relativeRepoPath ); try ( BufferedReader r = new BufferedReader( new FileReader( gitlog ) ) ) { String line; while ( ( line = r.readLine() ) != null ) { consumer.consumeLine( line ); } } return consumer.getChangedFiles(); }

Target:
private List<ScmFile> getChangedFiles( File gitlog, URI relativeRepoPath ) throws IOException { GitStatusConsumer consumer = new GitStatusConsumer( new DefaultLog(), null, relativeRepoPath ); try ( BufferedReader r = new BufferedReader( new InputStreamReader ( new FileInputStream( gitlog ), StandardCharsets.UTF_8 ) ) ) { String line; while ( ( line = r.readLine() ) != null ) { consumer.consumeLine( line ); } } return consumer.getChangedFiles(); }
Source:
private static Order.Action buildDrugOrderAction(MedicationRequest.MedicationRequestStatus status) { if (status != null) { if (MedicationRequest.MedicationRequestStatus.STOPPED.toCode(). equalsIgnoreCase(status.toCode())) { return Order.Action.DISCONTINUE; } } return Order.Action.NEW; }

Target:
private static Order.Action buildDrugOrderAction(MedicationRequest.MedicationRequestStatus status) { return (status != null && MedicationRequest.MedicationRequestStatus.STOPPED.toCode(). equalsIgnoreCase(status.toCode())) ? Order.Action.DISCONTINUE : Order.Action.NEW; }
Source:
public Map<String, String> getAttributes() { if (attributes == null) { attributes = new HashMap<>(); } return attributes; }

Target:
public Map<String, String> getAttributes() { return attributes; }
Source:
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { Map<Object, Object> newMap = new HashMap<>(4); for (Map.Entry<Object, Object> e : command.getMap().entrySet()) { Object key = e.getKey(); if (cdl.localNodeIsOwner(key)) { entryFactory.wrapEntryForWriting(ctx, key, EntryFactory.Wrap.WRAP_ALL, true, false); newMap.put(key, e.getValue()); } } if (newMap.size() > 0) { PutMapCommand clonedCommand = commandFactory.buildPutMapCommand(newMap, command.getMetadata(), command.getFlagsBitSet()); ctx.forkInvocationSync(clonedCommand); } return ctx.continueInvocation(); }

Target:
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { Map<Object, Object> newMap = new HashMap<>(4); for (Map.Entry<Object, Object> e : command.getMap().entrySet()) { Object key = e.getKey(); if (cdl.localNodeIsOwner(key)) { entryFactory.wrapEntryForWriting(ctx, key, EntryFactory.Wrap.WRAP_ALL, true, false); newMap.put(key, e.getValue()); } } if (newMap.size() > 0) { PutMapCommand clonedCommand = commandFactory.buildPutMapCommand(newMap, command.getMetadata(), command.getFlagsBitSet()); ctx.forkInvocationSync(clonedCommand); } return null; }
Source:
public long writeTo(Write writeChannel) throws IOException { long sizeWritten = 0; ReadableByteChannel readableByteChannel = Channels.newChannel(streamToWrite); sizeWritten = writeChannel.appendFrom(readableByteChannel, sizeToWrite); if(sizeWritten != sizeToWrite) { throw new IOException("Not able to write fully. Expected : " + sizeToWrite + " Actual : " + sizeWritten ); } return sizeWritten; }

Target:
public long writeTo(Write writeChannel) throws IOException { ReadableByteChannel readableByteChannel = Channels.newChannel(streamToWrite); writeChannel.appendFrom(readableByteChannel, sizeToWrite); return sizeToWrite; }
Source:
public void execute(CommandSender sender, String[] args) { if ( args.length == 0 ) { sender.sendMessage( ChatColor.RED + "You must supply a message." ); } else { String message = Joiner.on(' ').join( args ); try { ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) ); } catch ( Exception e ) { if ( sender instanceof ProxiedPlayer ) { sender.sendMessage( new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ). color( ChatColor.RED ).underlined( true ). event( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( e.getMessage() ).color( ChatColor.RED ).create() ) ). create() ); } else { sender.sendMessage(ChatColor.RED + "An error occurred while parsing your message. " + e.getMessage()); } } } }

Target:
public void execute(CommandSender sender, String[] args) { if ( args.length == 0 ) { sender.sendMessage( ChatColor.RED + "You must supply a message." ); } else { String message = Joiner.on(' ').join( args ); try { ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) ); } catch ( Exception e ) { Throwable error = e; while ( error.getCause() != null ) { error = error.getCause(); } if ( sender instanceof ProxiedPlayer ) { sender.sendMessage( new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ). color( ChatColor.RED ).underlined( true ). event( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( error.getMessage() ).color( ChatColor.RED ).create() ) ). create() ); } else { sender.sendMessage(new ComponentBuilder( "An error occurred while parsing your message: " ).color( ChatColor.RED ).append( error.getMessage() ).create() ); } } } }
Source:
public void attachExistingElementWithAttributeValue_elementHasAttribute() { IdElementTemplate template = new IdElementTemplate(); Assert.assertTrue(template.label.hasAttribute("someattrtibute")); Assert.assertNotNull(template.label.getAttribute("someattrtibute")); Assert.assertTrue( template.label.getAttribute("someattrtibute").isEmpty()); Assert.assertFalse(template.label.hasAttribute("property-binding")); Assert.assertFalse(template.label.hasAttribute("propertyBinding")); Assert.assertFalse(template.label.hasAttribute("another-binding")); Assert.assertFalse(template.label.hasAttribute("anotherBinding")); Assert.assertFalse(template.label.hasAttribute("attribute-binding")); Assert.assertFalse(template.label.hasAttribute("attributeBinding")); Assert.assertFalse(template.label.hasAttribute("attribute-binding$")); Assert.assertFalse(template.label.hasAttribute("attributeBinding$")); Assert.assertTrue(template.label.hasAttribute("another-attribute")); Assert.assertEquals("baz", template.label.getAttribute("another-attribute")); }

Target:
public void attachExistingElementWithAttributeValue_elementHasAttribute() { IdElementTemplate template = new IdElementTemplate(); Assert.assertTrue(template.label.hasAttribute("someattribute")); Assert.assertNotNull(template.label.getAttribute("someattribute")); Assert.assertTrue( template.label.getAttribute("someattribute").isEmpty()); Assert.assertFalse(template.label.hasAttribute("property-binding")); Assert.assertFalse(template.label.hasAttribute("propertyBinding")); Assert.assertFalse(template.label.hasAttribute("another-binding")); Assert.assertFalse(template.label.hasAttribute("anotherBinding")); Assert.assertFalse(template.label.hasAttribute("attribute-binding")); Assert.assertFalse(template.label.hasAttribute("attributeBinding")); Assert.assertFalse(template.label.hasAttribute("attribute-binding$")); Assert.assertFalse(template.label.hasAttribute("attributeBinding$")); Assert.assertTrue(template.label.hasAttribute("another-attribute")); Assert.assertEquals("baz", template.label.getAttribute("another-attribute")); }
Source:
public long getLong(int col) { CharSequence table = getStr(0); if (table != null) { TableReader reader = new TableReader(configuration, getStr(0)); if (col == 3) return reader.getMinTimestamp(); else if (col == 4) return reader.getMaxTimestamp(); else if (col == 5) return reader.getVersion(); else return reader.getDataVersion(); } else { return -1; } }

Target:
public long getLong(int col) { if (metadata != null) { if (col == 1) return metadata.getMinTimestamp(); else if (col == 2) return metadata.getMaxTimestamp(); else if (col == 3) return metadata.getRowCount(); else if (col == 7) return metadata.getStructVersion(); else return metadata.getDataVersion(); } else { return -1; } }
Source:
private static void recursiveFindRaoFiles(List<IResource> allRaoFiles, IPath path, IWorkspaceRoot workspaceRoot) { IContainer container = workspaceRoot.getContainerForLocation(path); try { IResource[] iResources; iResources = container.members(); for (IResource iR : iResources) { if ("rao".equalsIgnoreCase(iR.getFileExtension())) allRaoFiles.add(iR); if (iR.getType() == IResource.FOLDER) { IPath tempPath = iR.getLocation(); recursiveFindRaoFiles(allRaoFiles, tempPath, workspaceRoot); } } } catch (CoreException e) { e.printStackTrace(); } }

Target:
private static void recursiveFindRaoFiles(List<IResource> allRaoFiles, IPath path, IWorkspaceRoot workspaceRoot) { IContainer container = workspaceRoot.getContainerForLocation(path); try { IResource[] iResources; iResources = container.members(); for (IResource resource : iResources) { if ("rao".equalsIgnoreCase(resource.getFileExtension())) allRaoFiles.add(resource); if (resource.getType() == IResource.FOLDER) { IPath tempPath = resource.getLocation(); recursiveFindRaoFiles(allRaoFiles, tempPath, workspaceRoot); } } } catch (CoreException e) { e.printStackTrace(); } }