auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldSaveAllergyWithNonCodedAllergen() throws Exception { Allergy allergy = Context.getPatientService().getAllergyByUuid(getUuid()); Patient patient = allergy.getPatient(); String json = "{\"allergen\": {\"allergenType\":\"DRUG\", \"nonCodedAllergen\": \"test non coded\", \"codedAllergen\": { \"uuid\": \"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"} }}"; handle(newPostRequest(getURI(), json)); Allergies allergies = Context.getPatientService().getAllergies(patient); Assert.assertEquals(allergies.size(), 5); }

Target:
public void shouldSaveAllergyWithNonCodedAllergen() throws Exception { Allergy allergy = Context.getPatientService().getAllergyByUuid(getUuid()); Patient patient = allergy.getPatient(); Allergies allergies = Context.getPatientService().getAllergies(patient); Assert.assertEquals(allergies.size(), 4); String json = "{" + " \"comment\" : \"allergy comment\"," + " \"severity\" : { \"uuid\" : \"35d3346a-6769-4d52-823f-b4b234bac3e3\"}," + " \"allergen\" : " + " { \"allergenType\" : \"DRUG\", " + " \"codedAllergen\" : { \"uuid\" : \"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}, " + " \"nonCodedAllergen\" : \"test non coded allergen\"} " + "}"; SimpleObject savedAllergy = deserialize(handle(newPostRequest(getURI(), json))); Assert.assertEquals("allergy comment", Util.getByPath(savedAllergy, "comment")); Assert.assertEquals("35d3346a-6769-4d52-823f-b4b234bac3e3", Util.getByPath(savedAllergy, "severity/uuid")); Assert.assertEquals("5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", Util.getByPath(savedAllergy, "allergen/codedAllergen/uuid")); Assert.assertEquals("test non coded allergen", Util.getByPath(savedAllergy, "allergen/nonCodedAllergen")); Assert.assertEquals("DRUG", Util.getByPath(savedAllergy, "allergen/allergenType")); allergies = Context.getPatientService().getAllergies(patient); Assert.assertEquals(allergies.size(), 5); }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Facility facility, Resource resource, User user, Member member) throws InternalErrorException, MemberResourceMismatchException { List<Attribute> attributes = new ArrayList<>(); for (Service service : services) { getRequiredAttributes(sess, service, facility, resource, user, member); } return attributes; }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Facility facility, Resource resource, User user, Member member) throws MemberResourceMismatchException { Set<Attribute> attributes = new HashSet<>(); for (Service service : services) { attributes.addAll(getRequiredAttributes(sess, service, facility, resource, user, member)); } return new ArrayList<>(attributes); }
Source:
public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall( MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) { int currentRequestNum = requestCount.getAndIncrement(); int index = Math.abs(currentRequestNum % channels.length); ClientCall<RequestT, ResponseT> delegate = channels[index].newCall(methodDescriptor, callOptions); return new CheckedForwardingClientCall<RequestT, ResponseT>(delegate) { @Override protected void checkedStart(ClientCall.Listener<ResponseT> responseListener, Metadata headers) throws Exception { for (HeaderInterceptor interceptor : headerInterceptors) { interceptor.udpateHeaders(headers); } delegate().start(responseListener, headers); } }; }

Target:
public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall( MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) { int currentRequestNum = requestCount.getAndIncrement(); int index = Math.abs(currentRequestNum % channels.length); ClientCall<RequestT, ResponseT> delegate = channels[index].newCall(methodDescriptor, callOptions); return new CheckedForwardingClientCall<RequestT, ResponseT>(delegate) { @Override protected void checkedStart(ClientCall.Listener<ResponseT> responseListener, Metadata headers) throws Exception { for (HeaderInterceptor interceptor : headerInterceptors) { interceptor.updateHeaders(headers); } delegate().start(responseListener, headers); } }; }
Source:
protected PushOperationResult publish(final IProject project, final IServer server, final IProgressMonitor monitor) throws CoreException { IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 200); try (Repository repo = EGitUtils.getRepository(project)) { boolean uncommittedChanges = EGitUtils.countChanges( repo, true, new NullProgressMonitor()) > 0; if (uncommittedChanges) { String remote = ExpressServerUtils.getRemoteName(server); String applicationName = ExpressServerUtils.getApplicationName(server); ExpressCoreUIIntegration.openCommitDialog(project, remote, applicationName, new PublishJob(applicationName, project, server)); } else { if (ExpressCoreUIIntegration.requestApproval( getPushQuestion(project, server, subMonitor), NLS.bind(ExpressServerMessages.publishTitle, project.getName()))) { return push(project, server, subMonitor); } } } catch (Exception e) { IStatus status = ExpressCoreActivator.statusFactory().errorStatus(e); ExpressCoreActivator.pluginLog().logStatus(status); throw new CoreException(status); } finally { subMonitor.done(); } return null; }

Target:
protected PushOperationResult publish(final IProject project, final IServer server, final IProgressMonitor monitor) throws CoreException { IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 200); try { boolean uncommittedChanges = EGitUtils.countChanges( EGitUtils.getRepository(project), true, new NullProgressMonitor()) > 0; if (uncommittedChanges) { String remote = ExpressServerUtils.getRemoteName(server); String applicationName = ExpressServerUtils.getApplicationName(server); ExpressCoreUIIntegration.openCommitDialog(project, remote, applicationName, new PublishJob(applicationName, project, server)); } else { if (ExpressCoreUIIntegration.requestApproval( getPushQuestion(project, server, subMonitor), NLS.bind(ExpressServerMessages.publishTitle, project.getName()))) { return push(project, server, subMonitor); } } } catch (Exception e) { IStatus status = ExpressCoreActivator.statusFactory().errorStatus(e); ExpressCoreActivator.pluginLog().logStatus(status); throw new CoreException(status); } finally { subMonitor.done(); } return null; }
Source:
public String getPackageText(DetailAST ast) { final DetailAST nameAST = ast.getLastChild().getPreviousSibling(); return FullIdent.createFullIdent(nameAST).getText(); }

