auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean StorageDomainRemoved(storage_domain_static storageDomain) { storage_server_connections connection = DbFacade.getInstance().getStorageServerConnectionDAO().get(storageDomain.getstorage()); if (connection != null) DbFacade.getInstance().getStorageServerConnectionDAO().remove(connection.getid()); return true; }

Target:
public boolean StorageDomainRemoved(storage_domain_static storageDomain) { storage_server_connections connection = DbFacade.getInstance().getStorageServerConnectionDAO().get(storageDomain.getstorage()); if (connection != null) { DbFacade.getInstance().getStorageServerConnectionDAO().remove(connection.getid()); } return true; }
Source:
public void onRewardedVideoAdClicked(String instanceId, Placement placement) { onLog("onRewardedVideoAdClicked, placement: " + placement.getPlacementName() + " for instance: " + instanceId); if (mMediationRewardedVideoAdListener != null) { sendEventOnUIThread(new Runnable() { public void run() { mMediationRewardedVideoAdListener.onAdClicked(IronSourceRewardedAdapter.this); } }); } }

Target:
public void onRewardedVideoAdClicked(String instanceId, Placement placement) { onLog("onRewardedVideoAdClicked, placement: " + placement.getPlacementName() + " for instance: " + instanceId); if (mMediationRewardedVideoAdListener != null) { sendEventOnUIThread(new Runnable() { public void run() { mMediationRewardedVideoAdListener.onAdClicked(IronSourceRewardedAdapter.this); mMediationRewardedVideoAdListener.onAdLeftApplication(IronSourceRewardedAdapter.this); } }); } }
Source:
public void cannotInsertSameEntityTwice() throws Exception { getTransactionManager().begin(); EntityManager em = getFactory().createEntityManager(); MakeupArtist wibke = new MakeupArtist( "wibke", "halloween" ); em.persist( wibke ); getTransactionManager().commit(); em.clear(); getTransactionManager().begin(); em.joinTransaction(); MakeupArtist notWibke = new MakeupArtist( "wibke", "glamorous" ); em.persist( notWibke ); try { getTransactionManager().commit(); fail( "Expected exception wasn't raised" ); } catch (Exception e) { assertThat( e.getCause().getMessage() ).matches( ".*OGM000067.*" ); } em.clear(); getTransactionManager().begin(); em.joinTransaction(); MakeupArtist loadedMakeupArtist = em.find( MakeupArtist.class, "wibke" ); assertThat( loadedMakeupArtist ).isNotNull(); assertThat( loadedMakeupArtist.getFavoriteStyle() ).describedAs( "Second insert should not be applied" ).isEqualTo( "halloween" ); em.remove( loadedMakeupArtist ); getTransactionManager().commit(); em.close(); }

