auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TimestampSpec( @JsonProperty("column") String timestampColumn, @JsonProperty("format") String format, @JsonProperty("missingValue") DateTime missingValue, @JsonProperty("timeZone") String timeZone ) { this.timestampColumn = (timestampColumn == null) ? DEFAULT_COLUMN : timestampColumn; this.timestampFormat = format == null ? DEFAULT_FORMAT : format; this.timeZone = (StringUtils.isBlank(timeZone)) ? DateTimes.UTC_TIMEZONE : timeZone; this.timestampConverter = TimestampParser.createObjectTimestampParser(timestampFormat, this.timeZone); this.missingValue = missingValue == null ? DEFAULT_MISSING_VALUE : missingValue; }

Target:
public TimestampSpec( @JsonProperty("column") String timestampColumn, @JsonProperty("format") String format, @JsonProperty("missingValue") DateTime missingValue, @JsonProperty("timeZone") String timeZone ) { this.timestampColumn = (timestampColumn == null) ? DEFAULT_COLUMN : timestampColumn; this.timestampFormat = format == null ? DEFAULT_FORMAT : format; this.timeZone = StringUtils.isBlank(timeZone) ? DateTimes.UTC_TIMEZONE : timeZone; this.timestampConverter = TimestampParser.createObjectTimestampParser(timestampFormat, this.timeZone); this.missingValue = missingValue == null ? DEFAULT_MISSING_VALUE : missingValue; }
Source:
private void printTableScanInfo(TableScanNode node, int indent) { TableHandle table = node.getTable(); if (node.getLayout().isPresent()) { ConnectorTableLayoutHandle layout = node.getLayout().get().getConnectorHandle(); if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout); } } TupleDomain<ColumnHandle> predicate = node.getCurrentConstraint(); if (predicate.isNone()) { print(indent + 2, ":: NONE"); } else { for (Map.Entry<Symbol, ColumnHandle> assignment : node.getAssignments().entrySet()) { ColumnHandle column = assignment.getValue(); print(indent + 2, "%s := %s", assignment.getKey(), column); printConstraint(indent + 3, column, predicate); } if (!predicate.isAll()) { Set<ColumnHandle> outputs = ImmutableSet.copyOf(node.getAssignments().values()); predicate.getDomains().get() .entrySet().stream() .filter(entry -> !outputs.contains(entry.getKey())) .sorted(Comparator.comparing(o -> o.getKey().toString())) .forEach(entry -> { ColumnHandle column = entry.getKey(); print(indent + 2, "%s", column); printConstraint(indent + 3, column, predicate); }); } } }

Target:
private void printTableScanInfo(TableScanNode node, int indent) { TableHandle table = node.getTable(); if (node.getLayout().isPresent()) { ConnectorTableLayoutHandle layout = node.getLayout().get().getConnectorHandle(); if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout); } } TupleDomain<ColumnHandle> predicate = node.getCurrentConstraint(); if (predicate.isNone()) { print(indent + 2, ":: NONE"); } else { for (Map.Entry<Symbol, ColumnHandle> assignment : node.getAssignments().entrySet()) { ColumnHandle column = assignment.getValue(); print(indent + 2, "%s := %s", assignment.getKey(), column); printConstraint(indent + 3, column, predicate); } if (!predicate.isAll()) { Set<ColumnHandle> outputs = ImmutableSet.copyOf(node.getAssignments().values()); predicate.getDomains().get() .keySet().stream() .filter(entry -> !outputs.contains(entry)) .sorted(comparing(entry -> entry.toString())) .forEach(column -> { print(indent + 2, "%s", column); printConstraint(indent + 3, column, predicate); }); } } }
Source:
private Immutable(String uri) { _uri = uri; _scheme = null; _user = null; _host = null; _port = -1; _path = uri; _decodedPath = null; _param = null; _query = null; }

Target:
private Immutable(String uri) { _scheme = null; _user = null; _host = null; _port = -1; _path = uri; _param = null; _query = null; _fragment = null; _uri = uri; _decodedPath = null; }
Source:
public void setFocus() { if (treeViewerManager != null) { super.setFocus(); if (treeModel != null && treeModel.eIsProxy() && session != null) { IEditorInput editorInput = getEditorInput(); if (editorInput instanceof URIEditorInput) { URIEditorInput sessionEditorInput = (URIEditorInput) editorInput; final URI uri = sessionEditorInput.getURI(); setTreeModel(getDTree(uri, false)); IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session); if (uiSession != null && treeModel != null) { uiSession.detachEditor(this); uiSession.attachEditor(this); } } } } }

Target:
public void setFocus() { if (treeViewerManager != null) { super.setFocus(); if (treeModel != null && treeModel.eIsProxy() && session != null) { IEditorInput editorInput = getEditorInput(); if (editorInput instanceof URIEditorInput) { URIEditorInput sessionEditorInput = (URIEditorInput) editorInput; final URI uri = sessionEditorInput.getURI(); setTreeModel(getDTree(uri, false)); IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session); if (uiSession != null && treeModel != null) { uiSession.detachEditor(this); uiSession.attachEditor(this); } } } checkSemanticAssociation(); } }
Source:
public Object getBinJavaPath() { return new Object() { @Override public String toString() { return path() + ("mac".equals(platform()) ? "/Contents/Home" : "") + "/bin/java"; } }; }

