auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public HttpResponse doResult(@QueryParameter String election) throws NamingException, IOException { if ( election.isEmpty() || election.equals(".") || election.equals("..")){ return new HttpRedirect("/election/results"); } File directory = new File( electionLogDir + "/" + election ); if (!directory.isDirectory() || !directory.exists()){ return new HttpRedirect("/election/results"); } if (!isResultExist(election) || isOpen(election)){ return new HttpRedirect("/election/ongoing"); } else{ parseRawResult( election ); return HttpResponses.forwardToView(this,"result.jelly"); } }

Target:
public HttpResponse doResult(@QueryParameter String election) throws NamingException, IOException { if (!isElectionEnabled()) return new HttpRedirect("/"); else { if (election.isEmpty() || election.equals(".") || election.equals("..")) { return new HttpRedirect("/election/results"); } File directory = new File(electionLogDir + "/" + election); if (!directory.isDirectory() || !directory.exists()) { return new HttpRedirect("/election/results"); } if (!isResultExist(election) || isOpen(election)) { return new HttpRedirect("/election/ongoing"); } else { parseRawResult(election); return HttpResponses.forwardToView(this, "result.jelly"); } } }
Source:
String getExternalId(boolean fromServer) { synchronized(syncLock) { return toSyncUserState.syncValues.optString("external_user_id", null); } }

Target:
@Nullable String getExternalId(boolean fromServer) { synchronized(syncLock) { return toSyncUserState.syncValues.optString("external_user_id", null); } }
Source:
public void writeData(ObjectDataOutput out) throws IOException { out.writeObject(value); out.writeLong(expirationTime); out.writeLong(creationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); out.writeObject(expiryPolicy); }

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeObject(value); out.writeLong(expirationTime); out.writeLong(creationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); if (out.getVersion().isGreaterOrEqual(EXPIRY_POLICY_VERSION)) { out.writeObject(expiryPolicy); } }
Source:
protected ValidationResult macAvailable() { VmNic nic = getParameters().getNic(); Optional<VM> optionalVm = new VmInterfaceManager().getVmWithSameMacAs(nic, getMacPool()); return optionalVm.map(vm -> new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_MAC_ADDRESS, nic.getMacAddress()), ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_VM_NAME, vm.getName()))) .orElse(ValidationResult.VALID); }

Target:
protected ValidationResult macAvailable() { VmNic nic = getParameters().getNic(); Optional<VM> optionalVm = new VmInterfaceManager().getVmWithSameMacIfDuplicateIsNotAllowed(nic, getMacPool()); if (optionalVm.isPresent()) { return new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_MAC_ADDRESS, nic.getMacAddress()), ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_VM_NAME, optionalVm.get().getName())); } return ValidationResult.VALID; }
Source:
public void scan(File dir, FileVisitor visitor) throws IOException { if(fixEmpty(includes)==null && excludes==null) { new Full().scan(dir,visitor); return; } FileSet fs = Util.createFileSet(dir,includes,excludes); fs.setDefaultexcludes(useDefaultExcludes); if(dir.exists()) { fs.setFollowSymlinks(followSymlinks); DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project()); if(!followSymlinks) { for(String f: ds.getNotFollowedSymlinks()) { File file = dir.toPath().relativize(Paths.get(f)).toFile(); scanSymlink(new File(f), file.getPath(), visitor); } } for( String f : ds.getIncludedFiles()) { File file = new File(dir, f); scanSingle(file, f, visitor); } } }

Target:
public void scan(File dir, FileVisitor visitor) throws IOException { if(fixEmpty(includes)==null && excludes==null) { new Full().scan(dir,visitor); return; } FileSet fs = Util.createFileSet(dir,includes,excludes); fs.setDefaultexcludes(useDefaultExcludes); fs.appendSelector(new DescendantFileSelector(fs.getDir())); if(dir.exists()) { fs.setFollowSymlinks(followSymlinks); DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project()); if(!followSymlinks) { for(String f: ds.getNotFollowedSymlinks()) { File file = Util.fileToPath(dir).relativize(Paths.get(f)).toFile(); scanSymlink(new File(f), file.getPath(), visitor); } } for( String f : ds.getIncludedFiles()) { File file = new File(dir, f); scanSingle(file, f, visitor); } } }
Source:
private static CompletableFuture<List<? extends ICodeMining>> getCodeMinings(ITextViewer viewer, List<ICodeMiningProvider> providers, IProgressMonitor monitor) { List<CompletableFuture<List<? extends ICodeMining>>> com= providers.stream() .map(provider -> provider.provideCodeMinings(viewer, monitor)) .filter(c -> c != null) .map(provider -> provider.exceptionally(CodeMiningManager::onCodeMiningProviderException)) .collect(Collectors.toList()); return CompletableFuture.allOf(com.toArray(new CompletableFuture[com.size()])).thenApply( v -> com.stream().map(CompletableFuture::join).flatMap(l -> l.stream()).collect(Collectors.toList())); }

Target:
private static CompletableFuture<List<? extends ICodeMining>> getCodeMinings(ITextViewer viewer, List<ICodeMiningProvider> providers, IProgressMonitor monitor) { List<CompletableFuture<List<? extends ICodeMining>>> com= providers.stream() .map(provider -> provider.provideCodeMinings(viewer, monitor)) .filter(c -> c != null) .map(future -> future.exceptionally(CodeMiningManager::logCodeMiningProviderException)) .collect(Collectors.toList()); return CompletableFuture.allOf(com.toArray(new CompletableFuture[com.size()])).thenApply( v -> com.stream().map(CompletableFuture::join).flatMap(l -> l.stream()).collect(Collectors.toList())); }
Source:
public byte[] toBinary() { final byte[] filterBinary = filterOptionProvider.toBinary(); final byte[] typeNameBinary = typeNameProvider.toBinary(); final byte[] simpBinary = simpOptionProvider.toBinary(); final ByteBuffer buf = ByteBuffer.allocate(filterBinary.length + typeNameBinary.length + simpBinary.length + 4); buf.putInt(filterBinary.length); buf.put(filterBinary); buf.put(typeNameBinary); buf.put(simpBinary); return ArrayUtils.addAll( serializationFormatOptionProvider.toBinary(), buf.array()); }

