auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource); if (newName != null) { refactoringWizard.setNewName(newName); } RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else { RefactoringUIPlugin.logErrorMessage("Rename refactoring command new name parameter, expected String but got a " + newNameValue.getClass().getName()); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } return null; }
Source:
protected Control createDialogArea(Composite parent) { Composite parent2 = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parent2, SWT.NONE); composite.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite); createCenterArea(composite); composite.pack(); return parent; }

Target:
protected Control createDialogArea(Composite parent) { Composite parent2 = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parent2, SWT.NONE); composite.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite); createCenterArea(composite); composite.pack(); return parent2; }
Source:
public void test() throws Exception { test(false); test(true); testDropReferencedUserDefinedFunction(); testDropCascade(); testScriptExcludeSchema(); testScriptExcludeTable(); testScriptExcludeFunctionAlias(); testScriptExcludeConstant(); testScriptExcludeSequence(); testScriptExcludeConstraint(); testScriptExcludeTrigger(); testScriptExcludeRight(); testRunscriptFromClasspath(); testCancelScript(); testEncoding(); testClobPrimaryKey(); testComment(); deleteDb("runscript"); }

Target:
public void test() throws Exception { test(false); test(true); testDropReferencedUserDefinedFunction(); testDropCascade(); testScriptExcludeSchema(); testScriptExcludeTable(); testScriptExcludeFunctionAlias(); testScriptExcludeConstant(); testScriptExcludeSequence(); testScriptExcludeConstraint(); testScriptExcludeTrigger(); testScriptExcludeRight(); testRunscriptFromClasspath(); testCancelScript(); testEncoding(); testClobPrimaryKey(); deleteDb("runscript"); }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CONDITIONAL_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartConditionalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartConditionalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocess.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_INTERRUPTING, ""); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CONDITIONAL_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartConditionalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartConditionalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocess.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_INTERRUPTING, EMPTY_VALUE); }
Source:
public void testCascadingDeletion() throws IOException, InterruptedException { server.expect().delete().withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos/example-hello").andReturn(HttpURLConnection.HTTP_OK, "{\"metadata\":{},\"apiVersion\":\"v1\",\"kind\":\"Status\",\"details\":{\"name\":\"prometheus-example-rules\",\"group\":\"monitoring.coreos.com\",\"kind\":\"prometheusrules\",\"uid\":\"b3d085bd-6a5c-11e9-8787-525400b18c1d\"},\"status\":\"Success\"}").once(); KubernetesClient client = server.getClient(); Map<String, Object> result = client.customResource(customResourceDefinitionContext) .delete("ns1", "example-hello", true); assertEquals("Success", result.get("status")); DeleteOptions expectedDeleteOptions = new DeleteOptions(); expectedDeleteOptions.setPropagationPolicy("Orphan"); RecordedRequest request = server.getLastRequest(); assertEquals("DELETE", request.getMethod()); assertEquals("{\"apiVersion\":\"v1\",\"kind\":\"DeleteOptions\",\"orphanDependents\":false}", request.getBody().readUtf8()); }

Target:
public void testCascadingDeletion() throws IOException, InterruptedException { server.expect().delete().withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos/example-hello").andReturn(HttpURLConnection.HTTP_OK, "{\"metadata\":{},\"apiVersion\":\"v1\",\"kind\":\"Status\",\"details\":{\"name\":\"prometheus-example-rules\",\"group\":\"monitoring.coreos.com\",\"kind\":\"prometheusrules\",\"uid\":\"b3d085bd-6a5c-11e9-8787-525400b18c1d\"},\"status\":\"Success\"}").once(); KubernetesClient client = server.getClient(); Map<String, Object> result = client.customResource(customResourceDefinitionContext) .delete("ns1", "example-hello", true); assertEquals("Success", result.get("status")); RecordedRequest request = server.getLastRequest(); assertEquals("DELETE", request.getMethod()); assertEquals("{\"apiVersion\":\"v1\",\"kind\":\"DeleteOptions\",\"orphanDependents\":false}", request.getBody().readUtf8()); }
Source:
public void execute(String[] args, ConsoleReader reader) throws Exception { try (AppPackage ap = newAppPackageInstance(new File(expandFileName(args[1], true)))) { for (Map.Entry<String, PropertyInfo> entry : ap.getDefaultProperties().entrySet()) { if (entry.getKey().contains(".attr.")) { entry.getValue().setDescription(null); } } for (AppInfo appInfo : ap.getApplications()) { for (Map.Entry<String, PropertyInfo> entry : appInfo.defaultProperties.entrySet()) { if (entry.getKey().contains(".attr.")) { entry.getValue().setDescription(null); } } } JSONSerializationProvider jomp = new JSONSerializationProvider(); JSONObject apInfo = new JSONObject(jomp.getContext(null).writeValueAsString(ap)); apInfo.remove("name"); printJson(apInfo); } }

Target:
public void execute(String[] args, ConsoleReader reader) throws Exception { try (AppPackage ap = newAppPackageInstance(new File(expandFileName(args[1], true)))) { JSONSerializationProvider jomp = new JSONSerializationProvider(); JSONObject apInfo = new JSONObject(jomp.getContext(null).writeValueAsString(ap)); apInfo.remove("name"); printJson(apInfo); } }
Source:
public void saveWMSServerFile() { try { CoreWorkspace ws = (CoreWorkspace) Services.getService(CoreWorkspace.class); File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); PrintWriter pw = new PrintWriter(file); for (String server : serverswms) { pw.println(server); } pw.close(); } catch (FileNotFoundException e) { LOGGER.error(I18N.tr("Cannot save the list of WMS url")); } }

