auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static void openHttpLocationInBrowser(final String uri, IWorkbenchPage page) { page.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { URL url = new URL(uri); IWorkbenchBrowserSupport browserSupport = page.getWorkbenchWindow().getWorkbench() .getBrowserSupport(); String browserName = uri; if (browserName.length() > MAX_BROWSER_NAME_LENGTH) { browserName = uri.substring(0, MAX_BROWSER_NAME_LENGTH) + "..."; } browserSupport .createBrowser(IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, "lsp4e-symbols", browserName, uri) .openURL(url); } catch (Exception e) { LanguageServerPlugin.logError(e); } } }); }

Target:
protected static void openHttpLocationInBrowser(final String uri, IWorkbenchPage page) { page.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { URL url = new URL(uri); IWorkbenchBrowserSupport browserSupport = page.getWorkbenchWindow().getWorkbench() .getBrowserSupport(); String browserName = uri; if (browserName.length() > MAX_BROWSER_NAME_LENGTH) { browserName = uri.substring(0, MAX_BROWSER_NAME_LENGTH - 1) + "\u2026"; } browserSupport .createBrowser(IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, "lsp4e-symbols", browserName, uri) .openURL(url); } catch (Exception e) { LanguageServerPlugin.logError(e); } } }); }
Source:
private ResourceLock newWriteUnlocker() { return () -> CloseableReentrantReadWriteLock.this.writeLock().unlock(); }

Target:
private ResourceLock newWriteUnlocker() { return () -> this.writeLock().unlock(); }
Source:
public void handleRequest(HttpServerExchange exchange) throws Exception { String user = exchange.getRequestHeaders().getFirst("User"); if(user != null) { exchange.putAttachment(ExternalAuthenticationMechanism.EXTERNAL_PRINCIPAL, user); exchange.putAttachment(HttpServerExchange.REMOTE_USER, user); exchange.putAttachment(ExternalAuthenticationMechanism.EXTERNAL_AUTHENTICATION_TYPE, "user-header"); } next.handleRequest(exchange); }

Target:
public void handleRequest(HttpServerExchange exchange) throws Exception { String user = exchange.getRequestHeaders().getFirst("User"); if(user != null && (user.equals(Credentials.GOOD_USER_NAME) || user.equals(Credentials.BAD_USER_NAME))) { exchange.putAttachment(ExternalAuthenticationMechanism.EXTERNAL_PRINCIPAL, user); exchange.putAttachment(HttpServerExchange.REMOTE_USER, user); exchange.putAttachment(ExternalAuthenticationMechanism.EXTERNAL_AUTHENTICATION_TYPE, "user-header"); } next.handleRequest(exchange); }
Source:
protected ToggleButton convertToToggleButton(CategoryDTO category) { final ToggleButton categoryButton = createSidebarToggleButton(category.getName()); categoryButton.setId(String.format("%sButton", category.getId().toLowerCase())); categoryButton.setOnAction(event -> { getControl().setSelectedElement(category); getControl().getOnCategorySelection().accept(category); }); return categoryButton; }

Target:
protected ToggleButton convertToToggleButton(CategoryDTO category) { final ToggleButton categoryButton = createSidebarToggleButton(category.getName()); categoryButton.setId(String.format("%sButton", category.getId().toLowerCase())); categoryButton.setOnAction(event -> getControl().setSelectedElement(category)); return categoryButton; }
Source:
private List<RemoteReplicaInfo> createRemoteReplicaInfos(List<? extends ReplicaId> peerReplicas, ReplicaId replicaId) { List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); PartitionId partition = replicaId.getPartitionId(); Store store = storageManager.getStore(partition); for (ReplicaId remoteReplica : peerReplicas) { FindToken findToken = this.tokenHelper.getFindTokenFactoryFromReplicaType(remoteReplica.getReplicaType()).getNewFindToken(); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(remoteReplica, replicaId, store, findToken, storeConfig.storeDataFlushIntervalSeconds * SystemTime.MsPerSec * Replication_Delay_Multiplier, SystemTime.getInstance(), remoteReplica.getDataNodeId().getPortToConnectTo()); replicationMetrics.addMetricsForRemoteReplicaInfo(remoteReplicaInfo); remoteReplicaInfos.add(remoteReplicaInfo); } if (replicationConfig.replicationTrackPerPartitionLagFromRemote) { replicationMetrics.addLagMetricForPartition(partition); } return remoteReplicaInfos; }

Target:
private List<RemoteReplicaInfo> createRemoteReplicaInfos(List<? extends ReplicaId> peerReplicas, ReplicaId replicaId) { List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); PartitionId partition = replicaId.getPartitionId(); Store store = storageManager.getStore(partition); for (ReplicaId remoteReplica : peerReplicas) { FindToken findToken = this.tokenHelper.getFindTokenFactoryFromReplicaType(remoteReplica.getReplicaType()).getNewFindToken(); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(remoteReplica, replicaId, store, findToken, TimeUnit.SECONDS.toMillis(storeConfig.storeDataFlushIntervalSeconds) * Replication_Delay_Multiplier, SystemTime.getInstance(), remoteReplica.getDataNodeId().getPortToConnectTo()); replicationMetrics.addMetricsForRemoteReplicaInfo(remoteReplicaInfo); remoteReplicaInfos.add(remoteReplicaInfo); } if (replicationConfig.replicationTrackPerPartitionLagFromRemote) { replicationMetrics.addLagMetricForPartition(partition); } return remoteReplicaInfos; }
Source:
public void performBasicSendCompressReceiveTestCase() throws MqttException, XPathExpressionException, IOException { String topic = "BasicSendCompressReceiveTestCase"; int noOfSubscribers = 1; int noOfPublishers = 1; int noOfMessages = 1; boolean saveMessages = true; int messageSize = 250 * 1024; String filePath = MQTTConstants.MESSAGE_CONTENT_RANDOM_FILE_PATH; MQTTClientEngine mqttClientEngine = new MQTTClientEngine(); mqttClientEngine.createSubscriberConnection(topic, QualityOfService.LEAST_ONCE, noOfSubscribers, saveMessages, ClientMode.BLOCKING, automationContext); AndesClientUtils.createRandomFile(filePath, messageSize); Path path = Paths.get(filePath); byte[] payload = Files.readAllBytes(path); mqttClientEngine.createPublisherConnection(topic, QualityOfService.LEAST_ONCE, payload, noOfPublishers, noOfMessages, ClientMode.BLOCKING, automationContext); mqttClientEngine.waitUntilAllMessageReceivedAndShutdownClients(); List<MqttMessage> receivedMessages = mqttClientEngine.getReceivedMessages(); Assert.assertEquals(receivedMessages.size(), noOfMessages, "The received message count is incorrect."); Assert.assertEquals(receivedMessages.get(0).getPayload(), payload, "The received message is incorrect"); if (AndesClientUtils.deleteRandomFile(filePath)) { log.info("Deleting created file... " + filePath); } }