Target:
public void cannotInsertSameEntityTwice() throws Exception { getTransactionManager().begin(); EntityManager em = getFactory().createEntityManager(); MakeupArtist wibke = new MakeupArtist( "wibke", "halloween" ); em.persist( wibke ); getTransactionManager().commit(); em.clear(); getTransactionManager().begin(); em.joinTransaction(); MakeupArtist notWibke = new MakeupArtist( "wibke", "glamorous" ); em.persist( notWibke ); try { getTransactionManager().commit(); fail( "Expected exception wasn't raised" ); } catch (Exception e) { assertThat( e.getCause() ).isExactlyInstanceOf( EntityExistsException.class ); assertThat( e.getCause().getMessage() ).matches( ".*OGM000067.*" ); } em.clear(); getTransactionManager().begin(); em.joinTransaction(); MakeupArtist loadedMakeupArtist = em.find( MakeupArtist.class, "wibke" ); assertThat( loadedMakeupArtist ).isNotNull(); assertThat( loadedMakeupArtist.getFavoriteStyle() ).describedAs( "Second insert should not be applied" ).isEqualTo( "halloween" ); em.remove( loadedMakeupArtist ); getTransactionManager().commit(); em.close(); }
Source:
private Map<String, LoadBalancerStrategyFactory<?>> createDefaultLoadBalancerStrategyFactories() { final Map<String, LoadBalancerStrategyFactory<? extends LoadBalancerStrategy>> loadBalancerStrategyFactories = new HashMap<>(_config.loadBalancerStrategyFactories); final RandomLoadBalancerStrategyFactory randomStrategyFactory = new RandomLoadBalancerStrategyFactory(); loadBalancerStrategyFactories.putIfAbsent("random", randomStrategyFactory); final DegraderLoadBalancerStrategyFactoryV3 degraderStrategyFactoryV3 = new DegraderLoadBalancerStrategyFactoryV3( _config.healthCheckOperations, _config._executorService, _config.eventEmitter, Collections.emptyList()); loadBalancerStrategyFactories.putIfAbsent("degrader", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV2", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV3", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV2_1", degraderStrategyFactoryV3); final RelativeLoadBalancerStrategyFactory relativeLoadBalancerStrategyFactory = new RelativeLoadBalancerStrategyFactory( _config._executorService, _config.healthCheckOperations, Collections.emptyList(), _config.eventEmitter); loadBalancerStrategyFactories.putIfAbsent("relative", relativeLoadBalancerStrategyFactory); return loadBalancerStrategyFactories; }

Target:
private Map<String, LoadBalancerStrategyFactory<?>> createDefaultLoadBalancerStrategyFactories() { final Map<String, LoadBalancerStrategyFactory<? extends LoadBalancerStrategy>> loadBalancerStrategyFactories = new HashMap<>(_config.loadBalancerStrategyFactories); final RandomLoadBalancerStrategyFactory randomStrategyFactory = new RandomLoadBalancerStrategyFactory(); loadBalancerStrategyFactories.putIfAbsent("random", randomStrategyFactory); final DegraderLoadBalancerStrategyFactoryV3 degraderStrategyFactoryV3 = new DegraderLoadBalancerStrategyFactoryV3( _config.healthCheckOperations, _config._executorService, _config.eventEmitter, Collections.emptyList()); loadBalancerStrategyFactories.putIfAbsent("degrader", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV2", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV3", degraderStrategyFactoryV3); loadBalancerStrategyFactories.putIfAbsent("degraderV2_1", degraderStrategyFactoryV3); final RelativeLoadBalancerStrategyFactory relativeLoadBalancerStrategyFactory = new RelativeLoadBalancerStrategyFactory( _config._executorService, _config.healthCheckOperations, Collections.emptyList(), _config.eventEmitter); loadBalancerStrategyFactories.putIfAbsent(RelativeLoadBalancerStrategy.RELATIVE_LOAD_BALANCER_STRATEGY_NAME, relativeLoadBalancerStrategyFactory); return loadBalancerStrategyFactories; }
Source:
public static void cleanupTestBucketOrDirectory(final MantaClient client, final String testPath) throws IOException { if (testPath.contains(bucketObjectsSubstring)) { final String bucketPath = parseBucketPath(testPath); try { client.deleteBucket(bucketPath); } catch (MantaClientHttpResponseException e) { if (e.getServerCode().equals(MantaErrorCode.BUCKET_NOT_EMPTY_ERROR)) { e.setContextValue("Cleanup of non-empty test bucket attempted at:", testPath); throw e; } } } else { IntegrationTestConfigContext.cleanupTestDirectory(client, testPath); } }

Target:
public static void cleanupTestBucketOrDirectory(final MantaClient client, final String testPath) throws IOException { if (testPath.contains(bucketObjectsSubstring)) { final String bucket_path = parseBucketPath(testPath); try { client.deleteBucket(bucket_path); } catch (MantaClientHttpResponseException e) { if (e.getServerCode().equals(MantaErrorCode.BUCKET_NOT_EMPTY_ERROR)) { MantaIOException mioe = new MantaIOException("Cannot delete bucket containing objects", e); mioe.setContextValue("bucket_path", testPath); throw mioe; } } } else { IntegrationTestConfigContext.cleanupTestDirectory(client, testPath); } }
Source:
public synchronized Identity createEndpoint(ServerInfo serverInfo) { if (currentEndpoint != null) { coapServer.getEndpoints().remove(currentEndpoint); currentEndpoint.destroy(); } Identity server; if (serverInfo.isSecure()) { Builder newBuilder = cloneDtlsConfigBuilder(dtlsConfigbuilder); if (serverInfo.secureMode == SecurityMode.PSK) { StaticPskStore staticPskStore = new StaticPskStore(serverInfo.pskId, serverInfo.pskKey); newBuilder.setPskStore(staticPskStore); } if (endpointFactory != null) { currentEndpoint = endpointFactory.createSecuredEndpoint(newBuilder.build(), coapConfig, null); } else { currentEndpoint = new CoapEndpoint(new DTLSConnector(newBuilder.build()), coapConfig, null, null); } server = Identity.psk(serverInfo.getAddress(), serverInfo.pskId); } else { if (endpointFactory != null) { currentEndpoint = endpointFactory.createUnsecuredEndpoint(localAddress, coapConfig, null); } else { currentEndpoint = new CoapEndpoint(localAddress, coapConfig); } server = Identity.unsecure(serverInfo.getAddress()); } coapServer.addEndpoint(currentEndpoint); if (started) { coapServer.start(); try { currentEndpoint.start(); LOG.info("New endpoint created for server at {}", serverInfo.serverUri, currentEndpoint.getUri()); } catch (IOException e) { throw new RuntimeException("Unable to start endpoint", e); } } return server; }

Target:
public synchronized Identity createEndpoint(ServerInfo serverInfo) { if (currentEndpoint != null) { coapServer.getEndpoints().remove(currentEndpoint); currentEndpoint.destroy(); } Identity server; if (serverInfo.isSecure()) { Builder newBuilder = cloneDtlsConfigBuilder(dtlsConfigbuilder); if (serverInfo.secureMode == SecurityMode.PSK) { StaticPskStore staticPskStore = new StaticPskStore(serverInfo.pskId, serverInfo.pskKey); newBuilder.setPskStore(staticPskStore); } if (endpointFactory != null) { currentEndpoint = endpointFactory.createSecuredEndpoint(newBuilder.build(), coapConfig, null); } else { CoapEndpoint.CoapEndpointBuilder builder = new CoapEndpoint.CoapEndpointBuilder(); builder.setConnector(new DTLSConnector(newBuilder.build())); builder.setNetworkConfig(coapConfig); currentEndpoint = builder.build(); } server = Identity.psk(serverInfo.getAddress(), serverInfo.pskId); } else { if (endpointFactory != null) { currentEndpoint = endpointFactory.createUnsecuredEndpoint(localAddress, coapConfig, null); } else { CoapEndpoint.CoapEndpointBuilder builder = new CoapEndpoint.CoapEndpointBuilder(); builder.setInetSocketAddress(localAddress); builder.setNetworkConfig(coapConfig); currentEndpoint = builder.build(); } server = Identity.unsecure(serverInfo.getAddress()); } coapServer.addEndpoint(currentEndpoint); if (started) { coapServer.start(); try { currentEndpoint.start(); LOG.info("New endpoint created for server at {}", serverInfo.serverUri, currentEndpoint.getUri()); } catch (IOException e) { throw new RuntimeException("Unable to start endpoint", e); } } return server; }
Source:
public static String offerIDListToString(List<OfferID> offerIDList) { List<String> offerIDsAsStrings = Lists.transform(offerIDList, offerIDToStringTransform); return "[" + StringUtils.join(offerIDsAsStrings, ", ") + "]"; }

Target:
public static String offerIDListToString(List<OfferID> offerIDList) { List<String> offerIDsAsStrings = Lists.transform(offerIDList, offerIDToStringTransform); return String.format("[ %s ]", StringUtils.join(offerIDsAsStrings, ", ")); }
Source:
public static RuntimeException rethrow(Throwable pThrowable) { if (pThrowable == null) { throw new NullPointerException("The Throwable must not be null."); } if (pThrowable instanceof RuntimeException) { throw (RuntimeException) pThrowable; } else if (pThrowable instanceof Error) { throw (Error) pThrowable; } else if (pThrowable instanceof IOException) { throw new UncheckedIOException((IOException) pThrowable); } else { throw new UndeclaredThrowableException(pThrowable); } }

Target:
public static RuntimeException rethrow(Throwable pThrowable) { if (pThrowable == null) { throw new NullPointerException("The Throwable must not be null."); } else { if (pThrowable instanceof RuntimeException) { throw (RuntimeException) pThrowable; } else if (pThrowable instanceof Error) { throw (Error) pThrowable; } else if (pThrowable instanceof IOException) { throw new UncheckedIOException((IOException) pThrowable); } else { throw new UndeclaredThrowableException(pThrowable); } } }
Source:
public void run(IAction action) { final IResource[] resources = getSelectedResources(); if (resources.length == 0) return; WorkspaceJob job = new WorkspaceJob("Ignore Git resources") { public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { monitor.beginTask("Ignoring Git resources", resources.length); try { for (IResource resource : resources) { if (!Team.isIgnoredHint(resource)) { IContainer container = resource.getParent(); IFile gitignore = container.getFile(new Path( Constants.GITIGNORE_FILENAME)); String entry = "/" + resource.getName() + "\n"; if (gitignore.exists()) { gitignore.appendContents( new ByteArrayInputStream(entry .getBytes(Constants.CHARACTER_ENCODING)), true, true, monitor); } else { ByteArrayInputStream bais = new ByteArrayInputStream( entry .getBytes(Constants.CHARACTER_ENCODING)); gitignore.create(bais, true, monitor); } } monitor.worked(1); } monitor.done(); } catch (CoreException e) { throw e; } catch (Exception e) { throw new CoreException( new Status( IStatus.ERROR, "org.eclipse.egit.ui", "Unable to ignore resources", e)); } return Status.OK_STATUS; } }; job.schedule(); }

Target:
public void run(IAction action) { final IResource[] resources = getSelectedResources(); if (resources.length == 0) return; WorkspaceJob job = new WorkspaceJob(UIText.IgnoreAction_jobName) { public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { monitor.beginTask(UIText.IgnoreAction_taskName, resources.length); try { for (IResource resource : resources) { if (!Team.isIgnoredHint(resource)) { addIgnore(monitor, resource); } monitor.worked(1); } monitor.done(); } catch (CoreException e) { throw e; } catch (Exception e) { throw new CoreException( new Status( IStatus.ERROR, "org.eclipse.egit.ui", UIText.IgnoreAction_error, e)); } return Status.OK_STATUS; } private void addIgnore(IProgressMonitor monitor, IResource resource) throws UnsupportedEncodingException, CoreException { IContainer container = resource.getParent(); IFile gitignore = container.getFile(new Path( Constants.GITIGNORE_FILENAME)); String entry = "/" + resource.getName() + "\n"; ByteArrayInputStream entryBytes = asStream(entry); if (gitignore.exists()) gitignore.appendContents(entryBytes, true, true, monitor); else gitignore.create(entryBytes, true, monitor); } private ByteArrayInputStream asStream(String entry) throws UnsupportedEncodingException { return new ByteArrayInputStream(entry .getBytes(Constants.CHARACTER_ENCODING)); } }; job.schedule(); }
Source:
public boolean equals(Object o) { if (o instanceof MultipleInstanceCollectionInput) { MultipleInstanceCollectionInput other = (MultipleInstanceCollectionInput) o; return (null != value) ? value.equals(other.value) : null == other.value; } return false; }

Target:
public boolean equals(Object o) { if (o instanceof MultipleInstanceCollectionInput) { MultipleInstanceCollectionInput other = (MultipleInstanceCollectionInput) o; return Objects.equals(value, other.value); } return false; }
Source:
private void createWorkers(final GameData data) { workers.clear(); if (data != null && cancelCurrentOperation.get() >= 0) { final long startTime = System.currentTimeMillis(); final long startMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); final GameData newData; try { data.acquireWriteLock(); newData = GameDataUtils.cloneGameDataWithoutHistory(data, false); } finally { data.releaseWriteLock(); } currentThreads = getThreadsToUse((System.currentTimeMillis() - startTime), startMemory); try { newData.acquireReadLock(); int i = 0; if (currentThreads <= 2 || MAX_THREADS <= 2) { while (cancelCurrentOperation.get() >= 0 && i < currentThreads) { workers.add(new BattleCalculator(newData, (currentThreads == ++i))); } } else { final CountDownLatch workerLatch = new CountDownLatch(currentThreads - 1); while (i < (currentThreads - 1)) { ++i; executor.execute( () -> { if (cancelCurrentOperation.get() >= 0) { workers.add(new BattleCalculator(newData, false)); } workerLatch.countDown(); }); } workers.add(new BattleCalculator(newData, true)); Interruptibles.await(workerLatch); } } finally { newData.releaseReadLock(); } } if (cancelCurrentOperation.get() < 0 || data == null) { workers.clear(); isDataSet = false; } else { isDataSet = true; dataLoadedAction.run(); } latchWorkerThreadsCreation.countDown(); latchSetData.countDown(); }

Target:
private void createWorkers(final GameData data) { workers.clear(); if (data != null && cancelCurrentOperation.get() >= 0) { final long startTime = System.currentTimeMillis(); final long startMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); final GameData newData; try { data.acquireWriteLock(); newData = GameDataUtils.cloneGameDataWithoutHistory(data, false); } finally { data.releaseWriteLock(); } final int currentThreads = getThreadsToUse((System.currentTimeMillis() - startTime), startMemory); try { newData.acquireReadLock(); int i = 0; if (currentThreads <= 2 || MAX_THREADS <= 2) { while (cancelCurrentOperation.get() >= 0 && i < currentThreads) { workers.add(new BattleCalculator(newData, (currentThreads == ++i))); } } else { final CountDownLatch workerLatch = new CountDownLatch(currentThreads - 1); while (i < (currentThreads - 1)) { ++i; executor.execute( () -> { if (cancelCurrentOperation.get() >= 0) { workers.add(new BattleCalculator(newData, false)); } workerLatch.countDown(); }); } workers.add(new BattleCalculator(newData, true)); Interruptibles.await(workerLatch); } } finally { newData.releaseReadLock(); } } if (cancelCurrentOperation.get() < 0 || data == null) { workers.clear(); isDataSet = false; } else { isDataSet = true; dataLoadedAction.run(); } latchWorkerThreadsCreation.countDown(); latchSetData.countDown(); }
Source:
private static PlanNode addPartitioningNodes(Context context, PlanNode node, Symbol partitionSymbol, KdbTree kdbTree, Expression geometry, Optional<Expression> radius) { Assignments.Builder projections = Assignments.builder(); for (Symbol outputSymbol : node.getOutputSymbols()) { projections.putIdentity(outputSymbol); } ImmutableList.Builder<Expression> partitioningArguments = ImmutableList.<Expression>builder() .add(new Cast(new StringLiteral(KDB_TREE_CODEC.toJson(kdbTree)), KDB_TREE_TYPENAME)) .add(geometry); radius.map(partitioningArguments::add); FunctionCall partitioningFunction = new FunctionCall(QualifiedName.of("spatial_partitions"), partitioningArguments.build()); Symbol partitionsSymbol = context.getSymbolAllocator().newSymbol(partitioningFunction, new ArrayType(INTEGER)); projections.put(partitionsSymbol, partitioningFunction); return new UnnestNode(context.getIdAllocator().getNextId(), new ProjectNode(context.getIdAllocator().getNextId(), node, projections.build()), node.getOutputSymbols(), ImmutableMap.of(partitionsSymbol, ImmutableList.of(partitionSymbol)), Optional.empty()); }

