auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void runTestCase(TestScenario testScenario, TestCase testCase, TestEnvironmentExecutor testEnvironmentExecutor) throws TestFailException { System.out.println("Executing test case: " + testCase); String environmentId = null; try { if (testEnvironmentExecutor instanceof DockerComposeExecutor) { ((DockerComposeExecutor) testEnvironmentExecutor).createNetwork(); } apmServer.setHost("0.0.0.0"); apmServer.setTraces(new ArrayList<>()); apmServer.run(); environmentId = testEnvironmentExecutor.run(testScenario.getEnvironment()); Thread.sleep(testScenario.getEnvironment().getInitWaitSeconds()*1000); testEnvironmentExecutor.execScript(environmentId, testCase.getScriptServiceName(), testCase.getAction()); Thread.sleep(testCase.getAfterActionWaitSeconds()*1000); verifyResults(testScenario, testCase, apmServer); } catch (InterruptedException ex) { throw new TestFailException(testCase, ex); } finally { if (apmServer != null) { apmServer.shutdown(); } if (environmentId != null) { testEnvironmentExecutor.clean(environmentId); } } }

Target:
private void runTestCase(TestScenario testScenario, TestCase testCase, TestEnvironmentExecutor testEnvironmentExecutor) throws TestFailException { log.info(String.format("Executing test case: %s", testCase)); String environmentId = null; ApmMockServer apmServer = new ApmMockServer(); apmServer.setHost("0.0.0.0"); apmServer.setPort(apmServerPort); apmServer.setShutdownTimer(60*60*1000); try { if (testScenario.getEnvironment().getApmAddress() != null) { testEnvironmentExecutor.createNetwork(); } apmServer.run(); environmentId = testEnvironmentExecutor.run(testScenario.getEnvironment()); Thread.sleep(testScenario.getEnvironment().getInitWaitSeconds()*1000); testEnvironmentExecutor.execScript(environmentId, testCase.getScriptServiceName(), testCase.getAction()); Thread.sleep(testCase.getAfterActionWaitSeconds()*1000); Collection<JsonPathVerify> jsonPathVerifies = verifyResults(testScenario, testCase, apmServer); if (!jsonPathVerifies.isEmpty()) { throw new TestFailException(testCase, jsonPathVerifies); } } catch (InterruptedException ex) { log.severe("Interruption exception"); log.severe(ex.toString()); throw new TestFailException(testCase, ex); } finally { if (environmentId != null) { testEnvironmentExecutor.clean(environmentId); } if (apmServer != null) { apmServer.shutdown(); } } }
Source:
public void processTuple(String inputTuple) { try { if (out.isConnected()) { StringReader reader = new StringReader(inputTuple); JAXBElement<?> output = unmarshaller.unmarshal(new StreamSource(reader), getClazz()); LOG.debug(output.getValue().toString()); emittedObjectCount++; out.emit(output.getValue()); } else { validator.validate(new StreamSource(inputTuple)); } if (validatedOutput.isConnected()) { validatedOutput.emit(inputTuple); } if (parsedOutput.isConnected()) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); Document doc = builder.parse(inputTuple); parsedOutput.emit(doc); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { LOG.debug("Failed to parse xml tuple {}, Exception = ", inputTuple, e); errorTupleCount++; if (err.isConnected()) { err.emit(inputTuple); } } }

Target:
public void processTuple(String inputTuple) { try { if (out.isConnected()) { reader.open(inputTuple); JAXBElement<?> output = unmarshaller.unmarshal(new StreamSource(reader), getClazz()); LOG.debug(output.getValue().toString()); emittedObjectCount++; out.emit(output.getValue()); } else if (validator != null) { validator.validate(new StreamSource(inputTuple)); } if (parsedOutput.isConnected()) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); Document doc = builder.parse(inputTuple); parsedOutput.emit(doc); } catch (Exception e) { LOG.info("Failed to parse xml tuple {}, Exception = , StackTrace = {}", inputTuple, e, e.getStackTrace()); errorTupleCount++; if (err.isConnected()) { err.emit(inputTuple); } } } } catch (Exception e) { LOG.info("Failed to parse xml tuple {}, Exception = {}, StackTrace = ", inputTuple, e, e.getStackTrace()); errorTupleCount++; if (err.isConnected()) { err.emit(inputTuple); } } finally { try { if (reader.isOpen()) { reader.close(); } } catch (IOException e) { DTThrowable.wrapIfChecked(e); } } }
Source:
private Object getNextUnresolvedDiff(TreeItem start) { return getNextDataWhichSatisfies(start, new Predicate<EObject>() { public boolean apply(EObject input) { return input instanceof Diff && ((Diff)input).getState() == DifferenceState.UNRESOLVED; } }); }

Target:
private Object getNextUnresolvedDiff(TreeItem start) { return getNextData(start, EMFComparePredicates.hasState(DifferenceState.UNRESOLVED)); }
Source:
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); int b = buffer.readByte(); if (b != DataConstants.NULL) { final int length = buffer.readInt(); if (keysInterner != null) { address = keysInterner.intern(buffer, length); } else { address = SimpleString.readSimpleString(buffer, length); } } else { address = null; } if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(); properties.decode(buffer, keysInterner, valuesInterner); } }

Target:
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); int b = buffer.readByte(); if (b != DataConstants.NULL) { address = SimpleString.readSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool()); } else { address = null; } if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(); properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } }
Source:
synchronized Optional<LockToken> unlock() { if (!unlocked) { unlocked = true; referenceCounter.unmark(); } return referenceCounter.dereferenced() ? Optional.of(sharedLockToken) : Optional.empty(); }

