auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testOffsetMetricsReturnsNullWhenRetriableExceptionThrown() throws Exception { final int messageCount = 10; prepareSpout(messageCount); Map<String, Long> offsetMetric = (Map<String, Long>) spout.getKafkaOffsetMetric().getValueAndReset(); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalEarliestTimeOffset").longValue(), 0); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestTimeOffset").longValue(), 10); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalRecordsInPartitions").longValue(), 10); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestEmittedOffset").longValue(), 0); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestCompletedOffset").longValue(), 0); assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalSpoutLag").longValue(), 10); for (int i = 0; i < messageCount; i++) { nextTuple_verifyEmitted_ack_resetCollector(i); } commitAndVerifyAllMessagesCommitted(messageCount); when(getKafkaConsumer().beginningOffsets(anyCollection())).thenThrow(TimeoutException.class); offsetMetric = (Map<String, Long>) spout.getKafkaOffsetMetric().getValueAndReset(); assertNull(offsetMetric); }

Target:
public void testOffsetMetricsReturnsNullWhenRetriableExceptionThrown() throws Exception { final int messageCount = 10; prepareSpout(messageCount); when(getKafkaConsumer().beginningOffsets(anyCollection())).thenThrow(TimeoutException.class); Map<String, Long> offsetMetric = (Map<String, Long>) spout.getKafkaOffsetMetric().getValueAndReset(); assertNull(offsetMetric); }
Source:
private void checkSize(final String filePath, int totalBytes) throws IOException { if (totalBytes > runtimeOptions.getUploadSize()) { Files.deleteIfExists(Paths.get(filePath)); logger.error("Size file is bigger than max upload size {}", runtimeOptions.getUploadSize()); throw new IllegalArgumentException("External file size is too big."); } }

Target:
private void checkSize(final String filePath, int totalBytes) { if (totalBytes > runtimeOptions.getUploadSize()) { deleteFile(filePath); logger.error("Size file is bigger than max upload size {}", runtimeOptions.getUploadSize()); throw new IllegalArgumentException("External file size is too big."); } }
Source:
public ExecutionErrorManagerImpl(ExecutionErrorStorage storage) { ServiceLoader<ExecutionErrorFilter> discoveredFilters = ServiceLoader.load(ExecutionErrorFilter.class); discoveredFilters.forEach(filter -> filters.add(filter)); filters.sort((ExecutionErrorFilter f1, ExecutionErrorFilter f2) -> { return f1.getPriority().compareTo(f2.getPriority()); }); logger.debug("Error handling filters {}", this.filters); this.storage = storage; logger.debug("Execution error storage {}", this.storage); ServiceLoader<ExecutionErrorListener> discoveredListeners = ServiceLoader.load(ExecutionErrorListener.class); logger.debug("Error event listeners {}", discoveredListeners); discoveredListeners.forEach(filter -> listeners.add(filter)); }

Target:
public ExecutionErrorManagerImpl(ExecutionErrorStorage storage) { ServiceLoader<ExecutionErrorFilter> discoveredFilters = ServiceLoader.load(ExecutionErrorFilter.class); discoveredFilters.forEach(filter -> filters.add(filter)); filters.sort((ExecutionErrorFilter f1, ExecutionErrorFilter f2) -> { return f1.getPriority().compareTo(f2.getPriority()); }); logger.debug("Error handling filters {}", this.filters); this.storage = storage; logger.debug("Execution error storage {}", this.storage); ServiceLoader<ExecutionErrorListener> discoveredListeners = ServiceLoader.load(ExecutionErrorListener.class); logger.debug("Error event listeners {}", discoveredListeners); discoveredListeners.forEach(listener -> listeners.add(listener)); }
Source:
public IndexSourceMatcher(String expectedTableName, Map<String, Domain> expectedConstraint) { this.expectedTableName = requireNonNull(expectedTableName, "expectedTableName is null"); this.expectedConstraint = Optional.of(requireNonNull(expectedConstraint, "expectedConstraint is null")); }

Target:
public IndexSourceMatcher(String expectedTableName, Map<String, Domain> expectedConstraint) { this.expectedTableName = requireNonNull(expectedTableName, "expectedTableName is null"); this.expectedConstraint = Optional.of(ImmutableMap.copyOf(expectedConstraint)); }
Source:
public void updateAccount(AccountAttributes a, boolean updateStudentProfile) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, a); if (!a.isValid()) { throw new InvalidParametersException(a.getInvalidityInfo()); } Account accountToUpdate = getAccountEntity(a.googleId, updateStudentProfile); if (accountToUpdate == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_ACCOUNT + a.googleId + ThreadHelper.getCurrentThreadStack()); } a.sanitizeForSaving(); accountToUpdate.setName(a.name); accountToUpdate.setEmail(a.email); accountToUpdate.setIsInstructor(a.isInstructor); accountToUpdate.setInstitute(a.institute); if (updateStudentProfile) { StudentProfile existingStudentProfile = accountToUpdate.getStudentProfile(); if (existingStudentProfile == null) { existingStudentProfile = new StudentProfile(a.studentProfile.googleId); } StudentProfileAttributes existingProfile = new StudentProfileAttributes(existingStudentProfile); a.studentProfile.modifiedDate = existingProfile.modifiedDate; if (!existingProfile.toString().equals(a.studentProfile.toString())) { StudentProfile updatedStudentProfile = a.studentProfile.toEntity(); accountToUpdate.setStudentProfile(updatedStudentProfile); profilesDb.saveEntity(updatedStudentProfile); } } saveEntity(accountToUpdate, a); }

