auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void test2() throws Exception { final File fileToProcess = new File(getNonCompilablePath("SuppressionXpathRegression2.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageDeclarationCheck.class); final String[] expectedViolation = { "1:1: " + getCheckMessage(PackageDeclarationCheck.class, PackageDeclarationCheck.MSG_KEY_MISSING), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }

Target:
public void test2() throws Exception { final File fileToProcess = new File(getNonCompilablePath("SuppressionXpathRegression2.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageDeclarationCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(PackageDeclarationCheck.class, PackageDeclarationCheck.MSG_KEY_MISSING), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
public void testSearchAllResources() throws Exception { final var resources = createResources(3); final var condition = fedora_id + "=*"; final String searchUrl = getSearchEndpoint() + "condition=" + encode(condition); try (final CloseableHttpResponse response = execute(new HttpGet(searchUrl))) { assertEquals(OK.getStatusCode(), getStatus(response)); final ObjectMapper objectMapper = new ObjectMapper(); final SearchResult result = objectMapper.readValue(response.getEntity().getContent(), SearchResult.class); assertNotNull(result); assertNotNull(result.getPagination()); assertTrue(result.getItems().size() >= 3); final var resultingFedoraIds = result.getItems().stream().map(x -> x.get("fedora_id")).collect(Collectors.toList()); assertTrue("results must contain all newly created resources", resultingFedoraIds.containsAll(resources)); } }

Target:
public void testSearchAllResources() throws Exception { final var resources = createResources(3); final var condition = FEDORA_ID + "=*"; final String searchUrl = getSearchEndpoint() + "condition=" + encode(condition); try (final CloseableHttpResponse response = execute(new HttpGet(searchUrl))) { assertEquals(OK.getStatusCode(), getStatus(response)); final ObjectMapper objectMapper = new ObjectMapper(); final SearchResult result = objectMapper.readValue(response.getEntity().getContent(), SearchResult.class); assertNotNull(result); assertNotNull(result.getPagination()); assertTrue(result.getItems().size() >= 3); final var resultingFedoraIds = result.getItems().stream().map(x -> x.get("fedora_id")).collect(Collectors.toList()); assertTrue("results must contain all newly created resources", resultingFedoraIds.containsAll(resources)); } }
Source:
public HashMap<Category, ImList<CategorizedTime>> groupTimes() { Function1<CategorizedTime, Category> f = new Function1<CategorizedTime, Category>() { @Override public Category apply(CategorizedTime ct) { return ct.category; } }; return DefaultImList.create(times).groupBy(f); }

Target:
public HashMap<Category, ImList<CategorizedTime>> groupTimes() { return DefaultImList.create(times).groupBy(t -> t.category); }
Source:
public void configure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { try { IProjectDescription description = project.getDescription(); String[] oldNatures = description.getNatureIds(); List<String> natureList = new ArrayList<String>(); natureList.addAll(Arrays.asList(oldNatures)); if( !project.hasNature(HybridAppNature.NATURE_ID ) ){ natureList.add(HybridAppNature.NATURE_ID); } if( !project.hasNature( JavaScriptCore.NATURE_ID )){ natureList.add(JavaScriptCore.NATURE_ID); } description.setNatureIds(natureList.toArray(new String[natureList.size()])); project.setDescription(description, monitor); } catch (CoreException ex) { Activator.getDefault().getLog().log(new Status( IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex)); } }

Target:
public void configure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { try { new HybridProjectCreator().convertProject(project, monitor); } catch (CoreException ex) { ThymImporterActivator.getDefault().getLog().log(new Status( IStatus.ERROR, ThymImporterActivator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex)); } }
Source:
public void unshareButtonPressed(OCShare share) { mListener.removeShare(share); Log_OC.d(TAG, "Unshare - " + share.getSharedWithDisplayName()); }

Target:
public void unshareButtonPressed(OCShare share) { Log_OC.d(TAG, "Removed private share with " + share.getSharedWithDisplayName()); mListener.removeShare(share); }
Source:
public JsonFeature( String name, String id, @Nullable String version, @Nullable String description, FeatureState state, boolean required, @Nullable String region, @Nullable String repository, int startLevel) { Validate.notNull(name, "invalid null name"); Validate.notNull(id, " invalid null id"); Validate.notNull(state, "invalid null state"); this.name = name; this.id = id; this.version = version; this.description = description; this.state = state; this.required = required; this.region = region; this.repository = repository; this.startLevel = startLevel; }

Target:
JsonFeature( String name, String id, @Nullable String version, @Nullable String description, FeatureState state, boolean required, @Nullable String region, @Nullable String repository, int startLevel) { Validate.notNull(name, "invalid null name"); Validate.notNull(id, " invalid null id"); Validate.notNull(state, "invalid null state"); this.name = name; this.id = id; this.version = version; this.description = description; this.state = state; this.required = required; this.region = region; this.repository = repository; this.startLevel = startLevel; }
Source:
public boolean isBoundToCreatedVm(){ return isBoundToVm() && this.getBroker().equals(this.getVm().getBroker()) && this.getVm().isCreated(); }

Target:
public boolean isBoundToCreatedVm(){ return isBoundToVm() && this.getVm().isCreated() && this.getBroker().equals(this.getVm().getBroker()); }
Source:
public void onMatch(RelOptRuleCall call) { final Sort sort = call.rel(0); final DruidRel druidRel = call.rel(1); final DefaultLimitSpec limitSpec = GroupByRules.toLimitSpec(druidRel.getQueryBuilder().getRowOrder(), sort); if (limitSpec == null) { return; } if (limitSpec.getColumns().isEmpty()) { call.transformTo( druidRel.withQueryBuilder( druidRel.getQueryBuilder().withLimitSpec(limitSpec) ) ); } }

Target:
public void onMatch(RelOptRuleCall call) { final Sort sort = call.rel(0); final DruidRel druidRel = call.rel(1); final DefaultLimitSpec limitSpec = GroupByRules.toLimitSpec(druidRel.getQueryBuilder().getRowOrder(), sort); if (limitSpec == null) { return; } final List<OrderByColumnSpec> orderBys = limitSpec.getColumns(); if (orderBys.isEmpty() || (orderBys.size() == 1 && orderBys.get(0).getDimension().equals(Column.TIME_COLUMN_NAME))) { call.transformTo( druidRel.withQueryBuilder( druidRel.getQueryBuilder().withLimitSpec(limitSpec) ) ); } }
Source:
public List<String> getSegmentMetadataFromServer(String tableNameWithType, Map<String, List<String>> serversToSegmentsMap, BiMap<String, String> endpoints, int timeoutMs) { LOGGER.debug("Reading segment metadata from servers for table {}.", tableNameWithType); List<String> serverURLs = new ArrayList<>(); for (Map.Entry<String, List<String>> serverToSegments : serversToSegmentsMap.entrySet()) { List<String> segments = serverToSegments.getValue(); for (String segment : segments) { serverURLs.add(generateSegmentMetadataServerURL(tableNameWithType, segment, endpoints.get(serverToSegments.getKey()))); } } BiMap<String, String> endpointsToServers = endpoints.inverse(); CompletionServiceHelper completionServiceHelper = new CompletionServiceHelper(_executor, _connectionManager, endpointsToServers); CompletionServiceHelper.CompletionServiceResponse serviceResponse = completionServiceHelper.doMultiGetRequest(serverURLs, tableNameWithType, timeoutMs); List<String> segmentsMetadata = new ArrayList<>(); int failedParses = 0; for (Map.Entry<String, String> streamResponse : serviceResponse._httpResponses.entrySet()) { try { JsonNode segmentMetadata = JsonUtils.stringToJsonNode(streamResponse.getValue()); segmentsMetadata.add(JsonUtils.objectToString(segmentMetadata)); } catch (IOException e) { failedParses++; LOGGER.error("Unable to parse server response due to an error: ", e); } } if (failedParses != 0) { LOGGER.warn("Failed to parse segment metadata responses from server.", failedParses); } LOGGER.debug("Retrieved segment metadata from servers."); return segmentsMetadata; }

Target:
public List<String> getSegmentMetadataFromServer(String tableNameWithType, Map<String, List<String>> serversToSegmentsMap, BiMap<String, String> endpoints, int timeoutMs) { LOGGER.debug("Reading segment metadata from servers for table {}.", tableNameWithType); List<String> serverURLs = new ArrayList<>(); for (Map.Entry<String, List<String>> serverToSegments : serversToSegmentsMap.entrySet()) { List<String> segments = serverToSegments.getValue(); for (String segment : segments) { serverURLs.add(generateSegmentMetadataServerURL(tableNameWithType, segment, endpoints.get(serverToSegments.getKey()))); } } BiMap<String, String> endpointsToServers = endpoints.inverse(); CompletionServiceHelper completionServiceHelper = new CompletionServiceHelper(_executor, _connectionManager, endpointsToServers); CompletionServiceHelper.CompletionServiceResponse serviceResponse = completionServiceHelper.doMultiGetRequest(serverURLs, tableNameWithType, timeoutMs); List<String> segmentsMetadata = new ArrayList<>(); int failedParses = 0; for (Map.Entry<String, String> streamResponse : serviceResponse._httpResponses.entrySet()) { try { String segmentMetadata = streamResponse.getValue(); segmentsMetadata.add(segmentMetadata); } catch (Exception e) { failedParses++; LOGGER.error("Unable to parse server response due to an error: ", streamResponse.getKey(), e); } } if (failedParses != 0) { LOGGER.error("Unable to parse server / response due to an error: ", failedParses, serverURLs.size()); } LOGGER.debug("Retrieved segment metadata from servers."); return segmentsMetadata; }
Source:
public StripedWriterReaderPhaser(final int stripes) { assert stripes > 0 && (stripes & (stripes - 1)) == 0; this.stripes = stripes; startEpoch = new AtomicLongArray(stripes); evenEndEpoch = new AtomicLongArray(stripes); oddEndEpoch = new AtomicLongArray(stripes); stride = 1 + Long.MAX_VALUE / stripes; for (int i=0; i<stripes; i++) { startEpoch.set(i, i * stride); evenEndEpoch.set(i, i * stride); oddEndEpoch.set(i, Long.MIN_VALUE + i * stride); } }

Target:
public StripedWriterReaderPhaser(final int stripes) { if (stripes <= 0 || (stripes & (stripes - 1)) != 0) { throw new IllegalArgumentException("The number of stripes must be a power of 2, not " + stripes); } if (stripes > MAX_STRIPES) { throw new IllegalArgumentException("There must be at most " + MAX_STRIPES + " stripes, not " + stripes); } this.stripes = stripes; this.stripeMask = stripes - 1; final int paddedStripes = stripes * STRIDE; startEpoch = new AtomicLongArray(paddedStripes); evenEndEpoch = new AtomicLongArray(paddedStripes); oddEndEpoch = new AtomicLongArray(paddedStripes); for (int i = 0; i < stripes; i++) { oddEndEpoch.set(i * STRIDE, Long.MIN_VALUE); } }
Source:
public ByteBuf encode(ByteBuf buf, PlayParticleMessage message) throws IOException { buf.writeInt(message.getParticle()); buf.writeBoolean(message.isLongDistance()); buf.writeFloat(message.getX()); buf.writeFloat(message.getY()); buf.writeFloat(message.getZ()); buf.writeFloat(message.getOfsX()); buf.writeFloat(message.getOfsY()); buf.writeFloat(message.getOfsZ()); buf.writeFloat(message.getExtData()); buf.writeInt(message.getCount()); for (int extData : message.getData()) { ByteBufUtils.writeVarInt(buf, extData); } return buf; }

Target:
public ByteBuf encode(ByteBuf buf, PlayParticleMessage message) throws IOException { buf.writeInt(message.getParticle()); buf.writeBoolean(message.isLongDistance()); buf.writeFloat(message.getX()); buf.writeFloat(message.getY()); buf.writeFloat(message.getZ()); buf.writeFloat(message.getOfsX()); buf.writeFloat(message.getOfsY()); buf.writeFloat(message.getOfsZ()); buf.writeFloat(message.getData()); buf.writeInt(message.getCount()); for (int extData : message.getExtData()) { ByteBufUtils.writeVarInt(buf, extData); } return buf; }
Source:
public static boolean inRange(int value, int min, int max) { return (value <= max) & (value >= min); }

Target:
public static boolean inRange(int value, int min, int max) { return (value <= max) && (value >= min); }
Source:
public void cleanup() { myIdeFrame = null; myNavigationHelper.cleanup(); myNavigationHelper = null; myStateComponent = null; myTaskContext = null; }

Target:
public void cleanup() { myNavigationHelper.cleanup(); }
Source:
protected void executeIrsBrokerCommand() { storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId()); setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); String imageInitSize = null; if (getParameters().getImageInitialSizeInBytes() != 0) { imageInitSize = Long.valueOf(getParameters().getImageInitialSizeInBytes()).toString(); } String diskType = FeatureSupported.isContentTypeSupported(getParameters().getCompatibilityVersion()) ? getParameters().getDiskContentType().getStorageValue() : DiskContentType.LEGACY_DISK_TYPE; uuidReturn = getIrsProxy().createVolume( getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), diskType, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), Guid.Empty.toString(), Guid.Empty.toString(), imageInitSize); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.uuid); createdImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(createdImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters() .getStoragePoolId())); }