Target:
synchronized Optional<LockToken> unlock() { if (!unlocked) { unlocked = true; return referenceCounter.unmark() ? Optional.of(sharedLockToken) : Optional.empty(); } return Optional.empty(); }
Source:
private void configureSingleUserMode( Map<String, String> persistenceProperties, String infrastructure) { persistenceProperties.put( PersistenceUnitProperties.EXCEPTION_HANDLER_CLASS, "org.eclipse.che.core.db.h2.jpa.eclipselink.H2ExceptionHandler"); bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class); bind(MachineTokenProvider.class).to(MachineTokenProvider.EmptyMachineTokenProvider.class); bind(DataSource.class).toProvider(org.eclipse.che.core.db.h2.H2DataSourceProvider.class); install(new org.eclipse.che.api.user.server.jpa.UserJpaModule()); install(new org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule()); bind(org.eclipse.che.api.user.server.CheUserCreator.class); bindConstant().annotatedWith(Names.named("che.agents.auth_enabled")).to(false); bind(org.eclipse.che.security.oauth.shared.OAuthTokenProvider.class) .to(org.eclipse.che.security.oauth.OAuthAuthenticatorTokenProvider.class); bind(OAuthAPI.class).to(EmbeddedOAuthAPI.class); bind(RemoteSubscriptionStorage.class) .to(org.eclipse.che.api.core.notification.InmemoryRemoteSubscriptionStorage.class); bind(WorkspaceLockService.class) .to(org.eclipse.che.api.workspace.server.DefaultWorkspaceLockService.class); bind(WorkspaceStatusCache.class) .to(org.eclipse.che.api.workspace.server.DefaultWorkspaceStatusCache.class); install(new org.eclipse.che.api.workspace.activity.inject.WorkspaceActivityModule()); configureFakeJwtProxySecureProvisioner(infrastructure); }

Target:
private void configureSingleUserMode( Map<String, String> persistenceProperties, String infrastructure) { persistenceProperties.put( PersistenceUnitProperties.EXCEPTION_HANDLER_CLASS, "org.eclipse.che.core.db.h2.jpa.eclipselink.H2ExceptionHandler"); bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class); bind(MachineTokenProvider.class).to(MachineTokenProvider.EmptyMachineTokenProvider.class); bind(DataSource.class).toProvider(org.eclipse.che.core.db.h2.H2DataSourceProvider.class); install(new org.eclipse.che.api.user.server.jpa.UserJpaModule()); install(new org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule()); bind(org.eclipse.che.api.user.server.CheUserCreator.class); bindConstant().annotatedWith(Names.named("che.agents.auth_enabled")).to(false); bind(org.eclipse.che.security.oauth.shared.OAuthTokenProvider.class) .to(org.eclipse.che.security.oauth.OAuthAuthenticatorTokenProvider.class); bind(OAuthAPI.class).to(EmbeddedOAuthAPI.class); bind(RemoteSubscriptionStorage.class) .to(org.eclipse.che.api.core.notification.InmemoryRemoteSubscriptionStorage.class); bind(WorkspaceLockService.class) .to(org.eclipse.che.api.workspace.server.DefaultWorkspaceLockService.class); bind(WorkspaceStatusCache.class) .to(org.eclipse.che.api.workspace.server.DefaultWorkspaceStatusCache.class); install(new org.eclipse.che.api.workspace.activity.inject.WorkspaceActivityModule()); configureImpostorJwtProxySecureProvisioner(infrastructure); }
Source:
public void sanityCheck() { Multiset<PlanFragmentId> exchangeIds = fragment.getRemoteSourceNodes().stream() .map(RemoteSourceNode::getSourceFragmentIds) .flatMap(List::stream) .collect(toImmutableMultiset()); Multiset<PlanFragmentId> childrenIds = children.stream() .map(SubPlan::getFragment) .map(PlanFragment::getId) .collect(toImmutableMultiset()); checkState(exchangeIds.equals(childrenIds), "Subplan exchange ids don't match child fragment ids (%s vs %s)", exchangeIds, childrenIds); checkState( Streams.stream(Traverser.forTree(PlanNode::getSources).depthFirstPreOrder(fragment.getRoot())) .filter(node -> node instanceof TableWriterNode) .count() <= 1, "Each fragment cannot have multiple TableWriterNode"); for (SubPlan child : children) { child.sanityCheck(); } }

Target:
public void sanityCheck() { Multiset<PlanFragmentId> remoteSourceIds = fragment.getRemoteSourceNodes().stream() .map(RemoteSourceNode::getSourceFragmentIds) .flatMap(List::stream) .collect(toImmutableMultiset()); Multiset<PlanFragmentId> childrenIds = children.stream() .map(SubPlan::getFragment) .map(PlanFragment::getId) .collect(toImmutableMultiset()); checkState(childrenIds.containsAll(remoteSourceIds), "child fragments must include all remote source fragments (%s vs %s)", remoteSourceIds, childrenIds); long tableWriteCount = stream(Traverser.forTree(PlanNode::getSources).depthFirstPreOrder(fragment.getRoot())) .filter(TableWriterNode.class::isInstance) .count(); checkState(tableWriteCount <= 1, "Fragment cannot contain more than one TableWriterNode"); if (tableWriteCount == 1) { if (!(fragment.getRoot() instanceof OutputNode || fragment.getRoot() instanceof TableWriterNode)) { throw new VerifyException("For a fragment contains TableWriteNode, the root has to be either OutputNode or TableWriterNode"); } } for (SubPlan child : children) { child.sanityCheck(); } }
Source:
public void testCSimpleCall() throws Exception { loadCodeAndRun(getAboveComment()); checkErrorLine(5, ER_ID); }