Target:
public void saveWMSServerFile() { try { CoreWorkspace ws = Services.getService(CoreWorkspace.class); File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); PrintWriter pw = new PrintWriter(file); for (String server : serverswms) { pw.println(server); } pw.close(); } catch (FileNotFoundException e) { LOGGER.error(I18N.tr("Cannot save the list of WMS url")); } }
Source:
private static MerchantConfig getInstanceMap(Map<String, String> request, Properties props) throws ConfigException { String key = getKeyForInstanceMap(request, props); if(!mcObjects.containsKey(key)) { synchronized (Client.class) { if (!mcObjects.containsKey(key)) { mcObjects.put(key, getMerchantConfigObject(request, props)); } } } return mcObjects.get(key); }

Target:
private static MerchantConfig getInstanceMap(Map<String, String> request, Properties props) throws ConfigException { String midOrKeyAlias = getKeyForInstanceMap(request, props); if(!mcObjects.containsKey(midOrKeyAlias)) { synchronized (Client.class) { if (!mcObjects.containsKey(midOrKeyAlias)) { mcObjects.put(midOrKeyAlias, getMerchantConfigObject(request, props)); } } } MerchantConfig mc = mcObjects.get(midOrKeyAlias); String merchantID = request.get(ELEM_MERCHANT_ID); if(StringUtils.isEmpty(merchantID)) { merchantID = mc.getMerchantID(); request.put(ELEM_MERCHANT_ID, merchantID); } return mc; }
Source:
private MockHelixPropertyStore<ZNRecord> getMockHelixStore(HelixPropertyStoreConfig storeConfig) { String storeRootPath = storeConfig.zkClientConnectString + storeConfig.rootPath; MockHelixPropertyStore<ZNRecord> helixStore = storeKeyToMockStoreMap.get(storeRootPath); if (helixStore == null) { helixStore = new MockHelixPropertyStore<>(); storeKeyToMockStoreMap.put(storeRootPath, helixStore); } return helixStore; }

Target:
private MockHelixPropertyStore<ZNRecord> getMockHelixStore(HelixPropertyStoreConfig storeConfig) { return storeKeyToMockStoreMap.computeIfAbsent(storeConfig.zkClientConnectString + storeConfig.rootPath, path -> new MockHelixPropertyStore<>()); }
Source:
public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { sb.append(line); sb.append(System.getProperty("line.separator")); } } catch (IOException ioe) { ioe.printStackTrace(); } }

Target:
public void run() { try (InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr)){ String line = null; while ((line = br.readLine()) != null) { sb.append(line); sb.append(System.getProperty("line.separator")); } } catch (IOException ioe) { throw new RuntimeException("Problem consuming stream: " + ioe.getMessage(), ioe); } }
Source:
public UpdateQuery build() { Checks.checkNotEmpty(table, "Please specify table name"); return new UpdateQuery( table, where, whereArgs ); }

Target:
public UpdateQuery build() { checkNotEmpty(table, "Please specify table name"); return new UpdateQuery( table, where, whereArgs ); }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.PRINT_STATEMENT, ctx -> { PyPrintStatement node = (PyPrintStatement) ctx.syntaxNode(); PsiElement currentNode = node.getFirstChild().getNextSibling(); while (currentNode instanceof PsiWhiteSpace) { currentNode = currentNode.getNextSibling(); } if (currentNode == null || !currentNode.getText().startsWith("(")) { ctx.addIssue(node.getFirstChild(), "Replace print statement by built-in function."); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.PRINT_STATEMENT, ctx -> { List<PyElement> expressions = PsiTreeUtil.getChildrenOfAnyType(ctx.syntaxNode(), PyExpression.class, PyPrintTarget.class); if (expressions.size() == 1 && expressions.get(0) instanceof PyParenthesizedExpression) { return; } ctx.addIssue(ctx.syntaxNode().getFirstChild(), "Replace print statement by built-in function."); }); }
Source:
public <T> String display(Type targetType, T value) throws HTMLDisplayerException { if (targetType == null && value != null) { return getHTMLDisplayer(value.getClass()).display(value); } else { return getHTMLDisplayer(targetType).display(value); } }

Target:
public <T> String display(Type targetType, T value) throws HTMLDisplayerException { Type type = getType(targetType, value); return getHTMLDisplayer(type).display(type, value); }
Source:
private List<String> getIds(Map<String, Serializable> params) throws IOException { List<String> ids = new ArrayList<>(); Object ofs = OBJECTS_IDS_FOR_SCHEMA.lookUp(params); if (ofs == null || !(ofs instanceof String)) return ids; String idsStr = (String) ofs; String[] parts = idsStr.split(","); for (String epart : parts) { String id = epart.trim(); if (StringUtils.isNotEmpty(id)) ids.add(id); } return ids; }

Target:
private List<String> getIds(Map<String, Serializable> params) throws IOException { List<String> ids = new ArrayList<>(); Object ofs = OBJECTS_IDS_FOR_SCHEMA.lookUp(params); if (ofs == null) return ids; if (!(ofs instanceof String)) { throw new IllegalArgumentException("Object Ids parameter should be String type."); } String idsStr = (String) ofs; String[] parts = idsStr.split(","); for (String epart : parts) { String id = epart.trim(); if (StringUtils.isNotEmpty(id)) ids.add(id); } return ids; }
Source:
public void handleGet(RestRequestInfo restRequestInfo) throws RestServiceException { RestRequestMetadata restRequestMetadata = restRequestInfo.getRestRequestMetadata(); logger.trace("Handling get restRequestMetadata - " + restRequestMetadata.getUri()); AdminOperationType operationType = getOperationType(restRequestMetadata); switch (operationType) { case echo: EchoHandler.handleRequest(restRequestInfo); break; case getReplicasForBlobId: GetReplicasForBlobIdHandler.handleRequest(restRequestInfo, clusterMap); break; default: throw new IllegalStateException("Blob GET not implemented"); } }