Target:
protected void executeIrsBrokerCommand() { storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId()); setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); String imageInitSize = null; if (getParameters().getImageInitialSizeInBytes() != 0) { imageInitSize = Long.valueOf(getParameters().getImageInitialSizeInBytes()).toString(); } String diskType = FeatureSupported.isContentTypeSupported(getParameters().getPoolCompatibilityVersion()) ? getParameters().getDiskContentType().getStorageValue() : DiskContentType.LEGACY_DISK_TYPE; uuidReturn = getIrsProxy().createVolume( getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), diskType, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), Guid.Empty.toString(), Guid.Empty.toString(), imageInitSize); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.uuid); createdImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(createdImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters() .getStoragePoolId())); }
Source:
public OSMMaxAxleLoadParser() { this.maxAxleLoadEncoder = MaxAxleLoad.create(); }

Target:
public OSMMaxAxleLoadParser() { this(MaxAxleLoad.create()); }
Source:
protected RemoteOperationResult run(WebdavClient client) { PropFindMethod propfind = null; RemoteOperationResult result = null; try { propfind = new PropFindMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath), DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_0); int status; status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT); boolean isMultiStatus = status == HttpStatus.SC_MULTI_STATUS; if (isMultiStatus) { MultiStatus resp = propfind.getResponseBodyAsMultiStatus(); result = new RemoteOperationResult(true, status, propfind.getResponseHeaders()); if (result.isSuccess()) { WebdavEntry we = new WebdavEntry(resp.getResponses()[0], client.getBaseUri().getPath()); RemoteFile remoteFile = FileUtils.fillOCFile(we); ArrayList<RemoteFile> files = new ArrayList<RemoteFile>(); files.add(remoteFile); result.setData(files); } } else { client.exhaustResponse(propfind.getResponseBodyAsStream()); result = new RemoteOperationResult(false, status, propfind.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); e.printStackTrace(); Log.e(TAG, "Synchronizing file " + mRemotePath + ": " + result.getLogMessage(), result.getException()); } finally { if (propfind != null) propfind.releaseConnection(); } return result; }