Target:
public Object getBinJavaPath() { return new Object() { @Override public String toString() { return getJavaHome().getAbsolutePath() + "/bin/java"; } }; }
Source:
public boolean touch(URI uri) throws IOException { try { HeadObjectResponse s3ObjectMetadata = getS3ObjectMetadata(uri); String encodedUrl = null; try { encodedUrl = URLEncoder.encode(uri.getHost() + uri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String path = sanitizePath(uri.getPath()); Map<String, String> mp = new HashMap<>(); mp.put("lastModified", String.valueOf(System.currentTimeMillis())); CopyObjectRequest.Builder copyReqBuilder = CopyObjectRequest.builder().copySource(encodedUrl) .destinationBucket(uri.getHost()).destinationKey(path) .metadata(mp).metadataDirective(MetadataDirective.REPLACE); CopyObjectRequest request; if (!disableAcl) { request = copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build(); } else { request = copyReqBuilder.build(); } _s3Client.copyObject(request); long newUpdateTime = getS3ObjectMetadata(uri).lastModified().toEpochMilli(); return newUpdateTime > s3ObjectMetadata.lastModified().toEpochMilli(); } catch (NoSuchKeyException e) { String path = sanitizePath(uri.getPath()); PutObjectRequest.Builder putReqBuilder = PutObjectRequest.builder().bucket(uri.getHost()).key(path); PutObjectRequest putObjectRequest; if (!disableAcl) { putObjectRequest = putReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build(); } else { putObjectRequest = putReqBuilder.build(); } _s3Client.putObject(putObjectRequest, RequestBody.fromBytes(new byte[0])); return true; } catch (S3Exception e) { throw new IOException(e); } }

Target:
public boolean touch(URI uri) throws IOException { try { HeadObjectResponse s3ObjectMetadata = getS3ObjectMetadata(uri); String encodedUrl = null; try { encodedUrl = URLEncoder.encode(uri.getHost() + uri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String path = sanitizePath(uri.getPath()); Map<String, String> mp = new HashMap<>(); mp.put("lastModified", String.valueOf(System.currentTimeMillis())); CopyObjectRequest.Builder copyReqBuilder = CopyObjectRequest.builder().copySource(encodedUrl) .destinationBucket(uri.getHost()).destinationKey(path) .metadata(mp).metadataDirective(MetadataDirective.REPLACE); if (!disableAcl) { copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL); } CopyObjectRequest request = copyReqBuilder.build(); _s3Client.copyObject(request); long newUpdateTime = getS3ObjectMetadata(uri).lastModified().toEpochMilli(); return newUpdateTime > s3ObjectMetadata.lastModified().toEpochMilli(); } catch (NoSuchKeyException e) { String path = sanitizePath(uri.getPath()); PutObjectRequest.Builder putReqBuilder = PutObjectRequest.builder().bucket(uri.getHost()).key(path); if (!disableAcl) { putReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL); } PutObjectRequest putObjectRequest = putReqBuilder.build(); _s3Client.putObject(putObjectRequest, RequestBody.fromBytes(new byte[0])); return true; } catch (S3Exception e) { throw new IOException(e); } }
Source:
public void deletePost(Post post) { JCUser user = post.getUserCreated(); user.setPostCount(user.getPostCount() - 1); Topic topic = post.getTopic(); topic.removePost(post); Branch branch = topic.getBranch(); boolean deletedPostIsLastPostInBranch = branch.isLastPost(post); if (deletedPostIsLastPostInBranch) { branch.clearLastPost(); } topicDao.saveOrUpdate(topic); securityService.deleteFromAcl(post); Set<JCUser> topicSubscribers = new HashSet<>(topic.getSubscribers()); topicSubscribers.remove(user); notificationService.subscribedEntityChanged(topic, topicSubscribers); if (deletedPostIsLastPostInBranch) { branchLastPostService.refreshLastPostInBranch(branch); } logger.debug("Deleted post id={}", post.getId()); }

Target:
public void deletePost(Post post) { JCUser postCreator = post.getUserCreated(); postCreator.setPostCount(postCreator.getPostCount() - 1); Topic topic = post.getTopic(); topic.removePost(post); Branch branch = topic.getBranch(); boolean deletedPostIsLastPostInBranch = branch.isLastPost(post); if (deletedPostIsLastPostInBranch) { branch.clearLastPost(); } topicDao.saveOrUpdate(topic); securityService.deleteFromAcl(post); Set<JCUser> excludeFromNotification = new HashSet<>(topic.getSubscribers()); excludeFromNotification.remove(postCreator); notificationService.subscribedEntityChanged(topic, excludeFromNotification); if (deletedPostIsLastPostInBranch) { branchLastPostService.refreshLastPostInBranch(branch); } logger.debug("Deleted post id={}", post.getId()); }
Source:
public FileResponse(String u, Metadata md, FileProtocol fp) throws MalformedURLException, IOException { fileProtocol = fp; metadata = md; URL url = new URL(u); if (LOG.isTraceEnabled()) { LOG.trace("Fetching {}.",url.getPath()); } if (url.getPath() != url.getFile() && LOG.isWarnEnabled()) { LOG.warn("url.getPath() != url.getFile(): {}.",url); } String path = "".equals(url.getPath()) ? "/" : url.getPath(); File file=new File(URLDecoder.decode(path, fileProtocol.getEncoding())); if (!file.exists()) { statusCode = HttpStatus.SC_NOT_FOUND; } if (!file.canRead()) { statusCode = HttpStatus.SC_UNAUTHORIZED; } if (!file.equals(file.getCanonicalFile())) { metadata.setValue(HttpHeaders.LOCATION, file.getCanonicalFile().toURI().toURL().toString()); statusCode = HttpStatus.SC_MULTIPLE_CHOICES; } if (file.isDirectory()) { getDirAsHttpResponse(file); } else if (file.isFile()) { getFileAsHttpResponse(file); } else { statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } }

Target:
public FileResponse(String u, Metadata md, FileProtocol fp) throws MalformedURLException, IOException { fileProtocol = fp; metadata = md; URL url = new URL(u); if (!url.getPath().equals(url.getFile())) { LOG.warn("url.getPath() != url.getFile(): {}.", url); } String path = "".equals(url.getPath()) ? "/" : url.getPath(); File file = new File( URLDecoder.decode(path, fileProtocol.getEncoding())); if (!file.exists()) { statusCode = HttpStatus.SC_NOT_FOUND; return; } if (!file.canRead()) { statusCode = HttpStatus.SC_UNAUTHORIZED; return; } if (!file.equals(file.getCanonicalFile())) { metadata.setValue(HttpHeaders.LOCATION, file.getCanonicalFile() .toURI().toURL().toString()); statusCode = HttpStatus.SC_MULTIPLE_CHOICES; return; } if (file.isDirectory()) { getDirAsHttpResponse(file); } else if (file.isFile()) { getFileAsHttpResponse(file); } else { statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; return; } if (content == null) { content = new byte[0]; } }
Source:
public void testParentMessageIsCorrect() throws InterruptedException { Log.d("DEBUG", "hello"); MessageActivity messageActivity = getActivity(); EditText inputMessageField = (EditText) messageActivity.findViewById(R.id.inputMessageField); String input = "Mock comment"; onView(withId(R.id.inputMessageField)).perform(typeText(input)); onView(withId(R.id.sendButton)).perform(click()); Fragment fragment = messageActivity.getCurrentFragment(); ListView messageList = (ListView) fragment.getView().findViewById(R.id.groupMessageFragmentList); int tag = 0; messageList.getChildAt(0).setTag((Object) tag); View message = messageList.findViewWithTag((Object) tag); onView(withTagValue(is((Object) tag))).perform(click()); fragment = messageActivity.getCurrentFragment(); LinearLayout messageContainer = (LinearLayout) fragment.getView().findViewById(R.id.messageContainer); MessageView messageView = (MessageView) messageContainer.getChildAt(0); assertEquals("Mock comment", ((TextContent) messageView.getMessage().getContent()).getText()); }

Target:
public void testParentMessageIsCorrect() throws InterruptedException { MessageActivity messageActivity = getActivity(); EditText inputMessageField = (EditText) messageActivity.findViewById(R.id.inputMessageField); String input = "Mock comment"; onView(withId(R.id.inputMessageField)).perform(typeText(input)); onView(withId(R.id.sendButton)).perform(click()); Fragment fragment = messageActivity.getCurrentFragment(); ListView messageList = (ListView) fragment.getView().findViewById(R.id.groupMessageFragmentList); int tag = 0; messageList.getChildAt(0).setTag((Object) tag); View message = messageList.findViewWithTag((Object) tag); onView(withTagValue(is((Object) tag))).perform(click()); fragment = messageActivity.getCurrentFragment(); LinearLayout messageContainer = (LinearLayout) fragment.getView().findViewById(R.id.messageContainer); MessageView messageView = (MessageView) messageContainer.getChildAt(0); assertEquals("Mock comment", ((TextContent) messageView.getMessage().getContent()).getText()); }
Source:
@Override public Call<List<String>> getSpanNames(String serviceName) { if ("".equals(serviceName)) return Call.emptyList(); String q = String.format("SHOW TAG VALUES FROM \"%s\" with key=\"name\" WHERE \"service_name\" = '%s'", this.storage.measurement(), serviceName); Query query = new Query(q, this.storage.database()); QueryResult response = this.storage.get().query(query); if (response.hasError()){ throw new RuntimeException(response.getError()); } List<String> spans = new ArrayList<>(); List<QueryResult.Result> results = response.getResults(); if (results != null) { for (QueryResult.Result result : results) { if (result != null && result.getSeries() != null) { for (QueryResult.Series series : result.getSeries()) { for (List<Object> values : series.getValues()) { spans.add(values.get(1).toString()); } } } } } return Call.create(spans); }

Target:
@Override public Call<List<String>> getSpanNames(String serviceName) { if ("".equals(serviceName)) return Call.emptyList(); String q = String.format("SHOW TAG VALUES FROM \"%s\".\"%s\" with key=\"name\" WHERE \"remote_service_name\" = '%s' OR \"local_service_name\" = '%s'", this.storage.retentionPolicy(), this.storage.measurement(), serviceName.toLowerCase(), serviceName.toLowerCase()); Query query = new Query(q, this.storage.database()); QueryResult response = this.storage.get().query(query); if (response.hasError()){ throw new RuntimeException(response.getError()); } List<String> spans = new ArrayList<>(); List<QueryResult.Result> results = response.getResults(); if (results != null) { for (QueryResult.Result result : results) { if (result != null && result.getSeries() != null) { for (QueryResult.Series series : result.getSeries()) { for (List<Object> values : series.getValues()) { spans.add(values.get(1).toString()); } } } } } return Call.create(spans); }
Source:
public boolean match(ChangeData object) throws OrmException { final PatchSet patchSet = object.currentPatchSet(db); if (patchSet == null) { throw new OrmException("Unable to read patchset for " + object.getId()); } final RevId revision = patchSet.getRevision(); if (revision == null) { throw new OrmException("Unable to read revision for " + object.getId()); } final AnyObjectId objectId = ObjectId.fromString(revision.get()); if (objectId == null) { throw new OrmException("Unable to read objectId(SHA-1) for " + object.getId()); } Change change = object.change(db); if (change == null) { throw new OrmException("Unable to get change for " + object.getId()); } final Project.NameKey projectName = change.getProject(); if (projectName == null) { throw new OrmException("Unable to get projectName for " + object.getId()); } try { final Repository repo = repoManager.openRepository(projectName); try { final RevWalk rw = new RevWalk(repo); try { return match(repo, rw, objectId); } finally { rw.release(); } } finally { repo.close(); } } catch (RepositoryNotFoundException e) { log.error(projectName.get() + " does not denote an existing repository", e); } catch (IOException e) { log.error(projectName.get() + " cannot be read as a repository", e); } return false; }

Target:
public boolean match(ChangeData object) throws OrmException { final PatchSet patchSet = object.currentPatchSet(db); if (patchSet == null) { return false; } final RevId revision = patchSet.getRevision(); if (revision == null) { return false; } final AnyObjectId objectId = ObjectId.fromString(revision.get()); if (objectId == null) { return false; } Change change = object.change(db); if (change == null) { return false; } final Project.NameKey projectName = change.getProject(); if (projectName == null) { return false; } Arguments args = new Arguments(patchSet, revision, objectId, change, projectName); try { final Repository repo = repoManager.openRepository(projectName); try { final RevWalk rw = new RevWalk(repo); try { return match(repo, rw, args); } finally { rw.release(); } } finally { repo.close(); } } catch (RepositoryNotFoundException e) { log.error("Repository \"" + projectName.get() + "\" unknown.", e); } catch (IOException e) { log.error(projectName.get() + " cannot be read as a repository", e); } return false; }
Source:
public void openSignUpPage() { getUrl(Global.DOMAIN+"wiki/Special:UserSignup"); waitForElementByElement(blurryWordField); yearSelect = new Select(birthYearField); daySelect = new Select(birthDayField); monthSelect = new Select(birthMonthField); PageObjectLogging.log("openSignUpPage ", "Sign up page opened " +driver.getCurrentUrl(), true, driver); }

Target:
public void openSignUpPage() { getUrl(Global.DOMAIN+ URLsContent.specialUserSignup); yearSelect = new Select(birthYearField); daySelect = new Select(birthDayField); monthSelect = new Select(birthMonthField); PageObjectLogging.log( "openSignUpPage ", "Sign up page opened " +driver.getCurrentUrl(), true, driver ); }
Source:
static List<InetAddress> resolve(String host, ClientDnsLookup clientDnsLookup) throws UnknownHostException { InetAddress[] addresses = InetAddress.getAllByName(host); if (ClientDnsLookup.USE_FIRST_DNS_IP == clientDnsLookup) { return Collections.singletonList(addresses[0]); } else { return filterPreferredAddresses(addresses); } }

Target:
static List<InetAddress> resolve(String host, ClientDnsLookup clientDnsLookup) throws UnknownHostException { InetAddress[] addresses = InetAddress.getAllByName(host); switch (clientDnsLookup) { case DEFAULT: return Collections.singletonList(addresses[0]); case USE_ALL_DNS_IPS: case RESOLVE_CANONICAL_BOOTSTRAP_SERVERS_ONLY: return filterPreferredAddresses(addresses); } throw new IllegalStateException("Unhandled ClientDnsLookup instance: " + clientDnsLookup); }
Source:
public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); downloadPathVideoPreference = getString(R.string.download_path_video_key); downloadPathAudioPreference = getString(R.string.download_path_audio_key); storageUseSafPreference = getString(R.string.storage_use_saf); final String downloadStorageAsk = getString(R.string.downloads_storage_ask); prefPathVideo = findPreference(downloadPathVideoPreference); prefPathAudio = findPreference(downloadPathAudioPreference); prefStorageAsk = findPreference(downloadStorageAsk); final SwitchPreference prefUseSaf = findPreference(storageUseSafPreference); final boolean usingSaf = NewPipeSettings.useStorageAccessFramework(ctx); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { prefUseSaf.setDefaultValue(true); prefUseSaf.setChecked(usingSaf); } else { prefUseSaf.setDefaultValue(false); prefUseSaf.setChecked(usingSaf); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { prefUseSaf.setEnabled(false); } updatePreferencesSummary(); updatePathPickers(!defaultPreferences.getBoolean(downloadStorageAsk, false)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { prefStorageAsk.setSummary(R.string.downloads_storage_ask_summary); } if (hasInvalidPath(downloadPathVideoPreference) || hasInvalidPath(downloadPathAudioPreference)) { updatePreferencesSummary(); } prefStorageAsk.setOnPreferenceChangeListener((preference, value) -> { updatePathPickers(!(boolean) value); return true; }); }

Target:
public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); downloadPathVideoPreference = getString(R.string.download_path_video_key); downloadPathAudioPreference = getString(R.string.download_path_audio_key); storageUseSafPreference = getString(R.string.storage_use_saf); final String downloadStorageAsk = getString(R.string.downloads_storage_ask); prefPathVideo = findPreference(downloadPathVideoPreference); prefPathAudio = findPreference(downloadPathAudioPreference); prefStorageAsk = findPreference(downloadStorageAsk); final SwitchPreference prefUseSaf = findPreference(storageUseSafPreference); prefUseSaf.setDefaultValue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP); prefUseSaf.setChecked(NewPipeSettings.useStorageAccessFramework(ctx)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { prefUseSaf.setEnabled(false); } updatePreferencesSummary(); updatePathPickers(!defaultPreferences.getBoolean(downloadStorageAsk, false)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { prefStorageAsk.setSummary(R.string.downloads_storage_ask_summary); } if (hasInvalidPath(downloadPathVideoPreference) || hasInvalidPath(downloadPathAudioPreference)) { updatePreferencesSummary(); } prefStorageAsk.setOnPreferenceChangeListener((preference, value) -> { updatePathPickers(!(boolean) value); return true; }); }
Source:
public IAuthorizationPrincipal getPrincipalForEntity(Entity entity) { if (entity != null) { Class entityType; if (entity.getEntityType().equals(EntityEnum.GROUP.toString())) { entityType = IEntityGroup.class; } else { entityType = EntityEnum.getEntityEnum(entity.getEntityType()).getClazz(); } AuthorizationService authService = AuthorizationService.instance(); IAuthorizationPrincipal p = authService.newPrincipal(entity.getId(), entityType); return p; } return null; }

Target:
public IAuthorizationPrincipal getPrincipalForEntity(Entity entity) { if (entity == null) { return null; } Class entityType; if (entity.getEntityType().equals(EntityEnum.GROUP.toString())) { entityType = IEntityGroup.class; } else { entityType = EntityEnum.getEntityEnum(entity.getEntityType()).getClazz(); } AuthorizationService authService = AuthorizationService.instance(); IAuthorizationPrincipal p = authService.newPrincipal(entity.getId(), entityType); return p; }
Source:
public IRunnableWithProgress getRunnable() { return new WorkspaceModifyDelegatingOperation(imonitor -> { final Exception except[] = new Exception[1]; getShell().getDisplay().syncExec(() -> { IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> { SubMonitor subMonitor = SubMonitor.convert(monitor, 3); subMonitor.subTask(CUIPlugin.getResourceString(OP_DESC)); doRunPrologue(subMonitor.split(1)); try { doRun(subMonitor.split(1)); } catch (CoreException e) { except[0] = e; } doRunEpilogue(subMonitor.split(1)); }); try { getContainer().run(false, true, op); } catch (InvocationTargetException e1) { except[0] = e1; } catch (InterruptedException e2) { except[0] = e2; } }); if (except[0] != null) { if (except[0] instanceof InvocationTargetException) { throw (InvocationTargetException) except[0]; } if (except[0] instanceof InterruptedException) { throw (InterruptedException) except[0]; } throw new InvocationTargetException(except[0]); } }); }

