auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Node visitWindowSpecification(SqlBaseParser.WindowSpecificationContext context) { return new WindowSpecification( getLocation(context), Optional.ofNullable(context.identifier()).map(i -> (Identifier) visit(i)), visit(context.partition, Expression.class), visit(context.sortItem(), SortItem.class), visitIfPresent(context.windowFrame(), WindowFrame.class)); }

Target:
public Node visitWindowSpecification(SqlBaseParser.WindowSpecificationContext context) { return new WindowSpecification( getLocation(context), Optional.ofNullable(context.identifier()).map(identifier -> (Identifier) visit(identifier)), visit(context.partition, Expression.class), visit(context.sortItem(), SortItem.class), visitIfPresent(context.windowFrame(), WindowFrame.class)); }
Source:
public void objectOutputStreamBuilder_Test() throws IOException, URISyntaxException { final Ds3Object obj = new Ds3Object(OBJ_NAME, OBJ_BYTES.length); final Ds3ClientHelpers.Job job = HELPERS.startReadJob(BUCKET_NAME, Lists.newArrayList(obj)); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); job.transfer(new ObjectOutputStreamBuilder() { @Override public OutputStream buildOutputStream(String key) throws IOException { return stream; } }); assertThat(stream.toByteArray(), is(OBJ_BYTES)); }

Target:
public void objectOutputStreamBuilder_Test() throws IOException, URISyntaxException { final Ds3Object obj = new Ds3Object(OBJ_NAME, OBJ_BYTES.length); final Ds3ClientHelpers.Job job = HELPERS.startReadJob(BUCKET_NAME, Lists.newArrayList(obj)); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); job.transfer(new ObjectOutputStreamBuilder() { @Override public OutputStream buildOutputStream(final String key) throws IOException { return stream; } }); assertThat(stream.toByteArray(), is(OBJ_BYTES)); }
Source:
public void onCreated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (Object event1 : events) { CacheEntryEvent event = (CacheEntryEvent) event1; Assert.assertEquals(EventType.CREATED, event.getEventType()); this.created.incrementAndGet(); event.getKey(); event.getValue(); event.getSource(); } }

Target:
public void onCreated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends K, ? extends V> event : events) { Assert.assertEquals(EventType.CREATED, event.getEventType()); this.created.incrementAndGet(); } }
Source:
public void testParameters() throws Exception { FreeStyleProject other = createArtifactProject(), p = createProject("${PROJSRC}", null, "${BASE}/*.txt", "${TARGET}/bar", false, false, false, true); ParameterDefinition paramDef = new StringParameterDefinition("PROJSRC",other.getName(), ""); ParameterDefinition paramDef2 = new StringParameterDefinition("BASE","",""); ParameterDefinition paramDef3 = new StringParameterDefinition("TARGET","foo",""); ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef, paramDef2,paramDef3); p.addProperty(paramsDef); CopyArtifactPermissionProperty cpp=new CopyArtifactPermissionProperty("/"+p.getName()); other.addProperty(cpp); rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get()); FreeStyleBuild b = p.scheduleBuild2(0, new UserCause(), new ParametersAction(new StringParameterValue("PROJSRC", other.getName()), new StringParameterValue("BASE", "*r"), new StringParameterValue("TARGET", "foo"))).get(); rule.assertBuildStatusSuccess(b); assertFile(false, "foo/bar/foo.txt", b); assertFile(true, "foo/bar/subdir/subfoo.txt", b); }

Target:
public void testParameters() throws Exception { FreeStyleProject other = createArtifactProject(), p = createProject("$PROJSRC", null, "$BASE/*.txt", "$TARGET/bar", false, false, false, true); ParameterDefinition paramDef = new StringParameterDefinition("PROJSRC", other.getName(), ""); ParameterDefinition paramDef2 = new StringParameterDefinition("BASE", "", ""); ParameterDefinition paramDef3 = new StringParameterDefinition("TARGET", "foo", ""); ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef, paramDef2, paramDef3); p.addProperty(paramsDef); rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause()).get()); FreeStyleBuild b = p.scheduleBuild2(0, new UserCause(), new ParametersAction(new StringParameterValue("PROJSRC", other.getName()), new StringParameterValue("BASE", "*r"), new StringParameterValue("TARGET", "foo"))).get(); rule.assertBuildStatusSuccess(b); assertFile(false, "foo/bar/foo.txt", b); assertFile(true, "foo/bar/subdir/subfoo.txt", b); }
Source:
public boolean contains(final String name) { try { return !new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath(String.format("/page/rules/rule[name='%s']", name)) .isEmpty(); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public boolean contains(final String name) { try { return !new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath(String.format("/page/rules/rule[name='%s']", name)) .isEmpty(); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public void validateSortedEncodedKeyComponents( Double lhs, Double rhs, Indexed<Double> lhsEncodings, Indexed<Double> rhsEncodings ) throws SegmentValidationException { if (!lhs.equals(rhs)) { throw new SegmentValidationException("Dim [%s] value not equal. Expected [%s] found [%s]", lhs, rhs); } }

Target:
public void validateSortedEncodedKeyComponents( Double lhs, Double rhs, Indexed<Double> lhsEncodings, Indexed<Double> rhsEncodings ) throws SegmentValidationException { if (!lhs.equals(rhs)) { throw new SegmentValidationException( "Dim [%s] value not equal. Expected [%s] found [%s]", dimensionName, lhs, rhs ); } }
Source:
private boolean checkRealmListType(VariableElement field) { if (Utils.getGenericTypeQualifiedName(field) == null) { Utils.error("No generic type supplied for field", field); return false; } TypeMirror fieldType = field.asType(); final TypeMirror elementTypeMirror = ((DeclaredType) fieldType).getTypeArguments().get(0); if (elementTypeMirror.getKind() == TypeKind.DECLARED ) { TypeElement elementTypeElement = (TypeElement) ((DeclaredType) elementTypeMirror).asElement(); if (elementTypeElement.getSuperclass().getKind() == TypeKind.NONE) { Utils.error( "Only concrete Realm classes are allowed in RealmLists. " + "Neither interfaces nor abstract classes are allowed.", field); return false; } } if (!validListValueTypes.contains(elementTypeMirror) && !Utils.isRealmModel(elementTypeMirror)) { final StringBuilder messageBuilder = new StringBuilder( "Element type of RealmList must be a class implementing 'RealmModel' or one of the "); for (TypeMirror type : validListValueTypes) { messageBuilder.append('\'').append(type.toString()).append("', "); } messageBuilder.setLength(messageBuilder.length() - ", ".length()); messageBuilder.append('.'); Utils.error(messageBuilder.toString(), field); return false; } return true; }

Target:
private boolean checkRealmListType(VariableElement field) { if (Utils.getGenericTypeQualifiedName(field) == null) { Utils.error("No generic type supplied for field", field); return false; } TypeMirror fieldType = field.asType(); final TypeMirror elementTypeMirror = ((DeclaredType) fieldType).getTypeArguments().get(0); if (elementTypeMirror.getKind() == TypeKind.DECLARED ) { TypeElement elementTypeElement = (TypeElement) ((DeclaredType) elementTypeMirror).asElement(); if (elementTypeElement.getSuperclass().getKind() == TypeKind.NONE) { Utils.error( "Only concrete Realm classes are allowed in RealmLists. " + "Neither interfaces nor abstract classes are allowed.", field); return false; } } if (!validListValueTypes.contains(elementTypeMirror) && !Utils.isRealmModel(elementTypeMirror)) { final StringBuilder messageBuilder = new StringBuilder( "Element type of RealmList must be a class implementing 'RealmModel' or one of the "); final String separator = ", "; for (TypeMirror type : validListValueTypes) { messageBuilder.append('\'').append(type.toString()).append('\'').append(separator); } messageBuilder.setLength(messageBuilder.length() - separator.length()); messageBuilder.append('.'); Utils.error(messageBuilder.toString(), field); return false; } return true; }
Source:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { RepositoryResponse response = null; Gist gist = new Gist(); GitHubClient client = GistConnector.createClient(repository); AuthenticationCredentials credentials = repository .getCredentials(AuthenticationType.REPOSITORY); if (credentials != null) { client.setCredentials(credentials.getUserName(), credentials.getPassword()); } GistService service = new GistService(client); TaskAttribute root = taskData.getRoot(); gist.setId(taskData.getTaskId()); gist.setDescription(root.getAttribute( GistAttribute.DESCRIPTION.getMetadata().getId()).getValue()); if (taskData.isNew()) { try { gist = service.createGist(gist); } catch (IOException e) { throw new CoreException(GitHub.createWrappedStatus(e)); } response = new RepositoryResponse(ResponseKind.TASK_CREATED, gist.getId()); } else { try { String newComment = root.getAttribute( GistAttribute.COMMENT_NEW.getMetadata().getId()) .getValue(); if (newComment.length() > 0) service.createComment(taskData.getTaskId(), newComment); String author = GistAttribute.AUTHOR.getMetadata().getValue( taskData); if (isOwner(repository, author)) service.updateGist(gist); } catch (IOException e) { throw new CoreException(GitHub.createWrappedStatus(e)); } response = new RepositoryResponse(ResponseKind.TASK_UPDATED, taskData.getTaskId()); } return response; }

Target:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { RepositoryResponse response = null; Gist gist = new Gist(); GitHubClient client = GistConnector.createClient(repository); AuthenticationCredentials credentials = repository .getCredentials(AuthenticationType.REPOSITORY); if (credentials != null) { client.setCredentials(credentials.getUserName(), credentials.getPassword()); } gist.setOwner(new User().setLogin(credentials.getUserName())); GistService service = new GistService(client); TaskAttribute root = taskData.getRoot(); gist.setId(taskData.getTaskId()); gist.setDescription(root.getAttribute( GistAttribute.DESCRIPTION.getMetadata().getId()).getValue()); if (taskData.isNew()) { try { gist = service.createGist(gist); } catch (IOException e) { throw new CoreException(GitHub.createWrappedStatus(e)); } response = new RepositoryResponse(ResponseKind.TASK_CREATED, gist.getId()); } else { try { String newComment = root.getAttribute( GistAttribute.COMMENT_NEW.getMetadata().getId()) .getValue(); if (newComment.length() > 0) service.createComment(taskData.getTaskId(), newComment); String author = GistAttribute.AUTHOR.getMetadata().getValue( taskData); if (isOwner(repository, author)) service.updateGist(gist); } catch (IOException e) { throw new CoreException(GitHub.createWrappedStatus(e)); } response = new RepositoryResponse(ResponseKind.TASK_UPDATED, taskData.getTaskId()); } return response; }
Source:
public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); ResponseData responseData = this.responseDataRespository.findByCorrelationUid(correlationUid); final int maxtime = this.waitFailMillis; final int timeout = this.waitCheckIntervalMillis; for (int delayedtime = 0; delayedtime < maxtime; delayedtime += timeout) { try { Thread.sleep(timeout); } catch (final InterruptedException e) { LOGGER.error("Thread sleep interrupted ", e.getMessage()); break; } responseData = this.responseDataRespository.findByCorrelationUid(correlationUid); if (settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT) .equals(responseData.getNumberOfNotificationsSent().toString())) { break; } } assertEquals("NumberOfNotificationsSent is not as expected", settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT), responseData.getNumberOfNotificationsSent().toString()); assertEquals("MessageType is not as expected", settings.get(PlatformKeys.KEY_MESSAGE_TYPE), responseData.getMessageType()); }

Target:
public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); final ResponseData responseData = this.responseDataRespository.findByCorrelationUid(correlationUid); assertEquals(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT, settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT), responseData.getNumberOfNotificationsSent().toString()); assertEquals(PlatformKeys.KEY_MESSAGE_TYPE, settings.get(PlatformKeys.KEY_MESSAGE_TYPE), responseData.getMessageType()); }
Source:
public APIResult validateExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { String extensionType = ExtensionHandler.getExtensionType(extensionName, getExtensionJobDetail(extensionName)); InputStream configStream = getServletInputStream(configPath); if (ExtensionType.TRUSTED.name().equalsIgnoreCase(extensionType)) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.VALIDATE.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .call(ExtensionOperations.VALIDATE, configStream); return getResponse(APIResult.class, clientResponse); } else { validateExtensionAndGetEntities(extensionName, jobName, configStream); return new APIResult(APIResult.Status.SUCCEEDED, "Validated successfully"); } }

Target:
public APIResult validateExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { String extensionType = ExtensionHandler.getExtensionType(extensionName, getExtensionDetailJson(extensionName)); InputStream configStream = getServletInputStream(configPath); if (ExtensionType.TRUSTED.name().equalsIgnoreCase(extensionType)) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.VALIDATE.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .call(ExtensionOperations.VALIDATE, configStream); return getResponse(APIResult.class, clientResponse); } else { validateExtensionAndGetEntities(extensionName, jobName, configStream); return new APIResult(APIResult.Status.SUCCEEDED, "Validated successfully"); } }
Source:
protected void collectStatsImpl(Connection c, long clientHandle, OpsSelector selector, ParameterSet params) throws Exception { JSONObject obj = new JSONObject(); obj.put("selector", "SYSTEMINFORMATION"); String err = null; if (selector == OpsSelector.SYSTEMINFORMATION) { err = parseParamsForSystemInformation(params, obj); } else { err = "SystemInformationAgent received non-SYSTEMINFORMATION selector: " + selector.name(); } if (err != null) { sendErrorResponse(c, ClientResponse.GRACEFUL_FAILURE, err, clientHandle); return; } String subselector = obj.getString("subselector"); PendingOpsRequest psr = new PendingOpsRequest( selector, subselector, c, clientHandle, System.currentTimeMillis(), obj); if (subselector.equalsIgnoreCase("DEPLOYMENT")) { collectSystemInformationDeployment(psr); return; } if (subselector.equalsIgnoreCase("LICENSE")) { collectSystemInformationLicense(psr); return; } distributeOpsWork(psr, obj); }

Target:
protected void collectStatsImpl(Connection c, long clientHandle, OpsSelector selector, ParameterSet params) throws Exception { JSONObject obj = new JSONObject(); obj.put("selector", "SYSTEMINFORMATION"); String err = null; if (selector == OpsSelector.SYSTEMINFORMATION) { err = parseParamsForSystemInformation(params, obj); } else { err = "SystemInformationAgent received non-SYSTEMINFORMATION selector: " + selector.name(); } if (err != null) { sendErrorResponse(c, ClientResponse.GRACEFUL_FAILURE, err, clientHandle); return; } String subselector = obj.getString("subselector"); PendingOpsRequest psr = new PendingOpsRequest( selector, subselector, c, clientHandle, System.currentTimeMillis(), obj); if ("DEPLOYMENT".equalsIgnoreCase(subselector) || "LICENSE".equalsIgnoreCase(subselector)) { collectSystemInformation(psr, subselector); return; } distributeOpsWork(psr, obj); }
Source:
public IgniteStandardMXBeanTest() throws NotCompliantMBeanException { TestInterfaceImpl testInterfaceImpl = new TestInterfaceImpl(); igniteStandardMXBean = new IgniteStandardMXBean(testInterfaceImpl, TestInterface.class); parameterInfo = new MBeanParameterInfo(NAME, TYPE, PARAMETER_INFO_DESCRIPTION); }

Target:
public IgniteStandardMXBeanTest() throws NotCompliantMBeanException { TestInterfaceImpl testItfImpl = new TestInterfaceImpl(); igniteStandardMXBean = new IgniteStandardMXBean(testItfImpl, TestInterface.class); paramInfo = new MBeanParameterInfo(NAME, TYPE, PARAMETER_INFO_DESCRIPTION); }
Source:
private void createReplLoadCompleteAckTask() { if ((work.isIncrementalLoad() && !work.incrementalLoadTasksBuilder().hasMoreWork() && !work.hasBootstrapLoadTasks()) || (!work.isIncrementalLoad() && !work.hasBootstrapLoadTasks())) { ReplLoadCompleteAckWork replLoadCompleteAckWork = new ReplLoadCompleteAckWork(work.dumpDirectory); Task<ReplLoadCompleteAckWork> loadCompleteAckWorkTask = TaskFactory.get(replLoadCompleteAckWork, conf); if (this.childTasks.isEmpty()) { this.childTasks.add(loadCompleteAckWorkTask); } else { DAGTraversal.traverse(this.childTasks, new AddDependencyToLeaves(Collections.singletonList(loadCompleteAckWorkTask))); } } }