Target:
public void testCSimpleCall() throws Exception { loadCodeAndRunC(getAboveComment()); checkErrorLine(5, ER_ID); }
Source:
private void process() { byte[] frame = Arrays.copyOfRange(frameBytes, 4, frameBytes.length); TTransport input = new TMemoryInputTransport(frame); TMemoryOutputBuffer output = new TMemoryOutputBuffer(NATS_MAX_MESSAGE_SIZE); try { processor.process(inputProtoFactory.getProtocol(input), outputProtoFactory.getProtocol(output)); } catch (TApplicationException e) { LOGGER.warn("error processing frame: " + e.getMessage()); } catch (TException e) { LOGGER.warn("error processing frame: " + e.getMessage()); return; } if (!output.hasWriteData()) { return; } try { conn.publish(reply, output.getWriteBytes()); } catch (IOException e) { LOGGER.warn("failed to send response: " + e.getMessage()); } }

Target:
private void process() { byte[] frame = Arrays.copyOfRange(frameBytes, 4, frameBytes.length); TTransport input = new TMemoryInputTransport(frame); TMemoryOutputBuffer output = new TMemoryOutputBuffer(NATS_MAX_MESSAGE_SIZE); try { processor.process(inputProtoFactory.getProtocol(input), outputProtoFactory.getProtocol(output)); } catch (TApplicationException e) { LOGGER.error("user handler code returned unhandled error on request:" + e.getMessage()); } catch (TException e) { LOGGER.error("user handler code returned unhandled error on request:" + e.getMessage()); return; } if (!output.hasWriteData()) { return; } try { conn.publish(reply, output.getWriteBytes()); } catch (IOException e) { LOGGER.warn("failed to send response: " + e.getMessage()); } }
Source:
public ESAuthenticationInformation logIn(String username, String password, ESClientVersionInfo clientVersionInfo) throws AccessControlException { synchronized (MonitorProvider.getInstance().getMonitor(MONITOR_NAME)) { final long currentTimeStamp = System.currentTimeMillis(); if (checkTooManyFailedRequests(username, currentTimeStamp)) { throw new AccessControlException( MessageFormat.format(Messages.LoginService_VerifyUserTooManyFailedRequests, username, delay)); } ESAuthenticationInformation authInfo; try { authInfo = getUserVerifierService().verifyUser( username, password, clientVersionInfo); cleanupFailedAttempts(username); } catch (final AccessControlException ex) { recordFailedVerifyUserAttempt(username, currentTimeStamp); throw ex; } final AuthenticationInformation authenticationInformation = ESAuthenticationInformationImpl.class.cast( authInfo).toInternalAPI(); final ESSessionId existingSession = sessions.resolveByUser(authInfo.getUser()); if (existingSession == null) { sessions.add(authInfo); } else { authenticationInformation.setSessionId( ESSessionIdImpl.class.cast(existingSession).toInternalAPI()); } final ACUser resolvedUser = (ACUser) ESUserImpl.class.cast( orgUnitResolver.resolveRoles(authInfo)) .toInternalAPI(); authenticationInformation.setResolvedACUser(resolvedUser); return authInfo; } }

Target:
public ESAuthenticationInformation logIn(String username, String password, ESClientVersionInfo clientVersionInfo) throws AccessControlException { synchronized (MonitorProvider.getInstance().getMonitor(MONITOR_NAME)) { final Optional<ESAuthenticationInformation> information = doVerifyUser(username, password, clientVersionInfo); if (!information.isPresent()) { throw new AccessControlException( MessageFormat.format(Messages.LoginService_VerifyUserTooManyFailedRequests, username, delay)); } final ESAuthenticationInformation authInfo = information.get(); final AuthenticationInformation authenticationInformation = ESAuthenticationInformationImpl.class.cast( authInfo).toInternalAPI(); final ESSessionId existingSession = sessions.resolveByUser(authInfo.getUser()); if (existingSession == null) { sessions.add(authInfo); } else { authenticationInformation.setSessionId( ESSessionIdImpl.class.cast(existingSession).toInternalAPI()); } final ACUser resolvedUser = (ACUser) ESUserImpl.class.cast( orgUnitResolver.resolveRoles(authInfo)) .toInternalAPI(); authenticationInformation.setResolvedACUser(resolvedUser); return authInfo; } }
Source:
public void testValidMessageParameter() { File sourceFile = compilerHelper.getSourceFile( ValidMessageParameters.class ); boolean compilationResult = compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile ); assertTrue( compilationResult ); assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.WARNING, 78 ) ); }

Target:
public void testValidMessageParameter() { File sourceFile = compilerHelper.getSourceFile( ValidMessageParameters.class ); boolean compilationResult = compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile ); assertTrue( compilationResult ); assertThatDiagnosticsMatch( diagnostics, new DiagnosticExpectation( Kind.WARNING, 57 ), new DiagnosticExpectation( Kind.WARNING, 88 ), new DiagnosticExpectation( Kind.WARNING, 98 ), new DiagnosticExpectation( Kind.WARNING, 101 ), new DiagnosticExpectation( Kind.WARNING, 108 ), new DiagnosticExpectation( Kind.WARNING, 109 ), new DiagnosticExpectation( Kind.WARNING, 110 ), new DiagnosticExpectation( Kind.WARNING, 122 ) ); }
Source:
private static String getLinuxOSInfo() { String versionInfo = ""; try { BufferedReader br = null; final String ubuntuDistInfoFilePath = "/etc/lsb-release"; final String rhDistInfoFilePath = "/etc/redhat-release"; if (Files.exists(Paths.get(ubuntuDistInfoFilePath))) { br = new BufferedReader(new FileReader(ubuntuDistInfoFilePath)); } else if (Files.exists(Paths.get(rhDistInfoFilePath))) { br = new BufferedReader(new FileReader(rhDistInfoFilePath)); } if (br != null) { StringBuffer buffer = new StringBuffer(); while ((versionInfo = br.readLine()) != null) { buffer.append(versionInfo); } versionInfo = buffer.toString(); } } catch (IOException io) { System.err.println(io.getMessage()); versionInfo = ""; } return versionInfo; }