Target:
private static String getPackageText(DetailAST ast) { final DetailAST nameAST = ast.getLastChild().getPreviousSibling(); return FullIdent.createFullIdent(nameAST).getText(); }
Source:
public <T extends DataHolder.Immutable<T>, B extends DataHolderBuilder.Immutable<T, B>> void register(Class<T> holderClass, B builder) { if (!this.immutableDataBuilderMap.containsKey(Preconditions.checkNotNull(holderClass))) { this.immutableDataBuilderMap.put(holderClass, Preconditions.checkNotNull(builder)); } else { throw new IllegalStateException("Already registered the DataUtil for " + holderClass.getCanonicalName()); } }

Target:
public <T extends DataHolder.Immutable<T>, B extends DataHolderBuilder.Immutable<T, B>> void register(Class<T> holderClass, B builder) { final DataHolderBuilder.Immutable<?, ?> previous = this.immutableDataBuilderMap.putIfAbsent(Preconditions.checkNotNull(holderClass), Preconditions.checkNotNull(builder)); if (previous != null) { throw new IllegalStateException("Already registered the DataUtil for " + holderClass.getCanonicalName()); } }
Source:
private static String toStoreKey(SystemStreamPartition ssp, TaskName taskName) { return new StartpointKey(ssp, taskName).toString(); }

Target:
private static String toStoreKey(SystemStreamPartition ssp, TaskName taskName) { return new String(new JsonSerdeV2<>().toBytes(new StartpointKey(ssp, taskName))); }
Source:
private Account findAccount(String hrefOrEmailOrUsername){ Account account = null; String[] splitHrefOrEmailOrName = hrefOrEmailOrUsername.split("/"); Directory directory = this.getDirectory(); if (splitHrefOrEmailOrName.length > 4) { try { account = getDataStore().getResource(hrefOrEmailOrUsername, Account.class); if (account != null && account.getDirectory().getHref().equalsIgnoreCase(directory.getHref())){ return account; } } catch (ResourceException e) { } } AccountList accounts = directory.getAccounts(Accounts.where(Accounts.username().eqIgnoreCase(hrefOrEmailOrUsername))); if (accounts.iterator().hasNext()){ account = accounts.iterator().next(); } else { accounts = directory.getAccounts(Accounts.where(Accounts.email().eqIgnoreCase(hrefOrEmailOrUsername))); if (accounts.iterator().hasNext()){ account = accounts.iterator().next(); } } return account; }

Target:
private Account findAccount(String hrefOrEmailOrUsername){ Account account = null; String[] splitHrefOrEmailOrName = hrefOrEmailOrUsername.split("/"); Directory directory = this.getDirectory(); if (splitHrefOrEmailOrName.length > 4) { try { account = getDataStore().getResource(hrefOrEmailOrUsername, Account.class); if (account != null && account.getDirectory().getHref().equals(directory.getHref())){ return account; } } catch (ResourceException e) { } } AccountList accounts = directory.getAccounts(Accounts.where(Accounts.username().eqIgnoreCase(hrefOrEmailOrUsername))); if (accounts.iterator().hasNext()){ account = accounts.iterator().next(); } else { accounts = directory.getAccounts(Accounts.where(Accounts.email().eqIgnoreCase(hrefOrEmailOrUsername))); if (accounts.iterator().hasNext()){ account = accounts.iterator().next(); } } return account; }
Source:
private void addQueryParams(final Request request) { if (log != null) { request.addQueryParam("Log", log.toString()); } if (startMessageDate != null || endMessageDate != null) { request.addQueryDateRange("MessageDate", startMessageDate, endMessageDate); } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }

Target:
private void addQueryParams(final Request request) { if (log != null) { request.addQueryParam("Log", log.toString()); } if (messageDate != null) { request.addQueryParam("MessageDate", messageDate.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_FORMAT))); } else if (messageDateAfter != null || messageDateBefore != null) { request.addQueryDateRange("MessageDate", messageDateAfter, messageDateBefore); } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }
Source:
public void throwsOnNonBitChars() { db.getHandle().useTransaction(handle -> { handle.execute("drop table if exists videos"); handle.execute("create table videos (id int primary key, supported_platforms varchar)"); int id = 1; String notBit = "2"; handle.createUpdate("insert into videos(id, supported_platforms) values (:id, :notBits)") .bind("id", id) .bind("notBits", "0101" + notBit) .execute(); assertThatThrownBy(() -> handle.attach(VideoDao.class).getSupportedPlatforms(id)) .hasMessageContaining("non-bit character " + notBit); }); }

Target:
public void throwsOnNonBitChars() { Handle handle = db.getHandle(); handle.execute("drop table if exists videos"); handle.execute("create table videos (id int primary key, supported_platforms varchar)"); handle.execute("discard all"); handle.useTransaction(h -> { int id = 1; String notBit = "2"; h.createUpdate("insert into videos(id, supported_platforms) values (:id, :notBits)") .bind("id", id) .bind("notBits", "0101" + notBit) .execute(); assertThatThrownBy(() -> h.attach(VideoDao.class).getSupportedPlatforms(id)) .hasMessageContaining("non-bit character " + notBit); }); }
Source:
<T> int needToCreate(T byName, T byPort, String name) { if (byName != null && byPort != null) { if (byName == byPort) { return 0; } else { return -1; } } else if (byPort != null) { if (name == null) { return 0; } else { return -1; } } else { return 1; } }