Target:
public void handleGet(RestRequestInfo restRequestInfo) throws RestServiceException { RestRequestMetadata restRequestMetadata = restRequestInfo.getRestRequestMetadata(); logger.trace("Handling get restRequestMetadata - " + restRequestMetadata.getUri()); AdminOperationType operationType = getOperationType(restRequestMetadata); switch (operationType) { case echo: EchoHandler.handleRequest(restRequestInfo); break; case getReplicasForBlobId: GetReplicasForBlobIdHandler.handleRequest(restRequestInfo, clusterMap); break; default: throw new RestServiceException("Unsupported operation for Admin service", RestServiceErrorCode.UnsupportedOperation); } }
Source:
private SqlInvokedFunction createSqlInvokedFunction(CreateFunction statement) { if (statement.getFunctionName().getParts().size() != 3) { throw new PrestoException(GENERIC_USER_ERROR, format("Invalid function name: %s, require exactly 3 parts", statement.getFunctionName())); } QualifiedFunctionName functionName = QualifiedFunctionName.of( new CatalogSchemaName( statement.getFunctionName().getParts().get(0), statement.getFunctionName().getParts().get(1)), statement.getFunctionName().getParts().get(2)); List<SqlParameter> parameters = statement.getParameters().stream() .map(parameter -> new SqlParameter(parameter.getName().toString().toLowerCase(ENGLISH), parseTypeSignature(parameter.getType()))) .collect(toImmutableList()); TypeSignature returnType = parseTypeSignature(statement.getReturnType()); String description = statement.getComment().orElse(""); RoutineCharacteristics routineCharacteristics = new RoutineCharacteristics( RoutineCharacteristics.Language.valueOf(statement.getCharacteristics().getLanguage().name()), RoutineCharacteristics.Determinism.valueOf(statement.getCharacteristics().getDeterminism().name()), RoutineCharacteristics.NullCallClause.valueOf(statement.getCharacteristics().getNullCallClause().name())); String body = formatSql(statement.getBody(), Optional.empty()); return new SqlInvokedFunction( functionName, parameters, returnType, description, routineCharacteristics, body, Optional.empty()); }

Target:
private SqlInvokedFunction createSqlInvokedFunction(CreateFunction statement) { List<String> parts = statement.getFunctionName().getParts(); if (parts.size() != 3) { throw new PrestoException(GENERIC_USER_ERROR, format("Invalid function name: %s, require exactly 3 parts", statement.getFunctionName())); } QualifiedFunctionName functionName = QualifiedFunctionName.of( new CatalogSchemaName(parts.get(0), parts.get(1)), parts.get(2)); List<SqlParameter> parameters = statement.getParameters().stream() .map(parameter -> new SqlParameter(parameter.getName().toString().toLowerCase(ENGLISH), parseTypeSignature(parameter.getType()))) .collect(toImmutableList()); TypeSignature returnType = parseTypeSignature(statement.getReturnType()); String description = statement.getComment().orElse(""); RoutineCharacteristics routineCharacteristics = new RoutineCharacteristics( RoutineCharacteristics.Language.valueOf(statement.getCharacteristics().getLanguage().name()), RoutineCharacteristics.Determinism.valueOf(statement.getCharacteristics().getDeterminism().name()), RoutineCharacteristics.NullCallClause.valueOf(statement.getCharacteristics().getNullCallClause().name())); String body = formatSql(statement.getBody(), Optional.empty()); return new SqlInvokedFunction( functionName, parameters, returnType, description, routineCharacteristics, body, Optional.empty()); }
Source:
public void calledWithTooFewCommandArguments_returnsError() { List<byte[]> commandAsBytes = new ArrayList<>(); commandAsBytes.add("EXPIREAT".getBytes()); commandAsBytes.add("key".getBytes()); Command command = new Command(commandAsBytes); Throwable thrown = catchThrowable(() -> command.execute(mockContext())); AssertionsForClassTypes.assertThat(thrown).hasMessageContaining("wrong number of arguments"); AssertionsForClassTypes.assertThat(thrown).isInstanceOf(RedisParametersMismatchException.class); }

Target:
public void calledWithTooFewCommandArguments_returnsError() { List<byte[]> commandAsBytes = new ArrayList<>(); commandAsBytes.add("EXPIREAT".getBytes()); commandAsBytes.add("key".getBytes()); Command command = new Command(commandAsBytes); assertThatThrownBy(() -> command.execute(mockContext())) .hasMessageContaining("wrong number of arguments") .isInstanceOf(RedisParametersMismatchException.class); }
Source:
public void onReceive(Context ctx, Intent intent) { String action = intent.getAction(); switch (action) { case INSTALL_ACTION: installReferrer(ctx, intent); break; case Intent.ACTION_BOOT_COMPLETED: recordChannelId(ctx); NotificationPollService.start(ctx.getApplicationContext()); break; default: L.d("action=" + action); break; } }

Target:
public void onReceive(Context ctx, Intent intent) { String action = intent.getAction(); switch (action) { case INSTALL_ACTION: installReferrer(ctx, intent); break; case Intent.ACTION_BOOT_COMPLETED: recordChannelId(ctx); break; default: L.d("action=" + action); break; } }
Source:
public void testExecuteAsyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); queryExecutor.executeAsync(groupRequest); }