Target:
private static String getLinuxOSInfo() { String versionInfo = ""; BufferedReader br = null; final List<String> distInfoFilePaths = Arrays.asList("/etc/lsb-release", "/etc/redhat-release"); for (String filePath : distInfoFilePaths) { if (Files.exists(Paths.get(filePath))) { try { br = new BufferedReader(new FileReader(filePath)); } catch (FileNotFoundException excp) { System.err.println(excp.getMessage()); } break; } } if (br != null) { StringBuffer buffer = new StringBuffer(); try { while ((versionInfo = br.readLine()) != null) { buffer.append(versionInfo); } versionInfo = buffer.toString(); } catch (IOException io) { System.err.println(io.getMessage()); versionInfo = ""; } } return versionInfo; }
Source:
public void setSubject(String subject) { if (subject != null && subject.equals("")) { this.subject = "(no topic)"; } else { this.subject = subject; } }

Target:
public void setSubject(String subject) { if (subject != null && subject.equals("")) { this.subject = ZulipApp.get().getString(R.string.no_topic_in_message); } else { this.subject = subject; } }
Source:
public void handleEvent(MotechEvent event) { Map<String, Object> params = event.getParameters(); emailSender.sendPasswordResetReminder(usersDataService.findByUserName((String) params.get("username")), (DateTime) event.getParameters().get("expirationDate")); }

Target:
public void handleEvent(MotechEvent event) { emailSender.sendPasswordResetReminder(event.getParameters()); }
Source:
public static boolean isWifiandBTWixel(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String collection_method = prefs.getString("dex_collection_method", "WifiBlueToothWixel"); if(collection_method.compareTo("WifiBlueToothWixel") == 0) { return true; } return false; }

Target:
public static boolean isWifiandBTWixel(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel"); if(collection_method.compareTo("WifiBlueToothWixel") == 0) { return true; } return false; }
Source:
protected final void createDestinationGroup(Composite parent) { Composite containerGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; containerGroup.setLayout(layout); containerGroup.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); containerGroup.setFont(parent.getFont()); Label resourcesLabel = new Label(containerGroup, SWT.NONE); resourcesLabel.setText(IDEWorkbenchMessages.WizardImportPage_folder); resourcesLabel.setFont(parent.getFont()); containerNameField = new Text(containerGroup, SWT.SINGLE | SWT.BORDER); BidiUtils.applyBidiProcessing(containerNameField, BidiUtils.BTD_DEFAULT); containerNameField.addListener(SWT.Modify, this); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; containerNameField.setLayoutData(data); containerNameField.setFont(parent.getFont()); containerBrowseButton = new Button(containerGroup, SWT.PUSH); containerBrowseButton.setText(IDEWorkbenchMessages.WizardImportPage_browse2); containerBrowseButton.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL)); containerBrowseButton.addListener(SWT.Selection, this); containerBrowseButton.setFont(parent.getFont()); setButtonLayoutData(containerBrowseButton); initialPopulateContainerField(); }

Target:
protected final void createDestinationGroup(Composite parent) { Composite containerGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; containerGroup.setLayout(layout); containerGroup.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); containerGroup.setFont(parent.getFont()); Label resourcesLabel = new Label(containerGroup, SWT.NONE); resourcesLabel.setText(IDEWorkbenchMessages.WizardImportPage_folder); resourcesLabel.setFont(parent.getFont()); containerNameField = new Text(containerGroup, SWT.SINGLE | SWT.BORDER); BidiUtils.applyBidiProcessing(containerNameField, StructuredTextTypeHandlerFactory.FILE); containerNameField.addListener(SWT.Modify, this); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; containerNameField.setLayoutData(data); containerNameField.setFont(parent.getFont()); containerBrowseButton = new Button(containerGroup, SWT.PUSH); containerBrowseButton.setText(IDEWorkbenchMessages.WizardImportPage_browse2); containerBrowseButton.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL)); containerBrowseButton.addListener(SWT.Selection, this); containerBrowseButton.setFont(parent.getFont()); setButtonLayoutData(containerBrowseButton); initialPopulateContainerField(); }
Source:
public ResponseEntity<String> createAnnotationByTypeJsonld(@RequestParam(value = WebAnnotationFields.PARAM_WSKEY) String wskey, @RequestParam(value = WebAnnotationFields.PROVIDER, required = false) String provider, @RequestParam(value = WebAnnotationFields.IDENTIFIER, required = false) String identifier, @RequestParam(value = WebAnnotationFields.INDEX_ON_CREATE, required = false, defaultValue = "true") boolean indexOnCreate, @RequestBody String annotation, @RequestParam(value = WebAnnotationFields.USER_TOKEN, required = false, defaultValue = WebAnnotationFields.USER_ANONYMOUNS) String userToken, @PathVariable(value = WebAnnotationFields.PATH_PARAM_ANNO_TYPE) String annoType, HttpServletRequest request )throws HttpException, ApiKeyExtractionException, AuthorizationExtractionException { verifyWriteAccess(WebAnnotationFields.CREATE_OPERATION, request); MotivationTypes motivation = MotivationTypes.getTypeForOaType(annoType); if (motivation == null) { motivation = MotivationTypes.getTypeForAnnoType(annoType); } if(motivation == null) throw new ParamValidationException(ParamValidationException.MESSAGE_INVALID_PARAMETER_VALUE, I18nConstants.ANNOTATION_VALIDATION, new String[]{WebAnnotationFields.PATH_PARAM_ANNO_TYPE, annoType}, HttpStatus.NOT_ACCEPTABLE, null); return storeAnnotation(wskey, motivation, provider, identifier, indexOnCreate, annotation, userToken); }

