auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onListItemClick(ListView listView, View view, int i, long l) { final Weapon weapon = ((WeaponStatsAdapter) listView.getAdapter()).getItem(i); final Bundle dataToPass = getArgumentsBundle(); dataToPass.putSerializable(WeaponDetailsFragment.INTENT_WEAPON, weapon); if (isSw720dp() || isSw600dp()) { final FragmentManager fragmentManager = getFragmentManager(); DialogFragment fragment = (DialogFragment) fragmentManager.findFragmentByTag(WeaponDetailsFragment.TAG); if (fragment == null) { fragment = (DialogFragment) FragmentFactory.get(FragmentFactory.Type.WEAPON_STATS_DETAILS, dataToPass); } fragment.show(fragmentManager, WeaponDetailsFragment.TAG); } else { final Intent intent = new Intent(getActivity(), SingleFragmentActivity.class); intent.putExtra(SingleFragmentActivity.INTENT_FRAGMENT_TYPE, FragmentFactory.Type.WEAPON_STATS_DETAILS.ordinal()); intent.putExtra(SingleFragmentActivity.INTENT_FRAGMENT_DATA, dataToPass); startActivity(intent); } }

Target:
public void onListItemClick(ListView listView, View view, int i, long l) { final Weapon weapon = ((WeaponStatsAdapter) listView.getAdapter()).getItem(i); final Bundle dataToPass = getArgumentsBundle(); dataToPass.putSerializable(WeaponDetailsFragment.INTENT_WEAPON, weapon); openDetailFragment(FragmentFactory.Type.WEAPON_STATS_DETAILS, dataToPass, WeaponDetailsFragment.TAG); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LinkdHopCriteria) { LinkdHopCriteria ref = (LinkdHopCriteria) obj; return ref.m_nodeId.equals(m_nodeId) && ref.getNamespace().equals(getNamespace()); } return false; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LinkdHopCriteria) { LinkdHopCriteria ref = (LinkdHopCriteria) obj; return Objects.equals(m_nodeId, ref.m_nodeId) && Objects.equals(m_namespace, ref.m_namespace); } return false; }
Source:
public void testViewFSOverloadSchemeWithoutAnyMountLinks() throws Exception { try (FileSystem fs = FileSystem.get(TEST_DIR.toPath().toUri(), conf)) { ViewFileSystemOverloadScheme vfs = (ViewFileSystemOverloadScheme) fs; Assert.assertEquals(0, vfs.getMountPoints().length); Path testFallBack = new Path("test", FILE_NAME); Assert.assertTrue(vfs.mkdirs(testFallBack)); FileStatus[] status = vfs.listStatus(testFallBack.getParent()); Assert.assertEquals(FILE_NAME, status[0].getPath().getName()); Assert.assertEquals(testFallBack.getName(), vfs.getFileLinkStatus(testFallBack).getPath().getName()); } }

Target:
public void testViewFSOverloadSchemeWithoutAnyMountLinks() throws Exception { try (FileSystem fs = FileSystem.get(TEST_DIR.toPath().toUri(), conf)) { ViewFileSystemOverloadScheme vfs = (ViewFileSystemOverloadScheme) fs; assertEquals(0, vfs.getMountPoints().length); Path testFallBack = new Path("test", FILE_NAME); assertTrue(vfs.mkdirs(testFallBack)); FileStatus[] status = vfs.listStatus(testFallBack.getParent()); assertEquals(FILE_NAME, status[0].getPath().getName()); assertEquals(testFallBack.getName(), vfs.getFileLinkStatus(testFallBack).getPath().getName()); } }
Source:
private void checkInternetPermission() { PackageManager pm = mContext.getPackageManager(); if (PackageManager.PERMISSION_GRANTED != pm.checkPermission("android.permission.INTERNET", mContext.getPackageName())) { throw new IllegalArgumentException( "android.permission.INTERNET is not added to AndroidManifest file"); } }

Target:
private void checkInternetPermission() { PackageManager pm = mContext.getPackageManager(); if (PackageManager.PERMISSION_GRANTED != pm.checkPermission("android.permission.INTERNET", mContext.getPackageName())) { throw new AuthenticationException(ADALError.DEVELOPER_INTERNET_PERMISSION_MISSING); } }
Source:
protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); List<NetworkCluster> networkAttachments = getParameters().getNetworkClusterList(); boolean clusterAttachmentsSucceeded = true; if (networkAttachments != null) { clusterAttachmentsSucceeded = attachToClusters(networkAttachments).getSucceeded(); } Guid networkId = getNetwork().getId(); if (getNetwork().isVmNetwork() && !getNetwork().isExternal()) { runInternalAction(ActionType.AutodefineExternalNetwork, new IdParameters(networkId)); } getReturnValue().setActionReturnValue(clusterAttachmentsSucceeded ? networkId : null); setSucceeded(clusterAttachmentsSucceeded); }

Target:
protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); List<NetworkCluster> networkAttachments = getParameters().getNetworkClusterList(); if (networkAttachments != null) { ActionReturnValue attachToClustersResult = attachToClusters(networkAttachments); if (!attachToClustersResult.getSucceeded()) { propagateFailure(attachToClustersResult); return; } } runAutodefine(); getReturnValue().setActionReturnValue(getNetwork().getId()); setSucceeded(true); }
Source:
public CurveUnitParameterSensitivity mapSensitivity(DoubleUnaryOperator operator) { double[] updated = new double[sensitivity.length]; for (int i = 0; i < sensitivity.length; i++) { updated[i] = operator.applyAsDouble(sensitivity[i]); } return new CurveUnitParameterSensitivity(metadata, updated); }

Target:
public CurveUnitParameterSensitivity mapSensitivity(DoubleUnaryOperator operator) { return new CurveUnitParameterSensitivity(metadata, DoubleArrayMath.apply(sensitivity, operator)); }
Source:
public boolean canAppendRow() { final boolean countCheck = size() < maxRowCount; boolean sizeCheck = true; if (maxBytesInMemory != -1) { sizeCheck = sizeInBytes() < maxBytesInMemory; } final boolean canAdd = countCheck && sizeCheck; if (!countCheck) { outOfRowsReason = StringUtils.format("Maximum number of rows [%d] reached", maxRowCount); } if (!sizeCheck) { outOfRowsReason = StringUtils.format("Maximum size in bytes [%d] reached", maxBytesInMemory); } return canAdd; }