Target:
public IRunnableWithProgress getRunnable() { return new WorkspaceModifyDelegatingOperation(imonitor -> { final Exception except[] = new Exception[1]; getShell().getDisplay().syncExec(() -> { IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> { SubMonitor subMonitor = SubMonitor.convert(monitor, CUIPlugin.getResourceString(OP_DESC), 3); doRunPrologue(subMonitor.split(1)); try { doRun(subMonitor.split(1)); } catch (CoreException e) { except[0] = e; } doRunEpilogue(subMonitor.split(1)); }); try { getContainer().run(false, true, op); } catch (InvocationTargetException e1) { except[0] = e1; } catch (InterruptedException e2) { except[0] = e2; } }); if (except[0] != null) { if (except[0] instanceof InvocationTargetException) { throw (InvocationTargetException) except[0]; } if (except[0] instanceof InterruptedException) { throw (InterruptedException) except[0]; } throw new InvocationTargetException(except[0]); } }); }
Source:
public DocTableInfo build() { DocIndexMetaData md = docIndexMetaData(); List<PartitionName> partitions = buildPartitions(md); Collection<Reference> sysColumns = buildSysColumns(); return new DocTableInfo( ident, md.columns(), sysColumns, md.partitionedByColumns(), md.generatedColumnReferences(), md.notNullColumns(), md.indices(), md.references(), md.analyzers(), md.primaryKey(), md.checkConstraints(), md.routingCol(), md.hasAutoGeneratedPrimaryKey(), concreteIndices, concreteOpenIndices, indexNameExpressionResolver, md.numberOfShards(), md.numberOfReplicas(), md.tableParameters(), md.partitionedBy(), partitions, md.columnPolicy(), md.versionCreated(), md.versionUpgraded(), md.isClosed(), md.supportedOperations()); }

