auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { int scanId; synchronized (mScanInfo) { scanId = telephony.requestNetworkScan( subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); } <START> return new NetworkScan(scanId, subId); <END> } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }</code><technical_language>put this line in synchronized (mScanInfo) { } too? eliminate another race condition callback arrives earlier requestNetworkScan() caller</technical_language>

Target:
public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { int scanId; synchronized (mScanInfo) { scanId = telephony.requestNetworkScan( subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); return new NetworkScan(scanId, subId); } } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }
Source:
<code>final synchronized private SecretKey getSecretKeyFromAndroidKeyStore() throws IOException, GeneralSecurityException { if (sSecretKeyFromAndroidKeyStore != null) { return sSecretKeyFromAndroidKeyStore; } File keyFile = new File(mContext.getDir(mContext.getPackageName(), Context.MODE_PRIVATE), ADALKS); if (mKeyPair == null) { mKeyPair = getKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Retrived keypair from androidKeyStore"); } Cipher wrapCipher = Cipher.getInstance(WRAP_ALGORITHM); if (!keyFile.exists()) { Logger.v(TAG, "Key file does not exists"); final SecretKey key = generateSecretKey(); Logger.v(TAG, "Wrapping SecretKey"); final byte[] keyWrapped = wrap(wrapCipher, key); Logger.v(TAG, "Writing SecretKey"); writeKeyData(keyFile, keyWrapped); Logger.v(TAG, "Finished writing SecretKey"); } Logger.v(TAG, "Reading SecretKey"); try { final byte[] encryptedKey = readKeyData(keyFile); sSecretKeyFromAndroidKeyStore = unwrap(wrapCipher, encryptedKey); Logger.v(TAG, "Finished reading SecretKey"); <START> } catch (GeneralSecurityException ex) { <END> Logger.e(TAG, "Unwrap failed for AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED); mKeyPair = null; sSecretKeyFromAndroidKeyStore = null; deleteKeyFile(); resetKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Removed previous key pair info."); } return sSecretKeyFromAndroidKeyStore; }</code><technical_language>readKeyData throw out IOException, I catch exception here</technical_language>

Target:
final synchronized private SecretKey getSecretKeyFromAndroidKeyStore() throws IOException, GeneralSecurityException { if (sSecretKeyFromAndroidKeyStore != null) { return sSecretKeyFromAndroidKeyStore; } File keyFile = new File(mContext.getDir(mContext.getPackageName(), Context.MODE_PRIVATE), ADALKS); if (mKeyPair == null) { mKeyPair = getKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Retrived keypair from androidKeyStore"); } Cipher wrapCipher = Cipher.getInstance(WRAP_ALGORITHM); if (!keyFile.exists()) { Logger.v(TAG, "Key file does not exists"); final SecretKey key = generateSecretKey(); Logger.v(TAG, "Wrapping SecretKey"); final byte[] keyWrapped = wrap(wrapCipher, key); Logger.v(TAG, "Writing SecretKey"); writeKeyData(keyFile, keyWrapped); Logger.v(TAG, "Finished writing SecretKey"); } Logger.v(TAG, "Reading SecretKey"); try { final byte[] encryptedKey = readKeyData(keyFile); sSecretKeyFromAndroidKeyStore = unwrap(wrapCipher, encryptedKey); Logger.v(TAG, "Finished reading SecretKey"); } catch (GeneralSecurityException | IOException ex) { Logger.e(TAG, "Unwrap failed for AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED, ex); mKeyPair = null; sSecretKeyFromAndroidKeyStore = null; deleteKeyFile(); resetKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Removed previous key pair info."); } return sSecretKeyFromAndroidKeyStore; }
Source:
<code>public void storeData(String data, String filepath) throws AREAsapiException { <START> this.storeData(data, filepath, RES_TYPE.DATA, Charsets.UTF_8); <END> }</code><technical_language>UTF-8 version supported? version charset name</technical_language>

Target:
public void storeData(String data, String filepath) throws AREAsapiException { this.storeData(data, filepath, RES_TYPE.DATA); }
Source:
<code>public HCatClient getHCatClient() { if (null == this.hCatClient) { try { this.hCatClient = HCatUtil.getHCatClient(hcatEndpoint); } catch (HCatException e) { <START> throw new TestNGException(e); <END> } } return this.hCatClient; }</code><technical_language>this conversion</technical_language>

Target:
public HCatClient getHCatClient() { if (null == this.hCatClient) { try { this.hCatClient = HCatUtil.getHCatClient(hcatEndpoint); } catch (HCatException e) { Assert.fail("Unable to create hCatClient because of exception:\n" + ExceptionUtils.getStackTrace(e)); } } return this.hCatClient; }
Source:
<code>public void startExport(Process process, OutputStream os, String xslt) throws IOException { try { Document doc = createDocument(process, true); XMLOutputter outp = new XMLOutputter(); outp.setFormat(Format.getPrettyFormat()); outp.output(doc, os); os.close(); } catch (IOException | RuntimeException e) { <START> throw new IOException(e.getMessage(), e); <END> } }</code><technical_language>Is this change necessary? is new IOException, logger</technical_language>

Target:
public void startExport(Process process, OutputStream os, String xslt) throws IOException { try { Document doc = createDocument(process, true); XMLOutputter outp = new XMLOutputter(); outp.setFormat(Format.getPrettyFormat()); outp.output(doc, os); os.close(); } catch (RuntimeException e) { throw new IOException(e.getMessage(), e); } }
Source:
<code>public void channelActive(final ChannelHandlerContext ctx) throws Exception { <START> log.trace("channelActive: Incoming connection established from: Start Read Timeout.", <END> ctx.channel().remoteAddress()); ctx.pipeline().addBefore(ctx.name(), READ_TIMEOUT_HANDLER, new ReadTimeoutHandler(this.timeoutInSeconds)); }</code><technical_language>This log statement I is relevant if connection client a server is established. is useful, I leave INFO DEBUG</technical_language>

Target:
public void channelActive(final ChannelHandlerContext ctx) throws Exception { log.info("channelActive: Incoming connection established from: Start Read Timeout.", ctx.channel().remoteAddress()); ctx.pipeline().addBefore(ctx.name(), READ_TIMEOUT_HANDLER, new ReadTimeoutHandler(this.timeoutInSeconds)); }
Source:
<code>private static void browsePostOrPageEx( Context context, SiteModel site, PostModel post, RemotePreviewType remotePreviewType) { if (site == null || post == null || TextUtils.isEmpty(post.getLink())) { return; } if (remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE && TextUtils.isEmpty(post.getAutoSavePreviewUrl())) { return; } String url = PostUtils.getPreviewUrlForPost(remotePreviewType, post); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); boolean startPreviewForResult = remotePreviewType != RemotePreviewType.NOT_A_REMOTE_PREVIEW; if (site.isWPCom()) { WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials( context, url, shareableUrl, shareSubject, true, startPreviewForResult); <START> } else if (site.isJetpackConnected() && !TextUtils.isEmpty(site.getFrameNonce())) { <END> WPWebViewActivity .openJetpackBlogPostPreview( context, url, shareableUrl, shareSubject, site.getFrameNonce(), true, startPreviewForResult); } else { WPWebViewActivity.openUrlByUsingBlogCredentials( context, site, post, url, new String[]{post.getLink()}, true, true, startPreviewForResult); } }</code><technical_language>I achieve this: suggestion } else if (site.isJetpackConnected() && site.isUsingWpComRestApi()) { Alternatively add site.isUsingWpComRestApi() !TextUtils.isEmpty(site.getFrameNonce()). I 3 of solutions work, I explicit isUsingWpComRestApi check code a bit clearer for call openJetpackBlogPostPreview afterwards</technical_language>

Target:
private static void browsePostOrPageEx( Context context, SiteModel site, PostModel post, RemotePreviewType remotePreviewType) { if (site == null || post == null || TextUtils.isEmpty(post.getLink())) { return; } if (remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE && TextUtils.isEmpty(post.getAutoSavePreviewUrl())) { return; } String url = PostUtils.getPreviewUrlForPost(remotePreviewType, post); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); boolean startPreviewForResult = remotePreviewType != RemotePreviewType.NOT_A_REMOTE_PREVIEW; if (site.isWPCom()) { WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials( context, url, shareableUrl, shareSubject, true, startPreviewForResult); } else if (site.isJetpackConnected() && site.isUsingWpComRestApi()) { WPWebViewActivity .openJetpackBlogPostPreview( context, url, shareableUrl, shareSubject, site.getFrameNonce(), true, startPreviewForResult); } else { WPWebViewActivity.openUrlByUsingBlogCredentials( context, site, post, url, new String[]{post.getLink()}, true, true, startPreviewForResult); } }
Source:
<code>public Surface<Double, Double, Pair<Double, DoubleMatrix1D>> getVolAndParameterSensitivitySurface(final DoubleMatrix1D modelParameters) { <START> final BasisFunctionAggregation<double[]> bSpline = new BasisFunctionAggregation<>(_bSplines, modelParameters.getData()); <END> final Function2D<Double, Pair<Double, DoubleMatrix1D>> func = new Function2D<Double, Pair<Double, DoubleMatrix1D>>() { @Override public Pair<Double, DoubleMatrix1D> evaluate(final Double t, final Double k) { return bSpline.valueAndWeightSensitivity(new double[] {t, k }); } }; return new FunctionalSurface<>(func); }</code><technical_language>Check args</technical_language>

Target:
public Surface<Double, Double, Pair<Double, DoubleMatrix1D>> getVolAndParameterSensitivitySurface(final DoubleMatrix1D modelParameters) { ArgumentChecker.notNull(modelParameters, "modelParameters"); final BasisFunctionAggregation<double[]> bSpline = new BasisFunctionAggregation<>(_bSplines, modelParameters.getData()); final Function2D<Double, Pair<Double, DoubleMatrix1D>> func = new Function2D<Double, Pair<Double, DoubleMatrix1D>>() { @Override public Pair<Double, DoubleMatrix1D> evaluate(final Double t, final Double k) { return bSpline.valueAndWeightSensitivity(new double[] {t, k }); } }; return new FunctionalSurface<>(func); }
Source:
<code>public FsckError check(ProgressMonitor pm) throws IOException { if (pm == null) { pm = NullProgressMonitor.INSTANCE; } FsckError errors = new FsckError(); if (!connectivityOnly) { checkPacks(pm, errors); } checkConnectivity(pm, errors); <START> objChecker.reset(); <END> return errors; }</code><technical_language>In spirit of defensive programming, I easiest this reset() call right checkPacks. (Fewer hard-to-reproduce issues due a caller leaving some state in objChecker.)</technical_language>

Target:
public FsckError check(ProgressMonitor pm) throws IOException { if (pm == null) { pm = NullProgressMonitor.INSTANCE; } FsckError errors = new FsckError(); if (!connectivityOnly) { objChecker.reset(); checkPacks(pm, errors); } checkConnectivity(pm, errors); return errors; }
Source:
<code>public synchronized ContainerAccess getContainerAccess(String container) { Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); <START> if ( System.getProperty("os.name", "").toLowerCase().contains("windows") ) { <END> UserPrincipal everyone = null; try { everyone = getDefault().getUserPrincipalLookupService() .lookupPrincipalByName("Everyone"); } catch (IOException e) { throw new RuntimeException(e); } AclFileAttributeView aclFileAttributes = java.nio.file.Files.getFileAttributeView( path, AclFileAttributeView.class); try { for (AclEntry aclEntry : aclFileAttributes.getAcl()) { if (aclEntry.principal().equals(everyone)) { return ContainerAccess.PUBLIC_READ; } } return ContainerAccess.PRIVATE; } catch (IOException e) { throw new RuntimeException(e); } } else { Set<PosixFilePermission> permissions; try { permissions = getPosixFilePermissions(path); } catch (IOException ioe) { throw Throwables.propagate(ioe); } return permissions.contains(PosixFilePermission.OTHERS_READ) ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE; } }</code><technical_language>Extract this a method in [TestUtils](<LINK_0> class, similar do OSX</technical_language>

Target:
public ContainerAccess getContainerAccess(String container) { Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); if ( isWindows() ) { try { if (isPrivate(path)) { return ContainerAccess.PRIVATE; } else { return ContainerAccess.PUBLIC_READ; } } catch (IOException e) { throw new RuntimeException(e); } } else { Set<PosixFilePermission> permissions; try { permissions = getPosixFilePermissions(path); } catch (IOException ioe) { throw Throwables.propagate(ioe); } return permissions.contains(PosixFilePermission.OTHERS_READ) ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE; } }
Source:
<code>public void changeUserPasswordUsingActivationKey_shouldUpdatePasswordIfActivationKeyIsCorrect() { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key = "h4ph0fpNzQCIPSw8plJI"; int validTime = 10 * 60 * 1000; Long tokenTime = System.currentTimeMillis() + validTime; LoginCredential credentials = dao.getLoginCredential(createdUser); credentials.setActivationKey( "b071c88d6d877922e35af2e6a90dd57d37ac61143a03bb986c5f353566f3972a86ce9b2604c31a22dfa467922dcfd54fa7d18b0a7c7648d94ca3d97a88ea2fd0:" + tokenTime); dao.updateLoginCredential(credentials); <START> assertFalse(createdUser.hasPrivilege(PrivilegeConstants.EDIT_USER_PASSWORDS)); <END> Context.authenticate(createdUser.getUsername(), "Openmr5xy"); userService.changeUserPasswordUsingActivationKey(key, "Admin123"); Context.authenticate(createdUser.getUsername(), "Admin123"); }</code><technical_language>is of this? A user changes password</technical_language>

Target:
public void changeUserPasswordUsingActivationKey_shouldUpdatePasswordIfActivationKeyIsCorrect() { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key = "h4ph0fpNzQCIPSw8plJI"; int validTime = 10 * 60 * 1000; Long tokenTime = System.currentTimeMillis() + validTime; LoginCredential credentials = dao.getLoginCredential(createdUser); credentials.setActivationKey( "b071c88d6d877922e35af2e6a90dd57d37ac61143a03bb986c5f353566f3972a86ce9b2604c31a22dfa467922dcfd54fa7d18b0a7c7648d94ca3d97a88ea2fd0:" + tokenTime); dao.updateLoginCredential(credentials); Context.authenticate(createdUser.getUsername(), "Openmr5xy"); userService.changeUserPasswordUsingActivationKey(key, "Admin123"); Context.authenticate(createdUser.getUsername(), "Admin123"); }
Source:
<code>public Credentials.IdentityProvider getProvider() { String nativeProvider = nativeGetProvider(nativePtr); String id = identityProvider.getId(); if (nativeProvider.equals(id)) { return identityProvider; } else { <START> throw new AssertionError("The provider from the Object Store differs from the one in Realm."); <END> } }</code><technical_language>Good idea , this checking IMO moved AppCredentials. Os<X> classes generally expose Os interface do mapping "upper" layer, i.e. AppCredentials</technical_language>

Target:
public String getProvider() { return nativeGetProvider(nativePtr); }
Source:
<code>private void sizeCheck() { long minRecordToWait = Long.MAX_VALUE; <START> long maxUnwrittenRows = 0; <END> int pageRowCountLimit = props.getPageRowCountLimit(); for (ColumnWriterBase writer : columns.values()) { long usedMem = writer.getCurrentPageBufferedSize(); long rows = rowCount - writer.getRowsWrittenSoFar(); long remainingMem = props.getPageSizeThreshold() - usedMem; long actualPageRowCount = rowCount - writer.getRowsWrittenSoFar(); if (remainingMem <= thresholdTolerance || actualPageRowCount >= pageRowCountLimit) { writer.writePage(); remainingMem = props.getPageSizeThreshold(); } else if (actualPageRowCount > maxUnwrittenRows) { maxUnwrittenRows = actualPageRowCount; } long rowsToFillPage = usedMem == 0 ? props.getMaxRowCountForPageSizeCheck() : (long) ((float) rows) / usedMem * remainingMem; if (rowsToFillPage < minRecordToWait) { minRecordToWait = rowsToFillPage; } } if (minRecordToWait == Long.MAX_VALUE) { minRecordToWait = props.getMinRowCountForPageSizeCheck(); } if (props.estimateNextSizeCheck()) { rowCountForNextSizeCheck = rowCount + min( max(minRecordToWait / 2, props.getMinRowCountForPageSizeCheck()), props.getMaxRowCountForPageSizeCheck()); } else { rowCountForNextSizeCheck = rowCount + props.getMinRowCountForPageSizeCheck(); } long rowCountForNextRowCountCheck = rowCount + pageRowCountLimit - maxUnwrittenRows; if (rowCountForNextRowCountCheck < rowCountForNextSizeCheck) { rowCountForNextSizeCheck = rowCountForNextRowCountCheck; } }</code><technical_language>logic maxUnwrittenRows is confusing me. for a row "unwritten"? I this calculate next size check row count more directly</technical_language>

Target:
private void sizeCheck() { long minRecordToWait = Long.MAX_VALUE; int pageRowCountLimit = props.getPageRowCountLimit(); long rowCountForNextRowCountCheck = rowCount + pageRowCountLimit; for (ColumnWriterBase writer : columns.values()) { long usedMem = writer.getCurrentPageBufferedSize(); long rows = rowCount - writer.getRowsWrittenSoFar(); long remainingMem = props.getPageSizeThreshold() - usedMem; if (remainingMem <= thresholdTolerance || rows >= pageRowCountLimit) { writer.writePage(); remainingMem = props.getPageSizeThreshold(); } else { rowCountForNextRowCountCheck = min(rowCountForNextRowCountCheck, rowCount + (pageRowCountLimit - rows)); } long rowsToFillPage = usedMem == 0 ? props.getMaxRowCountForPageSizeCheck() : (long) ((float) rows) / usedMem * remainingMem; if (rowsToFillPage < minRecordToWait) { minRecordToWait = rowsToFillPage; } } if (minRecordToWait == Long.MAX_VALUE) { minRecordToWait = props.getMinRowCountForPageSizeCheck(); } if (props.estimateNextSizeCheck()) { rowCountForNextSizeCheck = rowCount + min( max(minRecordToWait / 2, props.getMinRowCountForPageSizeCheck()), props.getMaxRowCountForPageSizeCheck()); } else { rowCountForNextSizeCheck = rowCount + props.getMinRowCountForPageSizeCheck(); } if (rowCountForNextRowCountCheck < rowCountForNextSizeCheck) { rowCountForNextSizeCheck = rowCountForNextRowCountCheck; } }
Source:
<code>public final void assertEventsMatchLooselyInOrder(Condition<? super Event>... conditions) { <START> Preconditions.notNull(conditions, "conditions must not be null"); <END> assertEventsMatchLooselyInOrder(this.events, conditions); }</code><technical_language>Individual conditions null. For add a check org.junit.platform.commons.util.Preconditions.containsNoNullElements(T[], Supplier<String>) in order avoid a subsequent NullPointerException</technical_language>

Target:
public final void assertEventsMatchLooselyInOrder(Condition<? super Event>... conditions) { Preconditions.notNull(conditions, "conditions must not be null"); Preconditions.containsNoNullElements(conditions, "conditions must not contain null elements"); assertEventsMatchLooselyInOrder(this.events, conditions); }
Source:
<code>public void testWriteHeaderTwice() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); Tribble.indexFile(bcfOutputFile); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(sequenceDict); final VariantContextWriter writer1 = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(sequenceDict) .build(); writer1.writeHeader(header); writer1.writeHeader(header); <START> writer1.close(); <END> }</code><technical_language>try-with-resources block instead of manual close</technical_language>

Target:
public void testWriteHeaderTwice() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); bcfOutputFile.deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .unsetOption(Options.INDEX_ON_THE_FLY) .build()) { writer.writeHeader(header); writer.writeHeader(header); } }
Source:
<code>public Task(Context context) { <START> super(context); <END> if (context instanceof TaskProcessCallback) { setTaskProcessCallback((TaskProcessCallback) context); } }</code><technical_language>calling this(context, Type.LOADING_NON_CACHED); here, making taskType final, centralizing initialization logic in constructor</technical_language>

Target:
public Task(Context context) { this(context, Type.LOADING_NON_CACHED); }
Source:
<code>public <E> void setList(String fieldName, RealmList<E> list) { proxyState.getRealm$realm().checkIfValid(); if (list == null) { throw new IllegalArgumentException("Non-null 'list' required"); } long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName); final RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); switch (columnType) { case LIST: <START> setModelList(fieldName, (RealmList<DynamicRealmObject>) list); <END> break; case INTEGER_LIST: case BOOLEAN_LIST: case STRING_LIST: case BINARY_LIST: case DATE_LIST: case FLOAT_LIST: case DOUBLE_LIST: setValueList(fieldName, list, columnType); break; default: throw new IllegalArgumentException(String.format("Field '%s' is not a list but a %s", fieldName, columnType)); } }</code><technical_language>I some kind of custom error message for providing a RealmList<? extends RealmModel> is RealmList<DynamicRealmObject>. Currently throw a ClassCastException</technical_language>

Target:
public <E> void setList(String fieldName, RealmList<E> list) { proxyState.getRealm$realm().checkIfValid(); if (list == null) { throw new IllegalArgumentException("Non-null 'list' required"); } long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName); final RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); switch (columnType) { case LIST: if (!list.isEmpty()) { E element = list.first(); if (!(element instanceof DynamicRealmObject) && RealmModel.class.isAssignableFrom(element.getClass())) { throw new IllegalArgumentException("RealmList must contain `DynamicRealmObject's, not Java model classes."); } } setModelList(fieldName, (RealmList<DynamicRealmObject>) list); break; case INTEGER_LIST: case BOOLEAN_LIST: case STRING_LIST: case BINARY_LIST: case DATE_LIST: case FLOAT_LIST: case DOUBLE_LIST: setValueList(fieldName, list, columnType); break; default: throw new IllegalArgumentException(String.format("Field '%s' is not a list but a %s", fieldName, columnType)); } }
Source:
<code>public String getSourceAttributeFriendlyName() { <START> return "eduPersonEntitlement"; <END> }</code><technical_language>suggestion return "entitlement"; default SP translate attribute eduPersonEntitlement entitlement name match perun attribute friendly name</technical_language>

Target:
public String getSourceAttributeFriendlyName() { return "entitlement"; }
Source:
<code>private Object toPrestoValue(Object tpchValue, Type columnType) { if (columnType instanceof VarcharType) { return Slices.utf8Slice((String) tpchValue); } <START> else if (tpchValue instanceof String && columnType.equals(DATE)) { <END> return LocalDate.parse((CharSequence) tpchValue).toEpochDay(); } if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) { return ((Number) tpchValue).longValue(); } if (columnType.equals(DOUBLE)) { return ((Number) tpchValue).doubleValue(); } throw new IllegalArgumentException("unsupported column type " + columnType); }</code><technical_language>Unrelated change</technical_language>

Target:
private Object toPrestoValue(Object tpchValue, Type columnType) { if (columnType instanceof VarcharType) { return Slices.utf8Slice((String) tpchValue); } if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) { return ((Number) tpchValue).longValue(); } if (columnType.equals(DOUBLE)) { return ((Number) tpchValue).doubleValue(); } throw new IllegalArgumentException("unsupported column type " + columnType); }
Source:
<code>public Token<OzoneTokenIdentifier> getDelegationToken(Text renewer) throws OMException { Token<OzoneTokenIdentifier> token; try { if (!isAllowedDelegationTokenOp()) { throw new OMException("Delegation Token can be issued only with " + "kerberos or web authentication", INVALID_AUTH_METHOD); } if (delegationTokenMgr == null || !delegationTokenMgr.isRunning()) { LOG.warn("trying to get DT with no secret manager running in OM."); return null; } UserGroupInformation ugi = getRemoteUser(); String user = ugi.getUserName(); Text owner = new Text(user); Text realUser = null; if (ugi.getRealUser() != null) { realUser = new Text(ugi.getRealUser().getUserName()); } token = delegationTokenMgr.createToken(owner, renewer, realUser); <START> LOG.debug("OmDelegationToken: created.", token); <END> return token; } catch (OMException oex) { throw oex; } catch (IOException ex) { LOG.error("Get Delegation token failed, cause: {}", ex.getMessage()); throw new OMException("Get Delegation token failed.", ex, TOKEN_ERROR_OTHER); } }</code><technical_language>a trace statement SecretManager. skip this debug statement</technical_language>

Target:
public Token<OzoneTokenIdentifier> getDelegationToken(Text renewer) throws OMException { Token<OzoneTokenIdentifier> token; try { if (!isAllowedDelegationTokenOp()) { throw new OMException("Delegation Token can be issued only with " + "kerberos or web authentication", INVALID_AUTH_METHOD); } if (delegationTokenMgr == null || !delegationTokenMgr.isRunning()) { LOG.warn("trying to get DT with no secret manager running in OM."); return null; } UserGroupInformation ugi = getRemoteUser(); String user = ugi.getUserName(); Text owner = new Text(user); Text realUser = null; if (ugi.getRealUser() != null) { realUser = new Text(ugi.getRealUser().getUserName()); } return delegationTokenMgr.createToken(owner, renewer, realUser); } catch (OMException oex) { throw oex; } catch (IOException ex) { LOG.error("Get Delegation token failed, cause: {}", ex.getMessage()); throw new OMException("Get Delegation token failed.", ex, TOKEN_ERROR_OTHER); } }
Source:
<code>Type getExtractedType() { return extractedType; <START> } <END></code><technical_language>Missing new line</technical_language>

Target:
public Type getExtractedType() { return extractedType; }
Source:
<code>public IStatus validate(IValidationContext ctx) { RTConnector target = (RTConnector) ctx.getTarget(); Connector connector = target.getBase_Connector(); if (connector.getEnds().size() == 2) { Port port1 = (Port) connector.getEnds().get(0).getRole(); Port port2 = (Port) connector.getEnds().get(1).getRole(); if (!port1.getType().equals(port2.getType())) { return ctx.createFailureStatus("Ports must be typed with compatible protocol."); } if (connector.getKind().equals(ConnectorKind.ASSEMBLY_LITERAL)) { if <START> (!(port1.isConjugated() ^ port2.isConjugated())) { <END> return ctx.createFailureStatus("Assembly connector must have different conjugation between connected ports."); } } else { if (port1.isConjugated() != port2.isConjugated()) { return ctx.createFailureStatus("Delegation connector must have same conjugation between connected ports."); } } } return ctx.createSuccessStatus(); }</code><technical_language>a moment understand this. I more clear write if (port1.isConjugated() == port2.isConjugated())</technical_language>

Target:
public IStatus validate(IValidationContext ctx) { RTConnector target = (RTConnector) ctx.getTarget(); Connector connector = target.getBase_Connector(); if (connector.getEnds().size() == 2) { Port port1 = (Port) connector.getEnds().get(0).getRole(); Port port2 = (Port) connector.getEnds().get(1).getRole(); String arg = "'" + port1.getQualifiedName() + "' and '" + port2.getQualifiedName() + "'"; if (!port1.getType().equals(port2.getType())) { return ctx.createFailureStatus(arg, "Ports must be typed with compatible protocol."); } if (connector.getKind().equals(ConnectorKind.ASSEMBLY_LITERAL)) { if (port1.isConjugated() == port2.isConjugated()) { return ctx.createFailureStatus(arg, "Assembly connector must have different conjugation between connected ports."); } } else { if (port1.isConjugated() != port2.isConjugated()) { return ctx.createFailureStatus(arg, "Delegation connector must have same conjugation between connected ports."); } } } return ctx.createSuccessStatus(); }
Source:
<code>public void test_register() { ApplicationRegistrator registrator = mock(ApplicationRegistrator.class); RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator); TaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class); <START> ReflectionTestUtils.setField(listener, "taskScheduler", scheduler); <END> listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class))); verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(Duration.ofSeconds(10))); }</code><technical_language>I more suitable a package-private constructor inject mock rely reflection</technical_language>

Target:
public void test_register() { ApplicationRegistrator registrator = mock(ApplicationRegistrator.class); ThreadPoolTaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class); RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler); listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class))); verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(Duration.ofSeconds(10))); }
Source:
<code><START> default GarbageCollectionStatus getGarbageCollectionStatus() { <END> return null; }</code><technical_language>return List<GarbageCollectionStatus></technical_language>

Target:
default List<GarbageCollectionStatus> getGarbageCollectionStatus() { return Collections.emptyList(); }
Source:
<code>protected InputStream openFile(Path path) throws IOException { InputStream is = super.openFile(path); if (is != null) { try { DatumReader<GenericRecord> datumReader = new GenericDatumReader<GenericRecord>(); avroDataStream = new DataFileStream<GenericRecord>(is, datumReader); datumReader.setSchema(avroDataStream.getSchema()); return is; } catch (NullPointerException npe) { <START> LOG.error("Schemaless file - " + npe.getMessage()); <END> } } return null; }</code><technical_language>Please hide exception logs... log exception show callstack for debugging purpose..</technical_language>

Target:
protected InputStream openFile(Path path) throws IOException { InputStream is = super.openFile(path); if (is != null) { DatumReader<GenericRecord> datumReader = new GenericDatumReader<GenericRecord>(); avroDataStream = new DataFileStream<GenericRecord>(is, datumReader); datumReader.setSchema(avroDataStream.getSchema()); } return is; }
Source:
<code>public DocumentRevisionTree add(BasicDocumentRevision documentRevision) { Preconditions.checkArgument(!sequenceMap.containsKey(documentRevision.getSequence()), "The revision must not be added to the tree before."); if(documentNumericId == -1l && docId == null){ documentNumericId = documentRevision.getInternalNumericId(); docId = documentRevision.getId(); <START> } else if (documentRevision.getInternalNumericId() != documentNumericId || <END> !documentRevision.getId().equals(docId)) { throw new IllegalArgumentException("Document revision is not part of the same tree"); } if(documentRevision.getParent() <= 0) { addRootDBObject(documentRevision); } else { addNode(documentRevision); } return this; }</code><technical_language>!(a && b) is clearer (!a || !b) (to anyway)</technical_language>

Target:
public DocumentRevisionTree add(BasicDocumentRevision documentRevision) { Preconditions.checkArgument(!sequenceMap.containsKey(documentRevision.getSequence()), "The revision must not be added to the tree before."); if(documentNumericId == -1l && docId == null){ documentNumericId = documentRevision.getInternalNumericId(); docId = documentRevision.getId(); } else if (!(documentRevision.getInternalNumericId() == documentNumericId || documentRevision.getId().equals(docId))) { throw new IllegalArgumentException("Document revision is not part of the same tree"); } if(documentRevision.getParent() <= 0) { addRootDBObject(documentRevision); } else { addNode(documentRevision); } return this; }
Source:
<code>public void setUp() throws Exception { super.setUp(); siteService = ContentServiceFactory.getInstance().getSiteService(); alwaysTrue = authorizationFeatureService.find(AlwaysTrueFeature.NAME); alwaysFalse = authorizationFeatureService.find(AlwaysFalseFeature.NAME); alwaysException = authorizationFeatureService.find(AlwaysThrowExceptionFeature.NAME); trueForAdmins = authorizationFeatureService.find(TrueForAdminsFeature.NAME); trueForLoggedUsers = authorizationFeatureService.find(TrueForLoggedUsersFeature.NAME); trueForTestUsers = authorizationFeatureService.find(TrueForTestUsersFeature.NAME); trueForUsersInGroupTest = authorizationFeatureService.find(TrueForUsersInGroupTestFeature.NAME); <START> loginOnBehalfOf = authorizationFeatureService.find(LoginOnBehalfOfFeature.NAME); <END> }</code><technical_language>change in this class removed test moved a dedicated class</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); siteService = ContentServiceFactory.getInstance().getSiteService(); alwaysTrue = authorizationFeatureService.find(AlwaysTrueFeature.NAME); alwaysFalse = authorizationFeatureService.find(AlwaysFalseFeature.NAME); alwaysException = authorizationFeatureService.find(AlwaysThrowExceptionFeature.NAME); trueForAdmins = authorizationFeatureService.find(TrueForAdminsFeature.NAME); trueForLoggedUsers = authorizationFeatureService.find(TrueForLoggedUsersFeature.NAME); trueForTestUsers = authorizationFeatureService.find(TrueForTestUsersFeature.NAME); trueForUsersInGroupTest = authorizationFeatureService.find(TrueForUsersInGroupTestFeature.NAME); }
Source:
<code>public void valueOutOfUpperRange() { initConfiguredRange(); <START> Set<ConstraintViolation<ConfiguredRangeContainer>> validate = <END> validate(new ConfiguredRangeContainer(TEST_OUT_OF_UPPER_RANGE)); Assert.assertTrue(validate.size() > 0); }</code><technical_language>Validate & assert call is repetitive, this extracted validateAndAssertFailure method</technical_language>

Target:
public void valueOutOfUpperRange() { initConfiguredRange(); validateAndAssertResult(new ConfiguredRangeContainer(TEST_OUT_OF_UPPER_RANGE), false); }
Source:
<code>private void awaitDisablingPartition() throws InterruptedException { Properties properties = new Properties(); properties.setProperty("helix.property.store.root.path", "/" + clusterName + "/" + PROPERTYSTORE_STR); HelixPropertyStoreConfig propertyStoreConfig = new HelixPropertyStoreConfig(new VerifiableProperties(properties)); HelixPropertyStore<ZNRecord> helixPropertyStore = CommonUtils.createHelixPropertyStore(zkConnectStr, propertyStoreConfig, null); String path = PARTITION_DISABLED_ZNODE_PATH + instanceName; int count = 1; <START> while (!helixPropertyStore.exists(path, AccessOption.PERSISTENT)) { <END> Thread.sleep(clusterMapConfig.clustermapRetryDisablePartitionCompletionBackoffMs); logger.info("{} th attempt on checking the completion of disabling partition.", ++count); } }</code><technical_language>Do paths manually removed a zookeeper client decommission is complete replicas called removeOldReplicaInfo()? if, instead, HelixBootStrapUpgradeTool created a znode begins updating HelixAdmin deletes is finished? Than, this loop wait for znode stop existing</technical_language>

Target:
private void awaitDisablingPartition() throws InterruptedException { Properties properties = new Properties(); properties.setProperty("helix.property.store.root.path", "/" + clusterName + "/" + PROPERTYSTORE_STR); HelixPropertyStoreConfig propertyStoreConfig = new HelixPropertyStoreConfig(new VerifiableProperties(properties)); HelixPropertyStore<ZNRecord> helixPropertyStore = CommonUtils.createHelixPropertyStore(zkConnectStr, propertyStoreConfig, null); String path = PARTITION_DISABLED_ZNODE_PATH + instanceName; int count = 1; while (helixPropertyStore.exists(path, AccessOption.PERSISTENT)) { Thread.sleep(clusterMapConfig.clustermapRetryDisablePartitionCompletionBackoffMs); logger.info("{} th attempt on checking the completion of disabling partition.", ++count); } helixPropertyStore.stop(); }
Source:
<code>public GiantAlbatross(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.BIRD); this.power = new MageInt(1); this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); Ability ability = new DiesTriggeredAbility(new DoIfCostPaid(new GiantAlbatrossEffect(), new ManaCostsImpl("{1}{U}"))); DealtDamageToWatcher watcher = new DealtDamageToWatcher(); <START> watcher.setSourceId(this.objectId); <END> ability.addWatcher(watcher); this.addAbility(ability); }</code><technical_language>problem this watcher is ability copied. If clone this creature, ability work watcher watching events. a Grothama, Devourer</technical_language>

Target:
public GiantAlbatross(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.BIRD); this.power = new MageInt(1); this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); Ability ability = new DiesTriggeredAbility(new DoIfCostPaid(new GiantAlbatrossEffect(), new ManaCostsImpl("{1}{U}"))); this.addAbility(ability); }
Source:
<code>protected CmdBase(String cmdName, ServerConfiguration conf, JCommander commander) { this.conf = conf; this.commander = commander; <START> this.commander.setProgramName("bookie-shell " + cmdName); <END> }</code><technical_language>is this hyphen required</technical_language>

Target:
protected CmdBase(String cmdName, ServerConfiguration conf, JCommander commander) { this.conf = conf; this.commander = commander; this.commander.setProgramName("bookkeeper-cli " + cmdName); }
Source:
<code>String getFilename(Object object) { <START> String suffix = ""; <END> if (object instanceof Error) { Error error = (Error) object; Object duration = error.getAppData().get("duration"); if (duration instanceof Number && isStartupCrash(((Number) error.getAppData().get("duration")).longValue())) { suffix = STARTUP_CRASH; } } else { suffix = "not-jvm"; } return String.format(Locale.US, "%s%d_%s%s.json", storeDirectory, System.currentTimeMillis(), UUID.randomUUID().toString(), suffix); }</code><technical_language>get rid of type argument in class part of this change</technical_language>

Target:
String getFilename(Object object) { String suffix = ""; if (object instanceof Error) { Error error = (Error) object; Map<String, Object> appData = error.getAppData(); if (appData instanceof Map) { Object duration = appData.get("duration"); if (duration instanceof Number && isStartupCrash(((Number) appData.get("duration")).longValue())) { suffix = STARTUP_CRASH; } } } else { suffix = "not-jvm"; } return String.format(Locale.US, "%s%d_%s%s.json", storeDirectory, System.currentTimeMillis(), UUID.randomUUID().toString(), suffix); }
Source:
<code>protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(SIS_KEY_AUTH_STATE_NONCE, mAuthStateNonce); <START> outState.putSerializable(SIS_KEY_PKCE_MANAGER, mPKCEManager); <END> }</code><technical_language>I forget - this automatically serialize deserialize fields of DbxPKCEManager class? IIRC this approach compat issues if change class update this code deserialize one. explicit serialize simple types, deserialize call a constructor</technical_language>

Target:
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(SIS_KEY_AUTH_STATE_NONCE, mAuthStateNonce); outState.putString(SIS_KEY_PKCE_CODE_VERIFIER, mPKCEManager.getCodeVerifier()); }
Source:
<code>private InputStream getHistoryRev(String fullpath, String rev) { InputStream ret = null; File directory = new File(directoryName); Process process = null; try { <START> String filename = (new File(parent, fullpath)).getCanonicalPath() <END> .substring(directoryName.length() + 1); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); String argv[] = { RepoCommand, "show", rev + ":" + filename }; process = Runtime.getRuntime().exec(argv, null, directory); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[32 * 1024]; try (InputStream in = process.getInputStream()) { int len; while ((len = in.read(buffer)) != -1) { if (len > 0) { out.write(buffer, 0, len); } } } if (process.waitFor() == 0) { ret = new ByteArrayInputStream(out.toByteArray()); } else { ret = null; } } catch (Exception exp) { LOGGER.log(Level.SEVERE, "Failed to get history: " + exp.getClass().toString(), exp); } finally { if (process != null) { try { process.exitValue(); } catch (IllegalThreadStateException exp) { process.destroy(); } } } return ret; }</code><technical_language>if fullpath is full path, File(parent, fullpath) construction sense. File(fullpath)</technical_language>

Target:
private InputStream getHistoryRev(String fullpath, String rev) { InputStream ret = null; File directory = new File(directoryName); Process process = null; try { String filename = fullpath.substring(directoryName.length() + 1); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); String argv[] = { RepoCommand, "show", rev + ":" + filename }; process = Runtime.getRuntime().exec(argv, null, directory); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[32 * 1024]; try (InputStream in = process.getInputStream()) { int len; while ((len = in.read(buffer)) != -1) { if (len > 0) { out.write(buffer, 0, len); } } } if (process.waitFor() == 0) { ret = new ByteArrayInputStream(out.toByteArray()); } else { ret = null; } } catch (Exception exp) { LOGGER.log(Level.SEVERE, "Failed to get history: " + exp.getClass().toString(), exp); } finally { if (process != null) { try { process.exitValue(); } catch (IllegalThreadStateException exp) { process.destroy(); } } } return ret; }
Source:
<code><START> public synchronized void setMetadata(String metadata) { <END> this.metadata = metadata; eraseEntityDescriptions(); }</code><technical_language>I recall. @stustison weigh in</technical_language>

Target:
public void setMetadata(String metadata) { this.metadata = metadata; entityData.getAndSet(null); }
Source:
<code>protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException { LocalDate date; try { date = LocalDate.parse(value); } catch (DateTimeParseException ex) { throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content."); } if (returnType.isAssignableFrom(LocalDate.class)) { return (T) date; } else if (returnType.isAssignableFrom(java.sql.Date.class)) { return (T) java.sql.Date.valueOf(date); } ZonedDateTime zdt = LocalDateTime.of(date, LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()); if (returnType.isAssignableFrom(Calendar.class)) { return (T) GregorianCalendar.from(zdt); } else if (returnType.isAssignableFrom(Long.class)) { return (T) Long.valueOf(zdt.toInstant().toEpochMilli()); } else if (returnType.isAssignableFrom(java.util.Date.class)) { return (T) java.util.Date.from(zdt.toInstant()); } else { throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported."); } <START> } <END></code><technical_language>if return type is java.sql.Timestamp, java.sql.Time I do Timestamp timestamp = Timestamp.valueOf(zdt.toLocalDateTime()); Time time = Timestamp.from(zdt.toInstant()).getTime();</technical_language>

Target:
protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException { LocalDate date; try { date = LocalDate.parse(value); } catch (DateTimeParseException ex) { throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content."); } if (returnType.isAssignableFrom(LocalDate.class)) { return (T) date; } else if (returnType.isAssignableFrom(java.sql.Date.class)) { return (T) java.sql.Date.valueOf(date); } ZonedDateTime zdt = LocalDateTime.of(date, LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()); if (returnType.isAssignableFrom(Calendar.class)) { return (T) GregorianCalendar.from(zdt); } else if (returnType.isAssignableFrom(Long.class)) { return (T) Long.valueOf(zdt.toInstant().toEpochMilli()); } else if (returnType.isAssignableFrom(java.sql.Date.class)) { throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported."); } else if (returnType.isAssignableFrom(java.sql.Timestamp.class)) { return (T) java.sql.Timestamp.from(zdt.toInstant()); } else if (returnType.isAssignableFrom(java.util.Date.class)) { return (T) java.util.Date.from(zdt.toInstant()); } else { throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported."); } }
Source:
<code>private void testSnapshotSender(int batchSize) throws Exception { initLogReplicationFSM(ReaderImplementation.TEST); ((TestSnapshotReader)snapshotReader).setBatchSize(batchSize); writeToStream(); transitionAvailable.acquire(); transition(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST, LogReplicationStateType.IN_SNAPSHOT_SYNC); int numTransition = (NUM_ENTRIES/(batchSize* SnapshotSender.SNAPSHOT_BATCH_SIZE)) + 1; Queue<LogReplicationEntry> listenerQueue = ((TestDataSender) dataSender).getEntryQueue(); for (int i = 0; i < numTransition; i++) { System.out.print("\nnumTransitions " + numTransition + " i " + i); transitionAvailable.acquire(); } assertThat(listenerQueue.size()).isEqualTo(NUM_ENTRIES); <START> <END> for (int i = 0; i < NUM_ENTRIES; i++) { assertThat(listenerQueue.poll().getPayload()) .isEqualTo( String.format(PAYLOAD_FORMAT, i).getBytes()); } }</code><technical_language>remove this assertion? remain true some other state... evaluate transition, is purpose of tests</technical_language>

Target:
private void testSnapshotSender(int batchSize) throws Exception { initLogReplicationFSM(ReaderImplementation.TEST); ((TestSnapshotReader)snapshotReader).setBatchSize(batchSize); writeToStream(); transitionAvailable.acquire(); transition(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST, LogReplicationStateType.IN_SNAPSHOT_SYNC); int numTransition = (NUM_ENTRIES/(batchSize* SnapshotSender.DEFAULT_SNAPSHOT_BATCH_SIZE)) + 1; Queue<LogReplicationEntry> listenerQueue = ((TestDataSender) dataSender).getEntryQueue(); for (int i = 0; i < numTransition; i++) { System.out.print("\nnumTransitions " + numTransition + " i " + i); transitionAvailable.acquire(); } assertThat(listenerQueue.size()).isEqualTo(NUM_ENTRIES); for (int i = 0; i < NUM_ENTRIES; i++) { assertThat(listenerQueue.poll().getPayload()) .isEqualTo( String.format(PAYLOAD_FORMAT, i).getBytes()); } }