Target:
public void testExecuteAsyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { queryExecutor.executeAsync(groupRequest); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.NO_SUCH_TABLE, e.getErrorCode()); throw e; } }
Source:
private Object visitModify(InvocationContext ctx, FlagAffectedCommand command, Object key) throws Throwable { if (isProperWriter(ctx, command, key)) { CacheEntry entry = ctx.lookupEntry(key); if (!entry.isChanged()) { return null; } else if (entry.getValue() == null) { getModifications(ctx, key, command).removeEntry(key); } else { if (generateStatistics) putCount++; InternalCacheValue sv = entryFactory.getValueFromCtx(key, ctx); if (sv != null) { MarshallableEntry me = marshalledEntryFactory.create(key, sv); getModifications(ctx, key, command).addMarshalledEntry(key, me); } } } return null; }

Target:
private Object visitModify(InvocationContext ctx, FlagAffectedCommand command, Object key) { if (isProperWriter(ctx, command, key)) { CacheEntry<?, ?> entry = ctx.lookupEntry(key); if (!entry.isChanged()) { return null; } else if (entry.getValue() == null) { getModifications(ctx, key, command).removeEntry(key); } else { if (generateStatistics) putCount++; InternalCacheValue<?> sv = entryFactory.getValueFromCtx(key, ctx); if (sv != null) { MarshallableEntry<? ,?> me = marshalledEntryFactory.create(key, (InternalCacheValue) sv); getModifications(ctx, key, command).addMarshalledEntry(key, me); } } } return null; }
Source:
public PlanInterpreterGuessingType reconstruct() { attemptType(null, CatalogItemType.ENTITY); attemptType(null, CatalogItemType.TEMPLATE); attemptType("services", CatalogItemType.ENTITY); attemptType(POLICIES_KEY, CatalogItemType.POLICY); attemptType(LOCATIONS_KEY, CatalogItemType.LOCATION); if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) { planYaml = itemYaml; resolved = true; } return this; }

Target:
public PlanInterpreterGuessingType reconstruct() { if (catalogItemType==CatalogItemType.TEMPLATE) { attemptType(null, CatalogItemType.TEMPLATE); } else { attemptType(null, CatalogItemType.ENTITY); attemptType("services", CatalogItemType.ENTITY); attemptType(POLICIES_KEY, CatalogItemType.POLICY); attemptType(LOCATIONS_KEY, CatalogItemType.LOCATION); } if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) { planYaml = itemYaml; resolved = true; } return this; }
Source:
synchronized KeyStore createKeyStore(Path keystoreFilePath, String keystoreType, char[] password) throws KeystoreServiceException { Path parentPath = keystoreFilePath.getParent(); if (!Files.isDirectory(parentPath)) { try{ Files.createDirectories(parentPath); } catch (IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } } try { KeyStore ks = KeyStore.getInstance(keystoreType); ks.load(null, null); writeKeyStoreToFile(ks, keystoreFilePath, password); return ks; } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } }

Target:
synchronized KeyStore createKeyStore(Path keystoreFilePath, String keystoreType, char[] password) throws KeystoreServiceException { Path parentPath = keystoreFilePath.getParent(); if (parentPath != null && !Files.isDirectory(parentPath)) { try{ Files.createDirectories(parentPath); } catch (IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } } try { KeyStore ks = KeyStore.getInstance(keystoreType); ks.load(null, null); writeKeyStoreToFile(ks, keystoreFilePath, password); return ks; } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } }
Source:
public static Optional<String> extractExpression(Object value) { Optional<String> result = Optional.empty(); if (isExpression(value)) { String expression = (String) value; if (expression != null && !expression.isEmpty()) { String trimmedText = expression.trim(); result = Optional.of(trimmedText.substring(DEFAULT_EXPRESSION_PREFIX.length(), trimmedText.length() - DEFAULT_EXPRESSION_POSTFIX.length())); } } return result; }

Target:
public static Optional<String> extractExpression(Object value) { Optional<String> result = empty(); if (isExpression(value)) { String expression = (String) value; if (isNotEmpty(expression)) { String trimmedText = expression.trim(); result = of(trimmedText.substring(DEFAULT_EXPRESSION_PREFIX.length(), trimmedText.length() - DEFAULT_EXPRESSION_POSTFIX.length())); } } return result; }
Source:
public void writeTo(OutputStream out) throws IOException { CountingOutputStream countingStream = new CountingOutputStream( out ); Writer writer = new OutputStreamWriter( countingStream, CHARSET ); for ( JsonObject bodyPart : bodyParts ) { gson.toJson( bodyPart, writer ); writer.append( '\n' ); } writer.flush(); hintContentLenght( countingStream.getBytesWritten() ); }

Target:
public void writeTo(OutputStream out) throws IOException { CountingOutputStream countingStream = new CountingOutputStream( out ); Writer writer = new OutputStreamWriter( countingStream, CHARSET ); for ( JsonObject bodyPart : bodyParts ) { gson.toJson( bodyPart, writer ); writer.append( '\n' ); } writer.flush(); hintContentLength( countingStream.getBytesWritten() ); }
Source:
public CertificateController(LocalPreferences localPreferences) { if (localPreferences == null) { throw new IllegalArgumentException("localPreferences cannot be null"); } this.localPreferences = localPreferences; certificates = new ArrayList<>(); tableModel = new DefaultTableModel() { public Class<?> getColumnClass(int column) { switch (column) { case 0: return String.class; case 1: return String.class; case 2: return String.class; case 3: return String.class; case 4: return Boolean.class; default: return String.class; } } }; tableModel.setColumnIdentifiers(COLUMN_NAMES); certEntry = new Object[NUMBER_OF_COLUMNS]; try { FileInputStream input = new FileInputStream(localPreferences.getTrustStorePath()); trustStore = KeyStore.getInstance(localPreferences.getPKIStore().toString()); trustStore.load(input, localPreferences.getTrustStorePassword().toCharArray()); Enumeration store = trustStore.aliases(); while (store.hasMoreElements()) { String alias = (String) store.nextElement(); X509Certificate certificate = (X509Certificate) trustStore.getCertificate(alias); certificates.add(new CertificateModel(certificate, alias)); } for (CertificateModel cert : certificates) { certEntry[0] = cert.getAlias(); certEntry[1] = cert.getIssuer(); certEntry[2] = cert.getSubject(); certEntry[3] = cert.isValid(); certEntry[4] = cert.isExempted(); tableModel.addRow(certEntry); } } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { Log.warning("Cannot acces Truststore, it might be not set up", e); } }