Target:
<T> CreationState needToCreate(T byName, T byPort, String name) { if (byName != null && byPort != null) { if (byName == byPort) { return CreationState.Found; } else { return CreationState.InvalidState; } } else if (byPort != null) { if (name == null) { return CreationState.Found; } else { return CreationState.InvalidState; } } else { return CreationState.NeedToCreate; } }
Source:
public int doProcessing(Context context, HttpServletRequest request, HttpServletResponse response, SubmissionInfo subInfo) throws ServletException, IOException, SQLException, AuthorizeException { log.info(LogManager.getHeader(context, "submission_complete", "Completed submission with id=" + subInfo.getSubmissionItem().getID())); WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService(); boolean success = false; try { if(StringUtils.equals(configurationService.getProperty("workflow.framework"), "xmlworkflow")) { try{ workflowService.start(context, (WorkspaceItem) subInfo.getSubmissionItem()); }catch (Exception e){ log.error(LogManager.getHeader(context, "Error while starting xml workflow", "Item id: " + subInfo.getSubmissionItem().getItem().getID()), e); throw new ServletException(e); } }else{ workflowService.start(context, (WorkspaceItem) subInfo.getSubmissionItem()); } success = true; } catch (Exception e) { log.error("Caught exception in submission step: ",e); throw new ServletException(e); } finally { if (success) { context.dispatchEvents(); } } return STATUS_COMPLETE; }

Target:
public int doProcessing(Context context, HttpServletRequest request, HttpServletResponse response, SubmissionInfo subInfo) throws ServletException, IOException, SQLException, AuthorizeException { log.info(LogManager.getHeader(context, "submission_complete", "Completed submission with id=" + subInfo.getSubmissionItem().getID())); WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService(); boolean success = false; try { workflowService.start(context, (WorkspaceItem) subInfo.getSubmissionItem()); success = true; } catch (Exception e) { log.error("Caught exception in submission step: ",e); throw new ServletException(e); } finally { if (success) { context.dispatchEvents(); } } return STATUS_COMPLETE; }
Source:
private static void setFeatures(DocumentBuilderFactory dbf) throws ParserConfigurationException { String externalEntitiesValue = System.getProperty(EXTERNAL_ENTITIES_PROPERTY, "false"); externalEntities = Boolean.parseBoolean(externalEntitiesValue); String expandEntitiesValue = System.getProperty(EXPAND_ENTITIES_PROPERTY, "false"); expandEntities = Boolean.parseBoolean(expandEntitiesValue); String feature = null; feature = "<LINK_1>"; dbf.setFeature(feature, externalEntities); feature = "<LINK_2>"; dbf.setFeature(feature, externalEntities); feature = "<LINK_0>"; dbf.setFeature(feature, !expandEntities); dbf.setXIncludeAware(expandEntities); dbf.setExpandEntityReferences(expandEntities); dbf.setNamespaceAware(true); }

Target:
private void setFeatures(DocumentBuilderFactory dbf) throws ParserConfigurationException { String feature = null; feature = "<LINK_1>"; dbf.setFeature(feature, externalEntities); feature = "<LINK_2>"; dbf.setFeature(feature, externalEntities); feature = "<LINK_0>"; dbf.setFeature(feature, !expandEntities); dbf.setXIncludeAware(expandEntities); dbf.setExpandEntityReferences(expandEntities); dbf.setNamespaceAware(true); }
Source:
private void addAndTrack(final VariantContext toAdd, final VariantContext source) { trackLiftedVariantContig(liftedBySourceContig, source.getContig()); trackLiftedVariantContig(liftedByDestContig, toAdd.getContig()); if (sorter != null) { sorter.add(toAdd); } else { this.accept.add(toAdd); } }

Target:
private void addAndTrack(final VariantContext toAdd, final VariantContext source) { trackLiftedVariantContig(liftedBySourceContig, source.getContig()); trackLiftedVariantContig(liftedByDestContig, toAdd.getContig()); if (!DISABLE_SORT) { sorter.add(toAdd); } else { this.acceptedRecords.add(toAdd); } }
Source:
public void testPojoToJsonPrettyPrint() { String json = "{\n \"foo\" : \"bar\"\n}"; CompositeMessageConverter converter = converterFactory.newInstance(MimeTypeUtils.APPLICATION_JSON); for (MessageConverter messageConverter : converter.getConverters()) { if (messageConverter instanceof PojoToJsonMessageConverter) { ((PojoToJsonMessageConverter) messageConverter).setPrettyPrint(true); } else if (messageConverter instanceof TupleToJsonMessageConverter) { ((TupleToJsonMessageConverter) messageConverter).setPrettyPrint(true); } } Message<?> msg = (Message<?>) converter.fromMessage(new GenericMessage<Foo>(new Foo()), String.class); assertEquals(json, msg.getPayload()); assertEquals(MimeTypeUtils.APPLICATION_JSON, msg.getHeaders().get(MessageHeaders.CONTENT_TYPE)); }

Target:
public void testPojoToJsonPrettyPrint() { String json = "{\n \"foo\" : \"bar\"\n}"; PojoToJsonMessageConverter messageConverter = new PojoToJsonMessageConverter(); messageConverter.setPrettyPrint(true); Message<?> msg = (Message<?>) messageConverter.fromMessage(new GenericMessage<Foo>(new Foo()), String.class); assertEquals(json, msg.getPayload()); assertEquals(MimeTypeUtils.APPLICATION_JSON, msg.getHeaders().get(MessageHeaders.CONTENT_TYPE)); }
Source:
private void loadPaletteGroups() { paletteGroupMap = new HashMap<String,IPaletteGroup>(); paletteGroups = new ArrayList<IPaletteGroup>(); IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID); if(point != null){ HashMap<String, String> positions = new HashMap<String, String>(); for (IConfigurationElement element : point.getConfigurationElements()) { IPaletteGroup paletteGroup = createPaletteGroupInstance(element); if(paletteGroup != null){ paletteGroup.setPaletteModel(this); String version = getSelectedVersion(paletteGroup); paletteGroup.setSelectedVersion(version); paletteGroupMap.put(paletteGroup.getName(), paletteGroup); paletteGroups.add(paletteGroup); String position = element.getAttribute("position"); if(position != null){ positions.put(paletteGroup.getName(), position); } } } for(String groupName : positions.keySet()){ String position = positions.get(groupName); IPaletteGroup group = paletteGroupMap.get(groupName); if(POSITION_TOP.equals(position)){ paletteGroups.remove(group); paletteGroups.add(0, group); }else if(POSITION_BOTTOM.equals(position)){ paletteGroups.remove(group); paletteGroups.add(group); } } } }

Target:
private ArrayList<IPaletteGroup> loadPaletteGroups() { TreeMap<String,IPaletteGroup> groupsByOrderId = new TreeMap<String,IPaletteGroup>(); paletteGroupMap = new HashMap<String, IPaletteGroup>(); IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID); for (IConfigurationElement element : point.getConfigurationElements()) { IPaletteGroup paletteGroup = createPaletteGroupInstance(element); if(paletteGroup != null){ paletteGroup.setPaletteModel(this); IHTMLLibraryVersion version = getSelectedVersion(paletteGroup); paletteGroup.setSelectedVersion(version); paletteGroupMap.put(paletteGroup.getName(), paletteGroup); String orderId = element.getAttribute("orderId"); if(orderId == null){ orderId = paletteGroup.getName(); } groupsByOrderId.put(orderId, paletteGroup); } } return new ArrayList<IPaletteGroup>(groupsByOrderId.values()); }
Source:
public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = null; try { String query = "SELECT c.* FROM collection c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.collection_id and m.resource_type_id = ? and m.metadata_field_id = ?) "; if("oracle".equals(ConfigurationManager.getProperty("db.name"))){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query(context, query, Constants.COLLECTION, MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID() ); } catch (SQLException e) { log.error("Find all Collections - ",e); throw e; } List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; }

