auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<PhpIniIssue> analyze(PhpIniFile phpIniFile) { List<PhpIniIssue> issues = new ArrayList<>(); List<Directive> directives = phpIniFile.directivesForName("open_basedir"); if (directives.isEmpty()) { issues.add(newIssue("Set \"open_basedir\".")); } for (Directive directive : directives) { String value = directive.value().text(); if (value.startsWith("\"")) { value = value.substring(1); } if (value.endsWith("\"")) { value = value.substring(0, value.length() - 1); } for (String path : value.split(":|;")) { if (".".equals(path) || "/".equals(path)) { String message = "Limit \"open_basedir\" to a narrower path than \"" + path + "\"."; int line = directive.name().line(); issues.add(newIssue(message).line(line)); break; } } } return issues; }

Target:
public List<PhpIniIssue> analyze(PhpIniFile phpIniFile) { List<PhpIniIssue> issues = new ArrayList<>(); List<Directive> directives = phpIniFile.directivesForName("open_basedir"); if (directives.isEmpty()) { issues.add(newIssue(FILE_MESSAGE)); } for (Directive directive : directives) { String value = directive.value().text(); if (value.startsWith("\"")) { value = value.substring(1); } if (value.endsWith("\"")) { value = value.substring(0, value.length() - 1); } for (String path : value.split(":|;")) { if (".".equals(path) || "/".equals(path)) { String message = String.format(DIRECTIVE_MESSAGE, path); int line = directive.name().line(); issues.add(newIssue(message).line(line)); break; } } } return issues; }
Source:
public void compareVersion_shouldTreatSNAPSHOTAsEarliestVersion() throws Exception { String olderVersion = "1.8.4~SNAPSHOT"; String newerVersion = "1.8.4"; Assert.assertTrue(ModuleUtil.compareVersion(newerVersion, olderVersion) > 0); Assert.assertTrue(ModuleUtil.compareVersion(olderVersion, newerVersion) < 0); }

Target:
public void compareVersion_shouldTreatSNAPSHOTAsEarliestVersion() throws Exception { String olderVersion = "1.8.4-SNAPSHOT"; String newerVersion = "1.8.4"; Assert.assertTrue(ModuleUtil.compareVersion(newerVersion, olderVersion) > 0); Assert.assertTrue(ModuleUtil.compareVersion(olderVersion, newerVersion) < 0); }
Source:
private void updateWidgetOffsets(int fromOffset) { if (document != null) { final int docLines = document.getNumberOfLines(); if (isFixedWidth()) { try { final int offset = Math.max(fromOffset, 0); int docLineIndex = Math.max(document.getLineOfOffset(offset), 0); final int docLineOffset = document.getLineOffset(docLineIndex); int widgetLineIndex; if (docLineOffset > 0) { widgetLineIndex = getLineOfOffset(docLineOffset); } else { widgetLineIndex = 0; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = 0; } for (; docLineIndex < docLines; docLineIndex++) { int lineLength = document.getLineInformation(docLineIndex).getLength(); for (; lineLength > consoleWidth; lineLength -= consoleWidth) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + consoleWidth; } final String docLineDelimiter = document.getLineDelimiter(docLineIndex); if (docLineDelimiter != null) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + lineLength + docLineDelimiter.length(); } } widgetLines = widgetLineIndex + 1; } catch (BadLocationException e) { ConsolePlugin.log(e); } } else { widgetLines = docLines; } } else { widgetLines = 0; } }

Target:
private void updateWidgetOffsets(int fromOffset) { if (document == null) { widgetLines = 0; return; } final int docLines = document.getNumberOfLines(); if (!isFixedWidth()) { widgetLines = docLines; } else { try { final int offset = Math.max(fromOffset, 0); int docLineIndex = Math.max(document.getLineOfOffset(offset), 0); final int docLineOffset = document.getLineOffset(docLineIndex); int widgetLineIndex; if (docLineOffset > 0) { widgetLineIndex = getLineOfOffset(docLineOffset); } else { widgetLineIndex = 0; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = 0; } for (; docLineIndex < docLines; docLineIndex++) { int lineLength = document.getLineInformation(docLineIndex).getLength(); for (; lineLength > consoleWidth; lineLength -= consoleWidth) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + consoleWidth; } final String docLineDelimiter = document.getLineDelimiter(docLineIndex); if (docLineDelimiter != null) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + lineLength + docLineDelimiter.length(); } } widgetLines = widgetLineIndex + 1; } catch (BadLocationException e) { ConsolePlugin.log(e); } } }
Source:
static ImageLoadListener getImageLoadListener(ImageView view) { if(view != null) { ViewData data = (ViewData) view.getTag(); if(data != null) { return data.mListener; } } return null; }

Target:
static ImageLoadListener getImageLoadListener(ImageView view) { if(view != null) { ViewData data = (ViewData) view.getTag(); if(data != null) { return data.mListener; } } return NULL_LISTENER; }
Source:
public void onMapReady(MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; addRadar(mapboxMap); refreshGeoJsonRunnable = new RefreshGeoJsonRunnable(); do { handler.postDelayed(refreshGeoJsonRunnable, 1000); } while (index == 39); }

Target:
public void onMapReady(MapboxMap mapboxMap) { addRadar(mapboxMap); refreshGeoJsonRunnable = new RefreshGeoJsonRunnable(); do { handler.postDelayed(refreshGeoJsonRunnable, 1000); } while (index == 39); }
Source:
public void shouldParseComplexAggregateQuery() { NativeQueryParser parser = Parboiled.createParser( NativeQueryParser.class ); String match = "{ '$match': { 'NAME':{'$regex':'Bangalore', '$options': 'i'}}}"; String unwind = "{'$unwind': '$clicks'}"; String group = "{ '$group': {'_id' : '$_id' ,'clicks' : $push: $clicks ,'token' : { '$push': '$TOKEN' } } }"; String sort = "{ '$sort': { '_id' : -1 } }"; String nativeQuery = "db.UserFactualContent.aggregate([" + match + "," + unwind + "," + group + "," + sort + "])"; ParsingResult<MongoDBQueryDescriptor> run = new ReportingParseRunner<MongoDBQueryDescriptor>( parser.Query() ).run( nativeQuery ); MongoDBQueryDescriptor queryDescriptor = run.resultValue; assertThat( queryDescriptor.getCollectionName() ).isEqualTo( "UserFactualContent" ); assertThat( queryDescriptor.getOperation() ).isEqualTo( Operation.AGGREGATE_PIPELINE ); assertThat( queryDescriptor.getPipeline() ).containsExactly( Document.parse( match ), Document.parse( unwind ), Document.parse( group ), Document.parse( sort ) ); }