Target:
public byte[] toBinary() { final byte[] filterBinary = filterOptionProvider.toBinary(); final byte[] typeNameBinary = typeNameProvider.toBinary(); final byte[] simpBinary = simpOptionProvider.toBinary(); final byte[] backingBuffer = new byte[filterBinary.length + typeNameBinary.length + simpBinary.length + (Integer.BYTES * 2)]; final ByteBuffer buf = ByteBuffer.wrap(backingBuffer); buf.putInt(filterBinary.length); buf.put(filterBinary); buf.putInt(typeNameBinary.length); buf.put(typeNameBinary); buf.put(simpBinary); return ArrayUtils.addAll( serializationFormatOptionProvider.toBinary(), backingBuffer); }
Source:
public OnlineHmmData getModelDataByAccountId(Long accountId,final DateTime date) { final String dateString = DateTimeUtil.dateToYmdString(date); final GeneralProtobufDAODynamoDB.GeneralQueryResult results = dbDAO.getBySingleKeyLTERangeKey(accountId.toString(), dateString, 1); LOGGER.info("getModelDataByAccountId for user {}",accountId); final Map<String,byte[]> allColumns = results.payloadsByKey.get(accountId.toString()); Optional<OnlineHmmPriors> priors = Optional.absent(); Optional<OnlineHmmScratchPad> scratchPad = Optional.absent(); if (allColumns == null) { return new OnlineHmmData(priors,scratchPad); } final byte priorProtobufData = allColumns.get(PAYLOAD_KEY_FOR_PARAMS); if (priorProtobufData != null) { priors = OnlineHmmPriors.createFromProtoBuf(priorProtobufData); } final byte scratchPadProtobufData = allColumns.get(PAYLOAD_KEY_FOR_SCRATCHPAD); if (scratchPadProtobufData != null) { scratchPad = OnlineHmmScratchPad.createFromProtobuf(scratchPadProtobufData); } return new OnlineHmmData(priors,scratchPad); }

Target:
public OnlineHmmData getModelDataByAccountId(Long accountId,final DateTime date) { final String dateString = DateTimeUtil.dateToYmdString(date); final GeneralProtobufDAODynamoDB.GeneralQueryResult results = dbDAO.getBySingleKeyLTERangeKey(accountId.toString(), dateString, 1); LOGGER.info("getModelDataByAccountId for user {}",accountId); if (!results.payloadsByKey.containsKey(accountId.toString())) { LOGGER.info("getModelDataByAccountId for user returned ",accountId); return OnlineHmmData.createEmpty(); } final Map<String,byte[]> allColumns = results.payloadsByKey.get(accountId.toString()); OnlineHmmPriors priors = OnlineHmmPriors.createEmpty(); OnlineHmmScratchPad scratchPad = OnlineHmmScratchPad.createEmpty(); if (!allColumns.containsKey(PAYLOAD_KEY_FOR_PARAMS)) { LOGGER.info("getModelDataByAccountId for user did not find column {}",accountId,PAYLOAD_KEY_FOR_PARAMS); return OnlineHmmData.createEmpty(); } if ( !allColumns.containsKey(PAYLOAD_KEY_FOR_SCRATCHPAD)) { LOGGER.info("getModelDataByAccountId for user did not find column {}",accountId,PAYLOAD_KEY_FOR_SCRATCHPAD); return OnlineHmmData.createEmpty(); } final byte priorProtobufData = allColumns.get(PAYLOAD_KEY_FOR_PARAMS); final Optional<OnlineHmmPriors> priorsOptional = OnlineHmmPriors.createFromProtoBuf(priorProtobufData); if (priorsOptional.isPresent()) { priors = priorsOptional.get(); } final byte scratchPadProtobufData = allColumns.get(PAYLOAD_KEY_FOR_SCRATCHPAD); final Optional<OnlineHmmScratchPad> scratchPadOptional = OnlineHmmScratchPad.createFromProtobuf(scratchPadProtobufData); if (scratchPadOptional.isPresent()) { scratchPad = scratchPadOptional.get(); } return new OnlineHmmData(priors,scratchPad); }
Source:
private String generateRelatedIdentifiers(DvObject dvObject) { StringBuilder sb = new StringBuilder(); if (dvObject.isInstanceofDataset()) { Dataset dataset = (Dataset) dvObject; if (!dataset.getFiles().isEmpty() && !(dataset.getFiles().get(0).getIdentifier() == null)) { datafileIdentifiers = new ArrayList<>(); for (DataFile dataFile : dataset.getFiles()) { String add = ""; sb.append(""); if (!dataFile.getGlobalId().asString().isEmpty()) { add = "<relatedIdentifier relatedIdentifierType=\"DOI\" relationType=\"HasPart\"" + ">" + dataFile.getGlobalId() + "</relatedIdentifier>"; if (sb.toString().isEmpty()) { sb.append("<relatedIdentifiers>"); } sb.append(add); } } if (!sb.toString().isEmpty()) { sb.append("</relatedIdentifiers>"); } } } else if (dvObject.isInstanceofDataFile()){ DataFile df = (DataFile) dvObject; sb.append("<relatedIdentifiers>"); sb.append("<relatedIdentifier relatedIdentifierType=\"DOI\" relationType=\"IsPartOf\"" + ">" + df.getOwner().getGlobalId() + "</relatedIdentifier>"); sb.append("</relatedIdentifiers>"); } return sb.toString(); }