Target:
public CertificateController(LocalPreferences localPreferences) { if (localPreferences == null) { throw new IllegalArgumentException("localPreferences cannot be null"); } this.localPreferences = localPreferences; certificates = new ArrayList<>(); tableModel = new DefaultTableModel() { public Class<?> getColumnClass(int column) { switch (column) { case 0: return String.class; case 1: return String.class; case 2: return Boolean.class; default: throw new RuntimeException("Cannot assign classes for columns"); } } }; tableModel.setColumnIdentifiers(COLUMN_NAMES); certEntry = new Object[NUMBER_OF_COLUMNS]; try { FileInputStream input = new FileInputStream(localPreferences.getTrustStorePath()); trustStore = KeyStore.getInstance(localPreferences.getPKIStore().toString()); trustStore.load(input, localPreferences.getTrustStorePassword().toCharArray()); Enumeration store = trustStore.aliases(); while (store.hasMoreElements()) { String alias = (String) store.nextElement(); X509Certificate certificate = (X509Certificate) trustStore.getCertificate(alias); certificates.add(new CertificateModel(certificate, alias)); } for (CertificateModel cert : certificates) { if (cert.getSubjectCommonName() != null) { certEntry[0] = cert.getSubjectCommonName(); } else { certEntry[0] = cert.getSubject(); } certEntry[1] = cert.getValidityStatus(); certEntry[2] = cert.isExempted(); tableModel.addRow(certEntry); } } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { Log.warning("Cannot access Truststore, it might be not set up", e); } }
Source:
public static InsertMediaDialog newInstance(@NonNull InsertMediaCallback callback, @NonNull SiteModel site) { InsertMediaDialog dialog = new InsertMediaDialog(); dialog.setStyle(AppCompatDialogFragment.STYLE_NORMAL, R.style.Theme_AppCompat_Light_Dialog); dialog.setCallback(callback); Bundle args = new Bundle(); args.putSerializable(WordPress.SITE, site); return dialog; }

Target:
public static InsertMediaDialog newInstance(@NonNull InsertMediaCallback callback, @NonNull SiteModel site) { InsertMediaDialog dialog = new InsertMediaDialog(); dialog.setStyle(AppCompatDialogFragment.STYLE_NORMAL, R.style.Theme_AppCompat_Light_Dialog); dialog.setCallback(callback); Bundle args = new Bundle(); args.putSerializable(WordPress.SITE, site); dialog.setArguments(args); return dialog; }
Source:
public void testSaveSessionWithErrorDuringSave() { doOpenSession(); session.getSessionResource().eAdapters().add(new AdapterImpl() { @Override public void notifyChanged(Notification msg) { if (msg.getNotifier() == session.getSessionResource() && msg.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) { throw new RuntimeException("This is a SavingPolicy that always fails."); } } }); doCreateViews(); DiagramDescription description = findDiagramDescription("Acceleo Class Diagram"); Assert.assertNotNull(THE_UNIT_TEST_DATA_SEEMS_INCORRECT, description); doCreateRepresentations(description, 9); doOpenAllRepresentations(); assertTrue("The session should be dirty.", editors.get(0).isDirty()); try { session.save(new NullProgressMonitor()); fail("A RuntimeException should be thrown"); } catch (RuntimeException e) { } doCleanup(); }

Target:
public void testSaveSessionWithErrorDuringSave() { doOpenSession(); session.getSessionResource().eAdapters().add(new AdapterImpl() { @Override public void notifyChanged(Notification msg) { if (msg.getNotifier() == session.getSessionResource() && msg.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) { throw new RuntimeException("An adapter to have save fails."); } } }); doCreateViews(); DiagramDescription description = findDiagramDescription("Acceleo Class Diagram"); Assert.assertNotNull(THE_UNIT_TEST_DATA_SEEMS_INCORRECT, description); doCreateRepresentations(description, 9); doOpenAllRepresentations(); assertTrue("The session should be dirty.", editors.get(0).isDirty()); try { session.save(new NullProgressMonitor()); fail("A RuntimeException should be thrown"); } catch (RuntimeException e) { } doCleanup(); }
Source:
public void dataSharingSuspendedUpdatesSession() throws Exception { Account account = Mockito.mock(Account.class); TestUtils.mockEditAccount(accountDao, account); doAnswer((InvocationOnMock invocation) -> { session.setParticipant(new StudyParticipant.Builder().copyOf(session.getParticipant()) .withSharingScope(SharingScope.NO_SHARING).build()); return null; }).when(sessionUpdateService).updateSharingScope(session, SharingScope.NO_SHARING); Result result = controller.suspendDataSharing(); TestUtils.assertResult(result, 200); JsonNode node = TestUtils.getJson(result); assertEquals("no_sharing", node.get("sharingScope").asText()); assertFalse(node.get("dataSharing").asBoolean()); verify(account).setSharingScope(SharingScope.NO_SHARING); verify(accountDao).editAccount(eq(TestConstants.TEST_STUDY), eq(HEALTH_CODE), accountConsumerCaptor.capture()); Consumer<Account> accountConsumer = accountConsumerCaptor.getValue(); Account updatedAccount = Account.create(); accountConsumer.accept(updatedAccount); assertEquals(SharingScope.NO_SHARING, updatedAccount.getSharingScope()); }

Target:
public void dataSharingSuspendedUpdatesSession() throws Exception { Account account = Mockito.mock(Account.class); TestUtils.mockEditAccount(accountDao, account); doAnswer((InvocationOnMock invocation) -> { session.setParticipant(new StudyParticipant.Builder().copyOf(session.getParticipant()) .withSharingScope(SharingScope.NO_SHARING).build()); return null; }).when(sessionUpdateService).updateSharingScope(session, SharingScope.NO_SHARING); Result result = controller.suspendDataSharing(); TestUtils.assertResult(result, 200); JsonNode node = TestUtils.getJson(result); assertEquals("no_sharing", node.get("sharingScope").asText()); assertFalse(node.get("dataSharing").asBoolean()); verify(account).setSharingScope(SharingScope.NO_SHARING); verify(accountDao).editAccount(eq(TestConstants.TEST_STUDY), eq(HEALTH_CODE), any()); }
Source:
public static Map<IPath, RepositoryMapping> getMappings(@Nullable final IProject project) { GitProjectData data = getProjectData(project); if (data == null) { return new HashMap<>(); } return data.getRepositoryMappings(); }

Target:
public static Map<IPath, RepositoryMapping> getMappings(@Nullable final IProject project) { GitProjectData data = getProjectData(project); if (data == null) { return Collections.emptyMap(); } return data.getRepositoryMappings(); }
Source:
public AuthUser authenticate(final AuthRequest request) throws AuthException { List<AuthUser> authUsers = Lists.newArrayList(); List<AuthException> authExs = Lists.newArrayList(); for (AuthBackend backend : authBackends) { try { authUsers.add(checkNotNull(backend.authenticate(request))); } catch (MissingCredentialsException ex) { } catch (AuthException ex) { authExs.add(ex); } } if (authExs.isEmpty()) { return authUsers.get(0); } else if (authExs.size() == 1) { throw authExs.get(0); } else if (authExs.isEmpty() && authUsers.isEmpty()) { throw new MissingCredentialsException(); } String msg = String.format("Multiple AuthBackends attempted to handle request:" + " authUsers=%s authExs=%s", authUsers, authExs); throw new AuthException(msg); }

Target:
public AuthUser authenticate(final AuthRequest request) throws AuthException { List<AuthUser> authUsers = Lists.newArrayList(); List<AuthException> authExs = Lists.newArrayList(); for (AuthBackend backend : authBackends) { try { authUsers.add(checkNotNull(backend.authenticate(request))); } catch (MissingCredentialsException ex) { } catch (AuthException ex) { authExs.add(ex); } } if (authUsers.size() == 1) { return authUsers.get(0); } else if (authUsers.isEmpty() && authExs.size() == 1) { throw authExs.get(0); } else if (authExs.isEmpty() && authUsers.isEmpty()) { throw new MissingCredentialsException(); } String msg = String.format("Multiple AuthBackends attempted to handle request:" + " authUsers=%s authExs=%s", authUsers, authExs); throw new AuthException(msg); }
Source:
private static final void addProcessor(String key, Processor processor) throws UnsupportedOperationException { if (!map.containsKey(key)) { map.put(key, processor); } else { String msg = "Key " + key + " already exists in processor map"; throw new UnsupportedOperationException(msg); } }

Target:
private static final void addProcessor(String key, Processor processor) throws IllegalStateException { if (!map.containsKey(key)) { map.put(key, processor); } else { String msg = "Key " + key + " already exists in processor map"; throw new IllegalStateException(msg); } }
Source:
public PollingResult startPollingCmParcelDelete(Stack stack, ApiClient apiClient, Map<String, String> parcelVersions) { LOGGER.debug("Waiting for Cloudera Manager parcels to become to status [{}]. [Server address: {}]", parcelVersions, stack.getClusterManagerIp()); return pollCommandWithTimeListener(stack, apiClient, BigDecimal.ZERO, POLL_FOR_ONE_HOUR, new ClouderaManagerParcelDeletedListenerTask(clouderaManagerApiPojoFactory, cloudbreakEventService, parcelVersions)); }

Target:
public PollingResult startPollingCmParcelDelete(Stack stack, ApiClient apiClient, Map<String, String> parcelVersions) { LOGGER.debug("Waiting for Cloudera Manager parcels to be deleted. [Server address: {}]", parcelVersions, stack.getClusterManagerIp()); return pollCommandWithTimeListener(stack, apiClient, BigDecimal.ZERO, POLL_FOR_ONE_HOUR, new ClouderaManagerParcelDeletedListenerTask(clouderaManagerApiPojoFactory, cloudbreakEventService, parcelVersions)); }
Source:
public DrMemoryParser() { super(Messages._Warnings_DrMemory_ParserName(), Messages._Warnings_DrMemory_LinkName(), Messages._Warnings_DrMemory_TrendName(), DR_MEMORY_WARNING_PATTERN, true); }

Target:
public DrMemoryParser() { super(Messages._Warnings_DrMemory_ParserName(), Messages._Warnings_DrMemory_LinkName(), Messages._Warnings_DrMemory_TrendName(), DR_MEMORY_WARNING_PATTERN, false); }
Source:
private void validateHostAndUpdateErrorCount(final String host) { final boolean isNodeHealthy = isNodeHealthy(host); if (isNodeHealthy) { if (errorCounts.containsKey(host)) { errorCounts.remove(host); } } else { if (this.errorCounts.containsKey(host)) { this.errorCounts.put(host, this.errorCounts.get(host) + 1); } else { this.errorCounts.put(host, 1); } } }

Target:
private void validateHostAndUpdateErrorCount(final String host) { if (isNodeHealthy(host)) { if (errorCounts.containsKey(host)) { errorCounts.remove(host); } } else { if (this.errorCounts.containsKey(host)) { this.errorCounts.put(host, this.errorCounts.get(host) + 1); } else { this.errorCounts.put(host, 1); } } }
Source:
boolean sameTrack(TrackData other) { return this.title != null && this.artist != null && this.album != null && other.title != null && other.artist != null && other.album != null && this.title.equals(other.title) && this.artist.equals(other.artist) && this.album.equals(other.album); }

Target:
boolean sameTrack(TrackData other) { return other != null & this.title != null && this.artist != null && this.album != null && this.title.equals(other.title) && this.artist.equals(other.artist) && this.album.equals(other.album); }
Source:
public boolean isPreviewEnabled() { if (this.apiLevel == AST.JLS_Latest && this.previewEnabled) { return true; } return false; }

Target:
public boolean isPreviewEnabled() { return (this.apiLevel == AST.JLS_Latest && this.previewEnabled); }
Source:
public Response updateRegistry(String registryId, RegistryDTO body, MessageContext messageContext) { String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); String user = RestApiUtil.getLoggedInUsername(); EndpointRegistry registryProvider = new EndpointRegistryImpl(); EndpointRegistryInfo registryToUpdate = EndpointRegistryMappingUtils.fromDTOtoEndpointRegistry(body, user); try { EndpointRegistryInfo endpointRegistry = registryProvider.getEndpointRegistryByUUID(registryId, tenantDomain); if (endpointRegistry == null) { RestApiUtil.handleResourceNotFoundError("Endpoint registry with the id: " + registryId + " is not found", log); } registryProvider.updateEndpointRegistry(registryId, registryToUpdate); } catch (APIManagementException e) { RestApiUtil.handleInternalServerError("Error while updating the endpoint registry " + "with id: " + registryId, e, log); } return Response.ok().entity("Successfully updated the endpoint registry").build(); }

Target:
public Response updateRegistry(String registryId, RegistryDTO body, MessageContext messageContext) { String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); String user = RestApiUtil.getLoggedInUsername(); EndpointRegistry registryProvider = new EndpointRegistryImpl(); EndpointRegistryInfo registryToUpdate = EndpointRegistryMappingUtils.fromDTOtoEndpointRegistry(body, user); EndpointRegistryInfo updatedEndpointRegistry = null; try { EndpointRegistryInfo endpointRegistry = registryProvider.getEndpointRegistryByUUID(registryId, tenantDomain); if (endpointRegistry == null) { RestApiUtil.handleResourceNotFoundError("Endpoint registry with the id: " + registryId + " is not found", log); } registryProvider.updateEndpointRegistry(registryId, registryToUpdate); updatedEndpointRegistry = registryProvider.getEndpointRegistryByUUID(registryId, tenantDomain); } catch (APIManagementException e) { RestApiUtil.handleInternalServerError("Error while updating the endpoint registry " + "with id: " + registryId, e, log); } return Response.ok().entity(updatedEndpointRegistry).build(); }
Source:
private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final NakadiException | InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<String, List<NakadiCursor>> beforeFirst = getBeforeFirstNakadiCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk.getEventType()).stream() .filter(c -> c.getPartition().equals(pk.getPartition())) .findFirst() .orElseThrow(() -> new MyNakadiRuntimeException1("problem starting stream")); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (NakadiException | InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } }

Target:
private void reconfigureKafkaConsumer(final boolean forceSeek) { if (eventConsumer == null) { throw new IllegalStateException( "kafkaConsumer should not be null when calling reconfigureKafkaConsumer method"); } final Set<EventTypePartition> newAssignment = offsets.keySet().stream() .filter(o -> !this.releasingPartitions.containsKey(o)) .collect(Collectors.toSet()); if (forceSeek) { try { eventConsumer.reassign(Collections.emptyList()); } catch (final NakadiException | InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } final Set<EventTypePartition> currentAssignment = eventConsumer.getAssignment(); getLog().info("Changing kafka assignment from to {}", Arrays.deepToString(currentAssignment.toArray()), Arrays.deepToString(newAssignment.toArray())); if (!currentAssignment.equals(newAssignment)) { try { final Map<EventTypePartition, NakadiCursor> beforeFirst = getBeforeFirstCursors(newAssignment); final List<NakadiCursor> cursors = newAssignment.stream() .map(pk -> { final NakadiCursor beforeFirstAvailable = beforeFirst.get(pk); offsets.get(pk).ensureDataAvailable(beforeFirstAvailable); return offsets.get(pk).getSentOffset(); }) .collect(Collectors.toList()); eventConsumer.reassign(cursors); } catch (NakadiException | InvalidCursorException ex) { throw new NakadiRuntimeException(ex); } } }
Source:
protected void updateStatsRow(Object key, Object[] row) { boolean active = false; try { ActivityHelper helper = new ActivityHelper(); if (usingCommandLog()) { active = helper.collect(statsWithCmdLog); setValue(row, ColumnName.CLIENT_TXNS, helper.client_txns); setValue(row, ColumnName.CLIENT_REQ_BYTES, helper.client_reqBytes); setValue(row, ColumnName.CLIENT_RESP_MSGS, helper.client_respMsgs); setValue(row, ColumnName.IMPORTS_PENDING, helper.import_pend); setValue(row, ColumnName.CMDLOG_TXNS, helper.cmdlog_txns); setValue(row, ColumnName.CMDLOG_BYTES, helper.cmdlog_bytes); setValue(row, ColumnName.EXPORTS_PENDING, helper.export_pend); } else { active = helper.collect(statsWithoutCmdLog); setValue(row, ColumnName.CLIENT_TXNS, helper.client_txns); setValue(row, ColumnName.CLIENT_REQ_BYTES, helper.client_reqBytes); setValue(row, ColumnName.CLIENT_RESP_MSGS, helper.client_respMsgs); setValue(row, ColumnName.IMPORTS_PENDING, helper.import_pend); setValue(row, ColumnName.DRCONS_PARTS, helper.drcons_pend); setValue(row, ColumnName.EXPORTS_PENDING, helper.export_pend); setValue(row, ColumnName.DRPROD_SEGS, helper.drprod_segsPend); setValue(row, ColumnName.DRPROD_BYTES, helper.drprod_bytesPend); } } catch (Exception ex) { logger.error("Unhandled exception in ShutdownActivityStats: " + ex); } setValue(row, ColumnName.ACTIVE, active); super.updateStatsRow(key, row); }

Target:
protected void updateStatsRow(Object key, Object[] row) { boolean active = false; try { ActivityHelper helper = new ActivityHelper(); if (usingCommandLog()) { active = helper.collect(statsWithCmdLog); setValue(row, ColumnName.CLIENT_TXNS, helper.clientTxns); setValue(row, ColumnName.CLIENT_REQ_BYTES, helper.clientReqBytes); setValue(row, ColumnName.CLIENT_RESP_MSGS, helper.clientRespMsgs); setValue(row, ColumnName.IMPORTS_PENDING, helper.importPend); setValue(row, ColumnName.CMDLOG_TXNS, helper.cmdlogTxns); setValue(row, ColumnName.CMDLOG_BYTES, helper.cmdlogBytes); setValue(row, ColumnName.EXPORTS_PENDING, helper.exportPend); } else { active = helper.collect(statsWithoutCmdLog); setValue(row, ColumnName.CLIENT_TXNS, helper.clientTxns); setValue(row, ColumnName.CLIENT_REQ_BYTES, helper.clientReqBytes); setValue(row, ColumnName.CLIENT_RESP_MSGS, helper.clientRespMsgs); setValue(row, ColumnName.IMPORTS_PENDING, helper.importPend); setValue(row, ColumnName.DRCONS_PARTS, helper.drconsPend); setValue(row, ColumnName.EXPORTS_PENDING, helper.exportPend); setValue(row, ColumnName.DRPROD_ROWS, helper.drprodRowsPend); setValue(row, ColumnName.DRPROD_BYTES, helper.drprodBytesPend); } } catch (Exception ex) { logger.error("Unhandled exception in ShutdownActivityStats: " + ex); } setValue(row, ColumnName.ACTIVE, active); super.updateStatsRow(key, row); }
Source:
private static boolean keyspaceAlreadyExists(InetSocketAddress host, CassandraKeyValueServiceConfig config) throws TException { try { Client client = CassandraClientFactory.getClientInternal(host, config); client.describe_keyspace(config.getKeyspaceOrThrow()); CassandraKeyValueServices.waitForSchemaVersions( config, client, "(adding the initial empty keyspace)", true); return true; } catch (NotFoundException e) { return false; } }

Target:
private static boolean keyspaceAlreadyExists(InetSocketAddress host, CassandraKeyValueServiceConfig config) throws TException { try { Client client = CassandraClientFactory.getClientInternal(host, config); client.describe_keyspace(config.getKeyspaceOrThrow()); CassandraKeyValueServices.waitForSchemaVersions( config, client, "(checking if schemas diverged on startup)", true); return true; } catch (NotFoundException e) { return false; } }
Source:
public void importCT() throws IOException { if(getIdModel().getValue().toString().length() != 0) { String studyID = getIdModel().getValue().toString().trim().replace(" ", "%20"); String url = "<LINK_0>"+studyID+"?resultsxml=true"; Study clinicaltrialsData = ClinicaltrialsImporter.getClinicaltrialsData(url); setNewStudy(clinicaltrialsData); } }

Target:
public void importCT() throws IOException { if(getIdModel().getValue().toString().length() != 0) { String studyID = getIdModel().getValue().toString().trim().replace(" ", "%20"); Study clinicaltrialsData; if (d_importCTWithResults.getValue()) { String url = "<LINK_0>"+studyID+"?resultsxml=true"; clinicaltrialsData = ClinicaltrialsImporter.getClinicaltrialsData(url, true); } else { String url = "<LINK_0>"+studyID+"?displayxml=true"; clinicaltrialsData = ClinicaltrialsImporter.getClinicaltrialsData(url, false); } setNewStudy(clinicaltrialsData); } }
Source:
private void addToMessagesList() { messagesList.add(regionName1); messagesList.add(1); messagesList.add(eventID1); messagesList.add(regionName2); messagesList.add(2); messagesList.add(eventID2); messagesList.add(eventID3); }

Target:
private void addToMessagesList() { messagesList.add(regionName1); messagesList.add(region1EventSize); messagesList.add(eventID1); messagesList.add(regionName2); messagesList.add(region2EventSize); messagesList.add(eventID2); messagesList.add(eventID3); }