Target:
public void updateAccount(AccountAttributes a, boolean updateStudentProfile) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, a); if (!a.isValid()) { throw new InvalidParametersException(a.getInvalidityInfo()); } Account accountToUpdate = getAccountEntity(a.googleId, updateStudentProfile); if (accountToUpdate == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_ACCOUNT + a.googleId + ThreadHelper.getCurrentThreadStack()); } a.sanitizeForSaving(); accountToUpdate.setName(a.name); accountToUpdate.setEmail(a.email); accountToUpdate.setIsInstructor(a.isInstructor); accountToUpdate.setInstitute(a.institute); if (updateStudentProfile) { StudentProfile existingProfile = accountToUpdate.getStudentProfile(); if (existingProfile == null) { existingProfile = new StudentProfile(a.studentProfile.googleId); } StudentProfileAttributes existingProfileAttributes = new StudentProfileAttributes(existingProfile); a.studentProfile.modifiedDate = existingProfileAttributes.modifiedDate; if (!existingProfileAttributes.toString().equals(a.studentProfile.toString())) { StudentProfile updatedProfile = a.studentProfile.toEntity(); accountToUpdate.setStudentProfile(updatedProfile); profilesDb.saveEntity(updatedProfile); } } saveEntity(accountToUpdate, a); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE__SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestUploadOfContentFromApps(data, resultCode); } else if (requestCode == REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestUploadOfFilesFromFileSystem(data, resultCode); } else if(requestCode == REQUEST_CODE__UPLOAD_FROM_CAMERA && (resultCode == RESULT_OK || requestCode == UploadFilesActivity.RESULT_OK_AND_MOVE)){ requestUploadOfFilesFromFileSystem(data,resultCode); Log.e("#PointerValue",""+1); }else if (requestCode == REQUEST_CODE__MOVE_FILES && resultCode == RESULT_OK) { final Intent fData = data; getHandler().postDelayed( new Runnable() { @Override public void run() { requestMoveOperation(fData); } }, DELAY_TO_REQUEST_OPERATIONS_LATER ); } else if (requestCode == REQUEST_CODE__COPY_FILES && resultCode == RESULT_OK) { final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed( new Runnable() { @Override public void run() { requestCopyOperation(fData); } }, DELAY_TO_REQUEST_OPERATIONS_LATER ); } else { super.onActivityResult(requestCode, resultCode, data); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE__SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestUploadOfContentFromApps(data, resultCode); } else if (requestCode == REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestUploadOfFilesFromFileSystem(data, resultCode); } else if(requestCode == REQUEST_CODE__UPLOAD_FROM_CAMERA && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)){ requestUploadOfFilesFromFileSystem(data,resultCode); } else if (requestCode == REQUEST_CODE__MOVE_FILES && resultCode == RESULT_OK) { final Intent fData = data; getHandler().postDelayed( new Runnable() { @Override public void run() { requestMoveOperation(fData); } }, DELAY_TO_REQUEST_OPERATIONS_LATER ); } else if (requestCode == REQUEST_CODE__COPY_FILES && resultCode == RESULT_OK) { final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed( new Runnable() { @Override public void run() { requestCopyOperation(fData); } }, DELAY_TO_REQUEST_OPERATIONS_LATER ); } else { super.onActivityResult(requestCode, resultCode, data); } }
Source:
public void handleAction(ActionParameters params) throws ActionException { log.debug("Getting layer groups"); JSONArray json = getGroupJSON(-1,params, 0); log.debug("Got layer groups"); ResponseHelper.writeResponse(params, json); }

Target:
public void handleAction(ActionParameters params) throws ActionException { log.debug("Getting layer groups"); JSONArray json = getGroupJSON(-1, params); log.debug("Got layer groups"); ResponseHelper.writeResponse(params, json); }
Source:
public void destroy() throws Exception { apiPublisher.deleteAPI(apiID); super.cleanUpUsingRest(); }

Target:
public void destroy() throws Exception { restAPIPublisher.deleteAPI(apiID); super.cleanUp(); }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_OK) { if(requestCode == SELECT_PICTURE) { final boolean isCamera; if(data == null) { isCamera = true; } else { final String action = data.getAction(); if(action == null) { isCamera = false; } else { isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } Uri selectedImageUri; if(isCamera) { selectedImageUri = imageUri; } else { selectedImageUri = data == null ? null : data.getData(); } if(BuildConfig.DEBUG) { Log.d("asdf-----------", selectedImageUri.toString()); } ImageView viewById = (ImageView) findViewById(R.id.test); Picasso.with(this).load(selectedImageUri).into(viewById); } } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_OK) { if(requestCode == SELECT_PICTURE) { final boolean isCamera; if(data == null) { isCamera = true; } else { final String action = data.getAction(); if(action == null) { isCamera = false; } else { isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } Uri selectedImageUri; if(isCamera) { selectedImageUri = imageUri; } else { selectedImageUri = data == null ? null : data.getData(); } if(BuildConfig.DEBUG) { Log.d("asdf-----------", selectedImageUri.toString()); } adapter.refreshTestImage(selectedImageUri); } } }
Source:
public int getMinutes() { Toast.makeText(this.context, this.context.getString(R.string.invalid_method_call) + "getMinutes()", Toast.LENGTH_SHORT).show(); return 0; }