Target:
public void shouldParseComplexAggregateQuery() { NativeQueryParser parser = Parboiled.createParser( NativeQueryParser.class ); String match = "{ '$match': { 'NAME':{'$regex':'Bangalore', '$options': 'i'}}}"; String unwind = "{'$unwind': '$clicks'}"; String group = "{ '$group': {'_id' : '$_id' ,'clicks' : $push: $clicks ,'token' : { '$push': '$TOKEN' } } }"; String sort = "{ '$sort': { '_id' : -1 } }"; String nativeQuery = "db.UserFactualContent.aggregate([" + match + "," + unwind + "," + group + "," + sort + "])"; ParsingResult<MongoDBQueryDescriptor> run = new BasicParseRunner<MongoDBQueryDescriptor>( parser.Query() ).run( nativeQuery ); MongoDBQueryDescriptor queryDescriptor = run.resultValue; assertThat( queryDescriptor.getCollectionName() ).isEqualTo( "UserFactualContent" ); assertThat( queryDescriptor.getOperation() ).isEqualTo( Operation.AGGREGATE_PIPELINE ); assertThat( queryDescriptor.getPipeline() ) .containsExactly( Document.parse( match ) , Document.parse( unwind ) , Document.parse( group ) , Document.parse( sort ) ); }
Source:
public void removeItemsSelected() { mItemsSelected = new SparseBooleanArray(); notifyDataSetChanged(); }

Target:
public void removeItemsSelected() { mItemsSelected.clear(); notifyDataSetChanged(); }
Source:
protected boolean existsColumnWithSameName(GridColumnPreference gridColumnPreference, List<ColumnMeta<T>> columns) { for (ColumnMeta<T> columnMeta : columns) { if (columnMeta.getCaption().equals(gridColumnPreference.getName())) { return true; } } return false; }

Target:
protected boolean existsColumnWithSameName(GridColumnPreference gridColumnPreference, List<ColumnMeta<T>> columns) { return columns.stream().filter(meta -> meta.getCaption().equals(gridColumnPreference.getName())).findFirst().isPresent(); }
Source:
public Config(final String defaultConfigFilename, final String overrideConfigFilename) { final File defaultConfigFile = new File(defaultConfigFilename); final Environment defaultEnvironment = new ImmutableEnvironment(defaultConfigFile.getParent()); final ConfigurationSource defaultConfigSource = new FilesConfigurationSource(() -> Paths.get(defaultConfigFile.getName()) ); final ConfigurationProvider defaultConfigProvider = new ConfigurationProviderBuilder() .withEnvironment(defaultEnvironment) .withConfigurationSource(defaultConfigSource) .build(); final File overrideConfigFile = new File(overrideConfigFilename); final Environment overrideEnvironment = new ImmutableEnvironment(defaultConfigFile.getParent()); if (new File(overrideConfigFilename).exists()) { final ConfigurationSource configSource = new MergeConfigurationSource( defaultConfigSource, new FilesConfigurationSource(() -> Paths.get(overrideConfigFile.getName()))); configProvider = new ConfigurationProviderBuilder() .withEnvironment(overrideEnvironment) .withConfigurationSource(configSource) .build(); } else { configProvider = defaultConfigProvider; } }

Target:
public Config(final String defaultConfigFilename, final String overrideConfigFilename) { final File defaultConfigFile = new File(defaultConfigFilename); final Environment defaultEnvironment = new ImmutableEnvironment(defaultConfigFile.getParent()); final ConfigurationSource defaultConfigSource = new FilesConfigurationSource(() -> Paths.get(defaultConfigFile.getName()) ); final ConfigurationProvider defaultConfigProvider = new ConfigurationProviderBuilder() .withEnvironment(defaultEnvironment) .withConfigurationSource(defaultConfigSource) .build(); final File overrideConfigFile = new File(overrideConfigFilename); final Environment overrideEnvironment = new ImmutableEnvironment(defaultConfigFile.getParent()); if (overrideConfigFile.exists()) { final ConfigurationSource configSource = new MergeConfigurationSource( defaultConfigSource, new FilesConfigurationSource(() -> Paths.get(overrideConfigFile.getName()))); configProvider = new ConfigurationProviderBuilder() .withEnvironment(overrideEnvironment) .withConfigurationSource(configSource) .build(); } else { configProvider = defaultConfigProvider; } }
Source:
public static boolean createSlackMessage(List<FoundFailureCause> foundCauseList, boolean notifySlackOfAllFailures, List<String> slackFailureCauseCategories, String buildName, String buildNum, String buildUrl, PrintStream scanLog) { boolean notifySlackOfFailure = false; StringBuffer bufBuildFailCause = new StringBuffer(); for (int i = 0; i < foundCauseList.size(); i++) { if (!notifySlackOfAllFailures) { List<String> categories = foundCauseList.get(i).getCategories(); if (categories != null) { for (int j = 0; j < categories.size(); j++) { String category = categories.get(j); if (failureCategoryMatches(category, slackFailureCauseCategories)) { notifySlackOfFailure = true; break; } } } } if (bufBuildFailCause.length() == 0) { bufBuildFailCause.append(foundCauseList.get(i).getName()); } else { bufBuildFailCause.append("\n"); bufBuildFailCause.append(foundCauseList.get(i).getName()); } } if (notifySlackOfAllFailures || notifySlackOfFailure) { SlackMessageProvider slack = new SlackMessageProvider(); StringBuilder s = new StringBuilder("Job *\"" + buildName + "\"*"); s.append(" build *#" + buildNum + "* FAILED due to following failure causes: \n```"); s.append(bufBuildFailCause.toString() + "```\nSee "); s.append(buildUrl + " for details."); slack.postToSlack(s.toString(), scanLog); return true; } return false; }

Target:
public static boolean createSlackMessage(List<FoundFailureCause> foundCauseList, boolean notifySlackOfAllFailures, List<String> slackFailureCauseCategories, String buildName, String buildNum, String buildUrl, PrintStream scanLog) { boolean notifySlackOfFailure = false; StringBuilder bufBuildFailCause = new StringBuilder(); for (FoundFailureCause foundCause : foundCauseList) { if (!notifySlackOfAllFailures) { List<String> categories = foundCause.getCategories(); if (categories != null) { for (String category : categories) { if (failureCategoryMatches(category, slackFailureCauseCategories)) { notifySlackOfFailure = true; break; } } } } if (bufBuildFailCause.length() == 0) { bufBuildFailCause.append(foundCause.getName()); } else { bufBuildFailCause.append("\n"); bufBuildFailCause.append(foundCause.getName()); } } if (notifySlackOfAllFailures || notifySlackOfFailure) { SlackMessageProvider slack = new SlackMessageProvider(); StringBuilder s = new StringBuilder("Job *\"" + buildName + "\"*"); s.append(" build *#" + buildNum + "* FAILED due to following failure causes: \n```"); s.append(bufBuildFailCause.toString() + "```\nSee "); s.append(buildUrl + " for details."); slack.postToSlack(s.toString(), scanLog); return true; } return false; }
Source:
public Map<String, String> getConfiguredAttributesMap(RealmConfiguration realmConfiguration) { Map<String, String> attributeMap = new HashMap<>(); if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupIDAttribute) != null) { attributeMap.put(UserStoreConfigConstants.groupIDAttribute, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupIDAttribute)); } if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupCreatedDateAttribute) != null) { attributeMap.put(UserStoreConfigConstants.groupCreatedDateAttribute, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupCreatedDateAttribute)); } if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupModifiedDateAttribute) != null) { attributeMap.put(UserStoreConfigConstants.groupModifiedDateAttribute, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupModifiedDateAttribute)); } return attributeMap; }

Target:
public static Map<String, String> getConfiguredAttributesMap(RealmConfiguration realmConfiguration) { Map<String, String> attributeMap = new HashMap<>(); if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_ID_ATTRIBUTE) != null) { attributeMap.put(UserStoreConfigConstants.GROUP_ID_ATTRIBUTE, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_ID_ATTRIBUTE)); } if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE) != null) { attributeMap.put(UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE)); } if (realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE) != null) { attributeMap.put(UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE, realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE)); } return attributeMap; }
Source:
public NetworkView getEntity() { return (NetworkView) ((super.getEntity() instanceof NetworkView) ? super.getEntity() : null); }

Target:
public NetworkView getEntity() { return (NetworkView) super.getEntity(); }
Source:
public void testAbsentEntityRetrievalFails() throws Throwable { Connection client = CLUSTER.newConnection(); try { EntityRef<EhcacheClientEntity, ClusteredTierManagerConfiguration> ref = client.getEntityRef(EhcacheClientEntity.class, EhcacheEntityVersion.ENTITY_VERSION, "testAbsentEntityRetrievalFails"); try { ref.fetchEntity(); fail("Expected EntityNotFoundException"); } catch (EntityNotFoundException e) { } } finally { client.close(); } }

Target:
public void testAbsentEntityRetrievalFails() throws Throwable { Connection client = CLUSTER.newConnection(); try { EntityRef<EhcacheClientEntity, ClusteredTierManagerConfiguration> ref = getEntityRef(client); try { ref.fetchEntity(); fail("Expected EntityNotFoundException"); } catch (EntityNotFoundException e) { } } finally { client.close(); } }
Source:
FrameworkLogEntry createLogEntry(IStatus status) { Throwable t = status.getException(); ArrayList childlist = new ArrayList(); int stackCode = t instanceof CoreException ? 1 : 0; if (stackCode == 1) { IStatus coreStatus = ((CoreException) t).getStatus(); if (coreStatus != null) { childlist.add(createLogEntry(coreStatus)); } } if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); for (IStatus element : children) { childlist.add(createLogEntry(element)); } } FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()])); return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children); }

Target:
FrameworkLogEntry createLogEntry(IStatus status) { Throwable t = status.getException(); ArrayList childlist = new ArrayList(); int stackCode = t instanceof CoreException ? 1 : 0; if (stackCode == 1) { IStatus coreStatus = ((CoreException) t).getStatus(); if (coreStatus != null) { childlist.add(createLogEntry(coreStatus)); } } if (status.isMultiStatus()) { for (IStatus child : status.getChildren()) { childlist.add(createLogEntry(child)); } } FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()])); return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children); }
Source:
public List<Registration> getRegistrations() { return Arrays.asList(new Registration[] { new Registration(MessageHeaders.class, new MessageHeadersSerializer(), MESSAGEHEADERS_ID), new Registration(MutableMessageHeaders.class, new MutableMessageHeadersSerializer(), MUTABLE_MESSAGEHEADERS_ID) }); }

Target:
public List<Registration> getRegistrations() { return Arrays.asList( new Registration(MessageHeaders.class, new MessageHeadersSerializer(), this.messageHeadersRegistrationId), new Registration(MutableMessageHeaders.class, new MutableMessageHeadersSerializer(), this.mutableMessageHeadersRegistrationId)); }
Source:
public void test() throws IOException, InterruptedException { try (final DockerClient client = DockerClientFactory.instance().client()) { Instant startTime = Instant.now(); final AtomicBoolean received = new AtomicBoolean(false); EventsResultCallback callback = new EventsResultCallback() { @Override public void onNext(Event event) { if (event.getFrom().equals("alpine:latest") && event.getStatus().equals("create")) { received.set(true); } } }; GenericContainer container = new GenericContainer<>("alpine:latest") .withCommand("/bin/sh", "-c", "sleep 0") .withStartupCheckStrategy(new OneShotStartupCheckStrategy()); container.start(); Instant endTime = Instant.now(); client.eventsCmd() .withImageFilter("alpine:latest") .withEventFilter("create") .withSince(Long.toString(startTime.getEpochSecond())) .withUntil(Long.toString(endTime.getEpochSecond())) .exec(callback) .awaitCompletion() .close(); VisibleAssertions.assertTrue("Events has been captured", received.get()); } }

Target:
public void test() throws IOException, InterruptedException { CountDownLatch latch = new CountDownLatch(1); try ( GenericContainer container = new GenericContainer<>() .withCommand("true") .withStartupCheckStrategy(new OneShotStartupCheckStrategy()) ) { container.start(); String createdAt = container.getContainerInfo().getCreated(); try ( EventsResultCallback response = DockerClientFactory.instance().client().eventsCmd() .withContainerFilter(container.getContainerId()) .withEventFilter("create") .withSince(Instant.parse(createdAt).getEpochSecond() + "") .exec(new EventsResultCallback() { @Override public void onNext(@NotNull Event event) { if (event.getId().equals(container.getContainerId()) && event.getStatus().equals("create")) { latch.countDown(); } } }) ) { response.awaitStarted(5, TimeUnit.SECONDS); latch.await(5, TimeUnit.SECONDS); } } }
Source:
private void handleMessageRetry(final ProtocolResponseMessage message, final ScheduledTask scheduledTask) { final String errorMessage = this.determineErrorMessage(message); scheduledTask.setFailed(errorMessage); scheduledTask.retryOn(message.getRetryHeader().getScheduledRetryTime()); this.scheduledTaskRepository.save(scheduledTask); }

Target:
private void handleMessageRetry(final ProtocolResponseMessage message, final ScheduledTask scheduledTask) { scheduledTask.setFailed(this.determineErrorMessage(message)); scheduledTask.retryOn(message.getRetryHeader().getScheduledRetryTime()); this.scheduledTaskRepository.save(scheduledTask); }
Source:
public void testNativeQueryWithAliasSyntax() throws Exception { doInHibernate( this::sessionFactory, session -> { NativeQuery query = session.createNativeQuery( "SELECT ft.id as {ft.id}, ft.locationStart as {ft.locationStart}, ft.locationEnd as {ft.locationEnd}, abs(ft.locationEnd - locationStart) as {ft.distance} FROM foo_table ft") .addEntity( "ft", Foo.class ); Map<String,String> props = new HashMap<>(); props.put( "distance", "distance" ); query.setProperties( props ); List<Foo> list = query.getResultList(); assertEquals( 3, list.size() ); } ); }

Target:
public void testNativeQueryWithAliasSyntax() throws Exception { doInHibernate( this::sessionFactory, session -> { NativeQuery query = session.createNativeQuery( "SELECT ft.id as {ft.id}, ft.locationStart as {ft.locationStart}, ft.locationEnd as {ft.locationEnd}, abs(ft.locationEnd - locationStart) as {ft.distance} FROM foo_table ft") .addEntity( "ft", Foo.class ); query.setProperties( Collections.singletonMap( "distance", "distance" ) ); List<Foo> list = query.getResultList(); assertEquals( 3, list.size() ); } ); }
Source:
public long getVersion() { return version; }

Target:
public Long getVersion() { return version; }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof InstalledIUElement)) return false; if (iu == null) return false; if (!iu.equals(((InstalledIUElement) obj).getIU())) return false; Object parent = getParent(this); Object objParent = ((InstalledIUElement) obj).getParent(obj); if (parent == this && objParent == obj) return true; else if (parent != null && objParent != null) return parent.equals(objParent); else if (parent == null && objParent == null) return true; return false; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof InstalledIUElement)) return false; if (iu == null) return false; if (!iu.equals(((InstalledIUElement) obj).getIU())) return false; Object parent = getParent(this); Object objParent = ((InstalledIUElement) obj).getParent(obj); if (parent == this) return objParent == obj; else if (parent != null && objParent != null) return parent.equals(objParent); else if (parent == null && objParent == null) return true; return false; }
Source:
protected TableViewerSWTBuilder createTableViewerSWTBuilder(Composite parent, @SuppressWarnings("rawtypes") IObservableList list, @SuppressWarnings("rawtypes") IObservableValue labelText, @SuppressWarnings("rawtypes") IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, ObservableListContentProvider cp, ECPTableViewerComparator comparator, TableActionBar<? extends AbstractTableViewer> actionBar) { return createTableViewerSWTBuilder(parent, list, labelText, labelTooltipText, compositeBuilder, cp, comparator, actionBar); }

Target:
protected TableViewerSWTBuilder createTableViewerSWTBuilder(Composite parent, @SuppressWarnings("rawtypes") IObservableList list, @SuppressWarnings("rawtypes") IObservableValue labelText, @SuppressWarnings("rawtypes") IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, ObservableListContentProvider cp, ECPTableViewerComparator comparator, TableActionBar<? extends AbstractTableViewer> actionBar) { return createTableViewerSWTBuilder(parent, list, labelText, labelTooltipText, compositeBuilder, cp, (ViewerComparator) comparator, actionBar); }
Source:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<VagrantNode, Hardware, Box, Location>>() { }).to(VagrantComputeServiceAdapter.class); bind(new TypeLiteral<Function<VagrantNode, NodeMetadata>>() { }).to(MachineToNodeMetadata.class); bind(new TypeLiteral<Function<MachineState, Status>>() { }).to(MachineStateToJcloudsStatus.class); bind(new TypeLiteral<Function<Box, Image>>() { }).to(BoxToImage.class); bind(new TypeLiteral<Function<Hardware, Hardware>>() { }).to(this.<Hardware>getIdentityFunction()); bind(new TypeLiteral<Function<Location, Location>>() { }).to(this.<Location>getIdentityFunction()); bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(VagrantDefaultImageCredentials.class); }

Target:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<VagrantNode, Hardware, Box, Location>>() { }).to(new TypeLiteral<VagrantComputeServiceAdapter<Box>>() {}); bind(new TypeLiteral<Function<VagrantNode, NodeMetadata>>() { }).to(MachineToNodeMetadata.class); bind(new TypeLiteral<Function<Box, Image>>() { }).to(BoxToImage.class); bind(new TypeLiteral<Supplier<? extends Map<String, Hardware>>>() { }).to(VagrantHardwareSupplier.class).in(Singleton.class); bind(new TypeLiteral<Function<Hardware, Hardware>>() { }).to(this.<Hardware>castIdentityFunction()); bind(new TypeLiteral<Function<Location, Location>>() { }).to(this.<Location>castIdentityFunction()); bind(new TypeLiteral<Function<Collection<Box>, Collection<Box>>>() { }).to(OutdatedBoxesFilter.class); install(new FactoryModuleBuilder() .implement(new TypeLiteral<VagrantApiFacade<Box>>() {}, VagrantCliFacade.class) .build(new TypeLiteral<VagrantApiFacade.Factory<Box>>() {})); bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(VagrantDefaultImageCredentials.class); bind(TemplateBuilderImpl.class).to(ArbitraryCpuRamTemplateBuilderImpl.class); bind(CommandIOListener.class).to(VagrantWireLogger.class).in(Singleton.class); }
Source:
public void launchExperiment(AuthzToken authzToken, final String airavataExperimentId, String gatewayId) throws AuthorizationException, AiravataSystemException, TException { RegistryService.Client regClient = registryClientPool.getResource(); SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { ExperimentModel experiment = regClient.getExperiment(airavataExperimentId); String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); String entityId = experiment.getExecutionId(); if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, entityId,gatewayId + ":READ")) { logger.error(airavataExperimentId, "User does not have access to application module {}.", entityId); throw new AuthorizationException("User does not have permission to access this resource"); } if (experiment == null) { logger.error(airavataExperimentId, "Error while launching experiment, experiment doesn't exist.", airavataExperimentId); throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system.."); } submitExperiment(gatewayId, airavataExperimentId); registryClientPool.returnResource(regClient); sharingClientPool.returnResource(sharingClient); } catch (Exception e1) { logger.error(airavataExperimentId, "Error while instantiate the registry instance", e1); AiravataSystemException exception = new AiravataSystemException(); exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); exception.setMessage("Error while instantiate the registry instance. More info : " + e1.getMessage()); registryClientPool.returnBrokenResource(regClient); throw exception; } }

Target:
public void launchExperiment(AuthzToken authzToken, final String airavataExperimentId, String gatewayId) throws TException { RegistryService.Client regClient = registryClientPool.getResource(); try { ExperimentModel experiment = regClient.getExperiment(airavataExperimentId); if (experiment == null) { logger.error(airavataExperimentId, "Error while launching experiment, experiment doesn't exist.", airavataExperimentId); throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system.."); } submitExperiment(gatewayId, airavataExperimentId); registryClientPool.returnResource(regClient); } catch (Exception e1) { logger.error(airavataExperimentId, "Error while instantiate the registry instance", e1); AiravataSystemException exception = new AiravataSystemException(); exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); exception.setMessage("Error while instantiate the registry instance. More info : " + e1.getMessage()); registryClientPool.returnBrokenResource(regClient); throw exception; } }
Source:
public CompactionDetails getCompactionDetails(long totalCapacity, long usedCapacity, long segmentCapacity, long segmentHeaderSize, List<String> logSegmentsNotInJournal, BlobStoreStats blobStoreStats) throws StoreException { CompactionDetails details = null; if (usedCapacity >= (storeConfig.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0) * totalCapacity) { if (logSegmentsNotInJournal != null) { Pair<Long, NavigableMap<String, Long>> validDataPerLogSegments = blobStoreStats.getValidDataSizeByLogSegment( new TimeRange(time.milliseconds() - messageRetentionTimeInMs, 0)); Iterator<Map.Entry<String, Long>> validEntryIterator = validDataPerLogSegments.getSecond().entrySet().iterator(); while (validEntryIterator.hasNext()) { Map.Entry<String, Long> validEntry = validEntryIterator.next(); if (!logSegmentsNotInJournal.contains(validEntry.getKey())) { validEntryIterator.remove(); } } CostBenefitInfo bestCandidateToCompact = getBestCandidateToCompact(validDataPerLogSegments.getSecond(), segmentCapacity, segmentHeaderSize, blobStoreStats.getMaxBlobSize()); if (bestCandidateToCompact != null) { List<String> segmentsToCompact = new ArrayList<>(validDataPerLogSegments.getSecond() .subMap(bestCandidateToCompact.getFirstLogSegmentName(), true, bestCandidateToCompact.getLastLogSegmentName(), true) .keySet()); details = new CompactionDetails(validDataPerLogSegments.getFirst(), segmentsToCompact); } } } return details; }

Target:
public CompactionDetails getCompactionDetails(long totalCapacity, long usedCapacity, long segmentCapacity, long segmentHeaderSize, List<String> logSegmentsNotInJournal, BlobStoreStats blobStoreStats) throws StoreException { CompactionDetails details = null; if (usedCapacity >= (storeConfig.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0) * totalCapacity) { if (logSegmentsNotInJournal != null) { Pair<Long, NavigableMap<String, Long>> validDataSizeByLogSegment = blobStoreStats.getValidDataSizeByLogSegment( new TimeRange(time.milliseconds() - messageRetentionTimeInMs - ERROR_MARGIN_MS, ERROR_MARGIN_MS)); NavigableMap<String, Long> potentialLogSegmentValidSizeMap = validDataSizeByLogSegment.getSecond() .subMap(logSegmentsNotInJournal.get(0), true, logSegmentsNotInJournal.get(logSegmentsNotInJournal.size() - 1), true); CostBenefitInfo bestCandidateToCompact = getBestCandidateToCompact(potentialLogSegmentValidSizeMap, segmentCapacity, segmentHeaderSize, blobStoreStats.getMaxBlobSize()); if (bestCandidateToCompact != null) { details = new CompactionDetails(validDataSizeByLogSegment.getFirst(), bestCandidateToCompact.getSegmentsToCompact()); } } } return details; }
Source:
public static CheckpointedInputGate createCheckpointedInputGate( AbstractInvokable toNotifyOnCheckpoint, StreamConfig config, SubtaskCheckpointCoordinator checkpointCoordinator, IndexedInputGate[] inputGates, TaskIOMetricGroup taskIOMetricGroup, String taskName) { return createCheckpointedMultipleInputGate( toNotifyOnCheckpoint, config, checkpointCoordinator, taskIOMetricGroup, taskName, Arrays.asList(inputGates))[0]; }

Target:
public static CheckpointedInputGate createCheckpointedInputGate( AbstractInvokable toNotifyOnCheckpoint, StreamConfig config, SubtaskCheckpointCoordinator checkpointCoordinator, IndexedInputGate[] inputGates, TaskIOMetricGroup taskIOMetricGroup, String taskName) { CheckpointedInputGate[] checkpointedInputGates = createCheckpointedMultipleInputGate( toNotifyOnCheckpoint, config, checkpointCoordinator, taskIOMetricGroup, taskName, Arrays.asList(inputGates)); return Iterables.getOnlyElement(Arrays.asList(checkpointedInputGates)); }
Source:
private void notifyRejected(@CheckForNull Class<?> clazz, @CheckForNull String clazzName, String message) { Throwable cause = null; if (LOGGER.isLoggable(Level.INFO)) { cause = new SecurityException("Class rejected by the class filter: " + (clazz != null ? clazz.getName() : clazzName)); } LOGGER.log(Level.WARNING, message, cause); }

Target:
private void notifyRejected(@CheckForNull Class<?> clazz, @CheckForNull String clazzName, String message) { Throwable cause = null; if (LOGGER.isLoggable(Level.FINE)) { cause = new SecurityException("Class rejected by the class filter: " + (clazz != null ? clazz.getName() : clazzName)); } LOGGER.log(Level.WARNING, message, cause); }
Source:
public void testSetSubject() throws Exception { doReturn(ExchangeVersion.Exchange2010_SP2).when(exchangeService).getRequestedServerVersion(); Appointment appointment = new Appointment(exchangeService); final String subject = "Lorem Ipsum"; appointment.setSubject(subject); assertThat(appointment.getSubject(), allOf(not(isEmptyOrNullString()), equalTo(subject))); }

Target:
public void testSetSubject() throws Exception { doReturn(ExchangeVersion.Exchange2010_SP2).when(exchangeService).getRequestedServerVersion(); Appointment appointment = new Appointment(exchangeService); final String subject = "Lorem Ipsum"; appointment.setSubject(subject); assertThat(appointment.getSubject(), is(equalTo(subject))); }
Source:
public int hashCode() { int hashCode = (int)version ^ "getblocks".hashCode() ^ stopHash.hashCode(); return locator.hashCode(hashCode); }

Target:
public int hashCode() { int hashCode = (int) version ^ "getblocks".hashCode() ^ stopHash.hashCode(); return hashCode ^= locator.hashCode(); }
Source:
public void newSinkPerThread() throws Exception { List<Thread> threads = new ArrayList<>(); Set<FluxSink> sinks = new HashSet<>(); for (int i = 0; i < THREAD_TEST; i++) { Thread thread = new Thread(() -> { Transaction tx = mock(Transaction.class); try { try { TransactionCoordination.getInstance().bindTransaction(tx); FluxSink sink = txSupplier.get(); assertThat(txSupplier.get(), is(sink)); synchronized (sinks) { sinks.add(sink); } } finally { TransactionCoordination.getInstance().unbindTransaction(tx); } } catch (TransactionException e) { } }); threads.add(thread); } for (Thread t : threads) { t.start(); } for (Thread t : threads) { t.join(); } assertThat(sinks, hasSize(THREAD_TEST)); }

Target:
public void newSinkPerThread() throws Exception { List<Thread> threads = new ArrayList<>(); Set<FluxSink> sinks = synchronizedSet(new HashSet<>()); for (int i = 0; i < THREAD_TEST; i++) { Thread thread = new Thread(() -> { Transaction tx = mock(Transaction.class); try { try { TransactionCoordination.getInstance().bindTransaction(tx); FluxSink sink = txSupplier.get(); assertThat(txSupplier.get(), is(sink)); sinks.add(sink); } finally { TransactionCoordination.getInstance().unbindTransaction(tx); } } catch (TransactionException e) { } }); threads.add(thread); } for (Thread t : threads) { t.start(); } for (Thread t : threads) { t.join(); } assertThat(sinks, hasSize(THREAD_TEST)); }
Source:
public ValidationResult validateMacAddress(List<? extends VmNic> vmNics) { for (VmNic iface : vmNics) { String str = iface.getMacAddress(); if (str != null) { if (!VALIDATE_MAC_ADDRESS.matcher(iface.getMacAddress()).matches()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID, String.format("$IfaceName %1$s", iface.getName()), String.format("$MacAddress %1$s", iface.getMacAddress())); } } } return ValidationResult.VALID; }

Target:
public ValidationResult validateMacAddress(List<? extends VmNic> vmNics) { for (VmNic iface : vmNics) { if (iface.getMacAddress() != null) { if (!VALIDATE_MAC_ADDRESS.matcher(iface.getMacAddress()).matches()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID, String.format("$IfaceName %1$s", iface.getName()), String.format("$MacAddress %1$s", iface.getMacAddress())); } } } return ValidationResult.VALID; }
Source:
public void testLogReturnDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); LoggedUtils.logReturn(log, "", new Object(), new Object()); }

Target:
public void testLogReturnDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); LoggedUtils.logReturn(log, "", new Object(), new Object()); verifyZeroInteractions(log); }
Source:
public ChaosZKClient(String quorum) { this.quorum = quorum; try { this.createNewZKConnection(); } catch (IOException e) { LOG.error("Error creating ZooKeeper Connection: " + e); } }

Target:
public ChaosZKClient(String quorum) { this.quorum = quorum; try { this.createNewZKConnection(); } catch (IOException e) { LOG.error("Error creating ZooKeeper Connection: ", e); } }
Source:
public static void beforeClass() { SWTBotUtils.initialize(); Thread.currentThread().setName("SWTBotTest"); SWTBotPreferences.TIMEOUT = 60000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", bot); prepareWorkspace(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(PROJECT_NAME); }

Target:
public void beforeClass() { SWTBotUtils.initialize(); Thread.currentThread().setName("SWTBotTest"); SWTBotPreferences.TIMEOUT = 60000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", bot); prepareWorkspace(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(PROJECT_NAME); }
Source:
public void testAssetReportFilterSuccess() throws Exception { List<String> accessTokens = Arrays.asList(getItemCreateResponse().getAccessToken()); Response<AssetReportCreateResponse> createResponse = AssetReportCreateTest.createAssetReport(client(), accessTokens); String assetReportToken = createResponse.body().getAssetReportToken(); Response<AssetReportGetResponse> response = waitTillReady(client(), assetReportToken); AssetReportGetResponse respBody = response.body(); assertSuccessResponse(response); assertNotNull(respBody.getReport()); assertNotNull(respBody.getReport().getUser()); assertFalse(respBody.getReport().getItems().isEmpty()); assertNotNull(respBody.getReport().getAssetReportId()); List<String> accountIdsToExclude = new ArrayList<>(); accountIdsToExclude.add(respBody.getReport().getItems().get(0).getAccounts().get(0).getAccountId()); AssetReportFilterRequest assetReportFilterRequest = new AssetReportFilterRequest(assetReportToken, accountIdsToExclude); Response<AssetReportCreateResponse> assetReportFilterResponse = filterAssetReport(assetReportFilterRequest); String assetReportFilterToken = assetReportFilterResponse.body().getAssetReportToken(); Response<AssetReportGetResponse> filteredReportResponse = waitTillReady(client(), assetReportFilterToken); assertEquals(getAssetReportAccountIds(respBody.getReport()).size() - 1, getAssetReportAccountIds(filteredReportResponse.body().getReport()).size()); }

Target:
public void testAssetReportFilterSuccess() throws Exception { List<String> accessTokens = Arrays.asList(getItemCreateResponse().getAccessToken()); Response<AssetReportCreateResponse> createResponse = AssetReportCreateTest.createAssetReport(client(), accessTokens); String assetReportToken = createResponse.body().getAssetReportToken(); Response<AssetReportGetResponse> response = waitTillReady(client(), assetReportToken); AssetReportGetResponse respBody = response.body(); assertSuccessResponse(response); assertNotNull(respBody.getReport()); assertNotNull(respBody.getReport().getUser()); assertFalse(respBody.getReport().getItems().isEmpty()); assertNotNull(respBody.getReport().getAssetReportId()); List<String> accountIdsToExclude = new ArrayList<>(); accountIdsToExclude.add(respBody.getReport().getItems().get(0).getAccounts().get(0).getAccountId()); AssetReportFilterRequest assetReportFilterRequest = new AssetReportFilterRequest(assetReportToken, accountIdsToExclude); Response<AssetReportCreateResponse> assetReportFilterResponse = filterAssetReport(assetReportFilterRequest); String assetReportFilterToken = assetReportFilterResponse.body().getAssetReportToken(); Response<AssetReportGetResponse> filteredReportResponse = waitTillReady(client(), assetReportFilterToken); Set<String> filteredAssetReportIds = getAssetReportAccountIds(filteredReportResponse.body().getReport()); Set<String> unfilteredAssetReportIds = getAssetReportAccountIds(respBody.getReport()); assertEquals(unfilteredAssetReportIds.size() - 1, filteredAssetReportIds.size()); filteredAssetReportIds.add(accountIdsToExclude.get(0)); assertEquals(unfilteredAssetReportIds, filteredAssetReportIds); }
Source:
private void launchZendeskMyTickets() { if (isFinishing() || getIntent() == null) { return; } mBottomNav.setCurrentPosition(PAGE_ME); initSelectedSite(); ActivityLauncher.viewZendeskTickets( this, getSelectedSite(), null); }

Target:
private void launchZendeskMyTickets() { if (isFinishing()) { return; } mBottomNav.setCurrentPosition(PAGE_ME); initSelectedSite(); ActivityLauncher.viewZendeskTickets(this, getSelectedSite()); }
Source:
private ClientConfiguration buildClientConfig(Properties properties) { ClientConfiguration clientConfig = new ClientConfiguration(); String proxyHost = ""; int proxyPort = 0; if (properties.getProperty("http.proxyHost") != null) { LOG.info("Getting proxy info from properties file."); proxyHost = properties.getProperty("http.proxyHost"); proxyPort = Integer.parseInt(properties.getProperty("http.proxyPort")); } else if (System.getProperty("http.proxyHost") != null) { LOG.info("Getting proxy info from java system properties"); proxyHost = System.getProperty("http.proxyHost"); proxyPort = Integer.parseInt(System.getProperty("http.proxyPort")); } else if (System.getenv("http_proxy") != null) { LOG.info("Getting proxy info environment settings"); try { URI proxyAddr = new URI(System.getenv("http_proxy")); proxyHost = proxyAddr.getHost(); proxyPort = proxyAddr.getPort(); } catch (URISyntaxException e) { LOG.error("System proxy not set correctly"); } } if (!proxyHost.equals("") && proxyPort > 0) clientConfig = clientConfig.withProxyHost(proxyHost).withProxyPort(proxyPort); else LOG.info("Not configuring proxy as none specified"); return clientConfig; }

Target:
private ClientConfiguration buildClientConfig(Properties properties) { ClientConfiguration clientConfig = new ClientConfiguration(); String proxyHost = null; int proxyPort = 0; if (properties.getProperty(PROXY_HOST_PROP) != null) { LOG.debug("Getting proxy info from properties file."); proxyHost = properties.getProperty(PROXY_HOST_PROP); proxyPort = Integer.parseInt(properties.getProperty(PROXY_PORT_PROP)); } else if (System.getProperty(PROXY_HOST_PROP) != null) { LOG.debug("Getting proxy info from java system properties"); proxyHost = System.getProperty(PROXY_HOST_PROP); proxyPort = Integer.parseInt(System.getProperty(PROXY_PORT_PROP)); } else if (System.getenv(HTTP_PROXY_ENV_VAR) != null) { LOG.debug("Getting proxy info environment settings"); try { URI proxyAddr = new URI(System.getenv(HTTP_PROXY_ENV_VAR)); proxyHost = proxyAddr.getHost(); proxyPort = proxyAddr.getPort(); } catch (URISyntaxException e) { LOG.error("System proxy not set correctly", e); } } if (StringUtils.isNotEmpty(proxyHost) && proxyPort > 0) { clientConfig = clientConfig.withProxyHost(proxyHost).withProxyPort(proxyPort); } else { LOG.debug("Not configuring proxy as none specified"); } return clientConfig; }
Source:
private User getCurrentUser() { final Context context = ContextAccessor.current(); return context.getAuthInfo().getUser() != null ? context.getAuthInfo().getUser() : User.ANONYMOUS; }

Target:
private User getCurrentUser() { return Objects.requireNonNullElse( ContextAccessor.current().getAuthInfo().getUser(), User.ANONYMOUS ); }
Source:
public static void createViews(final PrintWriter writer, final PgSchema oldSchema, final PgSchema newSchema, final SearchPathHelper searchPathHelper) { for (final PgView newView : newSchema.getViews()) { PgView oldView; if (oldSchema != null) { oldView = oldSchema.getView(newView.getName()); } else { oldView = null; } if (oldSchema == null || !oldSchema.containsView(newView.getName()) || isViewModified(oldView, newView)) { searchPathHelper.outputSearchPath(writer); writer.println(); writer.println(newView.getCreationSQL()); if (newView.getOwnerTo() != null && oldView == null) { writer.println(); writer.println("ALTER VIEW " + PgDiffUtils.getQuotedName(newView.getName()) + " OWNER TO " + newView.getOwnerTo() + ";"); } for (PgRelationPrivilege viewPrivilege : newView.getPrivileges()) { writer.println("REVOKE ALL ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " FROM " + viewPrivilege.getRoleName() + ";"); if (!"".equals(viewPrivilege.getPrivilegesSQL(true))) { writer.println("GRANT " + viewPrivilege.getPrivilegesSQL(true) + " ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " TO " + viewPrivilege.getRoleName() + " WITH GRANT OPTION;"); } if (!"".equals(viewPrivilege.getPrivilegesSQL(false))) { writer.println("GRANT " + viewPrivilege.getPrivilegesSQL(false) + " ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " TO " + viewPrivilege.getRoleName() + ";"); } } } } }

Target:
public static void createViews(final PrintWriter writer, final PgSchema oldSchema, final PgSchema newSchema, final SearchPathHelper searchPathHelper) { for (final PgView newView : newSchema.getViews()) { PgView oldView = (oldSchema == null ? null : oldSchema.getView(newView.getName())); if (oldSchema == null || !oldSchema.containsView(newView.getName()) || isViewModified(oldView, newView)) { searchPathHelper.outputSearchPath(writer); writer.println(); writer.println(newView.getCreationSQL()); if (newView.getOwnerTo() != null && oldView == null) { writer.println(); writer.println("ALTER VIEW " + PgDiffUtils.getQuotedName(newView.getName()) + " OWNER TO " + newView.getOwnerTo() + ";"); } for (PgRelationPrivilege viewPrivilege : newView.getPrivileges()) { writer.println("REVOKE ALL ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " FROM " + viewPrivilege.getRoleName() + ";"); if (!"".equals(viewPrivilege.getPrivilegesSQL(true))) { writer.println("GRANT " + viewPrivilege.getPrivilegesSQL(true) + " ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " TO " + viewPrivilege.getRoleName() + " WITH GRANT OPTION;"); } if (!"".equals(viewPrivilege.getPrivilegesSQL(false))) { writer.println("GRANT " + viewPrivilege.getPrivilegesSQL(false) + " ON TABLE " + PgDiffUtils.getQuotedName(newView.getName()) + " TO " + viewPrivilege.getRoleName() + ";"); } } } } }
Source:
public void isNotExactlyInstanceOf_should_check_the_original_spliterator() { assertThat(stringSpliterator).isNotExactlyInstanceOf(Spliterator.class); try { assertThat(stringSpliterator).isNotExactlyInstanceOf(StringSpliterator.class); } catch (AssertionError e) { return; } failBecauseExpectedAssertionErrorWasNotThrown(); }

Target:
public void isNotExactlyInstanceOf_should_check_the_original_spliterator() { assertThat(stringSpliterator).isNotExactlyInstanceOf(Spliterator.class); expectAssertionError(() -> assertThat(stringSpliterator).isNotExactlyInstanceOf(StringSpliterator.class)); }
Source:
public void testOfferAfterFinish() throws Exception { AsyncQueue<String> queue = new AsyncQueue<>(4, executor); queue.offer("1"); queue.offer("2"); queue.offer("3"); queue.offer("4"); queue.finish(); queue.offer("5"); queue.offer("6"); queue.offer("7"); assertFalse(queue.isFinished()); assertEquals(queue.getBatchAsync(100).get(), ImmutableList.of("1", "2", "3", "4")); assertTrue(queue.isFinished()); }

Target:
public void testOfferAfterFinish() throws Exception { AsyncQueue<String> queue = new AsyncQueue<>(4, executor); assertTrue(queue.offer("1").isDone()); assertTrue(queue.offer("2").isDone()); assertTrue(queue.offer("3").isDone()); assertFalse(queue.offer("4").isDone()); queue.finish(); assertTrue(queue.offer("5").isDone()); assertTrue(queue.offer("6").isDone()); assertTrue(queue.offer("7").isDone()); assertFalse(queue.isFinished()); assertEquals(queue.getBatchAsync(100).get(), ImmutableList.of("1", "2", "3", "4")); assertTrue(queue.isFinished()); }