Target:
private String generateRelatedIdentifiers(DvObject dvObject) { StringBuilder sb = new StringBuilder(); if (dvObject.isInstanceofDataset()) { Dataset dataset = (Dataset) dvObject; if (!dataset.getFiles().isEmpty() && !(dataset.getFiles().get(0).getIdentifier() == null)) { datafileIdentifiers = new ArrayList<>(); for (DataFile dataFile : dataset.getFiles()) { if (!dataFile.getGlobalId().asString().isEmpty()) { if (sb.toString().isEmpty()) { sb.append("<relatedIdentifiers>"); } sb.append("<relatedIdentifier relatedIdentifierType=\"DOI\" relationType=\"HasPart\">" + dataFile.getGlobalId() + "</relatedIdentifier>"); } } if (!sb.toString().isEmpty()) { sb.append("</relatedIdentifiers>"); } } } else if (dvObject.isInstanceofDataFile()) { DataFile df = (DataFile) dvObject; sb.append("<relatedIdentifiers>"); sb.append("<relatedIdentifier relatedIdentifierType=\"DOI\" relationType=\"IsPartOf\"" + ">" + df.getOwner().getGlobalId() + "</relatedIdentifier>"); sb.append("</relatedIdentifiers>"); } return sb.toString(); }
Source:
public DirectDebitPayment getDirectDebitPayment(Account account, String paymentId) { Response connectorResponse = client .target(connectorUriGenerator.chargeURI(account, paymentId)) .request() .get(); if (connectorResponse.getStatus() == SC_OK) { DirectDebitConnectorCreatePaymentResponse ddConnectorResponse = connectorResponse.readEntity(DirectDebitConnectorCreatePaymentResponse.class); return aDirectDebitPayment() .withDescription(ddConnectorResponse.getDescription()) .withAmount(ddConnectorResponse.getAmount()) .withPaymentId(ddConnectorResponse.getPaymentExternalId()) .withPaymentProvider(ddConnectorResponse.getPaymentProvider()) .withState(ddConnectorResponse.getState()) .withCreatedDate(ddConnectorResponse.getCreatedDate()) .withReference(ddConnectorResponse.getReference()) .withSelfLink(publicApiUriGenerator.getDirectDebitPaymentURI(paymentId)) .withMandateLink(publicApiUriGenerator.getMandateURI(ddConnectorResponse.getMandateId())) .withEventsLink(publicApiUriGenerator.getMandateEventsURI(ddConnectorResponse.getMandateId())) .build(); } throw new GetChargeException(connectorResponse); }

Target:
public DirectDebitPayment getDirectDebitPayment(Account account, String paymentId) { Response connectorResponse = client .target(connectorUriGenerator.chargeURI(account, paymentId)) .request() .get(); if (connectorResponse.getStatus() != SC_OK) { throw new GetChargeException(connectorResponse); } DirectDebitConnectorPaymentResponse ddConnectorResponse = connectorResponse.readEntity(DirectDebitConnectorPaymentResponse.class); return DirectDebitPayment.from(ddConnectorResponse, publicApiUriGenerator); }
Source:
private RowMapBuffer getTransactionRows() throws Exception { BinlogConnectorEvent event; RowMapBuffer buffer = new RowMapBuffer(MAX_TX_ELEMENTS); while ( true ) { event = pollEvent(); if (event == null) { ensureReplicatorThread(); continue; } switch(event.getEvent().getHeader().getEventType()) { case WRITE_ROWS: case UPDATE_ROWS: case DELETE_ROWS: case EXT_WRITE_ROWS: case EXT_UPDATE_ROWS: case EXT_DELETE_ROWS: Table table = tableCache.getTable(event.getTableID()); event.setLastHeartbeat(lastHeartbeatRead); if ( table != null && shouldOutputEvent(table.getDatabase(), table.getName(), filter) ) { for ( RowMap r : event.jsonMaps(table) ) buffer.add(r); } break; case TABLE_MAP: TableMapEventData data = event.tableMapData(); tableCache.processEvent(getSchema(), this.filter, data.getTableId(), data.getDatabase(), data.getTable()); break; case QUERY: QueryEventData qe = event.queryData(); String sql = qe.getSql(); if ( sql.equals("COMMIT") ) { if ( !buffer.isEmpty() ) buffer.getLast().setTXCommit(); return buffer; } else if ( sql.toUpperCase().startsWith("SAVEPOINT")) { LOGGER.info("Ignoring SAVEPOINT in transaction: " + qe); } else if ( createTablePattern.matcher(sql).find() ) { processQueryEvent(event); } else { LOGGER.warn("Unhandled QueryEvent inside transaction: " + qe); } break; case XID: buffer.setXid(event.xidData().getXid()); replicationLag = event.getEvent().getHeader().getTimestamp() - (System.currentTimeMillis() / 1000); if ( !buffer.isEmpty() ) buffer.getLast().setTXCommit(); return buffer; } } }

Target:
private RowMapBuffer getTransactionRows() throws Exception { BinlogConnectorEvent event; RowMapBuffer buffer = new RowMapBuffer(MAX_TX_ELEMENTS); while ( true ) { event = pollEvent(); if (event == null) { ensureReplicatorThread(); continue; } switch(event.getEvent().getHeader().getEventType()) { case WRITE_ROWS: case UPDATE_ROWS: case DELETE_ROWS: case EXT_WRITE_ROWS: case EXT_UPDATE_ROWS: case EXT_DELETE_ROWS: Table table = tableCache.getTable(event.getTableID()); event.setLastHeartbeat(lastHeartbeatRead); if ( table != null && shouldOutputEvent(table.getDatabase(), table.getName(), filter) ) { for ( RowMap r : event.jsonMaps(table) ) buffer.add(r); } break; case TABLE_MAP: TableMapEventData data = event.tableMapData(); tableCache.processEvent(getSchema(), this.filter, data.getTableId(), data.getDatabase(), data.getTable()); break; case QUERY: QueryEventData qe = event.queryData(); String sql = qe.getSql(); if ( sql.equals("COMMIT") ) { if ( !buffer.isEmpty() ) buffer.getLast().setTXCommit(); return buffer; } else if ( sql.toUpperCase().startsWith("SAVEPOINT")) { LOGGER.info("Ignoring SAVEPOINT in transaction: " + qe); } else if ( createTablePattern.matcher(sql).find() ) { processQueryEvent(event); } else { LOGGER.warn("Unhandled QueryEvent inside transaction: " + qe); } break; case XID: buffer.setXid(event.xidData().getXid()); replicationLag = System.currentTimeMillis() - event.getEvent().getHeader().getTimestamp(); if ( !buffer.isEmpty() ) buffer.getLast().setTXCommit(); return buffer; } } }
Source:
private DocumentCollection getMultiPartitionCollectionDefinition() { DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setId(UUID.randomUUID().toString()); PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); List<String> paths = new ArrayList<>(); paths.add("/city"); partitionKeyDefinition.setPaths(paths); collectionDefinition.setPartitionKey(partitionKeyDefinition); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPaths = new ArrayList<>(); IncludedPath includedPath = new IncludedPath("/*"); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); ModelBridgeInternal.setIncludedPathIndexes(includedPath, indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); collectionDefinition.setIndexingPolicy(indexingPolicy); return collectionDefinition; }

Target:
private DocumentCollection getMultiPartitionCollectionDefinition() { DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setId(UUID.randomUUID().toString()); PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); List<String> paths = new ArrayList<>(); paths.add("/city"); partitionKeyDefinition.setPaths(paths); collectionDefinition.setPartitionKey(partitionKeyDefinition); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPaths = new ArrayList<>(); IncludedPath includedPath = new IncludedPath("/*"); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); collectionDefinition.setIndexingPolicy(indexingPolicy); return collectionDefinition; }
Source:
LamiReportViewTabPage getCurrentSelectedPage() { CTabFolder tf = fTabFolder; if (tf == null) { return null; } int idx = tf.getSelectionIndex(); if(idx != -1) { return fTabPages.get(idx); } return null; }

Target:
@Nullable LamiReportViewTabPage getCurrentSelectedPage() { CTabFolder tf = fTabFolder; if (tf == null) { return null; } int idx = tf.getSelectionIndex(); if (idx != -1) { return fTabPages.get(idx); } return null; }
Source:
public static Flux<ByteBuffer> convertStreamToByteBuffer (InputStream data, long length, int blockSize ) { return Flux.range(0, (int) Math.ceil((double) length / (double) blockSize)) .map(i -> i * blockSize) .concatMap(pos -> Mono.fromCallable(() -> { long count = pos + blockSize > length ? length - pos : blockSize; byte[] cache = new byte[(int) count]; if (data.available() > count) { throw new UnexpectedLengthException( String.format("Request body emitted more bytes than the expected %d bytes.", length), count, length); } int lastIndex = data.read(cache); if (lastIndex != -1 && lastIndex < count) { throw new UnexpectedLengthException( String.format("Request body emitted less bytes than the expected %d bytes.", length), count, length); } return ByteBuffer.wrap(cache); })); }

Target:
public static Flux<ByteBuffer> convertStreamToByteBuffer(InputStream data, long length, int blockSize) { final long[] currentTotalLength = new long[1]; return Flux.range(0, (int) Math.ceil((double) length / (double) blockSize)) .map(i -> i * blockSize) .concatMap(pos -> Mono.fromCallable(() -> { long count = pos + blockSize > length ? length - pos : blockSize; byte[] cache = new byte[(int) count]; int lastIndex = data.read(cache); currentTotalLength[0] += lastIndex; if (currentTotalLength[0] < count) { throw LOGGER.logExceptionAsError(new UnexpectedLengthException( String.format("Request body emitted %d bytes less than the expected %d bytes.", currentTotalLength[0], length), currentTotalLength[0], length)); } return ByteBuffer.wrap(cache); })) .doOnComplete(() -> { try { if (data.available() > 0) { Long totalLength = currentTotalLength[0] + data.available(); throw LOGGER.logExceptionAsError(new UnexpectedLengthException( String.format("Request body emitted %d bytes more than the expected %d bytes.", totalLength, length), totalLength, length)); } } catch (IOException e) { throw LOGGER.logExceptionAsError(new RuntimeException("I/O errors occurs. Error deatils: " + e.getMessage())); } }); }
Source:
void set(ChangeInfo info, final String revision) { if (info.status().isClosed()) { setVisible(false); return; } project = info.project(); ChangeApi.revision(info.legacy_id().get(), revision) .view("related") .get(new AsyncCallback<RelatedInfo>() { @Override public void onSuccess(RelatedInfo result) { tabPanel.getTabBar().setTabText(0, Resources.M.relatedChanges(result.changes().length())); render(revision, result.changes()); } @Override public void onFailure(Throwable err) { tabPanel.getTabBar().setTabText(0, Resources.M.relatedChanges("na")); progress.setVisible(false); scroll.setVisible(false); UIObject.setVisible(error, true); error.setInnerText(err.getMessage()); } }); }

Target:
void set(ChangeInfo info, final String revision) { if (info.status().isClosed()) { setVisible(false); return; } project = info.project(); ChangeApi.revision(info.legacy_id().get(), revision) .view("related") .get(new AsyncCallback<RelatedInfo>() { @Override public void onSuccess(RelatedInfo result) { tabPanel.getTabBar().setTabText(0, Resources.M.relatedChanges(result.changes().length())); render(revision, result.changes()); } @Override public void onFailure(Throwable err) { tabPanel.getTabBar().setTabText(0, Resources.M.relatedChanges(Resources.C.notAvailable())); progress.setVisible(false); scroll.setVisible(false); UIObject.setVisible(error, true); error.setInnerText(err.getMessage()); } }); }
Source:
public OpticalMicroscopeTileEntity() { super(0); }