Target:
private static PlanNode addPartitioningNodes(Context context, PlanNode node, Symbol partitionSymbol, KdbTree kdbTree, Expression geometry, Optional<Expression> radius) { Assignments.Builder projections = Assignments.builder(); for (Symbol outputSymbol : node.getOutputSymbols()) { projections.putIdentity(outputSymbol); } ImmutableList.Builder<Expression> partitioningArguments = ImmutableList.<Expression>builder() .add(new Cast(new StringLiteral(KdbTreeUtils.toJson(kdbTree)), KDB_TREE_TYPENAME)) .add(geometry); radius.map(partitioningArguments::add); FunctionCall partitioningFunction = new FunctionCall(QualifiedName.of("spatial_partitions"), partitioningArguments.build()); Symbol partitionsSymbol = context.getSymbolAllocator().newSymbol(partitioningFunction, new ArrayType(INTEGER)); projections.put(partitionsSymbol, partitioningFunction); return new UnnestNode( context.getIdAllocator().getNextId(), new ProjectNode(context.getIdAllocator().getNextId(), node, projections.build()), node.getOutputSymbols(), ImmutableMap.of(partitionsSymbol, ImmutableList.of(partitionSymbol)), Optional.empty()); }
Source:
protected void crawlXmlFolders() throws Exception { for ( SourceCrawlerXMLFolder xmlFolder : xmlFolders ) { String[] xmlDirs = { xmlFolder.getFolder() }; String[] xmlMasks = { xmlFolder.getWildcard() }; String[] xmlReq = { N_STRING }; boolean[] xmlSubdirs = { true }; FileInputList xulFileInputList = FileInputList.createFileList( new Variables(), xmlDirs, xmlMasks, xmlReq, xmlSubdirs ); for ( FileObject fileObject : xulFileInputList.getFiles() ) { try { Document doc = XMLHandler.loadXMLFile( fileObject ); for ( SourceCrawlerXMLElement xmlElement : xmlFolder.getElements() ) { addLabelOccurrences( xmlFolder.getDefaultSourceFolder(), fileObject, doc .getElementsByTagName( xmlElement.getSearchElement() ), xmlFolder.getKeyPrefix(), xmlElement .getKeyTag(), xmlElement.getKeyAttribute(), xmlFolder.getDefaultPackage(), xmlFolder .getPackageExceptions() ); } } catch ( KettleXMLException e ) { log.logError( "Unable to open XUL / XML document: " + fileObject ); } } } }