Target:
private void createReplLoadCompleteAckTask() { if ((work.isIncrementalLoad() && !work.incrementalLoadTasksBuilder().hasMoreWork() && !work.hasBootstrapLoadTasks() && !work.getPathsToCopyIterator().hasNext()) || (!work.isIncrementalLoad() && !work.hasBootstrapLoadTasks() && !work.getPathsToCopyIterator().hasNext())) { ReplLoadCompleteAckWork replLoadCompleteAckWork = new ReplLoadCompleteAckWork(work.dumpDirectory); Task<ReplLoadCompleteAckWork> loadCompleteAckWorkTask = TaskFactory.get(replLoadCompleteAckWork, conf); if (this.childTasks.isEmpty()) { this.childTasks.add(loadCompleteAckWorkTask); } else { DAGTraversal.traverse(this.childTasks, new AddDependencyToLeaves(Collections.singletonList(loadCompleteAckWorkTask))); } } }
Source:
private void setFirstTitle() { if((tabs.size()>0)&&activity != null) { String tabNumber = tabs.get(0); if (tabNumber.startsWith(TAB_NUMBER_KIOSK + "\t")) { String kiosk[] = tabNumber.split("\t"); if (kiosk.length == 2) { try { setTitle(kiosk[1]); } catch (Exception e) { } } } else if (tabNumber.startsWith(TAB_NUMBER_CHANNEL + "\t")) { String channelInfo[] = tabNumber.split("\t"); if(channelInfo.length==4) { setTitle(channelInfo[2]); } } else { switch (tabNumber) { case TAB_NUMBER_BLANK: setTitle(getString(R.string.app_name)); break; case TAB_NUMBER_SUBSCIRPTIONS: setTitle(getString(R.string.tab_subscriptions)); break; case TAB_NUMBER_FEED: setTitle(getString(R.string.fragment_whats_new)); break; case TAB_NUMBER_BOOKMARKS: setTitle(getString(R.string.tab_bookmarks)); break; case TAB_NUMBER_HISTORY: setTitle(getString(R.string.title_activity_history)); break; } } } }

Target:
private void setFirstTitle() { if((tabs.size() > 0) && activity != null) { String tabInformation = tabs.get(0); if (tabInformation.startsWith(TAB_NUMBER_KIOSK + "\t")) { String kiosk[] = tabInformation.split("\t"); if (kiosk.length == 3) { setTitle(kiosk[1]); } } else if (tabInformation.startsWith(TAB_NUMBER_CHANNEL + "\t")) { String channelInfo[] = tabInformation.split("\t"); if(channelInfo.length==4) { setTitle(channelInfo[2]); } } else { switch (tabInformation) { case TAB_NUMBER_BLANK: setTitle(getString(R.string.app_name)); break; case TAB_NUMBER_SUBSCIRPTIONS: setTitle(getString(R.string.tab_subscriptions)); break; case TAB_NUMBER_FEED: setTitle(getString(R.string.fragment_whats_new)); break; case TAB_NUMBER_BOOKMARKS: setTitle(getString(R.string.tab_bookmarks)); break; case TAB_NUMBER_HISTORY: setTitle(getString(R.string.title_activity_history)); break; } } } }
Source:
protected Void doInBackground(Void... arg0) { if (!Utils.isNetworkAvailable(contextWeakReference.get())) { ToastUtil.showError(contextWeakReference.get(), R.string.error_internet_connection); userLoggedIn = false; return null; } SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(contextWeakReference.get()); String token = sharedPreferences.getString(Constants.TOKEN, Constants.NO_TOKEN); Log.d(TAG, token); new ServerAuthenticator(username, password, token, CatrobatWebClient.INSTANCE.getClient(), FlavoredConstants.BASE_URL_HTTPS, (statusCode, errorMessage) -> { Log.e(TAG, "StatusCode: " + statusCode + errorMessage); message = errorMessage; userLoggedIn = false; }).performCatrobatLogin(sharedPreferences.edit()); return null; }

Target:
protected Void doInBackground(Void... arg0) { Context context = contextWeakReference.get(); if (context == null) { return null; } if (!Utils.isNetworkAvailable(context)) { ToastUtil.showError(context, R.string.error_internet_connection); userLoggedIn = false; return null; } SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String token = sharedPreferences.getString(Constants.TOKEN, Constants.NO_TOKEN); Log.d(TAG, token); ServerAuthenticator authenticator = new ServerAuthenticator(username, password, token, CatrobatWebClient.INSTANCE.getClient(), FlavoredConstants.BASE_URL_HTTPS, sharedPreferences.edit(), new ServerAuthenticator.TaskListener() { @Override public void onError(int statusCode, String errorMessage) { Log.e(TAG, "StatusCode: " + statusCode + errorMessage); message = errorMessage; userLoggedIn = false; } @Override public void onSuccess() { userLoggedIn = true; } }); authenticator.performCatrobatLogin(); return null; }
Source:
public List<FieldChange> cleanup(BibEntry entry) { List<FieldChange> changes = new ArrayList<>(); for (Map.Entry<Field, Field> alias : EntryConverter.FIELD_ALIASES_TEX_TO_LTX.entrySet()) { Field oldField = alias.getKey(); Field newField = alias.getValue(); entry.getField(oldField).ifPresent(oldValue -> { if (!oldValue.isEmpty() && (!entry.getField(newField).isPresent())) { entry.setField(newField, oldValue).ifPresent(changes::add); entry.clearField(oldField).ifPresent(changes::add); } }); } if (StringUtil.isBlank(entry.getField(StandardField.DATE))) { entry.getFieldOrAlias(StandardField.DATE).ifPresent(newDate -> { entry.setField(StandardField.DATE, newDate).ifPresent(changes::add); entry.clearField(StandardField.YEAR).ifPresent(changes::add); entry.clearField(StandardField.MONTH).ifPresent(changes::add); }); } else { entry.getFieldOrAlias(StandardField.DATE).ifPresent(newDate -> { entry.clearField(StandardField.YEAR).ifPresent(changes::add); entry.clearField(StandardField.MONTH).ifPresent(changes::add); }); } return changes; }

Target:
public List<FieldChange> cleanup(BibEntry entry) { List<FieldChange> changes = new ArrayList<>(); for (Map.Entry<Field, Field> alias : EntryConverter.FIELD_ALIASES_TEX_TO_LTX.entrySet()) { Field oldField = alias.getKey(); Field newField = alias.getValue(); entry.getField(oldField).ifPresent(oldValue -> { if (!oldValue.isEmpty() && (!entry.getField(newField).isPresent())) { entry.setField(newField, oldValue).ifPresent(changes::add); entry.clearField(oldField).ifPresent(changes::add); } }); } if (StringUtil.isBlank(entry.getField(StandardField.DATE))) { entry.getFieldOrAlias(StandardField.DATE).ifPresent(newDate -> { entry.setField(StandardField.DATE, newDate).ifPresent(changes::add); entry.clearField(StandardField.YEAR).ifPresent(changes::add); entry.clearField(StandardField.MONTH).ifPresent(changes::add); }); } else { entry.getFieldOrAlias(StandardField.DATE).ifPresent(date -> { Optional<Date> newDate = Date.parse(date); Optional<Date> checkDate = Date.parse(entry.getFieldOrAlias(StandardField.YEAR), entry.getFieldOrAlias(StandardField.MONTH), Optional.empty()); if (checkDate.equals(newDate)) { entry.clearField(StandardField.YEAR).ifPresent(changes::add); entry.clearField(StandardField.MONTH).ifPresent(changes::add); } }); } return changes; }
Source:
private void refillCache() { try { logger.info("Starting filling Owner Id to Subscription Name cache"); long start = System.currentTimeMillis(); Multimap<OwnerId, SubscriptionName> cache = ArrayListMultimap.create(); topicService.getAllTopics().stream() .flatMap(topic -> subscriptionRepository.listSubscriptions(topic.getName()).stream()) .forEach(subscription -> cache.put(subscription.getOwner(), subscription.getQualifiedName())); this.cache = Multimaps.synchronizedMultimap(cache); long end = System.currentTimeMillis(); logger.info("Cache filled. Took {}ms", end - start); } catch (Exception e) { logger.error("Error while filling cache", e); } }

Target:
private void refillCache() { try { logger.info("Starting filling SubscriptionOwnerCache"); long start = System.currentTimeMillis(); Multimap<OwnerId, SubscriptionName> cache = ArrayListMultimap.create(); topicService.getAllTopics().stream() .flatMap(topic -> subscriptionRepository.listSubscriptions(topic.getName()).stream()) .forEach(subscription -> cache.put(subscription.getOwner(), subscription.getQualifiedName())); this.cache = Multimaps.synchronizedMultimap(cache); long end = System.currentTimeMillis(); logger.info("SubscriptionOwnerCache filled. Took {}ms", end - start); } catch (Exception e) { logger.error("Error while filling SubscriptionOwnerCache", e); } }
Source:
public final ModelNode getCurrentOperationParameter(final String parameterName, boolean nullable) { if (isLegalParameterName(parameterName)) { assert activeStep != null; ModelNode operation = activeStep.operation; assert operation != null; if (!operation.has(parameterName) && nullable) { return null; } else { return operation.get(parameterName); } } else { throw new IllegalArgumentException(ControllerLogger.ROOT_LOGGER.invalidParameterName(parameterName)); } }

Target:
public final ModelNode getCurrentOperationParameter(final String parameterName, boolean nullable) { if (isLegalParameterName(parameterName)) { assert activeStep != null; ModelNode operation = activeStep.operation; assert operation != null; if (!operation.has(parameterName) && nullable) { return null; } else { return operation.get(parameterName); } } else { throw ControllerLogger.ROOT_LOGGER.invalidParameterName(parameterName); } }
Source:
public void requestHandleWithNonHealthCheckRequestTest() throws IOException { testNonHealthCheckRequest(HttpMethod.POST, "POST"); testNonHealthCheckRequest(HttpMethod.GET, "GET"); testNonHealthCheckRequest(HttpMethod.GET, MockBlobStorageService.ECHO_REST_METHOD); testNonHealthCheckRequest(HttpMethod.DELETE, "DELETE"); }

Target:
public void requestHandleWithNonHealthCheckRequestTest() throws IOException { testNonHealthCheckRequest(HttpMethod.POST, "POST"); testNonHealthCheckRequest(HttpMethod.GET, "GET"); testNonHealthCheckRequest(HttpMethod.DELETE, "DELETE"); }
Source:
public static void scheduleOnDemandPipeline(String clusterName, long delay) { if (clusterName == null) { LOG.error("Failed to issue a pipeline run. ClusterName is null."); } GenericHelixController controller = GenericHelixController.getController(clusterName); if (controller != null) { controller.scheduleOnDemandRebalance(delay); } else { LOG.error("Failed to issue a pipeline. Controller for cluster does not exist.", clusterName); } }

Target:
public static void scheduleOnDemandPipeline(String clusterName, long delay) { if (clusterName == null) { LOG.error("Failed to issue a pipeline run. ClusterName is null."); return; } if (delay < 0L) { LOG.error("Failed to issue a pipeline run. Delay is invalid."); return; } GenericHelixController controller = GenericHelixController.getController(clusterName); if (controller != null) { controller.scheduleOnDemandRebalance(delay); } else { LOG.error("Failed to issue a pipeline. Controller for cluster does not exist.", clusterName); } }
Source:
private boolean shouldTriggerMasterToAssignPartitions() { ClusterServiceImpl clusterService = node.getClusterService(); return partitionStateManager.isInitialized() && clusterService.isJoined() && node.getNodeExtension().isStartCompleted(); }

Target:
private boolean shouldTriggerMasterToAssignPartitions() { ClusterServiceImpl clusterService = node.getClusterService(); return !partitionStateManager.isInitialized() && clusterService.isJoined() && node.getNodeExtension().isStartCompleted(); }
Source:
protected boolean startUnitOfWork() { if (unitOfWork != null) { try { unitOfWork.begin(); return true; } catch (IllegalStateException e) { log.debug("Already have an open unit of work, " + "will close and start a new one"); return false; } } return false; }

Target:
protected boolean startUnitOfWork() { if (unitOfWork != null) { try { unitOfWork.begin(); return true; } catch (IllegalStateException e) { log.debug("Already have an open unit of work"); return false; } } return false; }
Source:
protected void cleanup() { follow = false; if(getProcess() != null) { IOUtils.closeQuietly(getProcess().getInputStream()); IOUtils.closeQuietly(getProcess().getErrorStream()); } cacheFlush.accept(this.container); }

Target:
protected void cleanup() { follow = false; if(getProcess() != null) { IOUtils.closeQuietly(getProcess().getInputStream()); IOUtils.closeQuietly(getProcess().getErrorStream()); } synchronized (cache) { cache.remove(this.container); } }
Source:
private CostAssertionBuilder assertCostFragmentedPlan( PlanNode node, Map<String, PlanCostEstimate> costs, Map<String, PlanNodeStatsEstimate> stats, Map<String, Type> types) { Map<Symbol, Type> symbolTypes = types.entrySet().stream() .collect(ImmutableMap.toImmutableMap(entry -> new Symbol(entry.getKey()), Map.Entry::getValue)); TypeProvider typeProvider = TypeProvider.copyOf(symbolTypes); StatsProvider statsProvider = new CachingStatsProvider(statsCalculator(stats), session, typeProvider); CostProvider costProvider = new TestingCostProvider(costs, costCalculatorUsingExchanges, statsProvider, session, typeProvider); IterativeOptimizer optimizer = new IterativeOptimizer(new RuleStatsRecorder(), statsCalculator(stats), costCalculatorUsingExchanges, new TranslateExpressions(metadata, new SqlParser()).rules()); PlanNode plan = optimizer.optimize(node, session, typeProvider, new SymbolAllocator(symbolTypes), new PlanNodeIdAllocator(), WarningCollector.NOOP); SubPlan subPlan = fragment(new Plan(plan, typeProvider, StatsAndCosts.create(node, statsProvider, costProvider))); return new CostAssertionBuilder(subPlan.getFragment().getStatsAndCosts().getCosts().getOrDefault(node.getId(), PlanCostEstimate.unknown())); }

Target:
private CostAssertionBuilder assertCostFragmentedPlan( PlanNode node, Map<String, PlanCostEstimate> costs, Map<String, PlanNodeStatsEstimate> stats, Map<String, Type> types) { Map<Symbol, Type> symbolTypes = types.entrySet().stream() .collect(ImmutableMap.toImmutableMap(entry -> new Symbol(entry.getKey()), Map.Entry::getValue)); TypeProvider typeProvider = TypeProvider.copyOf(symbolTypes); StatsProvider statsProvider = new CachingStatsProvider(statsCalculator(stats), session, typeProvider); CostProvider costProvider = new TestingCostProvider(costs, costCalculatorUsingExchanges, statsProvider, session, typeProvider); PlanNode plan = translateExpression(node, statsCalculator(stats), typeProvider); SubPlan subPlan = fragment(new Plan(plan, typeProvider, StatsAndCosts.create(node, statsProvider, costProvider))); return new CostAssertionBuilder(subPlan.getFragment().getStatsAndCosts().getCosts().getOrDefault(node.getId(), PlanCostEstimate.unknown())); }
Source:
protected void executeCommand() { boolean result = true; VdsValidator validator; setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("SSH Soft Fencing will not be executed on host {0}({1}) since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } validator = new VdsValidator(getVds()); if (validator.shouldVdsBeFenced()) { result = executeSshSoftFencingCommand(getVds().getHostName(), getVds().getVdsGroupCompatibilityVersion().toString()); if (result) { ResourceManager.getInstance().GetVdsManager(getVds().getId()).finishSshSoftFencingExecution(getVds()); } getReturnValue().setSucceeded(result); } else { setCommandShouldBeLogged(false); log.infoFormat("SSH Soft Fencing will not be executed on host {0}({1}) since it's status is ok.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); } }

Target:
protected void executeCommand() { VdsValidator validator; setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("SSH Soft Fencing will not be executed on host {0}({1}) since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } validator = new VdsValidator(getVds()); if (validator.shouldVdsBeFenced()) { boolean result = executeSshSoftFencingCommand(getVds().getHostName(), getVds().getVdsGroupCompatibilityVersion().toString()); if (result) { ResourceManager.getInstance().GetVdsManager(getVds().getId()).finishSshSoftFencingExecution(getVds()); } getReturnValue().setSucceeded(result); } else { setCommandShouldBeLogged(false); log.infoFormat("SSH Soft Fencing will not be executed on host {0}({1}) since it's status is ok.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); } }
Source:
protected HttpResponse post(String url, Map<String, String> payloads) throws IOException { try { HttpPost postRequest = new HttpPost(url); postRequest.setHeader("Accept", ACCEPT_CONTENT_TYPE); StringEntity entity = new StringEntity(OBJECT_MAPPER.writeValueAsString(payloads), ContentType.APPLICATION_JSON); postRequest.setEntity(entity); LOG.info("Executing request: {}, headers: {}, entity: {}", postRequest.getRequestLine(), postRequest.getAllHeaders(), postRequest.getEntity()); return _httpClient.execute(postRequest); } catch (ConnectTimeoutException e) { LOG.error( "Failed to perform customized health check due to ConnectTimeoutException for endpoint {}.", url, e); throw e; } catch (IOException e) { LOG.error("Failed to perform customized health check. Is participant endpoint available?", url, e); throw e; } }

Target:
protected HttpResponse post(String url, Map<String, String> payloads) throws IOException { try { HttpPost postRequest = new HttpPost(url); postRequest.setHeader("Accept", ACCEPT_CONTENT_TYPE); StringEntity entity = new StringEntity(OBJECT_MAPPER.writeValueAsString(payloads), ContentType.APPLICATION_JSON); postRequest.setEntity(entity); LOG.info("Executing request: {}, headers: {}, entity: {}", postRequest.getRequestLine(), postRequest.getAllHeaders(), postRequest.getEntity()); return _httpClient.execute(postRequest); } catch (IOException e) { LOG.error("Failed to perform customized health check. Is participant endpoint available?", url, e); throw e; } }
Source:
private void cacheBlock(String bpid, long blockId) { FsVolumeImpl volume; String blockFileName; long length, genstamp; Executor volumeExecutor; try (AutoCloseableLock lock = datasetWriteLock.acquire()) { ReplicaInfo info = volumeMap.get(bpid, blockId); boolean success = false; try { if (info == null) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": ReplicaInfo not found."); return; } if (info.getState() != ReplicaState.FINALIZED) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": replica is not finalized; it is in state " + info.getState()); return; } try { volume = (FsVolumeImpl)info.getVolume(); if (volume == null) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": volume not found."); return; } } catch (ClassCastException e) { LOG.warn("Failed to cache block with id " + blockId + ": volume was not an instance of FsVolumeImpl."); return; } if (volume.isRAMStorage()) { LOG.warn("Caching not supported on block with id " + blockId + " since the volume is backed by RAM_DISK or NVDIMM."); return; } success = true; } finally { if (!success) { cacheManager.numBlocksFailedToCache.incrementAndGet(); } } blockFileName = info.getBlockURI().toString(); length = info.getVisibleLength(); genstamp = info.getGenerationStamp(); volumeExecutor = volume.getCacheExecutor(); } cacheManager.cacheBlock(blockId, bpid, blockFileName, length, genstamp, volumeExecutor); }

Target:
private void cacheBlock(String bpid, long blockId) { FsVolumeImpl volume; String blockFileName; long length, genstamp; Executor volumeExecutor; try (AutoCloseableLock lock = datasetWriteLock.acquire()) { ReplicaInfo info = volumeMap.get(bpid, blockId); boolean success = false; try { if (info == null) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": ReplicaInfo not found."); return; } if (info.getState() != ReplicaState.FINALIZED) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": replica is not finalized; it is in state " + info.getState()); return; } try { volume = (FsVolumeImpl)info.getVolume(); if (volume == null) { LOG.warn("Failed to cache block with id " + blockId + ", pool " + bpid + ": volume not found."); return; } } catch (ClassCastException e) { LOG.warn("Failed to cache block with id " + blockId + ": volume was not an instance of FsVolumeImpl."); return; } if (volume.isRAMStorage()) { LOG.warn("Caching not supported on block with id since the " + "volume is backed by which is RAM.", blockId, volume); return; } success = true; } finally { if (!success) { cacheManager.numBlocksFailedToCache.incrementAndGet(); } } blockFileName = info.getBlockURI().toString(); length = info.getVisibleLength(); genstamp = info.getGenerationStamp(); volumeExecutor = volume.getCacheExecutor(); } cacheManager.cacheBlock(blockId, bpid, blockFileName, length, genstamp, volumeExecutor); }
Source:
public boolean hasEthernet(Context context) { if (TEST_RADIOS) { return SystemProperties.get(TEST_RADIOS_PROP).contains("ethernet"); } final ConnectivityManager conn = ConnectivityManager.from(context); final boolean hasEthernet = conn.isNetworkSupported(TYPE_ETHERNET); final long ethernetBytes; if (mStatsSession != null) { try { ethernetBytes = mStatsSession.getSummaryForNetwork( NetworkTemplate.buildTemplateEthernet(), Long.MIN_VALUE, Long.MAX_VALUE) .getTotalBytes(); } catch (RemoteException e) { throw new RuntimeException(e); } } else { ethernetBytes = 0; } return hasEthernet && (mStatsSession == null || ethernetBytes > 0); }

Target:
public boolean hasEthernet(Context context) { if (TEST_RADIOS) { return SystemProperties.get(TEST_RADIOS_PROP).contains("ethernet"); } final ConnectivityManager conn = ConnectivityManager.from(context); final boolean hasEthernet = conn.isNetworkSupported(TYPE_ETHERNET); final long ethernetBytes; if (mStatsSession != null) { try { ethernetBytes = mStatsSession.getSummaryForNetwork( NetworkTemplate.buildTemplateEthernet(), Long.MIN_VALUE, Long.MAX_VALUE) .getTotalBytes(); } catch (RemoteException e) { throw new RuntimeException(e); } } else { ethernetBytes = 0; } return hasEthernet && ethernetBytes > 0; }
Source:
public Set<String> getDependentFields() { final Set<String> dependentFields = super.getDependentFields(); dependentFields.addAll(field.getDependentFields()); return dependentFields; }

Target:
public Set<String> getDependentFields() { if (dependentFields == null) { dependentFields = Sets.newHashSet(super.getDependentFields()); dependentFields.addAll(field.getDependentFields()); } return dependentFields; }
Source:
public Optional<DispatchCatchingUp<I>> getDispatchOp() { return Optional.ofNullable(dispatchOp); }

Target:
DispatchCatchingUp<I> getDispatchOp() { return checkNotNull(dispatchOp); }
Source:
public <T> T invoke(OperationsCallback<T> action) { final Channel currentChannel = this.dedicatedChannels.get(); Assert.state(currentChannel == null, () -> "Nested invoke() calls are not supported; channel '" + currentChannel + "' is already associated with this thread"); this.activeTemplateCallbacks.incrementAndGet(); RabbitResourceHolder resourceHolder = null; Connection connection = null; Channel channel; if (isChannelTransacted()) { resourceHolder = ConnectionFactoryUtils.getTransactionalResourceHolder(getConnectionFactory(), true); channel = resourceHolder.getChannel(); if (channel == null) { ConnectionFactoryUtils.releaseResources(resourceHolder); throw new IllegalStateException("Resource holder returned a null channel"); } } else { connection = getConnectionFactory().createConnection(); if (connection == null) { throw new IllegalStateException("Connection factory returned a null connection"); } try { channel = connection.createChannel(false); if (channel == null) { throw new IllegalStateException("Connection returned a null channel"); } RabbitUtils.setPhysicalCloseRequired(true); this.dedicatedChannels.set(channel); } catch (RuntimeException e) { RabbitUtils.closeConnection(connection); throw e; } } try { return action.doInRabbit(this); } finally { this.activeTemplateCallbacks.decrementAndGet(); this.dedicatedChannels.remove(); if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); if (!(channel instanceof ChannelProxy)) { RabbitUtils.isPhysicalCloseRequired(); } RabbitUtils.closeConnection(connection); } } }

Target:
public <T> T invoke(OperationsCallback<T> action) { final Channel currentChannel = this.dedicatedChannels.get(); Assert.state(currentChannel == null, () -> "Nested invoke() calls are not supported; channel '" + currentChannel + "' is already associated with this thread"); this.activeTemplateCallbacks.incrementAndGet(); RabbitResourceHolder resourceHolder = null; Connection connection = null; Channel channel; if (isChannelTransacted()) { resourceHolder = ConnectionFactoryUtils.getTransactionalResourceHolder(getConnectionFactory(), true); channel = resourceHolder.getChannel(); if (channel == null) { ConnectionFactoryUtils.releaseResources(resourceHolder); throw new IllegalStateException("Resource holder returned a null channel"); } } else { connection = getConnectionFactory().createConnection(); if (connection == null) { throw new IllegalStateException("Connection factory returned a null connection"); } try { channel = connection.createChannel(false); if (channel == null) { throw new IllegalStateException("Connection returned a null channel"); } RabbitUtils.setPhysicalCloseRequired(channel, true); this.dedicatedChannels.set(channel); } catch (RuntimeException e) { RabbitUtils.closeConnection(connection); throw e; } } try { return action.doInRabbit(this); } finally { this.activeTemplateCallbacks.decrementAndGet(); this.dedicatedChannels.remove(); if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } } }
Source:
public void onJsonProcessFinish(String object) { System.out.println(object); }

Target:
public String onJsonProcessFinish(String object) { System.out.println(object); return object; }
Source:
protected CodecConfig genConfig(RendererConfiguration renderer) { CodecConfig config = new CodecConfig(); if (codecOverride.isSelected()) { LOGGER.debug("Using GUI codec overrides"); config.videoCodec = codecVideo.getText(); config.audioCodec = codecAudio.getText(); config.container = codecContainer.getText(); } else if (renderer.isTranscodeToWMV()) { LOGGER.debug("Using XBox WMV codecs"); config.videoCodec = "wmv2"; config.audioCodec = "wma"; config.container = "asf"; } else if (renderer.isTranscodeToMPEGPSAC3() || renderer.isTranscodeToMPEGTSAC3()) { String type = renderer.isTranscodeToMPEGPSAC3() ? "ps" : "ts"; LOGGER.debug("Using DLNA standard codecs with " + type + " container"); config.videoCodec = "mp2v"; config.audioCodec = "mp2a"; config.container = type; } else { throw new RuntimeException("Unknown encoding profile"); } LOGGER.debug("Using " + config.videoCodec + ", " + config.audioCodec + ", " + config.container); if (sampleRateOverride.isSelected()) { config.sampleRate = Integer.valueOf(sampleRate.getText()); } if (audioSyncEnabled.isSelected()) { config.extraTrans.add("audio-sync"); } return config; }

Target:
protected CodecConfig genConfig(RendererConfiguration renderer) { CodecConfig config = new CodecConfig(); if (renderer.isTranscodeToWMV()) { LOGGER.debug("Using XBox WMV codecs"); config.videoCodec = "wmv2"; config.audioCodec = "wma"; config.container = "asf"; } else if (renderer.isTranscodeToMPEGTSAC3()) { LOGGER.debug("Using DLNA standard codecs with ts container"); config.videoCodec = "mp2v"; config.audioCodec = "mp2a"; config.container = "ts"; } else { LOGGER.debug("Using DLNA standard codecs with ps (default) container"); config.videoCodec = "mp2v"; config.audioCodec = "mp2a"; config.container = "ps"; } LOGGER.trace("Using " + config.videoCodec + ", " + config.audioCodec + ", " + config.container); if (sampleRateOverride.isSelected()) { config.sampleRate = Integer.valueOf(sampleRate.getText()); } if (audioSyncEnabled.isSelected()) { config.extraTrans.put("audio-sync", ""); } return config; }
Source:
public static void putObject_test13() throws Exception { if (!mintEnv) { System.out.println("Test: putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse) using SSE_C. "); } long startTime = System.currentTimeMillis(); KeyGenerator keyGen = KeyGenerator.getInstance("AES"); keyGen.init(256); ServerSideEncryption sse = ServerSideEncryption.withCustomerKey(keyGen.generateKey()); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * MB)) { client.putObject(bucketName, objectName, is, 1 * MB, sse); } client.removeObject(bucketName, objectName); mintSuccessLog("putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse)", "size: 13 MB", startTime); } catch (Exception e) { mintFailedLog("putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse)", "size: 13 MB", startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }

Target:
public static void putObject_test13() throws Exception { if (!mintEnv) { System.out.println("Test: putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse) using SSE_C. "); } long startTime = System.currentTimeMillis(); KeyGenerator keyGen = KeyGenerator.getInstance("AES"); keyGen.init(256); ServerSideEncryption sse = ServerSideEncryption.withCustomerKey(keyGen.generateKey()); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * MB)) { client.putObject(bucketName, objectName, is, 1 * MB, sse); } client.removeObject(bucketName, objectName); mintSuccessLog("putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse) using SSE_C.", "size: 1 MB", startTime); } catch (Exception e) { mintFailedLog("putObject(String bucketName, String objectName, InputStream stream, " + "long size, ServerSideEncryption sse) using SSE_C.", "size: 1 MB", startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }