auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void premain(String agentArgument, Instrumentation instrumentation) throws Exception { String[] args = agentArgument.split(":"); if (args.length < 2 || args.length > 3) { System.err.println("Usage: -javaagent:/path/to/JavaAgent.jar=[host:]<port>:<yaml configuration file>"); System.exit(1); } String host; int port; String file; if (args.length == 3) { port = Integer.parseInt(args[1]); host = args[0]; file = args[2]; } else { port = Integer.parseInt(args[0]); host = "0.0.0.0"; file = args[1]; } new JmxCollector(new File(file)).register(); DefaultExports.initialize(); QueuedThreadPool pool = new QueuedThreadPool(); pool.setDaemon(true); pool.setMaxThreads(10); pool.setName("jmx_exporter"); server = new Server(pool); ServerConnector connector = new ServerConnector(server); connector.setReuseAddress(true); connector.setHost(host); connector.setPort(port); server.setConnectors(new Connector[]{connector}); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.addFilter(GzipFilter.class, "/*", null); server.setHandler(context); context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics"); final int delayInSecs = Integer.parseInt(System.getProperty("jmx_exporter.agent.startdelay", "0")); if (delayInSecs > 0) { new Thread("jmx_exporter-agent-delayed-starter-" + delayInSecs + "secs") { @Override public void run() { try { Thread.sleep(delayInSecs * 1000); server.start(); } catch (InterruptedException e) { Thread.interrupted(); return; } catch (Exception e) { e.printStackTrace(); return; } } }.start(); } else { server.start(); } }

Target:
public static void premain(String agentArgument, Instrumentation instrumentation) throws Exception { String[] args = agentArgument.split(":"); if (args.length < 2 || args.length > 3) { System.err.println("Usage: -javaagent:/path/to/JavaAgent.jar=[host:]<port>:<yaml configuration file>"); System.exit(1); } String host; int port; String file; if (args.length == 3) { port = Integer.parseInt(args[1]); host = args[0]; file = args[2]; } else { port = Integer.parseInt(args[0]); host = "0.0.0.0"; file = args[1]; } new JmxCollector(new File(file)).register(); DefaultExports.initialize(); QueuedThreadPool pool = new QueuedThreadPool(); pool.setDaemon(true); pool.setMaxThreads(10); pool.setName("jmx_exporter"); server = new Server(pool); ServerConnector connector = new ServerConnector(server); connector.setReuseAddress(true); connector.setHost(host); connector.setPort(port); server.setConnectors(new Connector[]{connector}); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.addFilter(GzipFilter.class, "/*", null); server.setHandler(context); context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics"); server.start(); }
Source:
private static long dmlDoInsert(UpdatePlan plan, Iterable<List<?>> cursor, int pageSize) throws IgniteCheckedException { GridCacheContext cctx = plan.cacheContext(); if (plan.rowCount() == 1) { IgniteBiTuple t = plan.processRow(cursor.iterator().next()); try ( MTC.TraceSurroundings ignored = MTC.support(cctx.kernalContext().tracing() .create(SQL_CACHE_UPDATE, MTC.span()) .addTag(SQL_CACHE_UPDATES, () -> Integer.toString(1))) ) { if (cctx.cache().putIfAbsent(t.getKey(), t.getValue())) return 1; else throw new TransactionDuplicateKeyException("Duplicate key during INSERT [key=" + t.getKey() + ']'); } } else { DmlBatchSender sender = new DmlBatchSender(cctx, pageSize, 1); for (List<?> row : cursor) { final IgniteBiTuple keyValPair = plan.processRow(row); sender.add(keyValPair.getKey(), new DmlStatementsProcessor.InsertEntryProcessor(keyValPair.getValue()), 0); } sender.flush(); SQLException resEx = sender.error(); if (!F.isEmpty(sender.failedKeys())) { String msg = "Failed to INSERT some keys because they are already in cache " + "[keys=" + sender.failedKeys() + ']'; SQLException dupEx = new SQLException(msg, SqlStateCode.CONSTRAINT_VIOLATION); if (resEx == null) resEx = dupEx; else resEx.setNextException(dupEx); } if (resEx != null) throw new IgniteSQLException(resEx); return sender.updateCount(); } }

Target:
private static long dmlDoInsert(UpdatePlan plan, Iterable<List<?>> cursor, int pageSize) throws IgniteCheckedException { GridCacheContext cctx = plan.cacheContext(); if (plan.rowCount() == 1) { IgniteBiTuple t = plan.processRow(cursor.iterator().next()); try ( MTC.TraceSurroundings ignored = MTC.support(cctx.kernalContext().tracing() .create(SQL_CACHE_UPDATE, MTC.span()) .addTag(SQL_CACHE_UPDATES, () -> "1")) ) { if (cctx.cache().putIfAbsent(t.getKey(), t.getValue())) return 1; else throw new TransactionDuplicateKeyException("Duplicate key during INSERT [key=" + t.getKey() + ']'); } } else { DmlBatchSender sender = new DmlBatchSender(cctx, pageSize, 1); for (List<?> row : cursor) { final IgniteBiTuple keyValPair = plan.processRow(row); sender.add(keyValPair.getKey(), new DmlStatementsProcessor.InsertEntryProcessor(keyValPair.getValue()), 0); } sender.flush(); SQLException resEx = sender.error(); if (!F.isEmpty(sender.failedKeys())) { String msg = "Failed to INSERT some keys because they are already in cache " + "[keys=" + sender.failedKeys() + ']'; SQLException dupEx = new SQLException(msg, SqlStateCode.CONSTRAINT_VIOLATION); if (resEx == null) resEx = dupEx; else resEx.setNextException(dupEx); } if (resEx != null) throw new IgniteSQLException(resEx); return sender.updateCount(); } }
Source:
public void testClusterHealth() { final String server1 = "server1"; final String server2 = "server2"; final String server3 = "server3"; final List<String> servers = Arrays.asList(server1, server2, server3); final Layout layout = layoutUtil.getLayout(servers); layout.setUnresponsiveServers(Arrays.asList(server3)); ClusterHealth clusterHealth = new ClusterHealth(); ClusterStatus status = clusterHealth.getClusterHealth( layout, layout.getAllActiveServers() ); assertThat(status).isEqualTo(ClusterStatus.STABLE); }

Target:
public void testClusterHealth() { Layout layout = layoutUtil.getLayout(servers); layout.setUnresponsiveServers(Collections.singletonList(server3)); ClusterStatus status = clusterHealth.getClusterHealth( layout, layout.getAllActiveServers() ); assertThat(status).isEqualTo(ClusterStatus.UNAVAILABLE); layout.getFirstSegment().getFirstStripe().getLogServers().remove(server3); status = clusterHealth.getClusterHealth( layout, layout.getAllActiveServers() ); assertThat(status).isEqualTo(ClusterStatus.DEGRADED); }
Source:
public void stop() { stop.set(true); if (DEBUG) LOGGER.debug("ScopAutoSuggestProvider got signal stop"); }

Target:
public void stop() { stop.set(true); LOGGER.debug("ScopAutoSuggestProvider got signal stop"); }
Source:
private Guid selectBestHost(VDSGroup cluster, VM vm, Guid destHostId, List<VDS> vdsList, ClusterPolicy policy, Map<String, String> parameters) { if (destHostId != null) { for (VDS vds : vdsList) { if (destHostId.equals(vds.getId())) { return destHostId; } } } if (policy.getFunctions() == null || policy.getFunctions().isEmpty()) { return vdsList.get(0).getId(); } if (shouldWeighClusterHosts(cluster, vdsList)) { return runFunctions(policy.getFunctions(), vdsList, vm, parameters); } if (!vdsList.isEmpty()) { return vdsList.get(0).getId(); } return null; }

Target:
private Guid selectBestHost(VDSGroup cluster, VM vm, Guid destHostId, List<VDS> vdsList, ClusterPolicy policy, Map<String, String> parameters) { if (destHostId != null) { for (VDS vds : vdsList) { if (destHostId.equals(vds.getId())) { return destHostId; } } } List<Pair<Guid, Integer>> functions = policy.getFunctions(); if (functions != null && !functions.isEmpty() && shouldWeighClusterHosts(cluster, vdsList)) { Guid bestHostByFunctions = runFunctions(functions, vdsList, vm, parameters); if (bestHostByFunctions != null) { return bestHostByFunctions; } } return vdsList.get(0).getId(); }
Source:
public void shouldSupportSortOnStandardFieldWithCriteria() { final List<String> sortedIds = repository.findAllByNameOrderByText("Salt").stream() .map(it -> it.id).collect(Collectors.toList()); assertThat(sortedIds).containsExactly("4", "5"); }

Target:
public void shouldSupportSortOnStandardFieldWithCriteria() { List<String> sortedIds = repository.findAllByNameOrderByText("Salt").stream() .map(it -> it.id).collect(Collectors.toList()); assertThat(sortedIds).containsExactly("4", "5"); }
Source:
public void setConnectTimeout(int timeout) { connectTimeout = timeout; if (timeout >= 0) { OkHttpClient.Builder builder = getBuilder(); builder.connectTimeout(timeout, TimeUnit.MILLISECONDS); client = builder.build(); } }

Target:
public void setConnectTimeout(int timeout) { connectTimeout = timeout; client = null; }
Source:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = feed.getDescription(); if (description != null) { if (Feed.TYPE_ATOM1.equals(feed.getType())) { description = getPlainText(new SpannedString(description)).toString(); } } else { description = ""; } txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthor.setText(feed.getAuthor()); txtvAuthorHeader.setText(feed.getAuthor()); } else { lblAuthor.setVisibility(View.GONE); txtvAuthor.setVisibility(View.GONE); } if (!TextUtils.isEmpty(feed.getLanguage())) { txtvLanguage.setText(LangUtils.getLanguageString(feed.getLanguage())); } else { lblLanguage.setVisibility(View.GONE); txtvLanguage.setVisibility(View.GONE); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }

Target:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthor.setText(feed.getAuthor()); txtvAuthorHeader.setText(feed.getAuthor()); } else { lblAuthor.setVisibility(View.GONE); txtvAuthor.setVisibility(View.GONE); } if (!TextUtils.isEmpty(feed.getLanguage())) { txtvLanguage.setText(LangUtils.getLanguageString(feed.getLanguage())); } else { lblLanguage.setVisibility(View.GONE); txtvLanguage.setVisibility(View.GONE); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }
Source:
@After public void tearDown() throws IOException { FileUtil.fullyDelete(TEST_DIR); }

Target:
public void tearDown() throws IOException { FileUtil.fullyDelete(TEST_DIR); }
Source:
private void initWsWorkUnitsSoapProxy(String baseURL, String user, String pass) { wsWorkunitsServiceSoapProxy = new WsWorkunitsServiceSoapProxy(baseURL); if (wsWorkunitsServiceSoapProxy != null) { WsWorkunitsServiceSoap wsWorkunitsServiceSoap = wsWorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) wsWorkunitsServiceSoap, user, pass); } version5WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WsWorkunitsServiceSoapProxy( baseURL); if (version5WorkunitsServiceSoapProxy != null) { org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WsWorkunitsServiceSoap version5WorkunitsServiceSoap = version5WorkunitsServiceSoapProxy .getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version5WorkunitsServiceSoap, user, pass); } version6WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_69.WsWorkunitsServiceSoapProxy( baseURL); if (version6WorkunitsServiceSoapProxy != null) { org.hpccsystems.ws.client.gen.wsworkunits.v1_69.WsWorkunitsServiceSoap version6WorkunitsServiceSoap = version6WorkunitsServiceSoapProxy .getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version6WorkunitsServiceSoap, user, pass); } }

Target:
private void initWsWorkUnitsSoapProxy(String baseURL, String user, String pass) { soapWrapper=new WsWorkunitsClientSoapProxyWrapper(baseURL, user,pass,targetVersion); wsWorkunitsServiceSoapProxy = soapWrapper.getLatestRaw(); }
Source:
private Callback kafkaSendCallback(final BatchItem item, final CountDownLatch done) { return (metadata, exception) -> { if (exception == null) { item.updateStatusAndDetail(EventPublishingStatus.SUBMITTED, ""); } else { LOG.error("Failed to publish event " + item.getEvent().toString(), exception); item.updateStatusAndDetail(EventPublishingStatus.FAILED, "internal error"); } done.countDown(); }; }