Target:
public int getMinutes() { return this.timerMinute; }
Source:
public String digestParams(RestInvocation restInvocation) { String path = restInvocation.getPath(); String queryParameters = restInvocation.getQueryString(); String toSign = "/" + path + "?" + queryParameters; Mac mac = getMac(); try { mac.update(toSign.getBytes("UTF-8")); } catch (IllegalStateException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String secondResult = bytesToHex(mac.doFinal()); return secondResult; }

Target:
public String digestParams(RestInvocation restInvocation) { try { String path = restInvocation.getPath(); String queryParameters = restInvocation.getQueryString(); String toSign = "/" + path + "?" + queryParameters; Mac mac = getMac(); mac.update(toSign.getBytes("UTF-8")); return bytesToHex(mac.doFinal()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("This JVM does not support HMAC_SHA_256?", e); } }
Source:
public NavResult getNav() throws DotDataException, DotSecurityException { return getNav(request.getRequestURI().replace("/api/v1/page/render/","/")); }

Target:
public NavResult getNav() throws DotDataException, DotSecurityException { return getNav(request.getRequestURI().replace("/api/v1/page/render/", StringPool.SLASH)); }
Source:
private Map<Address, Response> invokeRemotelyInLocalSite(CacheRpcCommand command) throws Exception { commandsFactory.initializeReplicableCommand(command, false); RpcOptions options = rpcManager.getDefaultRpcOptions(true, DeliverOrder.NONE); CompletableFuture<Map<Address, Response>> remoteFuture = rpcManager.invokeRemotelyAsync(null, command, options); final Future<Response> localFuture = asyncExecutor.submit( LocalInvocation.newInstance(responseGenerator, command, commandsFactory, rpcManager.getAddress())); final Map<Address, Response> responseMap = new HashMap<>(); responseMap.put(rpcManager.getAddress(), localFuture.get()); responseMap.putAll(RpcUtil.waitFor(remoteFuture, options.timeout(), options.timeUnit())); return responseMap; }

Target:
private Map<Address, Response> invokeRemotelyInLocalSite(CacheRpcCommand command) throws Exception { commandsFactory.initializeReplicableCommand(command, false); CompletableFuture<Map<Address, Response>> remoteFuture = rpcManager.invokeRemotelyAsync(null, command, rpcManager.getDefaultRpcOptions(true, DeliverOrder.NONE)); final Future<Response> localFuture = asyncExecutor.submit( LocalInvocation.newInstance(responseGenerator, command, commandsFactory, rpcManager.getAddress())); final Map<Address, Response> responseMap = new HashMap<>(); responseMap.put(rpcManager.getAddress(), localFuture.get()); responseMap.putAll(CompletableFutures.await(remoteFuture)); return responseMap; }
Source:
protected WorkflowItemRest createAndReturn(Context context, List<String> stringList) { XmlWorkflowItem source; if (stringList.isEmpty()) { throw new UnprocessableEntityException("The given URI list could not be parsed and is empty as a result"); } try { source = submissionService.createWorkflowItem(context, stringList.get(0)); } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (WorkflowException e) { throw new UnprocessableEntityException( "Invalid workflow action: " + e.getMessage(), e); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } if (source.getItem().isArchived()) { return null; } return converter.convert(source); }

Target:
protected WorkflowItemRest createAndReturn(Context context, List<String> stringList) { XmlWorkflowItem source; if (stringList == null || stringList.isEmpty() || stringList.size() > 1) { throw new UnprocessableEntityException("The given URI list could not be properly parsed to one result"); } try { source = submissionService.createWorkflowItem(context, stringList.get(0)); } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (WorkflowException e) { throw new UnprocessableEntityException( "Invalid workflow action: " + e.getMessage(), e); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } if (source.getItem().isArchived()) { return null; } return converter.convert(source); }
Source:
public static URI discoverableBoltUri( String scheme, Config config, Setting<URI> override, ConnectorPortRegister connectorPortRegister ) { if ( config.isConfigured( override ) ) { return config.get( override ); } Optional<AdvertisedSocketAddress> boltAddress = config.enabledBoltConnectors().stream().findFirst().map( boltConnector -> config.get( boltConnector.advertised_address ) ); if ( boltAddress.isPresent() ) { AdvertisedSocketAddress advertisedSocketAddress = boltAddress.get(); if ( advertisedSocketAddress.getPort() == 0 ) { int boltPort = connectorPortRegister.getLocalAddress( "bolt" ).getPort(); return boltURI( scheme, advertisedSocketAddress.getHostname(), boltPort ); } return boltURI( scheme, advertisedSocketAddress.getHostname(), advertisedSocketAddress.getPort() ); } return null; }

Target:
public static Optional<URI> discoverableBoltUri( String scheme, Config config, Setting<URI> override, ConnectorPortRegister connectorPortRegister ) { if ( config.isConfigured( override ) ) { return Optional.ofNullable( config.get( override ) ); } return config.enabledBoltConnectors().stream().findFirst().map( c -> { AdvertisedSocketAddress advertisedSocketAddress = config.get( c.advertised_address ); if ( advertisedSocketAddress.getPort() == 0 ) { int boltPort = connectorPortRegister.getLocalAddress( c.key() ).getPort(); return boltURI( scheme, advertisedSocketAddress.getHostname(), boltPort ); } return boltURI( scheme, advertisedSocketAddress.getHostname(), advertisedSocketAddress.getPort() ); } ); }
Source:
void updateTitlePadding() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { int logoWidth = logoPanel.getOffsetWidth(); if (logoWidth > 0) { logoWidth += 10; headerTitlePanel.getParent().getElement().getStyle().setMarginLeft(logoWidth, Unit.PX); } } }); }

Target:
void updateTitlePadding() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { int logoWidth = logoPanel.getOffsetWidth(); if (logoWidth > 0) { logoWidth += IMAGE_MARGIN; headerTitlePanel.getParent().getElement().getStyle().setMarginLeft(logoWidth, Unit.PX); } } }); }
Source:
public DependencyPair executePlanFragment( Map<Integer, List<VoltTable>> dependencies, long fragmentId, ParameterSet params, SystemProcedureExecutionContext context) { if (fragmentId == PF_cancelShutdown) { super.run(context); VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); if (context.isLowestSiteId()){ VoltDB.instance().setShuttingdown(false); t.addRow(m_stat.getMzxid()); if (LOG.isDebugEnabled()) { LOG.debug("@PrepareShutdown returning sigil " + ll(m_stat.getMzxid())); } } return new DependencyPair.TableDependencyPair(SysProcFragmentId.PF_cancelShutdown, t); } else if (fragmentId == PF_cancelShutdownAggregate) { NavigableSet<Long> uniqueTxnIds = new TreeSet<>(); for (VoltTable t: dependencies.get(SysProcFragmentId.PF_cancelShutdown)) { while (t.advanceRow()) { uniqueTxnIds.add(t.getLong(0)); } } VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); for (long zktxnid: uniqueTxnIds) { t.addRow(zktxnid); } return new DependencyPair.TableDependencyPair(SysProcFragmentId.PF_cancelShutdownAggregate, t); } else { VoltDB.crashLocalVoltDB( "Received unrecognized plan fragment id " + fragmentId + " in CancelShutdown", false, null); } throw new RuntimeException("Should not reach this code"); }

Target:
public DependencyPair executePlanFragment( Map<Integer, List<VoltTable>> dependencies, long fragmentId, ParameterSet params, SystemProcedureExecutionContext context) { if (fragmentId == PF_cancelShutdown) { if (context.isLowestSiteId()){ VoltDB.instance().setShuttingdown(false); } super.run(context); VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); if (context.isLowestSiteId()){ t.addRow(m_stat.getMzxid()); if (LOG.isDebugEnabled()) { LOG.debug("@CancelShutdown returning sigil " + ll(m_stat.getMzxid())); } } return new DependencyPair.TableDependencyPair(SysProcFragmentId.PF_cancelShutdown, t); } else if (fragmentId == PF_cancelShutdownAggregate) { NavigableSet<Long> uniqueTxnIds = new TreeSet<>(); for (VoltTable t: dependencies.get(SysProcFragmentId.PF_cancelShutdown)) { while (t.advanceRow()) { uniqueTxnIds.add(t.getLong(0)); } } VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); for (long zktxnid: uniqueTxnIds) { t.addRow(zktxnid); } return new DependencyPair.TableDependencyPair(SysProcFragmentId.PF_cancelShutdownAggregate, t); } else { VoltDB.crashLocalVoltDB( "Received unrecognized plan fragment id " + fragmentId + " in CancelShutdown", false, null); } throw new RuntimeException("Should not reach this code"); }
Source:
public void onKeyPress(KeyPressEvent event) { final int i = getCurrentRow(); final Widget radioButton = table.getWidget(i, 1); if (radioButton instanceof RadioButton) { ((RadioButton) radioButton).setValue(true); deleteButton.setEnabled(canBeDeletedArray[i]); } }

Target:
public void onKeyPress(KeyPressEvent event) { final int i = getCurrentRow(); final Widget radioButton = table.getWidget(i, 1); if (radioButton instanceof RadioButton) { ((RadioButton) radioButton).setFocus(true); ((RadioButton) radioButton).setValue(true); deleteButton.setEnabled(canBeDeletedArray[i]); } }
Source:
public INDArray propUp(INDArray v, boolean training) { INDArray W = getParam(PretrainParamInitializer.WEIGHT_KEY); if(training) { if(conf.isUseDropConnect()) { if (conf.getLayer().getDropOut() > 0) { W = Dropout.applyDropConnect(this,DefaultParamInitializer.WEIGHT_KEY); } } } INDArray hBias = getParam(PretrainParamInitializer.BIAS_KEY); if(layerConf().getVisibleUnit() == org.deeplearning4j.nn.conf.layers.RBM.VisibleUnit.GAUSSIAN) this.sigma = v.var(0).divi(input.rows()); INDArray preSig = v.mmul(W).addiRowVector(hBias); switch (layerConf().getHiddenUnit()) { case RECTIFIED: preSig = max(preSig, 0.0); return preSig; case GAUSSIAN: preSig.addi(Nd4j.randn(preSig.rows(), preSig.columns(), rng)); return preSig; case BINARY: return sigmoid(preSig); case SOFTMAX: return Nd4j.getExecutioner().execAndReturn(Nd4j.getOpFactory().createTransform("softmax", preSig)); default: throw new IllegalStateException("Hidden unit type should either be binary, gaussian, or rectified linear"); } }

Target:
public INDArray propUp(INDArray v, boolean training) { INDArray W = getParam(PretrainParamInitializer.WEIGHT_KEY); if(training && conf.isUseDropConnect() && conf.getLayer().getDropOut() > 0) { W = Dropout.applyDropConnect(this,DefaultParamInitializer.WEIGHT_KEY); } INDArray hBias = getParam(PretrainParamInitializer.BIAS_KEY); if(layerConf().getVisibleUnit() == org.deeplearning4j.nn.conf.layers.RBM.VisibleUnit.GAUSSIAN) this.sigma = v.var(0).divi(input.rows()); INDArray preSig = v.mmul(W).addiRowVector(hBias); switch (layerConf().getHiddenUnit()) { case RECTIFIED: preSig = max(preSig, 0.0); return preSig; case GAUSSIAN: preSig.addi(Nd4j.randn(preSig.rows(), preSig.columns(), rng)); return preSig; case BINARY: return sigmoid(preSig); case SOFTMAX: return Nd4j.getExecutioner().execAndReturn(Nd4j.getOpFactory().createTransform("softmax", preSig)); default: throw new IllegalStateException("Hidden unit type should either be binary, gaussian, or rectified linear"); } }
Source:
protected BundleContext getContext() { Bundle cxfBundle = FrameworkUtil.getBundle(TransformerLocatorImpl.class); if (cxfBundle != null) { return cxfBundle.getBundleContext(); } return null; }

Target:
protected BundleContext getContext() { Bundle bundle = FrameworkUtil.getBundle(TransformerLocatorImpl.class); if (bundle != null) { return bundle.getBundleContext(); } return null; }
Source:
protected ActionResult execute() throws EntityDoesNotExistException { try { String userEmailToResend = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(userEmailToResend); statusToAdmin = "Action Student Clicked Request Resending Links" + "<br>Email: " + userEmailToResend; boolean isValid = isValidEmailAddress(userEmailToResend); if (isValid) { EmailWrapper email = new EmailGenerator().generateFeedbackSessionResendLinksEmail(userEmailToResend); emailSender.sendEmail(email); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_ACCESS_LINKS_RESENT, StatusMessageColor.SUCCESS)); } else { statusToUser.add(new StatusMessage(Const.StatusMessages .FEEDBACK_SESSION_RESEND_ACCESS_LINKS_INVALID_EMAIL, StatusMessageColor.DANGER)); } PageData data = new FeedbackResendLinksPageData(account, sessionToken, isValid); return createAjaxResult(data); } catch (EmailSendingException e) { log.severe("Email of feedback session links failed to send: " + TeammatesException.toStringWithStackTrace(e)); } return null; }

Target:
protected ActionResult execute() throws EntityDoesNotExistException { try { FieldValidator validator = new FieldValidator(); String userEmailToResend = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); statusToAdmin = "Resend links requested" + "<br>Email: " + userEmailToResend; String error = validator.getInvalidityInfoForEmail(userEmailToResend); if (!error.isEmpty()) { statusToUser.add(new StatusMessage(error, StatusMessageColor.DANGER)); PageData data = new FeedbackResendLinksPageData(account, sessionToken, error); return createAjaxResult(data); } boolean shouldSkipVerification = getNonNullRequestParamValue( Const.ParamsNames.SHOULD_SKIP_RECAPTCHA_VERIFICATION).equals("true"); if (gateKeeper.getCurrentUser() != null && !shouldSkipVerification) { shouldSkipVerification = gateKeeper.getCurrentUser().isAdmin; } String recaptchaResponse = getNonNullRequestParamValue(Const.ParamsNames.RECAPTCHA_RESPONSE); if (!isReCaptchaValid(Config.RECAPTCHA_SECRETKEY, recaptchaResponse) && !shouldSkipVerification) { error = Const.StatusMessages.RECAPTCHA_VALIDATION_FAILED; statusToUser.add(new StatusMessage(error, StatusMessageColor.DANGER)); PageData data = new FeedbackResendLinksPageData(account, sessionToken, error); return createAjaxResult(data); } EmailWrapper email = new EmailGenerator().generateFeedbackSessionResendLinksEmail(userEmailToResend); emailSender.sendEmail(email); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_ACCESS_LINKS_RESENT, StatusMessageColor.SUCCESS)); PageData data = new FeedbackResendLinksPageData(account, sessionToken, error); return createAjaxResult(data); } catch (EmailSendingException e) { log.severe("Email of feedback session links failed to send: " + TeammatesException.toStringWithStackTrace(e)); } return null; }
Source:
public void setScanFuzzerMessages(boolean scanFuzzerMessages) { this.scanFuzzerMessages = scanFuzzerMessages; getConfig().setProperty(SCAN_FUZZER_MESSAGES_KEY, Boolean.valueOf(scanFuzzerMessages)); }

Target:
public void setScanFuzzerMessages(boolean scanFuzzerMessages) { this.scanFuzzerMessages = scanFuzzerMessages; getConfig().setProperty(SCAN_FUZZER_MESSAGES_KEY, scanFuzzerMessages); setFuzzerOptin(scanFuzzerMessages); }
Source:
private List<SingularityPendingTaskId> getOnDemandLateTasks (List<SingularityPendingTaskId> maybeOnDemandLateTasks) { List<SingularityPendingTaskId> onDemandLateTasks = new ArrayList<>(); for (SingularityPendingTaskId maybeOnDemandLateTask : maybeOnDemandLateTasks) { String requestId = requestManager.getRequest(maybeOnDemandLateTask.getRequestId()).get().getRequest().getId(); Optional<Integer> maybeInstancesLimit = requestManager.getRequest(maybeOnDemandLateTask.getRequestId()).get().getRequest().getInstances(); if (maybeInstancesLimit.isPresent()) { if (taskManager.getActiveTaskIdsForRequest(requestId).size() < maybeInstancesLimit.get()) { onDemandLateTasks.add(maybeOnDemandLateTask); } } } return onDemandLateTasks; }