Target:
public DocTableInfo build() { DocIndexMetaData md = docIndexMetaData(); List<PartitionName> partitions = buildPartitions(md); return new DocTableInfo( ident, md.columns(), md.partitionedByColumns(), md.generatedColumnReferences(), md.notNullColumns(), md.indices(), md.references(), md.analyzers(), md.primaryKey(), md.checkConstraints(), md.routingCol(), md.hasAutoGeneratedPrimaryKey(), concreteIndices, concreteOpenIndices, indexNameExpressionResolver, md.numberOfShards(), md.numberOfReplicas(), md.tableParameters(), md.partitionedBy(), partitions, md.columnPolicy(), md.versionCreated(), md.versionUpgraded(), md.isClosed(), md.supportedOperations()); }
Source:
private void preOrderPrint(PrintWriter writer, boolean printIntervals, HTNode currentNode, int curDepth) { writer.println(currentNode.toString()); if (printIntervals) { currentNode.debugPrintIntervals(writer); } switch (currentNode.getNodeType()) { case LEAF: return; case CORE: try { final CoreNode node = (CoreNode) currentNode; int extension = node.getExtensionSequenceNumber(); while (extension != -1) { HTNode nextNode = treeIO.readNode(extension); preOrderPrint(writer, printIntervals, nextNode, curDepth); } for (int i = 0; i < node.getNbChildren(); i++) { HTNode nextNode = treeIO.readNode(node.getChild(i)); for (int j = 0; j < curDepth; j++) { writer.print(" "); } writer.print("+-"); preOrderPrint(writer, printIntervals, nextNode, curDepth + 1); } } catch (ClosedChannelException e) { e.printStackTrace(); } break; default: break; } }

Target:
private void preOrderPrint(PrintWriter writer, boolean printIntervals, HTNode currentNode, int curDepth) { writer.println(currentNode.toString()); if (printIntervals) { currentNode.debugPrintIntervals(writer); } switch (currentNode.getNodeType()) { case LEAF: return; case CORE: try { final CoreNode node = (CoreNode) currentNode; int extension = node.getExtensionSequenceNumber(); while (extension != -1) { HTNode nextNode = treeIO.readNode(extension); preOrderPrint(writer, printIntervals, nextNode, curDepth); } for (int i = 0; i < node.getNbChildren(); i++) { HTNode nextNode = treeIO.readNode(node.getChild(i)); for (int j = 0; j < curDepth; j++) { writer.print(" "); } writer.print("+-"); preOrderPrint(writer, printIntervals, nextNode, curDepth + 1); } } catch (ClosedChannelException e) { Activator.logError(e.getMessage()); } break; default: break; } }
Source:
synchronized Map<String, Double> getTimeLatAvg(long now) { Map<String, Double> ret = new ConcurrentHashMap<>(); long lat; long count; synchronized (currentLock) { lat = currentLatBucket; count = currentCountBucket; } long timeSpent = now - bucketStart; ret.put("600", readApproximateLatAvg(lat, count, timeSpent, tmTime, tmLatBuckets, tmCountBuckets, 600 * 1000)); ret.put("10800", readApproximateLatAvg(lat, count, timeSpent, thTime, thLatBuckets, thCountBuckets, 10800 * 1000)); ret.put("86400", readApproximateLatAvg(lat, count, timeSpent, odTime, odLatBuckets, odCountBuckets, 86400 * 1000)); long allTimeCountSum = count + allTimeCount; ret.put(":all-time", Utils.zeroIfNaNOrInf( (double) lat + allTimeLat) / allTimeCountSum); return ret; }

