auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void setUp() { <END> mHandlerThread.start(); mMessenger = new Messenger(new Handler(mHandlerThread.getLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_TEST_STARTED: onTestStarted(); break; case MSG_TEST_ENDED_CLEAN: onTestEnded(false); break; default: super.handleMessage(msg); } } }); }</code><technical_language>setUp() call super.setUp();</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); mHandlerThread.start(); mMessenger = new Messenger(new Handler(mHandlerThread.getLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_TEST_STARTED: onTestStarted(); break; case MSG_TEST_ENDED_CLEAN: onTestEnded(false); break; default: super.handleMessage(msg); } } }); }
Source:
<code>private void addDefaultSetOfFunctionsToReduce() { functionsToReduce.add(SqlKind.AVG); functionsToReduce.add(SqlKind.SUM); functionsToReduce.add(SqlKind.STDDEV_POP); functionsToReduce.add(SqlKind.STDDEV_SAMP); functionsToReduce.add(SqlKind.VAR_POP); functionsToReduce.add(SqlKind.VAR_SAMP); functionsToReduce.add(SqlKind.COVAR_POP); functionsToReduce.add(SqlKind.COVAR_SAMP); functionsToReduce.add(SqlKind.REGR_SXX); <START> functionsToReduce.add(SqlKind.REGR_SYY); <END> }</code><technical_language>I put this a static block, functionsToReduce a static member</technical_language>

Target:
private void addDefaultSetOfFunctionsToReduce() { functionsToReduce.addAll(SqlKind.AVG_AGG_FUNCTIONS); functionsToReduce.addAll(SqlKind.COVAR_AVG_AGG_FUNCTIONS); functionsToReduce.add(SqlKind.SUM); }
Source:
<code>public void onClickToken(View v) { Log.v(TAG, "token button is clicked"); mLoginProgressDialog.show(); mAuthContext.acquireToken(MainActivity.this, Constants.RESOURCE_ID, Constants.CLIENT_ID, Constants.REDIRECT_URL, Constants.USER_HINT, new AuthenticationCallback<AuthenticationResult>() { @Override public void onError(Exception exc) { if (mLoginProgressDialog.isShowing()) { mLoginProgressDialog.dismiss(); } Toast.makeText(getApplicationContext(), TAG + "getToken Error:" + exc.getMessage(), Toast.LENGTH_SHORT) .show(); } @Override public void onSuccess(AuthenticationResult result) { if (mLoginProgressDialog.isShowing()) { mLoginProgressDialog.dismiss(); } <START> if (result != null && !result.getAccessToken().isEmpty()) { <END> mResult = result; Toast.makeText(getApplicationContext(), "Token is returned", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Token is NOT returned", Toast.LENGTH_SHORT).show(); } } }); }</code><technical_language>Is this a sample app? If yes, do want developers check result access token for null? Technically library reliable enough return valid result in OnSuccess callback</technical_language>

Target:
public void onClickToken(View v) { Log.v(TAG, "token button is clicked"); mLoginProgressDialog.show(); mAuthContext.acquireToken(MainActivity.this, Constants.RESOURCE_ID, Constants.CLIENT_ID, Constants.REDIRECT_URL, Constants.USER_HINT, new AuthenticationCallback<AuthenticationResult>() { @Override public void onError(Exception exc) { if (mLoginProgressDialog.isShowing()) { mLoginProgressDialog.dismiss(); } Toast.makeText(getApplicationContext(), TAG + "getToken Error:" + exc.getMessage(), Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(AuthenticationResult result) { if (mLoginProgressDialog.isShowing()) { mLoginProgressDialog.dismiss(); } mResult = result; Toast.makeText(getApplicationContext(), "Token is returned", Toast.LENGTH_SHORT) .show(); } }); }
Source:
<code>private void createAssignment() { ResourceAssignment newAssignment = myMutator.addAssignment(myHumanResource); newAssignment.setLoad(100); boolean coord = false; <START> if (myAssignments.isEmpty()) <END> coord = true; newAssignment.setCoordinator(coord); newAssignment.setRoleForAssignment(newAssignment.getResource().getRole()); myAssignments.add(newAssignment); }</code><technical_language>I sense add logic coordinator field here. matter is is corrdinator depends order of adding resources, and, case in table, effect</technical_language>

Target:
private void createAssignment() { ResourceAssignmentMutator mutator = myTask.getAssignmentCollection().createMutator(); ResourceAssignment newAssignment = mutator.addAssignment(myHumanResource); newAssignment.setLoad(100); newAssignment.setRoleForAssignment(newAssignment.getResource().getRole()); mutator.commit(); }
Source:
<code>protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), messageType); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_CORE, "An unknown error occurred", e); } <START> this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), messageType); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_CORE, "An unknown error occurred", e); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build(); this.webServiceResponseMessageSender.send(responseMessage); }
Source:
<code>private void initData(Style fullyLoadedStyle, @NonNull FeatureCollection featureCollection) { routeCoordinateList = ((LineString) featureCollection.features().get(0).geometry()).coordinates(); <START> if (mapboxMap != null) { <END> initSources(fullyLoadedStyle, featureCollection); initSymbolLayer(fullyLoadedStyle); initDotLinePath(fullyLoadedStyle); animate(); } }</code><technical_language>NIT: this check is redundant</technical_language>