Target:
private List<SingularityPendingTaskId> getOnDemandLateTasks (List<SingularityPendingTaskId> maybeOnDemandLateTasks) { List<SingularityPendingTaskId> onDemandLateTasks = new ArrayList<>(); for (SingularityPendingTaskId maybeOnDemandLateTask : maybeOnDemandLateTasks) { final Optional<SingularityRequestWithState> maybeRequest = requestManager.getRequest(maybeOnDemandLateTask.getRequestId()); if (maybeRequest.isPresent()) { final Optional<Integer> maybeInstancesLimit = maybeRequest.get().getRequest().getInstances(); if (maybeInstancesLimit.isPresent()) { if (taskManager.getActiveTaskIdsForRequest(maybeOnDemandLateTask.getRequestId()).size() < maybeInstancesLimit.get()) { onDemandLateTasks.add(maybeOnDemandLateTask); } } } } return onDemandLateTasks; }
Source:
public void setParent(IVertexConsumer parent) { super.setParent(parent); VertexFormat format = getVertexFormat(parent); if(format.equals(getVertexFormat())) return; setVertexFormat(format); for(int i = 0; i < getVertexFormat().getElementCount(); i++) { switch(getVertexFormat().getElement(i).getUsage()) { case POSITION: posIndex = i; break; case NORMAL: normalIndex = i; break; case COLOR: colorIndex = i; break; case UV: if(getVertexFormat().getElement(i).getIndex() == 1) { lightmapIndex = i; } break; default: } } if(posIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with position"); } if(lightmapIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with lightmap"); } if(colorIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with color"); } }

Target:
public void setParent(IVertexConsumer parent) { super.setParent(parent); VertexFormat format = getVertexFormat(parent); if(Objects.equal(format, getVertexFormat())) return; setVertexFormat(format); for(int i = 0; i < getVertexFormat().getElementCount(); i++) { switch(getVertexFormat().getElement(i).getUsage()) { case POSITION: posIndex = i; break; case NORMAL: normalIndex = i; break; case COLOR: colorIndex = i; break; case UV: if(getVertexFormat().getElement(i).getIndex() == 1) { lightmapIndex = i; } break; default: } } if(posIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with position"); } if(lightmapIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with lightmap"); } if(colorIndex == -1) { throw new IllegalArgumentException("vertex lighter needs format with color"); } }
Source:
public void webConfiguration() { WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() .withConfiguration( AutoConfigurations.of(RestTemplateAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, WebMvcAutoConfiguration.class, InitializrAutoConfiguration.class)); contextRunner.run((context) -> { assertThat(context).hasSingleBean(InitializrWebConfig.class); assertThat(context).hasSingleBean(MainController.class); assertThat(context).hasSingleBean(UiController.class); }); }

Target:
public void webConfiguration() { WebApplicationContextRunner webContextRunner = new WebApplicationContextRunner() .withConfiguration( AutoConfigurations.of(RestTemplateAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, WebMvcAutoConfiguration.class, InitializrAutoConfiguration.class)); webContextRunner.run((context) -> { assertThat(context).hasSingleBean(InitializrWebConfig.class); assertThat(context).hasSingleBean(MainController.class); assertThat(context).hasSingleBean(UiController.class); }); }
Source:
protected void stringDone(String body) { AuthContext context = serverExchange.getAttachment(AUTH_CONTEXT_KEY); context.clientResponseReceived(); if (clientExchange.getResponse().getResponseCode() == CREATED) { try { JsonNode jsonNode = objectMapper.readTree(body); JsonNode allowedNode = jsonNode == null ? null : jsonNode.get("allowed"); boolean allowed = allowedNode != null && allowedNode.asBoolean(); onRequestResult(serverExchange, connection, allowed); } catch (IOException e) { onRequestFailure(serverExchange, connection, e, true); } } else { IOException e = new IOException(StatusCodes.getReason(clientExchange.getResponse().getResponseCode())); onRequestFailure(serverExchange, connection, e, false); } }

Target:
protected void stringDone(String body) { AuthContext context = serverExchange.getAttachment(AUTH_CONTEXT_KEY); context.clientResponseReceived(); int responseCode = clientExchange.getResponse().getResponseCode(); if (responseCode == CREATED) { try { JsonNode jsonNode = objectMapper.readTree(body); JsonNode allowedNode = jsonNode == null ? null : jsonNode.get("allowed"); boolean allowed = allowedNode != null && allowedNode.asBoolean(); onRequestResult(serverExchange, connection, allowed); } catch (IOException e) { onRequestFailure(serverExchange, connection, e, true); } } else { IOException e = new IOException(StatusCodes.getReason(responseCode)); if(responseCode >= 500) { onRequestFailure(serverExchange, connection, e, true); } else { onRequestFailure(serverExchange, connection, e, false); } } }
Source:
private String getValueFromXML(String inputXML, String xPathQuery) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException { DocumentBuilder builder; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); factory.setFeature("<LINK_0>", true); } catch (Exception e) { logger.warn("failed to ebable xml safe feature"); } builder = factory.newDocumentBuilder(); Document document = builder.parse(new ByteArrayInputStream(inputXML.getBytes())); XPathFactory xpf = XPathFactory.newInstance(); try { xpf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (XPathFactoryConfigurationException ex) { logger.warn("failed to ebable xpath safe feature"); } XPath xpath = xpf.newXPath(); String expression = xPathQuery; Node cipherValue = (Node) xpath.evaluate(expression, document, XPathConstants.NODE); return cipherValue == null ? null : cipherValue.getTextContent(); } catch (XPathExpressionException e) { logger.error(e.getMessage()); throw e; } catch (ParserConfigurationException e) { logger.error(e.getMessage()); throw e; } catch (SAXException e) { logger.error(e.getMessage()); throw e; } catch (IOException e) { logger.error(e.getMessage()); throw e; } }

Target:
private String getValueFromXML(String inputXML, String xPathQuery) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException { DocumentBuilder builder; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); factory.setFeature("<LINK_0>", true); } catch (Exception e) { logger.warn("failed to enable xml safe feature"); } builder = factory.newDocumentBuilder(); Document document = builder.parse(new ByteArrayInputStream(inputXML.getBytes())); XPathFactory xpf = XPathFactory.newInstance(); try { xpf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (XPathFactoryConfigurationException ex) { logger.warn("failed to enable xpath safe feature"); } XPath xpath = xpf.newXPath(); String expression = xPathQuery; Node cipherValue = (Node) xpath.evaluate(expression, document, XPathConstants.NODE); return cipherValue == null ? null : cipherValue.getTextContent(); } catch (XPathExpressionException e) { logger.error(e.getMessage()); throw e; } catch (ParserConfigurationException e) { logger.error(e.getMessage()); throw e; } catch (SAXException e) { logger.error(e.getMessage()); throw e; } catch (IOException e) { logger.error(e.getMessage()); throw e; } }
Source:
private void migrateEntriesWithMetadata(RemoteCache<Object, Object> sourceCache, AtomicInteger counter) { try (CloseableIterator<Map.Entry<Object, MetadataValue<Object>>> iterator = sourceCache.retrieveEntriesWithMetadata(segments, readBatch)) { while (iterator.hasNext() && !Thread.currentThread().isInterrupted()) { Map.Entry<Object, MetadataValue<Object>> entry = iterator.next(); if (!Arrays.equals((byte[]) entry.getKey(), ignoredKey)) { MetadataValue<Object> metadataValue = entry.getValue(); int lifespan = metadataValue.getLifespan(); int maxIdle = metadataValue.getMaxIdle(); long version = metadataValue.getVersion(); Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(version)) .lifespan(lifespan, TimeUnit.SECONDS) .maxIdle(maxIdle, TimeUnit.SECONDS) .build(); executorService.submit(() -> { Object key = entry.getKey(); if (!deletedKeys.contains(new WrappedByteArray((byte[]) key))) { cache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_LOAD, Flag.ROLLING_UPGRADE).putIfAbsent(entry.getKey(), entry.getValue().getValue(), metadata); } int currentCount = counter.incrementAndGet(); if (log.isDebugEnabled() && currentCount % 100 == 0) log.debugf(">> Migrated %s entries\n", currentCount); }); } } } }

Target:
private void migrateEntriesWithMetadata(RemoteCache<Object, Object> sourceCache, AtomicInteger counter) { try (CloseableIterator<Map.Entry<Object, MetadataValue<Object>>> iterator = sourceCache.retrieveEntriesWithMetadata(segments, readBatch)) { while (iterator.hasNext() && !Thread.currentThread().isInterrupted()) { Map.Entry<Object, MetadataValue<Object>> entry = iterator.next(); if (!Arrays.equals((byte[]) entry.getKey(), ignoredKey)) { MetadataValue<Object> metadataValue = entry.getValue(); int lifespan = metadataValue.getLifespan(); int maxIdle = metadataValue.getMaxIdle(); long version = metadataValue.getVersion(); Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(version)) .lifespan(lifespan, TimeUnit.SECONDS) .maxIdle(maxIdle, TimeUnit.SECONDS) .build(); executorService.submit(() -> { Object key = entry.getKey(); if (!deletedKeys.contains(new WrappedByteArray((byte[]) key))) { InternalMetadata internalMetadata = new InternalMetadataImpl(metadata, metadataValue.getCreated(), metadataValue.getLastUsed()); cache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_LOAD, Flag.ROLLING_UPGRADE).putIfAbsent(entry.getKey(), entry.getValue().getValue(), internalMetadata); } int currentCount = counter.incrementAndGet(); if (log.isDebugEnabled() && currentCount % 100 == 0) log.debugf(">> Migrated %s entries\n", currentCount); }); } } } }
Source:
private void wizardCompletedPoints(IAtsTeamWorkflow teamWf, IAtsTeamDefinition teamDef, IAtsChangeSet changes) { ArtifactToken agileTeamArt = AtsClientService.get().getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); if (agileTeamArt != null) { IAgileTeam agileTeam = AtsClientService.get().getConfigItemFactory().getAgileTeam(agileTeamArt); AttributeTypeId agileTeamPointsAttributeType = AtsClientService.get().getAgileService().getAgileTeamPointsAttributeType(agileTeam); XWidget widget = (XWidget) teamDefFieldToWidget.get(teamDef, agileTeamPointsAttributeType.equals( AtsAttributeTypes.Points) ? WizardFields.Points : WizardFields.PointsNumeric); if (widget != null) { String points = null; if (widget instanceof XFloat) { XFloat xFloat = (XFloat) widget; points = xFloat.get(); } else if (widget instanceof XInteger) { XInteger xInteger = (XInteger) widget; points = xInteger.get(); } if (Strings.isValid(points) && Strings.isNumeric(points)) { changes.setSoleAttributeFromString(teamWf, agileTeamPointsAttributeType, points); } } } }

Target:
private void wizardCompletedPoints(IAtsTeamWorkflow teamWf, IAtsTeamDefinition teamDef, IAtsChangeSet changes) { ArtifactToken agileTeamArt = AtsClientService.get().getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); if (agileTeamArt != null) { IAgileTeam agileTeam = AtsClientService.get().getConfigItemFactory().getAgileTeam(agileTeamArt); AttributeTypeId agileTeamPointsAttributeType = AtsClientService.get().getAgileService().getAgileTeamPointsAttributeType(agileTeam); XWidget widget = (XWidget) teamDefFieldToWidget.get(teamDef, agileTeamPointsAttributeType.equals( AtsAttributeTypes.Points) ? WizardFields.Points : WizardFields.PointsNumeric); if (widget != null) { if (widget instanceof XFloat) { XFloat xFloat = (XFloat) widget; String pointsStr = xFloat.get(); if (Strings.isNumeric(pointsStr)) { Double points = Double.valueOf(pointsStr); changes.setSoleAttributeValue(teamWf, agileTeamPointsAttributeType, points); } } else if (widget instanceof XComboViewer) { XComboViewer pointsCombo = (XComboViewer) widget; String pointsStr = (String) pointsCombo.getSelected(); if (Strings.isValid(pointsStr)) { changes.setSoleAttributeValue(teamWf, agileTeamPointsAttributeType, pointsStr); } } } } }
Source:
private @Nullable ByteBuffer skipISBBlockUntilDataPacket(int blockType, SeekableByteChannel fileChannel) throws BadPcapFileException { final String errorMsg = "A pcapng file is invalid"; ByteBuffer pcapNgBlockHeader = null; int blockLength = 0; int typeBlock = 0; pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); while (typeBlock != PcapFileValues.PCAPNG_EPB && typeBlock != PcapFileValues.PCAPNG_PB && typeBlock == blockType && typeBlock != PcapFileValues.PCAPNG_SPB) { try { fileChannel.position(fileChannel.position() + blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); } setBlockLength(blockLength); setBlocType(typeBlock); return pcapNgBlockHeader; }

Target:
private @Nullable ByteBuffer skipISBBlockUntilDataPacket(int blockType, SeekableByteChannel fileChannel) throws BadPcapFileException { final String errorMsg = "A pcapng file is invalid"; ByteBuffer pcapNgBlockHeader = null; int blockLength = 0; int typeBlock = 0; try { if (fileChannel.size() - fileChannel.position() < PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE) { return null; } } catch (IOException e1) { e1.printStackTrace(); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); while (typeBlock != PcapFileValues.PCAPNG_EPB && typeBlock != PcapFileValues.PCAPNG_PB && typeBlock != PcapFileValues.PCAPNG_SPB) { try { fileChannel.position(fileChannel.position() + blockLength - PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); } setBlockLength(blockLength); setBlocType(typeBlock); return pcapNgBlockHeader; }
Source:
protected void recalculateButtonsAvailability(final ISelection selection, final SlaveObjectAxisProvider slave) { if (null != selection && !selection.isEmpty()) { removeAxis.setEnabled(true); int firstPosition = -1; int lastPosition = -1; if (selection instanceof StructuredSelection) { Iterator<?> selectedObjects = ((StructuredSelection) selection).iterator(); while (selectedObjects.hasNext()) { final Object selectedObject = selectedObjects.next(); final int objectPosition = slave.getAxis().indexOf(selectedObject); if (-1 == firstPosition || objectPosition < firstPosition) { firstPosition = objectPosition; } if (objectPosition > lastPosition) { lastPosition = objectPosition; } } } upAxis.setEnabled(firstPosition != 0); downAxis.setEnabled(lastPosition < slave.getAxis().size() - 1); } else { removeAxis.setEnabled(false); upAxis.setEnabled(false); downAxis.setEnabled(false); } }

Target:
protected void recalculateButtonsAvailability(final ISelection selection, final SlaveObjectAxisProvider slave) { if (null != selection && !selection.isEmpty()) { removeAxis.setEnabled(true); int firstPosition = -1; int lastPosition = -1; if (selection instanceof StructuredSelection) { final Iterator<?> selectedObjects = ((StructuredSelection) selection).iterator(); while (selectedObjects.hasNext()) { final Object selectedObject = selectedObjects.next(); final int objectPosition = slave.getAxis().indexOf(selectedObject); if (-1 == firstPosition || objectPosition < firstPosition) { firstPosition = objectPosition; } if (objectPosition > lastPosition) { lastPosition = objectPosition; } } } upAxis.setEnabled(firstPosition != 0); downAxis.setEnabled(lastPosition < slave.getAxis().size() - 1); } else { removeAxis.setEnabled(false); upAxis.setEnabled(false); downAxis.setEnabled(false); } }
Source:
private boolean isDataCenterValidForAttachedStorageDomains() { StoragePool storagePool = getDbFacade().getStoragePoolDao().get(getParameters().getId()); if ((storagePool != null) && storagePool.getStatus() != StoragePoolStatus.Up) { log.info("The attach of the Storage Domain is being done on a Data Center which is not in UP status." + " The query for attached Storage Domain will not be excuted"); return false; } return true; }

Target:
private boolean isDataCenterValidForAttachedStorageDomains() { StoragePool storagePool = getDbFacade().getStoragePoolDao().get(getParameters().getId()); if ((storagePool == null) || (storagePool.getStatus() != StoragePoolStatus.Up)) { log.info("The Data Center is not in UP status."); return false; } return true; }
Source:
protected String getOperationId(Method method, String httpMethod) { if (isUseEnhancedOperationId()) { return method.getDeclaringClass().getSimpleName() + "_" + method.getName() + "_" + httpMethod; } else { return method.getName(); } }

Target:
protected String getOperationId(Method method, String httpMethod) { if (this.operationIdFormat == null) { this.operationIdFormat = OPERATION_ID_FORMAT_DEFAULT; } String packageName = method.getDeclaringClass().getPackage().getName(); String className = method.getDeclaringClass().getSimpleName(); String methodName = method.getName(); StrBuilder sb = new StrBuilder(this.operationIdFormat); sb.replaceAll("{{packageName}}", packageName); sb.replaceAll("{{className}}", className); sb.replaceAll("{{methodName}}", methodName); sb.replaceAll("{{httpMethod}}", httpMethod); return sb.toString(); }
Source:
public void shouldRemoveNodeFromExplicitIndex() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, "this is it" ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }

Target:
public void shouldRemoveNodeFromExplicitIndex() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, VALUE ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }