auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateVmNumaNodeRuntimeInfo() { VmStatistics statistics = vdsmVm.getVmStatistics(); if (!dbVm.getStatus().isRunning()) { dbVm.getStatisticsData().getvNumaNodeStatisticsList().clear(); return; } Map<Integer, VdsNumaNode> vdsNumaNodes = <START> vdsNumaNodesSupplier.get(); <END> Map<Integer, VmNumaNode> vmAllNumaNodesMap = vmNumaNodeDao .getAllVmNumaNodeByVmId(dbVm.getId()).stream() .collect(Collectors.toMap(VmNumaNode::getIndex, Function.identity())); List<VmNumaNode> vmNumaNodesNeedUpdate = new ArrayList<>(); for (VmNumaNode vNode : statistics.getvNumaNodeStatisticsList()) { VmNumaNode dbVmNumaNode = vmAllNumaNodesMap.get(vNode.getIndex()); if (dbVmNumaNode != null) { vNode.setId(dbVmNumaNode.getId()); List<Integer> pinnedNodes = NumaUtils.getPinnedNodeIndexList(dbVmNumaNode.getVdsNumaNodeList()); List<Pair<Guid, Pair<Boolean, Integer>>> runTimePinList = new ArrayList<>(); for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (!pinnedNodes.contains(pair.getSecond().getSecond()) && vdsNumaNodes.containsKey(pair.getSecond().getSecond())) { pair.setFirst(vdsNumaNodes.get(pair.getSecond().getSecond()).getId()); pair.getSecond().setFirst(false); runTimePinList.add(pair); } } if (!runTimePinList.isEmpty()) { vNode.setVdsNumaNodeList(runTimePinList); vmNumaNodesNeedUpdate.add(vNode); } } } dbVm.getStatisticsData().getvNumaNodeStatisticsList().addAll(vmNumaNodesNeedUpdate); }</code><technical_language>supplier sense is accessed. pass in numa node map</technical_language>

Target:
private void updateVmNumaNodeRuntimeInfo() { VmStatistics statistics = vdsmVm.getVmStatistics(); if (!dbVm.getStatus().isRunning()) { dbVm.getStatisticsData().getvNumaNodeStatisticsList().clear(); return; } Map<Integer, VdsNumaNode> vdsNumaNodes = vdsNumaNodesProvider.get(); Map<Integer, VmNumaNode> vmAllNumaNodesMap = vmNumaNodeDao .getAllVmNumaNodeByVmId(dbVm.getId()).stream() .collect(Collectors.toMap(VmNumaNode::getIndex, Function.identity())); List<VmNumaNode> vmNumaNodesNeedUpdate = new ArrayList<>(); for (VmNumaNode vNode : statistics.getvNumaNodeStatisticsList()) { VmNumaNode dbVmNumaNode = vmAllNumaNodesMap.get(vNode.getIndex()); if (dbVmNumaNode != null) { vNode.setId(dbVmNumaNode.getId()); List<Integer> pinnedNodes = NumaUtils.getPinnedNodeIndexList(dbVmNumaNode.getVdsNumaNodeList()); List<Pair<Guid, Pair<Boolean, Integer>>> runTimePinList = new ArrayList<>(); for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (!pinnedNodes.contains(pair.getSecond().getSecond()) && vdsNumaNodes.containsKey(pair.getSecond().getSecond())) { pair.setFirst(vdsNumaNodes.get(pair.getSecond().getSecond()).getId()); pair.getSecond().setFirst(false); runTimePinList.add(pair); } } if (!runTimePinList.isEmpty()) { vNode.setVdsNumaNodeList(runTimePinList); vmNumaNodesNeedUpdate.add(vNode); } } } dbVm.getStatisticsData().getvNumaNodeStatisticsList().addAll(vmNumaNodesNeedUpdate); }
Source:
<code>public static synchronized GitScopeOperationFactory getFactory() { <START> if(instance == null) { <END> instance = new GitScopeOperationFactory(); } return instance; }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public static synchronized GitScopeOperationFactory getFactory() { if(instance == null) instance = new GitScopeOperationFactory(); return instance; }
Source:
<code><START> public Iterable<SshKeyCacheEntry> getSshKeyCacheEntries() { <END> return sshKeyIter; }</code><technical_language>This public. default package access thee cache impl in this package it</technical_language>

Target:
Iterable<SshKeyCacheEntry> getSshKeyCacheEntries() { return sshKeyIter; }
Source:
<code>private void loopRunTest( int testRuns ) throws InterruptedException, java.util.concurrent.ExecutionException { List<Throwable> exceptionList = new ArrayList<>(); loopRun( testRuns, exceptionList ); if ( !exceptionList.isEmpty() ) { int additionalRuns = testRuns * 99; loopRun( additionalRuns, exceptionList ); double totalRuns = additionalRuns + testRuns; double failures = exceptionList.size(); double failureRate = failures / totalRuns; <START> if ( failureRate > 0.2 ) <END> { AssertionError error = new AssertionError( "False deadlock failure rate of " + failureRate + " is greater than 2%" ); for ( Throwable th : exceptionList ) { error.addSuppressed( th ); } throw error; } } }</code><technical_language>0.02 instead? failure reporting threshold is more 20%</technical_language>

Target:
private void loopRunTest( int testRuns ) throws InterruptedException, java.util.concurrent.ExecutionException { List<Throwable> exceptionList = new ArrayList<>(); loopRun( testRuns, exceptionList ); if ( !exceptionList.isEmpty() ) { int additionalRuns = testRuns * 99; loopRun( additionalRuns, exceptionList ); double totalRuns = additionalRuns + testRuns; double failures = exceptionList.size(); double failureRate = failures / totalRuns; if ( failureRate > 0.02 ) { AssertionError error = new AssertionError( "False deadlock failure rate of " + failureRate + " is greater than 2%" ); for ( Throwable th : exceptionList ) { error.addSuppressed( th ); } throw error; } } }
Source:
<code>protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { final ModelNode model = resource.getModel(); final String name = context.getCurrentAddressValue(); final String jndiName = ContextServiceResourceDefinition.JNDI_NAME_AD.resolveModelAttribute(context, model).asString(); final boolean useTransactionSetupProvider = ContextServiceResourceDefinition.USE_TRANSACTION_SETUP_PROVIDER_AD.resolveModelAttribute(context, model).asBoolean(); final ServiceName serviceName = ContextServiceResourceDefinition.CAPABILITY.getCapabilityServiceName(name); final ContextServiceService contextServiceService = new ContextServiceService(name, jndiName, new DefaultContextSetupProviderImpl()); <START> final ServiceBuilder<ContextServiceImpl> serviceBuilder = context.getServiceTarget().addService(serviceName, contextServiceService); <END> if (useTransactionSetupProvider) { serviceBuilder.addDependency(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME,TransactionSetupProvider.class,contextServiceService.getTransactionSetupProvider()); } serviceBuilder.install(); }</code><technical_language>context.getCapabilityServiceTarget().addCapability(...) if possible</technical_language>

Target:
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { final ModelNode model = resource.getModel(); final String name = context.getCurrentAddressValue(); final String jndiName = ContextServiceResourceDefinition.JNDI_NAME_AD.resolveModelAttribute(context, model).asString(); final boolean useTransactionSetupProvider = ContextServiceResourceDefinition.USE_TRANSACTION_SETUP_PROVIDER_AD.resolveModelAttribute(context, model).asBoolean(); final ContextServiceService contextServiceService = new ContextServiceService(name, jndiName, new DefaultContextSetupProviderImpl()); final CapabilityServiceBuilder serviceBuilder = context.getCapabilityServiceTarget().addCapability(ContextServiceResourceDefinition.CAPABILITY, contextServiceService); if (useTransactionSetupProvider) { serviceBuilder.addDependency(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME,TransactionSetupProvider.class,contextServiceService.getTransactionSetupProvider()); } serviceBuilder.install(); }
Source:
<code>public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher( dimension, new DruidCompositePredicate() { @Override public boolean applyLong(long value) { <START> throw new UnsupportedOperationException("Spatial filter is not supported on long columns."); <END> } @Override public boolean apply(Object input) { if (input instanceof String) { final float[] coordinate = SpatialDimensionRowTransformer.decode((String) input); return bound.contains(coordinate); } else { return false; } } } ); }</code><technical_language>return false. treat high 32 bits x coordinate 32 bits y coordinate. Easter egg</technical_language>

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher( dimension, new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } final float[] coordinate = SpatialDimensionRowTransformer.decode(input); return bound.contains(coordinate); } }; } @Override public DruidLongPredicate makeLongPredicate() { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return false; } }; } } ); }
Source:
<code>public void lockWatchCreatedWithoutOpenLockGivesNoInformationOnLocks() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 0, ImmutableList.of( LockWatchCreatedEvent.builder(ROW_PREFIX_REQ, UUID.randomUUID()).build(0))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); <START> assertThat(state.version()).isEqualTo(OptionalLong.of(0)); <END> assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.NOT_WATCHED); }</code><technical_language>suggestion assertThat(state.version()).hasValue(0); on, test class</technical_language>

Target:
public void lockWatchCreatedWithoutOpenLockGivesNoInformationOnLocks() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 0, ImmutableList.of( LockWatchCreatedEvent.builder(ROW_PREFIX_REQ, UUID.randomUUID()).build(0))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); assertThat(state.version()).hasValue(0); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.UNKNOWN); }
Source:
<code>public synchronized SecretKey loadSecretKeyForEncryption() throws IOException, GeneralSecurityException { <START> if (mKey != null && mMacKey != null) <END> return mKey; final byte[] secretKeyData = AuthenticationSettings.INSTANCE.getSecretKeyData(); if(secretKeyData == null && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { throw new IllegalStateException("Secret key must be provided for API < 18. " + "Use AuthenticationSettings.INSTANCE.setSecretKey()"); } if (secretKeyData != null) { Logger.v(TAG, "Encryption will use user provided secret key."); mKey = getSecretKey(secretKeyData); mMacKey = getMacKey(mKey); mBlobVersion = VERSION_USER_DEFINED; } else { Logger.v(TAG, "Encryption will use keys persisted in AndroidKeyStore."); mKey = getSecretKeyFromAndroidKeyStore(); mMacKey = getMacKey(mKey); mBlobVersion = VERSION_ANDROID_KEY_STORE; } return mKey; }</code><technical_language>this function invoke loadSecretKeyForDecryption if fails fallback generate new keys</technical_language>

Target:
synchronized SecretKey loadSecretKeyForEncryption() throws IOException, GeneralSecurityException { if (mKey != null && mHMACKey != null) { return mKey; } final byte[] secretKeyData = AuthenticationSettings.INSTANCE.getSecretKeyData(); if (secretKeyData != null) { mBlobVersion = VERSION_USER_DEFINED; } else { mBlobVersion = VERSION_ANDROID_KEY_STORE; } return getKeyOrCreate(mBlobVersion); }
Source:
<code>public List<Integer> getFailedInvocationNumbers() { <START> return null; <END> }</code><technical_language>null empty list</technical_language>

Target:
public List<Integer> getFailedInvocationNumbers() { return Collections.emptyList(); }
Source:
<code>private static void openWPCOMURL(Activity activity, String url, Theme currentTheme, Blog blog, Boolean isCurrentTheme) { if (activity == null) { AppLog.e(AppLog.T.UTILS, "Context is null"); return; } if (TextUtils.isEmpty(url)) { <START> AppLog.e(AppLog.T.UTILS, "Empty or null URL passed to openUrlByUsingMainWPCOMCredentials"); <END> Toast.makeText(activity, activity.getResources().getText(R.string.invalid_url_message), Toast.LENGTH_SHORT).show(); return; } String authURL = ThemeWebActivity.getBlogLoginUrl(blog); Intent intent = new Intent(activity, ThemeWebActivity.class); intent.putExtra(ThemeWebActivity.AUTHENTICATION_USER, blog.getUsername()); intent.putExtra(ThemeWebActivity.AUTHENTICATION_PASSWD, blog.getPassword()); intent.putExtra(ThemeWebActivity.URL_TO_LOAD, url); intent.putExtra(ThemeWebActivity.AUTHENTICATION_URL, authURL); intent.putExtra(ThemeWebActivity.LOCAL_BLOG_ID, blog.getLocalTableBlogId()); intent.putExtra(IS_PREMIUM_THEME, currentTheme.isPremium()); intent.putExtra(IS_CURRENT_THEME, isCurrentTheme); intent.putExtra(THEME_NAME, currentTheme.getName()); intent.putExtra(ThemeBrowserActivity.THEME_ID, currentTheme.getId()); activity.startActivityForResult(intent, ThemeBrowserActivity.ACTIVATE_THEME); }</code><technical_language>openUrlByUsingMainWPCOMCredentials changed openWPCOMURL</technical_language>

Target:
private static void openWPCOMURL(Activity activity, String url, Theme currentTheme, Blog blog, Boolean isCurrentTheme) { if (activity == null) { AppLog.e(AppLog.T.UTILS, "Context is null"); return; } if (TextUtils.isEmpty(url)) { AppLog.e(AppLog.T.UTILS, "Empty or null URL passed to openWPCOMURL"); Toast.makeText(activity, activity.getResources().getText(R.string.invalid_url_message), Toast.LENGTH_SHORT).show(); return; } String authURL = ThemeWebActivity.getBlogLoginUrl(blog); Intent intent = new Intent(activity, ThemeWebActivity.class); intent.putExtra(ThemeWebActivity.AUTHENTICATION_USER, blog.getUsername()); intent.putExtra(ThemeWebActivity.AUTHENTICATION_PASSWD, blog.getPassword()); intent.putExtra(ThemeWebActivity.URL_TO_LOAD, url); intent.putExtra(ThemeWebActivity.AUTHENTICATION_URL, authURL); intent.putExtra(ThemeWebActivity.LOCAL_BLOG_ID, blog.getLocalTableBlogId()); intent.putExtra(IS_PREMIUM_THEME, currentTheme.isPremium()); intent.putExtra(IS_CURRENT_THEME, isCurrentTheme); intent.putExtra(THEME_NAME, currentTheme.getName()); intent.putExtra(ThemeBrowserActivity.THEME_ID, currentTheme.getId()); activity.startActivityForResult(intent, ThemeBrowserActivity.ACTIVATE_THEME); }
Source:
<code>public void setup() { databaseTestHelper = testContext.getDatabaseTestHelper(); defaultTestAccount = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestAccount() .insert(); <START> this.defaultTestCharge = DatabaseFixtures <END> .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .insert(); this.defaultTestToken = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestToken() .withTestToken(defaultTestCharge) .insert(); }</code><technical_language>need this.. a minor thing. for pedantic</technical_language>

Target:
public void setup() { databaseTestHelper = testContext.getDatabaseTestHelper(); defaultTestAccount = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestAccount() .insert(); defaultTestCharge = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .insert(); defaultTestToken = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestToken() .withTestToken(defaultTestCharge) .insert(); }
Source:
<code>void setFullscreen(boolean isFullscreen) { if (getView() == null) { return; } mFullscreen = isFullscreen; mControls.setVisibility(isFullscreen ? VISIBLE : View.GONE); AppUtils.toggleWebViewZoom(mWebView.getSettings(), isFullscreen); ViewGroup.LayoutParams params = mWebView.getLayoutParams(); if (isFullscreen) { mScrollView.removeView(mScrollViewContent); mWebView.scrollTo(mScrollView.getScrollX(), mScrollView.getScrollY()); mFullscreenView.addView(mScrollViewContent); params.height = ViewGroup.LayoutParams.MATCH_PARENT; } else { reset(); if (mWebView.getUrl().equals(PDF_LOADER_URL)) { mWebView.setInitialScale(1); <START> } <END> mFullscreenView.removeView(mScrollViewContent); mScrollView.addView(mScrollViewContent); mScrollView.post(() -> mScrollView.scrollTo(mWebView.getScrollX(), mWebView.getScrollY())); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; } mWebView.setLayoutParams(params); }</code><technical_language>remove if condition force reset scale toggle fullscreen & window mode</technical_language>

Target:
void setFullscreen(boolean isFullscreen) { if (getView() == null) { return; } mFullscreen = isFullscreen; mControls.setVisibility(isFullscreen ? VISIBLE : View.GONE); AppUtils.toggleWebViewZoom(mWebView.getSettings(), isFullscreen); ViewGroup.LayoutParams params = mWebView.getLayoutParams(); if (isFullscreen) { mScrollView.removeView(mScrollViewContent); mWebView.scrollTo(mScrollView.getScrollX(), mScrollView.getScrollY()); mFullscreenView.addView(mScrollViewContent); params.height = ViewGroup.LayoutParams.MATCH_PARENT; } else { reset(); int i = 0; while (mWebView.zoomOut() && i < 30) { i++; } mFullscreenView.removeView(mScrollViewContent); mScrollView.addView(mScrollViewContent); mScrollView.post(() -> mScrollView.scrollTo(mWebView.getScrollX(), mWebView.getScrollY())); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; } mWebView.setLayoutParams(params); }
Source:
<code>public Object decode(Response response, Type type) throws IOException, FeignException { if (!(type instanceof ParameterizedType)) { throw new IllegalArgumentException( "StreamDecoder supports only stream: unknown " + type); } ParameterizedType streamType = (ParameterizedType) type; if (!Stream.class.equals(streamType.getRawType())) { <START> throw new IllegalArgumentException( <END> "StreamDecoder supports only stream: unknown " + type); } Iterator<?> iterator = (Iterator) iteratorDecoder.decode(response, new IteratorParameterizedType(streamType)); return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT | Spliterator.NONNULL), false) .onClose(() -> { if (iterator instanceof Closeable) { ensureClosed((Closeable) iterator); } else { ensureClosed(response); } }); }</code><technical_language><LINK_0> (which I mistaken) 100char line wraps. is easier read wrap</technical_language>

Target:
public Object decode(Response response, Type type) throws IOException, FeignException { if (!(type instanceof ParameterizedType)) { throw new IllegalArgumentException("StreamDecoder supports only stream: unknown " + type); } ParameterizedType streamType = (ParameterizedType) type; if (!Stream.class.equals(streamType.getRawType())) { throw new IllegalArgumentException("StreamDecoder supports only stream: unknown " + type); } Iterator<?> iterator = (Iterator) iteratorDecoder.decode(response, new IteratorParameterizedType(streamType)); return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iterator, 0), false) .onClose(() -> { if (iterator instanceof Closeable) { ensureClosed((Closeable) iterator); } else { ensureClosed(response); } }); }
Source:
<code>private List<String> getLiveInstanceNames(List<String> nodes) { List<String> liveInstances = new ArrayList<>(); for (String n : nodes) { String hostname = _zkclient.ensureReadData(KeyBuilder.liveInstance(_cluster, n)); if (hostname != null) { liveInstances.add(hostname + "-" + n); <START> } <END> } return liveInstances; }</code><technical_language>add a log in else case node ended null</technical_language>

Target:
private List<String> getLiveInstanceNames(List<String> nodes) { List<String> liveInstances = new ArrayList<>(); for (String n : nodes) { String hostname = _zkclient.ensureReadData(KeyBuilder.liveInstance(_cluster, n)); if (hostname != null) { _log.error("Node is dead. Likely cause it dies after reading list of nodes.", n); liveInstances.add(hostname + "-" + n); } } return liveInstances; }
Source:
<code>private boolean skipJunk() throws IOException { boolean eof = false; int total = 0; while (!validHeader(runningFour)) { if (!readBuffer.hasRemaining()) readMoreData(); if (!readBuffer.hasRemaining()) { eof = true; break; } runningFour <<= 8; runningFour |= readBuffer.get() & 0xff; ++total; } <START> Logger.warn(String.format("[mp3demuxer] Skipped %d byts of junk", total)); <END> return eof; }</code><technical_language>byts bytes</technical_language>

Target:
private boolean skipJunk() throws IOException { boolean eof = false; int total = 0; while (!validHeader(runningFour)) { if (!readBuffer.hasRemaining()) readMoreData(); if (!readBuffer.hasRemaining()) { eof = true; break; } runningFour <<= 8; runningFour |= readBuffer.get() & 0xff; ++total; } Logger.warn(String.format("[mp3demuxer] Skipped %d bytes of junk", total)); return eof; }
Source:
<code>private static ActivityResponse call(TestRequest request) { return request .setMediaType(MediaTypes.PROTOBUF) <START> .execute().getInputObject(ActivityResponse.class); <END> }</code><technical_language>getInputObject next line</technical_language>

Target:
private static ActivityResponse call(TestRequest request) { return request.executeProtobuf(ActivityResponse.class); }
Source:
<code>private boolean isQuarriableBlock(int bx, int by, int bz) { boolean cantMine = false; Block block = worldObj.getBlock(bx, by, bz); <START> cantMine = cantMine || !BlockUtil.canChangeBlock(block, worldObj, bx, by, bz); <END> cantMine = cantMine || BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz); cantMine = cantMine || (block.getBlockHardness(worldObj, bx, by, bz) > MAX_BREAK_HARDNESS); return !cantMine; }</code><technical_language>Agreed. lump in if statement..</technical_language>

Target:
private boolean isQuarriableBlock(int bx, int by, int bz) { Block block = worldObj.getBlock(bx, by, bz); return !BlockUtil.canChangeBlock(block, worldObj, bx, by, bz) || BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz) || (block.getBlockHardness(worldObj, bx, by, bz) > MAX_BREAK_HARDNESS); }
Source:
<code>protected void setUpData() throws Exception { super.setUpData(); try { <START> dropDataTypesTable(); <END> } catch (SQLException e) { } }</code><technical_language>I a bit slow, I thought tests do clean activities (like dropDataTypesTable) in teardown method, in setup method prior setting data (incase a previous failed run)</technical_language>

Target:
protected void setUpData() throws Exception { super.setUpData(); try { dropRecreatedTable(); dropDataTypesTable(); } catch (SQLException e) { } }
Source:
<code>protected void executeCommand() { <START> VmTemplateHandler.lockVmTemplateInTransaction(diskImage.getit_guid(), getCompensationContext()); <END> TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType .MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); updateDatabase(); return null; } }); VmTemplateHandler.UnLockVmTemplate(diskImage.getit_guid()); }</code><technical_language>need a transaction</technical_language>

Target:
protected void executeCommand() { VmTemplateHandler.lockVmTemplateInTransaction(diskImage.getit_guid(), getCompensationContext()); VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType.MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); VmTemplateHandler.UnLockVmTemplate(diskImage.getit_guid()); }
Source:
<code>public void onCreate() { <START> this.server = new CoapServer(CoAP_PORT); <END> server.add(new HelloWorldResource()); }</code><technical_language>reason, plain endpoint is create in "onCreate" secure in "onStartCommand"? read android docu for "on???"</technical_language>

Target:
public void onCreate() { this.server = new CoapServer(); server.add(new HelloWorldResource()); }
Source:
<code>public void triggerMisfired(Trigger trigger) { <START> log.debug("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + <END> "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); }</code><technical_language>Please change this warn also. Thx</technical_language>

Target:
public void triggerMisfired(Trigger trigger) { log.warn("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); }
Source:
<code><START> void writeNull(int columnIndex) <END> { nullBitSet[columnIndex >>> 3] |= (1 << (columnIndex & 7)); }</code><technical_language>non-modifiered</technical_language>

Target:
private void writeNull(int columnIndex) { nullBitSet[columnIndex >>> 3] |= (1 << (columnIndex & 7)); }
Source:
<code>public synchronized void handleMessageSetEpoch(@NonNull CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { try { long epoch = msg.getPayload(); <START> String remoteHostAddress = "0.0.0.0"; <END> if (ctx.channel() != null) { remoteHostAddress = ((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress(); } log.info("handleMessageSetEpoch: Received SET_EPOCH from (clientId={}:{}), moving to new epoch {}", msg.getClientID(), remoteHostAddress, epoch); serverContext.setServerEpoch(epoch, r); r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); } catch (WrongEpochException e) { log.debug("handleMessageSetEpoch: Rejected SET_EPOCH current={}, requested={}", e.getCorrectEpoch(), msg.getPayload()); r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, e.getCorrectEpoch())); } }</code><technical_language>setting 0.0.0.0 null? remoteAddress() return null anyways. If want differentiate ctx.channel null ctx.channel connected this is fine expressive</technical_language>

Target:
public synchronized void handleMessageSetEpoch(@NonNull CorfuPayloadMsg<Long> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { try { long epoch = msg.getPayload(); String remoteHostAddress; try { remoteHostAddress = ((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress(); } catch (NullPointerException e) { remoteHostAddress = "unavailable"; } log.info("handleMessageSetEpoch: Received SET_EPOCH from (clientId={}:{}), moving to new epoch {}", msg.getClientID(), remoteHostAddress, epoch); serverContext.setServerEpoch(epoch, r); r.sendResponse(ctx, msg, CorfuMsgType.ACK.msg()); } catch (WrongEpochException e) { log.debug("handleMessageSetEpoch: Rejected SET_EPOCH current={}, requested={}", e.getCorrectEpoch(), msg.getPayload()); r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, e.getCorrectEpoch())); } }
Source:
<code>public Mono<ShouldRetryResult> shouldRetry(Exception e) { if (!(e instanceof CosmosException)) { return Mono.just(ShouldRetryResult.noRetry()); } CosmosException cosmosException = (CosmosException)e; if (cosmosException.getStatusCode() != HttpConstants.StatusCodes.NOTFOUND || cosmosException.getSubStatusCode() != HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE) { LOGGER.debug( "SessionTokenMismatchRetryPolicy not retrying because StatusCode or SubStatusCode not found."); return Mono.just(ShouldRetryResult.noRetry()); } if (this.waitTimeTimeoutHelper.isElapsed()) { <START> LOGGER.info( <END> "SessionTokenMismatchRetryPolicy not retrying because it has exceeded " + "the time limit. Retry count = {}", this.retryCount); return Mono.just(ShouldRetryResult.noRetry()); } Duration effectiveBackoff = Duration.ZERO; if (this.retryCount.getAndIncrement() > 0) { effectiveBackoff = getEffectiveBackoff( this.currentBackoff, this.waitTimeTimeoutHelper.getRemainingTime()); this.currentBackoff = getEffectiveBackoff( Duration.ofMillis(this.currentBackoff.toMillis() * BACKOFF_MULTIPLIER), this.maximumBackoff); } LOGGER.debug( "SessionTokenMismatchRetryPolicy will retry. Retry count = {}. Backoff time = ms", this.retryCount, effectiveBackoff.toMillis()); return Mono.just(ShouldRetryResult.retryAfter(effectiveBackoff)); }</code><technical_language>info warn</technical_language>

Target:
public Mono<ShouldRetryResult> shouldRetry(Exception e) { if (!(e instanceof CosmosException)) { return Mono.just(ShouldRetryResult.noRetry()); } CosmosException cosmosException = (CosmosException)e; if (cosmosException.getStatusCode() != HttpConstants.StatusCodes.NOTFOUND || cosmosException.getSubStatusCode() != HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE) { LOGGER.debug( "SessionTokenMismatchRetryPolicy not retrying because StatusCode or SubStatusCode not found."); return Mono.just(ShouldRetryResult.noRetry()); } if (this.waitTimeTimeoutHelper.isElapsed()) { LOGGER.warn( "SessionTokenMismatchRetryPolicy not retrying because it has exceeded " + "the time limit. Retry count = {}", this.retryCount); return Mono.just(ShouldRetryResult.noRetry()); } Duration effectiveBackoff = Duration.ZERO; if (this.retryCount.getAndIncrement() > 0) { effectiveBackoff = getEffectiveBackoff( this.currentBackoff, this.waitTimeTimeoutHelper.getRemainingTime()); this.currentBackoff = getEffectiveBackoff( Duration.ofMillis(this.currentBackoff.toMillis() * BACKOFF_MULTIPLIER), this.maximumBackoff); } LOGGER.debug( "SessionTokenMismatchRetryPolicy will retry. Retry count = {}. Backoff time = ms", this.retryCount, effectiveBackoff.toMillis()); return Mono.just(ShouldRetryResult.retryAfter(effectiveBackoff)); }
Source:
<code>private Map getSubjectPreferences(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); try { String filter = String.format("user = '%s'", userid); List<Map<String, Object>> preferencesList = persistentStore.get(PersistenceType.PREFERENCES_TYPE.toString(), filter); if (preferencesList.size() == 1) { byte[] json = (byte[]) preferencesList.get(0).get("preferences_json_bin"); return GSON.fromJson( new String(json, Charset.defaultCharset()), <START> new TypeToken<Map<String, Object>>() {}.getType()); <END> } } catch (PersistenceException e) { LOGGER.info( "PersistenceException while trying to retrieve persisted preferences for user {}", userid, e); } return Collections.emptyMap(); }</code><technical_language>If some of paths do anonymous TypeToken time sensitive often, consider creating static constants hole getType() result pass in. In migration, case I bother</technical_language>

Target:
private Map getSubjectPreferences(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); try { String filter = String.format("user = '%s'", userid); List<Map<String, Object>> preferencesList = persistentStore.get(PersistenceType.PREFERENCES_TYPE.toString(), filter); if (preferencesList.size() == 1) { byte[] json = (byte[]) preferencesList.get(0).get("preferences_json_bin"); return GSON.fromJson(new String(json, Charset.defaultCharset()), MAP_STRING_TO_OBJECT_TYPE); } } catch (PersistenceException e) { LOGGER.info( "PersistenceException while trying to retrieve persisted preferences for user {}", userid, e); } return Collections.emptyMap(); }
Source:
<code>public PerformanceResult call() throws Exception { final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(getClient()); final int numberOfFiles = Integer.valueOf(this.numberOfFiles); final long sizeOfFiles = Integer.valueOf(this.sizeOfFiles); try { helpers.ensureBucketExists(this.bucketName); <START> final List<Ds3Object> objList = Lists.newArrayList(); <END> for (int i = 0; i < numberOfFiles; i++) { final long testFileSize = sizeOfFiles * 1024L * 1024L; final Ds3Object obj = new Ds3Object("file_" + i, testFileSize); objList.add(obj); } transfer(helpers, numberOfFiles, sizeOfFiles, objList, true); transfer(helpers, numberOfFiles, sizeOfFiles, objList, false); } finally { deleteAllContents(getClient(), this.bucketName); } return new PerformanceResult("Done!"); }</code><technical_language>I move this function</technical_language>

Target:
public PerformanceResult call() throws Exception { final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(getClient()); final int numberOfFiles = Integer.valueOf(this.numberOfFiles); final long sizeOfFiles = Integer.valueOf(this.sizeOfFiles); try { helpers.ensureBucketExists(this.bucketName); final List<Ds3Object> objList = getDs3Objects(numberOfFiles, sizeOfFiles); transfer(helpers, numberOfFiles, sizeOfFiles, objList, true); transfer(helpers, numberOfFiles, sizeOfFiles, objList, false); } finally { deleteAllContents(getClient(), this.bucketName); } return new PerformanceResult("Done!"); }
Source:
<code>void clearWALEntryBatch() { <START> while(this.isAlive() || this.entryReader.isAlive()){ try { Thread.sleep(this.sleepForRetries); } catch (InterruptedException e) { LOG.info("{} Interrupted while waiting to stop on clearWALEntryBatch", this.source.getPeerId(), this.getName()); Thread.currentThread().interrupt(); } } <END> LongAccumulator totalToDecrement = new LongAccumulator((a,b) -> a + b, 0); entryReader.entryBatchQueue.forEach(w -> { entryReader.entryBatchQueue.remove(w); w.getWalEntries().forEach(e -> { long entrySizeExcludeBulkLoad = entryReader.getEntrySizeExcludeBulkLoad(e); totalToDecrement.accumulate(entrySizeExcludeBulkLoad); }); }); source.getSourceManager().getTotalBufferUsed().addAndGet(-totalToDecrement.longValue()); }</code><technical_language>a timeout here? is a timeout interrupt if long</technical_language>

Target:
void clearWALEntryBatch() { long timeout = System.currentTimeMillis() + this.shipEditsTimeout; while(this.isAlive() || this.entryReader.isAlive()){ try { if (System.currentTimeMillis() >= timeout) { LOG.warn("Interrupting source thread for peer without cleaning buffer usage " + "because clearWALEntryBatch method timed out whilst waiting reader/shipper " + "thread to stop.", this.source.getPeerId()); Thread.currentThread().interrupt(); } else { Thread.sleep(this.sleepForRetries); } } catch (InterruptedException e) { LOG.warn("{} Interrupted while waiting to stop on clearWALEntryBatch: {}", this.source.getPeerId(), this.getName(), e); Thread.currentThread().interrupt(); } } LongAccumulator totalToDecrement = new LongAccumulator((a,b) -> a + b, 0); entryReader.entryBatchQueue.forEach(w -> { entryReader.entryBatchQueue.remove(w); w.getWalEntries().forEach(e -> { long entrySizeExcludeBulkLoad = entryReader.getEntrySizeExcludeBulkLoad(e); totalToDecrement.accumulate(entrySizeExcludeBulkLoad); }); }); LOG.trace("Decrementing totalBufferUsed by {}B while stopping Replication WAL Readers.", totalToDecrement.longValue()); source.getSourceManager().getTotalBufferUsed().addAndGet(-totalToDecrement.longValue()); }
Source:
<code>private Set<Project.NameKey> getGrandParents(Project parent) { Set<Project.NameKey> grandParents = Sets.newHashSet(); if (parent != null) { Project.NameKey gp = parent.getParent(allProjects); <START> while (gp != null && grandParents.add(gp)) { <END> final ProjectState s = cache.get(gp); if (s != null) { gp = s.getProject().getParent(); } else { break; } } } return grandParents; }</code><technical_language>if dependent graph cycles be, grandParents.add(gp) == false ? If false include in while condition</technical_language>

Target:
private Set<Project.NameKey> getGrandParents(Project parent) { Set<Project.NameKey> grandParents = Sets.newHashSet(); if (parent != null) { Project.NameKey gp = parent.getParent(allProjects); while (gp != null && grandParents.add(gp)) { ProjectState s = cache.get(gp); if (s != null) { gp = s.getProject().getParent(); } else { break; } } } return grandParents; }
Source:
<code>public Command execute() throws RollBackCommandException { try { Session sess = this.getSecAdvisor().getReadOnlyHibernateSession(this.getUsername()); if(idTopic != null) { Topic dataTrack = (Topic) (sess.load(Topic.class, idTopic)); if (!this.getSecAdvisor().canRead(dataTrack)) { this.addInvalidField("perm", "Insufficient permission to access this topic"); } } else { this.addInvalidField("topicNumber", "topicNumber is either invalid or not provided"); } if (isValid()) { this.xmlResult = "<SUCCESS/>"; setResponsePage(this.SUCCESS_JSP); } else { setResponsePage(this.ERROR_JSP); } <START> } catch (NamingException e){ <END> LOG.error("An exception has occurred in CheckTopicPermission ", e); e.printStackTrace(System.out); throw new RollBackCommandException(e.getMessage()); } catch (SQLException e) { LOG.error("An exception has occurred in CheckTopicPermission ", e); e.printStackTrace(System.out); throw new RollBackCommandException(e.getMessage()); } catch (Exception e) { LOG.error("An exception has occurred in CheckTopicPermission ", e); e.printStackTrace(System.out); throw new RollBackCommandException(e.getMessage()); } finally { try { this.getSecAdvisor().closeReadOnlyHibernateSession(); } catch(Exception e) { } } return this; }</code><technical_language>consolidate get rid of e.printStackTrace(System.out); calls</technical_language>

Target:
public Command execute() throws RollBackCommandException { try { Session sess = this.getSecAdvisor().getReadOnlyHibernateSession(this.getUsername()); if(idTopic != null) { Topic dataTrack = (Topic) (sess.load(Topic.class, idTopic)); if (!this.getSecAdvisor().canRead(dataTrack)) { this.addInvalidField("perm", "Insufficient permission to access this topic"); } } else { this.addInvalidField("topicNumber", "topicNumber is either invalid or not provided"); } if (isValid()) { this.xmlResult = "<SUCCESS/>"; setResponsePage(this.SUCCESS_JSP); } else { setResponsePage(this.ERROR_JSP); } } catch (Exception e) { LOG.error("An exception has occurred in CheckTopicPermission ", e); throw new RollBackCommandException(e.getMessage()); } finally { try { this.getSecAdvisor().closeReadOnlyHibernateSession(); } catch(Exception e) { LOG.error("An exception has occurred in CheckTopicPermission ", e); } } return this; }
Source:
<code>public void queryLabelWithNoResults() throws Exception { List<ChangeInfo> changeInfos = newGson().fromJson( adminSession.get("/changes/?q=label:Code-Review-2") .getReader(), new TypeToken<List<ChangeInfo>>() .getType()); <START> assertThat(changeInfos).hasSize(0); <END> }</code><technical_language>isEmpty()</technical_language>

Target:
public void queryLabelWithNoResults() throws Exception { List<ChangeInfo> changeInfos = GET("Code-Review-2"); assertThat(changeInfos).isEmpty(); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((MifosBaseActivity) getActivity()).getActivityComponent().inject(this); Bundle arguments = getArguments(); if (arguments != null) { <START> mIsGroupAccount = arguments.containsKey(Constants.GROUP_ID); <END> clientId = arguments.getInt(Constants.CLIENT_ID); groupId = arguments.getInt(Constants.GROUP_ID); } }</code><technical_language>containsKey is like, putting dark If lot's of present in bundle want check present get not. java arguments.getBoolean(String key)</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((MifosBaseActivity) getActivity()).getActivityComponent().inject(this); Bundle arguments = getArguments(); if (arguments != null) { isGroupAccount = arguments.getBoolean(Constants.GROUP_ACCOUNT); clientId = arguments.getInt(Constants.CLIENT_ID); groupId = arguments.getInt(Constants.GROUP_ID); } }
Source:
<code>public MatchResult detailMatches(PlanNode node, PlanNodeCost cost, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); TableScanNode tableScanNode = (TableScanNode) node; TableMetadata tableMetadata = metadata.getTableMetadata(session, tableScanNode.getTable()); String actualTableName = tableMetadata.getTable().getTableName(); return new MatchResult( expectedTableName.equalsIgnoreCase(actualTableName) && <START> ((!expectedConstraint.isPresent()) || <END> domainsMatch(expectedConstraint, tableScanNode.getCurrentConstraint(), tableScanNode.getTable(), session, metadata))); }</code><technical_language>This in separate commit. do IndexSource pruning</technical_language>

Target:
public MatchResult detailMatches(PlanNode node, PlanNodeCost cost, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); TableScanNode tableScanNode = (TableScanNode) node; TableMetadata tableMetadata = metadata.getTableMetadata(session, tableScanNode.getTable()); String actualTableName = tableMetadata.getTable().getTableName(); return new MatchResult( expectedTableName.equalsIgnoreCase(actualTableName) && originalConstraintMatches(tableScanNode) && ((!expectedConstraint.isPresent()) || domainsMatch(expectedConstraint, tableScanNode.getCurrentConstraint(), tableScanNode.getTable(), session, metadata))); }
Source:
<code>public void processElement(ProcessContext context) throws Exception { KV<String, Iterable<Mutation>> element = context.element(); <START> List<Mutation> mutations = Lists.newArrayList(element.getValue()); <END> try { getMutator(element.getKey()).mutate(mutations); } catch (RetriesExhaustedWithDetailsException exception) { logExceptions(context, exception); rethrowException(exception); } mutationsCounter.addValue((long) mutations.size()); }</code><technical_language>I iterate group materializing collection in memory. This allow mutator push incoming stream</technical_language>

Target:
public void processElement(ProcessContext context) throws Exception { KV<String, Iterable<Mutation>> element = context.element(); BufferedMutator mutator = getMutator(element.getKey()); try { for (Mutation mutation : element.getValue()) { mutator.mutate(mutation); mutationsCounter.addValue(1l); } } catch (RetriesExhaustedWithDetailsException exception) { logExceptions(context, exception); rethrowException(exception); } }
Source:
<code>public JSONPlugin() { super(Arrays.asList( <START> (Class<? extends Plugin>) JSONFieldPlugin.class, <END> JSONViewPropertyPlugin.class, JSONInheritedPropertyPlugin.class)); }</code><technical_language>This cast a funky here. alternative is java Arrays.<Class<? extends Plugin>>asList( JSONFieldPlugin.class, JSONViewPropertyPlugin.class, JSONInheritedPropertyPlugin.class ); a funky, is more clear</technical_language>

Target:
public JSONPlugin() { super(Arrays.<Class<? extends Plugin>>asList( JSONFieldPlugin.class, JSONViewPropertyPlugin.class, JSONInheritedPropertyPlugin.class)); }
Source:
<code>private Boolean tryInjection(HttpMessage msg, String param, XSLTInjectionType checkType) { for (String payload : checkType.payloads) { try { if (isStop() || requestsLimitReached()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " Stopping."); } return false; } msg = sendRequest(msg, param, payload); for (String response : checkType.responses) { <START> if (getBaseMsg().getResponseBody().toString().contains(response)) { <END> continue; } if (msg.getResponseBody().toString().contains(response)) { raiseAlert(msg, param, payload, response, checkType.resourceIdentifier); return true; } } } catch (Exception e) { LOG.warn( "An error occurred while checking [" + msg.getRequestHeader().getMethod() + "] [" + msg.getRequestHeader().getURI() + "] for " + getName() + " Caught " + e.getClass().getName() + " " + e.getMessage()); continue; } } return false; }</code><technical_language>Ideally exclude responses sending message, need check base message</technical_language>

Target:
private Boolean tryInjection(HttpMessage msg, String param, XSLTInjectionType checkType) { Predicate<String> filterEvidence = ((Predicate<String>) (getBaseMsg().getResponseBody().toString()::contains)) .negate(); String[] relevantEvidence = Arrays.stream(checkType.getEvidences()) .filter(filterEvidence) .toArray(String[]::new); for (String payload : checkType.getPayloads(msg)) { try { if (isStop() || requestsLimitReached()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " Stopping."); } return true; } msg = sendRequest(msg, param, payload); for (String evidence : relevantEvidence) { if (msg.getResponseBody().toString().contains(evidence)) { raiseAlert( msg, param, payload, evidence, checkType.getResourceIdentifier()); return true; } } } catch (Exception e) { LOG.warn( "An error occurred while checking [" + msg.getRequestHeader().getMethod() + "] [" + msg.getRequestHeader().getURI() + "] for " + getName() + " Caught " + e.getClass().getName() + " " + e.getMessage()); continue; } } return false; }
Source:
<code>public ConfigKey<?>[] getConfigKeys() { return new ConfigKey<?>[] {NuageVspConfigDns, NuageVspDnsExternal, NuageVspConfigGateway, <START> NuageVspSharedNetworkDomainTemplateName, NuageVspVpcDomainTemplateName, NuageVspIsolatedNetworkDomainTemplateName}; <END> }</code><technical_language>This array declared a static constant avoid unnecessary object creation heap</technical_language>

Target:
public ConfigKey<?>[] getConfigKeys() { return Arrays.copyOf(NUAGE_VSP_CONFIG_KEYS, NUAGE_VSP_CONFIG_KEYS.length); }
Source:
<code>public void setValueAsString_shouldSetValueAsDateTimeIfDataTypeOfQuestionConceptIsDateTimeHavingTimeZone() throws Exception { Obs obs = new Obs(); ConceptDatatype cdt = new ConceptDatatype(); Concept c = new Concept(); <START> c.setDatatype(cdt); <END> obs.setConcept(c); String[] dates1 = { "2016-01-12T06:00:00+05:30", "2016-01-12T06:00:00+0530" }; String[] dates2 = { "2014-02-20T11:00:00.000-05:00", "2014-02-20T11:00:00.000-05" }; for (String date : dates1) { obs.setValueAsString(date); } for (String date : dates2) { obs.setValueAsString(date); } }</code><technical_language>do check if obs set date correctly? this useful for exception testing:<LINK_0></technical_language>

Target:
public void setValueAsString_shouldSetValueAsDateTimeIfDataTypeOfQuestionConceptIsDateTimeHavingTimeZone() throws Exception { Obs obs = new Obs(); ConceptDatatype cdt = new ConceptDatatype(); Concept c = new Concept(); c.setDatatype(cdt); obs.setConcept(c); String abbrev = c.getDatatype().getHl7Abbreviation(); String[] dates1 = { "2016-01-12T06:00:00+05:30", "2016-01-12T06:00:00+0530" }; String[] dates2 = { "201-02-20T11:00:00.000-05:00", "-02-20T11:00:00.000-05" }; for (String date : dates1) { obs.setValueAsString(date); } for (String date : dates2) { obs.setValueAsString(date); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Don't know how to handle " + abbrev); } }
Source:
<code><START> public JoinNode.Type getType() <END> { return type; }</code><technical_language>Is this correct? this ensured LocalExecutionPlanner</technical_language>

Target:
public Type getType() { return type; }
Source:
<code>public void testGetSubscriptionByCreateTopicIfAutosubscribeEnabled() throws NotFoundException { Topic createdTopic = ObjectsFactory.topics(user, 1).get(0); user.setAutosubscribe(true); <START> replyTopicStubs(createdTopic); <END> Topic createdTopicLast = topicService.createTopic(createdTopic, ANSWER_BODY); assertTrue(createdTopicLast.userSubscribed(user), SUBSCRIBED); }</code><technical_language>This test checks topic creation. do call replyTopicStubs</technical_language>

Target:
public void testGetSubscriptionByCreateTopicIfAutosubscribeEnabled() throws NotFoundException { Topic createdTopic = ObjectsFactory.topics(user, 1).get(0); user.setAutosubscribe(true); createTopicStubs(); Topic createdTopicLast = topicService.createTopic(createdTopic, ANSWER_BODY); verify(subscriptionService).subscribe(createdTopicLast); }