Target:
public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = null; try { String query = "SELECT c.* FROM collection c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.collection_id and m.resource_type_id = ? and m.metadata_field_id = ?) "; if(DatabaseManager.isOracle()){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query(context, query, Constants.COLLECTION, MetadataField.findByElement(context, MetadataSchema.find(context, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID() ); } catch (SQLException e) { log.error("Find all Collections - ",e); throw e; } List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; }
Source:
public void testSimpleAnnounce() throws IOException { IndexerSQLMetadataStorageCoordinator coordinator = new IndexerSQLMetadataStorageCoordinator( mapper, tablesConfig, derbyConnector ); coordinator.announceHistoricalSegments(segments); Assert.assertArrayEquals( mapper.writeValueAsString(defaultSegment).getBytes("UTF-8"), derbyConnector.lookup( tablesConfig.getSegmentsTable(), "id", "payload", defaultSegment.getIdentifier() ) ); }

Target:
public void testSimpleAnnounce() throws IOException { coordinator.announceHistoricalSegments(segments); Assert.assertArrayEquals( mapper.writeValueAsString(defaultSegment).getBytes("UTF-8"), derbyConnector.lookup( tablesConfig.getSegmentsTable(), "id", "payload", defaultSegment.getIdentifier() ) ); }
Source:
public void actionPerformed(ActionEvent e) { DbxState dbxState = etc.getDbxState(); if(Cloud.getInstance().getStatus() != Cloud.Status.DBX_CONNECTED || dbxState == null) { JOptionPane.showMessageDialog(null, "No Dropbox file has been loaded.\n" + "You must open Dropbox file, before you save it.", "Cannot save progress", JOptionPane.WARNING_MESSAGE); return; } String[] periodOptions = {"Disable", "1", "3", "5", "10"}; syncPeriod = (String) JOptionPane.showInputDialog( null, "Select the auto sync period (in min)", "Period of Dropbox Remote Sync", JOptionPane.QUESTION_MESSAGE, null, periodOptions, periodOptions[0] ); LOGGER.log("You set your interval of Dropbox auto sync as: " + syncPeriod); if(syncPeriod == null) { return; } if(!syncPeriod.startsWith("Disable")) { if(autoSyncThread == null) { autoSyncThread = new DbxAutoSync(Integer.valueOf(syncPeriod)); autoSyncThread.start(); } else { autoSyncThread.setInterval(Integer.valueOf(syncPeriod)); } } else { if(autoSyncThread != null){ autoSyncThread.setInterval(0); autoSyncThread.interrupt(); autoSyncThread = null; } } }

Target:
public void actionPerformed(ActionEvent e) { DbxState dbxState = etc.getEditorState().getDbxState(); if(Cloud.getInstance().getStatus() != Cloud.Status.DBX_CONNECTED || dbxState == null) { JOptionPane.showMessageDialog(null, "No Dropbox file has been loaded.\n" + "You must open Dropbox file, before you save it.", "Cannot save progress", JOptionPane.WARNING_MESSAGE); return; } String[] periodOptions = {"Disable", "1 minute", "3 minutes", "5 minutes", "10 minutes"}; syncPeriod = (String) JOptionPane.showInputDialog( null, "Select the auto sync period (in min)", "Period of Dropbox Remote Sync", JOptionPane.QUESTION_MESSAGE, null, periodOptions, periodOptions[0] ); LOGGER.log("You set your interval of Dropbox auto sync as: " + syncPeriod); if(syncPeriod == null) { return; } if(!syncPeriod.startsWith("Disable")) { syncPeriod = syncPeriod.substring(0, syncPeriod.indexOf(" ")); if(autoSyncThread == null) { dbxAutoSyncObj = new DbxAutoSync(Integer.valueOf(syncPeriod)); autoSyncThread = new Thread(dbxAutoSyncObj); autoSyncThread.start(); } else { dbxAutoSyncObj.setInterval(Integer.valueOf(syncPeriod)); } } else { if(autoSyncThread != null){ dbxAutoSyncObj.setInterval(0); autoSyncThread.interrupt(); autoSyncThread = null; } } }
Source:
public CurveParameterMetadata metadata(LocalDate valuationDate) { Tenor startTenor = Tenor.of(template.getPeriodToStart()); return TenorCurveNodeMetadata.of(valuationDate.plus(startTenor), startTenor); }

Target:
public CurveParameterMetadata metadata(LocalDate valuationDate) { Tenor endTenor = Tenor.of(template.getPeriodToEnd()); return TenorCurveNodeMetadata.of(valuationDate.plus(endTenor), endTenor); }
Source:
public String displayString(final IdentifierPolicy policy) { return StringUtils.join(names, ".", new Function<Identifier, String>() { @Override public String apply(@Nullable Identifier identifier) { return identifier.displayString(policy); } }); }

Target:
public String displayString(final IdentifierPolicy policy) { return StringUtils.join(names, policy.getIdentifierSeperator(), new Function<Identifier, String>() { @Override public String apply(@Nullable Identifier identifier) { return identifier.displayString(policy); } }); }
Source:
protected void executeCommand() { final T bckndCmdParams = getParameters(); final SetupNetworksVdsCommandParameters vdsCmdParams = new SetupNetworksVdsCommandParameters( getVdsId(), bckndCmdParams.getNetworks(), bckndCmdParams.getRemovedNetworks(), bckndCmdParams.getBonds(), bckndCmdParams.getRemovedBonds(), bckndCmdParams.getInterfaces()); vdsCmdParams.setForce(bckndCmdParams.isForce()); vdsCmdParams.setCheckConnectivity(bckndCmdParams.isCheckConnectivity()); vdsCmdParams.setConectivityTimeout(bckndCmdParams.getConectivityTimeout()); FutureVDSCall<VDSReturnValue> setupNetworksTask = createFutureTask(vdsCmdParams); if (bckndCmdParams.isCheckConnectivity()) { pollInterruptively(setupNetworksTask); } long timeout = bckndCmdParams.getConectivityTimeout() > 0 ? bckndCmdParams.getConectivityTimeout() : Config.<Integer> GetValue(ConfigValues.vdsTimeout); try { VDSReturnValue retVal = setupNetworksTask.get(timeout, TimeUnit.SECONDS); if (retVal != null && retVal.getSucceeded()) { setSucceeded(TransactionSupport.executeInNewTransaction(updateVdsNetworksInTx(bckndCmdParams))); } } catch (TimeoutException e) { log.debug("Setup networks command timed out for " + timeout + " seconds"); } }

Target:
protected void executeCommand() { final T bckndCmdParams = getParameters(); final SetupNetworksVdsCommandParameters vdsCmdParams = new SetupNetworksVdsCommandParameters( getVdsId(), bckndCmdParams.getNetworks(), bckndCmdParams.getRemovedNetworks(), bckndCmdParams.getBonds(), bckndCmdParams.getRemovedBonds(), bckndCmdParams.getInterfaces()); vdsCmdParams.setForce(bckndCmdParams.isForce()); vdsCmdParams.setCheckConnectivity(bckndCmdParams.isCheckConnectivity()); vdsCmdParams.setConectivityTimeout(bckndCmdParams.getConectivityTimeout()); FutureVDSCall<VDSReturnValue> setupNetworksTask = createFutureTask(vdsCmdParams); if (bckndCmdParams.isCheckConnectivity()) { pollInterruptively(setupNetworksTask); } long timeout = bckndCmdParams.getConectivityTimeout() > 0 ? bckndCmdParams.getConectivityTimeout() : Config.<Integer> GetValue(ConfigValues.vdsTimeout); try { VDSReturnValue retVal = setupNetworksTask.get(timeout, TimeUnit.SECONDS); if (retVal != null && retVal.getSucceeded()) { setSucceeded(TransactionSupport.executeInNewTransaction(updateVdsNetworksInTx(bckndCmdParams))); } } catch (TimeoutException e) { log.debugFormat("Setup networks command timed out for {0} seconds", timeout); } }
Source:
public Object getPropertyValue(Object id) { if (PROPERTY_NAME_ID.equals(id)) { if (tag != null) { return tag.getTagName(); } return ref.getName().substring(Constants.R_TAGS.length()); } if (PROPERTY_MESSAGE_ID.equals(id)) { if (tag != null) { return tag.getShortMessage(); } return UIText.TagPropertySource_TagPropertyNoMessage; } return null; }

Target:
public Object getPropertyValue(Object id) { if (PROPERTY_TAG_NAME_ID.equals(id)) { if (tag != null) { return tag.getTagName(); } return ref.getName().substring(Constants.R_TAGS.length()); } else if (PROPERTY_TAG_MESSAGE_ID.equals(id)) { if (tag != null) { return tag.getShortMessage(); } return UIText.TagPropertySource_TagPropertyNoMessage; } else if (PROPERTY_COMMIT_MESSAGE_ID.equals(id)) { if (commit != null) { return commit.getShortMessage(); } return ""; } else if (PROPERTY_COMMIT_ID_ID.equals(id)) { if (commit != null) { return commit.getId().name(); } return ""; } return null; }
Source:
public void testThrottleWithRandomDropping() throws InterruptedException { int maxTokens = 10; BlueThrottle throttler = new BlueThrottle(); throttler.setMaxTokens(maxTokens); throttler.setFillCount(maxTokens); throttler.setFillTime(1000); throttler.setFreezeTime(100); throttler.setDropIncrease(0.5); for (int i=0;i<maxTokens;i++) throttler.checkLimit(1); Assert.assertEquals("All tokens should be used up by now", throttler.getMaxTokens(), throttler.getDeficit()); Thread.sleep(110); throttler.checkLimit(1); Assert.assertTrue("Dropping probability should be increased", throttler.getDropChance()>0); LOG.info("Dropping probability is {}", throttler.getDropChance()); Thread.sleep(1500); LOG.info("Bucket is refilled with tokens.", maxTokens); int accepted = 0; for (int i=0;i<maxTokens;i++) { if (throttler.checkLimit(1)) { accepted ++; } } LOG.info("Send requests, are accepted", maxTokens, accepted); Assert.assertTrue("The dropping should be distributed", accepted<maxTokens); accepted = 0; for (int i=0;i<maxTokens;i++) { if (throttler.checkLimit(1)) { accepted ++; } } LOG.info("Send another requests, are accepted", maxTokens, accepted); Assert.assertTrue("Later requests should have a chance", accepted > 0); }

Target:
public void testThrottleWithRandomDropping() throws InterruptedException { int maxTokens = 5; BlueThrottle throttler = new BlueThrottleWithMockRandom(new MockRandom()); throttler.setMaxTokens(maxTokens); throttler.setFillCount(maxTokens); throttler.setFillTime(1000); throttler.setFreezeTime(100); throttler.setDropIncrease(0.5); for (int i=0;i<maxTokens;i++) throttler.checkLimit(1); Assert.assertEquals("All tokens should be used up by now", throttler.getMaxTokens(), throttler.getDeficit()); Thread.sleep(120); throttler.checkLimit(1); Assert.assertTrue("Dropping probability should be increased", throttler.getDropChance()>0); LOG.info("Dropping probability is {}", throttler.getDropChance()); Thread.sleep(1100); LOG.info("Bucket is refilled with tokens.", maxTokens); int accepted = 0; for (int i=0;i<maxTokens;i++) { if (throttler.checkLimit(1)) { accepted ++; } } LOG.info("Send requests, are accepted", maxTokens, accepted); Assert.assertTrue("The dropping should be distributed", accepted<maxTokens); accepted = 0; for (int i=0;i<maxTokens;i++) { if (throttler.checkLimit(1)) { accepted ++; } } LOG.info("Send another requests, are accepted", maxTokens, accepted); Assert.assertTrue("Later requests should have a chance", accepted > 0); }
Source:
public MecanumChassis(String name, Motor frontLeftWheel, Motor frontRightWheel, Motor backLeftWheel, Motor backRightWheel) { super(frontLeftWheel, frontRightWheel, backLeftWheel, backRightWheel); }

Target:
public MecanumChassis(String name, Motor frontLeftWheel, Motor frontRightWheel, Motor backLeftWheel, Motor backRightWheel) { super(name, frontLeftWheel, frontRightWheel, backLeftWheel, backRightWheel); }
Source:
public static void openExtendedNotificationsPanel(UiDevice device) throws UiObjectNotFoundException { new NetworkUtilPopupWatcher(device).checkForCondition(); device.openNotification(); new NetworkUtilPopupWatcher(device).checkForCondition(); UiObject expandIndicator = device.findObject(new UiSelector().resourceId(Res.NOTIFICATION_BAR_EXPAND_RES)); if (expandIndicator.waitForExists(5L)) { expandIndicator.clickAndWaitForNewWindow(); } else { Log.d(TAG, "tray expander icon not found"); } UiObject notificationHeader = device.findObject(new UiSelector().resourceId(Res.NOTIFICATION_BAR_HEADER_RES)); if (notificationHeader.waitForExists(5L)) { notificationHeader.click(); notificationHeader.swipeDown(3); } else { Log.d(TAG, "notification bar header not found"); } openNotificationQuickPanel(device); }

Target:
private static void openExtendedNotificationsPanel(UiDevice device) throws UiObjectNotFoundException { new NetworkUtilPopupWatcher(device).checkForCondition(); device.openNotification(); new NetworkUtilPopupWatcher(device).checkForCondition(); UiObject expandIndicator = device.findObject(new UiSelector().resourceId(Res.NOTIFICATION_BAR_EXPAND_RES)); if (expandIndicator.waitForExists(5L)) { expandIndicator.clickAndWaitForNewWindow(); } else { Log.d(TAG, "tray expander icon not found"); } UiObject notificationHeader = device.findObject(new UiSelector().resourceId(Res.NOTIFICATION_BAR_HEADER_RES)); if (notificationHeader.waitForExists(5L)) { notificationHeader.click(); notificationHeader.swipeDown(3); } else { Log.d(TAG, "notification bar header not found"); } openNotificationQuickPanel(device); }
Source:
protected void initialize() { goalInitial = editedCommand.getGoal(); view.setAvailableGoals(goalRegistry.getAllGoals()); view.setGoal(goalInitial); }

Target:
protected void initialize() { initialGoal = editedCommand.getGoal(); view.setAvailableGoals(goalRegistry.getAllGoals()); view.setGoal(initialGoal); }
Source:
public static boolean validate(String userVarValue) { List<String> validUserVars = new ArrayList<String>(); validUserVars.add(_PREFIX_USER_VAR + UserField.Id.field + _SURFIX_USER_VAR); validUserVars.add(_PREFIX_USER_VAR + UserField.First_Name.field + _SURFIX_USER_VAR); validUserVars.add(_PREFIX_USER_VAR + UserField.Last_Name.field + _SURFIX_USER_VAR); validUserVars.add(_PREFIX_USER_VAR + UserField.User_Name.field + _SURFIX_USER_VAR); validUserVars.add(_PREFIX_USER_VAR + UserField.Language.field + _SURFIX_USER_VAR); boolean result = true; if (userVarValue.startsWith(_PREFIX_USER_VAR) && userVarValue.endsWith(_SURFIX_USER_VAR)) { if (!validUserVars.contains(userVarValue)) { String propertyFieldHead = _PREFIX_USER_VAR + UserField.Properties.field + "[\""; String propertyFieldTail = "\"]" + _SURFIX_USER_VAR; if (!(userVarValue.startsWith(propertyFieldHead) && userVarValue.endsWith(propertyFieldTail))) { result = false; } } } return result; }

Target:
public static boolean validate(String userVarValue) { boolean isUserVarPattern = userVarValue.startsWith(_PREFIX_USER_VAR) && userVarValue.endsWith(_SUFFIX_USER_VAR); if (isUserVarPattern) { String propertyFieldHead = _PREFIX_USER_VAR + UserField.Properties.field + "[\""; String propertyFieldTail = "\"]" + _SUFFIX_USER_VAR; boolean propPattern = userVarValue.startsWith(propertyFieldHead) && userVarValue.endsWith(propertyFieldTail) && userVarValue.length() > propertyFieldHead.length() + propertyFieldTail.length(); if (!validUserVars.contains(userVarValue) && !propPattern) { return false; } } return true; }
Source:
public @ResponseBody ResponseEntity<Object> importXML(@RequestParam("file") MultipartFile xmlFile) { String username = GroupsThreadStore.getUsername(); log.info("User has submitted a bulk metadata update package", username); Map<String, Object> result = new HashMap<>(); result.put("action", "import xml"); result.put("username", username); String userEmail = GroupsThreadStore.getEmail(); try (InputStream importStream = xmlFile.getInputStream()) { service.pushJobToQueue(result, importStream, username, userEmail); } catch (IOException e) { log.error("Error creating or writing to import file: {}", e); result.put("error", e.getMessage()); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } catch (IllegalArgumentException e) { log.error("Error queueing the job: {}", e); result.put("error", e.getMessage()); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } result.put("message", "Import of metadata has begun. " + userEmail + " will be emailed when the update completes"); result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }

Target:
public @ResponseBody ResponseEntity<Object> importXML(@RequestParam("file") MultipartFile xmlFile) { AgentPrincipals agent = AgentPrincipals.createFromThread(); String userEmail = GroupsThreadStore.getEmail(); log.info("User with email has submitted a bulk metadata update package", userEmail); Map<String, Object> result = new HashMap<>(); result.put("action", "import xml"); result.put("username", agent.getUsername()); result.put("user email", userEmail); try (InputStream importStream = xmlFile.getInputStream()) { service.pushJobToQueue(result, importStream, agent, userEmail); } catch (IOException e) { log.error("Error creating or writing to import file: {}", e); result.put("error", e.getMessage()); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } catch (IllegalArgumentException e) { log.error("Error queueing the job: {}", e); result.put("error", e.getMessage()); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } result.put("message", "Import of metadata has begun. " + userEmail + " will be emailed when the update completes"); result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }
Source:
public String getStudyHost(String studyOid) throws Exception { String pManageUrl = CoreResources.getField("portalURL"); String ocUrl = CoreResources.getField("sysURL.base") + "rest2/openrosa/" + studyOid; URL eURL = new URL(pManageUrl + "/app/rest/oc/authorizations" + "?studyoid=" + studyOid + "&instanceurl=" + ocUrl); HttpURLConnection con = null; DataInputStream input = null; String response = null; try { con = (HttpURLConnection)eURL.openConnection(); con.setConnectTimeout(5000); con.setReadTimeout(5000); con.setRequestMethod("GET"); input = new DataInputStream( con.getInputStream()); response = IOUtils.toString(input, "UTF-8"); } catch (Exception e) { logger.error(e.getMessage()); logger.error(ExceptionUtils.getStackTrace(e)); } finally{ } if (response.isEmpty()) return ""; JSONObject json = JSONObject.fromObject(response); if (json.isEmpty()) return ""; JSONObject studyHost = json.getJSONObject("study"); String[] arrayUrl = pManageUrl.split(":"); String tmpProtocol = arrayUrl[0]; String tmpUrl = arrayUrl[1]; String tmpPort = arrayUrl[2]; tmpUrl = tmpUrl.substring(2); String[] tmpArr = tmpUrl.split("\\."); String[] tmpMore = new String[tmpArr.length + 1]; if (tmpArr.length > 2) { tmpArr[0] = studyHost.getString("host"); } else { tmpMore[0] = studyHost.getString("host"); System.arraycopy(tmpArr, 0, tmpMore, 1, tmpArr.length); tmpArr = tmpMore; } StringBuffer urlBuilder = new StringBuffer(); for (int i = 0; i < tmpArr.length; i++) { urlBuilder.append(tmpArr[i]); if (i != tmpArr.length - 1) { urlBuilder.append("."); } else { urlBuilder.append(":" + tmpPort); } } if (!studyHost.isNullObject()) return "http://"+urlBuilder.toString()+ "/#/login"; else return ""; }

Target:
public String getStudyHost(String studyOid) throws Exception { String pManageUrl = CoreResources.getField("portalURL"); String ocUrl = CoreResources.getField("sysURL.base") + "rest2/openrosa/" + studyOid; URL eURL = new URL(pManageUrl + "/app/rest/oc/authorizations" + "?studyoid=" + studyOid + "&instanceurl=" + ocUrl); HttpURLConnection con = null; DataInputStream input = null; String response = null; try { con = (HttpURLConnection)eURL.openConnection(); con.setConnectTimeout(5000); con.setReadTimeout(5000); con.setRequestMethod("GET"); input = new DataInputStream( con.getInputStream()); response = IOUtils.toString(input, "UTF-8"); } catch (Exception e) { logger.error(e.getMessage()); logger.error(ExceptionUtils.getStackTrace(e)); } finally{ } if (response.isEmpty()) return ""; JSONObject json = JSONObject.fromObject(response); if (json.isEmpty()) return ""; JSONObject studyHost = json.getJSONObject("study"); StringBuffer urlBuilder = buildUrl(pManageUrl, studyHost); if (!studyHost.isNullObject()) return "http://" + urlBuilder.toString() + "/#/login"; else return ""; }
Source:
private void analyzeDescDatabase(ASTNode ast) throws SemanticException { boolean isExtended; String dbName; if (ast.getChildCount() == 1) { dbName = stripQuotes(ast.getChild(0).getText()); isExtended = false; } else if (ast.getChildCount() == 2) { dbName = stripQuotes(ast.getChild(0).getText()); isExtended = true; } else { throw new SemanticException("Unexpected Tokens at DESCRIBE DATABASE"); } DescDatabaseDesc descDbDesc = new DescDatabaseDesc(ctx.getResFile(), dbName, isExtended); inputs.add(new ReadEntity(getDatabase(dbName))); rootTasks.add(TaskFactory.get(new DDLWork2(getInputs(), getOutputs(), descDbDesc))); setFetchTask(createFetchTask(DESC_DATABASE_SCHEMA)); }

Target:
private void analyzeDescDatabase(ASTNode ast) throws SemanticException { boolean isExtended; String dbName; if (ast.getChildCount() == 1) { dbName = stripQuotes(ast.getChild(0).getText()); isExtended = false; } else if (ast.getChildCount() == 2) { dbName = stripQuotes(ast.getChild(0).getText()); isExtended = true; } else { throw new SemanticException("Unexpected Tokens at DESCRIBE DATABASE"); } DescDatabaseDesc descDbDesc = new DescDatabaseDesc(ctx.getResFile(), dbName, isExtended); inputs.add(new ReadEntity(getDatabase(dbName))); rootTasks.add(TaskFactory.get(new DDLWork2(getInputs(), getOutputs(), descDbDesc))); setFetchTask(createFetchTask(DescDatabaseDesc.DESC_DATABASE_SCHEMA)); }
Source:
private boolean isJsonOutputRequired(List <String> installationArgs) { int jsonIndex = installationArgs.indexOf("--json"); if (jsonIndex > -1 ) { return jsonIndex == installationArgs.size() - 1 || !installationArgs.get(jsonIndex).equals("false"); } return installationArgs.contains("--json=true"); }

Target:
static boolean isJsonOutputRequired(List <String> installationArgs) { int jsonIndex = installationArgs.indexOf("--json"); if (jsonIndex > -1 ) { return jsonIndex == installationArgs.size() - 1 || !installationArgs.get(jsonIndex + 1).equals("false"); } return installationArgs.contains("--json=true"); }
Source:
public ArrayList<BookieSocketAddress> newEnsemble(int ensembleSize, int writeQuorumSize) throws BKNotEnoughBookiesException { try { return placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, quarantinedBookies.asMap().keySet()); } catch (BKNotEnoughBookiesException e) { if (logger.isDebugEnabled()) { logger.debug("Not enough healthy bookies available, using quarantined bookies"); } return placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, EMPTY_SET); } }

