auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setTrackingIdsFromTransaction(final Iterable<InvoiceModelDao> invoices, final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final InternalTenantContext context) { final InvoiceTrackingSqlDao invoiceTrackingidSqlDao = entitySqlDaoWrapperFactory.become(InvoiceTrackingSqlDao.class); final List<InvoiceTrackingModelDao> trackingIds = invoiceTrackingidSqlDao.getByAccountRecordId(context); final Map<UUID, List<InvoiceTrackingModelDao>> invoiceTrackingIdsPerInvoiceId = new HashMap<UUID, List<InvoiceTrackingModelDao>>(); for (InvoiceTrackingModelDao cur : trackingIds) { if (invoiceTrackingIdsPerInvoiceId.get(cur.getInvoiceId()) == null) { invoiceTrackingIdsPerInvoiceId.put(cur.getInvoiceId(), new LinkedList<>()); } invoiceTrackingIdsPerInvoiceId.get(cur.getInvoiceId()).add(cur); } for (final InvoiceModelDao invoice : invoices) { if (invoiceTrackingIdsPerInvoiceId.get(invoice.getId()) != null) { final List<InvoiceTrackingModelDao> perInvoiceTrackingIds = invoiceTrackingIdsPerInvoiceId.get(invoice.getId()); final Iterable<String> transform = Iterables.transform(perInvoiceTrackingIds, new Function<InvoiceTrackingModelDao, String>() { @Override public String apply(final InvoiceTrackingModelDao input) { return input.getTrackingId(); } }); invoice.addTrackingIds(ImmutableSet.<String>copyOf(transform)); } } }

Target:
private void setTrackingIdsFromTransaction(final Iterable<InvoiceModelDao> invoices, final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final InternalTenantContext context) { final Set<String> invoiceIds = ImmutableSet.<String>copyOf(Iterables.transform(invoices, new Function<InvoiceModelDao, String>() { @Override public String apply(final InvoiceModelDao input) { return input.getId().toString(); } })); final InvoiceTrackingSqlDao invoiceTrackingidSqlDao = entitySqlDaoWrapperFactory.become(InvoiceTrackingSqlDao.class); final List<InvoiceTrackingModelDao> trackingIds = invoiceTrackingidSqlDao.getTrackingsForInvoices(invoiceIds, context); final Map<UUID, List<InvoiceTrackingModelDao>> invoiceTrackingIdsPerInvoiceId = new HashMap<UUID, List<InvoiceTrackingModelDao>>(); for (InvoiceTrackingModelDao cur : trackingIds) { if (invoiceTrackingIdsPerInvoiceId.get(cur.getInvoiceId()) == null) { invoiceTrackingIdsPerInvoiceId.put(cur.getInvoiceId(), new LinkedList<>()); } invoiceTrackingIdsPerInvoiceId.get(cur.getInvoiceId()).add(cur); } for (final InvoiceModelDao invoice : invoices) { if (invoiceTrackingIdsPerInvoiceId.get(invoice.getId()) != null) { final List<InvoiceTrackingModelDao> perInvoiceTrackingIds = invoiceTrackingIdsPerInvoiceId.get(invoice.getId()); final Iterable<String> transform = Iterables.transform(perInvoiceTrackingIds, new Function<InvoiceTrackingModelDao, String>() { @Override public String apply(final InvoiceTrackingModelDao input) { return input.getTrackingId(); } }); invoice.addTrackingIds(ImmutableSet.<String>copyOf(transform)); } } }
Source:
public void checkImmutableTsLockAfterReadsForConservativeIfFlagIsSet() { TimelockService timelockService = spy(new LegacyTimelockService(timestampService, lockService, lockClient)); long transactionTs = timelockService.getFreshTimestamp(); LockImmutableTimestampResponse res = timelockService.lockImmutableTimestamp(); setTransactionConfig(ImmutableTransactionConfig.builder() .lockImmutableTsOnReadOnlyTransactions(true) .build()); SnapshotTransaction transaction = getSnapshotTransactionWith( timelockService, () -> transactionTs, res, PreCommitConditions.NO_OP, true); transaction.get(TABLE_SWEPT_CONSERVATIVE, ImmutableSet.of(TEST_CELL)); transaction.commit(); timelockService.unlock(ImmutableSet.of(res.getLock())); verify(timelockService).refreshLockLeases(ImmutableSet.of(res.getLock())); }

Target:
public void checkImmutableTsLockAfterReadsForConservativeIfFlagIsSet() { TimelockService timelockService = spy(new LegacyTimelockService(timestampService, lockService, lockClient)); long transactionTs = timelockService.getFreshTimestamp(); LockImmutableTimestampResponse res = timelockService.lockImmutableTimestamp(); setTransactionConfig(ImmutableTransactionConfig.builder() .lockImmutableTsOnReadOnlyTransactions(true) .build()); SnapshotTransaction transaction = getSnapshotTransactionWith( timelockService, () -> transactionTs, res, PreCommitConditions.NO_OP, true); transaction.get(TABLE_SWEPT_CONSERVATIVE, ImmutableSet.of(TEST_CELL)); verify(timelockService).refreshLockLeases(ImmutableSet.of(res.getLock())); transaction.commit(); timelockService.unlock(ImmutableSet.of(res.getLock())); }
Source:
private void addUrlParams(DetailedLink link, Action action) { if (action.getRequest().getUrlparams() != null && !action.getRequest().getUrlparams().isEmpty()) { link.getRequest().setUrl(new Url()); ParametersSet ps = new ParametersSet(); for (Object key : action.getRequest().getUrlparams().keySet()) { Parameter param = new Parameter(); param.setName(key.toString()); Object value = action.getRequest().getUrlparams().get(key); if (value != null) { ParamData urlParamData = (ParamData)value; param.setType(urlParamData.getType()); param.setContext(urlParamData.getContext()); param.setValue(urlParamData.getValue()); param.setRequired(urlParamData.getRequired()==null ? new Boolean(false) : urlParamData.getRequired()); } ps.getParameters().add(param); } link.getRequest().getUrl().getParametersSets().add(ps); } }