Target:
public void performBasicSendCompressReceiveTestCase() throws MqttException, XPathExpressionException, IOException { String topic = "BasicSendCompressReceiveTestCase"; int noOfSubscribers = 1; int noOfPublishers = 1; int noOfMessages = 1; boolean saveMessages = true; int messageSize = 250 * 1024; MQTTClientEngine mqttClientEngine = new MQTTClientEngine(); mqttClientEngine.createSubscriberConnection(topic, QualityOfService.LEAST_ONCE, noOfSubscribers, saveMessages, ClientMode.BLOCKING, automationContext); byte[] payload = new byte[messageSize]; new Random().nextBytes(payload); mqttClientEngine.createPublisherConnection(topic, QualityOfService.LEAST_ONCE, payload, noOfPublishers, noOfMessages, ClientMode.BLOCKING, automationContext); mqttClientEngine.waitUntilAllMessageReceivedAndShutdownClients(); List<MqttMessage> receivedMessages = mqttClientEngine.getReceivedMessages(); Assert.assertEquals(receivedMessages.size(), noOfMessages, "The received message count is incorrect."); Assert.assertEquals(receivedMessages.get(0).getPayload(), payload, "The received message is incorrect"); }
Source:
public void connect() { RiemannDiscovery discover = new RiemannDiscovery(); try { String machinePrefix = (discover.retrieveName().startsWith("prod") ? "prod" : "develop"); riemannIP = (Iterables.get(discover.describeInstancesByName(machinePrefix + "-riemann-instance"), 0)).getPrivateIpAddress(); client = RiemannClient.tcp(riemannIP, 5555); client.connect(); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void connect() { if (client == null || !client.isConnected()) { try { riemannIP = getRiemannIP(new RiemannDiscovery()); client = RiemannClient.tcp(riemannIP, 5555); client.connect(); } catch (IOException e) { throw Throwables.propagate(e); } } }
Source:
public Iterable<Edge> getEdges(final String key, final Object value) { final AutoIndexer indexer = this.rawGraph.index().getRelationshipAutoIndexer(); if (indexer.isEnabled() && indexer.getAutoIndexedProperties().contains(key)) { this.autoStartTransaction(false); return new Neo4j2EdgeIterable(this.rawGraph.index().getRelationshipAutoIndexer().getAutoIndex().get(key, value), this, this.checkElementsInTransaction()); } else { return new PropertyFilteredIterable<Edge>(key, value, this.getEdges()); } }

Target:
public Iterable<Edge> getEdges(final String key, final Object value) { this.autoStartTransaction(false); final AutoIndexer indexer = this.rawGraph.index().getRelationshipAutoIndexer(); if (indexer.isEnabled() && indexer.getAutoIndexedProperties().contains(key)) return new Neo4j2EdgeIterable(this.rawGraph.index().getRelationshipAutoIndexer().getAutoIndex().get(key, value), this, this.checkElementsInTransaction()); else return new PropertyFilteredIterable<Edge>(key, value, this.getEdges()); }
Source:
public Pair<View, String>[] getSharedElements() { return TransitionUtil.getSharedElements(getContext(), titleView, subtitleView, imageView); }

Target:
public Pair<View, String>[] getSharedElements() { return TransitionUtil.getSharedElements(getContext(), imageView); }
Source:
private void launchCommand(Command command, IConsoleParser[] parsers, InvocationParameters parameters, ConfigurationSettings settings) throws InvocationFailure, CoreException { IProject project = parameters.getActualFile().getProject(); IConsole c = startConsole(project, settings.getExternalToolName()); ConsoleOutputSniffer sniffer = new ConsoleOutputSniffer(c.getOutputStream(), c.getErrorStream(), parsers); ICommandLauncher launcher = commandLauncher(project); Process p = launcher.execute(command.getPath(), command.getArgs(), ENV, parameters.getWorkingDirectory(), NULL_PROGRESS_MONITOR); if (p == null) { throw new InvocationFailure("Unable to launch external tool. Cause unknown."); } try { p.getOutputStream().close(); } catch (Throwable ignored) try { launcher.waitAndRead(sniffer.getOutputStream(), sniffer.getErrorStream(), NULL_PROGRESS_MONITOR); } finally { p.destroy(); } }

Target:
private void launchCommand(Command command, IConsoleParser[] parsers, InvocationParameters parameters, ConfigurationSettings settings) throws InvocationFailure, CoreException { IProject project = parameters.getActualFile().getProject(); IConsole c = startConsole(project, settings.getExternalToolName()); ConsoleOutputSniffer sniffer = new ConsoleOutputSniffer(c.getOutputStream(), c.getErrorStream(), parsers); ICommandLauncher launcher = commandLauncher(project); Process p = launcher.execute(command.getPath(), command.getArgs(), ENV, parameters.getWorkingDirectory(), NULL_PROGRESS_MONITOR); if (p == null) { String format = "Unable to launch external tool '%s'. Cause unknown."; throw new InvocationFailure(String.format(format, settings.getExternalToolName())); } try { p.getOutputStream().close(); } catch (Throwable ignored) try { launcher.waitAndRead(sniffer.getOutputStream(), sniffer.getErrorStream(), NULL_PROGRESS_MONITOR); } finally { p.destroy(); } }
Source:
public Socket createSocket() { return new Socket() { RandomAccessFile file; InputStream is; OutputStream os; @Override public void close() throws IOException { if (file != null) { file.close(); file = null; } } @Override public void connect(SocketAddress endpoint) { connect(endpoint, 0); } public void connect(SocketAddress endpoint, int timeout) { file = Unreliables.retryUntilSuccess(Math.max(timeout, 10_000), TimeUnit.MILLISECONDS, () -> { try { return new RandomAccessFile(socketFileName, "rw"); } catch (FileNotFoundException e) { Kernel32.INSTANCE.WaitNamedPipe(socketFileName, 100); throw e; } }); is = new InputStream() { @Override public int read(byte[] bytes, int off, int len) throws IOException { return file.read(bytes, off, len); } @Override public int read() throws IOException { return file.read(); } @Override public int read(byte[] bytes) throws IOException { return file.read(bytes); } }; os = new OutputStream() { @Override public void write(byte[] bytes, int off, int len) throws IOException { file.write(bytes, off, len); } @Override public void write(int value) throws IOException { file.write(value); } @Override public void write(byte[] bytes) throws IOException { file.write(bytes); } }; } public InputStream getInputStream() { return is; } public OutputStream getOutputStream() { return os; } public void setTcpNoDelay(boolean bool) { } public void setKeepAlive(boolean bool) { } public void setReceiveBufferSize(int size) { } public void setSendBufferSize(int size) { } public void setSoLinger(boolean bool, int value) { } @Override public void setSoTimeout(int timeout) { } public void shutdownInput() { } public void shutdownOutput() { } }; }

Target:
public Socket createSocket() { return new Socket() { RandomAccessFile file; InputStream is; OutputStream os; @Override public void close() throws IOException { if (file != null) { file.close(); file = null; } } @Override public void connect(SocketAddress endpoint) { connect(endpoint, 0); } @Override public void connect(SocketAddress endpoint, int timeout) { file = Unreliables.retryUntilSuccess(Math.max(timeout, 10_000), TimeUnit.MILLISECONDS, () -> { try { return new RandomAccessFile(socketFileName, "rw"); } catch (FileNotFoundException e) { Kernel32.INSTANCE.WaitNamedPipe(socketFileName, 100); throw e; } }); is = new InputStream() { @Override public int read(byte[] bytes, int off, int len) throws IOException { return file.read(bytes, off, len); } @Override public int read() throws IOException { return file.read(); } @Override public int read(byte[] bytes) throws IOException { return file.read(bytes); } }; os = new OutputStream() { @Override public void write(byte[] bytes, int off, int len) throws IOException { file.write(bytes, off, len); } @Override public void write(int value) throws IOException { file.write(value); } @Override public void write(byte[] bytes) throws IOException { file.write(bytes); } }; } @Override public InputStream getInputStream() { return is; } @Override public OutputStream getOutputStream() { return os; } }; }
Source:
protected CustomObject<T> deserializeCustomObject(final HttpResponse httpResponse) { if(!httpResponse.hasSuccessResponseCode()){ return null; } JavaType customObjectJavaType = SphereJsonUtils.createCustomObjectJavaType( CustomObject.class, javaType.getRawClass()); return Optional.ofNullable(httpResponse) .filter(response -> response.getResponseBody() != null && response.getResponseBody().length > 0) .map(response -> response.getResponseBody()) .map(responseBody -> SphereJsonUtils.<CustomObject<T>>readObject(httpResponse.getResponseBody(), customObjectJavaType)) .orElse(null); }

Target:
protected CustomObject<T> deserializeCustomObject(final HttpResponse httpResponse) { if(!httpResponse.hasSuccessResponseCode()){ return null; } return Optional.ofNullable(httpResponse) .filter(response -> response.getResponseBody() != null && response.getResponseBody().length > 0) .map(response -> response.getResponseBody()) .map(responseBody -> SphereJsonUtils.<CustomObject<T>>readObject(httpResponse.getResponseBody(), customObjectJavaType)) .orElse(null); }
Source:
public void onCreate() { super.onCreate(); Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); Security.insertProviderAt(new BouncyCastleProvider(), 1); PRNGFixes.apply(); Log.d(Constants.TAG, "Bouncy Castle set and PRNG Fixes applied!"); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) { } } brandGlowEffect(getApplicationContext(), FormattingUtils.getColorFromAttr(getApplicationContext(), R.attr.colorPrimary)); createAccountIfNecessary(this); if (Preferences.getPreferences(this).isFirstTime()) { ContactSyncAdapterService.enableContactsSync(this); } KeyserverSyncAdapterService.updateKeyserverSync(this); Preferences.getPreferences(this).upgradePreferences(this); TlsHelper.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer"); TlsHelper.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer"); TlsHelper.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer"); TemporaryFileProvider.cleanUp(this); if (!checkConsolidateRecovery()) { new KeychainDatabase(this).getReadableDatabase().close(); } }

Target:
public void onCreate() { super.onCreate(); Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); Security.insertProviderAt(new BouncyCastleProvider(), 1); PRNGFixes.apply(); Log.d(Constants.TAG, "Bouncy Castle set and PRNG Fixes applied!"); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) { } } brandGlowEffect(getApplicationContext(), FormattingUtils.getColorFromAttr(getApplicationContext(), R.attr.colorPrimary)); createAccountIfNecessary(this); if (Preferences.getKeyserverSyncEnabled(this)) { KeyserverSyncAdapterService.enableKeyserverSync(this); } if (Preferences.getPreferences(this).isFirstTime()) { KeyserverSyncAdapterService.enableKeyserverSync(this); ContactSyncAdapterService.enableContactsSync(this); } Preferences.getPreferences(this).upgradePreferences(this); TlsHelper.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer"); TlsHelper.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer"); TlsHelper.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer"); TemporaryFileProvider.cleanUp(this); if (!checkConsolidateRecovery()) { new KeychainDatabase(this).getReadableDatabase().close(); } }
Source:
public void sendMessage(String... messages) { String s=new String(); for(String text:messages){ s += text; } this.addChatMessage(new ChatComponentText(s)); }

Target:
public void sendMessage(String... messages) { for (String text : messages) { this.addChatMessage(new ChatComponentText(text)); } }
Source:
protected void run() throws Exception { final MutableObjectId idBuf = new MutableObjectId(); final Archiver fmt = formats.get(format); if (tree == null) throw die(CLIText.get().treeIsRequired); final ArchiveOutputStream outa = fmt.createArchiveOutputStream(outs); final TreeWalk walk = new TreeWalk(db); final ObjectReader reader = walk.getObjectReader(); try { walk.reset(); walk.addTree(tree); walk.setRecursive(true); while (walk.next()) { final String name = walk.getPathString(); final FileMode mode = walk.getFileMode(0); if (mode == FileMode.TREE) continue; walk.getObjectId(idBuf, 0); fmt.putEntry(name, mode, reader.open(idBuf), outa); } } finally { reader.release(); walk.release(); outa.close(); } }

Target:
protected void run() throws Exception { final MutableObjectId idBuf = new MutableObjectId(); final Archiver fmt = formats.get(format); if (tree == null) throw die(CLIText.get().treeIsRequired); final ArchiveOutputStream outa = fmt.createArchiveOutputStream(outs); final TreeWalk walk = new TreeWalk(db); final ObjectReader reader = walk.getObjectReader(); try { walk.reset(); walk.addTree(tree); walk.setRecursive(true); while (walk.next()) { final String name = walk.getPathString(); final FileMode mode = walk.getFileMode(0); if (mode == FileMode.TREE) continue; walk.getObjectId(idBuf, 0); fmt.putEntry(name, mode, reader.open(idBuf), outa); } } finally { reader.release(); outa.close(); } }
Source:
protected boolean canDoAction() { if (!validate(linkedToTemplate())) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForTemplate(getParameters().getVmTemplateId()); if (!validate(templateExists())) { return false; } VmNic oldIface = LinqUtils.firstOrNull(interfaces, new Predicate<VmNic>() { @Override public boolean eval(VmNic i) { return i.getId().equals(getParameters().getInterface().getId()); } }); if (oldIface == null) { return false; } if (!updateVnicForBackwardCompatibility(oldIface)) { return false; } Version clusterCompatibilityVersion = getVdsGroup().getcompatibility_version(); VmNicValidator nicValidator = new VmNicValidator(getParameters().getInterface(), clusterCompatibilityVersion, getVmTemplate().getOsId()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(getVmTemplate().getVdsGroupId()))) { return false; } if (!StringUtils.equals(oldIface.getName(), getInterfaceName()) && !interfaceNameUnique(interfaces)) { return false; } if (!checkPciAndIdeLimit(oldIface, new ArrayList<VmNic>(interfaces), clusterCompatibilityVersion)) { return false; } return true; }

Target:
protected boolean canDoAction() { if (!validate(linkedToTemplate())) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForTemplate(getParameters().getVmTemplateId()); if (!validate(templateExists())) { return false; } VmNic oldIface = LinqUtils.firstOrNull(interfaces, new Predicate<VmNic>() { @Override public boolean eval(VmNic i) { return i.getId().equals(getParameters().getInterface().getId()); } }); if (oldIface == null) { addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); return false; } if (!updateVnicForBackwardCompatibility(oldIface)) { return false; } Version clusterCompatibilityVersion = getVdsGroup().getcompatibility_version(); VmNicValidator nicValidator = new VmNicValidator(getParameters().getInterface(), clusterCompatibilityVersion, getVmTemplate().getOsId()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(getVmTemplate().getVdsGroupId()))) { return false; } if (!StringUtils.equals(oldIface.getName(), getInterfaceName()) && !interfaceNameUnique(interfaces)) { return false; } if (!checkPciAndIdeLimit(oldIface, new ArrayList<VmNic>(interfaces), clusterCompatibilityVersion)) { return false; } return true; }
Source:
private static Matcher<MkQuery> queryContainingHeader(final String header) { return new BaseMatcher<MkQuery>() { @Override public boolean matches(final Object object) { final MkQuery query = (MkQuery) object; return query.headers().containsKey(header); } @Override public void describeTo(final Description description) { description.appendText("contains "); description.appendText(header); } }; }

Target:
private static Matcher<MkQuery> queryContainingHeader(final String header) { return new TypeSafeMatcher<MkQuery>() { @Override protected boolean matchesSafely(final MkQuery query) { return query.headers().containsKey(header); } @Override public void describeTo(final Description description) { description.appendText("contains "); description.appendText(header); } }; }
Source:
public LabelTypes getLabelTypes() { Set<LabelType> r = Sets.newHashSet(); String destBranch = getChange().getDest().get(); for (LabelType l : getProjectControl().getLabelTypes().getLabelTypes()) { List<String> refs = l.getRefPatterns(); if (refs == null) { r.add(l); } else { for (String refPattern : refs) { if (RefConfigSection.isValid(refPattern) && match(destBranch, refPattern)) { r.add(l); break; } } } } return new LabelTypes(Lists.newArrayList(r)); }

Target:
public LabelTypes getLabelTypes() { List<LabelType> r = Lists.newArrayList(); String destBranch = getChange().getDest().get(); for (LabelType l : getProjectControl().getLabelTypes().getLabelTypes()) { List<String> refs = l.getRefPatterns(); if (refs == null) { r.add(l); } else { for (String refPattern : refs) { if (RefConfigSection.isValid(refPattern) && match(destBranch, refPattern)) { r.add(l); break; } } } } return new LabelTypes(r); }
Source:
private BigtableDataSettings.Builder buildBigtableDataSettings() throws IOException { BigtableDataSettings.Builder dataBuilder = BigtableDataSettings.newBuilder() .setProjectId(getProjectId()) .setInstanceId(getInstanceId()); String appProfileId = configuration.get(APP_PROFILE_ID_KEY); if (!isNullOrEmpty(appProfileId)) { dataBuilder.setAppProfileId(appProfileId); } EnhancedBigtableStubSettings.Builder stubSettings = dataBuilder.stubSettings(); buildEndpoints(stubSettings, BIGTABLE_HOST_KEY); buildHeaderProvider(stubSettings); buildCredentialProvider(stubSettings); String shortRpcTimeoutStr = configuration.get(BIGTABLE_RPC_TIMEOUT_MS_KEY); if (!isNullOrEmpty(shortRpcTimeoutStr)) { Duration shortRpcTimeout = ofMillis(Long.parseLong(shortRpcTimeoutStr)); stubSettings.checkAndMutateRowSettings().setSimpleTimeoutNoRetries(shortRpcTimeout); stubSettings.readModifyWriteRowSettings().setSimpleTimeoutNoRetries(shortRpcTimeout); } buildBulkMutationsSettings(stubSettings); buildBulkReadRowsSettings(stubSettings); buildReadRowsSettings(stubSettings); stubSettings .readRowSettings() .setRetryableCodes(buildRetryCodes(stubSettings.readRowSettings().getRetryableCodes())) .setRetrySettings( buildIdempotentRetrySettings(stubSettings.readRowSettings().getRetrySettings())); stubSettings .mutateRowSettings() .setRetryableCodes(buildRetryCodes(stubSettings.mutateRowSettings().getRetryableCodes())) .setRetrySettings( buildIdempotentRetrySettings(stubSettings.mutateRowSettings().getRetrySettings())); stubSettings .sampleRowKeysSettings() .setRetryableCodes( buildRetryCodes(stubSettings.sampleRowKeysSettings().getRetryableCodes())) .setRetrySettings( buildIdempotentRetrySettings(stubSettings.sampleRowKeysSettings().getRetrySettings())); buildEmulatorSettings(stubSettings); return dataBuilder; }

Target:
private BigtableDataSettings buildBigtableDataSettings() throws IOException { BigtableDataSettings.Builder dataBuilder = BigtableDataSettings.newBuilder() .setProjectId(getProjectId()) .setInstanceId(getInstanceId()); String appProfileId = configuration.get(APP_PROFILE_ID_KEY); if (!isNullOrEmpty(appProfileId)) { dataBuilder.setAppProfileId(appProfileId); } if (Boolean.parseBoolean(configuration.get(ALLOW_NO_TIMESTAMP_RETRIES_KEY))) { throw new UnsupportedOperationException("Retries without Timestamp is not supported."); } EnhancedBigtableStubSettings.Builder stubSettings = dataBuilder.stubSettings(); configureConnection(stubSettings, BIGTABLE_HOST_KEY); configureHeaderProvider(stubSettings); configureCredentialProvider(stubSettings); configureEmulatorSettings(stubSettings); configureBulkMutationSettings(stubSettings); configureBulkReadRowsSettings(stubSettings); configureMutateRowSettings(stubSettings); configureReadRowsSettings(stubSettings); configureNonIdempotentCallSettings(stubSettings.checkAndMutateRowSettings()); configureNonIdempotentCallSettings(stubSettings.readModifyWriteRowSettings()); configureIdempotentCallSettings(stubSettings.readRowSettings()); configureIdempotentCallSettings(stubSettings.sampleRowKeysSettings()); return dataBuilder.build(); }
Source:
public void onEvent(RedoEvent event) { final CommandResult<ScenarioSimulationViolation> status = scenarioCommandRegistry.redo(context); if (Objects.equals(CommandResult.Type.ERROR, status.getType())) { String violations = StreamSupport.stream(status.getViolations().spliterator(), false) .map(violation -> violation.getMessage()) .collect(Collectors.joining("\r\n")); String message = new StringBuilder() .append("Redo: " + status.getType()) .append("\r\n") .append(violations) .toString(); notificationEvent.fire(new NotificationEvent(message, NotificationEvent.NotificationType.ERROR)); } }

Target:
public void onEvent(RedoEvent event) { final CommandResult<ScenarioSimulationViolation> status = scenarioCommandRegistry.redo(context); if (Objects.equals(CommandResult.Type.ERROR, status.getType())) { commonNotifyError(status, ScenarioSimulationEditorConstants.INSTANCE.redo()); } }
Source:
public BufferedMultipleAtomicCallField(String paramName, Stream<String> paramValues) { super(paramName); this.paramValues = (String[]) paramValues.toArray(); }

Target:
public BufferedMultipleAtomicCallField(String paramName, Stream<String> paramValues) { super(paramName); this.paramValues = paramValues.toArray(size -> new String[size]); }
Source:
public boolean isSatisfied() { javax.security.auth.Subject subject = javax.security.auth.Subject.getSubject(AccessController.getContext()); return subject .getPrincipals() .stream() .map(Principal::getName) .collect(Collectors.toList()) .containsAll(Arrays.asList(args)); }

Target:
public boolean isSatisfied() { javax.security.auth.Subject subject = javax.security.auth.Subject.getSubject(AccessController.getContext()); Set<Principal> principals = subject.getPrincipals(); List<String> principalNameList = new ArrayList<>(); for (Principal principal : principals) { principalNameList.add(principal.getName()); } return principalNameList.containsAll(argsAsList); }
Source:
public Object visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { final String groupName = command.getGroupName(); final boolean isOwner = groupManager.isOwner(groupName); updateTopologyId(command); final int commandTopologyId = command.getTopologyId(); if (ctx.isOriginLocal()) { Object localResult; try { localResult = invokeNextInterceptor(ctx, command); if (isOwner && currentTopologyId() != commandTopologyId) { logRetry(command); int newTopologyId = Math.max(currentTopologyId(), commandTopologyId + 1); command.setTopologyId(newTopologyId); waitForTransactionData(newTopologyId); localResult = visitGetKeysInGroupCommand(ctx, command); } } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; logRetry(command); int newTopologyId = Math.max(currentTopologyId(), commandTopologyId + 1); command.setTopologyId(newTopologyId); waitForTransactionData(newTopologyId); localResult = visitGetKeysInGroupCommand(ctx, command); } return localResult; } else { Object result = invokeNextInterceptor(ctx, command); if (isOwner && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException("Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } return result; } }

Target:
public Object visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { final String groupName = command.getGroupName(); final boolean isOwner = groupManager.isOwner(groupName); updateTopologyId(command); final int commandTopologyId = command.getTopologyId(); if (ctx.isOriginLocal()) { Object localResult; try { localResult = invokeNextInterceptor(ctx, command); if (isOwner && currentTopologyId() != commandTopologyId) { localResult = retryVisitGetKeysInGroupCommand(ctx, command, commandTopologyId); } } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; localResult = retryVisitGetKeysInGroupCommand(ctx, command, commandTopologyId); } return localResult; } else { Object result = invokeNextInterceptor(ctx, command); if (isOwner && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException("Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } return result; } }
Source:
public void createOrUpdateMeter(String classSimpleName, String key, String metricName, long value) { validateArguments(classSimpleName, metricName); String fullMetricName = MetricRegistry.name(classSimpleName, key, metricName); Meter meter = (Meter) checkCache(classSimpleName, fullMetricName).orElse(_metricRegistry.getMeters().get(fullMetricName)); if (meter == null) { meter = _metricRegistry.meter(fullMetricName); } meter.mark(value); updateCache(classSimpleName, fullMetricName, meter); }

Target:
public void createOrUpdateMeter(String classSimpleName, String key, String metricName, long value) { validateArguments(classSimpleName, metricName); String fullMetricName = MetricRegistry.name(classSimpleName, key, metricName); Meter meter = (Meter) checkCache(classSimpleName, fullMetricName).orElse(_metricRegistry.meter(fullMetricName)); meter.mark(value); updateCache(classSimpleName, fullMetricName, meter); }
Source:
public static boolean isValidPriority(String string) { return "P1".equals(string) || "P2".equals(string) || "P3".equals(string) || "P4".equals(string) || "P5".equals(string); }

Target:
public static boolean isValidPriority(String string) { try { PriorityLevel.valueOf(string); return true; } catch (IllegalArgumentException e) { return false; } }
Source:
public static void getClusterListByName(AsyncQuery aQuery, String name) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { List<VDSGroup> result = new ArrayList<VDSGroup>(); if (source == null || !(source instanceof VDSGroup)) { return result; } result.add((VDSGroup) source); return result; } }; Frontend.getInstance().runQuery(VdcQueryType.GetVdsGroupByName, new NameQueryParameters(name), aQuery); }

Target:
public static void getClusterListByName(AsyncQuery aQuery, String name) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { List<VDSGroup> result = new ArrayList<VDSGroup>(); if (source == null) { return result; } result.add((VDSGroup) source); return result; } }; Frontend.getInstance().runQuery(VdcQueryType.GetVdsGroupByName, new NameQueryParameters(name), aQuery); }
Source:
protected void log(@Nullable WikiSite wiki, Object... params) { int rate = getSampleRate(); if (rate != SAMPLE_LOG_DISABLE) { boolean chosen = app.getEventLogSamplingID() % rate == 0 || ReleaseUtil.isDevRelease(); if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; for (int i = 0; i < params.length; i += 2) { preprocessData(eventData, params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } L.d(logString); EventLoggingEvent event = new EventLoggingEvent( schemaName, revision, wiki == null ? app.getWikiSite().dbName() : wiki.dbName(), preprocessData(eventData) ); WikipediaApp.getInstance().getApplicationContext().startService(AnalyticsIntentService.getIntent(event.getData().toString())); } } }

Target:
protected void log(@Nullable WikiSite wiki, Object... params) { int rate = getSampleRate(); if (rate != SAMPLE_LOG_DISABLE) { boolean chosen = app.getEventLogSamplingID() % rate == 0 || ReleaseUtil.isDevRelease(); if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; for (int i = 0; i < params.length; i += 2) { preprocessData(eventData, params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } L.d(logString); EventLoggingEvent event = new EventLoggingEvent( schemaName, revision, wiki == null ? app.getWikiSite().dbName() : wiki.dbName(), preprocessData(eventData) ); AnalyticsIntentService.enqueueService(WikipediaApp.getInstance(), event.getData().toString()); } } }
Source:
void setUp() { factory = shouldHaveSizeGreaterThan(newArrayList('a', 'b'), 4, 2); }

Target:
void setUp() { factory = shouldHaveSizeGreaterThan("ab", 4, 2); }
Source:
public org.hibernate.query.Query<R> setEntity(int position, Object val) { throw new UnsupportedOperationException( "setEntity(int,Object) is not implemented in Hibernate Search queries" ); }

Target:
public FullTextQuery<R> setEntity(int position, Object val) { throw new UnsupportedOperationException( "setEntity(int,Object) is not implemented in Hibernate Search queries" ); }
Source:
public <T> boolean checkAndCommit(String family, String qualifier, T value) throws IOException { Preconditions.checkState(mPut != null, "checkAndCommit must be paired with a call to begin()"); final KijiColumnName kijiColumnName = new KijiColumnName(family, qualifier); final HBaseColumnName columnName = mTranslator.toHBaseColumnName(kijiColumnName); final CellSpec cellSpec = mTable.getLayout().getCellSpec(kijiColumnName) .setSchemaTable(mTable.getKiji().getSchemaTable()); final KijiCellEncoder cellEncoder = DefaultKijiCellEncoderFactory.get().create(cellSpec); final byte[] encoded = cellEncoder.encode(value); for (KeyValue kv : mHopper) { mPut.add(kv); } boolean retVal = mHTable.checkAndPut( mId, columnName.getFamily(), columnName.getQualifier(), encoded, mPut); if (retVal) { if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } mPut = null; mEntityId = null; mHopper = null; mId = null; mLGNames = Sets.newHashSet(); } return retVal; }

Target:
public <T> boolean checkAndCommit(String family, String qualifier, T value) throws IOException { Preconditions.checkState(mPut != null, "checkAndCommit must be paired with a call to begin()"); final KijiColumnName kijiColumnName = new KijiColumnName(family, qualifier); final HBaseColumnName columnName = mTranslator.toHBaseColumnName(kijiColumnName); final CellSpec cellSpec = mTable.getLayout().getCellSpec(kijiColumnName) .setSchemaTable(mTable.getKiji().getSchemaTable()); final KijiCellEncoder cellEncoder = DefaultKijiCellEncoderFactory.get().create(cellSpec); final byte[] encoded = cellEncoder.encode(value); for (KeyValue kv : mHopper) { mPut.add(kv); } boolean retVal = mHTable.checkAndPut( mId, columnName.getFamily(), columnName.getQualifier(), encoded, mPut); if (retVal) { if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } reset(); } return retVal; }
Source:
public abstract void run() throws Exception; @Override public Void call() throws Exception { additionalValidation(); if(embedded) throw new UnsupportedOperationException( "The \"--embedded\" option is not supported yet"); if(noRetry) retry = 1; run(); return null; }

Target:
public abstract void run() throws Exception; @Override public Void call() throws Exception { additionalValidation(); if(embedded) throw new UnsupportedOperationException( "The \"--embedded\" option is not supported yet"); if(noRetry) retry = 0; run(); return null; }
Source:
public void run() { try { final Manufacturer manufacturer = this.findManufacturer(this.eventRetrievalScheduledTaskManufacturerName); if (manufacturer == null) { return; } final List<DeviceModel> deviceModels = this.findDeviceModels(manufacturer); if (deviceModels == null || deviceModels.isEmpty()) { return; } final List<Device> devices = this.findDevices(deviceModels); if (devices.isEmpty()) { return; } final List<Device> devicesToContact = this.findDevicesToContact(devices, this.eventRetrievalScheduledTaskMaximumAllowedAge); if (devicesToContact.isEmpty()) { return; } this.contactDevices(devicesToContact, DeviceFunction.GET_STATUS); } catch (final Exception e) { LOGGER.error("Exception caught during EventRetrievalScheduledTask.run()", e); } }

Target:
public void run() { try { final Manufacturer manufacturer = this.findManufacturer(this.eventRetrievalScheduledTaskManufacturerName); if (manufacturer == null) { return; } final List<DeviceModel> deviceModels = this.findDeviceModels(manufacturer); if (deviceModels == null || deviceModels.isEmpty()) { return; } final List<Device> devices = this.findDevices(deviceModels, Ssld.SSLD_TYPE); if (devices.isEmpty()) { return; } final List<Device> devicesToContact = this.findDevicesToContact(devices, this.eventRetrievalScheduledTaskMaximumAllowedAge); if (devicesToContact == null || devicesToContact.isEmpty()) { return; } this.contactDevices(devicesToContact, DeviceFunction.GET_STATUS); } catch (final Exception e) { LOGGER.error("Exception caught during EventRetrievalScheduledTask.run()", e); } }
Source:
public void checkName(String name) throws Failure { boolean matches = false; ArrayList<String> badList = null; final AuthorizationStrategy auth = Jenkins.getInstance().getAuthorizationStrategy(); if (auth instanceof RoleBasedAuthorizationStrategy) { final RoleBasedAuthorizationStrategy rbas = (RoleBasedAuthorizationStrategy) auth; boolean globalRolePermitted = false; final SortedMap<Role, Set<String>> gRole = rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.GLOBAL); for (final SortedMap.Entry<Role, Set<String>> entry : gRole.entrySet()) { if (entry.getKey().hasPermission(Item.CREATE)) { globalRolePermitted = true; break; } } if (!globalRolePermitted) { throw new Failure(Messages.RoleBasedProjectNamingStrategy_NoPermissions()); } final SortedMap<Role, Set<String>> roles = rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.PROJECT); badList = new ArrayList<>(roles.size()); for (final SortedMap.Entry<Role, Set<String>> entry : roles.entrySet()) { final Role key = entry.getKey(); if (key.hasPermission(Item.CREATE) && key.hasPermission(Item.READ) && key.hasPermission(Item.CONFIGURE) && isUserIncluded(entry.getValue())) { final String namePattern = key.getPattern().toString(); if (StringUtils.isNotBlank(namePattern) && StringUtils.isNotBlank(name)) { if (Pattern.matches(namePattern, name)) { matches = true; } else { badList.add(namePattern); } } } } } if (!matches) { String error; if (badList != null && !badList.isEmpty()) error = Messages.RoleBasedProjectNamingStrategy_JobNameConventionNotApplyed(name, badList.toString()); else error = Messages.RoleBasedProjectNamingStrategy_NoPermissions(); throw new Failure(error); } }

Target:
public void checkName(String name) throws Failure { boolean matches = false; ArrayList<String> badList = null; final AuthorizationStrategy auth = Jenkins.get().getAuthorizationStrategy(); if (auth instanceof RoleBasedAuthorizationStrategy) { final RoleBasedAuthorizationStrategy rbas = (RoleBasedAuthorizationStrategy) auth; boolean globalRolePermitted = false; final SortedMap<Role, Set<String>> gRole = rbas.getGrantedRoles(RoleType.Global); for (final SortedMap.Entry<Role, Set<String>> entry : gRole.entrySet()) { if (entry.getKey().hasPermission(Item.CREATE)) { globalRolePermitted = true; break; } } if (!globalRolePermitted) { throw new Failure(Messages.RoleBasedProjectNamingStrategy_NoPermissions()); } final SortedMap<Role, Set<String>> roles = rbas.getGrantedRoles(RoleType.Project); badList = new ArrayList<>(roles.size()); if (StringUtils.isNotBlank(name)) { for (SortedMap.Entry<Role, Set<String>> entry: roles.entrySet()) { Role key = entry.getKey(); if (key.hasPermission(Item.CREATE)) { String namePattern = key.getPattern().toString(); if (StringUtils.isNotBlank(namePattern)) { if (Pattern.matches(namePattern, name)){ matches = true; } else { badList.add(namePattern); } } } } } } if (!matches) { String error; if (badList != null && !badList.isEmpty()) error = Messages.RoleBasedProjectNamingStrategy_JobNameConventionNotApplyed(name, badList.toString()); else error = Messages.RoleBasedProjectNamingStrategy_NoPermissions(); throw new Failure(error); } }
Source:
public boolean supportsRefreshing() { for (AbstractTaskEditorPart part : subParts) { if (!part.supportsRefreshing()) { return false; } } return true; }

Target:
public boolean supportsRefreshing() { if (!super.supportsRefreshing()) { return false; } for (AbstractTaskEditorPart part : subParts) { if (!part.supportsRefreshing()) { return false; } } return true; }
Source:
public ObjectId readCherryPickHead() throws IOException, NoWorkTreeException { if (isBare() || getDirectory() == null) throw new NoWorkTreeException(); File mergeHeadFile = new File(getDirectory(), Constants.CHERRY_PICK_HEAD); byte[] raw; try { raw = IO.readFully(mergeHeadFile); } catch (FileNotFoundException notFound) { return null; } if (raw.length == 0) return null; ObjectId head = ObjectId.fromString(raw, 0); return head; }

Target:
public ObjectId readCherryPickHead() throws IOException, NoWorkTreeException { if (isBare() || getDirectory() == null) throw new NoWorkTreeException(); File mergeHeadFile = new File(getDirectory(), Constants.CHERRY_PICK_HEAD); byte[] raw; try { raw = IO.readFully(mergeHeadFile); } catch (FileNotFoundException notFound) { return null; } if (raw.length == 0) return null; return ObjectId.fromString(raw, 0); }
Source:
private void determineAtomicFileCreationSupport() { AtomicFileCreation ret = getAtomicFileCreationSupportOption( GlobalConfigCache.getInstance().getUserConfig()); if (ret == AtomicFileCreation.UNDEFINED && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } if (ret == AtomicFileCreation.UNDEFINED) { ret = AtomicFileCreation.SUPPORTED; } supportsAtomicCreateNewFile = ret; }

Target:
private void determineAtomicFileCreationSupport() { AtomicFileCreation ret; try { ret = getAtomicFileCreationSupportOption( GlobalConfigCache.getInstance().getUserConfig()); } catch (IOException | ConfigInvalidException e) { ret = AtomicFileCreation.UNDEFINED; } if (ret == AtomicFileCreation.UNDEFINED && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } if (ret == AtomicFileCreation.UNDEFINED) { ret = AtomicFileCreation.SUPPORTED; } supportsAtomicCreateNewFile = ret; }
Source:
private void maybeUpdateServer(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 100); IRemoteConnection conn = fRemoteServicesDelegate.getRemoteConnection(); LMLDAServer server = (LMLDAServer) RemoteServerManager.getServer(LMLDAServer.SERVER_ID, conn); server.waitForServerStart(60000); server.setWorkDir(new Path(conn.getWorkingDirectory()).append(JAXBControlConstants.ECLIPSESETTINGS).toString()); try { server.updateServer(progress.newChild(100)); } catch (IOException e) { throw CoreExceptionUtils.newException(e.getMessage(), e); } }

Target:
private void maybeUpdateServer(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 100); IRemoteConnection conn = fRemoteServicesDelegate.getRemoteConnection(); LMLDAServer server = (LMLDAServer) RemoteServerManager.getServer(LMLDAServer.SERVER_ID, conn); server.setWorkDir(new Path(conn.getWorkingDirectory()).append(JAXBControlConstants.ECLIPSESETTINGS).toString()); try { server.updateServer(progress.newChild(100)); } catch (IOException e) { throw CoreExceptionUtils.newException(e.getMessage(), e); } }
Source:
public void testHasSolidTumor() throws Exception { Set<TumorType> tumorTypeSet = new HashSet<>(); TumorType tt1 = new TumorType(); TumorType tt2 = new TumorType(); tt1.setId(0); tt1.setId(1); tumorTypeSet.add(tt1); tumorTypeSet.add(tt2); assertFalse("No tumor type should be solid tumor", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt1.setTissue("EYE"); assertTrue("One tumor type is solid tumor, should be true", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt2.setTissue("BONE"); assertTrue("Both tumor types are solid tumor, should be true", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt1.setTissue("BLOOD"); tt2.setTissue("BONE"); assertTrue("One tumor type is solid tumor, should be true", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); }

Target:
public void testHasSolidTumor() throws Exception { Set<TumorType> tumorTypeSet = new HashSet<>(); TumorType tt1 = new TumorType(); TumorType tt2 = new TumorType(); tt1.setId(0); tt1.setId(1); tumorTypeSet.add(tt1); tumorTypeSet.add(tt2); assertFalse("Empty tumor type set has solid tumor, but it should not.", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt1.setTissue("EYE"); assertTrue("Tumor types set does not have solid tumor, but it should because of EYE is solid tumor.", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt2.setTissue("BONE"); assertTrue("Tumor types set does not have solid tumor, but both tumor types in the set are solid tumor.", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); tt1.setTissue("BLOOD"); tt2.setTissue("BONE"); assertTrue("Tumor types set does not have solid tumor, but one of tumor types BONE is solid tumor.", TumorTypeUtils.hasSolidTumor(tumorTypeSet)); }