Target:
protected void crawlXmlFolders() throws Exception { for ( SourceCrawlerXMLFolder xmlFolder : xmlFolders ) { String[] xmlDirs = { xmlFolder.getFolder() }; String[] xmlMasks = { xmlFolder.getWildcard() }; String[] xmlReq = { N }; boolean[] xmlSubdirs = { true }; FileInputList xulFileInputList = FileInputList.createFileList( new Variables(), xmlDirs, xmlMasks, xmlReq, xmlSubdirs ); for ( FileObject fileObject : xulFileInputList.getFiles() ) { try { Document doc = XMLHandler.loadXMLFile( fileObject ); for ( SourceCrawlerXMLElement xmlElement : xmlFolder.getElements() ) { addLabelOccurrences( xmlFolder.getDefaultSourceFolder(), fileObject, doc .getElementsByTagName( xmlElement.getSearchElement() ), xmlFolder.getKeyPrefix(), xmlElement .getKeyTag(), xmlElement.getKeyAttribute(), xmlFolder.getDefaultPackage(), xmlFolder .getPackageExceptions() ); } } catch ( KettleXMLException e ) { log.logError( "Unable to open XUL / XML document: " + fileObject ); } } } }
Source:
protected void onResume() { super.onResume(); if (getIntent() != null && getIntent().getAction().equals(Intent.ACTION_VIEW)) { Uri uri = getIntent().getData(); if (uri.getQueryParameter("error") != null) { String error = uri.getQueryParameter("error"); } else { String authCode = uri.getQueryParameter("code"); Intent intent = new Intent(this, AccountRetrievalService.class); intent.putExtra("AUTHCODE", authCode); intent.putExtra("REDIRECT_URI", REDIRECT_URI); intent.putExtra("CLIENT_ID", CLIENT_ID); startService(intent); Intent loadingActivityIntent = new Intent(this, LoadingActivity.class); startActivity(loadingActivityIntent); } } }

Target:
protected void onResume() { super.onResume(); if (getIntent() != null && getIntent().getAction().equals(Intent.ACTION_VIEW)) { Uri uri = getIntent().getData(); Log.d("LandingActivity", "onResume: uri = " + uri); String error = uri.getQueryParameter("error"); if (error != null) { Toast.makeText(this, R.string.whoops_error_message_on_app_return, Toast.LENGTH_SHORT).show(); Log.d("LandingActivity", "onResume: error = " + error); } else { String authCode = uri.getQueryParameter("code"); Intent intent = new Intent(this, AccountRetrievalService.class); intent.putExtra("AUTHCODE", authCode); intent.putExtra("REDIRECT_URI", REDIRECT_URI); intent.putExtra("CLIENT_ID", CLIENT_ID); startService(intent); Intent loadingActivityIntent = new Intent(this, LoadingActivity.class); startActivity(loadingActivityIntent); } } }
Source:
public FlowIdentifier backupClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId) { LOGGER.debug("Starting cluster database backup: " + nameOrCrn); if (nameOrCrn.hasName()) { return databaseBackupRestoreService.backupDatabase(workspaceId, nameOrCrn.getName(), location, backupId); } else { LOGGER.debug("No stack name provided for backup, found: " + nameOrCrn); throw new BadRequestException("Please provide a stack name for backup"); } }

Target:
public FlowIdentifier backupClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId) { databaseBackupRestoreService.validate(workspaceId, nameOrCrn, location, backupId); LOGGER.debug("Starting cluster database backup: " + nameOrCrn); return databaseBackupRestoreService.backupDatabase(workspaceId, nameOrCrn, location, backupId); }
Source:
public void restRequest(RestRequest request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<RestResponse> callback) { int currentIntervalIndex = (int) (_clockedExecutor.currentTimeMillis() / _intervalMillis); int requestCount = _lastRequestCountMap.getOrDefault(_uri, 0); long latency = _latencyManager.getLatency(_uri, requestCount, currentIntervalIndex); boolean hasError = _errorCountManager.getErrorCount(_uri, requestCount, currentIntervalIndex) - _currentErrorCountMap.getOrDefault(_uri, 0) > 0; _clockedExecutor.schedule(new Runnable() { @Override public void run() { RestResponseBuilder restResponseBuilder = new RestResponseBuilder().setEntity(request.getURI().getRawPath().getBytes()); if (hasError) { restResponseBuilder.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); RestException restException = new RestException(restResponseBuilder.build(), new Throwable("internal error")); callback.onResponse(TransportResponseImpl.error(restException)); return; } callback.onResponse(TransportResponseImpl.success(restResponseBuilder.build())); } }, latency, TimeUnit.MILLISECONDS); synchronized (_lock) { if (hasError) { _currentErrorCountMap.putIfAbsent(_uri, 0); _currentErrorCountMap.put(_uri, _currentErrorCountMap.get(_uri) + 1); } _callCountMap.putIfAbsent(_uri, 0); _callCountMap.put(_uri, _callCountMap.get(_uri) + 1); _latencySumMap.putIfAbsent(_uri, 0L); _latencySumMap.put(_uri, _latencySumMap.get(_uri) + latency); } }

Target:
public void restRequest(RestRequest request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<RestResponse> callback) { int currentIntervalIndex = (int) (_clockedExecutor.currentTimeMillis() / _intervalMillis); int requestCount = _lastRequestCountMap.getOrDefault(_uri, 0); long latency = _latencyManager.getLatency(_uri, requestCount, currentIntervalIndex); boolean hasError = _errorCountManager.getErrorCount(_uri, requestCount, currentIntervalIndex) - _currentErrorCountMap.getOrDefault(_uri, 0) > 0; _clockedExecutor.schedule(new Runnable() { @Override public void run() { RestResponseBuilder restResponseBuilder = new RestResponseBuilder().setEntity(request.getURI().getRawPath().getBytes()); if (hasError) { restResponseBuilder.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); RestException restException = new RestException(restResponseBuilder.build(), new Throwable("internal error")); callback.onResponse(TransportResponseImpl.error(restException)); return; } callback.onResponse(TransportResponseImpl.success(restResponseBuilder.build())); } }, latency, TimeUnit.MILLISECONDS); if (hasError) { _currentErrorCountMap.putIfAbsent(_uri, 0); _currentErrorCountMap.put(_uri, _currentErrorCountMap.get(_uri) + 1); } _callCountMap.putIfAbsent(_uri, 0); _callCountMap.put(_uri, _callCountMap.get(_uri) + 1); _latencySumMap.putIfAbsent(_uri, 0L); _latencySumMap.put(_uri, _latencySumMap.get(_uri) + latency); }
Source:
protected Response performRemove(String id) { QuotaCRUDParameters prms = new QuotaCRUDParameters(); prms.setQuotaId(GuidUtils.asGuid(id)); return performAction(VdcActionType.RemoveQuota, prms); }

Target:
protected Response performRemove(String id) { QuotaCRUDParameters prms = new QuotaCRUDParameters(); prms.setQuotaId(asGuid(id)); return performAction(VdcActionType.RemoveQuota, prms); }
Source:
private static void drawMarkerLabels(List<IMarkerEvent> markerEvents, Rectangle rect, GC gc, long time0, int leftSpace, double pixelsPerNanoSec) { if (markerEvents == null) { return; } for (IMarkerEvent markerEvent : markerEvents) { String label = markerEvent.getLabel(); if (label != null && markerEvent.getEntry() == null) { label = label.substring(0, Math.min(256, label.length())); int x = rect.x + leftSpace + (int) (Math.floor((markerEvent.getTime() - time0) * pixelsPerNanoSec)); int y = rect.y + rect.height - gc.stringExtent(" ").y + 2; gc.setForeground(markerEvent.getColor()); Utils.drawText(gc, label, x, y, true); } } }

Target:
private static void drawMarkerLabels(List<IMarkerEvent> markerEvents, Rectangle rect, GC gc, long time0, int leftSpace, double pixelsPerNanoSec) { if (markerEvents == null) { return; } for (IMarkerEvent markerEvent : markerEvents) { String label = markerEvent.getLabel(); if (label != null && markerEvent.getEntry() == null) { label = label.substring(0, Math.min(label.indexOf('\n') != -1 ? label.indexOf('\n') : label.length(), MAX_LABEL_LENGTH)); int x = rect.x + leftSpace + (int) (Math.floor((markerEvent.getTime() - time0) * pixelsPerNanoSec)); int y = rect.y + rect.height - gc.stringExtent(" ").y + 2; gc.setForeground(markerEvent.getColor()); Utils.drawText(gc, label, x, y, true); } } }
Source:
public String getUniverseInfo() { int worldCount = entityManager.getWorldPools().size(); StringBuilder message = new StringBuilder(100); message.append("Number of world is " + worldCount + "\n"); Map<Long, EngineEntityPool> worldPoolMap = entityManager.getPoolMap(); Map<EngineEntityPool, Long> poolCounts = new HashMap<EngineEntityPool, Long>(); for (EngineEntityPool engineEntityPools : entityManager.getWorldPools()) { poolCounts.put(engineEntityPools, 0L); } for (Map.Entry<Long, EngineEntityPool> entry : worldPoolMap.entrySet()) { if (poolCounts.containsKey(entry.getValue())) { poolCounts.put(entry.getValue(), poolCounts.get(entry.getValue()) + 1); } else { poolCounts.put(entry.getValue(), 1L); } } for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { message.append("Pool for " + entry.getKey().getTitle() + " has " + poolCounts.get(entry.getValue()) + " entities \n"); } return message.toString(); }

Target:
public String getUniverseInfo() { int worldCount = entityManager.getWorldPools().size(); StringBuilder message = new StringBuilder(); message.append("Number of worlds is " + worldCount + "\n"); Map<EngineEntityPool, Long> poolCounts = entityManager.getPoolCounts(); for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { message.append("Pool for " + entry.getKey().getTitle() + " has " + entry.getValue().getActiveEntityCount() + " entities \n"); } return message.toString(); }
Source:
public void addError(AuditEvent event) { final int line = event.getLine(); final String message = event.getMessage(); if (position >= comments.length) { fail("found a warning when none was expected for #" + position + " at line " + line + " with message " + message); } final IndentComment comment = comments[position]; position++; final String possibleExceptedMessages = Arrays.stream(comment.getExpectedMessages()) .reduce("", (cur, next) -> cur + "\"" + next + "\", "); final boolean hasExpectedMessagePostfix = Arrays.stream(comment.getExpectedMessages()).anyMatch(message::endsWith); assertTrue( "input expected warning #" + position + " at line " + comment.getLineNumber() + " to report one of the following: " + possibleExceptedMessages + "but got instead: " + line + ": " + message, hasExpectedMessagePostfix && line == comment.getLineNumber()); }

Target:
public void addError(AuditEvent event) { final int line = event.getLine(); final String message = event.getMessage(); if (position >= comments.length) { fail("found a warning when none was expected for #" + position + " at line " + line + " with message " + message); } final IndentComment comment = comments[position]; position++; final String possibleExceptedMessages = Arrays.stream(comment.getExpectedMessages()) .reduce("", (cur, next) -> cur + "\"" + next + "\", "); final String assertMessage = String.format( Locale.ROOT, "input expected warning #%d at line %d to report one of the following: %s" + "but got instead: %d: %s", position, comment.getLineNumber(), possibleExceptedMessages, line, message); assertTrue(assertMessage, line == comment.getLineNumber() && Arrays.stream(comment.getExpectedMessages()).anyMatch(message::endsWith)); }
Source:
public Iterable<Directive> process(final XML xml) throws IOException { final XML req = xml.nodes("/talk/request").get(0); final Issue.Smart issue = new TalkIssues(this.github, xml).get(); final String tag = req.xpath("args/arg[@name='tag']/text()").get(0); final Releases.Smart rels = new Releases.Smart(issue.repo().releases()); final URI home = new Home(xml).uri(); final List<DefaultArtifactVersion> previous = this.transformVers(rels); if (rels.exists(tag)) { final Release.Smart rel = new Release.Smart(rels.find(tag)); rel.body( String.format( "%s\n\nSee also #%d and [build log](%s)", rel.body(), issue.number(), home ) ); issue.comments().post( String.format( CommentsTag.PHRASES.getString("CommentsTag.duplicate"), tag ) ); Logger.info(this, "duplicate tag %s commented", tag); } else if (CommentsTag.isVersionValid(tag) && !CommentsTag.isReleaseValid(tag, previous)) { issue.comments().post( String.format( CommentsTag.PHRASES.getString("CommentsTag.version-to-low"), tag, previous.toString() ) ); Logger.info( this, "tag %s must be greater than previous version %s", tag, previous ); } else { final Repo repo = issue.repo(); final Date prev = CommentsTag.previous(repo); final Release.Smart rel = new Release.Smart( rels.create(tag.trim()) ); rel.name(issue.title()); rel.prerelease(true); rel.body( String.format( "See #%d, release log:\n\n%s\n\nReleased by Rultor %s, see [build log](%s)", issue.number(), new CommitsLog(repo).build(prev, rel.publishedAt()), Manifests.read("Rultor-Version"), home ) ); Logger.info(this, "tag %s created and commented", tag); } return new Directives(); }

Target:
public Iterable<Directive> process(final XML xml) throws IOException { final XML req = xml.nodes("/talk/request").get(0); final Issue.Smart issue = new TalkIssues(this.github, xml).get(); final String tag = req.xpath("args/arg[@name='tag']/text()").get(0); final Releases.Smart rels = new Releases.Smart(issue.repo().releases()); final URI home = new Home(xml).uri(); final List<DefaultArtifactVersion> previous = this.versions(rels); if (rels.exists(tag)) { final Release.Smart rel = new Release.Smart(rels.find(tag)); rel.body( String.format( "%s\n\nSee also #%d and [build log](%s)", rel.body(), issue.number(), home ) ); this.comment( issue, String.format( CommentsTag.PHRASES.getString("CommentsTag.duplicate"), tag ) ); } else if (CommentsTag.invalid(tag)) { this.comment( issue, String.format( CommentsTag.PHRASES.getString("CommentsTag.invalid-tag"), tag ) ); } else if (CommentsTag.tooOld(tag, previous)) { this.comment( issue, String.format( CommentsTag.PHRASES.getString("CommentsTag.version-too-low"), tag, previous.toString() ) ); } else { final Repo repo = issue.repo(); final Date prev = CommentsTag.previous(repo); final Release.Smart rel = new Release.Smart( rels.create(tag.trim()) ); rel.name(issue.title()); rel.prerelease(true); rel.body( String.format( "See #%d, release log:\n\n%s\n\nReleased by Rultor %s, see [build log](%s)", issue.number(), new CommitsLog(repo).build(prev, rel.publishedAt()), Manifests.read("Rultor-Version"), home ) ); Logger.info(this, "tag %s created and commented", tag); } return new Directives(); }
Source:
public void clear() { notifyInactive(); setPreviewSurfaceCallback(null); super.clear(); }

Target:
public void clear() { notifyInactive(); if (mSurfaceHolder != null) { mSurfaceHolder.release(); } super.clear(); }
Source:
public void testExecuteAndPostProcess() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; gaeSimulation.loginAsInstructor(instructorId); ______TS("Unsuccessful case: not enough parameters"); verifyAssumptionFailure(); String[] submissionParams = new String[] {}; verifyAssumptionFailure(submissionParams); ______TS("typical successful case"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, Const.ParamsNames.COURSE_INDEX, "1", Const.ParamsNames.USER_ID, instructor.googleId }; InstructorCourseEnrollAjaxPageAction action = getAction(submissionParams); AjaxResult ar = getAjaxResult(action); InstructorCourseEnrollAjaxPageData pageData = (InstructorCourseEnrollAjaxPageData) ar.data; String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : pageData.students) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }

Target:
public void testExecuteAndPostProcess() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; gaeSimulation.loginAsInstructor(instructorId); ______TS("Unsuccessful case: not enough parameters"); verifyAssumptionFailure(); String[] submissionParams = new String[] {}; verifyAssumptionFailure(submissionParams); ______TS("typical successful case"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; InstructorCourseEnrollAjaxPageAction action = getAction(submissionParams); AjaxResult ajaxResult = getAjaxResult(action); assertNotNull(ajaxResult); InstructorCourseEnrollAjaxPageData pageData = (InstructorCourseEnrollAjaxPageData) ajaxResult.data; String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : pageData.students) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }
Source:
public void routeError(Exception error, Consumer<CoreEvent> continueCallback, Consumer<Throwable> propagateCallback) { MessagingException messagingError = (MessagingException) error; CoreEvent failureEvent = messagingError.getEvent(); routingSink.get().next(quickCopy(failureEvent, of(getParameterId(ERROR_EXCEPTION, failureEvent), error, getParameterId(ERROR_SUCCESS_CALLBACK, failureEvent), continueCallback, getParameterId(ERROR_RETHROWN_CALLBACK, failureEvent), propagateCallback, getParameterId(ERROR_EVENT, failureEvent), failureEvent))); }

Target:
public void routeError(Exception error, Consumer<CoreEvent> continueCallback, Consumer<Throwable> propagateCallback) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Routing error in '" + this.toString() + "'..."); } MessagingException messagingError = (MessagingException) error; CoreEvent failureEvent = messagingError.getEvent(); routingSink.get().next(quickCopy(failureEvent, of(getParameterId(ERROR_EXCEPTION, failureEvent), error, getParameterId(ERROR_SUCCESS_CALLBACK, failureEvent), continueCallback, getParameterId(ERROR_RETHROWN_CALLBACK, failureEvent), propagateCallback, getParameterId(ERROR_EVENT, failureEvent), failureEvent))); }
Source:
public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { for (PreReceiveHook hook : hooks) { hook.onPreReceive(rp, commands); } }

Target:
public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { for (int i = 0; i < count; i++) hooks[i].onPreReceive(rp, commands); }
Source:
private static org.ehcache.xml.model.ResourceUnit unparseUnit(ResourceUnit resourceUnit) { if (resourceUnit instanceof EntryUnit) { return org.ehcache.xml.model.ResourceUnit.ENTRIES; } else { return org.ehcache.xml.model.ResourceUnit.valueOf(((MemoryUnit) resourceUnit).name()); } }

Target:
private static org.ehcache.xml.model.ResourceUnit unparseUnit(ResourceUnit resourceUnit) { if (resourceUnit instanceof EntryUnit) { return org.ehcache.xml.model.ResourceUnit.ENTRIES; } else { return org.ehcache.xml.model.ResourceUnit.fromValue(resourceUnit.toString()); } }
Source:
public void dropIndex(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { PreparedStatement pstmt = null; try (Connection conn = getConnection()) { int databaseId = getDatabaseId(databaseName); String sql = String.format("SELECT INDEX_NAME FROM %s WHERE %s=? AND INDEX_NAME=?", TB_INDEXES, COL_DATABASES_PK); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); ResultSet res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(CatalogUtil.buildFQName(databaseName, indexName)); } pstmt.close(); res.close(); sql = "DELETE FROM " + TB_INDEXES + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); pstmt.executeUpdate(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt); } }

Target:
public void dropIndex(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { Connection conn; PreparedStatement pstmt = null; try { int databaseId = getDatabaseId(databaseName); String sql = String.format("SELECT INDEX_NAME FROM %s WHERE %s=? AND INDEX_NAME=?", TB_INDEXES, COL_DATABASES_PK); conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); ResultSet res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(CatalogUtil.buildFQName(databaseName, indexName)); } pstmt.close(); res.close(); sql = "DELETE FROM " + TB_INDEXES + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); pstmt.executeUpdate(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt); } }
Source:
public void testInnerInequalityJoinWithEquiJoinConjuncts() throws Exception { assertPlan("SELECT 1 FROM orders o JOIN lineitem l ON o.shippriority = l.linenumber AND o.orderkey < l.orderkey", anyTree( join(INNER, ImmutableList.of(equiJoinClause("O_SHIPPRIORITY", "L_LINENUMBER")), Optional.of("O_ORDERKEY < L_ORDERKEY"), any(tableScan("orders", ImmutableMap.of( "O_SHIPPRIORITY", "shippriority", "O_ORDERKEY", "orderkey"))), anyTree(tableScan("lineitem", ImmutableMap.of( "L_LINENUMBER", "linenumber", "L_ORDERKEY", "orderkey")))))); }

Target:
public void testInnerInequalityJoinWithEquiJoinConjuncts() throws Exception { assertPlan("SELECT 1 FROM orders o JOIN lineitem l ON o.shippriority = l.linenumber AND o.orderkey < l.orderkey", anyTree( anyNot(FilterNode.class, join(INNER, ImmutableList.of(equiJoinClause("O_SHIPPRIORITY", "L_LINENUMBER")), Optional.of("O_ORDERKEY < L_ORDERKEY"), any(tableScan("orders", ImmutableMap.of( "O_SHIPPRIORITY", "shippriority", "O_ORDERKEY", "orderkey"))), anyTree(tableScan("lineitem", ImmutableMap.of( "L_LINENUMBER", "linenumber", "L_ORDERKEY", "orderkey"))))))); }
Source:
public void testSimpleGetAll() throws Exception { Cache<Number, CharSequence> testCache = cacheManager.createCache("testCache", CacheConfigurationBuilder.newCacheConfigurationBuilder().buildConfig(Number.class, CharSequence.class)); testCache.put(1, "one"); testCache.put(2, "two"); Map<Number, CharSequence> all = testCache.getAll(Arrays.asList(1, 2, 3)); assertThat(all.size(), is(2)); assertThat(all.get(1), Matchers.<CharSequence>equalTo("one")); assertThat(all.get(2), Matchers.<CharSequence>equalTo("two")); assertThat(all.get(3), is(nullValue())); }

Target:
public void testSimpleGetAll() throws Exception { Cache<Number, CharSequence> testCache = cacheManager.createCache("testCache", CacheConfigurationBuilder.newCacheConfigurationBuilder().buildConfig(Number.class, CharSequence.class)); testCache.put(1, "one"); testCache.put(2, "two"); Map<Number, CharSequence> all = testCache.getAll(Arrays.asList(1, 2, 3)); assertThat(all.keySet(), containsInAnyOrder((Number)1, 2)); assertThat(all.get(1), Matchers.<CharSequence>equalTo("one")); assertThat(all.get(2), Matchers.<CharSequence>equalTo("two")); }
Source:
public void removeAllPlayers() { removePlayers( players ); players.clear(); }

Target:
public void removeAllPlayers() { sendToAffected( removePacket ); players.clear(); }
Source:
protected void doStop() { autoEncryptionSupport.close(); super.doStop(); LDAPCache.clear(); }

Target:
protected void doStop() { if (autoEncryptionSupport != null) { autoEncryptionSupport.close(); } super.doStop(); LDAPCache.clear(); }
Source:
public boolean isResponseTypeAllowed(ResponseType responseType) { return isResponseTypeAllowed(responseType); }

Target:
public boolean isResponseTypeAllowed(ResponseType responseType) { return isFlowSupported(responseType); }
Source:
public void testEnforceValidityWarningsOnly() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, true, getAdminConfig()); ingestXmlFromResourceWaitForFailure(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_BAD_REQUEST); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); }

Target:
public void testEnforceValidityWarningsOnly() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, true, getAdminConfig()); try { ingestXmlFromResourceWaitForFailure(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_BAD_REQUEST); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); } finally { configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); } }
Source:
public int hashCode() { int result = defaultField != null ? defaultField.hashCode() : 0; result = 31 * result + (getAuthors() != null ? getAuthors().hashCode() : 0); result = 31 * result + (getTitlePhrases() != null ? getTitlePhrases().hashCode() : 0); result = 31 * result + (getAbstractPhrases() != null ? getTitlePhrases().hashCode() : 0); result = 31 * result + (getFromYear().isPresent() ? getFromYear().hashCode() : 0); result = 31 * result + (getToYear().isPresent() ? getToYear().hashCode() : 0); result = 31 * result + (getSingleYear().isPresent() ? getSingleYear().hashCode() : 0); result = 31 * result + (getJournal().isPresent() ? getJournal().hashCode() : 0); return result; }

Target:
public int hashCode() { return Objects.hash(defaultField, getAuthors(), getSingleYear(), getAbstractPhrases(), getFromYear(), getToYear(), getTitlePhrases(), getJournal()); }
Source:
public void testGetterValidationOccursBecauseItIsEnabledInXml() throws Exception { assertNotNull( repeater ); try { repeater.getHelloWorld(); fail( "method validation should be disabled via validation.xml" ); } catch ( ConstraintViolationException e ) { } }

Target:
public void testGetterValidationOccursBecauseItIsEnabledInXml() throws Exception { assertNotNull( repeater ); try { repeater.getHelloWorld(); fail( "method validation should be enabled via validation.xml" ); } catch ( ConstraintViolationException e ) { } }