Target:
private void addUrlParams(DetailedLink link, Action action) { if (action.getRequest().getUrlparams() != null && !action.getRequest().getUrlparams().isEmpty()) { link.getRequest().setUrl(new Url()); ParametersSet ps = new ParametersSet(); for (Object key : action.getRequest().getUrlparams().keySet()) { Parameter param = new Parameter(); param.setName(key.toString()); Object value = action.getRequest().getUrlparams().get(key); if (value != null) { ParamData urlParamData = (ParamData)value; param.setType(urlParamData.getType()); param.setContext(urlParamData.getContext()); param.setValue(urlParamData.getValue()); param.setRequired(urlParamData.getRequired()==null ? Boolean.FALSE : urlParamData.getRequired()); } ps.getParameters().add(param); } link.getRequest().getUrl().getParametersSets().add(ps); } }
Source:
protected void handleMessage(Message<?> message) { boolean executorInterceptorPresent = false; if (this.channelInterceptors != null) { for (ChannelInterceptor interceptor : this.channelInterceptors) { if (interceptor instanceof ExecutorChannelInterceptor) { executorInterceptorPresent = true; break; } } } Deque<ExecutorChannelInterceptor> interceptorStack = null; try { if (executorInterceptorPresent) { interceptorStack = new ArrayDeque<ExecutorChannelInterceptor>(); message = applyBeforeHandle(message, interceptorStack); if (message == null) { return; } } this.handler.handleMessage(message); if (!CollectionUtils.isEmpty(interceptorStack)) { triggerAfterMessageHandled(message, null, interceptorStack); } } catch (Exception ex) { if (!CollectionUtils.isEmpty(interceptorStack)) { triggerAfterMessageHandled(message, ex, interceptorStack); } if (ex instanceof MessagingException) { throw (MessagingException) ex; } String description = "Failed to handle " + message + " to " + this + " in " + this.handler; throw new MessageDeliveryException(message, description, ex); } catch (Error ex) { if (!CollectionUtils.isEmpty(interceptorStack)) { String description = "Failed to handle " + message + " to " + this + " in " + this.handler; triggerAfterMessageHandled(message, new MessageDeliveryException(message, description, ex), interceptorStack); } throw ex; } }

Target:
protected void handleMessage(Message<?> message) { Deque<ExecutorChannelInterceptor> interceptorStack = null; try { if (this.channelInterceptors != null && ((ExecutorChannelInterceptorAware) this.inputChannel).hasExecutorInterceptors()) { interceptorStack = new ArrayDeque<ExecutorChannelInterceptor>(); message = applyBeforeHandle(message, interceptorStack); if (message == null) { return; } } this.handler.handleMessage(message); if (!CollectionUtils.isEmpty(interceptorStack)) { triggerAfterMessageHandled(message, null, interceptorStack); } } catch (Exception ex) { if (!CollectionUtils.isEmpty(interceptorStack)) { triggerAfterMessageHandled(message, ex, interceptorStack); } if (ex instanceof MessagingException) { throw (MessagingException) ex; } String description = "Failed to handle " + message + " to " + this + " in " + this.handler; throw new MessageDeliveryException(message, description, ex); } catch (Error ex) { if (!CollectionUtils.isEmpty(interceptorStack)) { String description = "Failed to handle " + message + " to " + this + " in " + this.handler; triggerAfterMessageHandled(message, new MessageDeliveryException(message, description, ex), interceptorStack); } throw ex; } }
Source:
public void onBind() { view.getSubmitButton().addListener(Events.OnClick, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { if (!view.getMainPanel().isValid()) { N10N.message(I18N.CONSTANTS.createFormIncomplete(), I18N.MESSAGES.createFormIncompleteDetails(I18N.CONSTANTS.adminImportationScheme()), MessageType.INFO); return; } Map<String, Object> newImportationSchemeModelProperties = new HashMap<String, Object>(); newImportationSchemeModelProperties.put(AdminUtil.ADMIN_SCHEMA, view.getSchemasCombo().getValue()); if (model instanceof ProjectModelDTO) { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_PROJECT_MODEL, model); } else if (model instanceof OrgUnitDTO) { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_ORG_UNIT_MODEL, model); } else { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_CONTACT_MODEL, model); } newImportationSchemeModelProperties.put(AdminUtil.ADMIN_IMPORTATION_SCHEME_MODEL, new ImportationSchemeModelDTO()); CreateEntity cmd = new CreateEntity(ImportationSchemeModelDTO.ENTITY_NAME, newImportationSchemeModelProperties); dispatch.execute(cmd, new CommandResultHandler<CreateResult>() { @Override protected void onCommandSuccess(CreateResult result) { eventBus.fireEvent(new UpdateEvent(UpdateEvent.IMPORTATION_SCHEME_MODEL_UPDATE, model, result.getEntity())); hideView(); } @Override protected void onCommandFailure(Throwable caught) { hideView(); } }, new LoadingMask(view.getMainPanel())); } }); }

Target:
public void onBind() { view.getSubmitButton().addListener(Events.OnClick, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { if (!view.getMainPanel().isValid()) { N10N.message(I18N.CONSTANTS.createFormIncomplete(), I18N.MESSAGES.createFormIncompleteDetails(I18N.CONSTANTS.adminImportationScheme()), MessageType.INFO); return; } Map<String, Object> newImportationSchemeModelProperties = new HashMap<String, Object>(); newImportationSchemeModelProperties.put(AdminUtil.ADMIN_SCHEMA, view.getSchemasCombo().getValue()); if (model instanceof OrgUnitModelDTO) { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_ORG_UNIT_MODEL, model); } else if (model instanceof ProjectModelDTO) { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_PROJECT_MODEL, model); } else if (model instanceof ContactModelDTO) { newImportationSchemeModelProperties.put(AdminUtil.ADMIN_CONTACT_MODEL, model); } else { throw new IllegalArgumentException("Invalid model type"); } newImportationSchemeModelProperties.put(AdminUtil.ADMIN_IMPORTATION_SCHEME_MODEL, new ImportationSchemeModelDTO()); CreateEntity cmd = new CreateEntity(ImportationSchemeModelDTO.ENTITY_NAME, newImportationSchemeModelProperties); dispatch.execute(cmd, new CommandResultHandler<CreateResult>() { @Override protected void onCommandSuccess(CreateResult result) { eventBus.fireEvent(new UpdateEvent(UpdateEvent.IMPORTATION_SCHEME_MODEL_UPDATE, model, result.getEntity())); hideView(); } @Override protected void onCommandFailure(Throwable caught) { hideView(); } }, new LoadingMask(view.getMainPanel())); } }); }
Source:
public MapFeederForkJoin(StreamMapper task, TaskDataSource source, int parallelism) { this.source = source; this.task = task; this.parallelism = parallelism; this.mapperPool = new ForkJoinPool(parallelism); this.enqueuePermits = new Semaphore(QUEUE_DEPTH); }

Target:
public MapFeederForkJoin(StreamMapper task, TaskDataSource source, int parallelism) { this.source = source; this.task = task; this.parallelism = parallelism; this.mapperPool = new ForkJoinPool(parallelism, ForkJoinPool.defaultForkJoinWorkerThreadFactory, (Thread t, Throwable e) -> handleUncaughtThrowable(e), true); this.enqueuePermits = new Semaphore(QUEUE_DEPTH); }
Source:
final ExecutionPlan getExecutionPlan(StreamApplication app) throws Exception { StreamGraphImpl streamGraph = new StreamGraphImpl(this, config); app.init(streamGraph, config); ExecutionPlanner planner = new ExecutionPlanner(config, streamManager); return planner.plan(streamGraph); }

Target:
final ExecutionPlan getExecutionPlan(StreamApplication app) throws Exception { StreamGraphImpl streamGraph = new StreamGraphImpl(this, config); app.init(streamGraph, config); return planner.plan(streamGraph); }
Source:
public SamzaSqlApplicationConfig(Config staticConfig) { sql = fetchSqlFromConfig(staticConfig); queryInfo = fetchQueryInfo(sql); ioResolver = createIOResolver(staticConfig); udfResolver = createUdfResolver(staticConfig); udfMetadata = udfResolver.getUdfs(); inputSystemStreamConfigBySource = queryInfo.stream() .map(QueryInfo::getSources) .flatMap(Collection::stream) .collect(Collectors.toMap(Function.identity(), ioResolver::fetchSourceInfo, (src1, src2) -> src1)); Set<SqlIOConfig> systemStreamConfigs = new HashSet<>(inputSystemStreamConfigBySource.values()); outputSystemStreamConfigsBySource = queryInfo.stream() .map(QueryInfo::getSink) .collect(Collectors.toMap(Function.identity(), ioResolver::fetchSinkInfo, (src1, src2) -> src1)); systemStreamConfigs.addAll(outputSystemStreamConfigsBySource.values()); relSchemaProvidersBySource = systemStreamConfigs.stream() .collect(Collectors.toMap(SqlIOConfig::getSource, x -> initializePlugin("RelSchemaProvider", x.getRelSchemaProviderName(), staticConfig, CFG_FMT_REL_SCHEMA_PROVIDER_DOMAIN, (o, c) -> ((RelSchemaProviderFactory) o).create(x.getSystemStream(), c)))); samzaRelConvertersBySource = systemStreamConfigs.stream() .collect(Collectors.toMap(SqlIOConfig::getSource, x -> initializePlugin("SamzaRelConverter", x.getSamzaRelConverterName(), staticConfig, CFG_FMT_SAMZA_REL_CONVERTER_DOMAIN, (o, c) -> ((SamzaRelConverterFactory) o).create(x.getSystemStream(), relSchemaProvidersBySource.get(x.getSource()), c)))); windowDurationMs = staticConfig.getLong(CFG_GROUPBY_WINDOW_DURATION_MS, DEFAULT_GROUPBY_WINDOW_DURATION_MS); }

Target:
public SamzaSqlApplicationConfig(Config staticConfig) { sql = fetchSqlFromConfig(staticConfig); queryInfo = fetchQueryInfo(sql); ioResolver = createIOResolver(staticConfig); udfResolver = createUdfResolver(staticConfig); udfMetadata = udfResolver.getUdfs(); inputSystemStreamConfigBySource = queryInfo.stream() .map(QueryInfo::getSources) .flatMap(Collection::stream) .distinct() .collect(Collectors.toMap(Function.identity(), ioResolver::fetchSourceInfo)); Set<SqlIOConfig> systemStreamConfigs = new HashSet<>(inputSystemStreamConfigBySource.values()); outputSystemStreamConfigsBySource = queryInfo.stream() .map(QueryInfo::getSink) .distinct() .collect(Collectors.toMap(Function.identity(), ioResolver::fetchSinkInfo)); systemStreamConfigs.addAll(outputSystemStreamConfigsBySource.values()); relSchemaProvidersBySource = systemStreamConfigs.stream() .collect(Collectors.toMap(SqlIOConfig::getSource, x -> initializePlugin("RelSchemaProvider", x.getRelSchemaProviderName(), staticConfig, CFG_FMT_REL_SCHEMA_PROVIDER_DOMAIN, (o, c) -> ((RelSchemaProviderFactory) o).create(x.getSystemStream(), c)))); samzaRelConvertersBySource = systemStreamConfigs.stream() .collect(Collectors.toMap(SqlIOConfig::getSource, x -> initializePlugin("SamzaRelConverter", x.getSamzaRelConverterName(), staticConfig, CFG_FMT_SAMZA_REL_CONVERTER_DOMAIN, (o, c) -> ((SamzaRelConverterFactory) o).create(x.getSystemStream(), relSchemaProvidersBySource.get(x.getSource()), c)))); windowDurationMs = staticConfig.getLong(CFG_GROUPBY_WINDOW_DURATION_MS, DEFAULT_GROUPBY_WINDOW_DURATION_MS); }
Source:
public String telnet(Channel channel, String message) throws RemotingException { String prompt = channel.getUrl().getParameterAndDecoded(Constants.PROMPT_KEY, Constants.DEFAULT_PROMPT); boolean noprompt = message.contains("--no-prompt"); message = message.replace("--no-prompt", ""); StringBuilder buf = new StringBuilder(); message = message.trim(); String command; if (message.length() > 0) { int i = message.indexOf(' '); if (i > 0) { command = message.substring(0, i).trim(); message = message.substring(i + 1).trim(); } else { command = message; message = ""; } } else { command = ""; } if (command.length() > 0) { if (extensionLoader.hasExtension(command)) { if (commandEnabled(channel.getUrl(), command)) { try { String result = extensionLoader.getExtension(command).telnet(channel, message); if (result == null) { return null; } buf.append(result); } catch (Throwable t) { buf.append(t.getMessage()); } } else { buf.append("Command: "); buf.append(command); buf.append(" disabled"); } } else { buf.append("Unsupported command: "); buf.append(command); } } if (buf.length() > 0) { buf.append("\r\n"); } if (prompt != null && prompt.length() > 0 && !noprompt) { buf.append(prompt); } return buf.toString(); }