Target:
private Callback kafkaSendCallback(final BatchItem item, final CountDownLatch done) { return (metadata, exception) -> { if (exception == null) { item.updateStatusAndDetail(EventPublishingStatus.SUBMITTED, ""); } else { LOG.error("Failed to publish event", exception); item.updateStatusAndDetail(EventPublishingStatus.FAILED, "internal error"); } done.countDown(); }; }
Source:
public void showStatus(GlusterVolumeTaskStatusEntity rebalanceStatusEntity) { List<GlusterVolumeTaskStatusForHost> rebalanceSessionsList = rebalanceStatusEntity.getHostwiseStatusDetails(); List<EntityModel> sessionList = new ArrayList<EntityModel>(); for (GlusterVolumeTaskStatusForHost hostDetail : rebalanceSessionsList) { EntityModel sessionModel = new EntityModel(hostDetail); sessionList.add(sessionModel); } getStartedTime().setEntity(rebalanceStatusEntity.getStartTime()); getStatusTime().setEntity(rebalanceStatusEntity.getStatusTime()); getRebalanceSessions().setItems(sessionList); if(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED) { setStatusAvailable(true); refresh.cancel(); }else { setStatusAvailable(false); if ((rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED || rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FAILED)) { refresh.cancel(); } } if (GlusterTaskType.REBALANCE.equals(getEntity().getAsyncTask().getType())) { getStopReblanceFromStatus().setIsExecutionAllowed(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.STARTED); } }

Target:
public void showStatus(GlusterVolumeTaskStatusEntity rebalanceStatusEntity) { List<GlusterVolumeTaskStatusForHost> rebalanceSessionsList = rebalanceStatusEntity.getHostwiseStatusDetails(); List<EntityModel> sessionList = new ArrayList<EntityModel>(); for (GlusterVolumeTaskStatusForHost hostDetail : rebalanceSessionsList) { EntityModel sessionModel = new EntityModel(hostDetail); sessionList.add(sessionModel); } getStartedTime().setEntity(rebalanceStatusEntity.getStartTime()); getStatusTime().setEntity(rebalanceStatusEntity.getStatusTime()); getRebalanceSessions().setItems(sessionList); if(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED) { setStatusAvailable(true); refresh.cancel(); }else { setStatusAvailable(false); if ((rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED || rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FAILED)) { refresh.cancel(); } } if (GlusterTaskType.REBALANCE == getEntity().getAsyncTask().getType()) { getStopReblanceFromStatus().setIsExecutionAllowed(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.STARTED); } }
Source:
private boolean isMine() { return reviewitem.getReview().getRepository().getAccount().toString().compareTo(currentAuthor) == 0; }

Target:
private boolean isMine() { return (reviewitem != null) && (reviewitem.getReview() != null) && (reviewitem.getReview().getRepository() != null) && (reviewitem.getReview().getRepository().getAccount() != null) && (reviewitem.getReview().getRepository().getAccount().getDisplayName().compareTo(currentAuthor) == 0); }
Source:
public void stop(@Nonnull Throwable cause) throws Exception { if (body!=null) body.cancel(cause); }

Target:
public void stop(@Nonnull Throwable cause) throws Exception { if (body!=null) { body.cancel(cause); } }
Source:
public void postMessage(final Direction direction, final Tuple update, final DifferentialTimestamp timestamp) { final TreeMap<DifferentialTimestamp, Map<Tuple, Integer>> activeQueue = getActiveQueue(); Map<Tuple, Integer> tupleMap = activeQueue.get(timestamp); final boolean wasEmpty = tupleMap == null; boolean significantChange = false; if (tupleMap == null) { tupleMap = CollectionsFactory.createMap(); activeQueue.put(timestamp, tupleMap); significantChange = true; } Integer count = tupleMap.get(update); if (count == null) { count = 0; significantChange = true; } if (direction == Direction.REVOKE) { count--; } else { count++; } if (count == 0) { tupleMap.remove(update); if (tupleMap.isEmpty()) { activeQueue.remove(timestamp); } significantChange = true; } else { tupleMap.put(update, count); } if (significantChange) { final CommunicationGroup targetGroup = this.getAdapter() != null ? this.getAdapter().getCurrentGroup() : this.getCurrentGroup(); final Mailbox targetMailbox = this.getAdapter() != null ? this.getAdapter() : this; if (wasEmpty) { targetGroup.notifyHasMessage(targetMailbox, timestamp); } else if (tupleMap.isEmpty()) { targetGroup.notifyLostAllMessages(targetMailbox, timestamp); } } }

