auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void canOverrideWriteTimeoutPerCall() throws Exception { assumeThat(System.getenv("TRAVIS"), not(equalTo("true"))); server.enqueue(new MockResponse().throttleBody(1, 1, TimeUnit.SECONDS)); RequestBody streamingBody = new RequestBody() { @Override public MediaType contentType() { return MediaType.parse("*/*"); } @Override public void writeTo(BufferedSink sink) throws IOException { byte[] data = new byte[2 * 1024 * 1024]; sink.write(data); } }; int writeTimeout = 1; int executionTime = 200; Builder<ResponseBody, Object> builder = builder(HttpMethod.POST, "", false); Observable<ResponseBody> stream = builder.body(streamingBody).responseAs(ResponseBody.class).writeTimeout(writeTimeout) .build().stream().subscribeOn(Schedulers.newThread()); TestSubscriber<ResponseBody> testSubscriber = new TestSubscriber<>(); long before = System.currentTimeMillis(); stream.toBlocking().subscribe(testSubscriber); <START> long diff = System.currentTimeMillis() - before; <END> testSubscriber.assertError(SocketTimeoutException.class); assertThat(diff).isLessThan((writeTimeout * 1000) + executionTime); }</code><technical_language>Get rid of this please</technical_language>

Target:
public void canOverrideWriteTimeoutPerCall() throws Exception { assumeThat(System.getenv("TRAVIS"), not(equalTo("true"))); server.enqueue(new MockResponse().throttleBody(1, 1, TimeUnit.SECONDS)); RequestBody streamingBody = new RequestBody() { @Override public MediaType contentType() { return MediaType.parse("*/*"); } @Override public void writeTo(BufferedSink sink) throws IOException { byte[] data = new byte[2 * 1024 * 1024]; sink.write(data); } }; int writeTimeout = 1; int executionTime = 500; Builder<ResponseBody, Object> builder = builder(HttpMethod.POST, "", false); Observable<ResponseBody> stream = builder.body(streamingBody).responseAs(ResponseBody.class).writeTimeout(writeTimeout) .build().stream(); TestSubscriber<ResponseBody> testSubscriber = new TestSubscriber<>(); long before = System.currentTimeMillis(); stream.subscribe(testSubscriber); long diff = System.currentTimeMillis() - before; testSubscriber.assertError(SocketTimeoutException.class); assertThat(diff).isLessThan((writeTimeout * 1000) + executionTime); }
Source:
<code>public static Object readSingleValue(final byte tagType, final ByteBuffer byteBuffer, ValidationStringency validationStringency) { switch (tagType) { case 'Z': return readNullTerminatedString(byteBuffer); case 'A': return (char) byteBuffer.get(); case 'I': final long val = byteBuffer.getInt() & 0xffffffffL; if (val <= Integer.MAX_VALUE) { return (int)val; } SAMUtils.processValidationError(new SAMValidationError(SAMValidationError.Type.TAG_VALUE_TOO_LARGE, "Tag value " + val + " too large to store as signed integer.", null), validationStringency); <START> return val; <END> case 'i': return byteBuffer.getInt(); case 's': return (int) byteBuffer.getShort(); case 'S': return byteBuffer.getShort() & 0xffff; case 'c': return (int) byteBuffer.get(); case 'C': return byteBuffer.get() & 0xff; case 'f': return byteBuffer.getFloat(); case 'H': final String hexRep = readNullTerminatedString(byteBuffer); return StringUtil.hexStringToBytes(hexRep); case 'B': final TagValueAndUnsignedArrayFlag valueAndFlag = readArray( byteBuffer); return valueAndFlag.value; default: throw new SAMFormatException("Unrecognized tag type: " + (char) tagType); } }</code><technical_language>I this is behavior want here... writing a bam, if attribute is a Long is > BinaryTagCodec.MAX_INT <= BinaryTagCodec.MAX_UINT, assign a tag type of "I" (as opposed "i"). This is consistent BAM spec. reading attributes in, if attribute type is "I" (rather "i") allow values >= 0 <= BinaryTagCodec.MAX_UINT raising a validation error if is large stored in a signed int</technical_language>

Target:
public static Object readSingleValue(final byte tagType, final ByteBuffer byteBuffer, ValidationStringency validationStringency) { switch (tagType) { case 'Z': return readNullTerminatedString(byteBuffer); case 'A': return (char) byteBuffer.get(); case 'I': final long val = byteBuffer.getInt() & 0xffffffffL; if (val <= Integer.MAX_VALUE) { return (int)val; } if (! SAMUtils.isValidUnsignedIntegerAttribute(val)) { SAMUtils.processValidationError(new SAMValidationError(SAMValidationError.Type.TAG_VALUE_TOO_LARGE, "Unsigned integer is out of range for a 32-bit unsigned value: " + val, null), validationStringency); } return val; case 'i': return byteBuffer.getInt(); case 's': return (int) byteBuffer.getShort(); case 'S': return byteBuffer.getShort() & 0xffff; case 'c': return (int) byteBuffer.get(); case 'C': return byteBuffer.get() & 0xff; case 'f': return byteBuffer.getFloat(); case 'H': final String hexRep = readNullTerminatedString(byteBuffer); return StringUtil.hexStringToBytes(hexRep); case 'B': final TagValueAndUnsignedArrayFlag valueAndFlag = readArray( byteBuffer); return valueAndFlag.value; default: throw new SAMFormatException("Unrecognized tag type: " + (char) tagType); } }
Source:
<code>public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { DOMStorage.DomStorageItemRemovedParams removedParams = new DOMStorage.DomStorageItemRemovedParams(); removedParams.storageId = mStorageId; removedParams.key = key; <START> sendNotificationToPeers("DOMStorage.domStorageItemRemoved", removedParams); <END> Map<String, ?> entries = sharedPreferences.getAll(); if (entries.containsKey(key)) { DOMStorage.DomStorageItemAddedParams addedParams = new DOMStorage.DomStorageItemAddedParams(); addedParams.storageId = mStorageId; addedParams.key = key; addedParams.newValue = SharedPreferencesHelper.valueToString(entries.get(key)); sendNotificationToPeers("DOMStorage.domStorageItemAdded", addedParams); } }</code><technical_language>+1: yeah I in protocol, wanted didnt need cache values returned</technical_language>

Target:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Map<String, ?> entries = sharedPreferences.getAll(); boolean existedBefore = mCopy.containsKey(key); boolean existsNow = entries.containsKey(key); Object newValue = existsNow ? entries.get(key) : null; if (existedBefore && existsNow) { signalItemUpdated( mStorageId, key, SharedPreferencesHelper.valueToString(mCopy.get(key)), SharedPreferencesHelper.valueToString(newValue)); mCopy.put(key, newValue); } else if (existedBefore) { signalItemRemoved(mStorageId, key); mCopy.remove(key); } else if (existsNow) { signalItemAdded( mStorageId, key, SharedPreferencesHelper.valueToString(newValue)); mCopy.put(key, newValue); } else { throw new RuntimeException("Prefs change detected for unknown key=" + key); } }
Source:
<code>void retrievePolicyForService(UUID serviceId) throws Throwable { ServicePolicy policy = getDirectoryClient().getServicePolicy(serviceId); <START> currentServicePolicyEntity = policy == null ? null : ServicePolicyEntity.fromServicePolicy(policy); <END> }</code><technical_language>getServicePolicy return null. Based Python SDK functions return a policy object time. In case is in fact empty ({"factors": [], "minimum_requirements": []}), return a policy minimum_factors set false 0</technical_language>

Target:
void retrievePolicyForService(UUID serviceId) throws Throwable { ServicePolicy policy = getDirectoryClient().getServicePolicy(serviceId); currentServicePolicyEntity = ServicePolicyEntity.fromServicePolicy(policy); }
Source:
<code>public void move(final int numBlocks, final String srcEvalId, final String destEvalId, @Nullable final EventHandler<AvroElasticMemoryMessage> finishedCallback) { <START> try (final TraceScope moveTraceScope = Trace.startSpan(MOVE, traceSampler)) { <END> final String operationId = MOVE + "-" + Long.toString(operationIdCounter.getAndIncrement()); migrationManager.startMigration(operationId, srcEvalId, destEvalId, numBlocks, TraceInfo.fromSpan(moveTraceScope.getSpan()), finishedCallback); } }</code><technical_language>I name MOVE represent meaning; sound rename OP_MOVE OP_TYPE_MOVE</technical_language>

Target:
public void move(final int numBlocks, final String srcEvalId, final String destEvalId, @Nullable final EventHandler<AvroElasticMemoryMessage> finishedCallback) { Trace.setProcessId("elastic_memory"); try (final TraceScope moveScope = Trace.startSpan(OP_MOVE, traceSampler)) { final String operationId = String.format("%s-%d", OP_MOVE, operationIdCounter.getAndIncrement()); migrationManager.startMigration(operationId, srcEvalId, destEvalId, numBlocks, TraceInfo.fromSpan(moveScope.getSpan()), finishedCallback); } }
Source:
<code>static void handleNotificationReceived(OSNotificationGenerationJob notifJob, boolean displayed) { int androidNotificationId = notifJob.getAndroidId(); try { JSONObject jsonObject = new JSONObject(notifJob.jsonPayload.toString()); jsonObject.put("notificationId", androidNotificationId); OSNotificationOpenResult openResult = generateOsNotificationOpenResult(newJsonArray(jsonObject), displayed); <START> if(trackFirebaseAnalytics != null && getFirebaseAnalyticsEnabled()) <END> trackFirebaseAnalytics.trackReceivedEvent(openResult); } catch (JSONException e) { e.printStackTrace(); } fireNotificationWillShowInForegroundHandlers(notifJob); }</code><technical_language>reformat code in here, space if (</technical_language>

Target:
static void handleNotificationReceived(OSNotificationGenerationJob notifJob, boolean displayed) { try { JSONObject jsonObject = new JSONObject(notifJob.jsonPayload.toString()); jsonObject.put(BUNDLE_KEY_ANDROID_NOTIFICATION_ID, notifJob.getAndroidId()); OSNotificationOpenResult openResult = generateOsNotificationOpenResult(newJsonArray(jsonObject), displayed); if (trackFirebaseAnalytics != null && getFirebaseAnalyticsEnabled()) trackFirebaseAnalytics.trackReceivedEvent(openResult); } catch (JSONException e) { e.printStackTrace(); } }
Source:
<code>private void checkListingContainsPath(S3AFileSystem fs, Path filePath) throws IOException { final RemoteIterator<LocatedFileStatus> listIter = fs.listFiles(filePath.getParent(), false); boolean lfsHit = false; while (listIter.hasNext()) { final LocatedFileStatus lfs = listIter.next(); if (lfs.getPath().equals(filePath)) { lfsHit = true; LOG.info("{}; file found in listFiles as expected.", filePath); break; } } assertTrue("The file should be listed in fs.listFiles: ", lfsHit); boolean lsHit = false; final FileStatus[] fileStatuses = fs.listStatus(filePath.getParent()); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.getPath().equals(filePath)) { <START> lsHit = true; <END> LOG.info("{}; file found in listStatus as expected.", filePath); break; } } assertTrue("The file should be listed in fs.listStatus: ", lsHit); }</code><technical_language>assertEquals</technical_language>

Target:
private void checkListingContainsPath(S3AFileSystem fs, Path filePath) throws IOException { final RemoteIterator<LocatedFileStatus> listIter = fs.listFiles(filePath.getParent(), false); while (listIter.hasNext()) { final LocatedFileStatus lfs = listIter.next(); assertEquals(filePath, lfs.getPath()); } final FileStatus[] fileStatuses = fs.listStatus(filePath.getParent()); for (FileStatus fileStatus : fileStatuses) { assertEquals("The file should be listed in fs.listStatus", filePath, fileStatus.getPath()); } }
Source:
<code><START> public void <END> reevaluateAllRequests() { post(() -> { evalRequests(); }); }</code><technical_language>I this stay protected. Non-subclasses business calling this</technical_language>

Target:
protected void reevaluateAllRequests() { post(() -> { evalRequests(); }); }
Source:
<code>protected Status doProcess() throws EventDeliveryException { long totalEventSent = counterGroup.addAndGet("events.total", lastSent); if ((maxTotalEvents >= 0 && totalEventSent >= maxTotalEvents) || (maxSuccessfulEvents >= 0 && counterGroup.get("events.successful") >= maxSuccessfulEvents)) { return Status.BACKOFF; } try { lastSent = batchSize; if (batchSize == 1) { <START> if (limiter != null) { <END> limiter.acquire(); } getChannelProcessor().processEvent(event); } else { long eventsLeft = maxTotalEvents - totalEventSent; if (maxTotalEvents >= 0 && eventsLeft < batchSize) { eventBatchListToProcess = eventBatchList.subList(0, (int)eventsLeft); } else { eventBatchListToProcess = eventBatchList; } lastSent = eventBatchListToProcess.size(); getChannelProcessor().processEventBatch(eventBatchListToProcess); } counterGroup.addAndGet("events.successful", lastSent); } catch (ChannelException ex) { counterGroup.addAndGet("events.failed", lastSent); return Status.BACKOFF; } return Status.READY; }</code><technical_language>Is intentional a rate limit batchSize larger 1? limiter.acquire(batchSize) kind of need if right</technical_language>

Target:
protected Status doProcess() throws EventDeliveryException { long totalEventSent = counterGroup.addAndGet("events.total", lastSent); if ((maxTotalEvents >= 0 && totalEventSent >= maxTotalEvents) || (maxSuccessfulEvents >= 0 && counterGroup.get("events.successful") >= maxSuccessfulEvents)) { return Status.BACKOFF; } try { lastSent = batchSize; if (batchSize == 1) { if (limiter != null) { limiter.acquire(); } getChannelProcessor().processEvent(event); } else { long eventsLeft = maxTotalEvents - totalEventSent; if (maxTotalEvents >= 0 && eventsLeft < batchSize) { eventBatchListToProcess = eventBatchList.subList(0, (int)eventsLeft); } else { eventBatchListToProcess = eventBatchList; } lastSent = eventBatchListToProcess.size(); if (limiter != null) { limiter.acquire((int)lastSent); } getChannelProcessor().processEventBatch(eventBatchListToProcess); } counterGroup.addAndGet("events.successful", lastSent); } catch (ChannelException ex) { counterGroup.addAndGet("events.failed", lastSent); return Status.BACKOFF; } return Status.READY; }
Source:
<code>public void patchAddTitleOnSectionThatNotContainAttributeTitleTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1) .withIssueDate("2019-11-21") .withSubject("ExtraEntry") .build(); configurationService.setProperty("webui.submit.upload.required", false); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); List<Operation> addTitle = new ArrayList<Operation>(); List<Map<String, String>> values = new ArrayList<Map<String, String>>(); Map<String, String> value = new HashMap<String, String>(); value.put("value", "New Title"); values.add(value); addTitle.add(new AddOperation("/sections/traditionalpagetwo/dc.title", values)); String patchBody = getPatchContent(addTitle); <START> getClient(authToken).perform(patch("/api/submission/workspaceitems/" + witem.getID()) <END> .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); }</code><technical_language>verify dc.title is created</technical_language>

Target:
public void patchAddTitleOnSectionThatNotContainAttributeTitleTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1) .withIssueDate("2019-11-21") .withSubject("ExtraEntry") .build(); configurationService.setProperty("webui.submit.upload.required", false); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); List<Operation> addTitle = new ArrayList<Operation>(); List<Map<String, String>> values = new ArrayList<Map<String, String>>(); Map<String, String> value = new HashMap<String, String>(); value.put("value", "New Title"); values.add(value); addTitle.add(new AddOperation("/sections/traditionalpagetwo/dc.title", values)); String patchBody = getPatchContent(addTitle); getClient(authToken).perform(patch("/api/submission/workspaceitems/" + witem.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(authToken).perform(get("/api/submission/workspaceitems/" + witem.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.sections.traditionalpageone['dc.title']").doesNotExist()); }
Source:
<code>public Builder addStep(final String stepClassName) { final Step.Factory factory = FACTORIES.get(stepClassName); if (null == factory) { <START> LOGGER.error("No Factory exist that can create Step '{}'", stepClassName); <END> } else { final Step step = factory.create(); if (null == step) { LOGGER.error("Step.Factory '{}' failed to create Step '{}'", factory, stepClassName); } else { LOGGER.info("Step.Factory '{}' created '{}'", factory, step); steps.add(step); } } return this; }</code><technical_language>Typo: exist -> exists</technical_language>

Target:
public Builder addStep(final String stepClassName) { final Step.Factory factory = FACTORIES.get(stepClassName); if (null == factory) { LOGGER.error("No Factory exists that can create Step '{}'", stepClassName); } else { final Step step = factory.create(); if (null == step) { LOGGER.error("Step.Factory '{}' failed to create Step '{}'", factory, stepClassName); } else { LOGGER.info("Step.Factory '{}' created '{}'", factory, step); steps.add(step); } } return this; }
Source:
<code>protected void completeOperation(FutureResult futureResult, Callback callback, Object operationResult, Exception exception) { long postProcessingStartTime = System.currentTimeMillis(); try { futureResult.done(operationResult, exception); if (callback != null) { callback.onCompletion(operationResult, exception); } } catch (Exception e) { metrics.futureCallbackError.inc(); logger.error("Exception caught during future and callback completion", e); if (operationResult instanceof ReadableStreamChannel) { try { logger.trace("Closing readable stream channel due to exception"); ((ReadableStreamChannel) operationResult).close(); <START> } catch (IOException e1) { <END> logger.error("Ignoring IOException thrown during closing of readable stream channel on exception"); } } } finally { metrics.operationPostProcessingTimeInMs.update(System.currentTimeMillis() - postProcessingStartTime); } }</code><technical_language>call this channelCloseException</technical_language>

Target:
protected void completeOperation(FutureResult futureResult, Callback callback, Object operationResult, Exception exception) { long postProcessingStartTime = System.currentTimeMillis(); try { futureResult.done(operationResult, exception); if (callback != null) { callback.onCompletion(operationResult, exception); } } catch (Exception e) { metrics.futureCallbackError.inc(); logger.error("Exception caught during future and callback completion", e); if (operationResult instanceof ReadableStreamChannel) { try { logger.trace("Closing ReadableStreamChannel due to exception"); ((ReadableStreamChannel) operationResult).close(); } catch (IOException channelCloseException) { logger.error("Ignoring IOException during ReadableStreamChannel close"); } } } finally { metrics.operationPostProcessingTimeInMs.update(System.currentTimeMillis() - postProcessingStartTime); } }
Source:
<code>private int drawDescription(Canvas canvas, String description, int top) { final int marginBottom = 3; final int maxHeight = 23; final int maxLines = 2; final float maxFontSize = 15.0f; final float minFontSize = 10.0f; TextPaint textPaint = new TextPaint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(maxFontSize); textPaint.setStyle(Paint.Style.FILL); textPaint.setShadowLayer(1.0f, 0.0f, 0.0f, Color.GRAY); StaticLayout textLayout = optimizeTextSize( new TextLayoutParams(description, textPaint, DESCRIPTION_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines, maxFontSize, minFontSize); int left = HORIZONTAL_PADDING; if (isArticleRTL) { left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth(); } <START> top = top - (int)(marginBottom * displayDensity) - textLayout.getHeight(); <END> canvas.save(); canvas.translate(left, top); textLayout.draw(canvas); canvas.restore(); return top; }</code><technical_language>displayDensity bearing layout. layout is a fixed size layout in pixel. a fixed 640 x 360 px image</technical_language>

Target:
private int drawDescription(Canvas canvas, String description, int top) { final int marginBottom = 4; final int maxHeight = 23; final int maxLines = 2; final float maxFontSize = 15.0f; final float minFontSize = 10.0f; if (TextUtils.isEmpty(description)) { return marginBottom; } TextPaint textPaint = new TextPaint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(maxFontSize); textPaint.setStyle(Paint.Style.FILL); textPaint.setShadowLayer(1.0f, 0.0f, 0.0f, Color.GRAY); StaticLayout textLayout = optimizeTextSize( new TextLayoutParams(description, textPaint, DESCRIPTION_WIDTH, SPACING_MULTIPLIER), maxHeight, maxLines, maxFontSize, minFontSize); int left = HORIZONTAL_PADDING; if (isArticleRTL) { left = WIDTH - HORIZONTAL_PADDING - textLayout.getWidth(); } top = top - marginBottom - textLayout.getHeight(); canvas.save(); canvas.translate(left, top); textLayout.draw(canvas); canvas.restore(); return top; }
Source:
<code>public TermQueryConverter(TermQuery query, FieldConverter fieldConverter) { this.query = query; this.fieldConverter = fieldConverter; <START> this.basicAttrs = Arrays.asList(MetaObject.META_OBJECT_ID, <END> MetaObject.META_OBJECT_TYPE, MetaObject.META_OBJECT_CLUSTER_ID, MetaObject.META_OBJECT_SEGMENT_ID, MetaObject.META_OBJECT_KEY); }</code><technical_language>This list is change runtime depend constructor arguments. For space performance reasons suggest changing static (so recreated new TermQueryConverter) making unmodifiable: private static final List<String> basicAttrs = Collections.unmodifiableList( Arrays.asList(MetaObject.META_OBJECT_ID, MetaObject.META_OBJECT_TYPE, MetaObject.META_OBJECT_CLUSTER_ID, MetaObject.META_OBJECT_SEGMENT_ID, MetaObject.META_OBJECT_KEY) );</technical_language>

Target:
public TermQueryConverter(TermQuery query, FieldConverter fieldConverter) { this.query = query; this.fieldConverter = fieldConverter; }
Source:
<code>public static boolean isExtension(String filename, String extension) { if (filename == null) { return false; } <START> if ((extension == null) || extension.isEmpty()) { <END> return false; } return getExtension(filename).equals(extension); }</code><technical_language>remove braces check</technical_language>

Target:
public static boolean isExtension(String filename, String extension) { if (filename == null) { return false; } if (extension == null || extension.isEmpty()) { return false; } return getExtension(filename).equals(extension); }
Source:
<code>public DerbyConnectorRule() { <START> this(Suppliers.ofInstance(MetadataStorageTablesConfig.fromBase("druidTest" + dbSafeUUID()))); <END> }</code><technical_language>is necessary create unique table IDs, if create a unique database test</technical_language>

Target:
public DerbyConnectorRule() { this(Suppliers.ofInstance(MetadataStorageTablesConfig.fromBase("druidTest"))); }
Source:
<code>protected Message doSendAndReceive(final String exchange, final String routingKey, final Message message) { if (!this.evaluatedFastReplyTo) { <START> evaluateFastReplyTo(); <END> } if (this.replyQueue == null || this.usingFastReplyTo) { return doSendAndReceiveWithTemporary(exchange, routingKey, message); } else { return doSendAndReceiveWithFixed(exchange, routingKey, message); } }</code><technical_language>I need synchronized double check</technical_language>

Target:
protected Message doSendAndReceive(final String exchange, final String routingKey, final Message message) { if (!this.evaluatedFastReplyTo) { synchronized(this) { if (!this.evaluatedFastReplyTo) { evaluateFastReplyTo(); } } } if (this.replyQueue == null || this.usingFastReplyTo) { return doSendAndReceiveWithTemporary(exchange, routingKey, message); } else { return doSendAndReceiveWithFixed(exchange, routingKey, message); } }
Source:
<code>private static IFile createNewFile(IPath newFilePath, InputStream contents, boolean force, <START> IProgressMonitor monitor) throws CoreException { <END> int totalWork = 100; int createFileWork = totalWork; monitor.beginTask(NewFileWizardMessages.NewSourceFileGenerator_createFile_task, totalWork); IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot(); IFile newFile = root.getFileForLocation(newFilePath); if (newFile == null) newFile = root.getFile(newFilePath); if (newFile.exists()) { monitor.done(); return newFile; } if (newFilePath.segmentCount() > 1) { IPath containerPath = newFilePath.removeLastSegments(1); if (root.getContainerForLocation(containerPath) == null) { int containerWork = totalWork / 2; createFileWork = totalWork / 2; ContainerGenerator generator = new ContainerGenerator(containerPath); generator.generateContainer(SubMonitor.convert(monitor, containerWork)); } } createFile(newFile, contents, force, SubMonitor.convert(monitor, createFileWork)); monitor.done(); return newFile; }</code><technical_language>SubMonitor.convert() is _NOT_ a drop-in replacement for "new SubProgressMonitor". correct pattern follows:</technical_language>

Target:
private static IFile createNewFile(IPath newFilePath, InputStream contents, boolean force, IProgressMonitor monitor) throws CoreException { int totalWork = 100; int createFileWork = totalWork; monitor.beginTask(NewFileWizardMessages.NewSourceFileGenerator_createFile_task, totalWork); IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot(); IFile newFile = root.getFileForLocation(newFilePath); if (newFile == null) newFile = root.getFile(newFilePath); if (newFile.exists()) { monitor.done(); return newFile; } if (newFilePath.segmentCount() > 1) { IPath containerPath = newFilePath.removeLastSegments(1); if (root.getContainerForLocation(containerPath) == null) { int containerWork = totalWork / 2; createFileWork = totalWork / 2; ContainerGenerator generator = new ContainerGenerator(containerPath); generator.generateContainer(new SubProgressMonitor(monitor, containerWork)); } } createFile(newFile, contents, force, new SubProgressMonitor(monitor, createFileWork)); monitor.done(); return newFile; }
Source:
<code>private PlanNodeStatsAssertion assertExpression(String expression) { <START> System.out.println("Expression: " + expression); <END> return assertExpression(expression(expression)); }</code><technical_language>remove? this left manual testing</technical_language>

Target:
private PlanNodeStatsAssertion assertExpression(String expression) { return assertExpression(expression(expression)); }
Source:
<code>private void assertEventIsReceived(UpdateEventType updateEventType, String channelID, String acceptedItemType) { Configuration configuration = new Configuration(); initialize(configuration, channelID, acceptedItemType, null, null); EventSubscriber eventSubscriberMock = mock(EventSubscriber.class); when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Collections.singleton(ItemStateEvent.TYPE)); registerService(eventSubscriberMock); if (updateEventType.equals(UpdateEventType.HANDLE_COMMAND)) { ntpHandler.handleCommand(new ChannelUID("ntp:test:chan:1"), new StringType("test")); } else if (updateEventType.equals(UpdateEventType.CHANNEL_LINKED)) { ntpHandler.channelLinked(new ChannelUID("ntp:test:chan:1")); } waitForAssert(() -> { <START> verify(eventSubscriberMock).receive(ArgumentMatchers.any(Event.class)); <END> }); }</code><technical_language>I familiar Mockito (shame me)... this work if receive is called in fron of waitForAssert block? rephrase: this verify check if method called "before"</technical_language>

Target:
private void assertEventIsReceived(UpdateEventType updateEventType, String channelID, String acceptedItemType) { Configuration configuration = new Configuration(); initialize(configuration, channelID, acceptedItemType, null, null); EventSubscriber eventSubscriberMock = mock(EventSubscriber.class); when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Collections.singleton(ItemStateEvent.TYPE)); registerService(eventSubscriberMock); if (updateEventType.equals(UpdateEventType.HANDLE_COMMAND)) { ntpHandler.handleCommand(new ChannelUID("ntp:test:chan:1"), new StringType("test")); } else if (updateEventType.equals(UpdateEventType.CHANNEL_LINKED)) { ntpHandler.channelLinked(new ChannelUID("ntp:test:chan:1")); } waitForAssert(() -> { verify(eventSubscriberMock, atLeastOnce()).receive(ArgumentMatchers.any(Event.class)); }); }
Source:
<code>public PipelineTask(@JsonProperty("phases") @Nonnull StreamMapper[] phases, @JsonProperty("validateDirs") boolean validateDirs) { this.phases = phases; this.validateDirs = validateDirs; this.manager = new Thread(new PipelineTaskManager(), "PipelineTask"); <START> String message = validateOutputDirectories(); <END> if (message != null) { throw new IllegalStateException(message); } }</code><technical_language>this method void throw exception</technical_language>

Target:
public PipelineTask(@JsonProperty("phases") @Nonnull StreamMapper[] phases, @JsonProperty("validateDirs") boolean validateDirs) { validateOutputDirectories(); this.phases = phases; this.validateDirs = validateDirs; this.phaseManagement = new CompletableFuture[Math.max(phases.length - 1, 0)]; for (int i = 0; i < phaseManagement.length; i++) { final int current = i; phaseManagement[i] = phases[i].onCompleteThenRun(() -> beginPhase(current + 1)); } }
Source:
<code>public SwiftObject apply(InternalObject input) { <START> String name = input.name==null?"":input.name; <END> if (input.subdir != null) { return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(name).build()) .name(name) .etag(SUBDIR_ETAG) .payload(payload(input.bytes, input.hash, "application/directory", input.expires)) .lastModified(new Date(0)).build(); } String etag = input.hash==null?"":input.hash; Date date = input.last_modified==null?new Date(0):input.last_modified; return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(name).build()) .name(name) .etag(etag) .payload(payload(input.bytes, input.hash, input.content_type, input.expires)) .lastModified(date).build(); }</code><technical_language>more idiomatic Strings.nullToEmpty(input.name)</technical_language>

Target:
public SwiftObject apply(InternalObject input) { if (input.subdir != null) { return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(input.subdir).build()) .name(input.subdir) .etag(SUBDIR_ETAG) .payload(payload(input.bytes, input.hash, "application/directory", input.expires)) .lastModified(new Date(0)).build(); } String name = Strings.nullToEmpty(input.name); String etag = Strings.nullToEmpty(input.hash); Date lastModified = input.last_modified == null ? new Date() : input.last_modified; return SwiftObject.builder() .uri(uriBuilder(containerUri).clearQuery().appendPath(input.name).build()) .name(name) .etag(etag) .payload(payload(input.bytes, etag, input.content_type, input.expires)) .lastModified(lastModified).build(); }
Source:
<code>public DataTransactionResult remove(DataHolder dataHolder) { DataTransactionBuilder builder = DataTransactionBuilder.builder(); Optional<LockableData> oldData = from(dataHolder); if (oldData.isPresent()) { builder.replace(oldData.get().getValues()); } <START> if (!((ItemStack) dataHolder).hasTagCompound()) { <END> return builder.result(DataTransactionResult.Type.SUCCESS).build(); } try { final Optional<NBTTagCompound> mainCompound = NbtDataUtil.getItemCompound(((ItemStack) dataHolder)); if (mainCompound.isPresent()) { mainCompound.get().removeTag("Lock"); } return builder.result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { return builder.result(DataTransactionResult.Type.ERROR).build(); } }</code><technical_language>checking if data holder is ItemStack</technical_language>

Target:
public DataTransactionResult remove(DataHolder dataHolder) { if (dataHolder instanceof ItemStack) { DataTransactionBuilder builder = DataTransactionBuilder.builder(); Optional<LockableData> oldData = from(dataHolder); if (oldData.isPresent()) { builder.replace(oldData.get().getValues()); } if (!((ItemStack) dataHolder).hasTagCompound()) { return builder.result(DataTransactionResult.Type.SUCCESS).build(); } try { final NBTTagCompound mainCompound = NbtDataUtil.getItemCompound(((ItemStack) dataHolder)).get(); if (mainCompound.hasKey(NbtDataUtil.BLOCK_ENTITY_TAG)) { NBTTagCompound tileCompound = mainCompound.getCompoundTag(NbtDataUtil.BLOCK_ENTITY_TAG); tileCompound.removeTag(NbtDataUtil.ITEM_LOCK); } return builder.result(DataTransactionResult.Type.SUCCESS).build(); } catch (Exception e) { return builder.result(DataTransactionResult.Type.ERROR).build(); } } return DataTransactionBuilder.failNoData(); }
Source:
<code>public void testTableToString() { Table t = new Table(); t.addColumn(RealmFieldType.STRING, "stringCol"); t.addColumn(RealmFieldType.INTEGER, "intCol"); t.addColumn(RealmFieldType.BOOLEAN, "boolCol"); t.add("s1", 1, true); t.add("s2", 2, false); <START> String expected = "Table contains 3 columns: stringCol, intCol, boolCol. And 2 rows."; <END> assertEquals(expected, t.toString()); }</code><technical_language>Nitpick, a table a name is extra space :)</technical_language>

Target:
public void testTableToString() { Table t = new Table(); t.addColumn(RealmFieldType.STRING, "stringCol"); t.addColumn(RealmFieldType.INTEGER, "intCol"); t.addColumn(RealmFieldType.BOOLEAN, "boolCol"); t.add("s1", 1, true); t.add("s2", 2, false); String expected = "The Table contains 3 columns: stringCol, intCol, boolCol. And 2 rows."; assertEquals(expected, t.toString()); }
Source:
<code>ServerResponse(ServerErrorCode serverErrorCode, StoreKey storeKey, BlobProperties blobProperties, byte[] userMetadata, byte[] blobData, ByteBuffer encryptionKeyBuffer) { this.serverErrorCode = serverErrorCode; this.storeKey = storeKey; this.blobProperties = blobProperties; this.userMetadata = userMetadata; this.blobData = blobData; <START> this.encryptionKey = encryptionKeyBuffer != null ? encryptionKeyBuffer.array() : null; <END> }</code><technical_language>Do need do extract array? exploit ByteBuffer.equals() in comparison</technical_language>

Target:
ServerResponse(ServerErrorCode serverErrorCode, StoreKey storeKey, BlobProperties blobProperties, byte[] userMetadata, byte[] blobData, ByteBuffer encryptionKeyBuffer) { this.serverErrorCode = serverErrorCode; this.storeKey = storeKey; this.blobProperties = blobProperties; this.userMetadata = userMetadata; this.blobData = blobData; this.encryptionKey = encryptionKeyBuffer; }
Source:
<code>public static void main(String[] args) throws Exception { try (FluoClient client = FluoFactory.newClient(new FluoConfiguration(new File(args[0]))); Snapshot snap = client.newSnapshot()) { System.out.println("Scanning wait column ...."); ScannerConfiguration scanConfig = new ScannerConfiguration(); scanConfig.fetchColumn(Constants.COUNT_WAIT_COL.getFamily(), Constants.COUNT_WAIT_COL.getQualifier()); RowIterator rowIter = snap.get(scanConfig); int totalWait = 0; while (rowIter.hasNext()) { Entry<Bytes,ColumnIterator> rowEntry = rowIter.next(); ColumnIterator colIter = rowEntry.getValue(); while (colIter.hasNext()) { Entry<Column,Bytes> col = colIter.next(); totalWait += Integer.parseInt(col.getValue().toString()); } } System.out.println("Total wait : " + totalWait); <START> String rootRow = Node.generateRootId(8); <END> TypedSnapshot tsnap = Constants.TYPEL.wrap(snap); int total = tsnap.get().row(rootRow).col(Constants.COUNT_SEEN_COL).toInteger(0); System.out.println("Root value : " + total); } }</code><technical_language>this hard coded 8? Print accept a nodeSize argument. Another option is include nodeSize in root row. While needed for children, necessary for root row. row id of root node 00:root this require some rework of Node class</technical_language>

Target:
public static void main(String[] args) throws Exception { if (args.length != 2) { log.error("Usage: " + Print.class.getSimpleName() + "<fluo props> <node size>"); System.exit(-1); } int nodeSize = Integer.parseInt(args[1]); System.out.println("Scanning wait column ...."); Stats stats = getStats(new FluoConfiguration(new File(args[0])), nodeSize); for (Entry<Integer,Integer> entry : stats.levelWait.entrySet()) { System.out.println("Level " + entry.getKey() + " wait : " + entry.getValue() + " #nodes:" + stats.nodesPerLevel.get(entry.getKey())); } System.out.println("Total wait : " + stats.totalWait); System.out.println("Root value : " + stats.rootValue); if (stats.sawOtherNodes) { System.err.println("WARN : Other node sizes were seen and ignored."); } }
Source:
<code>public void deletePatient(String id) { org.openmrs.Patient patient = Context.getPatientService().getPatientByUuid(id); if (patient == null) { <START> throw new ResourceNotFoundException(new IdDt("Patient", id)); <END> } try { Context.getPatientService().voidPatient(patient, "DELETED by FHIR request"); } catch (APIException ex) { throw new MethodNotAllowedException("The OpenMRS API refused to retire the Patient via the FHIR request."); } }</code><technical_language>Spuild ise IDType instead</technical_language>

Target:
public void deletePatient(String id) { org.openmrs.Patient patient = Context.getPatientService().getPatientByUuid(id); if (patient == null) { throw new ResourceNotFoundException(new IdType(FHIRConstants.PATIENT, id)); } try { Context.getPatientService().voidPatient(patient, FHIRConstants.PATIENT_DELETE_MESSAGE); } catch (APIException ex) { throw new MethodNotAllowedException("The OpenMRS API refused to retire the Patient via the FHIR request."); } }
Source:
<code><START> protected boolean canDoAction() { <END> boolean returnValue = true; if (!Config.<Boolean> GetValue(ConfigValues.HotPlugEnabled, getVds().getvds_group_compatibility_version().getValue())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_SUPPORTED); } else if (getVm() == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } else if (getVm().getstatus() != VMStatus.Up) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_UP); } else if (getVm().getguest_os() == null || !Config.<String> GetValue(ConfigValues.HotPlugSupportedOsList) .toLowerCase() .contains(getVm().getguest_os().toLowerCase())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } else { VmHandler.updateDisksFromDb(getVm()); if (getVm().getDiskList() != null) { for (DiskImage image : getVm().getDiskList()) { if (image.getId().equals(getParameters().getDiskId())) { diskImage = image; break; } } } if (diskImage == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } else if (!DiskInterface.VirtIO.equals(diskImage.getdisk_interface())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_VIRTIO); } else if (VdcActionType.HotPlugDiskToVm == getActionType() && diskImage.getPlugged()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_UNPLUGGED); } } return returnValue; }</code><technical_language>this method a lot of calls getVm(), create a local variable making call time need it</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; if (!Config.<Boolean> GetValue(ConfigValues.HotPlugEnabled, getVds().getvds_group_compatibility_version().getValue())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_SUPPORTED); } else { VM vm = getVm(); if (vm == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } else if (vm.getstatus() != VMStatus.Up) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_UP); } else if (!isOsSupported(vm)) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } else { VmHandler.updateDisksFromDb(vm); if (vm.getDiskList() != null) { for (DiskImage image : vm.getDiskList()) { if (image.getId().equals(getParameters().getDiskId())) { diskImage = image; break; } } } if (diskImage == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } else if (!DiskInterface.VirtIO.equals(diskImage.getdisk_interface())) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_VIRTIO); } else if (VdcActionType.HotPlugDiskToVm == getActionType() && diskImage.getPlugged()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_UNPLUGGED); } } } return returnValue; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DruidServer that = (DruidServer) o; <START> if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) { <END> return false; } return true; }</code><technical_language>Please annotate DruidServerMetadata.getName() @Nullable. Please Objects.equals(), regenerate equals hashCode intelliJ</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ImmutableDruidServer that = (ImmutableDruidServer) o; if (metadata.equals(that.metadata)) { return false; } return true; }
Source:
<code>@Test public void testCastTimestampToTimestamp() throws SQLException { withJavaSqlDateTypes(connection -> { Statement statement = connection.createStatement(); final String sql = "select %s as EXPECTED, %s as ACTUAL from \"java_sql_date_types\""; for (int i = 3; i >= 0; i--) { final String castTo = format(Locale.ROOT, "TIMESTAMP(%d)", i); final String expected = format(Locale.ROOT, "cast(TIMESTAMP '2018-12-14 18:29:34.123' as %s)", castTo); final String actual = format(Locale.ROOT, "cast(\"ts\" as %s)", castTo); final ResultSet resultSet = statement.executeQuery( format(Locale.ROOT, sql, expected, actual)); resultSet.next(); assertEquals(format(Locale.ROOT, "cast(java.sql.Timestamp as %s)", castTo), <START> resultSet.getTimestamp(1), resultSet.getTimestamp(2)); <END> } }); }</code><technical_language>@ijokarumawak , this is wrong. "EXPECTED" a system test. hard-code expected (which is preferred) compute a "simple understand" approach</technical_language>

Target:
@Test public void testCastTimestampToTimestamp() throws SQLException { withJavaSqlDateTypes(connection -> { Statement statement = connection.createStatement(); final Timestamp[] expectedTimestamps = { Timestamp.valueOf("2018-12-14 18:29:34"), Timestamp.valueOf("2018-12-14 18:29:34.1"), Timestamp.valueOf("2018-12-14 18:29:34.12"), Timestamp.valueOf("2018-12-14 18:29:34.123") }; for (int i = 3; i >= 0; i--) { final String castTo = "TIMESTAMP(" + i + ")"; final String sql = "select cast(\"ts\" as " + castTo + ") from \"java_sql_date_types\""; final ResultSet resultSet = statement.executeQuery(sql); resultSet.next(); assertEquals("cast(java.sql.Timestamp.valueOf(\"2018-12-14 18:29:34.123\")" + " as " + castTo + ")", expectedTimestamps[i], resultSet.getTimestamp(1)); } }); }
Source:
<code>private void assertConversionFromAndToLegacyPreservesId(LockRefreshToken lockRefreshToken) { LockTokenV2 initialToken = new LegacyTimelockService.LockRefreshTokenV2Adapter(lockRefreshToken); LockTokenV2 serializable = LockTokenConvertingTimelockService.makeSerializable(initialToken); <START> LockTokenV2 reconverted = LockTokenConvertingTimelockService.castToAdapter(serializable); <END> assertThat(reconverted.getRequestId()).isEqualTo(initialToken.getRequestId()); assertThat(serializable.getRequestId()).isEqualTo(initialToken.getRequestId()); }</code><technical_language>i want test bigint contained this adapter is same. i.e. reconverted.equals(initialToken)</technical_language>

Target:
private void assertConversionFromAndToLegacyPreservesId(LockRefreshToken lockRefreshToken) { LockTokenV2 initialToken = new LegacyTimelockService.LockRefreshTokenV2Adapter(lockRefreshToken); LockTokenV2 serializable = LockTokenConvertingTimelockService.makeSerializable(initialToken); LockTokenV2 reconverted = LockTokenConvertingTimelockService.castToAdapter(serializable); assertThat(reconverted).isEqualTo(initialToken); assertThat(serializable.getRequestId()).isEqualTo(initialToken.getRequestId()); }
Source:
<code>public List<SDVariable> doDiff(List<SDVariable> f1) { <START> return null; <END> }</code><technical_language>UnsupportedOperationException</technical_language>

Target:
public List<SDVariable> doDiff(List<SDVariable> f1) { throw new UnsupportedOperationException(); }
Source:
<code>public BuildOptions patch(BuildOptions options) { if (executionPlatform == null) { return options; } BuildOptions execConfiguration = options.createHostOptions(); if (execConfiguration.get(CoreOptions.class) != null) { execConfiguration.get(CoreOptions.class).isHost = false; } if (execConfiguration.get(PlatformOptions.class) != null) { execConfiguration.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } <START> return execConfiguration; <END> }</code><technical_language>extraExecutionPlatforms factor in? in emptying out for caching? is useful for execution transitions dependency chain? scenario is a valid scenario, right? i.e. execution platform switch another since, I guess theoretically, build a helper tool builds another helper tool</technical_language>

Target:
public BuildOptions patch(BuildOptions options) { if (executionPlatform == null) { return options; } BuildOptions execConfiguration = options.createHostOptions(); CoreOptions coreOptions = Preconditions.checkNotNull(execConfiguration.get(CoreOptions.class)); coreOptions.isHost = false; if (execConfiguration.get(PlatformOptions.class) != null) { execConfiguration.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } return execConfiguration; }
Source:
<code>public JSONWithPadding reactivate( @Context UriInfo ui, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception { final boolean externalTokensEnabled = !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { <START> throw new IllegalArgumentException( "Admin Users must reactiveate via " + <END> properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); } logger.info( "Send activation email for user: {}" , user.getUuid() ); ApiResponse response = createApiResponse(); management.startAdminUserActivationFlow( user ); response.setAction( "reactivate user" ); return new JSONWithPadding( response, callback ); }</code><technical_language>typo</technical_language>

Target:
public JSONWithPadding reactivate( @Context UriInfo ui, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception { final boolean externalTokensEnabled = !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reactivate via " + properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); } logger.info( "Send activation email for user: {}" , user.getUuid() ); ApiResponse response = createApiResponse(); management.startAdminUserActivationFlow( user ); response.setAction( "reactivate user" ); return new JSONWithPadding( response, callback ); }