Target:
public ResponseEntity<String> createAnnotationByTypeJsonld(@RequestParam(value = WebAnnotationFields.PARAM_WSKEY) String wskey, @RequestParam(value = WebAnnotationFields.PROVIDER, required = false) String provider, @RequestParam(value = WebAnnotationFields.IDENTIFIER, required = false) String identifier, @RequestParam(value = WebAnnotationFields.INDEX_ON_CREATE, required = false, defaultValue = "true") boolean indexOnCreate, @RequestBody String annotation, @RequestParam(value = WebAnnotationFields.USER_TOKEN, required = false, defaultValue = WebAnnotationFields.USER_ANONYMOUNS) String userToken, @PathVariable(value = WebAnnotationFields.PATH_PARAM_ANNO_TYPE) String annoType, HttpServletRequest request )throws HttpException, ApiKeyExtractionException, AuthorizationExtractionException { verifyWriteAccess(WebAnnotationFields.CREATE_OPERATION, request); MotivationTypes motivation = MotivationTypes.getTypeForAnnoType(annoType); if(motivation == null) throw new ParamValidationException(ParamValidationException.MESSAGE_INVALID_PARAMETER_VALUE, I18nConstants.ANNOTATION_VALIDATION, new String[]{WebAnnotationFields.PATH_PARAM_ANNO_TYPE, annoType}, HttpStatus.NOT_ACCEPTABLE, null); return storeAnnotation(wskey, motivation, provider, identifier, indexOnCreate, annotation, userToken); }
Source:
public String toString() { return "DoubleLastAggregatorFactory{" + "name='" + name + '\'' + ", fieldName='" + fieldName + '\'' + '}'; }

Target:
public String toString() { return "LongLastAggregatorFactory{" + "name='" + name + '\'' + ", fieldName='" + fieldName + '\'' + '}'; }
Source:
public CompletableFuture<List<KubernetesPod>> getPodsWithLabels(Map<String, String> labels) { return CompletableFuture.supplyAsync(() -> { final List<Pod> podList = this.internalClient.pods().withLabels(labels).list().getItems(); if (podList == null || podList.size() < 1) { return new ArrayList<>(); } return podList .stream() .map(KubernetesPod::new) .collect(Collectors.toList()); }, executorWrapper.getExecutor()); }

Target:
public List<KubernetesPod> getPodsWithLabels(Map<String, String> labels) { final List<Pod> podList = this.internalClient.pods().withLabels(labels).list().getItems(); if (podList == null || podList.isEmpty()) { return new ArrayList<>(); } return podList .stream() .map(KubernetesPod::new) .collect(Collectors.toList()); }
Source:
public Optional<ImmutableWetData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableWetData immutable) { if (key == Keys.IS_WET) { return Optional.<ImmutableWetData>of(new ImmutableSpongeWetData((Boolean) value)); } return Optional.absent(); }

Target:
public Optional<ImmutableWetData> with(Key<? extends BaseValue<?>> key, Object value, ImmutableWetData immutable) { if (key == Keys.IS_WET) { return Optional.<ImmutableWetData>of(ImmutableDataCachingUtil.getManipulator(ImmutableSpongeWetData.class, (Boolean) value)); } return Optional.empty(); }
Source:
public Pagination<Payment> getPayments(final Long offset, final Long limit, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context) { return paymentProcessor.getPayments(offset, limit, withPluginInfo, properties, context, internalCallContextFactory.createInternalTenantContext(context)); }

Target:
public Pagination<Payment> getPayments(final Long offset, final Long limit, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context) { return paymentProcessor.getPayments(offset, limit, withPluginInfo, withAttempts, properties, context, internalCallContextFactory.createInternalTenantContext(context)); }
Source:
public Object getArgument(int index) { assert index >= 0 && index <= arguments.size(); return arguments.get(index); }

Target:
public Object getArgument(int index) { assert index >= 0 && index < arguments.size(); return arguments.get(index); }
Source:
private static ProgramState checkAssertIsNotNull(ProgramState currentState, CheckerContext context, MethodInvocationTree methodInvocation) { MethodInvocationTree mit = methodInvocation; while (true) { ExpressionTree methodSelect = mit.methodSelect(); if (!methodSelect.is(Tree.Kind.MEMBER_SELECT)) { return currentState; } ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); if (!expression.is(Tree.Kind.METHOD_INVOCATION)) { return currentState; } mit = (MethodInvocationTree) expression; if (ASSERT_THAT.anyMatch(mit)) { break; } } ExplodedGraph.Node node = context.getNode(); Tree previousSyntaxNode; do { node = node.parent(); previousSyntaxNode = node.programPoint.syntaxTree(); } while (!previousSyntaxNode.equals(mit)); SymbolicValue assertThatParameter = node.programState.peekValue(); if (assertThatParameter == null) { return currentState; } ObjectConstraint nullNessConstraint = currentState.getConstraint(assertThatParameter, ObjectConstraint.class); if (nullNessConstraint == ObjectConstraint.NULL) { return null; } return currentState; }

Target:
private static ProgramState checkAssertIsNotNull(ProgramState currentState, CheckerContext context, MethodInvocationTree methodInvocation) { MethodInvocationTree mit = methodInvocation; while (true) { ExpressionTree methodSelect = mit.methodSelect(); if (!methodSelect.is(Tree.Kind.MEMBER_SELECT)) { return currentState; } ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); if (!expression.is(Tree.Kind.METHOD_INVOCATION)) { return currentState; } mit = (MethodInvocationTree) expression; if (ASSERT_THAT.anyMatch(mit)) { break; } } ExplodedGraph.Node node = context.getNode(); Tree previousSyntaxNode; do { node = node.parent(); if (node == null) { return currentState; } previousSyntaxNode = node.programPoint.syntaxTree(); } while (!previousSyntaxNode.equals(mit)); SymbolicValue assertThatParameter = node.programState.peekValue(); if (assertThatParameter == null) { return currentState; } ObjectConstraint nullNessConstraint = currentState.getConstraint(assertThatParameter, ObjectConstraint.class); if (nullNessConstraint == ObjectConstraint.NULL) { return null; } return currentState; }
Source:
public Response add(UserPermission entity) throws SQLException { Context.getPermissionsManager().checkAdmin(getUserId()); if (entity.getUserId() == entity.getOtherUserId()) { throw new SecurityException("Selfmanagement prohibited"); } Context.getDataManager().linkUser(entity.getUserId(), entity.getOtherUserId()); Context.getPermissionsManager().refreshUserPermissions(); return Response.ok(entity).build(); }

Target:
public Response add(UserPermission entity) throws SQLException { Context.getPermissionsManager().checkAdmin(getUserId()); if (entity.getUserId() != entity.getManagedUserId()) { Context.getDataManager().linkUser(entity.getUserId(), entity.getManagedUserId()); Context.getPermissionsManager().refreshUserPermissions(); } return Response.ok(entity).build(); }
Source:
public String getAlgorithm() { return "SK-ECDSA"; }

Target:
public String getAlgorithm() { return ALGORITHM; }
Source:
public final FormValidation doCheckId(@ContextInPath ModelObject context, @QueryParameter String value) { if (value.isEmpty()) { return FormValidation.ok(); } if (!value.matches("[a-zA-Z0-9_.-]+")) { return FormValidation.error("Unacceptable characters"); } FormValidation problem = checkForDuplicates(value, context, context); if (problem != null) { return problem; } CredentialsStoreAction a; if (!(context instanceof User)) { User me = User.current(); if (me != null) { problem = checkForDuplicates(value, context, me); if (problem != null) { return problem; } } } if (!(context instanceof Jenkins)) { Jenkins j = Jenkins.getInstance(); if (j != null) { problem = checkForDuplicates(value, context, j); if (problem != null) { return problem; } } } return FormValidation.ok(); }

Target:
public final FormValidation doCheckId(@ContextInPath ModelObject context, @QueryParameter String value) { if (value.isEmpty()) { return FormValidation.ok(); } if (!value.matches("[a-zA-Z0-9_.-]+")) { return FormValidation.error("Unacceptable characters"); } FormValidation problem = checkForDuplicates(value, context, context); if (problem != null) { return problem; } if (!(context instanceof User)) { User me = User.current(); if (me != null) { problem = checkForDuplicates(value, context, me); if (problem != null) { return problem; } } } if (!(context instanceof Jenkins)) { Jenkins j = Jenkins.getInstance(); if (j != null) { problem = checkForDuplicates(value, context, j); if (problem != null) { return problem; } } } return FormValidation.ok(); }
Source:
public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); AddExternalEventParameters parameters; boolean isHostExternalStateDefined = event.isSetHost() && event.getHost().isSetExternalStatus() && event.getHost().getExternalStatus().isSetState(); boolean isStorageDomainExternalStateDefined = event.isSetStorageDomain() && event.getStorageDomain().isSetExternalStatus() && event.getStorageDomain().getExternalStatus().isSetState(); if (isHostExternalStateDefined) { parameters = new AddExternalEventParameters(map(event), HostMapper.map(EntityExternalStatus.fromValue( event.getHost().getExternalStatus().getState()), null)); } else if (isStorageDomainExternalStateDefined) { parameters = new AddExternalEventParameters(map(event), HostMapper.map(EntityExternalStatus.fromValue( event.getStorageDomain().getExternalStatus().getState()), null)); } else{ parameters = new AddExternalEventParameters(map(event), null); } return performCreate(VdcActionType.AddExternalEvent, parameters, new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }

Target:
public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); AddExternalEventParameters parameters; boolean isHostExternalStateDefined = event.isSetHost() && event.getHost().isSetExternalStatus() && event.getHost().getExternalStatus().isSetState(); boolean isStorageDomainExternalStateDefined = event.isSetStorageDomain() && event.getStorageDomain().isSetExternalStatus() && event.getStorageDomain().getExternalStatus().isSetState(); if (isHostExternalStateDefined) { parameters = new AddExternalEventParameters(map(event), ExternalStatusMapper.map(EntityExternalStatus.fromValue( event.getHost().getExternalStatus().getState()), null)); } else if (isStorageDomainExternalStateDefined) { parameters = new AddExternalEventParameters(map(event), ExternalStatusMapper.map(EntityExternalStatus.fromValue( event.getStorageDomain().getExternalStatus().getState()), null)); } else{ parameters = new AddExternalEventParameters(map(event), null); } return performCreate(VdcActionType.AddExternalEvent, parameters, new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }
Source:
public void testNonForwardQueryPause() throws Exception { final String sql = "select * from default.lineitem"; TableDesc tableDesc = cluster.getMaster().getCatalog().getTableDesc("default", "lineitem"); assertNotNull(tableDesc); assertEquals(0L, tableDesc.getStats().getNumRows().longValue()); InputStream testInput = new ByteArrayInputStream(new byte[]{(byte) DefaultTajoCliOutputFormatter.QUIT_COMMAND}); try (TajoCli cli = new TajoCli(cluster.getConfiguration(), new String[]{}, null, testInput, out)) { setVar(cli, SessionVars.CLI_PAGE_ROWS, "2"); setVar(cli, SessionVars.CLI_FORMATTER_CLASS, TajoCliOutputTestFormatter.class.getName()); cli.executeScript(sql); String consoleResult; consoleResult = new String(out.toByteArray()); assertOutputResult(consoleResult); } }

Target:
public void testNonForwardQueryPause() throws Exception { final String sql = "select * from default.lineitem"; TableDesc tableDesc = cluster.getMaster().getCatalog().getTableDesc("default", "lineitem"); assertNotNull(tableDesc); assertEquals(0L, tableDesc.getStats().getNumRows().longValue()); try (InputStream testInput = new ByteArrayInputStream(new byte[]{(byte) DefaultTajoCliOutputFormatter.QUIT_COMMAND}); TajoCli cli = new TajoCli(cluster.getConfiguration(), new String[]{}, null, testInput, out)) { setVar(cli, SessionVars.CLI_PAGE_ROWS, "2"); setVar(cli, SessionVars.CLI_FORMATTER_CLASS, TajoCliOutputTestFormatter.class.getName()); cli.executeScript(sql); String consoleResult; consoleResult = new String(out.toByteArray()); assertOutputResult(consoleResult); } }
Source:
@Test public void fieldVariableElement() { TypeElement classElement = getElement(VariableElementFieldClass.class); List<VariableElement> methods = fieldsIn(elements.getAllMembers(classElement)); VariableElement element = findFirst(methods, "name"); try { ParameterSpec.get(element); } catch (IllegalArgumentException exception) { assertThat(exception).hasMessageThat().isEqualTo("element is not a parameter"); } }

Target:
@Test public void fieldVariableElement() { TypeElement classElement = getElement(VariableElementFieldClass.class); List<VariableElement> methods = fieldsIn(elements.getAllMembers(classElement)); VariableElement element = findFirst(methods, "name"); try { ParameterSpec.get(element); fail(); } catch (IllegalArgumentException exception) { assertThat(exception).hasMessageThat().isEqualTo("element is not a parameter"); } }
Source:
private void overwriteScChambers(SupremeCourtJudgment oldJudgment, SupremeCourtJudgment newJudgment) { oldJudgment.getScChambers().stream().forEach(scChamber-> removeChamberFromOld(oldJudgment, newJudgment, scChamber)); newJudgment.getScChambers().stream().forEach(scChamber->addChamberToOld(oldJudgment, scChamber)); }

Target:
private void overwriteScChambers(SupremeCourtJudgment oldJudgment, SupremeCourtJudgment newJudgment) { oldJudgment.getScChambers().stream().filter(scChamber->!newJudgment.containsScChamber(scChamber)).forEach(scChamber->oldJudgment.removeScChamber(scChamber)); newJudgment.getScChambers().stream().filter(scChamber->!oldJudgment.containsScChamber(scChamber)).forEach(scChamber->oldJudgment.addScChamber(scChamber)); }
Source:
public void reassignTasksToUser(final String userId) { taskService.call((List<TaskAssignmentSummary> reassignments) -> { reassignments.forEach(taskAssignmentSummary -> { if (taskAssignmentSummary.isDelegationAllowed()) { displayNotification(constants.TaskWasDelegated(String.valueOf(taskAssignmentSummary.getTaskId()), taskAssignmentSummary.getTaskName(), userId)); } else { displayUnsuccessfulNotification(constants.ReassignmentNotAllowedOn(String.valueOf(taskAssignmentSummary.getTaskId()), taskAssignmentSummary.getTaskName(), userId)); } }); reassignments.forEach(taskAssignmentSummary -> { if (taskAssignmentSummary.isDelegationAllowed()) { taskRefreshed.fire(new TaskRefreshedEvent()); return; } }); bulkActionPerformedEvent.fire(new BulkActionPerformedEvent()); placeManager.closePlace(place); }, new DefaultErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { displayUnsuccessfulNotification(constants.UnableToPerformReassignment(userId, throwable.getMessage())); return false; } }).delegateTasks(serverTemplateId, tasksToReassign, userId); }

Target:
public void reassignTasksToUser(final String userId) { taskService.call((List<TaskAssignmentSummary> reassignments) -> { reassignments.forEach(taskAssignmentSummary -> { if (taskAssignmentSummary.isDelegationAllowed()) { displayNotification(constants.TaskWasDelegated(String.valueOf(taskAssignmentSummary.getTaskId()), taskAssignmentSummary.getTaskName(), userId)); } else { displayUnsuccessfulNotification(constants.ReassignmentNotAllowedOn(String.valueOf(taskAssignmentSummary.getTaskId()), taskAssignmentSummary.getTaskName(), userId)); } }); reassignments.stream() .filter(taskAssignmentSummary -> taskAssignmentSummary.isDelegationAllowed()) .findFirst() .ifPresent(taskAssignmentSummary -> taskRefreshed.fire(new TaskRefreshedEvent(serverTemplateId, taskAssignmentSummary.getDeploymentId(), taskAssignmentSummary.getTaskId()))); deselectAllItemsEvent.fire(new DeselectAllItemsEvent()); placeManager.closePlace(place); }, new DefaultErrorCallback() { @Override public boolean error(Message message, Throwable throwable) { displayUnsuccessfulNotification(constants.UnableToPerformReassignment(userId, throwable.getMessage())); return false; } }).delegateTasks(serverTemplateId, tasksToReassign, userId); }
Source:
private static Consumer<OutputLinkWriter> links(String fingerprint) { return outputLinkWriter -> outputLinkWriter.addLink("self", Routes.Materials.modification(fingerprint)) .addAbsoluteLink("doc", Routes.Materials.DOC) .addLink("find", Routes.Materials.FIND_MODIFICATIONS); }