Target:
public OpticalMicroscopeTileEntity() { super(1); }
Source:
public void show(final Activity activity){ final ScrollView scrollView = new ScrollView(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.master_password_dialog_title); builder.setView(scrollView); builder.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String password = mPasswordView.getText().toString(); if (password == K9.getMasterPassword()) { dialog.dismiss(); mLastActive = currentTimeMillis(); return; } mPasswordView.setText(""); } } ); mDialog = builder.create(); View layout = mDialog.getLayoutInflater().inflate(R.layout.master_password_prompt,scrollView); TextView intro = (TextView) layout.findViewById(R.id.master_password_prompt_intro); intro.setText(R.string.master_password_prompt_intro); TextView prompt = (TextView) layout.findViewById(R.id.master_password_prompt); prompt.setText(R.string.master_password_prompt); mPasswordView = (EditText) layout.findViewById(R.id.master_password_input); mPasswordView.addTextChangedListener(this); mDialog.setCancelable(false); mDialog.show(); }

Target:
public void show(final Activity activity){ final ScrollView scrollView = new ScrollView(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.master_password_dialog_title); builder.setView(scrollView); builder.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String password = mPasswordView.getText().toString(); if (hash(password).equals(K9.getMasterPassword())) { dialog.dismiss(); mLastActive = currentTimeMillis(); return; } mPasswordView.setText(""); show(activity); } } ); mDialog = builder.create(); View layout = mDialog.getLayoutInflater().inflate(R.layout.master_password_prompt,scrollView); TextView intro = (TextView) layout.findViewById(R.id.master_password_prompt_intro); intro.setText(R.string.master_password_prompt_intro); TextView prompt = (TextView) layout.findViewById(R.id.master_password_prompt); prompt.setText(R.string.master_password_prompt); mPasswordView = (EditText) layout.findViewById(R.id.master_password_input); mPasswordView.addTextChangedListener(this); mDialog.setCancelable(false); mDialog.show(); }
Source:
private Method getConditionMethod(Class<?> clazz) { for (Method checkMethod : clazz.getMethods()) { if (checkMethod.getName().equals("getCondition") && (checkMethod.getModifiers() & Modifier.STATIC) != Modifier.STATIC && checkParameterTypes(checkMethod.getParameterTypes())) { return checkMethod; } } return null; }

Target:
private Method getConditionMethod(Class<?> clazz) { for (Method checkMethod : clazz.getMethods()) { if (checkMethod.getName().equals("getCondition") && (checkMethod.getModifiers() & Modifier.STATIC) == Modifier.STATIC && checkParameterTypes(checkMethod.getParameterTypes())) { return checkMethod; } } return null; }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String url = req.getRequestURI(); String maven_url = ""; if (url.contains(URL_CONTEXT_STR)) { maven_url = url.substring(url.indexOf(URL_CONTEXT_STR) + URL_CONTEXT_STR.length()); } else { maven_url = url; } if (maven_url.startsWith("/")) { maven_url = maven_url.substring(1); } String[] tokens = maven_url.split("/"); if (tokens != null && tokens.length > 0) { String groupId = ""; String version = ""; String artifactId = ""; String file_name = ""; if (tokens.length >= 4) { file_name = tokens[tokens.length - 1]; MavenArtifactWrapper artifact = null; if (file_name.contains(".")) { version = tokens[tokens.length - 2]; for (int i = 0; i < tokens.length - 2; i++) { if (i < tokens.length - 3) { if (i != 0) { groupId += "."; } groupId += tokens[i]; } else { artifactId = tokens[i]; } } try { artifact = service.getArtifactContent(file_name, groupId, artifactId, version); if (artifact != null) { resp.setContentLength(artifact.getContentLength()); resp.getOutputStream().write(artifact.getContent()); resp.addHeader("Content-Disposition", "attachment; filename=" + artifact.getFileName()); resp.setContentType(artifact.getContentType()); } } catch (SrampAtomException e) { logger.info(Messages.i18n.format("maven.servlet.artifact.content.get.exception", groupId, artifactId, version, file_name)); } } if (artifact == null) { listItemsResponse(req, resp, maven_url); } } else { listItemsResponse(req, resp, maven_url); } } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String url = req.getRequestURI(); String maven_url = ""; if (url.contains(URL_CONTEXT_STR)) { maven_url = url.substring(url.indexOf(URL_CONTEXT_STR) + URL_CONTEXT_STR.length()); } else { maven_url = url; } if (maven_url.startsWith("/")) { maven_url = maven_url.substring(1); } String[] tokens = maven_url.split("/"); if (tokens != null && tokens.length > 0) { String groupId = ""; String version = ""; String artifactId = ""; String file_name = ""; if (tokens.length >= 4) { file_name = tokens[tokens.length - 1]; MavenArtifactWrapper artifact = null; if (file_name.contains(".")) { version = tokens[tokens.length - 2]; for (int i = 0; i < tokens.length - 2; i++) { if (i < tokens.length - 3) { if (i != 0) { groupId += "."; } groupId += tokens[i]; } else { artifactId = tokens[i]; } } try { artifact = service.getArtifactContent(file_name, groupId, artifactId, version); if (artifact != null) { resp.setContentLength(artifact.getContentLength()); resp.addHeader("Content-Disposition", "attachment; filename=" + artifact.getFileName()); resp.setContentType(artifact.getContentType()); IOUtils.copy(artifact.getContent(), resp.getOutputStream()); } } catch (SrampAtomException e) { logger.info(Messages.i18n.format("maven.servlet.artifact.content.get.exception", groupId, artifactId, version, file_name)); } finally { if (artifact != null && artifact.getContent() != null) { artifact.getContent().close(); } } } if (artifact == null) { listItemsResponse(req, resp, maven_url); } } else { listItemsResponse(req, resp, maven_url); } } }
Source:
protected void loadProperties(Properties props) throws IOException { try { super.loadProperties(props); } catch(FileNotFoundException e) { if (configFile != null && copyOutTemplate) { OutputStream fout = configFile.out(); props.store(fout, comments); fout.flush(); fout.close(); } } }

Target:
protected void loadProperties(Properties props) throws IOException { try { super.loadProperties(props); } catch(FileNotFoundException e) { if (configFile != null && copyOutTemplate) { try (OutputStream fout = configFile.out()) { props.store(fout, comments); fout.flush(); } } } }
Source:
protected void configureCopyCommand(final String source, final String destination) { command = new LocalCopyFileCommand(); ((LocalCopyFileCommand) command).setConfiguration(source, destination); }

Target:
protected void configureCopyCommand(final String source, final String destination) { LocalCopyFileCommand cmd = new LocalCopyFileCommand(); cmd.setConfiguration(source, destination); command.set(cmd); }
Source:
public void testSHGetKnownFolderPath() { int flags = ShlObj.KNOWN_FOLDER_FLAG.NONE.getFlag(); PointerByReference outPath = new PointerByReference(); HANDLE token = null; GUID guid = KnownFolders.FOLDERID_Fonts; HRESULT hr = Shell32.INSTANCE.SHGetKnownFolderPath(guid, flags, token, outPath); Ole32.INSTANCE.CoTaskMemFree(new LPVOID(outPath.getPointer().getLong(0))); assertTrue(W32Errors.SUCCEEDED(hr.intValue())); }

Target:
public void testSHGetKnownFolderPath() { int flags = ShlObj.KNOWN_FOLDER_FLAG.NONE.getFlag(); PointerByReference outPath = new PointerByReference(); HANDLE token = null; GUID guid = KnownFolders.FOLDERID_Fonts; HRESULT hr = Shell32.INSTANCE.SHGetKnownFolderPath(guid, flags, token, outPath); Ole32.INSTANCE.CoTaskMemFree(outPath.getValue()); assertTrue(W32Errors.SUCCEEDED(hr.intValue())); }
Source:
public void testQueryTaskByVariables() { Map<String, Object> variables = Collections.<String, Object> singletonMap("task_in_a1", "a0"); Map<String, Object> attributes = Collections.<String, Object> singletonMap("deploymentId", "org.jbpm.test:test-module:1.0.0"); List<String> potOwners = emptyList(); List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(attributes, variables, emptyMap(), potOwners, new QueryContext()); Assert.assertEquals(4, data.size()); for (UserTaskInstanceWithPotOwnerDesc p : data) { Assert.assertEquals("a0", p.getInputdata().get("task_in_a1")); Assert.assertEquals("org.jbpm.test:test-module:1.0.0", p.getDeploymentId()); } }

Target:
public void testQueryTaskByVariables() { List<QueryParam> variables = list(equalsTo("task_in_a1", "a0")); List<QueryParam> attributes = list(equalsTo(PROCESS_ATTR_DEPLOYMENT_ID, "org.jbpm.test:test-module:1.0.0")); List<String> potOwners = emptyList(); List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(attributes, variables, emptyList(), potOwners, queryContext); if (queryContext.getCount() > 0) { Assert.assertThat(data.size(), is(queryContext.getCount())); } for (UserTaskInstanceWithPotOwnerDesc p : data) { Assert.assertEquals("a0", p.getInputdata().get("task_in_a1")); Assert.assertEquals("org.jbpm.test:test-module:1.0.0", p.getDeploymentId()); } }
Source:
public void shouldQueryForObservationByPatientIdAndConceptId() throws Exception { String patientId = "OOO"; String conceptId = "CCC"; URI url = config.toInstancePathWithParams("/obs?patient={patientUUID}&concept={conceptUUID}&limit=1", patientId, conceptId); when(restOperations.exchange(eq(url), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class))) .thenReturn(getResponseFromFile(OBSERVATION_QUERY_RESPONSE_JSON)); ObservationListResult result = observationResource.getObservationByPatientUUIDAndConceptUUID(config, patientId, conceptId); verify(restOperations).exchange(eq(url), eq(HttpMethod.GET), requestCaptor.capture(), eq(String.class)); assertThat(result, equalTo(readFromFile(OBSERVATION_QUERY_RESPONSE_JSON, ObservationListResult.class))); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForGet(config))); assertThat(requestCaptor.getValue().getBody(), nullValue()); }

Target:
public void shouldQueryForObservationByPatientIdAndConceptId() throws Exception { String patientId = "OOO"; String conceptId = "CCC"; URI url = config.toInstancePathWithParams("/obs?patient={patientUUID}&concept={conceptUUID}&limit=1", patientId, conceptId); when(restOperations.exchange(eq(url), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class))) .thenReturn(getResponseFromFile(OBSERVATION_QUERY_RESPONSE_JSON)); ObservationListResult result = observationResource.getObservationByPatientUUIDAndConceptUUID(config, patientId, conceptId); verify(restOperations).exchange(eq(url), eq(HttpMethod.GET), requestCaptor.capture(), eq(String.class)); assertThat(result, equalTo(readFromFile(OBSERVATION_QUERY_RESPONSE_JSON, ObservationListResult.class))); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForGet(config))); }
Source:
public void verifyNoAsyncErrors() { try { Thread.sleep(defaultTimeoutMillis()); verifyNoAsyncErrorsNoDelay(); } catch (InterruptedException e) { throw new RuntimeException(e); } }

Target:
public void verifyNoAsyncErrors() { verifyNoAsyncErrors(defaultTimeoutMillis()); }
Source:
public static Type getTypeOfVal(String val) { Type type = null; Type[] types = Type.values(); for (int i = 0; i < Type.STRING.ordinal(); i++) { final Class clazz = types[i].getJavaType(); try { clazz.getMethod("valueOf", String.class).invoke(null, val); type = types[i]; break; } catch (Exception e) { } } if (type == null) { type = Type.STRING; } return type; }

Target:
public static Type getTypeOfVal(String val) { Type type = null; Type[] types = Type.values(); if (val.equalsIgnoreCase("true") || val.equalsIgnoreCase("false")) { type = BOOLEAN; } for (int i = 1; type == null && i < STRING.ordinal(); i++) { final Class clazz = types[i].getJavaType(); try { Object result = clazz.getMethod("valueOf", String.class).invoke(null, val); if (!(result instanceof Float) || !((Float) result).isInfinite()) { type = types[i]; break; } } catch (Exception e) { } } if (type == null) { type = STRING; } return type; }
Source:
public void init(ImportContext context, boolean prepData) throws IOException { context.reattach(catalog); try { ImportData data = context.getData(); if (data != null) { if (data instanceof RemoteData) { data = ((RemoteData) data).resolve(this); context.setData(data); } addTasks(context, data, prepData); } if (context.getState() == ImportContext.State.INIT) { context.setState(ImportContext.State.PENDING); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to resolve remote data", e); if (context.getState() == ImportContext.State.INIT) { context.setState(ImportContext.State.COMPLETE); } return; } }

Target:
public void init(ImportContext context, boolean prepData) throws IOException { context.reattach(catalog); try { ImportData data = context.getData(); if (data != null) { if (data instanceof RemoteData) { data = ((RemoteData) data).resolve(this); context.setData(data); } addTasks(context, data, prepData); } context.setState(ImportContext.State.PENDING); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to init the context ", e); context.setState(ImportContext.State.INIT_ERROR); context.setMessage(e.getMessage()); return; } }
Source:
protected PersistableNetworkPayload putIfAbsent(P2PDataStorage.ByteArray hash, PersistableNetworkPayload payload) { if (getMap().containsKey(hash)) return null; PersistableNetworkPayload previous = store.getMap().putIfAbsent(hash, payload); persist(); return previous; }

Target:
protected PersistableNetworkPayload putIfAbsent(P2PDataStorage.ByteArray hash, PersistableNetworkPayload payload) { if (getMap().containsKey(hash)) return null; PersistableNetworkPayload previous = store.getMap().put(hash, payload); persist(); return previous; }
Source:
private static boolean anyFile(IResource[] memebers) { for (IResource member : memebers) { if (member.getType() == IResource.FILE) return true; else if (member.getType() == IResource.FOLDER) return hasContainerAnyFiles(member); } return false; }

Target:
private static boolean anyFile(IResource[] memebers) { for (IResource member : memebers) { if (member.getType() == IResource.FILE) return true; else if (member.getType() == IResource.FOLDER) if (hasContainerAnyFiles(member)) return true; } return false; }
Source:
private void initializeScanners() { Assert.isTrue(isNewSetup()); boolean isModuleInfoEditor= false; IEditorSite editorSite= fTextEditor.getEditorSite(); if (editorSite != null && editorSite.getId().equals(JavaUI.ID_MODULE_INFO_EDITOR)) { isModuleInfoEditor= true; } fCodeScanner= new JavaCodeScanner(getColorManager(), fPreferenceStore, isModuleInfoEditor); fMultilineCommentScanner= new JavaCommentScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_MULTI_LINE_COMMENT); fSinglelineCommentScanner= new JavaCommentScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT); fStringScanner= new SingleTokenJavaScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_STRING); fJavaDocScanner= new JavaDocScanner(getColorManager(), fPreferenceStore); }

Target:
private void initializeScanners() { Assert.isTrue(isNewSetup()); boolean isModuleInfoEditor= false; if (fTextEditor != null && JavaUI.ID_MODULE_INFO_EDITOR.equals(fTextEditor.getEditorSite().getId())) { isModuleInfoEditor= true; } fCodeScanner= new JavaCodeScanner(getColorManager(), fPreferenceStore, isModuleInfoEditor); fMultilineCommentScanner= new JavaCommentScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_MULTI_LINE_COMMENT); fSinglelineCommentScanner= new JavaCommentScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT); fStringScanner= new SingleTokenJavaScanner(getColorManager(), fPreferenceStore, IJavaColorConstants.JAVA_STRING); fJavaDocScanner= new JavaDocScanner(getColorManager(), fPreferenceStore); }
Source:
private void querryProvider(IActivityStream activityStream) { try { activityStream.query(null); } catch (CoreException e) { logException(e); } }

Target:
private void querryProvider(IActivityStream activityStream) { try { activityStream.query(null); } catch (CoreException e) { StatusHandler.log(new Status(IStatus.ERROR, PLUGIN_ID, "Problem occured when querry the TaskActivityProvider.", e)); } }
Source:
static OperatingSystem mapOsType(OsType osType) { OperatingSystem os = OperatingSystem.builder() .description(OsFamily.UNRECOGNIZED.value()) .family(OsFamily.UNRECOGNIZED) .build(); if (os != null) switch (osType) { case WINDOWS: return OperatingSystem.builder() .description(OsFamily.WINDOWS.value()) .family(OsFamily.WINDOWS) .build(); case LINUX: return OperatingSystem.builder() .description(OsFamily.LINUX.value()) .family(OsFamily.LINUX) .build(); } return os; }

Target:
static OperatingSystem mapOsType(OsType osType) { if (osType != null) switch (osType) { case WINDOWS: return OperatingSystem.builder() .description(OsFamily.WINDOWS.value()) .family(OsFamily.WINDOWS) .build(); case LINUX: return OperatingSystem.builder() .description(OsFamily.LINUX.value()) .family(OsFamily.LINUX) .build(); } return OperatingSystem.builder() .description(OsFamily.UNRECOGNIZED.value()) .family(OsFamily.UNRECOGNIZED) .build(); }
Source:
private KfsVendorDataWrapper createInsuranceCertificateNote(PaymentWorksVendor pmwVendor, KfsVendorDataWrapper kfsVendorDataWrapper) { if (paymentWorksVendorIsPurchaseOrderVendor(pmwVendor) && StringUtils.isNotBlank(pmwVendor.getInsuranceCertificate())) { StringBuilder sbText = new StringBuilder(getConfigurationService().getPropertyValueAsString(PaymentWorksKeyConstants.NEW_VENDOR_PVEN_NOTES_INSURANCE_CERTIFICATE_URL_EXISTS_MESSAGE)); kfsVendorDataWrapper = getPaymentWorksBatchUtilityService().createNoteRecordingAnyErrors(kfsVendorDataWrapper, sbText.toString(), PaymentWorksConstants.ErrorDescriptorForBadKfsNote.INSURANCE_CERTIFICATE.getNoteDescriptionString()); } return kfsVendorDataWrapper; }

Target:
private KfsVendorDataWrapper createInsuranceCertificateNote(PaymentWorksVendor pmwVendor, KfsVendorDataWrapper kfsVendorDataWrapper) { if (paymentWorksVendorIsPurchaseOrderVendor(pmwVendor) && StringUtils.isNotBlank(pmwVendor.getInsuranceCertificate())) { kfsVendorDataWrapper = getPaymentWorksBatchUtilityService().createNoteRecordingAnyErrors(kfsVendorDataWrapper, getConfigurationService().getPropertyValueAsString(PaymentWorksKeyConstants.NEW_VENDOR_PVEN_NOTES_INSURANCE_CERTIFICATE_URL_EXISTS_MESSAGE), PaymentWorksConstants.ErrorDescriptorForBadKfsNote.INSURANCE_CERTIFICATE.getNoteDescriptionString()); } return kfsVendorDataWrapper; }
Source:
public void onPlayerCastsSpell(SpellLearnEvent event) { player = dPlayer.mirrorBukkitPlayer(event.getLearner()); spell = new Element(event.getSpell().getName()); source = new Element(event.getSource().name()); cancelled = event.isCancelled(); this.event = event; fire(event); event.setCancelled(cancelled); }

Target:
public void onPlayerCastsSpell(SpellLearnEvent event) { player = dPlayer.mirrorBukkitPlayer(event.getLearner()); spell = new Element(event.getSpell().getName()); source = new Element(event.getSource().name()); this.event = event; fire(event); }
Source:
public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmNames = platformConfiguration.getListProperty(REALM_PROPERTY_NAME, Collections.emptyList()); if (this.realmNames.size() > 0) { this.realmName = this.realmNames.get(0); } else { this.realmName = null; } this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE); this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); this.cors = platformConfiguration.getBooleanProperty(CORS_PROPERTY_NAME, true); }

Target:
public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmName = platformConfiguration.getProperty(REALM_PROPERTY_NAME); final List<String> realmNames = new ArrayList<>(platformConfiguration.getListProperty(REALMS_PROPERTY_NAME, Collections.emptyList())); if (this.realmName != null && !this.realmName.isEmpty() && !realmNames.contains(this.realmName)) { realmNames.add(this.realmName); } this.realmNames = Collections.unmodifiableList(realmNames); this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE); this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); this.cors = platformConfiguration.getBooleanProperty(CORS_PROPERTY_NAME, CORS_PROPERTY_DEFAULT_VALUE); }
Source:
public void brokerConnectionListenerTests() { MqttService service = new MqttService(); assertFalse(service.isBrokerObservers()); MqttBrokersObserver observer = new MqttBrokersObserver() { @Override public void brokerAdded(MqttBrokerConnection broker) { brokerExisting = true; } @Override public void brokerRemoved(MqttBrokerConnection broker) { brokerExisting = false; } }; service.addBrokersListener(observer); assertTrue(service.isBrokerObservers()); MqttBrokerConnection connection; try { connection = new MqttBrokerConnection("name", "tcp://123.123.123.123", false); } catch (ConfigurationException c) { fail("Couldn't create a MqttBrokerConnection object"); return; } assertTrue(service.addBrokerConnection(connection)); assertTrue(brokerExisting); service.removeBrokerConnection(connection); assertFalse(brokerExisting); service.removeBrokersListener(observer); assertFalse(service.isBrokerObservers()); }

Target:
public void brokerConnectionListenerTests() throws ConfigurationException { MqttService service = new MqttService(); assertFalse(service.isBrokerObservers()); MqttBrokersObserver observer = mock(MqttBrokersObserver.class); service.addBrokersListener(observer); assertTrue(service.isBrokerObservers()); MqttBrokerConnection connection = new MqttBrokerConnection("name", "tcp://123.123.123.123", false); assertTrue(service.addBrokerConnection(connection)); verify(observer).brokerAdded(connection); service.removeBrokerConnection(connection); verify(observer).brokerRemoved(connection); service.removeBrokersListener(observer); assertFalse(service.isBrokerObservers()); }
Source:
private Widget getWidget(final DTCellValue52 defaultValue) { final DTColumnConfig52 column = getPlugin().editingCol(); final Pattern52 pattern = getPlugin().editingPattern(); if (column instanceof ActionSetFieldCol52) { final ActionSetFieldCol52 col52 = (ActionSetFieldCol52) column; return factory().getWidget(pattern, col52, defaultValue); } else if (column instanceof ConditionCol52) { final ConditionCol52 col52 = (ConditionCol52) column; return factory().getWidget(pattern, col52, defaultValue); } else if (column instanceof ActionInsertFactCol52) { final ActionInsertFactCol52 col52 = (ActionInsertFactCol52) column; return factory().getWidget(col52, defaultValue); } return null; }

Target:
private Widget getWidget(final DTCellValue52 defaultValue) { final DTColumnConfig52 column = getPlugin().editingCol(); final Pattern52 pattern = getPlugin().editingPattern(); if (column instanceof ActionSetFieldCol52) { final ActionSetFieldCol52 col52 = (ActionSetFieldCol52) column; return factory().getWidget(pattern, col52, defaultValue); } else if (column instanceof ConditionCol52) { final ConditionCol52 col52 = (ConditionCol52) column; return factory().getWidget(pattern, col52, defaultValue); } else if (column instanceof ActionInsertFactCol52) { final ActionInsertFactCol52 col52 = (ActionInsertFactCol52) column; return factory().getWidget(col52, defaultValue); } throw new UnsupportedOperationException("The column type is not supported by the 'DefaultWidget'"); }