Target:
private void initData(Style fullyLoadedStyle, @NonNull FeatureCollection featureCollection) { routeCoordinateList = ((LineString) featureCollection.features().get(0).geometry()).coordinates(); initSources(fullyLoadedStyle, featureCollection); initSymbolLayer(fullyLoadedStyle); initDotLinePath(fullyLoadedStyle); animate(); }
Source:
<code>public QueryStringEncoder(String uri, Charset charset) { uriBuilder = new StringBuilder(uri); <START> this.charset = charset; <END> }</code><technical_language>please add a null check well: java this.charset = ObjectUtil.checkNonNull(charset, "charset"));</technical_language>

Target:
public QueryStringEncoder(String uri, Charset charset) { ObjectUtil.checkNotNull(charset, "charset"); uriBuilder = new StringBuilder(uri); this.charset = CharsetUtil.UTF_8.equals(charset) ? null : charset; }
Source:
<code>public void testScripts() throws Exception { <START> EventService service; <END> URL url = EventListenerTest.class.getClassLoader().getResource("test-listeners.xml"); deployTestContrib("org.nuxeo.ecm.core.event", url); applyInlineDeployments(); service = Framework.getService(EventService.class); assertEquals(0, SCRIPT_CNT); service.fireEvent("test", new EventContextImpl(null, null)); assertEquals(1, SCRIPT_CNT); removeInlineDeployments(); service = Framework.getService(EventService.class); assertEquals(1, SCRIPT_CNT); service.fireEvent("test", new EventContextImpl(null, null)); assertEquals(1, SCRIPT_CNT); deployTestContrib("org.nuxeo.ecm.core.event", url); applyInlineDeployments(); service = Framework.getService(EventService.class); service.fireEvent("test1", new EventContextImpl(null, null)); assertEquals(2, SCRIPT_CNT); service.fireEvent("some-event", new EventContextImpl(null, null)); assertEquals(2, SCRIPT_CNT); }</code><technical_language>Remove tab</technical_language>

Target:
public void testScripts() throws Exception { EventService service; pushInlineDeployments("org.nuxeo.ecm.core.event:test-listeners.xml"); service = Framework.getService(EventService.class); assertEquals(0, SCRIPT_CNT); service.fireEvent("test", new EventContextImpl(null, null)); assertEquals(1, SCRIPT_CNT); removeInlineDeployments(); service = Framework.getService(EventService.class); assertEquals(1, SCRIPT_CNT); service.fireEvent("test", new EventContextImpl(null, null)); assertEquals(1, SCRIPT_CNT); pushInlineDeployments("org.nuxeo.ecm.core.event:test-listeners.xml"); service = Framework.getService(EventService.class); service.fireEvent("test1", new EventContextImpl(null, null)); assertEquals(2, SCRIPT_CNT); service.fireEvent("some-event", new EventContextImpl(null, null)); assertEquals(2, SCRIPT_CNT); }
Source:
<code>public Object exec(Tuple input) throws IOException { <START> if (input.size() == 0) <END> { throw new RuntimeException("Expected at least one parameter"); } for (Object o : input) { if (o != null) { return o; } } return null; }</code><technical_language>I be: java if (input == null || input.size() == 0) return null;</technical_language>

Target:
public Object exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } for (Object o : input) { if (o != null) { return o; } } return null; }
Source:
<code>private void fillContactDataFromCursor(Cursor cursor, ArrayList<Recipient> recipients, HashMap<String, Recipient> recipientMap) { cursor.moveToFirst(); <START> while (!cursor.isAfterLast()) { <END> String name = cursor.getString(INDEX_NAME); String email = cursor.getString(INDEX_EMAIL); long contactId = cursor.getLong(INDEX_CONTACT_ID); if (recipientMap.containsKey(email)) { cursor.moveToNext(); continue; } Uri photoUri = cursor.isNull(INDEX_PHOTO_URI) ? null : Uri.parse(cursor.getString(INDEX_PHOTO_URI)); Recipient recipient = new Recipient(name, email, contactId); recipient.photoThumbnailUri = photoUri; recipientMap.put(email, recipient); recipients.add(recipient); cursor.moveToNext(); } cursor.close(); }</code><technical_language>written shorter while (cursor.moveToNext()) { }</technical_language>

Target:
private void fillContactDataFromCursor(Cursor cursor, ArrayList<Recipient> recipients, HashMap<String, Recipient> recipientMap) { while (cursor.moveToNext()) { String name = cursor.getString(INDEX_NAME); String email = cursor.getString(INDEX_EMAIL); long contactId = cursor.getLong(INDEX_CONTACT_ID); String lookupKey = cursor.getString(INDEX_LOOKUP_KEY); if (recipientMap.containsKey(email)) { continue; } int addressType = cursor.getInt(INDEX_EMAIL_TYPE); String addressLabel = null; switch (addressType) { case ContactsContract.CommonDataKinds.Email.TYPE_HOME: addressLabel = getContext().getString(R.string.address_type_home); break; case ContactsContract.CommonDataKinds.Email.TYPE_WORK: addressLabel = getContext().getString(R.string.address_type_work); break; case ContactsContract.CommonDataKinds.Email.TYPE_OTHER: addressLabel = getContext().getString(R.string.address_type_other); break; case ContactsContract.CommonDataKinds.Email.TYPE_MOBILE: addressLabel = getContext().getString(R.string.address_type_mobile); break; case ContactsContract.CommonDataKinds.Email.TYPE_CUSTOM: addressLabel = cursor.getString(INDEX_EMAIL_CUSTOM_LABEL); break; } Uri photoUri = cursor.isNull(INDEX_PHOTO_URI) ? null : Uri.parse(cursor.getString(INDEX_PHOTO_URI)); Recipient recipient = new Recipient(name, email, addressLabel, contactId, lookupKey); recipient.photoThumbnailUri = photoUri; recipientMap.put(email, recipient); recipients.add(recipient); } cursor.close(); }
Source:
<code>protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } if <START> (!validate(VmHandler.validateMaxMemorySize(getVmTemplate(), getEffectiveCompatibilityVersion()))) <END> { return false; } return validateAfterCloneVm(domainsMap); }</code><technical_language>vm</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } VmHandler.updateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } if (!validate(VmHandler.validateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()))) { return false; } return validateAfterCloneVm(domainsMap); }
Source:
<code>private static long getRecordRange(String query) throws SQLException { long rowCount = 0; Connection dbConnection = null; PreparedStatement preparedStatement = null; try { dbConnection = getDBConnection(); preparedStatement = dbConnection.prepareStatement(query); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { <START> rowCount = Long.parseLong(rs.getString("RowCount")); <END> LOG.info("# Rows - " + rowCount); } } catch (SQLException e) { LOG.error("Exception in retreiving result set", e); } finally { if (preparedStatement != null) { preparedStatement.close(); } if (dbConnection != null) { dbConnection.close(); } } return rowCount; }</code><technical_language>Suggest index instead of a column alias. this is a simple count utility. rename "getTupleCount()"</technical_language>

Target:
private static long getRecordRange(String query) throws SQLException { long rowCount = 0; Connection dbConnection = null; PreparedStatement preparedStatement = null; try { dbConnection = getDBConnection(); preparedStatement = dbConnection.prepareStatement(query); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { rowCount = Long.parseLong(rs.getString(1)); LOG.debug("# Rows - " + rowCount); } } catch (SQLException e) { LOG.error("Exception in retreiving result set", e); throw new RuntimeException(e); } finally { if (preparedStatement != null) { preparedStatement.close(); } if (dbConnection != null) { dbConnection.close(); } } return rowCount; }
Source:
<code>public Serializable parseDate(Serializable value) { if (value == null) { return null; } if (value instanceof Date) { return ((Date) value).toInstant().toString(); } if (value instanceof Long) { return Instant.ofEpochMilli((Long) value); } if (!(value instanceof String)) { return null; } <START> if (StringUtils.isEmpty(value)) { <END> return null; } String string = String.valueOf(value); SimpleDateFormat dateFormat; if (boonDefault.matcher(string).matches()) { dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy"); } else if (iso8601.matcher(string).matches()) { dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT); } else { dateFormat = new SimpleDateFormat(); } dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return dateFormat.parse(value.toString()); } catch (ParseException e) { throw new IllegalArgumentException(e); } }</code><technical_language>nit: combine this check check 584. style though, some prefer more explicit. Approved way. if (!(value instanceof String) || StringUtils.isEmpty(value)) { return null; }</technical_language>

Target:
public Serializable parseDate(Serializable value) { if (value == null) { return null; } if (value instanceof Date) { return ((Date) value).toInstant().toString(); } if (value instanceof Long) { return Instant.ofEpochMilli((Long) value); } if (!(value instanceof String)) { return null; } if (StringUtils.isEmpty((String) value)) { return null; } String string = String.valueOf(value); SimpleDateFormat dateFormat; if (boonDefault.matcher(string).matches()) { dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy"); } else if (iso8601.matcher(string).matches()) { dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT); } else { dateFormat = new SimpleDateFormat(); } dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return dateFormat.parse(value.toString()); } catch (ParseException e) { throw new IllegalArgumentException(e); } }
Source:
<code>void encode(final ByteBuf out) { final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); <START> checkState(out.readerIndex() == out.writerIndex()); <END> final int start = out.writerIndex(); out.writeIntLE(expectedLength); this.frame.encode(out); this.headers.encode(out); checkState(out.writerIndex() - start == expectedLength, "encoding error: {\"expectedLength\": %s, \"observedLength\": %s}", expectedLength, out.writerIndex() - expectedLength); if (this.payload.length > 0) { out.writeIntLE(this.payload.length); out.writeBytes(this.payload); } }</code><technical_language>Suggestion: unrelated changes pushed separate iteration</technical_language>

Target:
void encode(final ByteBuf out) { final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); final int start = out.writerIndex(); out.writeIntLE(expectedLength); this.frame.encode(out); this.headers.encode(out); checkState(out.writerIndex() - start == expectedLength, "encoding error: {\"expectedLength\": %s, \"observedLength\": %s}", expectedLength, out.writerIndex() - expectedLength); if (this.payload.length > 0) { out.writeIntLE(this.payload.length); out.writeBytes(this.payload); } }
Source:
<code>public void handleFlush(Object input) { TreeNodeCompareInput treeNodeCompareInput = (TreeNodeCompareInput)input; EObject eobject = treeNodeCompareInput.getComparisonObject(); Comparison comparison; if (eobject instanceof Match) { comparison = ((Match)eobject).getComparison(); } else if (eobject instanceof Diff) { comparison = ((Diff)eobject).getMatch().getComparison(); } else if (eobject instanceof MatchResource) { comparison = ((MatchResource)eobject).getComparison(); } else { return; } boolean unresolved = false; EList<Conflict> conflicts = comparison.getConflicts(); <START> outer: for (Conflict conflict : conflicts) { <END> if (conflict.getKind() != ConflictKind.PSEUDO) { for (Diff diff : conflict.getDifferences()) { if (diff.getState() == DifferenceState.UNRESOLVED) { unresolved = true; break outer; } } } } if (!unresolved) { mergeResolutionListenerRegistry.mergeResolutionCompleted(comparison); } return; }</code><technical_language>please avoid goto structures. This expressed guava : Predicate<Conflict> unresolvedConflict = new Predicate<Conflict>() { public boolean apply(Conflict conflict) { return conflict != null && conflict.getKind() != ConflictKind.PSEUDO && Iterables.any(conflict.getDifferences(), EMFComparePredicates .hasState(DifferenceState.UNRESOLVED)); } }; if (Iterables.any(comparison.getConflicts(), unresolvedConflict)) { mergeResolutionListenerRegistry.mergeResolutionCompleted(comparison); }</technical_language>

Target:
public void handleFlush(Object input) { TreeNodeCompareInput treeNodeCompareInput = (TreeNodeCompareInput)input; EObject eobject = treeNodeCompareInput.getComparisonObject(); Comparison comparison; if (eobject instanceof Match) { comparison = ((Match)eobject).getComparison(); } else if (eobject instanceof Diff) { comparison = ((Diff)eobject).getMatch().getComparison(); } else if (eobject instanceof MatchResource) { comparison = ((MatchResource)eobject).getComparison(); } else { return; } Predicate<Conflict> unresolvedConflict = new Predicate<Conflict>() { public boolean apply(Conflict conflict) { return conflict != null && conflict.getKind() != ConflictKind.PSEUDO && Iterables.any(conflict.getDifferences(), EMFComparePredicates .hasState(DifferenceState.UNRESOLVED)); } }; if (Iterables.any(comparison.getConflicts(), unresolvedConflict)) { mergeResolutionListenerRegistry.mergeResolutionCompleted(comparison); } }
Source:
<code>private ArrayList<GenericColumnSerializer> setupMetricsWriters( final SegmentWriteOutMedium segmentWriteOutMedium, final List<String> mergedMetrics, final Map<String, ValueType> metricsValueTypes, final Map<String, String> metricTypeNames, final IndexSpec indexSpec ) throws IOException { ArrayList<GenericColumnSerializer> metWriters = Lists.newArrayListWithCapacity(mergedMetrics.size()); final CompressionStrategy metCompression = indexSpec.getMetricCompression(); final CompressionFactory.LongEncodingStrategy longEncoding = indexSpec.getLongEncoding(); for (String metric : mergedMetrics) { ValueType type = metricsValueTypes.get(metric); GenericColumnSerializer writer; switch (type) { case LONG: <START> writer = createLongColumnSerializer(segmentWriteOutMedium, metric, metCompression, longEncoding, indexSpec); <END> break; case FLOAT: writer = createFloatColumnSerializer(segmentWriteOutMedium, metric, metCompression, indexSpec); break; case DOUBLE: writer = createDoubleColumnSerializer(segmentWriteOutMedium, metric, metCompression, indexSpec); break; case COMPLEX: final String typeName = metricTypeNames.get(metric); ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(typeName); if (serde == null) { throw new ISE("Unknown type[%s]", typeName); } writer = serde.getSerializer(segmentWriteOutMedium, metric); break; default: throw new ISE("Unknown type[%s]", type); } writer.open(); metWriters.add(writer); } return metWriters; }</code><technical_language>nit: metCompression longEncoding indexSpec, shrink parameter list grabbing indexSpec in create*ColumnSerializer methods</technical_language>

Target:
private ArrayList<GenericColumnSerializer> setupMetricsWriters( final SegmentWriteOutMedium segmentWriteOutMedium, final List<String> mergedMetrics, final Map<String, ValueType> metricsValueTypes, final Map<String, String> metricTypeNames, final IndexSpec indexSpec ) throws IOException { ArrayList<GenericColumnSerializer> metWriters = Lists.newArrayListWithCapacity(mergedMetrics.size()); for (String metric : mergedMetrics) { ValueType type = metricsValueTypes.get(metric); GenericColumnSerializer writer; switch (type) { case LONG: writer = createLongColumnSerializer(segmentWriteOutMedium, metric, indexSpec); break; case FLOAT: writer = createFloatColumnSerializer(segmentWriteOutMedium, metric, indexSpec); break; case DOUBLE: writer = createDoubleColumnSerializer(segmentWriteOutMedium, metric, indexSpec); break; case COMPLEX: final String typeName = metricTypeNames.get(metric); ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(typeName); if (serde == null) { throw new ISE("Unknown type[%s]", typeName); } writer = serde.getSerializer(segmentWriteOutMedium, metric); break; default: throw new ISE("Unknown type[%s]", type); } writer.open(); metWriters.add(writer); } return metWriters; }
Source:
<code>public static void initializeRankSystems() { final String METHOD_NAME = "initializeRankSystems()"; rankSystems = new Hashtable<>(); MekHQ.getLogger().log(Ranks.class, METHOD_NAME, LogLevel.INFO, "Starting load of Rank Systems from XML..."); Document xmlDoc = null; try { <START> InputStream is = new FileInputStream("data/universe/ranks.xml"); <END> DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); is.close(); } catch (Exception ex) { MekHQ.getLogger().error(Ranks.class, METHOD_NAME, ex); } Element ranksEle = xmlDoc.getDocumentElement(); NodeList nl = ranksEle.getChildNodes(); ranksEle.normalize(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); Ranks value; if (wn.getParentNode() != ranksEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("rankSystem")) { value = generateInstanceFromXML(wn, null); rankSystems.put(value.getRankSystem(), value); } } } MekHQ.getLogger().log(Ranks.class, METHOD_NAME, LogLevel.INFO, "Done loading Rank Systems"); }</code><technical_language>try-with-resources</technical_language>

Target:
public static void initializeRankSystems() { final String METHOD_NAME = "initializeRankSystems()"; rankSystems = new Hashtable<>(); MekHQ.getLogger().log(Ranks.class, METHOD_NAME, LogLevel.INFO, "Starting load of Rank Systems from XML..."); Document xmlDoc = null; try (InputStream is = new FileInputStream("data/universe/ranks.xml")) { DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); } catch (Exception ex) { MekHQ.getLogger().error(Ranks.class, METHOD_NAME, ex); } Element ranksEle = xmlDoc.getDocumentElement(); NodeList nl = ranksEle.getChildNodes(); ranksEle.normalize(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); Ranks value; if (wn.getParentNode() != ranksEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("rankSystem")) { value = generateInstanceFromXML(wn, null); rankSystems.put(value.getRankSystem(), value); } } } MekHQ.getLogger().log(Ranks.class, METHOD_NAME, LogLevel.INFO, "Done loading Rank Systems"); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExecutionOptions that = (JdbcExecutionOptions) o; return batchIntervalMs == that.batchIntervalMs && batchSize == that.batchSize && maxRetries == that.maxRetries && <START> parallelism == that.parallelism; <END> }</code><technical_language>return false parallelism > 128</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExecutionOptions that = (JdbcExecutionOptions) o; return batchIntervalMs == that.batchIntervalMs && batchSize == that.batchSize && maxRetries == that.maxRetries; }
Source:
<code>public Worker createWorker() { final Worker actualWorker = actualScheduler.createWorker(); <START> ReplaySubject<ScheduledAction> actionSubject = ReplaySubject.create(); <END> final Observer<ScheduledAction> actionObserver = new SerializedObserver<ScheduledAction>(actionSubject); Flowable<Completable> actions = actionSubject.toFlowable(BackpressureStrategy.BUFFER).map(new Function<ScheduledAction, Completable>() { @Override public Completable apply(final ScheduledAction action) { return Completable.unsafeCreate(new CompletableSource() { @Override public void subscribe(CompletableObserver actionCompletable) { actionCompletable.onSubscribe(action); action.call(actualWorker, actionCompletable); } }); } }); Worker worker = new Worker() { private final AtomicBoolean unsubscribed = new AtomicBoolean(); @Override public void dispose() { if (unsubscribed.compareAndSet(false, true)) { actualWorker.dispose(); actionObserver.onComplete(); } } @Override public boolean isDisposed() { return unsubscribed.get(); } @Override public Disposable schedule(final Runnable action, final long delayTime, final TimeUnit unit) { DelayedAction delayedAction = new DelayedAction(action, delayTime, unit); actionObserver.onNext(delayedAction); return delayedAction; } @Override public Disposable schedule(final Runnable action) { ImmediateAction immediateAction = new ImmediateAction(action); actionObserver.onNext(immediateAction); return immediateAction; } }; workerObserver.onNext(actions); return worker; }</code><technical_language>a ReplayProcessor instead</technical_language>

Target:
public Worker createWorker() { final Worker actualWorker = actualScheduler.createWorker(); final FlowableProcessor<ScheduledAction> actionProcessor = UnicastProcessor.<ScheduledAction>create().toSerialized(); Flowable<Completable> actions = actionProcessor.map(new Function<ScheduledAction, Completable>() { @Override public Completable apply(final ScheduledAction action) { return new Completable() { @Override protected void subscribeActual(CompletableObserver actionCompletable) { actionCompletable.onSubscribe(action); action.call(actualWorker, actionCompletable); } }; } }); Worker worker = new Worker() { private final AtomicBoolean unsubscribed = new AtomicBoolean(); @Override public void dispose() { if (unsubscribed.compareAndSet(false, true)) { actualWorker.dispose(); actionProcessor.onComplete(); } } @Override public boolean isDisposed() { return unsubscribed.get(); } @Override public Disposable schedule(final Runnable action, final long delayTime, final TimeUnit unit) { DelayedAction delayedAction = new DelayedAction(action, delayTime, unit); actionProcessor.onNext(delayedAction); return delayedAction; } @Override public Disposable schedule(final Runnable action) { ImmediateAction immediateAction = new ImmediateAction(action); actionProcessor.onNext(immediateAction); return immediateAction; } }; workerProcessor.onNext(actions); return worker; }
Source:
<code>public Filter getFilter() { return new Pac4jFilter( name, authorizerName, <START> createPac4jConfig(oidcConfig), <END> oidcConfig.getCookiePassphrase().getPassword() ); }</code><technical_language>create a pack4jConfig getFilter() is called? cache</technical_language>

Target:
public Filter getFilter() { return new Pac4jFilter( name, authorizerName, pac4jConfigSupplier.get(), oidcConfig.getCookiePassphrase().getPassword() ); }
Source:
<code>public static ColumnValueSelector makeColumnValueSelector( ColumnSelectorFactory columnSelectorFactory, Expr expression ) { final ColumnValueSelector<ExprEval> baseSelector = makeExprEvalSelector(columnSelectorFactory, expression); return new ColumnValueSelector() { @Override public double getDouble() { return baseSelector.getDouble(); } @Override public float getFloat() { return baseSelector.getFloat(); } @Override public long getLong() { return baseSelector.getLong(); } @Override public boolean isNull() { return baseSelector.isNull(); } @Nullable @Override public Object getObject() { ExprEval eval = baseSelector.getObject(); if (eval.isArray()) { <START> return Arrays.stream(eval.asArray()).map(String::valueOf).collect(Collectors.toList()); <END> } return eval.value(); } @Override public Class classOfObject() { return Object.class; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } }; }</code><technical_language>Do allow null numbers in lists? If so, this'll turn "null" keeping null. right behavior</technical_language>

Target:
public static ColumnValueSelector makeColumnValueSelector( ColumnSelectorFactory columnSelectorFactory, Expr expression ) { final ColumnValueSelector<ExprEval> baseSelector = makeExprEvalSelector(columnSelectorFactory, expression); return new ColumnValueSelector() { @Override public double getDouble() { return baseSelector.getDouble(); } @Override public float getFloat() { return baseSelector.getFloat(); } @Override public long getLong() { return baseSelector.getLong(); } @Override public boolean isNull() { return baseSelector.isNull(); } @Nullable @Override public Object getObject() { ExprEval eval = baseSelector.getObject(); if (eval.isArray()) { return Arrays.stream(eval.asStringArray()) .map(NullHandling::emptyToNullIfNeeded) .collect(Collectors.toList()); } return eval.value(); } @Override public Class classOfObject() { return Object.class; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } }; }
Source:
<code><START> public List<Expression> rewrite(List<Expression> items, Context<C> context) <END> { ImmutableList.Builder<Expression> builder = ImmutableList.builder(); for (Expression expression : items) { builder.add(rewrite(expression, context.get())); } return builder.build(); }</code><technical_language>This private</technical_language>

Target:
private List<Expression> rewrite(List<Expression> items, Context<C> context) { ImmutableList.Builder<Expression> builder = ImmutableList.builder(); for (Expression expression : items) { builder.add(rewrite(expression, context.get())); } return builder.build(); }
Source:
<code><START> public void doesNotGoBackwardsEvenIfSweepTimestampRegressesWithinBucket() { <END> enqueueWrite(TABLE_CONS, LOW_TS); enqueueWrite(TABLE_CONS, LOW_TS2); enqueueWrite(TABLE_CONS, LOW_TS3); runConservativeSweepAtTimestamp(LOW_TS2 + 5); assertReadAtTimestampReturnsSentinel(TABLE_CONS, LOW_TS2); assertTestValueEnqueuedAtGivenTimestampStillPresent(TABLE_CONS, LOW_TS2); verify(spiedKvs, times(1)).deleteAllTimestamps(any(TableReference.class), anyMap()); runConservativeSweepAtTimestamp(LOW_TS2 - 5); verify(spiedKvs, times(1)).deleteAllTimestamps(any(TableReference.class), anyMap()); }</code><technical_language>Added a check progress is expected</technical_language>

Target:
public void doesNotGoBackwardsEvenIfSweepTimestampRegressesWithinBucket() { enqueueWrite(TABLE_CONS, LOW_TS); enqueueWrite(TABLE_CONS, LOW_TS2); enqueueWrite(TABLE_CONS, LOW_TS3); runConservativeSweepAtTimestamp(LOW_TS2 + 5); assertReadAtTimestampReturnsSentinel(TABLE_CONS, LOW_TS2); assertTestValueEnqueuedAtGivenTimestampStillPresent(TABLE_CONS, LOW_TS2); verify(spiedKvs, times(1)).deleteAllTimestamps(any(TableReference.class), anyMap()); assertProgressUpdatedToTimestamp(LOW_TS2 + 5 - 1); runConservativeSweepAtTimestamp(LOW_TS2 - 5); verify(spiedKvs, times(1)).deleteAllTimestamps(any(TableReference.class), anyMap()); assertProgressUpdatedToTimestamp(LOW_TS2 + 5 - 1); }
Source:
<code><START> public CuratorZookeeperClient(URL url) { <END> this(url, null); }</code><technical_language>I this this(url,new HashSet<>()); better. do say</technical_language>

Target:
public CuratorZookeeperClient(URL url) { super(url); try { int timeout = url.getParameter(Constants.TIMEOUT_KEY, 5000); CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(url.getBackupAddress()) .retryPolicy(new RetryNTimes(1, 1000)) .connectionTimeoutMs(timeout); String authority = url.getAuthority(); if (authority != null && authority.length() > 0) { builder = builder.authorization("digest", authority.getBytes()); } client = builder.build(); client.getConnectionStateListenable().addListener(new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework client, ConnectionState state) { if (state == ConnectionState.LOST) { CuratorZookeeperClient.this.stateChanged(StateListener.DISCONNECTED); } else if (state == ConnectionState.CONNECTED) { CuratorZookeeperClient.this.stateChanged(StateListener.CONNECTED); } else if (state == ConnectionState.RECONNECTED) { CuratorZookeeperClient.this.stateChanged(StateListener.RECONNECTED); } } }); client.start(); } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
Source:
<code>public void notifyChanged(Notification notification) { if <START> ((notification.getFeatureID(Property.class) <END> == UMLPackage.PORT__IS_CONJUGATED)) { refreshDisplay(); } else { super.notifyChanged(notification); Object object = notification.getNotifier(); Property property = getUMLElement(); if ((object != null) && (property != null)) { if (notification.getFeature() == UMLPackage.Literals.OPAQUE_EXPRESSION__BODY) { refreshDisplay(); } } } }</code><technical_language>This API is reliable notifier is a priori of 'expectedClass' type. check notification.getFeature() == UMLPackage.Literals.PORT__IS_CONJUGATED getFeatureID API is employed for notifiers Objects, Resources ResourceSets</technical_language>

Target:
public void notifyChanged(Notification notification) { if (notification.getFeature() == UMLPackage.Literals.PORT__IS_CONJUGATED) { refreshDisplay(); } else { super.notifyChanged(notification); Object object = notification.getNotifier(); Property property = getUMLElement(); if ((object != null) && (property != null)) { if (notification.getFeature() == UMLPackage.Literals.OPAQUE_EXPRESSION__BODY) { refreshDisplay(); } } } }
Source:
<code>public void close() { <START> taskContainerMappingMetadataStore.close(); <END> }</code><technical_language>I close other store well</technical_language>

Target:
public void close() { taskContainerMappingMetadataStore.close(); taskModeMappingMetadataStore.close(); }
Source:
<code>public void encodeToStream(final ShuffleControlMessage msg, final DataOutputStream stream) { try { if (msg.getShuffleName() == null) { stream.writeUTF(""); } else { stream.writeUTF(msg.getShuffleName()); } stream.writeInt(msg.getCode()); stream.writeInt(msg.size()); <START> final int messageLength = msg.size(); <END> for (int i = 0; i < messageLength; i++) { final byte[] data = msg.get(i); stream.writeInt(data.length); stream.write(data); } } catch(final IOException exception) { throw new RuntimeException(exception); } }</code><technical_language>calling msg.size() twice, easily rearrange code call once</technical_language>

Target:
public void encodeToStream(final ShuffleControlMessage msg, final DataOutputStream stream) { try { if (msg.getShuffleName() == null) { stream.writeUTF(""); } else { stream.writeUTF(msg.getShuffleName()); } stream.writeInt(msg.getCode()); final int messageLength = msg.size(); stream.writeInt(messageLength); for (int i = 0; i < messageLength; i++) { final String endPointId = msg.get(i); stream.writeUTF(endPointId); } } catch (final IOException exception) { throw new RuntimeException(exception); } }
Source:
<code>public void printAsJava(PrintWriter pw) { try { appendAsJava(value, pw, typeName, true, RexDigestIncludeType.NO_TYPE); } catch (IOException e) { <START> throw new IllegalStateException("IOException should not be raised with PrintWriter", e); <END> } }</code><technical_language>UncheckedIOException</technical_language>

Target:
public void printAsJava(PrintWriter pw) { appendAsJava(value, pw, typeName, true, RexDigestIncludeType.NO_TYPE); }
Source:
<code>public void shouldEditConceptAttribute() throws Exception { String json = "{ \"attributeType\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_TYPE_UUID +"\" }"; ConceptAttribute conceptAttribute = service.getConceptAttributeByUuid(getUuid()); Assert.assertEquals("Joining Date", conceptAttribute.getAttributeType().getName()); <START> <END> handle(newPostRequest(getURI() + "/" + getUuid(), json)); conceptAttribute = service.getConceptAttributeByUuid(getUuid()); Assert.assertEquals("Joining Date", conceptAttribute.getAttributeType().getName()); }</code><technical_language>edit here</technical_language>

Target:
public void shouldEditConceptAttribute() throws Exception { String json = "{ \"attributeType\":\"" + RestTestConstants2_0.CONCEPT_ATTRIBUTE_TYPE_UUID +"\", \"value\": \"2015-04-12\" }"; ConceptAttribute conceptAttribute = service.getConceptAttributeByUuid(getUuid()); Assert.assertEquals("2011-04-25", conceptAttribute.getValueReference()); handle(newPostRequest(getURI() + "/" + getUuid(), json)); conceptAttribute = service.getConceptAttributeByUuid(getUuid()); Assert.assertEquals("2015-04-12", conceptAttribute.getValueReference()); }
Source:
<code>public EntityView(Context context, Detail d, String[] headerText) { super(context); this.context = context; this.views = new View[headerText.length]; this.mHints = d.getHeaderSizeHints(); String[] headerForms = d.getHeaderForms(); int[] colors = AndroidUtil.getThemeColorIDs(context, new int[]{R.attr.entity_view_header_background_color, R.attr.entity_view_header_text_color}); <START> Log.i("DEBUG-i", "Background color is: " + colors[0] + ", text color is: " + colors[1]); <END> if (colors[0] != -1) { this.setBackgroundColor(colors[0]); } for (int i = 0; i < views.length; ++i) { if (mHints[i] == null || !mHints[i].startsWith("0")) { LayoutParams l = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); ViewId uniqueId = new ViewId(rowId, i, false); views[i] = initView(headerText[i], headerForms[i], uniqueId, null); views[i].setId(i); if (colors[1] != -1) { TextView tv = (TextView) views[i].findViewById(R.id.component_audio_text_txt); if (tv != null) tv.setTextColor(colors[1]); } addView(views[i], l); } } }</code><technical_language>hanging debug</technical_language>

Target:
public EntityView(Context context, Detail d, String[] headerText) { super(context); this.context = context; this.views = new View[headerText.length]; this.mHints = d.getHeaderSizeHints(); String[] headerForms = d.getHeaderForms(); int[] colors = AndroidUtil.getThemeColorIDs(context, new int[]{R.attr.entity_view_header_background_color, R.attr.entity_view_header_text_color}); if (colors[0] != -1) { this.setBackgroundColor(colors[0]); } for (int i = 0; i < views.length; ++i) { if (mHints[i] == null || !mHints[i].startsWith("0")) { LayoutParams l = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); ViewId uniqueId = new ViewId(rowId, i, false); views[i] = initView(headerText[i], headerForms[i], uniqueId, null); views[i].setId(i); if (colors[1] != -1) { TextView tv = (TextView) views[i].findViewById(R.id.component_audio_text_txt); if (tv != null) tv.setTextColor(colors[1]); } addView(views[i], l); } } }
Source:
<code>public static <P extends VdcActionParametersBase> CommandBase<P> createCommand(VdcActionType action, P parameters, CommandContext commandContext) { try { Constructor<CommandBase<? extends VdcActionParametersBase>> commandConstructor = findCommandConstructor(getCommandClass(action.name()), parameters.getClass()); CommandBase<P> command = (CommandBase<P>) commandConstructor.newInstance(parameters); <START> if (commandContext != null) { <END> if (commandContext.getEngineContext().getSessionId() == null) { commandContext.getEngineContext().withSessionId(parameters.getSessionId()); } command.setContext(commandContext); } return Injector.injectMembers(command); } catch (InvocationTargetException ex) { log.error("Error in invocating CTOR of command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } catch (Exception ex) { log.error("An exception has occured while trying to create a command object for command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } }</code><technical_language>prefer here: if (commandContext == null) { // set default context is currently in CommandBase c'tor } else { // do logic describe }</technical_language>

Target:
public static <P extends VdcActionParametersBase> CommandBase<P> createCommand(VdcActionType action, P parameters, CommandContext commandContext) { try { Constructor<CommandBase<? extends VdcActionParametersBase>> commandConstructor = findCommandConstructor(getCommandClass(action.name()), parameters.getClass(), CommandContext.class); if (commandContext == null) { commandContext = new CommandContext(parameters.getSessionId()); } else if (commandContext.getEngineContext().getSessionId() == null) { commandContext.getEngineContext().withSessionId(parameters.getSessionId()); } CommandBase<P> command = (CommandBase<P>) commandConstructor.newInstance(parameters, commandContext); return Injector.injectMembers(command); } catch (InvocationTargetException ex) { log.error("Error in invocating CTOR of command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } catch (Exception ex) { log.error("An exception has occured while trying to create a command object for command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } }
Source:
<code>public void close() { if (closed) { return; } closed = true; <START> block = null; <END> Throwable innerException = null; for (Closer closer : closers) { try { closer.close(); } catch (Throwable t) { if (innerException == null) { innerException = t; } else if (innerException != t) { innerException.addSuppressed(t); } } } if (innerException != null) { throw new RuntimeException(innerException); } }</code><technical_language>This change is problematic. lease block block create multiple leases</technical_language>

Target:
public void close() { if (closed) { return; } closed = true; Throwable innerException = null; for (Closer closer : closers) { try { closer.close(); } catch (Throwable t) { if (innerException == null) { innerException = t; } else if (innerException != t) { innerException.addSuppressed(t); } } } if (innerException != null) { throw new RuntimeException(innerException); } }
Source:
<code>public void innerNext(InnerQueuedSubscriber<R> inner, R value) { <START> if (!inner.queue().offer(value)) { <END> inner.cancel(); innerError(inner, new MissingBackpressureException()); } else { drain(); } }</code><technical_language>nit: reversing if-else. I PMD complains btw</technical_language>

Target:
public void innerNext(InnerQueuedSubscriber<R> inner, R value) { if (inner.queue().offer(value)) { drain(); } else { inner.cancel(); innerError(inner, new MissingBackpressureException()); } }
Source:
<code>public void perform(Value value) { if (value.isEmptyString()) { return; } BigDecimal number = value.getBigDecimal(); if (number == null) { throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.notNumeric") .set(PARAM_VALUE, value.toString()) .format()); } BigDecimal rounded = new BigDecimal(number.unscaledValue(), number.scale()).setScale(scale, RoundingMode.FLOOR); <START> if (number.subtract(rounded).compareTo(BigDecimal.valueOf(0.00001)) > 0) { <END> throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.scaleExceeded") .set(PARAM_VALUE, value.toString()) .set(PARAM_SCALE, scale) .format()); } if (number.compareTo(BigDecimal.valueOf(Math.pow(10, (precision - scale)))) > -1) { throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.precisionExceeded") .set(PARAM_VALUE, value.toString()) .set(PARAM_PRECISION, precision) .format()); } }</code><technical_language>Doubles.EPSILON</technical_language>

Target:
public void perform(Value value) { if (value.isEmptyString()) { return; } BigDecimal number = value.getBigDecimal(); if (number == null) { throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.notNumeric") .set(PARAM_VALUE, value.toString()) .format()); } BigDecimal rounded = new BigDecimal(number.unscaledValue(), number.scale()).setScale(scale, RoundingMode.FLOOR); if (number.subtract(rounded).compareTo(BigDecimal.valueOf(Doubles.EPSILON)) > 0) { throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.scaleExceeded") .set(PARAM_VALUE, value.toString()) .set(PARAM_SCALE, scale) .format()); } if (number.compareTo(BigDecimal.valueOf(Math.pow(10, (precision - scale)))) > -1) { throw new IllegalArgumentException(NLS.fmtr("AmountScaleCheck.errorMsg.precisionExceeded") .set(PARAM_VALUE, value.toString()) .set(PARAM_PRECISION, precision) .format()); } }
Source:
<code>public BrowserWebDriverContainer() { final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); <START> try { <END> vncRecordingDirectory = Files.createTempDirectory(TC_TEMP_DIR_PREFIX).toFile(); } catch (IOException e) { logger().error("Exception while trying to create directory " + vncRecordingDirectory.getAbsolutePath(), e); throw new RuntimeException(e); } this.withRecordingFileFactory(new DefaultRecordingFileFactory()); }</code><technical_language>IMO move configure create dir if recording is enabled</technical_language>

Target:
public BrowserWebDriverContainer() { final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); this.withRecordingFileFactory(new DefaultRecordingFileFactory()); }