Target:
private static Consumer<OutputLinkWriter> links(String fingerprint) { return outputLinkWriter -> outputLinkWriter.addLink("self", Routes.MaterialModifications.modification(fingerprint)) .addAbsoluteLink("doc", Routes.MaterialConfig.DOC) .addLink("find", Routes.MaterialModifications.FIND); }
Source:
public void forceSnapshotSync(String clusterId) { if (localClusterDescriptor.getRole() == ClusterRole.STANDBY) { String errorStr = "The forceSnapshotSync command is not supported on standby cluster: " + localNodeDescriptor; log.error(errorStr); throw new RuntimeException(errorStr); } log.info("Received the forceSnapshotSync command at node and will write to the replicationTable.", localNodeDescriptor); ReplicationEventKey key = ReplicationEventKey.newBuilder().setKey(System.currentTimeMillis() + " "+ clusterId).build(); ReplicationEvent event = ReplicationEvent.newBuilder().setClusterId(clusterId).setType(LogReplicationMetadata.ReplicationEventType.FORCE_SNAPSHOT_SYNC).build(); getLogReplicationMetadataManager().updateLogReplicationEventTable(key, event); }

Target:
public void forceSnapshotSync(String clusterId) throws LogReplicationDiscoveryServiceException { if (localClusterDescriptor.getRole() == ClusterRole.STANDBY) { String errorStr = "The forceSnapshotSync command is not supported on standby cluster."; log.error(errorStr); throw new LogReplicationDiscoveryServiceException(errorStr); } log.info("Received the forceSnapshotSync command."); ReplicationEventKey key = ReplicationEventKey.newBuilder().setKey(System.currentTimeMillis() + " "+ clusterId).build(); ReplicationEvent event = ReplicationEvent.newBuilder().setClusterId(clusterId).setType(LogReplicationMetadata.ReplicationEventType.FORCE_SNAPSHOT_SYNC).build(); getLogReplicationMetadataManager().updateLogReplicationEventTable(key, event); }
Source:
public static void skipOnOS(OS... oses) { OS currentOs = SkipUtil.getOs(); if (Arrays.asList(oses).indexOf(currentOs) >= 0) { throw new SkipException("Skipping test on " + currentOs); } }

Target:
public static void skipOnOS(OS... oses) { OS currentOs = OS.getCurrentOs(); if (Arrays.asList(oses).contains(currentOs)) { throw new SkipException("Skipping test on " + currentOs); } }
Source:
public boolean accept(final File file, final String name) { if (name.toLowerCase().endsWith(".xml") || name.toLowerCase().endsWith(".json")) { return true; } return false; }

Target:
public boolean accept(final File file, final String name) { String fileName = name.toLowerCase(); if (fileName.endsWith(".xml") || fileName.endsWith(".json")) { return true; } return false; }
Source:
public synchronized boolean removeScanner(WebSocketPassiveScanner passiveScanner) { return getPassiveScannersSet().remove(passiveScanner); }

Target:
public synchronized boolean removeScanner(WebSocketPassiveScanner passiveScanner) { return getPassiveScannersSet().remove(new WebSocketPassiveScannerDecorator(passiveScanner)); }
Source:
public static void checkoutEntry(final Repository repo, File f, DirCacheEntry entry, ObjectReader or) throws IOException { ObjectLoader ol = or.open(entry.getObjectId()); File parentDir = f.getParentFile(); File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); FileOutputStream rawChannel = new FileOutputStream(tmpFile); OutputStream channel; if (opt.getAutoCRLF() == AutoCRLF.TRUE) channel = new AutoCRLFOutputStream(rawChannel); else channel = rawChannel; try { ol.copyTo(channel); } finally { channel.close(); } FS fs = repo.getFS(); if (opt.isFileMode() && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { FileUtils.delete(f); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); entry.setLength(f.length()); }

Target:
public static void checkoutEntry(final Repository repo, File f, DirCacheEntry entry, ObjectReader or) throws IOException { ObjectLoader ol = or.open(entry.getObjectId()); File parentDir = f.getParentFile(); File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); FileOutputStream rawChannel = new FileOutputStream(tmpFile); OutputStream channel; if (opt.getAutoCRLF() == AutoCRLF.TRUE) channel = new AutoCRLFOutputStream(rawChannel); else channel = rawChannel; try { ol.copyTo(channel); } finally { channel.close(); } FS fs = repo.getFS(); if (opt.isFileMode() && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { FileUtils.delete(f); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); if (opt.getAutoCRLF() != AutoCRLF.FALSE) entry.setLength(f.length()); else entry.setLength((int) ol.getSize()); }
Source:
protected Void copyManagedTemplateCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> callback, CreateBaseImageContext<VolumeApiResult> context) { CopyCommandResult result = callback.getResult(); VolumeApiResult res = new VolumeApiResult(context.getVolume()); res.setResult(result.getResult()); AsyncCallFuture<VolumeApiResult> future = context.getFuture(); DataObject templateOnPrimaryStoreObj = context.destObj; if (!result.isSuccess()) { templateOnPrimaryStoreObj.processEvent(Event.OperationFailed); future.complete(res); return null; } templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer()); future.complete(res); return null; }

Target:
protected Void copyManagedTemplateCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> callback, CreateBaseImageContext<VolumeApiResult> context) { CopyCommandResult result = callback.getResult(); VolumeApiResult res = new VolumeApiResult(context.getVolume()); res.setResult(result.getResult()); AsyncCallFuture<VolumeApiResult> future = context.getFuture(); DataObject templateOnPrimaryStoreObj = context.destObj; if (result.isSuccess()) { templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer()); } else { templateOnPrimaryStoreObj.processEvent(Event.OperationFailed); } future.complete(res); return null; }