Target:
protected RemoteOperationResult run(WebdavClient client) { PropFindMethod propfind = null; RemoteOperationResult result = null; try { propfind = new PropFindMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath), DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_0); int status; status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT); boolean isMultiStatus = status == HttpStatus.SC_MULTI_STATUS; if (isMultiStatus) { MultiStatus resp = propfind.getResponseBodyAsMultiStatus(); WebdavEntry we = new WebdavEntry(resp.getResponses()[0], client.getBaseUri().getPath()); RemoteFile remoteFile = new RemoteFile(we); ArrayList<RemoteFile> files = new ArrayList<RemoteFile>(); files.add(remoteFile); result = new RemoteOperationResult(true, status, propfind.getResponseHeaders()); result.setData(files); } else { client.exhaustResponse(propfind.getResponseBodyAsStream()); result = new RemoteOperationResult(false, status, propfind.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); e.printStackTrace(); Log.e(TAG, "Synchronizing file " + mRemotePath + ": " + result.getLogMessage(), result.getException()); } finally { if (propfind != null) propfind.releaseConnection(); } return result; }
Source:
public static File unzip( Class<?> testClass, String resource, File targetDirectory ) throws IOException { InputStream source = testClass.getResourceAsStream( resource ); if ( source == null ) { throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" ); } try { try ( ZipInputStream zipStream = new ZipInputStream( source ) ) { ZipEntry entry; byte[] scratch = new byte[8096]; while ( (entry = zipStream.getNextEntry()) != null ) { if ( entry.isDirectory() ) { new File( targetDirectory, entry.getName() ).mkdirs(); } else { try ( OutputStream file = new BufferedOutputStream( new FileOutputStream( new File( targetDirectory, entry.getName() ) ) ) ) { long toCopy = entry.getSize(); while ( toCopy > 0 ) { int read = zipStream.read( scratch ); file.write( scratch, 0, read ); toCopy -= read; } } } zipStream.closeEntry(); } } } finally { source.close(); } return targetDirectory; }

Target:
public static File unzip( Class<?> testClass, String resource, File targetDirectory ) throws IOException { InputStream source = testClass.getResourceAsStream( resource ); if ( source == null ) { throw new FileNotFoundException( "Could not find resource '" + resource + "' to unzip" ); } try ( ZipInputStream zipStream = new ZipInputStream( source ) ) { ZipEntry entry; byte[] scratch = new byte[8096]; while ( (entry = zipStream.getNextEntry()) != null ) { if ( entry.isDirectory() ) { new File( targetDirectory, entry.getName() ).mkdirs(); } else { try ( OutputStream file = new BufferedOutputStream( new FileOutputStream( new File( targetDirectory, entry.getName() ) ) ) ) { long toCopy = entry.getSize(); while ( toCopy > 0 ) { int read = zipStream.read( scratch ); file.write( scratch, 0, read ); toCopy -= read; } } } zipStream.closeEntry(); } } finally { source.close(); } return targetDirectory; }
Source:
private void providers_SelectedItemChanged() { Provider provider = (Provider) getProviders().getSelectedItem(); if (provider != null ) { AsyncQuery getHostsQuery = new AsyncQuery(); getHostsQuery.setModel(this); getHostsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { ArrayList<VDS> hosts = (ArrayList<VDS>) result; ListModel hostNameListModel = getExternalHostName(); hosts.add(0, null); hostNameListModel.setItems(hosts); hostNameListModel.setIsChangable(true); } }; AsyncDataProvider.GetExternalProviderHostList(getHostsQuery, provider.getId(), true); } else { getExternalHostName().setItems(null); getExternalHostName().setIsChangable(false); } }

Target:
private void providers_SelectedItemChanged() { Provider provider = (Provider) getProviders().getSelectedItem(); if (provider != null ) { AsyncQuery getHostsQuery = new AsyncQuery(); getHostsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { ArrayList<VDS> hosts = (ArrayList<VDS>) result; ListModel hostNameListModel = getExternalHostName(); hosts.add(0, null); hostNameListModel.setItems(hosts); hostNameListModel.setIsChangable(true); } }; AsyncDataProvider.GetExternalProviderHostList(getHostsQuery, provider.getId(), true); } else { getExternalHostName().setItems(null); getExternalHostName().setIsChangable(false); } }
Source:
public ContextMenu getContextMenu() { return chatUserContextMenuRoot; }

Target:
ContextMenu getContextMenu() { return chatUserContextMenuRoot; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (WikipediaApp) getActivity().getApplicationContext(); model = new PageViewModel(); if (Prefs.isExperimentalPageLoadEnabled()) { pageLoadStrategy = new HtmlPageLoadStrategy(); } else { pageLoadStrategy = new JsonPageLoadStrategy(); } dailyEventTask = new DailyEventTask(getActivity()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (WikipediaApp) getActivity().getApplicationContext(); model = new PageViewModel(); if (Prefs.isExperimentalPageLoadEnabled()) { pageLoadStrategy = new HtmlPageLoadStrategy(); } else { pageLoadStrategy = new JsonPageLoadStrategy(); } }
Source:
public static File mkdirs(File dir) { if (dir.isDirectory()) return dir; boolean success = dir.mkdirs(); if (!success) { if (dir.isDirectory()) return dir; throw Exceptions.propagate(new IOException("Failed to create directory " + dir + (dir.isFile() ? "(is file)" : ""))); } return dir; }

Target:
public static File mkdirs(File dir) { dir.mkdirs(); if (dir.isDirectory()) { return dir; } throw Exceptions.propagate(new IOException("Failed to create directory " + dir + (dir.isFile() ? "(is file)" : ""))); }
Source:
public static void remoteFileDownload(ILaunchConfiguration config, ILaunch launch, String localExePath, String remoteExePath, IProgressMonitor monitor) throws CoreException { boolean skipDownload = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false); if (skipDownload) return; monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100); try { IRemoteConnection conn = getCurrentConnection(config); IRemoteFileService fs = conn.getService(IRemoteFileService.class); IFileStore remoteFile = fs.getResource(remoteExePath); IFileSystem localfs = EFS.getLocalFileSystem(); IFileStore localFile = localfs.getStore(new Path(localExePath)); if (!localFile.fetchInfo().exists()) { return; } localFile.copy(remoteFile, EFS.OVERWRITE, monitor); IFileInfo remoteFileInfo = remoteFile.fetchInfo(); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, true); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, true); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, true); remoteFile.putInfo(remoteFileInfo, EFS.SET_ATTRIBUTES, null); } catch (CoreException e) { abort(Messages.RemoteRunLaunchDelegate_6, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } finally { monitor.done(); } }