Target:
synchronized Map<String, Double> getTimeLatAvg(long now) { Map<String, Double> ret = new HashMap<>(); long lat; long count; synchronized (currentLock) { lat = currentLatBucket; count = currentCountBucket; } long timeSpent = now - bucketStart; ret.put("600", readApproximateLatAvg(lat, count, timeSpent, tmTime, tmLatBuckets, tmCountBuckets, 600 * 1000)); ret.put("10800", readApproximateLatAvg(lat, count, timeSpent, thTime, thLatBuckets, thCountBuckets, 10800 * 1000)); ret.put("86400", readApproximateLatAvg(lat, count, timeSpent, odTime, odLatBuckets, odCountBuckets, 86400 * 1000)); long allTimeCountSum = count + allTimeCount; ret.put(":all-time", Utils.zeroIfNaNOrInf( (double) lat + allTimeLat) / allTimeCountSum); return ret; }
Source:
public void testMigrateUpdateRequest() throws Exception { Result result = mock(Result.class); Metacard workspace = getWorkspaceMetacard("workspaceId"); doReturn(workspace).when(result).getMetacard(); doReturn(Collections.singletonList(result)).when(queryResponse).getResults(); ArgumentCaptor<UpdateRequest> updateRequestArgumentCaptor = ArgumentCaptor.forClass(UpdateRequest.class); workspaceQueryMigration.migrateWorkspaces(); verify(catalogFramework, times(1)).update(updateRequestArgumentCaptor.capture()); UpdateRequest actualUpdateRequest = updateRequestArgumentCaptor.getValue(); Metacard updateMetacard = actualUpdateRequest.getUpdates().get(0).getValue(); assertThat(actualUpdateRequest.getUpdates().get(0).getKey(), is("workspaceId")); assertThat( updateMetacard.getAttribute(WORKSPACE_QUERIES).getValues(), is(ImmutableList.of("queryId1", "queryId2"))); }

Target:
public void testMigrateUpdateRequest() throws Exception { ArgumentCaptor<UpdateRequest> updateRequestArgumentCaptor = ArgumentCaptor.forClass(UpdateRequest.class); workspaceQueryMigration.migrate(); verify(catalogFramework, times(1)).update(updateRequestArgumentCaptor.capture()); UpdateRequest actualUpdateRequest = updateRequestArgumentCaptor.getValue(); Metacard updateMetacard = actualUpdateRequest.getUpdates().get(0).getValue(); assertThat(actualUpdateRequest.getUpdates().get(0).getKey(), is(WORKSPACE_ID)); assertThat( updateMetacard.getAttribute(WORKSPACE_QUERIES).getValues(), is(ImmutableList.of("queryId1", "queryId2"))); }
Source:
public void createPartControl(@Nullable Composite parent) { super.createPartControl(parent); String name = getViewSite().getSecondaryId(); if (name != null) { fViewInfo.setName(name); } setViewTitle(); }

Target:
public void createPartControl(@Nullable Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { fViewInfo.setName(name); } super.createPartControl(parent); setViewTitle(); }
Source:
public void testWorkflowDAGCWLRequirementMap() throws ApiException { final List<String> strings = getJSON("DockstoreTestUser2/SnapTools", "/snaptools_create_snap_file.cwl", "cwl", "feature/docker_cwl_req_in_main"); int countNode = countNodeInJSON(strings); Assert.assertTrue("JSON should not be blank", strings.size() > 0); Assert.assertEquals("JSON should have eight nodes (including start and end)", countNode, 8); Assert.assertTrue("node data should have snaptools_preprocess_reads as tool", strings.get(0).contains("snaptools_preprocess_reads")); Assert.assertTrue("node data should have snaptools_create_ref_genome_size_file as tool", strings.get(0).contains("snaptools_create_ref_genome_size_file")); Assert.assertTrue("edge should connect snaptools_preprocess_reads and snaptools_create_ref_genome_size_file", strings.get(0).contains("\"source\":\"dockstore_snaptools_create_ref_genome_size_file\",\"target\":\"dockstore_snaptools_preprocess_reads\"")); }

Target:
public void testWorkflowDAGCWLRequirementMap() throws ApiException { final List<String> strings = getJSON("DockstoreTestUser2/SnapTools", "/snaptools_create_snap_file.cwl", DescriptorLanguage.CWL.getShortName(), "feature/docker_cwl_req_in_main"); int countNode = countNodeInJSON(strings); Assert.assertTrue("JSON should not be blank", strings.size() > 0); Assert.assertEquals("JSON should have eight nodes (including start and end)", 8, countNode); Assert.assertTrue("node data should have snaptools_preprocess_reads as tool", strings.get(0).contains("snaptools_preprocess_reads")); Assert.assertTrue("node data should have snaptools_create_ref_genome_size_file as tool", strings.get(0).contains("snaptools_create_ref_genome_size_file")); Assert.assertTrue("edge should connect snaptools_preprocess_reads and snaptools_create_ref_genome_size_file", strings.get(0).contains("\"source\":\"dockstore_snaptools_create_ref_genome_size_file\",\"target\":\"dockstore_snaptools_preprocess_reads\"")); }
Source:
protected boolean checkExistingStorageDomain() { if (storageDomainStaticDao.get(getStorageDomain().getId()) != null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST); } Pair<StorageDomainStatic, Guid> domainFromIrs = executeHSMGetStorageDomainInfo( new HSMGetStorageDomainInfoVDSCommandParameters(getVdsId(), getStorageDomain().getId())); if (domainFromIrs == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } if (!concreteCheckExistingStorageDomain(domainFromIrs)) { return false; } initStorageDomainProperties(domainFromIrs); if (isStorageWithSameNameExists()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } return true; }

Target:
protected boolean checkExistingStorageDomain() { if (storageDomainStaticDao.get(getStorageDomain().getId()) != null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST); } Pair<StorageDomainStatic, Guid> domainFromIrs = executeHSMGetStorageDomainInfo( new HSMGetStorageDomainInfoVDSCommandParameters(getVdsId(), getStorageDomain().getId())); if (domainFromIrs == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } if (!concreteCheckExistingStorageDomain(domainFromIrs)) { return false; } initStorageDomainProperties(domainFromIrs); return true; }
Source:
public ResponseEntity<?> exposeSingleEventType(@PathVariable final String name, final NativeWebRequest nativeWebRequest) { try { final EventType eventType = repository.findByName(name); return status(HttpStatus.OK).body(eventType); } catch (NoSuchEventTypeException e) { LOG.debug("Could not find EventType: " + name); return create(Problem.valueOf(NOT_FOUND, "EventType '" + name + "' does not exist."), nativeWebRequest); } }

Target:
public ResponseEntity<?> exposeSingleEventType(@PathVariable final String name, final NativeWebRequest nativeWebRequest) { try { final EventType eventType = repository.findByName(name); return status(HttpStatus.OK).body(eventType); } catch (NoSuchEventTypeException e) { LOG.debug("Could not find EventType: {}", name); return create(Problem.valueOf(NOT_FOUND, "EventType '" + name + "' does not exist."), nativeWebRequest); } }
Source:
public void removeNodeToken(String nodeUrl, String token) throws RMException { if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.removeToken(token); } else { throw new RMException("Unkonwn node " + nodeUrl); } }

Target:
public void removeNodeToken(String nodeUrl, String token) throws RMException { if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); checkNodeAdminPermission(rmNode, caller); rmNode.removeToken(token); } else { throw new RMException("Unknown node " + nodeUrl); } }
Source:
public static CalledStringFunction create(long start, long end, int depth, String value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledStringFunction(start, end, value, depth, parent); }

Target:
protected static CalledStringFunction create(long start, long end, int depth, String value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledStringFunction(start, end, value, depth, parent); }
Source:
public LocalStoreUnavailableException() { super(new StringBuilder().append("Local storage seems unavailable.") .append(System.lineSeparator()) .append("Local storage available: ") .append(Gdx.files.isLocalStorageAvailable()) .append(System.lineSeparator()) .append("Local storage path: ") .append(Gdx.files.getLocalStoragePath()) .toString()); }

Target:
public LocalStoreUnavailableException() { super(new StringBuilder().append("Local storage seems unavailable.") .append(System.lineSeparator()) .append("Local storage path: ") .append(Gdx.files.getLocalStoragePath()) .toString()); }
Source:
private void batchData() { TreeSet<Data> batchData; long startBatching; synchronized (pendingData) { startBatching = System.currentTimeMillis(); batchData = pendingData; pendingData = new TreeSet<>(); Data previousData = null; for (Iterator<Data> i = batchData.iterator(); i.hasNext();) { Data d = i.next(); if (null == previousData || !(d.getId().equals(previousData.getId()) && d.getTenantId().equals(previousData.getTenantId()))) { previousData = d; } else { i.remove(); if ((d.getTimestamp() - previousData.getTimestamp()) < minReportingInterval) { log.tracef("MinReportingInterval violation, prev: %s, removed: %s", previousData, d); } else { pendingData.add(d); log.tracef("Deferring data, keep: %s, defer: %s", previousData, d); } } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%d] Datum(s) to next firing !!", pendingData.size()); } } batchData.stream().forEach(d -> kSession.insert(d)); long batchingTime = System.currentTimeMillis() - startBatching; log.debugf("Batching Data [%s] took [%s]", batchData.size(), batchingTime); if (batchingTime > PERF_BATCHING_THRESHOLD) { log.warnf("Batching Data [%s] took [%s] ms exceeding [%s] ms", batchData.size(), batchingTime, PERF_BATCHING_THRESHOLD); } }

Target:
private void batchData() { long startBatching = System.currentTimeMillis(); TreeSet<Data> batchData = pendingData; pendingData = new TreeSet<>(); Data previousData = null; for (Iterator<Data> i = batchData.iterator(); i.hasNext();) { Data d = i.next(); if (!d.same(previousData)) { previousData = d; kSession.insert(d); } else { if ((d.getTimestamp() - previousData.getTimestamp()) < minReportingInterval) { log.tracef("MinReportingInterval violation, prev: %s, removed: %s", previousData, d); } else { pendingData.add(d); log.tracef("Deferring data, keep: %s, defer: %s", previousData, d); } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%d] Datum(s) to next firing !!", pendingData.size()); } } long batchingTime = System.currentTimeMillis() - startBatching; log.debugf("Batching Data [%s] took [%s]", batchData.size(), batchingTime); if (batchingTime > PERF_BATCHING_THRESHOLD) { log.warnf("Batching Data [%s] took [%s] ms exceeding [%s] ms", batchData.size(), batchingTime, PERF_BATCHING_THRESHOLD); } }
Source:
public Response handle(Request request) { try { return this.handleAsync(request).get(); } catch (InterruptedException | ExecutionException ex) { throw new RuntimeException(ex); } }

Target:
public Response handle(Request request) { try { return this.handleAsync(request).get(); } catch (InterruptedException | ExecutionException ex) { throw Throwables.propagate(ex); } }
Source:
protected boolean validateExtensionElement(IConfigurationElement element) { final boolean valid; if (TAG_PROCESSOR.equals(element.getName())) { IConfigurationElement[] nsURIChildren = element.getChildren(TAG_NS_URI); IConfigurationElement[] resourceURIChildren = element.getChildren(TAG_RESOURCE_URI); if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); valid = false; } else if (element.getAttribute(ATT_ORDINAL) == null) { String ordinalStr = element.getAttribute(ATT_ORDINAL); try { Integer.parseInt(ordinalStr); } catch (NumberFormatException nfe) { log(IStatus.ERROR, element, EMFCompareRCPMessages.getString( "malformed.extension.attribute", ATT_ORDINAL)); } logMissingAttribute(element, ATT_ORDINAL); valid = false; } else if (nsURIChildren.length > 0) { if (nsURIChildren[0].getAttribute(ATT_VALUE) == null) { logMissingAttribute(nsURIChildren[0], ATT_VALUE); valid = false; } else { valid = true; } } else if (resourceURIChildren.length > 0) { if (resourceURIChildren[0].getAttribute(ATT_VALUE) == null) { logMissingAttribute(resourceURIChildren[0], ATT_VALUE); valid = false; } else { valid = true; } } else { log(IStatus.ERROR, element, "Post processor must have an nsURI or a resource URI"); valid = false; } } else { valid = false; } return valid; }

Target:
protected boolean validateExtensionElement(IConfigurationElement element) { final boolean valid; if (TAG_PROCESSOR.equals(element.getName())) { IConfigurationElement[] nsURIChildren = element.getChildren(TAG_NS_URI); IConfigurationElement[] resourceURIChildren = element.getChildren(TAG_RESOURCE_URI); if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); valid = false; } else if (element.getAttribute(ATT_ORDINAL) == null) { logMissingAttribute(element, ATT_ORDINAL); valid = false; } else if (element.getAttribute(ATT_ORDINAL) != null) { String ordinalStr = element.getAttribute(ATT_ORDINAL); try { Integer.parseInt(ordinalStr); } catch (NumberFormatException nfe) { log(IStatus.ERROR, element, EMFCompareRCPMessages.getString( "malformed.extension.attribute", ATT_ORDINAL)); return false; } valid = true; } else if (nsURIChildren.length > 0) { if (nsURIChildren[0].getAttribute(ATT_VALUE) == null) { logMissingAttribute(nsURIChildren[0], ATT_VALUE); valid = false; } else { valid = true; } } else if (resourceURIChildren.length > 0) { if (resourceURIChildren[0].getAttribute(ATT_VALUE) == null) { logMissingAttribute(resourceURIChildren[0], ATT_VALUE); valid = false; } else { valid = true; } } else { log(IStatus.ERROR, element, "Post processor must have an nsURI or a resource URI"); valid = false; } } else { valid = false; } return valid; }
Source:
private void determineExcessEntitlements(Pool pool) { List<Pool> pools = new ArrayList<Pool>(); pools.add(pool); pools.addAll(sharedPools.get(pool)); List<Entitlement> freeEntitlements = this.poolCurator.retrieveOrderedEntitlementsOf(pools); long existing = pool.getQuantity(); for (Entitlement ent : freeEntitlements) { if (newConsumed > existing) { if (!ent.getConsumer().isShare()) { if (ent.getPool().getType().equals(Pool.PoolType.SHARE_DERIVED)) { Entitlement source = ent.getPool().getSourceEntitlement(); if (entitlementsToAdjust.get(source) == null) { addEntitlementToAdjust(source, source.getQuantity()); } addEntitlementToAdjust(source, entitlementsToAdjust.get(source) - ent.getQuantity()); } addEntitlementToRevoke(ent); newConsumed -= ent.getQuantity(); } } } }

Target:
private void determineExcessEntitlements(Pool pool) { List<Pool> pools = new ArrayList<Pool>(); pools.add(pool); if (sharedPools.get(pool) != null) { pools.addAll(sharedPools.get(pool)); } List<Entitlement> entitlements = this.poolCurator.retrieveOrderedEntitlementsOf(pools); long newConsumed = poolNewConsumed.get(pool); long existing = pool.getQuantity(); for (Entitlement ent : entitlements) { if (newConsumed > existing) { if (!ent.getConsumer().isShare()) { if (ent.getPool().getType().equals(Pool.PoolType.SHARE_DERIVED)) { Entitlement source = ent.getPool().getSourceEntitlement(); if (shareEntitlementsToAdjust.get(source) == null) { addEntitlementToAdjust(source, source.getQuantity()); } addEntitlementToAdjust(source, shareEntitlementsToAdjust.get(source) - ent.getQuantity()); if (shareEntitlementsToAdjust.get(source) == 0) { shareEntitlementsToAdjust.remove(source); addEntitlmentToRevoke(source); } } addEntitlementToRevoke(ent); newConsumed -= ent.getQuantity(); } } } poolNewConsumed.put(pool, newConsumed); }
Source:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); VersioningConfiguration config = minioClient.getBucketVersioning( GetBucketVersioningArgs.builder().bucket("my-bucketname").build()); if (config.status() == VersioningConfiguration.Status.OFF) { System.out.println("Versioning on bucket 'my-bucketname' is not enabled"); } else if (config.status() == VersioningConfiguration.Status.ENABLED) { System.out.println("Versioning on bucket 'my-bucketname' is enabled"); } else if (config.status() == VersioningConfiguration.Status.SUSPENDED) { System.out.println("Versioning on bucket 'my-bucketname' is suspended"); } } catch (MinioException e) { System.out.println("Error occurred: " + e); } }

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); VersioningConfiguration config = minioClient.getBucketVersioning( GetBucketVersioningArgs.builder().bucket("my-bucketname").build()); System.out.println("Versioning on bucket 'my-bucketname' is " + config.status()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
public void testSendDateForDisplay() { validAdminEmailAttributesObject.sendDate = Instant.now(); String expectedDate = TimeHelper.formatTime12H(formatDateForAdminEmailAttributesTest( validAdminEmailAttributesObject.sendDate)); String actualDate = validAdminEmailAttributesObject.getSendDateForDisplay(); assertEquals(expectedDate, actualDate); }

Target:
public void testSendDateForDisplay() { validAdminEmailAttributesObject.sendDate = Instant.now(); String expectedDate = TimeHelper.formatTime12H(convertToAdminTime(validAdminEmailAttributesObject.sendDate)); String actualDate = validAdminEmailAttributesObject.getSendDateForDisplay(); assertEquals(expectedDate, actualDate); }
Source:
public void testUnknownMigration() { assertEquals(null, migrationService.getMigration("fake")); }

Target:
public void testUnknownMigration() { assertNull(migrationService.getMigration("fake")); }
Source:
private void triggerConfigure() { String source = (String) sourceComboBox.getSelectedItem(); if (source.equals(SOURCE_AGGREGATE)) { AggregateServerConnectionDialog dialog = AggregateServerConnectionDialog.empty(__ -> true); dialog.onConnect(this::triggerAggregateConnection); dialog.getForm().setVisible(true); } else if (source.equals(SOURCE_CUSTOM_DIR)) { WrappedFileChooser fc = new WrappedFileChooser(SourceSelectPanelForm.this, new ODKCollectFileChooser(SourceSelectPanelForm.this)); int retVal = fc.showDialog(); if (retVal == JFileChooser.APPROVE_OPTION) triggerCustomDirSource(Paths.get(fc.getSelectedFile().getAbsolutePath())); } }

Target:
private void triggerConfigure() { Optional .ofNullable((Source<?>) sourceComboBox.getSelectedItem()) .ifPresent(source -> { if (source.equals(Source.AGGREGATE)) Source.AGGREGATE.onSelect(container, this::triggerAggregateConnection); if (source.equals(Source.CUSTOM_DIR)) Source.CUSTOM_DIR.onSelect(container, this::triggerCustomDirSource); }); }