auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetAnnotation() { DocumentModel docToAnnotate = session.createDocumentModel("/", "testDoc", "File"); docToAnnotate = session.createDocument(docToAnnotate); String annotationId = "foo"; String docIdToAnnotate = docToAnnotate.getId(); String xpathToAnnotate = "files:files/0/file"; CoreInstance.doPrivileged(session, adminSession -> { DocumentModel annotationModel = adminSession.createDocumentModel(null, "testName", ANNOTATION_DOC_TYPE); annotationModel.setPropertyValue(ANNOTATION_ID_PROPERTY, annotationId); annotationModel.setPropertyValue(ANNOTATION_XPATH_PROPERTY, xpathToAnnotate); annotationModel.setPropertyValue(ANNOTATION_DOCUMENT_ID_PROPERTY, docIdToAnnotate); adminSession.createDocument(annotationModel); adminSession.save(); }); Annotation annotation = annotationService.getAnnotation(session, annotationId); assertNotNull("Unable to get the annotation", annotation); assertEquals(docIdToAnnotate, annotation.getDocumentId()); }

Target:
public void testGetAnnotation() { DocumentModel docToAnnotate = session.createDocumentModel("/", "testDoc", "File"); docToAnnotate = session.createDocument(docToAnnotate); String annotationId = "foo"; String docIdToAnnotate = docToAnnotate.getId(); String xpathToAnnotate = "files:files/0/file"; createAnnotationAsDocumentModel(annotationId, docIdToAnnotate, xpathToAnnotate); Annotation annotation = annotationService.getAnnotation(session, annotationId); assertNotNull("Unable to get the annotation", annotation); assertEquals(docIdToAnnotate, annotation.getDocumentId()); }
Source:
TryCastResolver(DataType type, String name) { super(FuncParams.builder().withIndependentVarArgs(Param.ANY).build()); this.type = type; this.name = name; }

Target:
TryCastResolver(DataType type, String name) { super(FuncParams.builder(Param.ANY) .withVarArgs(Param.ANY) .limitVarArgOccurrences(1) .build()); this.type = type; this.name = name; }
Source:
public String processBulkSubmit(@RequestBody JSONArray librariesDtos) throws IOException, MalformedLibraryException { try { if (librariesDtos != null && librariesDtos.size() > 0) { List<Long> savedLibraryIds = new ArrayList<>(); for (Object lDto : librariesDtos) { ObjectMapper mapper = new ObjectMapper(); LibraryDto libDto = mapper.readValue(lDto.toString(), LibraryDto.class); Library library = Dtos.to(libDto); library.setSample(sampleService.get(libDto.getParentSampleId())); library.setLibrarySelectionType(libraryService.getLibrarySelectionTypeById(libDto.getLibrarySelectionTypeId())); library.setLibraryStrategyType(libraryService.getLibraryStrategyTypeById(libDto.getLibraryStrategyTypeId())); library.setLibraryType(libraryService.getLibraryTypeById(libDto.getLibraryTypeId())); Long savedId = libraryService.save(library).getId(); savedLibraryIds.add(savedId); } return "redirect:/miso/library/bulk/edit/" + savedLibraryIds.toString(); } else { throw new IOException("There are no libraries to save!"); } } catch (IOException ex) { if (log.isDebugEnabled()) { log.debug("Failed to save library", ex); } throw ex; } }

Target:
public String processBulkSubmit(@RequestBody JSONArray librariesDtos) throws IOException, MalformedLibraryException { try { if (librariesDtos != null && librariesDtos.size() > 0) { List<Long> savedLibraryIds = new ArrayList<>(); for (Object lDto : librariesDtos) { ObjectMapper mapper = new ObjectMapper(); LibraryDto libDto = mapper.readValue(lDto.toString(), LibraryDto.class); Library library = Dtos.to(libDto); Long savedId = libraryService.create(library); savedLibraryIds.add(savedId); } return "redirect:/miso/library/bulk/edit/" + savedLibraryIds.toString(); } else { throw new IOException("There are no libraries to save!"); } } catch (IOException ex) { if (log.isDebugEnabled()) { log.debug("Failed to save library", ex); } throw ex; } }
Source:
public List<@NonNull IDataChartDescriptor<T, ?>> getDataDescriptors() { return fDescriptors; }

Target:
public List<@NonNull IDataChartDescriptor<T, ?>> getDataDescriptors() { return ImmutableList.copyOf(fDescriptors); }
Source:
private SourceFile getSourceFile(String path, String repositoryId, String branch, SourceFile.FileType type) { SourceFile file = new SourceFile(); String url = BITBUCKET_API_URL + "repositories/" + repositoryId + "/raw/" + branch + "/" + path; Optional<String> asString = ResourceUtilities.asString(url, bitbucketTokenContent, client); LOG.info(gitUsername + ": RESOURCE CALL: {}", url); if (asString.isPresent()) { String content = asString.get(); Boolean validWorkflow; if (type == SourceFile.FileType.DOCKSTORE_CWL) { validWorkflow = checkValidCWLWorkflow(content); } else { validWorkflow = checkValidWDLWorkflow(content); } if (validWorkflow) { file.setType(type); file.setContent(content); file.setPath(path); } } return file; }

Target:
private SourceFile getSourceFile(String path, String repositoryId, String branch, SourceFile.FileType type) { SourceFile file = new SourceFile(); String url = BITBUCKET_API_URL + "repositories/" + repositoryId + "/raw/" + branch + "/" + path; Optional<String> asString = ResourceUtilities.asString(url, bitbucketTokenContent, client); LOG.info(gitUsername + ": RESOURCE CALL: {}", url); if (asString.isPresent()) { String content = asString.get(); boolean validWorkflow; if (type == SourceFile.FileType.DOCKSTORE_CWL) { validWorkflow = checkValidCWLWorkflow(content); } else { validWorkflow = checkValidWDLWorkflow(content); } if (validWorkflow) { file.setType(type); file.setContent(content); file.setPath(path); } } return file; }
Source:
void testPolymorphicConfig() { AggregateConfigurer<A> aggregateConfigurer = AggregateConfigurer.defaultConfiguration(A.class); aggregateConfigurer.registerSubtype(B.class); Configuration configuration = DefaultConfigurer.defaultConfiguration() .configureAggregate(aggregateConfigurer) .configureEmbeddedEventStore(c -> new InMemoryEventStorageEngine()) .buildConfiguration(); configuration.start(); CommandGateway commandGateway = configuration.commandGateway(); String aggregateAId = commandGateway.sendAndWait(new CreateACommand("123")); String aggregateBId = commandGateway.sendAndWait(new CreateBCommand("456")); String result1 = commandGateway.sendAndWait(new DoSomethingCommand(aggregateAId)); String result2 = commandGateway.sendAndWait(new DoSomethingCommand(aggregateBId)); String result3 = commandGateway.sendAndWait(new BSpecificCommand(aggregateBId)); assertEquals("A123", result1); assertEquals("B456", result2); assertEquals("bSpecific456", result3); configuration.shutdown(); }

Target:
void testPolymorphicConfig() { AggregateConfigurer<A> aggregateConfigurer = AggregateConfigurer.defaultConfiguration(A.class) .withSubtypes(B.class); Configuration configuration = DefaultConfigurer.defaultConfiguration() .configureAggregate(aggregateConfigurer) .configureEmbeddedEventStore(c -> new InMemoryEventStorageEngine()) .buildConfiguration(); configuration.start(); CommandGateway commandGateway = configuration.commandGateway(); String aggregateAId = commandGateway.sendAndWait(new CreateACommand("123")); String aggregateBId = commandGateway.sendAndWait(new CreateBCommand("456")); String result1 = commandGateway.sendAndWait(new DoSomethingCommand(aggregateAId)); String result2 = commandGateway.sendAndWait(new DoSomethingCommand(aggregateBId)); String result3 = commandGateway.sendAndWait(new BSpecificCommand(aggregateBId)); assertEquals("A123", result1); assertEquals("B456", result2); assertEquals("bSpecific456", result3); configuration.shutdown(); }
Source:
public void afterPropertiesSet() { super.afterPropertiesSet(); proxyObject = ProxyFactory.getProxy(getObjectType(), this); objectMapper = null; if (applicationContext != null && applicationContext.containsBean("objectMapper")) { objectMapper = (ObjectMapper) applicationContext.getBean("objectMapper"); } if (objectMapper == null && applicationContext != null) { try { objectMapper = BeanFactoryUtils.beanOfTypeIncludingAncestors(applicationContext, ObjectMapper.class); } catch (Exception e) { logger.debug(e); } } if (objectMapper == null) { objectMapper = new ObjectMapper(); } try { jsonRpcRestClient = new JsonRpcRestClient(new URL(getServiceUrl()), objectMapper, restTemplate, new HashMap<String, String>()); jsonRpcRestClient.setRequestListener(requestListener); jsonRpcRestClient.setSslContext(sslContext); jsonRpcRestClient.setHostNameVerifier(hostNameVerifier); if (exceptionResolver!=null) { jsonRpcRestClient.setExceptionResolver(exceptionResolver); } } catch (MalformedURLException mue) { throw new RuntimeException(mue); } ReflectionUtil.clearCache(); }

Target:
public void afterPropertiesSet() { super.afterPropertiesSet(); proxyObject = ProxyFactory.getProxy(getObjectType(), this); if (jsonRpcRestClient==null) { if (objectMapper == null && applicationContext != null && applicationContext.containsBean("objectMapper")) { objectMapper = (ObjectMapper) applicationContext.getBean("objectMapper"); } if (objectMapper == null && applicationContext != null) { try { objectMapper = BeanFactoryUtils.beanOfTypeIncludingAncestors(applicationContext, ObjectMapper.class); } catch (Exception e) { logger.debug(e); } } if (objectMapper == null) { objectMapper = new ObjectMapper(); } try { jsonRpcRestClient = new JsonRpcRestClient(new URL(getServiceUrl()), objectMapper, restTemplate, new HashMap<String, String>()); jsonRpcRestClient.setRequestListener(requestListener); jsonRpcRestClient.setSslContext(sslContext); jsonRpcRestClient.setHostNameVerifier(hostNameVerifier); if (exceptionResolver!=null) { jsonRpcRestClient.setExceptionResolver(exceptionResolver); } } catch (MalformedURLException mue) { throw new RuntimeException(mue); } } ReflectionUtil.clearCache(); }
Source:
public AppearanceTabViewModel(DialogService dialogService, JabRefPreferences preferences) { this.dialogService = dialogService; this.preferences = preferences; fontSizeValidator = new FunctionBasedValidator<>( fontSizeProperty, input -> { try { int fontSize = Integer.parseInt(fontSizeProperty().getValue()); return (fontSize > 8) && (fontSize < 22); } catch (NumberFormatException ex) { return false; } }, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Appearance"), Localization.lang("Font settings"), Localization.lang("You must enter an integer value in the interval 8-22.")))); }

Target:
public AppearanceTabViewModel(DialogService dialogService, JabRefPreferences preferences) { this.dialogService = dialogService; this.preferences = preferences; fontSizeValidator = new FunctionBasedValidator<>( fontSizeProperty, input -> { try { return Integer.parseInt(fontSizeProperty().getValue()) > 8; } catch (NumberFormatException ex) { return false; } }, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Appearance"), Localization.lang("Font settings"), Localization.lang("You must enter an integer value higher than 8.")))); }
Source:
private synchronized List<Role> getSpecialRolesHierarchy() throws DotDataException { if (specialRolesHierarchy == null) { final Role anyWhoCanEditPermisionsContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_PERMISSIONS_ROLE_KEY); final Role anyWhoCanPublishContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_PUBLISH_ROLE_KEY); final Role anyWhoCanEditContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_ROLE_KEY); final Role anyWhoCanViewContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_VIEW_ROLE_KEY); specialRolesHierarchy = ImmutableList .of(anyWhoCanEditPermisionsContent, anyWhoCanPublishContent, anyWhoCanEditContent, anyWhoCanViewContent); } return specialRolesHierarchy; }

Target:
private List<Role> getSpecialRolesHierarchy() throws DotDataException { if (specialRolesHierarchy == null) { synchronized (this) { if (specialRolesHierarchy == null) { final Role anyWhoCanEditPermisionsContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_PERMISSIONS_ROLE_KEY); final Role anyWhoCanPublishContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_PUBLISH_ROLE_KEY); final Role anyWhoCanEditContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_ROLE_KEY); final Role anyWhoCanViewContent = roleAPI .loadRoleByKey(RoleAPI.WORKFLOW_ANY_WHO_CAN_VIEW_ROLE_KEY); specialRolesHierarchy = ImmutableList .of(anyWhoCanEditPermisionsContent, anyWhoCanPublishContent, anyWhoCanEditContent, anyWhoCanViewContent); } } } return specialRolesHierarchy; }
Source:
protected void buildCommonRecordAttributes(Job item, Record record) { record.setAttribute(ID_ATTR.getName(), item.getId()); long duration = -1; record.setAttribute(STATE_ATTR.getName(), item.getStatus().toString()); record.setAttribute(ISSUES_ATTR.getName(), buildIssuesAttr(item)); record.setAttribute(USER_ATTR.getName(), item.getUser()); record.setAttribute(PRIORITY_ATTR.getName(), item.getPriority().toString()); record.setAttribute(NAME_ATTR.getName(), item.getName()); if (item.getStatus() != JobStatus.IN_ERROR) { if (item.getFinishTime() > 0 && item.getStartTime() > 0) { duration = item.getFinishTime() - item.getStartTime(); } } else { duration = item.getInErrorTime() - item.getStartTime(); } record.setAttribute(DURATION_ATTR.getName(), duration); for (GridColumns extraColumn : EXTRA_COLUMNS) { String columnName = extraColumn.getName(); if (columnName.startsWith(GENERIC_INFORMATION_MATCHER)) { String key = columnName.replace(GENERIC_INFORMATION_MATCHER, ""); record.setAttribute(columnName, item.getGenericInformation().get(key)); } } }

Target:
protected void buildCommonRecordAttributes(Job item, Record record) { record.setAttribute(ID_ATTR.getName(), item.getId()); long duration = -1; record.setAttribute(STATE_ATTR.getName(), item.getStatus().toString()); record.setAttribute(ISSUES_ATTR.getName(), buildIssuesAttr(item)); record.setAttribute(USER_ATTR.getName(), item.getUser()); record.setAttribute(PRIORITY_ATTR.getName(), item.getPriority().toString()); record.setAttribute(NAME_ATTR.getName(), item.getName()); if (item.getStatus() != JobStatus.IN_ERROR) { if (item.getFinishTime() > 0 && item.getStartTime() > 0) { duration = item.getFinishTime() - item.getStartTime(); } } else { duration = item.getInErrorTime() - item.getStartTime(); } record.setAttribute(DURATION_ATTR.getName(), duration); for (GridColumns extraColumn : EXTRA_COLUMNS) { String columnName = extraColumn.getName(); String key = JobColumnsUtil.getGenericInformationKey(columnName); if (key != null) { record.setAttribute(columnName, item.getGenericInformation().get(key)); } } }
Source:
public void testRemoveColumnMetaFromColumnsForAddDomainSpecifColumns() { TaskListViewImpl taskListView = view; GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", taskListView.getInitColumns(), taskListView.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Extra",-1,"")); Set<String> set = new HashSet<String>(); set.add("Extra"); taskListView.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().size()).isEqualTo(16); taskListView.addDomainSpecifColumns(extendedPagedTable, set); assertThat(set.size()).isEqualTo(0); }

Target:
public void testRemoveColumnMetaFromColumnsForAddDomainSpecifColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Extra",-1,"")); Set<String> set = Sets.newHashSet("Extra"); view.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().size()).isEqualTo(16); view.addDomainSpecifColumns(extendedPagedTable, set); assertThat(set.size()).isEqualTo(0); }
Source:
public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { Socket socket = null; try { socket = pool.borrowObject(address); PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), UTF_8), true); List<String> typeNames = this.getTypeNames(); for (Result result : results) { log.debug("Query result: {}", result); Map<String, Object> resultValues = result.getValues(); if (resultValues != null) { for (Entry<String, Object> values : resultValues.entrySet()) { Object value = values.getValue(); if (NumberUtils.isNumeric(value)) { String line = KeyUtils.getKeyString(server, query, result, values, typeNames, rootPrefix) .replaceAll("[()]", "_") + " " + value.toString() + " " + result.getEpoch() / 1000 + "\n"; log.debug("Graphite Message: {}", line); writer.write(line); writer.flush(); if (writer.checkError()) { log.error("Error writing to Graphite, clearing Graphite socket pool"); pool.returnObject(address, socket); pool.clear(); } } else { log.warn("Unable to submit non-numeric value to Graphite: from result [{}]", value, result); } } } } } finally { pool.returnObject(address, socket); } }

Target:
public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { Socket socket = null; PrintWriter writer = null; try { socket = pool.borrowObject(address); writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), UTF_8), true); List<String> typeNames = this.getTypeNames(); for (Result result : results) { log.debug("Query result: {}", result); Map<String, Object> resultValues = result.getValues(); if (resultValues != null) { for (Entry<String, Object> values : resultValues.entrySet()) { Object value = values.getValue(); if (NumberUtils.isNumeric(value)) { String line = KeyUtils.getKeyString(server, query, result, values, typeNames, rootPrefix) .replaceAll("[()]", "_") + " " + value.toString() + " " + result.getEpoch() / 1000 + "\n"; log.debug("Graphite Message: {}", line); writer.write(line); writer.flush(); } else { log.warn("Unable to submit non-numeric value to Graphite: from result [{}]", value, result); } } } } } finally { if (writer != null && writer.checkError()) { log.error("Error writing to Graphite, clearing Graphite socket pool"); pool.invalidateObject(address, socket); } else { pool.returnObject(address, socket); } } }
Source:
public void shutdownBlobStore(PartitionId id){ DiskManager diskManager = partitionToDiskManager.get(id); if(diskManager != null){ diskManager.shutdownBlobStore(id); } }

Target:
public boolean shutdownBlobStore(PartitionId id) { DiskManager diskManager = partitionToDiskManager.get(id); return diskManager != null && diskManager.shutdownBlobStore(id); }
Source:
public void updateImpl(List<Metric> metrics) { Preconditions.checkNotNull(metrics); List<Metric> batch = new ArrayList<Metric>(batchSize); int batchCount = 1; while (metrics.size() > 0) { Metric m = metrics.remove(0); if (m.hasNumberValue()) { batch.add(m); if (batchCount++ % batchSize == 0) { try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (Exception e) { log.error("Error while submitting data for metrics : " + Arrays.toString(batch.toArray()), e); } batch.clear(); } } } if (!batch.isEmpty()) { try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (Exception e) { log.error("Error while submitting data for metrics : " + Arrays.toString(batch.toArray()), e); } } }

Target:
public void updateImpl(List<Metric> metrics) { Preconditions.checkNotNull(metrics); List<Metric> batch = new ArrayList<Metric>(batchSize); int batchCount = 1; while (metrics.size() > 0) { Metric m = metrics.remove(0); if (m.hasNumberValue()) { batch.add(m); if (batchCount++ % batchSize == 0) { try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (Exception e) { log.error("Error while submitting data for metrics : " + batch, e); } batch.clear(); } } } if (!batch.isEmpty()) { try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (Exception e) { log.error("Error while submitting data for metrics : " + batch, e); } } }
Source:
public void close(final long timeoutMs) throws InterruptedException, TimeoutException, ExecutionException { }

Target:
public void close(final long timeoutMs) throws InterruptedException, TimeoutException, ExecutionException { throw new NotImplementedException(); }
Source:
public HypervisorUpdateJob(OwnerCurator ownerCurator, ConsumerCurator consumerCurator, ConsumerTypeCurator consumerTypeCurator, ConsumerResource consumerResource, I18n i18n, SubscriptionServiceAdapter subAdapter, ComplianceRules complianceRules) { this.ownerCurator = ownerCurator; this.consumerCurator = consumerCurator; this.consumerTypeCurator = consumerTypeCurator; this.consumerResource = consumerResource; this.i18n = i18n; this.subAdapter = subAdapter; this.complianceRules = complianceRules; this.hypervisorType = consumerTypeCurator.lookupByLabel(ConsumerTypeEnum.HYPERVISOR.getLabel()); }

Target:
public HypervisorUpdateJob(OwnerCurator ownerCurator, ConsumerCurator consumerCurator, ConsumerTypeCurator consumerTypeCurator, ConsumerResource consumerResource, I18n i18n, SubscriptionServiceAdapter subAdapter, ComplianceRules complianceRules) { this.ownerCurator = ownerCurator; this.consumerCurator = consumerCurator; this.consumerResource = consumerResource; this.i18n = i18n; this.subAdapter = subAdapter; this.complianceRules = complianceRules; this.hypervisorType = consumerTypeCurator.lookupByLabel(ConsumerTypeEnum.HYPERVISOR.getLabel()); if (this.hypervisorType == null) { this.hypervisorType = consumerTypeCurator.create(new ConsumerType(ConsumerTypeEnum.HYPERVISOR)); } }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { AbstractBasePattern pattern = this.pattern; if (pattern == null) { if (!getPatternExpression().evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { logger.debug("LIKE is FALSE: pattern is null"); } return false; } String value = (String) PVarchar.INSTANCE.toObject(ptr, getPatternExpression().getSortOrder()); pattern = compilePattern(value); if (logger.isDebugEnabled()) { logger.debug("LIKE pattern is expression: " + pattern.pattern()); } } if (!getStrExpression().evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { logger.debug("LIKE is FALSE: child expression is null"); } return false; } if (ptr.getLength() == 0) { return true; } String value = null; if (logger.isDebugEnabled()) { value = (String) PVarchar.INSTANCE.toObject(ptr, getStrExpression().getSortOrder()); } boolean matched = pattern.macher(ptr, getStrExpression().getSortOrder()).matches(); ptr.set(matched ? PDataType.TRUE_BYTES : PDataType.FALSE_BYTES); if (logger.isDebugEnabled()) { logger.debug("LIKE(value='" + value + "'pattern='" + pattern.pattern() + "' is " + matched); } return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { AbstractBasePattern pattern = this.pattern; if (pattern == null) { if (!getPatternExpression().evaluate(tuple, ptr)) { if (logger.isTraceEnabled()) { logger.trace("LIKE is FALSE: pattern is null"); } return false; } String value = (String) PVarchar.INSTANCE.toObject(ptr, getPatternExpression().getSortOrder()); pattern = compilePattern(value); if (logger.isTraceEnabled()) { logger.trace("LIKE pattern is expression: " + pattern.pattern()); } } Expression strExpression = getStrExpression(); SortOrder strSortOrder = strExpression.getSortOrder(); PVarchar strDataType = PVarchar.INSTANCE; if (!strExpression.evaluate(tuple, ptr)) { if (logger.isTraceEnabled()) { logger.trace("LIKE is FALSE: child expression is null"); } return false; } String value = null; if (logger.isTraceEnabled()) { value = (String) strDataType.toObject(ptr, strSortOrder); } strDataType.coerceBytes(ptr, strDataType, strSortOrder, SortOrder.ASC); pattern.matches(ptr, ptr); if (logger.isTraceEnabled()) { boolean matched = ((Boolean) PBoolean.INSTANCE.toObject(ptr)).booleanValue(); logger.trace("LIKE(value='" + value + "'pattern='" + pattern.pattern() + "' is " + matched); } return true; }
Source:
public void shouldCreateVisitWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); DateTime startDateTime = new DateTime("2010-01-10T07:22:05Z"); DateTime endDateTime = new DateTime("2012-08-01T07:22:05Z"); Visit visit = new Visit(startDateTime.toDate(), endDateTime.toDate(), patient, new VisitType("testVisitType"), location); doReturn(patient).when(patientService).getPatientByUuid(eq(CONFIG_NAME), eq(patient.getUuid())); doReturn(Collections.singletonList(location)) .when(locationService).getLocations(eq(CONFIG_NAME), eq(location.getName())); openMRSActionProxyService.createVisit(CONFIG_NAME, patient.getUuid(), new DateTime(visit.getStartDatetime()), new DateTime(visit.getEndDatetime()), visit.getVisitType().getDisplay(), location.getName()); verify(visitService).createVisit(eq(CONFIG_NAME), visitCaptor.capture()); assertEquals(visit, visitCaptor.getValue()); }

Target:
public void shouldCreateVisitWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); DateTime startDateTime = new DateTime("2010-01-10T07:22:05Z"); DateTime endDateTime = new DateTime("2012-08-01T07:22:05Z"); Visit visit = new Visit(startDateTime.toDate(), endDateTime.toDate(), patient, new VisitType("ee1b6117-e40b-4082-8880-96aca7ea1472"), location); doReturn(patient).when(patientService).getPatientByUuid(eq(CONFIG_NAME), eq(patient.getUuid())); doReturn(Collections.singletonList(location)) .when(locationService).getLocations(eq(CONFIG_NAME), eq(location.getName())); openMRSActionProxyService.createVisit(CONFIG_NAME, patient.getUuid(), new DateTime(visit.getStartDatetime()), new DateTime(visit.getStopDatetime()), visit.getVisitType().getUuid(), location.getName()); verify(visitService).createVisit(eq(CONFIG_NAME), visitCaptor.capture()); assertEquals(visit, visitCaptor.getValue()); }
Source:
private boolean isArrayElement(ExpressionTree expression) { if (expression.is(Tree.Kind.BRACKET_MEMBER_EXPRESSION)) { BracketMemberExpressionTree bracketExpr = ((BracketMemberExpressionTree) expression); if (bracketExpr.object() instanceof IdentifierTree && ((IdentifierTreeImpl) bracketExpr.object()).hasType(Type.Kind.ARRAY)) { return true; } return ((BracketMemberExpressionTree) expression).property().is(Tree.Kind.NUMERIC_LITERAL); } return false; }

Target:
private boolean isArrayElement(ExpressionTree expression) { if (expression.is(Tree.Kind.BRACKET_MEMBER_EXPRESSION)) { BracketMemberExpressionTree bracketExpr = ((BracketMemberExpressionTree) expression); return canOnlyBeArray(bracketExpr.object()); } return false; }
Source:
public String retrieveUnProcessButton_action() { errorMessages.setText(""); if (!isDateSearchCriteriaValid()) { LOG.error("Error Message: " + errors); errorMessages.setText(errors); return null; } String startCreationTime = (String) startCreationDate.getText(); String stopCreationTime = (String) stopCreationDate.getText(); String statusValue = (String) status.getValue(); Date startDate = getDate(startCreationTime); Date stopDate = getDate(stopCreationTime); if (startDate == null || stopDate == null) { return null; } DeferredQueueManagerFacade deferredQueueManagerFacade = new DeferredQueueManagerFacade(); List<AsyncMsgRecord> unProcessQueueResults; if (StringUtils.isNotBlank(startCreationTime) && StringUtils.isNotBlank(stopCreationTime) && StringUtils. isNotBlank(statusValue)) { unProcessQueueResults = deferredQueueManagerFacade.queryForDeferredQueueSelected(); } else { unProcessQueueResults = deferredQueueManagerFacade.queryBySearchCriteria(startDate, stopDate, statusValue); } if (unProcessQueueResults == null || unProcessQueueResults.isEmpty()) { errorMessages.setText("No records found to process."); } UserSession userSession = (UserSession) getBean("UserSession"); userSession.setUnProcessQueueResults(null); userSession.getUnProcessQueueResults().addAll(unProcessQueueResults); return null; }

Target:
public String retrieveUnProcessButton_action() { errorMessages.setText(""); if (!isDateSearchCriteriaValid()) { LOG.error("Error Message: " + errors); errorMessages.setText(errors); return null; } String startCreationTime = (String) startCreationDate.getText(); String stopCreationTime = (String) stopCreationDate.getText(); String statusValue = (String) status.getValue(); Date startDate = getDate(startCreationTime); Date stopDate = getDate(stopCreationTime); if (startDate == null || stopDate == null) { return null; } DeferredQueueManagerFacade deferredQueueManagerFacade = new DeferredQueueManagerFacade(); List<AsyncMsgRecord> unProcessQueueResults; if (StringUtils.isBlank(startCreationTime) && StringUtils.isBlank(stopCreationTime) && StringUtils. isBlank(statusValue)) { unProcessQueueResults = deferredQueueManagerFacade.queryForDeferredQueueSelected(); } else { unProcessQueueResults = deferredQueueManagerFacade.queryBySearchCriteria(startDate, stopDate, statusValue); } if (unProcessQueueResults == null || unProcessQueueResults.isEmpty()) { errorMessages.setText("No records found to process."); } UserSession userSession = (UserSession) getBean("UserSession"); userSession.setUnProcessQueueResults(null); userSession.getUnProcessQueueResults().addAll(unProcessQueueResults); return null; }
Source:
protected Notification newActivityNotification(Context context, HostBean host) { NotificationCompat.Builder notification = newNotificationBuilder(context); Resources res = context.getResources(); String contentText = res.getString( R.string.notification_text, host.getNickname()); Intent notificationIntent = new Intent(context, ConsoleActivity.class); notificationIntent.setAction("android.intent.action.VIEW"); notificationIntent.setData(host.getUri()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); notification.setContentTitle(res.getString(R.string.app_name)) .setContentText(contentText) .setContentIntent(contentIntent); notification.setAutoCancel(true); int ledOnMS = 300; int ledOffMS = 1000; notification.setDefaults(Notification.DEFAULT_LIGHTS); if (HostDatabase.COLOR_RED.equals(host.getColor())) notification.setLights(Color.RED, ledOnMS, ledOffMS); else if (HostDatabase.COLOR_GREEN.equals(host.getColor())) notification.setLights(Color.GREEN, ledOnMS, ledOffMS); else if (HostDatabase.COLOR_BLUE.equals(host.getColor())) notification.setLights(Color.BLUE, ledOnMS, ledOffMS); else notification.setLights(Color.WHITE, ledOnMS, ledOffMS); return notification.build(); }

Target:
protected Notification newActivityNotification(Context context, HostBean host) { NotificationCompat.Builder builder = newNotificationBuilder(context); Resources res = context.getResources(); String contentText = res.getString( R.string.notification_text, host.getNickname()); Intent notificationIntent = new Intent(context, ConsoleActivity.class); notificationIntent.setAction("android.intent.action.VIEW"); notificationIntent.setData(host.getUri()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); builder.setContentTitle(res.getString(R.string.app_name)) .setContentText(contentText) .setContentIntent(contentIntent); builder.setAutoCancel(true); int ledOnMS = 300; int ledOffMS = 1000; builder.setDefaults(Notification.DEFAULT_LIGHTS); if (HostDatabase.COLOR_RED.equals(host.getColor())) builder.setLights(Color.RED, ledOnMS, ledOffMS); else if (HostDatabase.COLOR_GREEN.equals(host.getColor())) builder.setLights(Color.GREEN, ledOnMS, ledOffMS); else if (HostDatabase.COLOR_BLUE.equals(host.getColor())) builder.setLights(Color.BLUE, ledOnMS, ledOffMS); else builder.setLights(Color.WHITE, ledOnMS, ledOffMS); return builder.build(); }
Source:
private void addAttributesToEntityType(IApsEntity entityType, KieProcessFormQueryResult form) { logger.debug("AddAttributesToEntityType"); if (null != form && null != form.getFields()) { if (form.getFields().size() > 0) { try { if (form.getFields().get(0).getName().contains("_")) { this.processForm(form.getFields().get(0), this.getCurrentLang().getCode()); } else { String formName = null; if (KieApiUtil.getFieldProperty(form.getProperties(), "name").contains(".")) { formName = KieApiUtil.getFieldProperty(form.getProperties(), "name") .substring(0, KieApiUtil.getFieldProperty(form.getProperties(), "name").indexOf(".")); } else { formName = KieApiUtil.getFieldProperty(form.getProperties(), "name"); } String formLabel = KieApiUtil.getI18nFormLabelProperty(formName); if (null == this.getI18nManager().getLabel(formLabel, this.getCurrentLang().getCode())) { this.saveEntandoLabel(formLabel, formName); } } } catch (ApsSystemException ex) { logger.error("error on addAttributesToEntityType {}", ex); } } for (KieProcessFormField field : form.getFields()) { logger.debug("addAttributeToEntityType {}", field.getName()); this.addAttributeToEntityType(entityType, field); } if (null != form.getNestedForms()) { for (KieProcessFormQueryResult subForm : form.getNestedForms()) { logger.debug("addAttributeToEntityType getNestedForms"); this.addAttributesToEntityType(entityType, subForm); } } } }

Target:
private void addAttributesToEntityType(IApsEntity entityType, KieProcessFormQueryResult form) { if (null != form && null != form.getFields()) { if (form.getFields().size() > 0) { try { if (form.getFields().get(0).getName().contains("_")) { this.processForm(form.getFields().get(0), this.getCurrentLang().getCode()); } else { String formName = null; if (KieApiUtil.getFieldProperty(form.getProperties(), "name").contains(".")) { formName = KieApiUtil.getFieldProperty(form.getProperties(), "name") .substring(0, KieApiUtil.getFieldProperty(form.getProperties(), "name").indexOf(".")); } else { formName = KieApiUtil.getFieldProperty(form.getProperties(), "name"); } String formLabel = KieApiUtil.getI18nFormLabelProperty(formName); if (null == this.getI18nManager().getLabel(formLabel, this.getCurrentLang().getCode())) { this.saveEntandoLabel(formLabel, formName); } } } catch (ApsSystemException ex) { logger.error("error on addAttributesToEntityType {}", ex); } } for (KieProcessFormField field : form.getFields()) { this.addAttributeToEntityType(entityType, field); } if (null != form.getNestedForms()) { for (KieProcessFormQueryResult subForm : form.getNestedForms()) { logger.debug("addAttributeToEntityType for nested forms"); this.addAttributesToEntityType(entityType, subForm); } } } }
Source:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.history_details, menu); }

Target:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.history_detail, menu); }
Source:
public void onPartitionStateChangeToLeaderFromStandby(String partitionName) { logger.debug("Partition state change notification from Standby to Leader received for partition {}", partitionName); synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Could not add replication for paritition {}", partitionName); } } }

Target:
public void onPartitionStateChangeToLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Exception while adding replication for partition {}", rex, partitionName); replicationMetrics.addCloudPartitionErrorCount.inc(); } } }
Source:
public long abort() throws UnknownHttpResponseException { return parseLong(_run("abort", new JSONObject())); }

Target:
public void abort() throws UnknownHttpResponseException { _run("abort", new JSONObject()); }
Source:
protected ProjectState(final AnonymousUser anonymousUser, final ProjectCache projectCache, @WildProjectName final Project.NameKey wildProject, final ProjectControl.AssistedFactory projectControlFactory, final PrologEnvironment.Factory envFactory, final GitRepositoryManager gitMgr, @Assisted final ProjectConfig config, final RulesCache rulesCache) { this.anonymousUser = anonymousUser; this.projectCache = projectCache; this.wildProject = wildProject; this.projectControlFactory = projectControlFactory; this.envFactory = envFactory; this.gitMgr = gitMgr; this.config = config; this.lastCheckTime = System.currentTimeMillis(); this.ruleLoader = rulesCache.getClassLoader(config.getRulesId()); HashSet<AccountGroup.UUID> groups = new HashSet<AccountGroup.UUID>(); AccessSection all = config.getAccessSection(AccessSection.ALL); if (all != null) { Permission owner = all.getPermission(Permission.OWNER); if (owner != null) { for (PermissionRule rule : owner.getRules()) { GroupReference ref = rule.getGroup(); if (ref.getUUID() != null) { groups.add(ref.getUUID()); } } } } localOwners = Collections.unmodifiableSet(groups); }

Target:
protected ProjectState(final AnonymousUser anonymousUser, final ProjectCache projectCache, @WildProjectName final Project.NameKey wildProject, final ProjectControl.AssistedFactory projectControlFactory, final PrologEnvironment.Factory envFactory, final GitRepositoryManager gitMgr, @Assisted final ProjectConfig config, final RulesCache rulesCache) { this.anonymousUser = anonymousUser; this.projectCache = projectCache; this.wildProject = wildProject; this.projectControlFactory = projectControlFactory; this.envFactory = envFactory; this.gitMgr = gitMgr; this.config = config; this.lastCheckTime = System.currentTimeMillis(); if (rulesCache != null) { ruleLoader = rulesCache.getClassLoader(config.getRulesId()); } else { ruleLoader = null; } HashSet<AccountGroup.UUID> groups = new HashSet<AccountGroup.UUID>(); AccessSection all = config.getAccessSection(AccessSection.ALL); if (all != null) { Permission owner = all.getPermission(Permission.OWNER); if (owner != null) { for (PermissionRule rule : owner.getRules()) { GroupReference ref = rule.getGroup(); if (ref.getUUID() != null) { groups.add(ref.getUUID()); } } } } localOwners = Collections.unmodifiableSet(groups); }
Source:
public BasicAuthDBConfig( final PasswordProvider initialAdminPassword, final PasswordProvider initialInternalClientPassword, final String initialAdminUser, final String initialAdminRole, final String initialAdminGroupMapping, final boolean enableCacheNotifications, final long cacheNotificationTimeout, final int credentialIterations ) { this.initialAdminPassword = initialAdminPassword; this.initialInternalClientPassword = initialInternalClientPassword; this.initialAdminUser = initialAdminUser; this.initialAdminRole = initialAdminRole; this.initialAdminGroupMapping = initialAdminGroupMapping; this.enableCacheNotifications = enableCacheNotifications; this.cacheNotificationTimeout = cacheNotificationTimeout; this.iterations = credentialIterations; }

Target:
public BasicAuthDBConfig( final PasswordProvider initialAdminPassword, final PasswordProvider initialInternalClientPassword, final String initialAdminUser, final String initialAdminRole, final String initialAdminGroupMapping, final boolean enableCacheNotifications, final long cacheNotificationTimeout, final int credentialIterations ) { this.initialAdminPassword = initialAdminPassword; this.initialInternalClientPassword = initialInternalClientPassword; this.initialAdminUser = initialAdminUser; this.initialAdminRole = initialAdminRole; this.initialAdminGroupMapping = initialAdminGroupMapping; this.enableCacheNotifications = enableCacheNotifications; this.cacheNotificationTimeout = cacheNotificationTimeout; this.credentialIterations = credentialIterations; }
Source:
public FastCubeBlockAccess(ICubeCache cache, Cube cube, int radius) { int n = radius*2 + 1; this.world = cube.getCubicWorld(); this.cache = new Cube[n][n][n]; this.originX = cube.getX() - radius; this.originY = cube.getY() - radius; this.originZ = cube.getZ() - radius; for (int relativeCubeX = -radius; relativeCubeX <= radius; relativeCubeX++) { for (int relativeCubeZ = -radius; relativeCubeZ <= radius; relativeCubeZ++) { Column column = cache.provideChunk( originX + relativeCubeX + radius, originZ + relativeCubeZ + radius); for (int relativeCubeY = -radius; relativeCubeY <= radius; relativeCubeY++) { this.cache[relativeCubeX + radius][relativeCubeY + radius][relativeCubeZ + radius] = column.getCube(originY + relativeCubeY + radius); } } } }

Target:
public FastCubeBlockAccess(ICubeCache cache, Cube cube, int radius) { int n = radius*2 + 1; this.world = cube.getWorld(); this.cache = new Cube[n][n][n]; this.originX = cube.getX() - radius; this.originY = cube.getY() - radius; this.originZ = cube.getZ() - radius; for (int relativeCubeX = -radius; relativeCubeX <= radius; relativeCubeX++) { for (int relativeCubeZ = -radius; relativeCubeZ <= radius; relativeCubeZ++) { for (int relativeCubeY = -radius; relativeCubeY <= radius; relativeCubeY++) { this.cache[relativeCubeX + radius][relativeCubeY + radius][relativeCubeZ + radius] = cache.getLoadedCube(originX + relativeCubeX + radius, originY + relativeCubeY + radius, originZ + relativeCubeZ + radius); } } } }
Source:
public boolean checkEndpoint(String hostname, String service) { if (service.equals("SRMv2")) { service = "SRM"; } for (EndpointItem item : list) { if (item.hostname.equals(hostname) && item.service.equals(service)) { return true; } } return false; }

Target:
public boolean checkEndpoint(String hostname, String service) { for (EndpointItem item : fList) { if (item.hostname.equals(hostname) && item.service.equals(service)) { return true; } } return false; }
Source:
public void testSegmentMemoriesResetWithNotNodeInTheMiddle() { String drl = "import " + FactA.class.getCanonicalName() + ";\n" + "import " + FactB.class.getCanonicalName() + ";\n" + "import " + FactC.class.getCanonicalName() + ";\n" + "rule R1\n" + "when\n" + " $factA : FactA( field1 == \"code1\")\n" + " not FactC( f2 == 1 && f1 == \"code1\")\n" + " $factB : FactB( f2 == 1 )\n" + "then\n" + "end\n" + "rule R2\n" + "when\n" + " $factA : FactA( field1 == \"code1\")\n" + " not FactC( f2 == 1 && f1 == \"code1\")\n" + " $factB : FactB( f2 == 3 )\n" + "then\n" + "end\n" + "rule R3\n" + "when\n" + " $factA: FactA( field1 == \"code1\")\n" + " $factC: FactC( f1 == \"code1\")\n" + "then\n" + "end"; KieContainer kcontainer = new KieHelper().addContent( drl, ResourceType.DRL ).getKieContainer(); KieSessionsPool pool = kcontainer.newKieSessionsPool( 1 ); KieSession ksession = pool.newKieSession(); createFactAndInsert(ksession); assertEquals(1, ksession.fireAllRules()); ksession.dispose(); ksession = pool.newKieSession(); createFactAndInsert(ksession); assertEquals(1, ksession.fireAllRules()); ksession.dispose(); pool.shutdown(); }

Target:
public void testSegmentMemoriesResetWithNotNodeInTheMiddle() { String drl = "import " + FactA.class.getCanonicalName() + ";\n" + "import " + FactB.class.getCanonicalName() + ";\n" + "import " + FactC.class.getCanonicalName() + ";\n" + "rule R1\n" + "when\n" + " $factA : FactA( field1 == \"code1\")\n" + " not FactC( f2 == 1 && f1 == \"code1\")\n" + " $factB : FactB( f2 == 1 )\n" + "then\n" + "end\n" + "rule R2\n" + "when\n" + " $factA : FactA( field1 == \"code1\")\n" + " not FactC( f2 == 1 && f1 == \"code1\")\n" + " $factB : FactB( f2 == 3 )\n" + "then\n" + "end\n" + "rule R3\n" + "when\n" + " $factA: FactA( field1 == \"code1\")\n" + " $factC: FactC( f1 == \"code1\")\n" + "then\n" + "end"; KieContainer kcontainer = new KieHelper().addContent( drl, ResourceType.DRL ).getKieContainer(); KieSessionsPool pool = kcontainer.newKieSessionsPool( 1 ); KieSession ksession = pool.newKieSession(); try { createFactAndInsert(ksession); assertEquals(1, ksession.fireAllRules()); } finally { ksession.dispose(); } ksession = pool.newKieSession(); try { createFactAndInsert(ksession); assertEquals(1, ksession.fireAllRules()); } finally { ksession.dispose(); } pool.shutdown(); }
Source:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, blobId, clusterMap, responseHandler, futureResult, callback, new DeleteRequestRegistrationCallbackImpl(), time); deleteOperations.add(deleteOperation); } catch (RouterException e) { NonBlockingRouter.completeOperation(futureResult, callback, null, e); } }

Target:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, responseHandler, blobId, futureResult, callback, time); deleteOperations.add(deleteOperation); } catch (RouterException e) { NonBlockingRouter.completeOperation(futureResult, callback, null, e); } }
Source:
private void testContent() { ______TS("content: typical page"); Url sessionsUrl = createUrl(Const.ActionURIs.ADMIN_SESSIONS_PAGE); sessionsPage = loginAdminToPage(browser, sessionsUrl, AdminSessionsPage.class); sessionsPage.verifyHtml("/adminSessionsPage.html"); ______TS("content: show filter"); sessionsPage.clickDetailButton(); sessionsPage.verifyHtmlMainContent("/adminSessionsPageShowFilter.html"); }

Target:
private void testContent() { ______TS("content: typical page"); Url sessionsUrl = createUrl(Const.ActionURIs.ADMIN_SESSIONS_PAGE); sessionsPage = loginAdminToPage(browser, sessionsUrl, AdminSessionsPage.class); sessionsPage.verifyHtml("/adminSessionsPage.html"); ______TS("content: show filter"); sessionsPage.clickDetailButton(); sessionsPage.verifyHtmlMainContent("/adminSessionsPageShowFilter.html"); ______TS("content: hide filter"); sessionsPage.clickDetailButton(); sessionsPage.verifyHtmlMainContent("/adminSessionsPageHideFilter.html"); }
Source:
public void cancel() { new CancelButton().click(); new WaitWhile(new ShellIsActive("Open CDI Named Bean")); }

Target:
public void cancel() { new CancelButton().click(); new WaitWhile(new ShellIsAvailable("Open CDI Named Bean")); }
Source:
public void restoreSnapshot(ClockSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } setNumber(s.getNumber()); stop(); setTime(s.getTime()); if (s.isRunning()) { start(false); } } }

Target:
public void restoreSnapshot(ClockSnapshot s) { synchronized (coreLock) { if (s.getId() != getId()) { return; } setNumber(s.getNumber()); set(Value.TIME, s.getTime(), Flag.INTERNAL); if (s.isRunning()) { start(); } else { stop(); } } }
Source:
void copy() throws IOException { FileInputStream input = new FileInputStream(src); FileOutputStream output = new FileOutputStream(dest); try { FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); } finally { input.close(); output.close(); } }

Target:
void copy() throws IOException { FileInputStream input = new FileInputStream(src); try { FileOutputStream output = new FileOutputStream(dest); try { FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); } finally { output.close(); } } finally { input.close(); } }