Target:
public static void remoteFileDownload(ILaunchConfiguration config, ILaunch launch, String localExePath, String remoteExePath, IProgressMonitor monitor) throws CoreException { boolean skipDownload = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false); if (skipDownload) { return; } SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.RemoteRunLaunchDelegate_2, 100); try { IRemoteConnection conn = getCurrentConnection(config); IRemoteFileService fs = conn.getService(IRemoteFileService.class); IFileStore remoteFile = fs.getResource(remoteExePath); IFileSystem localfs = EFS.getLocalFileSystem(); IFileStore localFile = localfs.getStore(new Path(localExePath)); if (!localFile.fetchInfo().exists()) { return; } localFile.copy(remoteFile, EFS.OVERWRITE, subMonitor.split(95)); IFileInfo remoteFileInfo = remoteFile.fetchInfo(); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, true); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, true); remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, true); remoteFile.putInfo(remoteFileInfo, EFS.SET_ATTRIBUTES, subMonitor.split(5)); } catch (CoreException e) { abort(Messages.RemoteRunLaunchDelegate_6, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } finally { monitor.done(); } }
Source:
private ContentRange(long from, long to) { this.from = from; this.to = to; }

Target:
private ContentRange(long from, long to) { checkArgument(from < to, "\"from\" should be lower than \"to\""); checkArgument(from >= 0 && to > 0, "\"from\" cannot be negative and \"to\" has to be positive"); this.from = from; this.to = to; }
Source:
private KafkaConsumer<byte[], byte[]> getKafkaConsumer() { final Map<String, Object> consumerConfigs = KafkaConsumerConfigs.getConsumerProperties(); final Properties props = new Properties(); props.putAll(consumerConfigs); addConsumerPropertiesFromConfig(props, sortingMapper, consumerProperties); ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return new KafkaConsumer<>(props, new ByteArrayDeserializer(), new ByteArrayDeserializer()); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }

Target:
private KafkaConsumer<byte[], byte[]> getKafkaConsumer() { final Map<String, Object> consumerConfigs = KafkaConsumerConfigs.getConsumerProperties(); final Properties props = new Properties(); addConsumerPropertiesFromConfig(props, sortingMapper, consumerProperties); props.putAll(consumerConfigs); ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return new KafkaConsumer<>(props, new ByteArrayDeserializer(), new ByteArrayDeserializer()); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }
Source:
private static String make(final String previous, final CharSequence name, final CharSequence value, final CharSequence... attrs) { final StringBuilder text = new StringBuilder(); if (!previous.isEmpty()) { text.append(String.format("%s,", previous)); } text.append( String.format("%s=%s", name, value) ); for (final CharSequence attr : attrs) { text.append(';').append(attr); } return text.toString(); }

Target:
private static String make(final String previous, final CharSequence name, final CharSequence value, final CharSequence... attrs) throws IOException { final StringBuilder text = new StringBuilder(); if (!previous.isEmpty()) { text.append(String.format("%s,", previous)); } text.append(String.format("%s=%s", name, value)); for (final CharSequence attr : attrs) { text.append(';').append(attr); } return text.toString(); }
Source:
public InputVDir getInputVDir(@Nonnull VPath path) throws NotFileOrDirectoryException, NoSuchFileException { File file = new File(dir, path.getPathAsString(File.separatorChar)); if (!file.exists()) { throw new NoSuchFileException(new FileLocation(file)); } if (!file.isFile()) { throw new NotFileOrDirectoryException(new FileLocation(file)); } return new InputOutputZipVDir(file, zipFile, new ZipEntry(path.getPathAsString('/'))); }

Target:
public InputVDir getInputVDir(@Nonnull VPath path) throws NotFileOrDirectoryException, NoSuchFileException { File file = new File(dir, path.getPathAsString(File.separatorChar)); if (!file.exists()) { throw new NoSuchFileException(new FileLocation(file)); } if (!file.isFile()) { throw new NotFileOrDirectoryException(new FileLocation(file)); } return new InputOutputZipVDir(file, zipFile, new ZipEntry(path.getPathAsString(ZIP_ENTRY_SEPARATOR))); }
Source:
public PostIngestConsumer(CatalogEndpoint endpoint, Processor processor) { super(endpoint, processor); this.endpoint = endpoint; Integer threadPoolSize = Integer.parseInt( System.getProperty( "org.codice.ddf.system.threadPoolSize", String.valueOf(THREAD_POOL_DEFAULT_SIZE))); blockingQueue = new LinkedBlockingQueue<>(); threadExecutor = new ThreadPoolExecutor( THREAD_POOL_DEFAULT_SIZE, threadPoolSize, TimeUnit.MINUTES.toMillis(30), TimeUnit.MILLISECONDS, blockingQueue, StandardThreadFactoryBuilder.newThreadFactory("postIngestConsumerThread")); }

Target:
public PostIngestConsumer(CatalogEndpoint endpoint, Processor processor) { super(endpoint, processor); this.endpoint = endpoint; Integer threadPoolSize; try { threadPoolSize = Integer.parseInt( System.getProperty( "org.codice.ddf.system.threadPoolSize", String.valueOf(THREAD_POOL_DEFAULT_SIZE))); } catch (NumberFormatException nfe) { threadPoolSize = THREAD_POOL_DEFAULT_SIZE; } threadExecutor = new ThreadPoolExecutor( THREAD_POOL_DEFAULT_SIZE, threadPoolSize, TimeUnit.MINUTES.toMillis(30), TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), StandardThreadFactoryBuilder.newThreadFactory("postIngestConsumerThread")); }
Source:
protected void beforeExecute(Thread t, Runnable r) { try { JobDetail jobDetails = exposeJobDetails(r); Optional.ofNullable(jobDetails).ifPresent(this::bootstrapCronJobContext); } catch (Exception e) { LOGGER.error("Before execute failed for [{}]", r, e); } }

Target:
protected void beforeExecute(Thread t, Runnable r) { try { JobDetail jobDetails = exposeJobDetails(r); Optional.ofNullable(jobDetails).ifPresent(this::bootstrapCronJobContext); } catch (Exception e) { logger.error("Before execute failed for [{}]", r, e); } }
Source:
public void testListProjectsOnExternalStorage() throws IOException { File backpackFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "backpack"); assertTrue(backpackFolder.mkdirs()); File tempFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, Constants.TMP_DIR_NAME); assertTrue(tempFolder.mkdirs()); File projectFolder1 = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "projectFolder1"); assertTrue(projectFolder1.mkdirs()); assertTrue(new File(projectFolder1, Constants.CODE_XML_FILE_NAME).createNewFile()); File projectFolder2 = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "projectFolder2"); assertTrue(projectFolder2.mkdirs()); assertTrue(new File(projectFolder2, Constants.CODE_XML_FILE_NAME).createNewFile()); File someFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "someFolder"); assertTrue(someFolder.mkdirs()); List<File> projectFiles = ListProjectFilesTask .task(tmpFolder); assertThat(projectFiles, hasItem(projectFolder1)); assertThat(projectFiles, hasItem(projectFolder2)); assertThat(projectFiles, not(hasItem(backpackFolder))); assertThat(projectFiles, not(hasItem(tempFolder))); assertThat(projectFiles, not(hasItem(someFolder))); }

Target:
public void testListProjectsOnExternalStorage() throws IOException { File backpackFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "backpack"); assertTrue(backpackFolder.mkdirs()); File tempFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, TMP_DIR_NAME); assertTrue(tempFolder.mkdirs()); File projectFolder1 = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "projectFolder1"); assertTrue(projectFolder1.mkdirs()); assertTrue(new File(projectFolder1, CODE_XML_FILE_NAME).createNewFile()); File projectFolder2 = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "projectFolder2"); assertTrue(projectFolder2.mkdirs()); assertTrue(new File(projectFolder2, CODE_XML_FILE_NAME).createNewFile()); File someFolder = new File(EXTERNAL_STORAGE_ROOT_DIRECTORY, "someFolder"); assertTrue(someFolder.mkdirs()); List<File> projectFiles = ListProjectFilesTask .task(tmpFolder); assertThat(projectFiles, hasItem(projectFolder1)); assertThat(projectFiles, hasItem(projectFolder2)); assertThat(projectFiles, not(hasItem(backpackFolder))); assertThat(projectFiles, not(hasItem(tempFolder))); assertThat(projectFiles, not(hasItem(someFolder))); }
Source:
public static <R, F> R loadAndInvokeFactory(final Class<F> factoryInterface, final FactoryInvoker<F, R> factoryInvoker, final Supplier<F> defaultProvider) { final ServiceLoader<F> factories = ServiceLoader.load(factoryInterface); final List<R> instantiatedResources = new ArrayList<>(); final List<Exception> errorsDuringInitialization = new ArrayList<>(); for (F factory : factories) { try { R resource = factoryInvoker.invoke(factory); instantiatedResources.add(resource); LOG.info("Instantiated {}.", resource.getClass().getSimpleName()); } catch (Exception e) { LOG.debug("Factory could not instantiate instance.", factory.getClass().getSimpleName(), e); errorsDuringInitialization.add(e); } } if (instantiatedResources.size() == 1) { return instantiatedResources.get(0); } if (instantiatedResources.isEmpty()) { try { return factoryInvoker.invoke(defaultProvider.get()); } catch (Exception e) { final RuntimeException exception = new RuntimeException("Could not instantiate instance."); errorsDuringInitialization.forEach(exception::addSuppressed); throw exception; } } throw new RuntimeException("Multiple instances were created: " + instantiatedResources); }

Target:
public static <R, F> R loadAndInvokeFactory(final Class<F> factoryInterface, final FactoryInvoker<F, R> factoryInvoker, final Supplier<F> defaultProvider) { final ServiceLoader<F> factories = ServiceLoader.load(factoryInterface); final List<R> instantiatedResources = new ArrayList<>(); final List<Exception> errorsDuringInitialization = new ArrayList<>(); for (F factory : factories) { try { R resource = factoryInvoker.invoke(factory); instantiatedResources.add(resource); LOG.info("Instantiated {}.", resource.getClass().getSimpleName()); } catch (Exception e) { LOG.debug("Factory could not instantiate instance.", factory.getClass().getSimpleName(), e); errorsDuringInitialization.add(e); } } if (instantiatedResources.size() == 1) { return instantiatedResources.get(0); } if (instantiatedResources.isEmpty()) { try { return factoryInvoker.invoke(defaultProvider.get()); } catch (Exception e) { final RuntimeException exception = new RuntimeException("Could not instantiate any instance."); final RuntimeException defaultException = new RuntimeException("Could not instantiate default instance.", e); exception.addSuppressed(defaultException); errorsDuringInitialization.forEach(exception::addSuppressed); throw exception; } } throw new RuntimeException("Multiple instances were created: " + instantiatedResources); }
Source:
public static void registerEnchantment(String name, Enchantment enchantment) { if(ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name)) return; ENCHANTMENTS.put(name, enchantment); }

Target:
public static void registerEnchantment(String name, Enchantment enchantment) { if (ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name)) { return; } ENCHANTMENTS.put(name, enchantment); }
Source:
private JSONObject getFilteredStatsForRollup(Rollup rollup, Set<MetricStat> filterStats) { final JSONObject filteredObject = new JSONObject(); for (MetricStat stat : filterStats) { try { Object filteredValue = stat.convertRollupToObject(rollup); if (filteredValue instanceof Map && stat == MetricStat.PERCENTILE) { for (Map.Entry entry : ((Map<?,?>)filteredValue).entrySet()) { BluefloodTimerRollup.Percentile pct = (BluefloodTimerRollup.Percentile)entry.getValue(); filteredObject.put(String.format("pct_%s", entry.getKey().toString()), pct.getMean()); } } else { filteredObject.put(stat.toString(), filteredValue); } } catch (UnsupportedOperationException ex) { log.warn(ex.getMessage()); } } return filteredObject; }

Target:
private JSONObject getFilteredStatsForRollup(Rollup rollup, Set<MetricStat> filterStats) { final JSONObject filteredObject = new JSONObject(); for (MetricStat stat : filterStats) { try { Object filteredValue = stat.convertRollupToObject(rollup); if (filteredValue instanceof Map && stat == MetricStat.PERCENTILE) { for (Map.Entry entry : ((Map<?,?>)filteredValue).entrySet()) { BluefloodTimerRollup.Percentile pct = (BluefloodTimerRollup.Percentile)entry.getValue(); filteredObject.put(String.format("pct_%s", entry.getKey().toString()), pct.getMean()); } } else { filteredObject.put(stat.toString(), filteredValue); } } catch (UnsupportedOperationException ex) { log.debug(ex.toString()); } } return filteredObject; }
Source:
private Polyline createBorder() { PointCollection points = new PointCollection(SpatialReferences.getWebMercator()); points.add(new Point(-9981328.687124, 6111053.281447)); points.add(new Point(-9946518.044066, 6102350.620682)); points.add(new Point(-9872545.427566, 6152390.920079)); points.add(new Point(-9838822.617103, 6157830.083057)); points.add(new Point(-9446115.050097, 5927209.572793)); points.add(new Point(-9430885.393759, 5876081.440801)); points.add(new Point(-9415655.737420, 5860851.784463)); return new Polyline(points); }

Target:
private static Polyline createBorder() { PointCollection points = new PointCollection(SpatialReferences.getWebMercator()); points.add(new Point(-9981328.687124, 6111053.281447)); points.add(new Point(-9946518.044066, 6102350.620682)); points.add(new Point(-9872545.427566, 6152390.920079)); points.add(new Point(-9838822.617103, 6157830.083057)); points.add(new Point(-9446115.050097, 5927209.572793)); points.add(new Point(-9430885.393759, 5876081.440801)); points.add(new Point(-9415655.737420, 5860851.784463)); return new Polyline(points); }
Source:
public Community[] getSubcommunities() throws SQLException { List<Community> subcommunities = new ArrayList<Community>(); TableRowIterator tri = null; try { String query = "SELECT c.* FROM community2community c2c, community c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.community_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "WHERE c2c.child_comm_id=c.community_id " + "AND c2c.parent_comm_id= ? "; if("oracle".equals(ConfigurationManager.getProperty("db.name"))){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query( ourContext, query, Constants.COMMUNITY, MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), getID() ); } catch (SQLException e) { log.error("Find all Sub Communities - ",e); throw e; } try { while (tri.hasNext()) { TableRow row = tri.next(); Community fromCache = (Community) ourContext.fromCache( Community.class, row.getIntColumn("community_id")); if (fromCache != null) { subcommunities.add(fromCache); } else { subcommunities.add(new Community(ourContext, row)); } } } finally { if (tri != null) { tri.close(); } } Community[] communityArray = new Community[subcommunities.size()]; communityArray = (Community[]) subcommunities.toArray(communityArray); return communityArray; }

Target:
public Community[] getSubcommunities() throws SQLException { List<Community> subcommunities = new ArrayList<Community>(); TableRowIterator tri = null; try { String query = "SELECT c.* FROM community2community c2c, community c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.community_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "WHERE c2c.child_comm_id=c.community_id " + "AND c2c.parent_comm_id= ? "; if(DatabaseManager.isOracle()){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query( ourContext, query, Constants.COMMUNITY, MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), getID() ); } catch (SQLException e) { log.error("Find all Sub Communities - ",e); throw e; } try { while (tri.hasNext()) { TableRow row = tri.next(); Community fromCache = (Community) ourContext.fromCache( Community.class, row.getIntColumn("community_id")); if (fromCache != null) { subcommunities.add(fromCache); } else { subcommunities.add(new Community(ourContext, row)); } } } finally { if (tri != null) { tri.close(); } } Community[] communityArray = new Community[subcommunities.size()]; communityArray = (Community[]) subcommunities.toArray(communityArray); return communityArray; }
Source:
public Cohort addMembershipToCohort(Cohort cohort, CohortMembership cohortMembership) throws APIException { if (!cohort.contains(cohortMembership)) { ValidateUtil.validate(cohortMembership); cohort.addMembership(cohortMembership); Context.getCohortService().saveCohort(cohort); } return cohort; }

Target:
public Cohort addMembershipToCohort(Cohort cohort, CohortMembership cohortMembership) throws APIException { cohort.addMembership(cohortMembership); Context.getCohortService().saveCohort(cohort); return cohort; }
Source:
public void processMessage(final ProtocolRequestMessage message) throws FunctionalException { try { final Device device = this.domainHelperService.findDevice(message.getDeviceIdentification()); final ProtocolInfo protocolInfo; if (device.getGatewayDevice() == null) { protocolInfo = device.getProtocolInfo(); } else { protocolInfo = device.getGatewayDevice().getProtocolInfo(); } if (protocolInfo == null || !this.protocolRequestService.isSupported(protocolInfo)) { final String msg = "Protocol unknown for device [" + device.getDeviceIdentification() + "]"; LOGGER.error(msg); throw new FunctionalException(FunctionalExceptionType.PROTOCOL_UNKNOWN_FOR_DEVICE, ComponentType.OSGP_CORE); } LOGGER.info("Device is using protocol with version [{}]", protocolInfo.getProtocol(), protocolInfo.getProtocolVersion()); final Organisation organisation = this.domainHelperService.findOrganisation(message .getOrganisationIdentification()); this.domainHelperService.isAllowed(organisation, device, Enum.valueOf(DeviceFunction.class, message.getMessageType())); this.protocolRequestService.send(message, protocolInfo); } catch (final FunctionalException e) { this.domainResponseMessageSender.send(message, e); throw e; } }

Target:
public void processMessage(final ProtocolRequestMessage message) throws FunctionalException { try { final Device device = this.domainHelperService.findDevice(message.getDeviceIdentification()); final ProtocolInfo protocolInfo; if (device.getGatewayDevice() == null) { protocolInfo = device.getProtocolInfo(); } else { protocolInfo = device.getGatewayDevice().getProtocolInfo(); } if (protocolInfo == null || !this.protocolRequestService.isSupported(protocolInfo)) { if (protocolInfo == null) { LOGGER.error("Protocol unknown for device [{}]", device.getDeviceIdentification()); } else { LOGGER.error("Protocol with version unknown for device [{}], needs to be reloaded.", protocolInfo.getProtocol(), protocolInfo.getProtocolVersion(), device.getDeviceIdentification()); } throw new FunctionalException(FunctionalExceptionType.PROTOCOL_UNKNOWN_FOR_DEVICE, ComponentType.OSGP_CORE); } LOGGER.info("Device is using protocol with version [{}]", protocolInfo.getProtocol(), protocolInfo.getProtocolVersion()); final Organisation organisation = this.domainHelperService.findOrganisation(message .getOrganisationIdentification()); this.domainHelperService.isAllowed(organisation, device, Enum.valueOf(DeviceFunction.class, message.getMessageType())); this.protocolRequestService.send(message, protocolInfo); } catch (final FunctionalException e) { this.domainResponseMessageSender.send(message, e); throw e; } }
Source:
private TransactionTable getTransactionTable(TransactionMode transactionMode) { switch (transactionMode) { case NON_XA: return syncTransactionTable; case NON_DURABLE_XA: return xaTransactionTable; case FULL_XA: default: throw new IllegalArgumentException("XA isn't supported yet!"); } }

Target:
private TransactionTable getTransactionTable(TransactionMode transactionMode) { switch (transactionMode) { case NON_XA: return syncTransactionTable; case NON_DURABLE_XA: return xaTransactionTable; case FULL_XA: default: throw new IllegalArgumentException("FULL_XA isn't supported yet!"); } }
Source:
public void correctlyKeepsOldWarrantCitations(){ Court COURT = new Court(); COURT.citation_expires_after_days = 3; Citation CITATION = new Citation(); CITATION.id = 3; CITATION.court_id = new HashableEntity<Court>(Court.class,4L); Violation VIOLATION = new Violation(); VIOLATION.warrant_status = true; List<Violation> VIOLATIONS = Lists.newArrayList(VIOLATION); CITATION.violations = VIOLATIONS; String courtDateString = "09/10/2016 14:33"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm"); CITATION.court_dateTime = LocalDateTime.parse(courtDateString, formatter); List<Citation> CITATIONS = Lists.newArrayList(CITATION); when(courtManagerMock.getCourtById(CITATION.court_id.getValue())).thenReturn(COURT); assertThat(citationFilter.RemoveCitationsWithExpiredDates(CITATIONS).size(), is(1)); }

Target:
public void correctlyKeepsOldWarrantCitations(){ Court COURT = new Court(); COURT.citation_expires_after_days = 3; Citation CITATION = new Citation(); CITATION.id = 3; CITATION.court_id = new HashableEntity<Court>(Court.class,4L); Violation VIOLATION = new Violation(); VIOLATION.warrant_status = true; List<Violation> VIOLATIONS = Lists.newArrayList(VIOLATION); CITATION.violations = VIOLATIONS; String courtDateString = "09/10/2016 14:33"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm"); CITATION.court_dateTime = LocalDateTime.parse(courtDateString, formatter); List<Citation> CITATIONS = Lists.newArrayList(CITATION); when(courtManagerMock.getCourtById(CITATION.court_id.getValue())).thenReturn(COURT); assertThat(citationFilter.Filter(CITATIONS).size(), is(1)); }
Source:
protected ImmutableValue<List<Text>> constructImmutableValue(List<Text> value) { return new ImmutableSpongeValue<List<Text>>(Keys.ITEM_LORE, value); }

Target:
protected ImmutableValue<List<Text>> constructImmutableValue(List<Text> value) { return new ImmutableSpongeListValue<Text>(Keys.ITEM_LORE, ImmutableList.copyOf(value)); }
Source:
public Expression visitLeave(JsonSingleKeySearchParseNode node, List<Expression> children) throws SQLException { ParseNode rhsNode = node.getChildren().get(1); Expression lhs = children.get(0); if (rhsNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)rhsNode, lhs); } if(!(PJson.INSTANCE.isComparableTo(children.get(0).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } if(!(PVarchar.INSTANCE.isComparableTo(children.get(1).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } Expression expression = new JsonSingleKeySearchExpression(children); return wrapGroupByExpression(expression); }

Target:
public Expression visitLeave(JsonSingleKeySearchParseNode node, List<Expression> children) throws SQLException { if(!(PJson.INSTANCE.isComparableTo(children.get(0).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } if(!(PVarchar.INSTANCE.isComparableTo(children.get(1).getDataType()))){ throw TypeMismatchException.newException(children.get(0).getDataType(), children.get(1).getDataType()); } Expression expression = new JsonSingleKeySearchExpression(children); return wrapGroupByExpression(expression); }