Target:
public ArrayList<BookieSocketAddress> newEnsemble(int ensembleSize, int writeQuorumSize) throws BKNotEnoughBookiesException { try { return placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, new HashSet<BookieSocketAddress>( quarantinedBookies.asMap().keySet())); } catch (BKNotEnoughBookiesException e) { if (logger.isDebugEnabled()) { logger.debug("Not enough healthy bookies available, using quarantined bookies"); } return placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, EMPTY_SET); } }
Source:
public void finishedReplication(Replicator replicator) { synchronized (replicator) { remove(replicator); if (replicatorsInProgress.size() == 0 && mReplicationsCompletedListener != null) { mReplicationsCompletedListener.allReplicationsCompleted(); } } }

Target:
public void finishedReplication(Replicator replicator) { synchronized (replicatorsInProgress) { remove(replicator); if (replicatorsInProgress.size() == 0 && mReplicationsCompletedListener != null) { mReplicationsCompletedListener.allReplicationsCompleted(); } } }
Source:
public void stop() { try { for (WorkerWrapper workerWrapper : zkWorkers.values()) { workerWrapper.getWatcher().close(); } } catch (Exception e) { throw Throwables.propagate(e); } finally { started = false; } }

Target:
public void stop() { try { for (WorkerWrapper workerWrapper : zkWorkers.values()) { workerWrapper.close(); } } catch (Exception e) { throw Throwables.propagate(e); } finally { started = false; } }
Source:
public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); final String segmentPaths = conf.get(CONF_INPUT_SEGMENTS); logger.info("Segment Paths = " + segmentPaths); List<InputSplit> splits = Lists.transform( (List<String>)new ObjectMapper().readValue(segmentPaths, new TypeReference<List<String>>() {}), new Function<String, InputSplit>() { @Override public InputSplit apply(String input) { return new DatasourceInputSplit(input); } } ); logger.info("Number of splits = " + splits.size()); return splits; }

Target:
public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); String segmentsStr = Preconditions.checkNotNull(conf.get(CONF_INPUT_SEGMENTS), "No segments found to read"); List<DataSegment> segments = HadoopDruidIndexerConfig.jsonMapper.readValue( segmentsStr, new TypeReference<List<DataSegment>>() { } ); if (segments == null || segments.size() == 0) { throw new ISE("No segments found to read"); } logger.info("segments to read [%s]", segmentsStr); long maxSize = conf.getLong(CONF_MAX_SPLIT_SIZE, 0); if (maxSize > 0) { Collections.sort( segments, new Comparator<DataSegment>() { @Override public int compare(DataSegment s1, DataSegment s2) { return Long.compare(s1.getSize(), s2.getSize()); } } ); } List<InputSplit> splits = Lists.newArrayList(); List<DataSegment> list = new ArrayList<>(); long size = 0; for (DataSegment segment : segments) { if (size + segment.getSize() > maxSize && size > 0) { splits.add(new DatasourceInputSplit(list)); list = Lists.newArrayList(); size = 0; } list.add(segment); size += segment.getSize(); } if (list.size() > 0) { splits.add(new DatasourceInputSplit(list)); } logger.info("Number of splits [%d]", splits.size()); return splits; }
Source:
public Connection connect(Shell shell, String connectionString) { disconnect(); connection = ConnectionFactory.getConnection(connectionString, sslContext); try { connection.connect(); } catch (AccessDeniedException accessDenied) { try { connection.close(); String username = null; String password = null; if (shell != null) { username = shell.readLine(Messages.MSG.username()); password = username.isEmpty() ? null : shell.readLine(new Prompt(Messages.MSG.password(), '*')); } else { java.io.Console sysConsole = System.console(); if (sysConsole != null) { username = sysConsole.readLine(Messages.MSG.username()); password = username.isEmpty() ? null : new String(sysConsole.readPassword(Messages.MSG.password())); } else { } } connection.connect(username, password); } catch (Exception e) { disconnect(); showError(shell, e); } } catch (IOException e) { disconnect(); showError(shell, e); } refreshPrompt(); return connection; }

Target:
public Connection connect(Shell shell, String connectionString) { disconnect(); connection = ConnectionFactory.getConnection(connectionString, sslContext); try { connection.connect(); } catch (AccessDeniedException accessDenied) { try { Util.close(connection); String username = null; String password = null; if (shell != null) { username = shell.readLine(Messages.MSG.username()); password = username.isEmpty() ? null : shell.readLine(new Prompt(Messages.MSG.password(), '*')); } else { java.io.Console sysConsole = System.console(); if (sysConsole != null) { username = sysConsole.readLine(Messages.MSG.username()); password = username.isEmpty() ? null : new String(sysConsole.readPassword(Messages.MSG.password())); } else { } } connection.connect(username, password); } catch (Exception e) { disconnect(); showError(shell, e); } } catch (IOException e) { disconnect(); showError(shell, e); } refreshPrompt(); return connection; }