Target:
public String telnet(Channel channel, String message) throws RemotingException { String prompt = channel.getUrl().getParameterAndDecoded(Constants.PROMPT_KEY, Constants.DEFAULT_PROMPT); boolean noprompt = message.contains("--no-prompt"); message = message.replace("--no-prompt", ""); StringBuilder buf = new StringBuilder(); message = message.trim(); String command; if (message.length() > 0) { int i = message.indexOf(' '); if (i > 0) { command = message.substring(0, i).trim(); message = message.substring(i + 1).trim(); } else { command = message; message = ""; } } else { command = ""; } if (command.length() > 0) { if (extensionLoader.hasExtension(command)) { try { String result = extensionLoader.getExtension(command).telnet(channel, message); if (result == null) { return null; } buf.append(result); } catch (Throwable t) { buf.append(t.getMessage()); } } else { buf.append("Unsupported command: "); buf.append(command); } } if (buf.length() > 0) { buf.append("\r\n"); } if (prompt != null && prompt.length() > 0 && !noprompt) { buf.append(prompt); } return buf.toString(); }
Source:
public boolean isArray() { try { JSONArray.fromObject(value); return true; } catch (JSONException e) { LOGGER.debug("This json is not an object: {}", e.getMessage()); return false; } }

Target:
public boolean isArray() { try { JSONArray.fromObject(value); return true; } catch (JSONException e) { LOGGER.debug("This json is not an Array: {}", e.getMessage()); return false; } }
Source:
public static String moduleToJsonString(Module module) throws IOException { JsonFactory jsonFactory = createJsonFactory(); StringWriter writer = new StringWriter(); JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer); jsonGenerator.useDefaultPrettyPrinter(); jsonGenerator.writeObject(module); String result = writer.getBuffer().toString(); return result; }

Target:
public static String moduleToJsonString(Module module) throws IOException { JsonFactory jsonFactory = createJsonFactory(); StringWriter writer = new StringWriter(); JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer); jsonGenerator.useDefaultPrettyPrinter(); jsonGenerator.writeObject(module); return writer.getBuffer().toString(); }
Source:
private void handleConnections(final CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation> commandBuilder, final Node<View<?>, Edge> node, final Supplier<Connection> connectionSupplier, final Supplier<CanvasCommand<AbstractCanvasHandler>> commandSupplier) { final Connection connection = connectionSupplier.get(); if (Objects.isNull(connection) || !(connection instanceof MagnetConnection)) { return; } final MagnetConnection magnetConnection = (MagnetConnection) connection; magnetConnection.getMagnetIndex().ifPresent(index -> { final Shape shape = canvasHandler.getCanvas().getShape(node.getUUID()); Optional.ofNullable(WiresUtils.isWiresShape(shape.getShapeView()) ? (WiresShape) shape.getShapeView() : null) .ifPresent(wiresShape -> { final WiresMagnet magnet = wiresShape.getMagnets().getMagnet(index); if (Objects.nonNull(magnetConnection.getLocation())) { magnetConnection.getLocation().setX(magnet.getX()); magnetConnection.getLocation().setY(magnet.getY()); } else { magnetConnection.setLocation(new Point2D(magnet.getX(), magnet.getY())); } commandBuilder.addCommand(commandSupplier.get()); }); }); }

Target:
private void handleConnections(final CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation> commandBuilder, final Node<View<?>, Edge> node, final Supplier<Connection> connectionSupplier, final Supplier<CanvasCommand<AbstractCanvasHandler>> commandSupplier) { final Connection connection = connectionSupplier.get(); if (Objects.isNull(connection) || !(connection instanceof MagnetConnection)) { return; } final MagnetConnection magnetConnection = (MagnetConnection) connection; magnetConnection.getMagnetIndex().ifPresent(index -> { final Shape shape = canvasHandler.getCanvas().getShape(node.getUUID()); Optional.ofNullable(WiresUtils.isWiresShape(shape.getShapeView()) ? (WiresShape) shape.getShapeView() : null) .ifPresent(wiresShape -> { final WiresMagnet magnet = wiresShape.getMagnets().getMagnet(index); magnetConnection.setLocation(new Point2D(magnet.getX(), magnet.getY())); commandBuilder.addCommand(commandSupplier.get()); }); }); }
Source:
private void showRemoveSelfHostedSiteDialog(@NonNull final SiteModel site) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(getResources().getText(R.string.remove_account)); dialogBuilder.setMessage(getResources().getText(R.string.sure_to_remove_account)); dialogBuilder.setPositiveButton(getResources().getText(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mDispatcher.dispatch(SiteActionBuilder.newRemoveSiteAction(site)); getAdapter().loadSites(); } }); dialogBuilder.setNegativeButton(getResources().getText(R.string.no), null); dialogBuilder.setCancelable(false); dialogBuilder.create().show(); }

Target:
private void showRemoveSelfHostedSiteDialog(@NonNull final SiteModel site) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(getResources().getText(R.string.remove_account)); dialogBuilder.setMessage(getResources().getText(R.string.sure_to_remove_account)); dialogBuilder.setPositiveButton(getResources().getText(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mDispatcher.dispatch(SiteActionBuilder.newRemoveSiteAction(site)); } }); dialogBuilder.setNegativeButton(getResources().getText(R.string.no), null); dialogBuilder.setCancelable(false); dialogBuilder.create().show(); }
Source:
private static List<? extends Expression> matchMethodParameterTypes(boolean varArgs, Class[] parameterTypes, List<? extends Expression> arguments) { if (varArgs) { if (arguments.size() < parameterTypes.length - 1) { return null; } } else { if (parameterTypes.length != arguments.size()) { return null; } } final List<Expression> typeMatchedArguments = new ArrayList<>(); for (int i = 0; i < arguments.size(); i++) { Class parameterType = !varArgs || i < parameterTypes.length - 1 ? parameterTypes[i] : Object.class; final Expression typeMatchedArgument = matchMethodParameterType(arguments.get(i), parameterType); if (typeMatchedArgument == null) { return null; } typeMatchedArguments.add(typeMatchedArgument); } return typeMatchedArguments; }

Target:
private static List<? extends Expression> matchMethodParameterTypes(boolean varArgs, Class[] parameterTypes, List<? extends Expression> arguments) { if ((varArgs && arguments.size() < parameterTypes.length - 1) || (!varArgs && arguments.size() != parameterTypes.length)) { return null; } final List<Expression> typeMatchedArguments = new ArrayList<>(); for (int i = 0; i < arguments.size(); i++) { Class parameterType = !varArgs || i < parameterTypes.length - 1 ? parameterTypes[i] : Object.class; final Expression typeMatchedArgument = matchMethodParameterType(arguments.get(i), parameterType); if (typeMatchedArgument == null) { return null; } typeMatchedArguments.add(typeMatchedArgument); } return typeMatchedArguments; }
Source:
protected void onBind() { super.onBind(); Scheduler.get().scheduleDeferred(() -> addPluginActionButtons( actionButtonPluginHandler.getButtons(getProxy().getTargetHistoryToken()), false)); Scheduler.get().scheduleDeferred(() -> addPluginActionButtons( actionButtonPluginHandler.getMenuItems(getProxy().getTargetHistoryToken()), false)); registerHandler(getEventBus().addHandler(AddActionButtonEvent.getType(), event -> { if (getProxy().getTargetHistoryToken().equals(event.getHistoryToken())) { List<ActionButtonDefinition<?>> pluginActionButtonList = new ArrayList<>(); pluginActionButtonList.add(event.getButtonDefinition()); addPluginActionButtons(pluginActionButtonList, false); } })); registerHandler(getEventBus().addHandler(AddKebabMenuListItemEvent.getType(), event -> { if (getProxy().getTargetHistoryToken().equals(event.getHistoryToken())) { List<ActionButtonDefinition<?>> pluginActionButtonList = new ArrayList<>(); pluginActionButtonList.add(event.getButtonDefinition()); addPluginActionButtons(pluginActionButtonList, true); } })); }

Target:
protected void onBind() { super.onBind(); Scheduler.get().scheduleDeferred(() -> { addPluginActionButtons( actionButtonPluginHandler.getButtons(getProxy().getTargetHistoryToken()), false); addPluginActionButtons( actionButtonPluginHandler.getMenuItems(getProxy().getTargetHistoryToken()), false); }); registerHandler(getEventBus().addHandler(AddActionButtonEvent.getType(), event -> { if (getProxy().getTargetHistoryToken().equals(event.getHistoryToken())) { List<ActionButtonDefinition<?>> pluginActionButtonList = new ArrayList<>(); pluginActionButtonList.add(event.getButtonDefinition()); addPluginActionButtons(pluginActionButtonList, false); } })); registerHandler(getEventBus().addHandler(AddKebabMenuListItemEvent.getType(), event -> { if (getProxy().getTargetHistoryToken().equals(event.getHistoryToken())) { List<ActionButtonDefinition<?>> pluginActionButtonList = new ArrayList<>(); pluginActionButtonList.add(event.getButtonDefinition()); addPluginActionButtons(pluginActionButtonList, true); } })); }
Source:
public void copy_shouldCopyAllDrugOrderFields() throws Exception { DrugOrder drugOrder = new DrugOrder(); Drug drug = new Drug(); drug.setConcept(new Concept()); drugOrder.setDrug(drug); OrderTest.assertThatAllFieldsAreCopied(drugOrder, null, "orderGroup", "sortWeight"); }

Target:
public void copy_shouldCopyAllDrugOrderFields() throws Exception { DrugOrder drugOrder = new DrugOrder(); Drug drug = new Drug(); drug.setConcept(new Concept()); drugOrder.setDrug(drug); OrderTest.assertThatAllFieldsAreCopied(drugOrder, null); }
Source:
public void testGetTypeIndel() { assertEquals(VariantType.INDEL, new Variant("1", 1, 1, "T", "<DEL>").getType()); assertEquals(VariantType.INDEL, new Variant("1", 1, 1, "T", "<INS>").getType()); assertEquals(VariantType.INDEL, new Variant("1", 1, 1, ".", "T").getType()); assertEquals(VariantType.INDEL, new Variant("1", 1, 1, "", "T").getType()); assertEquals(VariantType.INDEL, new Variant("1", 1, 1, "GGGGCCC", "TGA").getType()); }

Target:
public void testGetTypeIndel() { assertEquals(VariantType.INDEL, new Variant("1", 1, 1, ".", "T").getType()); assertEquals(VariantType.INDEL, new Variant("1", 1, 1, "GGGGCCC", "TGA").getType()); }
Source:
public Server listen() throws InterruptedException { workGroup = new NioEventLoopGroup(); try { logger.info("Starting server on port: {}", this.port); beatsInitializer = new BeatsInitializer(isSslEnable(), messageListener, clientInactivityTimeoutSeconds, beatsHeandlerThreadCount); ServerBootstrap server = new ServerBootstrap(); server.group(workGroup) .channel(NioServerSocketChannel.class) .childOption(ChannelOption.SO_LINGER, 0) .childHandler(beatsInitializer); Channel channel = server.bind(host, port).sync().channel(); channel.closeFuture().sync(); } finally { shutdown(); } return this; }

Target:
public Server listen() throws InterruptedException { if (workGroup != null) { try { logger.debug("Shutting down existing worker group before starting"); workGroup.shutdownGracefully().sync(); } catch (Exception e) { logger.error("Could not shut down worker group before starting", e); } } workGroup = new NioEventLoopGroup(); try { logger.info("Starting server on port: {}", this.port); beatsInitializer = new BeatsInitializer(isSslEnable(), messageListener, clientInactivityTimeoutSeconds, beatsHeandlerThreadCount); ServerBootstrap server = new ServerBootstrap(); server.group(workGroup) .channel(NioServerSocketChannel.class) .childOption(ChannelOption.SO_LINGER, 0) .childHandler(beatsInitializer); Channel channel = server.bind(host, port).sync().channel(); channel.closeFuture().sync(); } finally { shutdown(); } return this; }
Source:
public void shutdown() { if(null != this.queueProcessor) this.queueProcessor.shutdown(); if(null != this.updaterThread) this.updaterThread.shutdown(); }

Target:
public void shutdown() { if(null != this.queueProcessor) { this.queueProcessor.shutdown(); } if(null != this.updaterThread) { this.updaterThread.shutdown(); } }
Source:
private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if (destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain() && diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) { diskImage.setvolumeFormat(VolumeFormat.COW); } } }

Target:
private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if ( diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW) && getDestintationDomainTypeFromDisk(diskImage).isBlockDomain()) { diskImage.setvolumeFormat(VolumeFormat.COW); } } }
Source:
@Override protected Boolean run(@Nullable VisorContinuousQueryCancelTaskArg arg) throws IgniteException { IgniteLogger log = ignite.log().getLogger(VisorContinuousQueryCancelJob.class); log.info("Cancelling continuous query[routineId=" + arg.getRoutineId() + ']'); try { IgniteInternalFuture<?> fut = ignite.context().continuous().stopRoutine(arg.getRoutineId()); fut.get(); } catch (IgniteCheckedException e) { return false; } return true; }

Target:
@Override protected Boolean run(@Nullable VisorContinuousQueryCancelTaskArg arg) throws IgniteException { IgniteLogger log = ignite.log().getLogger(VisorContinuousQueryCancelJob.class); if (log.isInfoEnabled()) log.info("Cancelling continuous query[routineId=" + arg.getRoutineId() + ']'); try { IgniteInternalFuture<?> fut = ignite.context().continuous().stopRoutine(arg.getRoutineId()); fut.get(); } catch (IgniteCheckedException e) { return false; } return true; }
Source:
public Multimap<URI, URI> aliases() { return ImmutableMultimap.<URI, URI>builder() .put(URI.create(ExtensionNamespaces.L3_ROUTER), URI.create("<LINK_2>")) .put(URI.create(ExtensionNamespaces.SECURITY_GROUPS), URI.create("<LINK_1>")) .put(URI.create(ExtensionNamespaces.LBAAS_V1), URI.create("<LINK_0>")) .build(); }

Target:
public Multimap<URI, URI> aliases() { return ImmutableMultimap.<URI, URI>builder() .put(URI.create(ExtensionNamespaces.L3_ROUTER), URI.create("<LINK_2>")) .put(URI.create(ExtensionNamespaces.SECURITY_GROUPS), URI.create("<LINK_1>")) .put(URI.create(ExtensionNamespaces.LBAAS), URI.create("<LINK_0>")) .build(); }
Source:
public void init() { File elementsDataFile = new File(Compendium.Config.configPrefix + Compendium.Config.elementsDataJson); if (Config.useDefaultElements||!elementsDataFile.isFile()) { FileHelper.copyFromJar(ElementHandler.class, Compendium.Config.elementsDataJsonSource, Compendium.Config.elementsDataJson); } elementsDataFile = new File(Compendium.Config.configPrefix + Compendium.Config.elementsDataJson); if (elementsDataFile.isFile()) { LogHelper.debug("JSON file exists"); JsonReader jReader=null; try { jReader = new JsonReader(new InputStreamReader(new FileInputStream(elementsDataFile))); JsonParser parser = new JsonParser(); JsonObject elementsObject = parser.parse(jReader).getAsJsonObject(); int count = 1; LogHelper.debug("JSON Object:"); while (elementsObject.has(Integer.toString(count))) { JsonObject element = elementsObject.get(Integer.toString(count)).getAsJsonObject(); LogHelper.debug("Atomic Number: " + count); LogHelper.debug("Element name: " + element.get("longName")); LogHelper.debug("Element abbreviation: " + element.get("shortName")); count++; } } catch (Exception e) { throw new RuntimeException(e); } finally { if (jReader!=null) { try { jReader.close(); } catch (IOException e) { LogHelper.exception(e, Level.WARN); } } } } }

Target:
public void init() { if (Config.useDefaultElements){ InputStream stream=null; try{ stream=FileHelper.getInputStreamFromJar(ElementHandler.class, Compendium.Config.elementsDataJsonSource); readFromStream(stream); } finally { if (stream!=null){ try { stream.close(); } catch (IOException e) { LogHelper.exception("Cannot close stream!", e, Level.WARN); } } } } else { File elementsDataFile = new File(Compendium.Config.configPrefix + Compendium.Config.elementsDataJson); if (!elementsDataFile.isFile()) { FileHelper.copyFromJar(ElementHandler.class, Compendium.Config.elementsDataJsonSource, Compendium.Config.elementsDataJson); } elementsDataFile = new File(Compendium.Config.configPrefix + Compendium.Config.elementsDataJson); if (elementsDataFile.isFile()) { LogHelper.debug("JSON file exists"); InputStream stream=null; try { stream=new FileInputStream(elementsDataFile); readFromStream(stream); } catch (FileNotFoundException e) { throw new RuntimeException(e); } finally { if (stream!=null){ try { stream.close(); } catch (IOException e) { LogHelper.exception("Cannot close stream!", e, Level.WARN); } } } } } }
Source:
public void queryItemsWithContinuationTokenAndPageSize() throws Exception{ List<String> actualIds = new ArrayList<>(); CosmosItemProperties properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); String query = String.format("SELECT * from c where c.id in ('%s', '%s', '%s')", actualIds.get(0), actualIds.get(1), actualIds.get(2)); FeedOptions feedOptions = new FeedOptions(); String continuationToken = null; int pageSize = 1; int initialDocumentCount = 3; int finalDocumentCount = 0; CosmosContinuablePagedIterable<CosmosItemProperties> feedResponseIterator1 = container.queryItems(query, feedOptions, CosmosItemProperties.class); do { Iterable<FeedResponse<CosmosItemProperties>> feedResponseIterable = feedResponseIterator1.iterableByPage(continuationToken, pageSize); Iterator<FeedResponse<CosmosItemProperties>> feedResponse = feedResponseIterable.iterator(); for (; feedResponse.hasNext(); ) { FeedResponse<CosmosItemProperties> fr = feedResponse.next(); int resultSize = fr.getResults().size(); assertThat(resultSize).isEqualTo(pageSize); finalDocumentCount += fr.getResults().size(); continuationToken = fr.getContinuationToken(); } } while(continuationToken != null); assertThat(finalDocumentCount).isEqualTo(initialDocumentCount); }

Target:
public void queryItemsWithContinuationTokenAndPageSize() throws Exception{ List<String> actualIds = new ArrayList<>(); CosmosItemProperties properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); properties = getDocumentDefinition(UUID.randomUUID().toString()); container.createItem(properties); actualIds.add(properties.getId()); String query = String.format("SELECT * from c where c.id in ('%s', '%s', '%s')", actualIds.get(0), actualIds.get(1), actualIds.get(2)); FeedOptions feedOptions = new FeedOptions(); String continuationToken = null; int pageSize = 1; int initialDocumentCount = 3; int finalDocumentCount = 0; CosmosContinuablePagedIterable<CosmosItemProperties> feedResponseIterator1 = container.queryItems(query, feedOptions, CosmosItemProperties.class); do { Iterable<FeedResponse<CosmosItemProperties>> feedResponseIterable = feedResponseIterator1.iterableByPage(continuationToken, pageSize); for (FeedResponse<CosmosItemProperties> fr : feedResponseIterable) { int resultSize = fr.getResults().size(); assertThat(resultSize).isEqualTo(pageSize); finalDocumentCount += fr.getResults().size(); continuationToken = fr.getContinuationToken(); } } while(continuationToken != null); assertThat(finalDocumentCount).isEqualTo(initialDocumentCount); }
Source:
public void logOut(String wikiURL) { try { getUrl(wikiURL + URLsContent.logout); } catch (TimeoutException e) { PageObjectLogging.log("logOut", "page loads for more than 30 seconds", true); } wait.until(ExpectedConditions.visibilityOfElementLocated(By .cssSelector("a[data-id='login']"))); PageObjectLogging.log("logOut", "user is logged out", true, driver); }

Target:
public void logOut(String wikiURL) { try { getUrl(wikiURL + URLsContent.logout); } catch (TimeoutException e) { PageObjectLogging.log("logOut", "page loads for more than 30 seconds", true); } waitForElementByElement(loginButton); PageObjectLogging.log("logOut", "user is logged out", true, driver); }
Source:
private Class<?> getClassForType(final String typeName) { Assert.requireNonNull(typeName, "typeName"); Map<String, Class<?>> mapping = configuration.getTypeMapping(); if(mapping.containsKey(typeName)) { Class<?> cls = mapping.get(typeName); if(cls == null) { throw new IllegalStateException("null value specified for type " + typeName); } return cls; } try { return classLoader.loadClass(typeName); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Can not find class for type " + typeName, e); } }

Target:
private Class<?> getClassForType(final String typeName) { Assert.requireNonNull(typeName, "typeName"); final Map<String, Class<?>> mapping = configuration.getTypeMapping(); if(mapping.containsKey(typeName)) { final Class<?> cls = mapping.get(typeName); if(cls == null) { throw new IllegalStateException("null value specified for type " + typeName); } return cls; } try { return classLoader.loadClass(typeName); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException("Can not find class for type " + typeName, e); } }
Source:
public VdsDeploy(VDS vds) { _vds = vds; _messages = new InstallerMessages(_vds); _dialog = new EngineSSHDialog(); _parser = new MachineDialogParser(); _thread = new Thread( new Runnable() { @Override public void run() { _threadMain(); } }, "VdsDeploy" ); if (s_deployPackage == null) { String cacheDir = System.getenv("ENGINE_CACHE"); if (cacheDir == null) { log.warn("ENGINE_CACHE environment variable not found, using tmpdir instead."); cacheDir = System.getProperty("java.io.tmpdir"); } s_deployPackage = new CachedTar( new File( LocalConfig.getInstance().getCacheDir(), Config.<String> GetValue(ConfigValues.BootstrapPackageName) ), new File(Config.<String> GetValue(ConfigValues.BootstrapPackageDirectory)) ); } }

Target:
public VdsDeploy(VDS vds) { _vds = vds; _messages = new InstallerMessages(_vds); _dialog = new EngineSSHDialog(); _parser = new MachineDialogParser(); _thread = new Thread( new Runnable() { @Override public void run() { _threadMain(); } }, "VdsDeploy" ); if (s_deployPackage == null) { s_deployPackage = new CachedTar( new File( LocalConfig.getInstance().getCacheDir(), Config.<String> GetValue(ConfigValues.BootstrapPackageName) ), new File(Config.<String> GetValue(ConfigValues.BootstrapPackageDirectory)) ); } }
Source:
public Right register(RightDescription rightDescription) throws UnableToRegisterRightException { return register(rightDescription, Collections.singleton(Right.ADMIN)); }

Target:
public Right register(RightDescription rightDescription) throws UnableToRegisterRightException { return register(rightDescription, new HashSet<>(DEFAULT_IMPLIED_BY_RIGHTS)); }
Source:
private void newVM(UnitVmModel model) { Cluster cluster = model.getSelectedCluster(); BiosType vmBiosType = model.getBiosType().getSelectedItem(); if (cluster.getArchitecture().getFamily() != ArchitectureType.x86 || getEffectiveBiosType(vmBiosType, cluster).getChipsetType() == ChipsetType.I440FX) { saveNewVm(model); return; } Guid templateId = model.getTemplateWithVersion().getSelectedItem().getTemplateVersion().getId(); AsyncDataProvider.getInstance().isVmTemplateI440fx(new AsyncQuery<>(isI440fx -> { if (!isI440fx) { saveNewVm(model); } else { setCurrentVmModel(model); confirmQ35VmDeviceChanges(); } }), templateId); }

Target:
private void newVM(UnitVmModel model) { model.needsQ35VmDeviceChanges( () -> saveNewVm(model), () -> { setCurrentVmModel(model); confirmQ35VmDeviceChanges(); } ); }
Source:
public BinaryManagerStatus garbageCollectBinaries(boolean delete) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(BINARY_GC_TX_TIMEOUT_SEC); List<BinaryGarbageCollector> gcs = getGarbageCollectors(); long start = System.currentTimeMillis(); for (BinaryGarbageCollector gc : gcs) { gc.start(); } RepositoryService repositoryService = Framework.getService(RepositoryService.class); for (String repositoryName : repositoryService.getRepositoryNames()) { Repository repository = repositoryService.getRepository(repositoryName); repository.markReferencedBinaries(); } BinaryManagerStatus globalStatus = new BinaryManagerStatus(); for (BinaryGarbageCollector gc : gcs) { gc.stop(delete); BinaryManagerStatus status = gc.getStatus(); globalStatus.numBinaries += status.numBinaries; globalStatus.sizeBinaries += status.sizeBinaries; globalStatus.numBinariesGC += status.numBinariesGC; globalStatus.sizeBinariesGC += status.sizeBinariesGC; } globalStatus.gcDuration = System.currentTimeMillis() - start; TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); return globalStatus; }

Target:
public BinaryManagerStatus garbageCollectBinaries(boolean delete) { return runInTransaction(() -> { List<BinaryGarbageCollector> gcs = getGarbageCollectors(); long start = System.currentTimeMillis(); for (BinaryGarbageCollector gc : gcs) { gc.start(); } RepositoryService repositoryService = Framework.getService(RepositoryService.class); for (String repositoryName : repositoryService.getRepositoryNames()) { Repository repository = repositoryService.getRepository(repositoryName); repository.markReferencedBinaries(); } BinaryManagerStatus globalStatus = new BinaryManagerStatus(); for (BinaryGarbageCollector gc : gcs) { gc.stop(delete); BinaryManagerStatus status = gc.getStatus(); globalStatus.numBinaries += status.numBinaries; globalStatus.sizeBinaries += status.sizeBinaries; globalStatus.numBinariesGC += status.numBinariesGC; globalStatus.sizeBinariesGC += status.sizeBinariesGC; } globalStatus.gcDuration = System.currentTimeMillis() - start; return globalStatus; }, BINARY_GC_TX_TIMEOUT_SEC); }
Source:
public void testWindowsEndsOfLineWithLinuxSources() throws Exception { this.validateCheckstyle( "Bar.java", false, Matchers.containsString("LICENSE found") ); }

Target:
public void testWindowsEndsOfLineWithLinuxSources() throws Exception { this.validateCheckstyle( "WindowsEolLinux.java", false, Matchers.containsString("LICENSE found") ); }
Source:
public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { ReadAsync<SampleRowKeysRequest, SampleRowKeysResponse> readAsync = new ReadAsync<SampleRowKeysRequest, SampleRowKeysResponse>() { @Override public ListenableFuture<List<SampleRowKeysResponse>> readAsync(SampleRowKeysRequest request) { ClientCall<SampleRowKeysRequest, SampleRowKeysResponse> call = channel.newCall(BigtableServiceGrpc.METHOD_SAMPLE_ROW_KEYS, CallOptions.DEFAULT); CollectingStreamObserver<SampleRowKeysResponse> responseBuffer = new CollectingStreamObserver<>(call); ClientCalls.asyncServerStreamingCall( call, request, responseBuffer); return Futures.transform( responseBuffer.getResponseCompleteFuture(), IMMUTABLE_LIST_FUNCTION); }}; if (retryOptions.enableRetries()) { ReadFallback<SampleRowKeysRequest, SampleRowKeysResponse> readFallback = new ReadFallback<>(request, readAsync); return Futures.withFallback(readAsync.readAsync(request), readFallback); } return readAsync.readAsync(request); }

Target:
public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { return doReadAsync(request, sampleRowKeysAsync); }
Source:
public static boolean isValidOverWhiteListPatterns(String input, String... whiteListPatterns) { if (ArrayUtils.isEmpty(whiteListPatterns)) { throw new IllegalArgumentException("Should provide at least one white list pattern"); } boolean isValid = false; if (input != null) { for (String key : whiteListPatterns) { if (validatorConfig.getPattern(key) != null) { isValid = validatorConfig.getPattern(key).matcher(input).matches(); if (isValid) { break; } } } } return isValid; }

Target:
public static boolean isValidOverWhiteListPatterns(String input, String... whiteListPatterns) { if (ArrayUtils.isEmpty(whiteListPatterns)) { throw new IllegalArgumentException("Should provide at least one white list pattern"); } if (StringUtils.isEmpty(input)) { return true; } boolean isValid = false; for (String key : whiteListPatterns) { if (validatorConfig.getPattern(key) != null) { isValid = validatorConfig.getPattern(key).matcher(input).matches(); if (isValid) { break; } } } return isValid; }
Source:
private static void printQuery(PreparedStatement s, StringBuilder sb) throws SQLException { ResultSet set = null; try { set = s.executeQuery(); ResultSetMetaData metaData = set.getMetaData(); for (int i = 1; i <= metaData.getColumnCount(); i++) { if (i == 1) sb.append("||"); sb.append(metaData.getColumnName(i) + "||"); } sb.append("\n"); while (set.next()) { for (int i = 1; i <= metaData.getColumnCount(); i++) { if (i == 1) sb.append("|"); sb.append(set.getString(i) + "|"); } sb.append("\n"); } } finally { try { set.close(); } catch (Throwable ignore) { } try { s.close(); } catch (Throwable ignore) { } } }

Target:
private static void printQuery(PreparedStatement s, StringBuilder sb) throws SQLException { ResultSet set = null; try { set = s.executeQuery(); ResultSetMetaData metaData = set.getMetaData(); for (int i = 1; i <= metaData.getColumnCount(); i++) { if (i == 1) sb.append("||"); sb.append(metaData.getColumnName(i) + "||"); } sb.append("\n"); while (set.next()) { for (int i = 1; i <= metaData.getColumnCount(); i++) { if (i == 1) sb.append("|"); sb.append(set.getString(i) + "|"); } sb.append("\n"); } } finally { try { if (set != null) { set.close(); } } catch (Throwable ignore) { } try { if (s != null) { s.close(); } } catch (Throwable ignore) { } } }