Target:
public void postMessage(final Direction direction, final Tuple update, final DifferentialTimestamp timestamp) { final TreeMap<DifferentialTimestamp, IDeltaBag<Tuple>> activeQueue = getActiveQueue(); IDeltaBag<Tuple> tupleMap = activeQueue.get(timestamp); final boolean wasEmpty = tupleMap == null; boolean significantChange = false; if (tupleMap == null) { tupleMap = CollectionsFactory.createDeltaBag(); activeQueue.put(timestamp, tupleMap); significantChange = true; } int count = tupleMap.getCount(update); if (count == 0) { significantChange = true; } if (direction == Direction.REVOKE) { count--; } else { count++; } if (count == 0) { tupleMap.clearAllOf(update); if (tupleMap.isEmpty()) { activeQueue.remove(timestamp); } significantChange = true; } else { tupleMap.addSigned(update, count); } if (significantChange) { final Mailbox targetMailbox = this.adapter; final CommunicationGroup targetGroup = this.adapter.getCurrentGroup(); if (wasEmpty) { targetGroup.notifyHasMessage(targetMailbox, timestamp); } else if (tupleMap.isEmpty()) { targetGroup.notifyLostAllMessages(targetMailbox, timestamp); } } }
Source:
public void validate(Object obj, Errors errors) { if (obj == null || !(obj instanceof CohortMembership)) { throw new IllegalArgumentException("The parameter obj should not be null and must be of type" + CohortMembership.class); } CohortMembership cohortMembership = (CohortMembership) obj; Patient p = cohortMembership.getPatient(); if (p.getVoided() != cohortMembership.getVoided()) { errors.rejectValue("voided", "Cohort.patientAndMembershipShouldBeVoided"); } ValidateUtil.validateFieldLengths(errors, obj.getClass(), "voided"); }

Target:
public void validate(Object obj, Errors errors) { if (obj == null || !(obj instanceof Cohort)) { throw new IllegalArgumentException("The parameter obj should not be null and must be of type" + Cohort.class); } Cohort cohort = (Cohort) obj; Collection<CohortMembership> members = cohort.getMembers(); if (!CollectionUtils.isEmpty(members)) { for (CohortMembership member : members) { Patient p = member.getPatient(); if (p.getVoided() && !member.getVoided()) { String eMessage = "Patient " + p.getPatientId() + " is voided, cannot add voided members to a cohort"; errors.rejectValue("members", "Cohort.patientAndMemberShouldBeVoided", eMessage); } } } }
Source:
public void tearDown() throws Exception { ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), "BaseDataReader", "ProcessWaitFor", "Timer" ); try { if (myCompilerTester != null) { myCompilerTester.tearDown(); } killNailgun(); cleanProjectRoot(); Messages.setTestDialog(TestDialog.DEFAULT); final Stream<Sdk> leakedJdks = Arrays.stream(ProjectJdkTable.getInstance().getAllJdks()) .filter(jdk -> { final String name = jdk.getName(); return name.contains("pants") || name.startsWith("python"); }); leakedJdks.forEach(jdk -> { ApplicationManager.getApplication().runWriteAction(() -> { ProjectJdkTable.getInstance().removeJdk(jdk); }); }); super.tearDown(); } catch (Throwable throwable) { if (!throwable.getMessage().contains("Already disposed")) { throw throwable; } } }

Target:
public void tearDown() throws Exception { ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), "BaseDataReader", "ProcessWaitFor", "Timer" ); try { if (myCompilerTester != null) { myCompilerTester.tearDown(); } killNailgun(); cleanProjectRoot(); Messages.setTestDialog(TestDialog.DEFAULT); removeJdks(jdk -> jdk.getName().contains("pants")); super.tearDown(); } catch (Throwable throwable) { if (!throwable.getMessage().contains("Already disposed")) { throw throwable; } } }
Source:
public static LocationSummary newInstance(ManagementContext mgmt, String id, LocationSpec locationSpec, LocationDetailLevel level) { Map<String, ?> config = locationSpec.getConfig(); if (level==LocationDetailLevel.FULL_EXCLUDING_SECRET || level==LocationDetailLevel.FULL_INCLUDING_SECRET) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().lookup(ld); if (ll!=null) config = ll.getAllConfig(true); } else if (level==LocationDetailLevel.LOCAL_EXCLUDING_SECRET) { if (!config.containsKey(LocationConfigKeys.DISPLAY_NAME.getName()) && mgmt!=null) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().lookup(ld); if (ll!=null) { Map<String, Object> configExtra = ll.getAllConfig(true); if (configExtra.containsKey(LocationConfigKeys.DISPLAY_NAME.getName())) { ConfigBag configNew = ConfigBag.newInstance(configExtra); configNew.configure(LocationConfigKeys.DISPLAY_NAME, (String)configExtra.get(LocationConfigKeys.DISPLAY_NAME.getName())); config = configNew.getAllConfig(); } } } } return new LocationSummary( id, locationSpec.getName(), locationSpec.getSpec(), null, copyConfig(config, level), ImmutableMap.of("self", URI.create("/v1/locations/" + id))); }

Target:
public static LocationSummary newInstance(ManagementContext mgmt, String id, LocationSpec locationSpec, LocationDetailLevel level) { Map<String, ?> config = locationSpec.getConfig(); if (level==LocationDetailLevel.FULL_EXCLUDING_SECRET || level==LocationDetailLevel.FULL_INCLUDING_SECRET) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().resolveForPeeking(ld); if (ll!=null) config = ll.getAllConfig(true); } else if (level==LocationDetailLevel.LOCAL_EXCLUDING_SECRET) { if (!config.containsKey(LocationConfigKeys.DISPLAY_NAME.getName()) && mgmt!=null) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().resolveForPeeking(ld); if (ll!=null) { Map<String, Object> configExtra = ll.getAllConfig(true); if (configExtra.containsKey(LocationConfigKeys.DISPLAY_NAME.getName())) { ConfigBag configNew = ConfigBag.newInstance(config); configNew.configure(LocationConfigKeys.DISPLAY_NAME, (String)configExtra.get(LocationConfigKeys.DISPLAY_NAME.getName())); config = configNew.getAllConfig(); } } } } return new LocationSummary( id, locationSpec.getName(), locationSpec.getSpec(), null, copyConfig(config, level), ImmutableMap.of("self", URI.create("/v1/locations/" + id))); }
Source:
public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws Exception { String queryId = null; String id = null; Forwarded forwarded = null; if (parser.getName().equals(MamResultExtension.ELEMENT)) { queryId = parser.getAttributeValue("", "queryid"); id = parser.getAttributeValue("", "id"); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals(Forwarded.ELEMENT)) { forwarded = new ForwardedProvider().parse(parser); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(MamResultExtension.ELEMENT)) { done = true; } } } } return new MamResultExtension(queryId, id, forwarded); }

Target:
public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws Exception { Forwarded forwarded = null; String queryId = parser.getAttributeValue("", "queryid"); String id = parser.getAttributeValue("", "id"); outerloop: while (true) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals(Forwarded.ELEMENT)) { forwarded = new ForwardedProvider().parse(parser); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getDepth() == initialDepth) { break outerloop; } } } return new MamResultExtension(queryId, id, forwarded); }
Source:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { this.location = location; this.databaseName = location.getName(); this.database = new DatabaseImpl(location, keyProvider); this.database.getEventBus().register(this); this.query = new IndexManagerImpl(database); }

Target:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { this.location = location; this.databaseName = location.getName(); this.database = new DatabaseImpl(location, keyProvider); this.query = new IndexManagerImpl(database); }
Source:
protected boolean areEqual(Object obj1, Object obj2) { if (obj1 == null) { return (obj2 == null); } if (obj2 == null) { return false; } if (JHelper.objectSameReference(obj1, obj2)) { return true; } if (obj1 instanceof BigDecimal) { if (obj2 instanceof BigDecimal) { Comparable com1 = (Comparable) obj1; return (com1.compareTo(obj2) == 0); } else { return false; } } if (obj1 instanceof URL) { return obj1.toString().equals(obj2.toString()); } return obj1.equals(obj2); }

Target:
protected boolean areEqual(Object obj1, Object obj2) { if (obj1 == null) { return (obj2 == null); } if (obj2 == null) { return false; } if (obj1 == obj2) { return true; } if (obj1 instanceof BigDecimal) { if (obj2 instanceof BigDecimal) { Comparable com1 = (Comparable) obj1; return (com1.compareTo(obj2) == 0); } else { return false; } } if (obj1 instanceof URL) { return obj1.toString().equals(obj2.toString()); } return obj1.equals(obj2); }
Source:
public CdnDTO create( @ApiParam(name = "cdn", required = true) CdnDTO cdnDTOInput, @Context Principal principal) { Cdn existing = curator.lookupByLabel(cdnDTOInput.getLabel()); if (existing != null) { throw new BadRequestException(i18n.tr( "A CDN with the label {0} already exists", cdnDTOInput.getLabel())); } Cdn cndToCreate = new Cdn(); this.populateEntity(cndToCreate, cdnDTOInput); return this.translator.translate(cdnManager.createCdn(cndToCreate), CdnDTO.class); }

Target:
public CdnDTO create( @ApiParam(name = "cdn", required = true) CdnDTO cdnDTOInput, @Context Principal principal) { Cdn existing = curator.lookupByLabel(cdnDTOInput.getLabel()); if (existing != null) { throw new BadRequestException(i18n.tr( "A CDN with the label {0} already exists", cdnDTOInput.getLabel())); } Cdn cndToCreate = new Cdn(); this.populateEntity(cndToCreate, cdnDTOInput); if (cdnDTOInput.getLabel() != null) { cndToCreate.setLabel(cdnDTOInput.getLabel()); } return this.translator.translate(cdnManager.createCdn(cndToCreate), CdnDTO.class); }
Source:
private void check(CryptoMode cryptoMode) { if (cryptoProvider == null && (cryptoMode == CryptoMode.AuthenticatedEncryption || cryptoMode == CryptoMode.StrictAuthenticatedEncryption)) { if (!CryptoRuntime.isBouncyCastleAvailable()) { CryptoRuntime.enableBouncyCastle(); if (!CryptoRuntime.isBouncyCastleAvailable()) { throw new UnsupportedOperationException( "The Bouncy castle library jar is required on the classpath to enable authenticated encryption"); } } if (!CryptoRuntime.isAesGcmAvailable()) throw new UnsupportedOperationException( "More recent version of the Bouncy castle library is required to enable authenticated encryption"); } }

Target:
private void check(CryptoMode cryptoMode) { boolean preferBC = (cryptoMode == CryptoMode.AuthenticatedEncryption) || (cryptoMode == CryptoMode.StrictAuthenticatedEncryption); boolean haveOverride = (cryptoProvider != null && alwaysUseCryptoProvider); if (preferBC && !haveOverride) { if (!CryptoRuntime.isBouncyCastleAvailable()) { CryptoRuntime.enableBouncyCastle(); if (!CryptoRuntime.isBouncyCastleAvailable()) { throw new UnsupportedOperationException( "The Bouncy castle library jar is required on the classpath to enable authenticated encryption"); } } if (!CryptoRuntime.isAesGcmAvailable()) throw new UnsupportedOperationException( "More recent version of the Bouncy castle library is required to enable authenticated encryption"); } }
Source:
private void addDevice(XmlRpcStruct struct, VmDevice vmDevice, String path) { Map<String, Object> specParams = (vmDevice.getSpecParams() == null) ? new HashMap<String, Object>() : vmDevice.getSpecParams(); struct.add(VdsProperties.Path, path); struct.add(VdsProperties.SpecParams, specParams); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); addBootOrder(vmDevice, struct); devices.add(struct); addToManagedDevices(vmDevice); }

Target:
private void addDevice(XmlRpcStruct struct, VmDevice vmDevice, String path) { Map<String, Object> specParams = (vmDevice.getSpecParams() == null) ? Collections.<String, Object> emptyMap() : vmDevice.getSpecParams(); struct.add(VdsProperties.Path, path); struct.add(VdsProperties.SpecParams, specParams); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); addBootOrder(vmDevice, struct); devices.add(struct); addToManagedDevices(vmDevice); }
Source:
public boolean add(Setting setting) { SimpleUri id = setting.getId(); if (id == null) { LOGGER.warn("The id of a setting cannot be null."); return false; } else if (contains(id)) { LOGGER.warn("A Setting with the id \"{}\" already exists.", id); return false; } if (unusedSettings != null) { if (unusedSettings.containsKey(id)) { setting.setValueFromString(unusedSettings.remove(id)); } } settingMap.put(id, setting); return true; }

Target:
public boolean add(Setting setting) { SimpleUri id = setting.getId(); if (id == null) { LOGGER.warn("The id of a setting cannot be null."); return false; } else if (contains(id)) { LOGGER.warn("A Setting with the id \"{}\" already exists.", id); return false; } if (temporarilyParkedSettings.containsKey(id)) { setting.setValueFromString(temporarilyParkedSettings.remove(id)); } settings.put(id, setting); return true; }
Source:
public EditText initProgramServer(){ return null; }

Target:
public void initProgramServer(){ }
Source:
private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle, QueryContext ctx) throws GrillException { LOG.info("execute configuration: "); for(Map.Entry<String,String> entry: ctx.getConf()) { LOG.info(entry.getKey()+":"+entry.getValue()); } ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString()); QueryStatus before = ctx.getStatus(); ctx.setStatus(new QueryStatus(0.0, QueryStatus.Status.QUEUED, "Query is queued", false, null, null)); acceptedQueries.add(ctx); allQueries.put(ctx.getQueryHandle(), ctx); fireStatusChangeEvent(ctx, ctx.getStatus(), before); LOG.info("Returning handle " + ctx.getQueryHandle().getHandleId()); return ctx.getQueryHandle(); }

Target:
private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle, QueryContext ctx) throws GrillException { ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString()); QueryStatus before = ctx.getStatus(); ctx.setStatus(new QueryStatus(0.0, QueryStatus.Status.QUEUED, "Query is queued", false, null, null)); acceptedQueries.add(ctx); allQueries.put(ctx.getQueryHandle(), ctx); fireStatusChangeEvent(ctx, ctx.getStatus(), before); LOG.info("Returning handle " + ctx.getQueryHandle().getHandleId()); return ctx.getQueryHandle(); }
Source:
public static AdvancedInsightResponse fromJson(String json) { try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, AdvancedInsightResponse.class); } catch (IOException jpe) { throw new NexmoUnexpectedException("Failed to produce BasicInsightResponse from json.", jpe); } }

Target:
public static AdvancedInsightResponse fromJson(String json) { try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, AdvancedInsightResponse.class); } catch (IOException jpe) { throw new NexmoUnexpectedException("Failed to produce AdvancedInsightResponse from json.", jpe); } }
Source:
public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Permission {"); sb.append("resource: "); sb.append(resource); sb.append("\tOperation: "); sb.append(operation.toString()); sb.append("\tAuthorization attribute: "); sb.append(authorizationAttribute.toString()); sb.append("}."); return sb.toString(); }

Target:
public String toString() { final StringBuilder sb = new StringBuilder(); return sb.append("Permission {resource: ") .append(resource) .append("\tOperation: ") .append(operation.toString()) .append("\tAuthorization attribute: ") .append(authorizationAttribute.toString()) .append("}.") .toString(); }
Source:
private void handleGroupAlreadyExistException(String groupName, List<String> userIDList, List<org.wso2.carbon.user.core.Permission> permissions) throws UserStoreException { String errorCode = ErrorMessages.ERROR_CODE_ROLE_ALREADY_EXISTS.getCode(); String errorMessage = String.format(ErrorMessages.ERROR_CODE_ROLE_ALREADY_EXISTS.getMessage(), groupName); handleAddGroupFailure(errorCode, errorMessage, groupName, userIDList, permissions); throw new UserStoreException(errorCode + " - " + errorMessage); }

Target:
private void handleGroupAlreadyExistException(String groupName, List<String> userIDList, List<org.wso2.carbon.user.core.Permission> permissions) throws UserStoreException { String errorCode = ERROR_CODE_ROLE_ALREADY_EXISTS.getCode(); String errorMessage = String.format(ERROR_CODE_ROLE_ALREADY_EXISTS.getMessage(), groupName); handleAddGroupFailure(errorCode, errorMessage, groupName, userIDList, permissions); throw new UserStoreException(errorCode + " - " + errorMessage); }
Source:
private boolean isUsageOverrideListHasOnlyNull(List<UsagePriceOverride> usagePriceOverrides) { for (UsagePriceOverride override : usagePriceOverrides) if (override != null) return false; return true; }

Target:
private boolean isUsageOverrideListHasOnlyNull(List<UsagePriceOverride> usagePriceOverrides) { for (UsagePriceOverride override : usagePriceOverrides) { if (override != null) { return false; } } return true; }
Source:
public String browseNetworks(@PathVariable("ProjectUnixName") String unixName, Model model, Principal principal, @InjectProject(unixNameParameter = "ProjectUnixName") IProject project) throws QuadrigaStorageException { String projectid = project.getProjectId(); List<INetwork> networks = networkmanager.getNetworksInProject(projectid, INetworkStatus.APPROVED); for(INetwork nw: networks) model.addAttribute("networks", networks); model.addAttribute("project", project); return "sites/browseNetworks"; }

Target:
public String browseNetworks(@PathVariable("ProjectUnixName") String unixName, Model model, Principal principal, @InjectProject(unixNameParameter = "ProjectUnixName") IProject project) throws QuadrigaStorageException { String projectid = project.getProjectId(); List<INetwork> networks = networkmanager.getNetworksInProject(projectid, INetworkStatus.APPROVED); model.addAttribute("networks", networks); model.addAttribute("project", project); return "sites/browseNetworks"; }
Source:
public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for (Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch (GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch (AttributeValueException ex) { throw new ConsistencyErrorException("All resources were removed from this group. So all attributes values can be removed.", ex); } catch (WrongAttributeAssignmentException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); } catch (RelationExistsException | WrongReferenceAttributeValueException | AlreadyMemberException | NotGroupMemberException | GroupNotExistsException | WrongAttributeValueException e) { throw new ConsistencyErrorException(e); } } getPerunBl().getAuditer().log(sess, "All group in deleted.", vo); }

Target:
public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException, GroupOperationsException { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for (Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch (GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch (AttributeValueException ex) { throw new ConsistencyErrorException("All resources were removed from this group. So all attributes values can be removed.", ex); } catch (WrongAttributeAssignmentException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); } catch (RelationExistsException | GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } getPerunBl().getAuditer().log(sess, "All group in deleted.", vo); }
Source:
public int compareTo( DurationValue other ) { return Comparator.comparingLong(DurationValue::averageLengthInNanos) .thenComparingLong( DurationValue::getMonths ) .thenComparingLong( DurationValue::getDays ) .thenComparingLong( DurationValue::getSeconds ) .thenComparingInt( DurationValue::getNanos ).compare( this, other ); }

Target:
public int compareTo( DurationValue other ) { return COMPARATOR.compare( this, other ); }
Source:
public void testUsedByBatch() throws Exception { final List<UseManyEntries> entryList = new ArrayList<>(); final Entry entry1 = new Entry(null, TITLE, null, null, null, null, false, null, null, null, null, false, false); final Entry entry2 = new Entry(null, TITLE2, null, null, null, null, false, null, null, null, null, false, false); entryList.add(new UseManyEntries(OBJ_URI, asList(entry1))); entryList.add(new UseManyEntries(OBJ_URI2, asList(entry1, entry2))); final UseMany useMany = new UseMany(entryList); onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(USEDBY_URI) .respond() .withStatus(200) .withBody(MAPPER.writeValueAsString(useMany)); final Collection<Usage> result = gd.getMetadataService().usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class); assertThat(result, is(notNullValue())); assertThat(result.size(), is(2)); final Iterator<Usage> usages = result.iterator(); final Usage usage1 = usages.next(); assertThat(usage1.getUri(), is(OBJ_URI)); assertThat(usage1.getUsedBy().iterator().next().getTitle(), is(TITLE)); final Usage usage2 = usages.next(); assertThat(usage2.getUri(), is(OBJ_URI2)); final Iterator<Entry> obj2Entries = usage2.getUsedBy().iterator(); assertThat(obj2Entries.next().getTitle(), is(TITLE)); assertThat(obj2Entries.next().getTitle(), is(TITLE2)); }

Target:
public void testUsedByBatch() throws Exception { final List<UseManyEntries> entryList = new ArrayList<>(); final Entry entry1 = new Entry(null, TITLE, null, null, null, null, false, null, null, null, null, false, false); final Entry entry2 = new Entry(null, TITLE2, null, null, null, null, false, null, null, null, null, false, false); entryList.add(new UseManyEntries(OBJ_URI, asList(entry1))); entryList.add(new UseManyEntries(OBJ_URI2, asList(entry1, entry2))); final UseMany useMany = new UseMany(entryList); onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(USEDBY_URI) .respond() .withStatus(200) .withBody(MAPPER.writeValueAsString(useMany)); final Collection<Usage> result = gd.getMetadataService().usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class); assertThat(result, hasSize(2)); final Iterator<Usage> usages = result.iterator(); final Usage usage1 = usages.next(); assertThat(usage1.getUri(), is(OBJ_URI)); assertThat(usage1.getUsedBy().iterator().next().getTitle(), is(TITLE)); final Usage usage2 = usages.next(); assertThat(usage2.getUri(), is(OBJ_URI2)); final Iterator<Entry> obj2Entries = usage2.getUsedBy().iterator(); assertThat(obj2Entries.next().getTitle(), is(TITLE)); assertThat(obj2Entries.next().getTitle(), is(TITLE2)); }
Source:
Table<String, String, String> getPerStageSelectedFields() { ImmutableTable.Builder<String, String, String> tableBuilder = new ImmutableTable.Builder<>(); if (Strings.isNullOrEmpty(selectedFields)) { throw new IllegalArgumentException("selectedFields can not be empty. Please provide at least 1 selectedFields"); } for (String selectedField : Splitter.on(',').trimResults().omitEmptyStrings().split(selectedFields)) { Iterable<String> stageOldNameAliasPair = Splitter.on(" as ").trimResults().omitEmptyStrings() .split(selectedField); if (Iterables.size(stageOldNameAliasPair) != 2) { throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } Iterable<String> stageOldNamePair = Splitter.on('.').trimResults().omitEmptyStrings(). split(Iterables.get(stageOldNameAliasPair, 0)); if (Iterables.size(stageOldNameAliasPair) != 2) { throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } String alias = Iterables.get(stageOldNameAliasPair, 1); tableBuilder.put(Iterables.get(stageOldNamePair, 0), Iterables.get(stageOldNamePair, 1), alias); } return tableBuilder.build(); }

Target:
Table<String, String, String> getPerStageSelectedFields() { ImmutableTable.Builder<String, String, String> tableBuilder = new ImmutableTable.Builder<>(); if (Strings.isNullOrEmpty(selectedFields)) { throw new IllegalArgumentException("selectedFields can not be empty. Please provide at least 1 selectedFields"); } for (String selectedField : Splitter.on(',').trimResults().omitEmptyStrings().split(selectedFields)) { Iterable<String> stageOldNameAliasPair = Splitter.on(" as ").trimResults().omitEmptyStrings() .split(selectedField); Iterable<String> stageOldNamePair = Splitter.on('.').trimResults().omitEmptyStrings(). split(Iterables.get(stageOldNameAliasPair, 0)); if (Iterables.size(stageOldNameAliasPair) != 2) { throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } String alias = (Iterables.size(stageOldNameAliasPair) == 1) ? Iterables.get(stageOldNameAliasPair, 0) : Iterables.get(stageOldNameAliasPair, 1); tableBuilder.put(Iterables.get(stageOldNamePair, 0), Iterables.get(stageOldNamePair, 1), alias); } return tableBuilder.build(); }
Source:
public void testGetAllForStoragePoolWithPermissionsPrivilegedUser() { Guid storagePoolId = Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"); List<StorageDomain> result = dao.getAllForStoragePool(storagePoolId, PRIVILEGED_USER_ID, true); assertGetAllForStoragePoolResult(result, storagePoolId); }

Target:
public void testGetAllForStoragePoolWithPermissionsPrivilegedUser() { Guid storagePoolId = new Guid("6d849ebf-755f-4552-ad09-9a090cda105d"); List<StorageDomain> result = dao.getAllForStoragePool(storagePoolId, PRIVILEGED_USER_ID, true); assertGetAllForStoragePoolResult(result, storagePoolId); }
Source:
protected void configure() { bind(Props.class).toInstance(this.config.getProps()); bind(Storage.class).to(resolveStorageClassType()); bind(DatabaseOperator.class).to(DatabaseOperatorImpl.class); bind(TriggerLoader.class).to(JdbcTriggerImpl.class); bind(ProjectLoader.class).to(JdbcProjectImpl.class); bind(DataSource.class).to(AzkabanDataSource.class); bind(ExecutorLoader.class).to(JdbcExecutorLoader.class); bind(MetricRegistry.class).in(Scopes.SINGLETON); bind(ExecutorApiClient.class).in(Scopes.SINGLETON); }

Target:
protected void configure() { bind(Props.class).toInstance(this.config.getProps()); bind(Storage.class).to(resolveStorageClassType()); bind(DatabaseOperator.class).to(DatabaseOperatorImpl.class); bind(TriggerLoader.class).to(JdbcTriggerImpl.class); bind(ProjectLoader.class).to(JdbcProjectImpl.class); bind(DataSource.class).to(AzkabanDataSource.class); bind(ExecutorLoader.class).to(JdbcExecutorLoader.class); bind(MetricRegistry.class).in(Scopes.SINGLETON); }
Source:
public TaskRepository getTaskRepository() { if(this.taskRepository == null) { if(this.taskExecutionDaoFactoryBean == null) { this.taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(this.context); } this.taskRepository = new SimpleTaskRepository(this.taskExecutionDaoFactoryBean); } return this.taskRepository; }

Target:
public TaskRepository getTaskRepository() { return this.taskRepository; }
Source:
private Project.NameKey getProjectName(final File gitDir) { String relativeGitPath; try { relativeGitPath = getBasePath().getCanonicalFile().toURI().relativize(gitDir.getCanonicalFile().toURI()).getPath(); } catch (IOException e) { throw new RuntimeException(e); } if (!relativeGitPath.endsWith("/")) { relativeGitPath = relativeGitPath + "/"; } final String prefix = relativeGitPath.substring(0, relativeGitPath.length() - 1 - gitDir.getName().length()); return getProjectName(prefix, gitDir.getName()); }

Target:
private Project.NameKey getProjectName(final File gitDir) { String relativeGitPath = getBasePath().toURI().relativize(gitDir.toURI()).getPath(); if (!relativeGitPath.endsWith("/")) { relativeGitPath = relativeGitPath + "/"; } final String prefix = relativeGitPath.substring(0, relativeGitPath.length() - 1 - gitDir.getName().length()); return getProjectName(prefix, gitDir.getName()); }