Target:
public boolean canAppendRow() { final boolean countCheck = size() < maxRowCount; final boolean sizeCheck = maxBytesInMemory <= 0 || getBytesInMemory() < maxBytesInMemory; final boolean canAdd = countCheck && sizeCheck; if (!countCheck && !sizeCheck) { outOfRowsReason = StringUtils.format( "Maximum number of rows [%d] and maximum size in bytes [%d] reached", maxRowCount, maxBytesInMemory ); } else { if (!countCheck) { outOfRowsReason = StringUtils.format("Maximum number of rows [%d] reached", maxRowCount); } else if (!sizeCheck) { outOfRowsReason = StringUtils.format("Maximum size in bytes [%d] reached", maxBytesInMemory); } } return canAdd; }
Source:
public void start() throws ReplicationException { try { for (String mountPath : mountPathToPartitionInfoList.keySet()) { retrieveReplicaTokensAndPersistIfNecessary(mountPath); } if (replicaThreadPoolByDc.size() == 0) { logger.warn("Number of Datacenters to replicate from is 0, not starting any replica threads"); return; } replicationMetrics.trackReplicationDisabledPartitions(replicaThreadPoolByDc); for (List<ReplicaThread> replicaThreads : replicaThreadPoolByDc.values()) { for (ReplicaThread thread : replicaThreads) { Thread replicaThread = Utils.newThread(thread.getName(), thread, false); logger.info("Starting replica thread " + thread.getName()); replicaThread.start(); } } if (persistor != null) { this.scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); } } catch (IOException e) { logger.error("IO error while starting replication", e); } }

Target:
public void start() throws ReplicationException { try { for (String mountPath : mountPathToPartitionInfos.keySet()) { retrieveReplicaTokensAndPersistIfNecessary(mountPath); } if (replicaThreadPoolByDc.size() == 0) { logger.warn("Number of Datacenters to replicate from is 0, not starting any replica threads"); return; } replicationMetrics.trackReplicationDisabledPartitions(replicaThreadPoolByDc); for (List<ReplicaThread> replicaThreads : replicaThreadPoolByDc.values()) { for (ReplicaThread thread : replicaThreads) { Thread replicaThread = Utils.newThread(thread.getName(), thread, false); logger.info("Starting replica thread " + thread.getName()); replicaThread.start(); } } if (persistor != null) { this.scheduler.scheduleAtFixedRate(persistor, replicationConfig.replicationTokenFlushDelaySeconds, replicationConfig.replicationTokenFlushIntervalSeconds, TimeUnit.SECONDS); } } catch (IOException e) { logger.error("IO error while starting replication", e); } }
Source:
String resolveFieldName(String solrFieldName) { String originalName = solrFieldName; boolean suffixExists = true; while (suffixExists) { suffixExists = false; for (String suffix : SchemaFields.SUFFIX_LIST) { if (originalName.endsWith(suffix)) { suffixExists = true; originalName = originalName.substring(0, originalName.indexOf(suffix)); } } } return originalName; }

Target:
String resolveFieldName(String solrFieldName) { int lastIndexOfUndercore = solrFieldName.lastIndexOf(FIRST_CHAR_OF_SUFFIX); if (lastIndexOfUndercore != -1) { return solrFieldName.substring(0, lastIndexOfUndercore); } return solrFieldName; }
Source:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { staticMapImageView = findViewById(R.id.static_map_imageview); createStaticImageButton = findViewById(R.id.create_static_image_button); mapStyleRadioGroup = findViewById(R.id.map_style_radio_group); mapStyleRadioGroup.setOnCheckedChangeListener(StaticImageActivity.this); createStaticImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mapStyleRadioGroup.getCheckedRadioButtonId() == -1) { Toast.makeText(StaticImageActivity.this, R.string.select_a_style, Toast.LENGTH_SHORT).show(); } else { Picasso.with(StaticImageActivity.this).load(takeSnapshot( mapboxMap.getCameraPosition().zoom, mapboxMap.getStyle().getUrl().equals("mapbox://styles/mapbox/dark-v9") ? StaticMapCriteria.DARK_STYLE : StaticMapCriteria.STREET_STYLE, mapboxMap.getCameraPosition().target, mapboxMap.getCameraPosition().bearing, mapboxMap.getCameraPosition().tilt, (int) MathUtils.clamp(findViewById(R.id.static_map_imageview).getMeasuredWidth(), 0, 1280), (int) MathUtils.clamp(findViewById(R.id.static_map_imageview).getMeasuredHeight(), 0, 1280)) .url().toString()).into(staticMapImageView); } } }); } }); }

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS); initViews(); }
Source:
protected static KeyManagerFactory buildKeyManagerFactory(File certChainFile, String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf, String keyStore) throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, IOException, CertificateException, KeyException, UnrecoverableKeyException { return buildKeyManagerFactory(toX509Certificates(certChainFile), keyAlgorithm, toPrivateKey(keyFile, keyPassword), keyPassword, kmf, keyStore); }

Target:
static KeyManagerFactory buildKeyManagerFactory(File certChainFile, String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf, String keyStore) throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, IOException, CertificateException, KeyException, UnrecoverableKeyException { return buildKeyManagerFactory(toX509Certificates(certChainFile), keyAlgorithm, toPrivateKey(keyFile, keyPassword), keyPassword, kmf, keyStore); }
Source:
public void run(String[] args) { Set<Param> allParams = getAllParams(); CommandLine cli = getCli(args, allParams); try { requiredOperations.forEach(operation -> { checkForMissingParams(cli, operation.requiredParams); operation.argsConsumer.accept(Args.from(cli, operation.requiredParams)); }); operations.forEach(operation -> { if (cli.hasOption(operation.param.shortCode)) { checkForMissingParams(cli, operation.requiredParams); if (operation.param.shortCode.equals("e")) { if (cli.hasOption("start")) checkForDateFormat(cli.getOptionValue("start")); if (cli.hasOption("end")) checkForDateFormat(cli.getOptionValue("end")); } operation.argsConsumer.accept(Args.from(cli, operation.getAllParams())); executedOperations.add(operation); } }); if (executedOperations.isEmpty()) otherwiseRunnables.forEach(Runnable::run); } catch (BriefcaseException e) { System.err.println("Error: " + e.message); log.error("Error", e); System.exit(1); } catch (Throwable t) { System.err.println("Briefcase unexpected error. Please review the logs and contact maintainers on the following URLs:"); System.err.println("\t<LINK_0>"); System.err.println("\t<LINK_1>"); log.error("Error", t); System.exit(1); } }

Target:
public void run(String[] args) { Set<Param> allParams = getAllParams(); CommandLine cli = getCli(args, allParams); try { requiredOperations.forEach(operation -> { checkForMissingParams(cli, operation.requiredParams); operation.argsConsumer.accept(Args.from(cli, operation.requiredParams)); }); operations.forEach(operation -> { if (cli.hasOption(operation.param.shortCode)) { checkForMissingParams(cli, operation.requiredParams); operation.argsConsumer.accept(Args.from(cli, operation.getAllParams())); executedOperations.add(operation); } }); if (executedOperations.isEmpty()) otherwiseRunnables.forEach(Runnable::run); } catch (BriefcaseException e) { System.err.println("Error: " + e.message); log.error("Error", e); System.exit(1); } catch (Throwable t) { System.err.println("Briefcase unexpected error. Please review the logs and contact maintainers on the following URLs:"); System.err.println("\t<LINK_0>"); System.err.println("\t<LINK_1>"); log.error("Error", t); System.exit(1); } }
Source:
public DeprecatedApiEntry getDeprecated( String reqApiVersion ) { if ( isBlank( reqApiVersion )) { return null; } Float reqVer; try { reqVer = Float.parseFloat( reqApiVersion ); } catch ( NumberFormatException e ) { logger.warn( "Unknown api version: {}", reqApiVersion ); return null; } for ( DeprecatedApiEntry et : deprecatedApis ) { if ( et.range != null && et.range.containsFloat( reqVer ) ) { return et; } } for ( DeprecatedApiEntry et : deprecatedApis ) { if ( et.endVersion != null && reqVer <= et.endVersion ) { return et; } } return null; }

Target:
public Optional<DeprecatedApiEntry> getDeprecated( String reqApiVersion ) { if ( isBlank( reqApiVersion )) { return empty(); } Float reqVer; try { reqVer = Float.parseFloat( reqApiVersion ); } catch ( NumberFormatException e ) { logger.warn( "Unknown api version: {}", reqApiVersion ); return empty(); } for ( DeprecatedApiEntry et : deprecatedApis ) { if ( et.range != null && et.range.containsFloat( reqVer ) ) { return of( et ); } } for ( DeprecatedApiEntry et : deprecatedApis ) { if ( et.endVersion != null && reqVer <= et.endVersion ) { return of( et ); } } return empty(); }
Source:
public void encode(ByteBuf buf) { buf.writeByte('*'); String[] commands = null; if (type.name().contains("$")) { commands = type.name().split("\\$"); } CommandArgs.IntegerArgument.writeInteger(buf, (commands == null ? 1 : commands.length) + (args != null ? args.count() : 0)); buf.writeBytes(CommandArgs.CRLF); if (commands != null) { for (String cmd : commands) { CommandArgs.BytesArgument.writeBytes(buf, cmd.getBytes(LettuceCharsets.ASCII)); } } else { CommandArgs.BytesArgument.writeBytes(buf, type.getBytes()); } if (args != null) { args.encode(buf); } }

Target:
public void encode(ByteBuf buf) { buf.writeByte('*'); CommandArgs.IntegerArgument.writeInteger(buf, 1 + (args != null ? args.count() : 0)); buf.writeBytes(CommandArgs.CRLF); CommandArgs.BytesArgument.writeBytes(buf, type.getBytes()); if (args != null) { args.encode(buf); } }
Source:
private static MultiValueMap<String, Object> extractFromRequest(HttpServletRequest request) throws IOException { MultiValueMap<String, Object> builder = new LinkedMultiValueMap<>(); Set<String> queryParams = findQueryParams(request); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { String key = entry.getKey(); if (!queryParams.contains(key)) { for (String value : entry.getValue()) { builder.add(entry.getKey(), value); } } } return builder; }

Target:
private static MultiValueMap<String, Object> extractFromRequest(HttpServletRequest request) throws IOException { MultiValueMap<String, Object> builder = new LinkedMultiValueMap<>(); Set<String> queryParams = findQueryParams(request); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { String key = entry.getKey(); if (!queryParams.contains(key)) { for (String value : entry.getValue()) { builder.add(key, value); } } } return builder; }
Source:
static LockRequest of(Set<LockDescriptor> lockDescriptors, long acquireTimeoutMs, String clientDescription) { return ImmutableLockRequestV2.of( UUID.randomUUID(), lockDescriptors, acquireTimeoutMs, Optional.of(clientDescription)); }

Target:
static LockRequest of(Set<LockDescriptor> lockDescriptors, long acquireTimeoutMs, String clientDescription) { return ImmutableLockRequest.of( UUID.randomUUID(), lockDescriptors, acquireTimeoutMs, Optional.of(clientDescription)); }
Source:
protected void assertResultEquals(Change expected, ChangeInfo actual) { assertEquals(expected.getId().get(), (int) actual._number); }

Target:
protected void assertResultEquals(Change expected, ChangeInfo actual) { assertEquals(expected.getId().get(), actual._number); }
Source:
private void updateBCSID(Container container, DispatcherContext dispatcherContext, ContainerProtos.Type cmdType) { long bcsID = container.getBlockCommitSequenceId(); long containerId = container.getContainerData().getContainerID(); Map<Long, Long> container2BCSIDMap; if (dispatcherContext != null && (cmdType == ContainerProtos.Type.PutBlock || cmdType == ContainerProtos.Type.PutSmallFile)) { container2BCSIDMap = dispatcherContext.getContainer2BCSIDMap(); Preconditions.checkNotNull(container2BCSIDMap); Preconditions.checkArgument(container2BCSIDMap.containsKey(containerId)); container2BCSIDMap.computeIfPresent(containerId, (u, v) -> v = bcsID); } }

Target:
private void updateBCSID(Container container, DispatcherContext dispatcherContext, ContainerProtos.Type cmdType) { if (dispatcherContext != null && (cmdType == ContainerProtos.Type.PutBlock || cmdType == ContainerProtos.Type.PutSmallFile)) { Preconditions.checkNotNull(container); long bcsID = container.getBlockCommitSequenceId(); long containerId = container.getContainerData().getContainerID(); Map<Long, Long> container2BCSIDMap; container2BCSIDMap = dispatcherContext.getContainer2BCSIDMap(); Preconditions.checkNotNull(container2BCSIDMap); Preconditions.checkArgument(container2BCSIDMap.containsKey(containerId)); container2BCSIDMap.computeIfPresent(containerId, (u, v) -> v = bcsID); } }
Source:
private void executeUnaryExpression(Tree tree) { ProgramState.Pop unstackUnary = programState.unstackValue(1); programState = unstackUnary.state; SymbolicValue unarySymbolicValue = constraintManager.createSymbolicValue(tree); unarySymbolicValue.computedFrom(unstackUnary.valuesAndSymbols); if (tree.is(Tree.Kind.POSTFIX_DECREMENT, Tree.Kind.POSTFIX_INCREMENT)) { ProgramState.SymbolicValueSymbol symbolicValueSymbol = unstackUnary.valuesAndSymbols.get(0); programState = programState.stackValue(symbolicValueSymbol.sv, symbolicValueSymbol.symbol); } else { programState = programState.stackValue(unarySymbolicValue); } if (tree.is(Tree.Kind.POSTFIX_DECREMENT, Tree.Kind.POSTFIX_INCREMENT, Tree.Kind.PREFIX_DECREMENT, Tree.Kind.PREFIX_INCREMENT)) { ExpressionTree expr = ExpressionUtils.skipParentheses(((UnaryExpressionTree) tree).expression()); Symbol symbol = null; if (expr.is(Tree.Kind.IDENTIFIER)) { symbol = ((IdentifierTree) expr).symbol(); } else if (expr.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mset = (MemberSelectExpressionTree) expr; symbol = ExpressionUtils.isSelectOnThisOrSuper(mset) ? mset.identifier().symbol() : null; } if (symbol != null) { programState = programState.put(symbol, unarySymbolicValue); } } }

Target:
private void executeUnaryExpression(Tree tree) { ProgramState.Pop unstackUnary = programState.unstackValue(1); programState = unstackUnary.state; SymbolicValue unarySymbolicValue = constraintManager.createSymbolicValue(tree); unarySymbolicValue.computedFrom(unstackUnary.valuesAndSymbols); ProgramState.SymbolicValueSymbol symbolicValueSymbol = unstackUnary.valuesAndSymbols.get(0); if (tree.is(Tree.Kind.POSTFIX_DECREMENT, Tree.Kind.POSTFIX_INCREMENT)) { programState = programState.stackValue(symbolicValueSymbol.sv, symbolicValueSymbol.symbol); } else { programState = programState.stackValue(unarySymbolicValue); } if (tree.is(Tree.Kind.POSTFIX_DECREMENT, Tree.Kind.POSTFIX_INCREMENT, Tree.Kind.PREFIX_DECREMENT, Tree.Kind.PREFIX_INCREMENT) && symbolicValueSymbol.symbol != null) { programState = programState.put(symbolicValueSymbol.symbol, unarySymbolicValue); } }
Source:
public void testMultipleEntryStore() { Cell cell1 = Cell.create(new byte[] {1, 2, 3}, new byte[] {4, 5, 6}); Cell cell2 = Cell.create(new byte[] {7, 8, 9}, new byte[] {4, 5, 6}); Cell cell3 = Cell.create(new byte[] {1, 2, 3}, new byte[] {7, 8, 9}); TableReference ref1 = TableReference.fromString("foo.bar"); TableReference ref2 = TableReference.fromString("foo.baz"); long timestamp1 = 10; long timestamp2 = 20; scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell2, ref1), timestamp1, 1000); scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell3, ref2), timestamp2, 1000); Assert.assertEquals( ImmutableList.of(ImmutableSortedMap.of( timestamp1, ImmutableMultimap.of(ref1, cell2), timestamp2, ImmutableMultimap.of(ref2, cell3, ref1, cell1))), getScrubQueue()); scrubStore.markCellsAsScrubbed(ImmutableMap.of( ref2, ImmutableMultimap.of(cell3, timestamp2), ref1, ImmutableMultimap.of(cell1, timestamp1)), 1000); Assert.assertEquals( ImmutableList.of(ImmutableSortedMap.of( timestamp1, ImmutableMultimap.of(ref1, cell2), timestamp2, ImmutableMultimap.of(ref1, cell1))), getScrubQueue()); }

Target:
public void testMultipleEntryStore() { Cell cell1 = Cell.create(new byte[] {1, 2, 3}, new byte[] {4, 5, 6}); Cell cell2 = Cell.create(new byte[] {7, 8, 9}, new byte[] {4, 5, 6}); Cell cell3 = Cell.create(new byte[] {1, 2, 3}, new byte[] {7, 8, 9}); TableReference ref1 = TableReference.fromString("foo.bar"); TableReference ref2 = TableReference.fromString("foo.baz"); long timestamp1 = 10; long timestamp2 = 20; scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell2, ref1), timestamp1, 1000); scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell3, ref2), timestamp2, 1000); Assert.assertEquals( ImmutableList.of(ImmutableSortedMap.of( timestamp1, ImmutableMultimap.of(ref1, cell2), timestamp2, ImmutableMultimap.of(ref2, cell3, ref1, cell1))), getScrubQueue()); scrubStore.markCellsAsScrubbed(ImmutableMap.of( ref2, ImmutableMultimap.of(cell3, timestamp2), ref1, ImmutableMultimap.of(cell1, timestamp1, cell1, timestamp2)), 1000); Assert.assertEquals( ImmutableList.of(ImmutableSortedMap.of( timestamp1, ImmutableMultimap.of(ref1, cell2))), getScrubQueue()); }
Source:
default Collection<ServerName> getRegionServers(boolean excludeDecommissionedRS) throws IOException { List<ServerName> allServers = getClusterMetrics(EnumSet.of(Option.SERVERS_NAME)).getServersName(); if (!excludeDecommissionedRS) { return allServers; } List<ServerName> decommissionedRegionServers = listDecommissionedRegionServers(); if (CollectionUtils.isNotEmpty(decommissionedRegionServers)) { allServers = new ArrayList<>(allServers); allServers.removeIf(decommissionedRegionServers::contains); return Collections.unmodifiableList(allServers); } return allServers; }

Target:
default Collection<ServerName> getRegionServers(boolean excludeDecommissionedRS) throws IOException { List<ServerName> allServers = getClusterMetrics(EnumSet.of(Option.SERVERS_NAME)).getServersName(); if (!excludeDecommissionedRS) { return allServers; } List<ServerName> decommissionedRegionServers = listDecommissionedRegionServers(); return allServers.stream() .filter(s -> !decommissionedRegionServers.contains(s)) .collect(ImmutableList.toImmutableList()); }
Source:
protected void packColumns() { if (fPackDone) { return; } TableColumn tableColumns[] = fTable.getColumns(); for (int i = 0; i < tableColumns.length; i++) { final TableColumn column = tableColumns[i]; final int headerWidth = column.getWidth(); column.pack(); if (i == 0) { column.setWidth(column.getWidth() + SEARCH_IMAGE.getBounds().width); } if (column.getWidth() < headerWidth) { column.setWidth(headerWidth); } } fPackDone = true; }

Target:
protected void packColumns() { if (fPackDone) { return; } boolean isLinux = System.getProperty("os.name").contains("Linux") ? true : false; TableColumn tableColumns[] = fTable.getColumns(); for (int i = 0; i < tableColumns.length; i++) { final TableColumn column = tableColumns[i]; final int headerWidth = column.getWidth(); column.pack(); if (isLinux && (i == 0)) { column.setWidth(column.getWidth() + SEARCH_IMAGE.getBounds().width); } if (column.getWidth() < headerWidth) { column.setWidth(headerWidth); } } fPackDone = true; }
Source:
public void testCheckWithNoMatchingMethodName() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(MatchXpathCheck.class); checkConfig.addAttribute("query", " + "@text='nonExistingMethod']]"); final String[] expected = {}; verify(checkConfig, getPath("InputMatchXpath.java"), expected); }

Target:
public void testCheckWithNoMatchingMethodName() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(MatchXpathCheck.class); checkConfig.addAttribute("query", " + "@text='nonExistingMethod']]"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMatchXpath.java"), expected); }
Source:
public boolean matches(Notification notification) { boolean matches = false; if (!notification.isTouch() && notification.getNotifier() instanceof EObject) { EObject eObject = (EObject) notification.getNotifier(); Option<DRepresentation> dRepresentationOption = new EObjectQuery(eObject).getRepresentation(); matches = dRepresentationOption.some() && dRepresentationOption.get() == dRepresentation; } return matches; }

Target:
public boolean matches(Notification notification) { boolean matches = false; if (!notification.isTouch()) { Object notifier = notification.getNotifier(); if (notifier instanceof EObject) { EObject eObject = (EObject) notifier; Option<DRepresentation> dRepresentationOption = new EObjectQuery(eObject).getRepresentation(); matches = dRepresentationOption.some() && dRepresentationOption.get() == dRepresentation; } } return matches; }
Source:
public BlobReadOptions getBlobReadInfo(StoreKey id) throws StoreException { IndexValue value = findKey(id); if (value == null) { throw new StoreException("id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } else if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { throw new StoreException("id " + id + " has been deleted in index " + dataDir, StoreErrorCodes.ID_Deleted); } else if (value.isExpired()) { throw new StoreException("id " + id + " has expired ttl in index " + dataDir, StoreErrorCodes.TTL_Expired); } return new BlobReadOptions(value.getOffset(), value.getSize(), value.getTimeToLiveInMs(), id); }

Target:
public BlobReadOptions getBlobReadInfo(StoreKey id) throws StoreException { IndexValue value = findKey(id); if (value == null) { throw new StoreException("Id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } else if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { throw new StoreException("Id " + id + " has been deleted in index " + dataDir, StoreErrorCodes.ID_Deleted); } else if (value.isExpired()) { throw new StoreException("Id " + id + " has expired ttl in index " + dataDir, StoreErrorCodes.TTL_Expired); } return new BlobReadOptions(value.getOffset(), value.getSize(), value.getTimeToLiveInMs(), id); }
Source:
private int load(Class<?> source) { if (isGroovyPresent() && GroovyBeanDefinitionSource.class.isAssignableFrom(source) && IS_XML_ENABLED) { GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source, GroovyBeanDefinitionSource.class); load(loader); } if (isEligible(source)) { this.annotatedReader.register(source); return 1; } return 0; }

Target:
private int load(Class<?> source) { if (isGroovyPresent() && GroovyBeanDefinitionSource.class.isAssignableFrom(source)) { GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source, GroovyBeanDefinitionSource.class); ((GroovyBeanDefinitionReader) this.groovyReader).beans(loader.getBeans()); } if (isEligible(source)) { this.annotatedReader.register(source); return 1; } return 0; }
Source:
public void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close KijiTableWriter instance %s in state %s.", this, oldState); mLayoutConsumerRegistration.close(); try { mHBClient.shutdown().join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } mTable.release(); }

Target:
public void close() throws IOException { final State oldState = mState.getAndSet(State.CLOSED); Preconditions.checkState(oldState == State.OPEN, "Cannot close KijiTableWriter instance %s in state %s.", this, oldState); mLayoutConsumerRegistration.close(); mTable.release(); }
Source:
public List<Container> refreshRepos(@QueryParam("user_id") Long userId) { List<Container> currentRepos = containerDAO.findByUserId(userId); List<Container> allRepos = new ArrayList<>(0); List<Token> tokens = tokenDAO.findByUserId(userId); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository?last_modified=true&public=false", token.getContent(), client); if (asString.isPresent()) { RepoList repos; try { repos = MAPPER.readValue(asString.get(), RepoList.class); allRepos.addAll(repos.getRepositories()); } catch (IOException ex) { Logger.getLogger(DockerRepoResource.class.getName()).log(Level.SEVERE, null, ex); } } } } for (Container newContainer : allRepos) { for (Container oldContainer : currentRepos) { if (newContainer.getName().equals(oldContainer.getName()) && newContainer.getNamespace().equals(oldContainer.getNamespace())) { System.out.println("container " + oldContainer.getId() + " is being updated ..."); oldContainer.update(newContainer); containerDAO.create(oldContainer); System.out.println("container " + oldContainer.getId() + " is updated"); } } } return currentRepos; }

Target:
public List<Container> refreshRepos(@QueryParam("user_id") Long userId) { List<Container> currentRepos = containerDAO.findByUserId(userId); List<Container> allRepos = new ArrayList<>(0); List<Token> tokens = tokenDAO.findByUserId(userId); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository?last_modified=true&public=false", token.getContent(), client); if (asString.isPresent()) { RepoList repos; try { repos = objectMapper.readValue(asString.get(), RepoList.class); allRepos.addAll(repos.getRepositories()); } catch (IOException ex) { LOG.info("Exception: " + ex); } } } } for (Container newContainer : allRepos) { for (Container oldContainer : currentRepos) { if (newContainer.getName().equals(oldContainer.getName()) && newContainer.getNamespace().equals(oldContainer.getNamespace())) { LOG.info("container " + oldContainer.getId() + " is being updated ..."); oldContainer.update(newContainer); containerDAO.create(oldContainer); LOG.info("container " + oldContainer.getId() + " is updated"); } } } return currentRepos; }
Source:
public boolean hasEmptyEccFields(Release release) { EccInformation eccInformation = release.getEccInformation(); return (eccInformation.getAL() == null || eccInformation.getAL().isEmpty()) && (eccInformation.getECCN() == null || eccInformation.getECCN().isEmpty()) && (eccInformation.getEccStatus() == null || eccInformation.getEccStatus() == ECCStatus.OPEN); }

Target:
public boolean hasEmptyEccFields(Release release) { EccInformation eccInformation = release.getEccInformation(); return isNullEmptyOrWhitespace(eccInformation.getAL()) && isNullEmptyOrWhitespace(eccInformation.getECCN()) && (eccInformation.getEccStatus() == null || eccInformation.getEccStatus() == ECCStatus.OPEN); }
Source:
boolean doesColumnExist(Connection conn, String tableName, String columnName) throws SQLException { final String objectIdColumnExistsTemplate = "SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='%s' AND column_name='%s')"; ResultSet resultSet; Statement statement = conn.createStatement(); boolean columnExists = false; resultSet = statement.executeQuery(String.format(objectIdColumnExistsTemplate, tableName, columnName)); try { if (resultSet.next()) { columnExists = resultSet.getBoolean(1); } } finally { resultSet.close(); statement.close(); } return columnExists; }

Target:
boolean doesColumnExist(Connection conn, String tableName, String columnName) throws SQLException { final String objectIdColumnExistsTemplate = "SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='%s' AND column_name='%s')"; ResultSet resultSet = null; Statement statement = null; boolean columnExists = false; try { statement = conn.createStatement(); resultSet = statement.executeQuery(String.format(objectIdColumnExistsTemplate, tableName, columnName)); if (resultSet.next()) { columnExists = resultSet.getBoolean(1); } } finally { EamDbUtil.closeResultSet(resultSet); EamDbUtil.closeStatement(statement); } return columnExists; }
Source:
protected @Nullable String getProcessName(@NonNull ITmfEvent event) { String pName = super.getProcessName(event); if (pName == null) { pName = event.getContent().getFieldValue(String.class, "pid"); } if (pName == null) { int processId = getProcessId(event); pName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } return pName; }

Target:
protected @Nullable String getProcessName(@NonNull ITmfEvent event) { String pName = super.getProcessName(event); if (pName == null) { pName = event.getContent().getFieldValue(String.class, ITraceEventConstants.PID); } if (pName == null) { int processId = getProcessId(event); pName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } return pName; }
Source:
private static boolean testRow(List<Type> types, List<List<?>> values, int row, Map<Integer, TupleDomainFilter> columnFilters) { for (int column = 0; column < types.size(); column++) { TupleDomainFilter filter = columnFilters.get(column); if (filter == null) { continue; } Object value = values.get(column).get(row); if (value == null) { if (!filter.testNull()) { return false; } } else { Type type = types.get(column); if (type == BOOLEAN) { if (!filter.testBoolean(((Boolean) value).booleanValue())) { return false; } } else { fail("Unsupported type: " + type); } } } return true; }

Target:
private static boolean testRow(List<Type> types, List<List<?>> values, int row, Map<Integer, TupleDomainFilter> columnFilters) { for (int column = 0; column < types.size(); column++) { TupleDomainFilter filter = columnFilters.get(column); if (filter == null) { continue; } Object value = values.get(column).get(row); if (value == null) { if (!filter.testNull()) { return false; } } else { Type type = types.get(column); if (type == BOOLEAN) { if (!filter.testBoolean((Boolean) value)) { return false; } } else { fail("Unsupported type: " + type); } } } return true; }
Source:
public void testCorruptedFile() throws IOException { Schema schema = Schema.create(Type.STRING); DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos); w.append(new Utf8("apple")); w.append(new Utf8("banana")); w.sync(); w.append(new Utf8("celery")); w.append(new Utf8("date")); long pos = w.sync(); w.append(new Utf8("endive")); w.append(new Utf8("fig")); w.close(); byte[] original = baos.toByteArray(); int corruptPosition = (int) pos - DataFileConstants.SYNC_SIZE; int corruptedBytes = 3; byte[] corrupted = new byte[original.length + corruptedBytes]; System.arraycopy(original, 0, corrupted, 0, corruptPosition); System.arraycopy(original, corruptPosition, corrupted, corruptPosition + corruptedBytes, original.length - corruptPosition); File file = makeFile("corrupt"); file.deleteOnExit(); FileOutputStream out = new FileOutputStream(file); out.write(corrupted); out.close(); DataFileReader r = new DataFileReader<>(file, new GenericDatumReader<>(schema)); assertEquals("apple", r.next().toString()); assertEquals("banana", r.next().toString()); long prevSync = r.previousSync(); try { r.next(); fail("Corrupt block should throw exception"); } catch (AvroRuntimeException e) { assertEquals("Invalid sync!", e.getCause().getMessage()); } r.sync(prevSync); assertEquals("endive", r.next().toString()); assertEquals("fig", r.next().toString()); assertFalse(r.hasNext()); r.close(); }

Target:
public void testCorruptedFile() throws IOException { Schema schema = Schema.create(Type.STRING); DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos); w.append(new Utf8("apple")); w.append(new Utf8("banana")); w.sync(); w.append(new Utf8("celery")); w.append(new Utf8("date")); long pos = w.sync(); w.append(new Utf8("endive")); w.append(new Utf8("fig")); w.close(); byte[] original = baos.toByteArray(); int corruptPosition = (int) pos - DataFileConstants.SYNC_SIZE; int corruptedBytes = 3; byte[] corrupted = new byte[original.length + corruptedBytes]; System.arraycopy(original, 0, corrupted, 0, corruptPosition); System.arraycopy(original, corruptPosition, corrupted, corruptPosition + corruptedBytes, original.length - corruptPosition); File file = makeFile("corrupt"); file.deleteOnExit(); FileOutputStream out = new FileOutputStream(file); out.write(corrupted); out.close(); try (DataFileReader r = new DataFileReader<>(file, new GenericDatumReader<>(schema))) { assertEquals("apple", r.next().toString()); assertEquals("banana", r.next().toString()); long prevSync = r.previousSync(); r.next(); fail("Corrupt block should throw exception"); r.sync(prevSync); assertEquals("endive", r.next().toString()); assertEquals("fig", r.next().toString()); assertFalse(r.hasNext()); } catch (AvroRuntimeException e) { assertEquals("Invalid sync!", e.getCause().getMessage()); } }
Source:
private CommandEntity getParentCommandEntity(Guid cmdId, VdcActionType actionType, VdcActionParametersBase parameters) { CommandEntity cmdEntity = Guid.isNullOrEmpty(cmdId) ? null : coco.getCommandEntity(cmdId); if (cmdEntity == null) { cmdEntity = coco.createCommandEntity(cmdId, actionType, parameters); if (!Guid.isNullOrEmpty(cmdId)) { cmdEntity.setCommandStatus(CommandStatus.ACTIVE); coco.persistCommand(cmdEntity); } } return cmdEntity; }

Target:
private CommandEntity getParentCommandEntity(Guid cmdId, VdcActionType actionType, VdcActionParametersBase parameters) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity == null) { cmdEntity = coco.createCommandEntity(cmdId, actionType, parameters); if (!Guid.isNullOrEmpty(cmdId)) { cmdEntity.setCommandStatus(CommandStatus.ACTIVE); coco.persistCommand(cmdEntity); } } return cmdEntity; }
Source:
public boolean filter(HttpServletRequest request, HttpServletResponse response) { if (StringUtils.isEmpty(request.getHeader(IGNORE_METRICS_HEADER))) { try { metricsService.captureRequest(request); } catch (Exception ex) { logError(ex).log(); return false; } } return true; }

Target:
public boolean filter(HttpServletRequest request, HttpServletResponse response) { if (StringUtils.isEmpty(request.getHeader(IGNORE_METRICS_HEADER))) { try { metricsService.captureRequest(request); } catch (Exception ex) { logError(ex).log(); } } return true; }
Source:
public static SchemaRuleCommand createIndexRule( SchemaIndexProvider.Descriptor provider, long id, LabelSchemaDescriptor descriptor ) { SchemaRule rule = IndexRule.indexRule( id, NewIndexDescriptorFactory.forLabel( descriptor.getLabelId(), descriptor.getPropertyId() ), provider ); DynamicRecord record = new DynamicRecord( id ); record.setInUse( true ); record.setCreated(); record.setData( rule.serialize() ); return new SchemaRuleCommand( Collections.<DynamicRecord>emptyList(), singletonList( record ), rule ); }

Target:
public static SchemaRuleCommand createIndexRule( SchemaIndexProvider.Descriptor provider, long id, LabelSchemaDescriptor descriptor ) { SchemaRule rule = IndexRule.indexRule( id, NewIndexDescriptorFactory.forSchema( descriptor ), provider ); DynamicRecord record = new DynamicRecord( id ); record.setInUse( true ); record.setCreated(); record.setData( rule.serialize() ); return new SchemaRuleCommand( Collections.<DynamicRecord>emptyList(), singletonList( record ), rule ); }
Source:
public ArchiveResult archive() { markProcessed(); final Object record = getRecord(); final TableRecordReference recordRef = TableRecordReference.of(record); final DocumentReportResult report = getDocumentReportService() .createReport(DocumentReportRequest.builder() .documentRef(recordRef) .printFormatIdToUse(getPrintFormatId().orElse(null)) .printPreview(true) .clientId(InterfaceWrapperHelper.getClientId(record).orElse(ClientId.SYSTEM)) .orgId(InterfaceWrapperHelper.getOrgId(record).orElse(OrgId.ANY)) .userId(Env.getLoggedUserIdIfExists().orElse(UserId.SYSTEM)) .roleId(Env.getLoggedRoleId()) .build()); final ArchiveResult lastArchiveResult = report.getLastArchiveResult(); final ArchiveResult archiveResult; if (lastArchiveResult.isNoArchive()) { archiveResult = createArchive(report); } else { archiveResult = lastArchiveResult; } final String ccPath = getCCPath().orElse(null); if (Check.isNotBlank(ccPath) && ccAbleDocumentFactoryService.isTableNameSupported(recordRef.getTableName()) && archiveResult.getArchiveRecord() != null) { DocOutboundCCWorkpackageProcessor.scheduleOnTrxCommit(archiveResult.getArchiveRecord()); } return archiveResult; }

Target:
public ArchiveResult archive() { markProcessed(); final Object record = getRecord(); final TableRecordReference recordRef = TableRecordReference.of(record); final DocumentReportResult report = getDocumentReportService() .createReport(DocumentReportRequest.builder() .documentRef(recordRef) .printFormatIdToUse(getPrintFormatId().orElse(null)) .printPreview(true) .clientId(InterfaceWrapperHelper.getClientId(record).orElse(ClientId.SYSTEM)) .orgId(InterfaceWrapperHelper.getOrgId(record).orElse(OrgId.ANY)) .userId(Env.getLoggedUserIdIfExists().orElse(UserId.SYSTEM)) .roleId(Env.getLoggedRoleId()) .build()); final ArchiveResult lastArchive = report.getLastArchive(); final ArchiveResult archiveResult; if (lastArchive == null || lastArchive.isNoArchive()) { archiveResult = createArchive(report); } else { archiveResult = lastArchive; } final String ccPath = getCCPath().orElse(null); if (Check.isNotBlank(ccPath) && ccAbleDocumentFactoryService.isTableNameSupported(recordRef.getTableName()) && archiveResult.getArchiveRecord() != null) { DocOutboundCCWorkpackageProcessor.scheduleOnTrxCommit(archiveResult.getArchiveRecord()); } return archiveResult; }
Source:
public void testSkipRevFilter() throws Exception { final RevCommit a = commit(); final RevCommit b = commit(a); final RevCommit c1 = commit(b); final RevCommit c2 = commit(b); final RevCommit d = commit(c1, c2); final RevCommit e = commit(d); rw.reset(); rw.setRevFilter(SkipRevFilter.create(3)); markStart(e); assertCommit(c1, rw.next()); assertCommit(b, rw.next()); assertCommit(a, rw.next()); assertNull(rw.next()); rw.reset(); rw.setRevFilter(SkipRevFilter.create(0)); markStart(e); assertCommit(e, rw.next()); assertCommit(d, rw.next()); assertCommit(c2, rw.next()); assertCommit(c1, rw.next()); assertCommit(b, rw.next()); assertCommit(a, rw.next()); assertNull(rw.next()); }

Target:
public void testSkipRevFilter() throws Exception { final RevCommit a = commit(); final RevCommit b = commit(a); final RevCommit c1 = commit(b); final RevCommit c2 = commit(b); final RevCommit d = commit(c1, c2); final RevCommit e = commit(d); rw.reset(); rw.setRevFilter(SkipRevFilter.create(3)); markStart(e); assertCommit(c1, rw.next()); assertCommit(b, rw.next()); assertCommit(a, rw.next()); assertNull(rw.next()); }
Source:
public String toString() { return String.format("Notifications [notifications=[%s]]", StringUtils.join(get(), ", ")); }

Target:
public String toString() { return String.format("Notifications [notifications=%s]", get()); }
Source:
public void testCommaSeparatedList(){ CrossSiteOriginFilter crossSiteOriginFilter = new CrossSiteOriginFilter(new ServerConfiguration()); crossSiteOriginFilter.getAsCommaSeparatedList(null); }

Target:
public void testCommaSeparatedList(){ final CrossSiteOriginFilter crossSiteOriginFilter = new CrossSiteOriginFilter(new ServerConfiguration()); crossSiteOriginFilter.getAsCommaSeparatedList(null); }
Source:
public void testGetSplitsNoCombining() throws Exception { DatasourceInputFormat inputFormat = new DatasourceInputFormat().setSupplier(testFormatter); List<InputSplit> splits = inputFormat.getSplits(context); Assert.assertEquals(segments.size(), splits.size()); for (int i = 0; i < segments.size(); i++) { DatasourceInputSplit split = (DatasourceInputSplit) splits.get(i); Assert.assertEquals(segments.get(i), split.getSegments().get(0)); System.out.println(Arrays.toString(split.getLocations())); Assert.assertTrue(split.getLocations().length > 0); } }

Target:
public void testGetSplitsNoCombining() throws Exception { DatasourceInputFormat inputFormat = new DatasourceInputFormat().setSupplier(testFormatter); List<InputSplit> splits = inputFormat.getSplits(context); Assert.assertEquals(segments.size(), splits.size()); for (int i = 0; i < segments.size(); i++) { DatasourceInputSplit split = (DatasourceInputSplit) splits.get(i); Assert.assertEquals(segments.get(i), split.getSegments().get(0)); } Assert.assertArrayEquals(new String[] {"s1", "s2"}, splits.get(0).getLocations()); Assert.assertArrayEquals(new String[] {"s1", "s2"}, splits.get(1).getLocations()); Assert.assertArrayEquals(new String[] {"s2", "s3"}, splits.get(2).getLocations()); }
Source:
public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action == null) { return; } if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { PackageManager pm = context.getPackageManager(); if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) { pm.setApplicationEnabledSetting(context.getPackageName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); } } }

Target:
public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { PackageManager pm = context.getPackageManager(); if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_ANY)) { pm.setApplicationEnabledSetting(context.getPackageName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); } } }
Source:
public Single<Integer> checkFBMD (String filePath){ try { return ReadFBMD.processMetadata(filePath); } catch (IOException e) { return Single.just(ImageUtils.FILE_FBMD); } }

Target:
public Single<Integer> checkFBMD(String filePath) { try { return readFBMD.processMetadata(filePath); } catch (IOException e) { return Single.just(ImageUtils.FILE_FBMD); } }