auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean removeVertex(final V v) { final Map<V, I> edges = adjacent.remove(v); if (edges != null) { inDegrees.remove(v); for (final Map.Entry<V, I> edge : edges.entrySet()) { final V neighbor = edge.getKey(); final int inDegree = inDegrees.get(neighbor) - 1; <START> inDegrees.put(neighbor, inDegree); <END> if (inDegree == 0) { rootVertices.add(neighbor); } } rootVertices.remove(v); for (Map.Entry<V, ConcurrentMap<V, I>> entry : adjacent.entrySet()) { entry.getValue().remove(v); } return true; } else { LOG.log(Level.WARNING, "The vertex {0} does exists", new Object[]{v}); return false; } }</code><technical_language>code lines race condition</technical_language>

Target:
public boolean removeVertex(final V v) { final Map<V, I> edges = adjacent.remove(v); if (edges != null) { numVertices -= 1; final int inDegreeEdges = inDegrees.remove(v); numEdges -= inDegreeEdges; numEdges -= edges.size(); for (final Map.Entry<V, I> edge : edges.entrySet()) { final V neighbor = edge.getKey(); final int inDegree = inDegrees.get(neighbor) - 1; inDegrees.put(neighbor, inDegree); } for (Map.Entry<V, Map<V, I>> entry : adjacent.entrySet()) { entry.getValue().remove(v); } return true; } else { LOG.log(Level.WARNING, "The vertex {0} does exists", new Object[]{v}); return false; } }
Source:
<code>protected void doStart() throws Exception { super.doStart(); if (this.taskExecutor == null) { this.taskExecutor = new SimpleAsyncTaskExecutor( (getBeanName() == null ? "container" : getBeanName()) + "-"); } Long idleEventInterval = getIdleEventInterval(); if (idleEventInterval != null) { if (this.taskScheduler != null) { afterPropertiesSet(); } this.idleTask = this.taskScheduler.scheduleAtFixedRate(() -> { long now = System.currentTimeMillis(); if (now - getLastReceive() > idleEventInterval && now - this.lastAlertAt > idleEventInterval) { publishIdleContainerEvent(now - getLastReceive()); this.lastAlertAt = now; } <START> }, this.getIdleEventInterval() / 2); <END> } AtomicBoolean initialized = new AtomicBoolean(); this.taskExecutor.execute(() -> { synchronized (this.consumersMonitor) { while (!initialized.get() && isRunning()) { this.cancellationLock.reset(); try { for (String queue : getQueueNames()) { consumeFromQueue(queue); } } catch (Exception e) { this.logger.error("Error creating consumer; retrying in " + DirectMessageListenerContainer.this.recoveryInterval, e); doShutdown(); try { Thread.sleep(DirectMessageListenerContainer.this.recoveryInterval); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } continue; } initialized.set(true); } } }); if (logger.isInfoEnabled()) { this.logger.info("Container initialized for queues: " + Arrays.asList(getQueueNames())); } }</code><technical_language>extracted idleEventInterval variable</technical_language>

Target:
protected void doStart() throws Exception { super.doStart(); if (this.taskExecutor == null) { this.taskExecutor = new SimpleAsyncTaskExecutor( (getBeanName() == null ? "container" : getBeanName()) + "-"); } long idleEventInterval = getIdleEventInterval(); if (idleEventInterval > 0) { if (this.taskScheduler != null) { afterPropertiesSet(); } this.idleTask = this.taskScheduler.scheduleAtFixedRate(() -> { long now = System.currentTimeMillis(); if (now - getLastReceive() > idleEventInterval && now - this.lastAlertAt > idleEventInterval) { publishIdleContainerEvent(now - getLastReceive()); this.lastAlertAt = now; } }, idleEventInterval / 2); } AtomicBoolean initialized = new AtomicBoolean(); this.taskExecutor.execute(() -> { synchronized (this.consumersMonitor) { while (!initialized.get() && isRunning()) { this.cancellationLock.reset(); try { for (String queue : getQueueNames()) { consumeFromQueue(queue); } } catch (Exception e) { this.logger.error("Error creating consumer; retrying in " + DirectMessageListenerContainer.this.recoveryInterval, e); doShutdown(); try { Thread.sleep(DirectMessageListenerContainer.this.recoveryInterval); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } continue; } initialized.set(true); } } }); if (logger.isInfoEnabled()) { this.logger.info("Container initialized for queues: " + Arrays.asList(getQueueNames())); } }
Source:
<code>private void writeVmCustomMetadata() { writer.writeStartElement(OVIRT_VM_URI, "custom"); Map<String, String> <START> vmCutomProperties <END> = VmPropertiesUtils.getInstance().getVMProperties( vm.getCompatibilityVersion(), vm.getStaticData()); vmCutomProperties.entrySet().forEach( property -> writer.writeElement(OVIRT_VM_URI, property.getKey(), property.getValue())); writer.writeEndElement(); }</code><technical_language>Custom</technical_language>

Target:
private void writeVmCustomMetadata() { writer.writeStartElement(OVIRT_VM_URI, "custom"); Map<String, String> vmCustomProperties = VmPropertiesUtils.getInstance().getVMProperties( vm.getCompatibilityVersion(), vm.getStaticData()); vmCustomProperties.entrySet().forEach( property -> writer.writeElement(OVIRT_VM_URI, property.getKey(), property.getValue())); writer.writeEndElement(); }
Source:
<code>public void forceLedger(final BookieSocketAddress addr, final long ledgerId, final ForceLedgerCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.forceLedgerComplete(getRc(BKException.Code.BookieHandleNotAvailableException), <START> ledgerId, addr, null); <END> return; } client.obtain((rc, pcbc) -> { if (rc != BKException.Code.OK) { try { executor.executeOrdered(ledgerId, safeRun(() -> { cb.forceLedgerComplete(rc, ledgerId, addr, ctx); })); } catch (RejectedExecutionException re) { cb.forceLedgerComplete(getRc(BKException.Code.InterruptedException), ledgerId, addr, ctx); } } else { pcbc.forceLedger(ledgerId, cb, ctx); } }, ledgerId); }</code><technical_language>null -> ctx</technical_language>

Target:
public void forceLedger(final BookieSocketAddress addr, final long ledgerId, final ForceLedgerCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.forceLedgerComplete(getRc(BKException.Code.BookieHandleNotAvailableException), ledgerId, addr, ctx); return; } client.obtain((rc, pcbc) -> { if (rc != BKException.Code.OK) { try { executor.executeOrdered(ledgerId, safeRun(() -> { cb.forceLedgerComplete(rc, ledgerId, addr, ctx); })); } catch (RejectedExecutionException re) { cb.forceLedgerComplete(getRc(BKException.Code.InterruptedException), ledgerId, addr, ctx); } } else { pcbc.forceLedger(ledgerId, cb, ctx); } }, ledgerId); }
Source:
<code>public static void setUpClass() throws Exception { repository = new TestRepository(); repository.create( HistoryGuru.class.getResourceAsStream("repositories.zip")); RuntimeEnvironment env = RuntimeEnvironment.getInstance(); <START> env.setHistoryEnabled(true); <END> env.setRepositories(repository.getSourceRoot()); }</code><technical_language>RuntimeEnvironment is shared runs of tests, I noticed a reversion of original settings - e.g. env.setHistoryEnabled(originalIsHistoryEnabled) in @AfterClass. I tests passing if done for correctness</technical_language>

Target:
public static void setUpClass() throws Exception { repository = new TestRepository(); repository.create( HistoryGuru.class.getResourceAsStream("repositories.zip")); RuntimeEnvironment env = RuntimeEnvironment.getInstance(); env.setRepositories(repository.getSourceRoot()); env.setHistoryEnabled(true); }
Source:
<code>public void setUp() throws Exception { storeEntity(EntityType.CLUSTER, "corp", CLUSTER_XML); storeEntity(EntityType.FEED, "clicks", FEED_XML); storeEntity(EntityType.FEED, "impressions", FEED_XML); storeEntity(EntityType.FEED, "clicksummary", FEED_XML); storeEntity(EntityType.PROCESS, "clicksummary", PROCESS_XML); storeEntity(EntityType.PROCESS, "pig-process", PIG_PROCESS_XML); <START> storeEntity(EntityType.PROCESS, "post-process", POST_PROCEES_XML); <END> ConfigurationStore store = ConfigurationStore.get(); cluster = store.get(EntityType.CLUSTER, "corp"); org.apache.falcon.entity.v0.cluster.Property property = new org.apache.falcon.entity.v0.cluster.Property(); property.setName(SecurityUtil.HIVE_METASTORE_KERBEROS_PRINCIPAL); property.setValue("hive/_HOST"); cluster.getProperties().getProperties().add(property); ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl); ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY).setEndpoint("thrift://localhost:49083"); fs = new Path(hdfsUrl).getFileSystem(EmbeddedCluster.newConfiguration()); fs.create(new Path(ClusterHelper.getLocation(cluster, ClusterLocationType.WORKING).getPath(), "libext/PROCESS/ext.jar")).close(); Process process = store.get(EntityType.PROCESS, "clicksummary"); Path wfpath = new Path(process.getWorkflow().getPath()); assert new Path(hdfsUrl).getFileSystem(EmbeddedCluster.newConfiguration()).mkdirs(wfpath); }</code><technical_language>create more process reuse PIG_PROCESS_XML</technical_language>

Target:
public void setUp() throws Exception { storeEntity(EntityType.CLUSTER, "corp", CLUSTER_XML); storeEntity(EntityType.FEED, "clicks", FEED_XML); storeEntity(EntityType.FEED, "impressions", FEED_XML); storeEntity(EntityType.FEED, "clicksummary", FEED_XML); storeEntity(EntityType.PROCESS, "clicksummary", PROCESS_XML); storeEntity(EntityType.PROCESS, "pig-process", PIG_PROCESS_XML); ConfigurationStore store = ConfigurationStore.get(); cluster = store.get(EntityType.CLUSTER, "corp"); org.apache.falcon.entity.v0.cluster.Property property = new org.apache.falcon.entity.v0.cluster.Property(); property.setName(SecurityUtil.HIVE_METASTORE_KERBEROS_PRINCIPAL); property.setValue("hive/_HOST"); cluster.getProperties().getProperties().add(property); ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl); ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY).setEndpoint("thrift://localhost:49083"); fs = new Path(hdfsUrl).getFileSystem(EmbeddedCluster.newConfiguration()); fs.create(new Path(ClusterHelper.getLocation(cluster, ClusterLocationType.WORKING).getPath(), "libext/PROCESS/ext.jar")).close(); Process process = store.get(EntityType.PROCESS, "clicksummary"); Path wfpath = new Path(process.getWorkflow().getPath()); assert new Path(hdfsUrl).getFileSystem(EmbeddedCluster.newConfiguration()).mkdirs(wfpath); }
Source:
<code>public void saveQuestionAndAdjustQuestionNumbers(FeedbackQuestionAttributes question, boolean isUpdating, <START> int oldQuestionNumber) <END> throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { FeedbackQuestionAttributes fqaSaved = oldQuestionsDb.saveQuestionAndAdjustQuestionNumbers(question, isUpdating, oldQuestionNumber); newQuestionsDb.saveQuestionAndAdjustQuestionNumbers(fqaSaved, isUpdating, oldQuestionNumber); }</code><technical_language>3 parameters line</technical_language>

Target:
public void saveQuestionAndAdjustQuestionNumbers( FeedbackQuestionAttributes question, boolean isUpdating, int oldQuestionNumber) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { FeedbackQuestionAttributes fqaSaved = oldQuestionsDb.saveQuestionAndAdjustQuestionNumbers(question, isUpdating, oldQuestionNumber); try { newQuestionsDb.saveQuestionAndAdjustQuestionNumbers(fqaSaved, isUpdating, oldQuestionNumber); } catch (EntityDoesNotExistException e) { } }
Source:
<code>void handleXaTxnRollbackOnly(final MessageInputStream message, final int invId) throws IOException { int param; int len; SimpleXid xid = null; int secContext = 0; boolean hasSecContext = false; while ((param = message.read()) != - 1) { len = StreamUtils.readPackedUnsignedInt32(message); switch (param) { case P_XID: { xid = readXid(message, len); break; } case P_SEC_CONTEXT: { secContext = readIntParam(message, len); hasSecContext = true; break; } default: { readIntParam(message, len); } } } if (xid == null) { writeParamError(invId); return; } SecurityIdentity securityIdentity = getSecurityIdentity(M_RESP_XA_RB_ONLY, invId, secContext, hasSecContext); if (securityIdentity == null) { return; } securityIdentity.runAsObjIntConsumer((x, i) -> { try { final ImportResult<LocalTransaction> importResult = localTransactionContext.findOrImportTransaction(x, 0, true); if (importResult != null) { <START> importResult.getControl().end(XAResource.TMFAIL); <END> return; } else { Log.log.noAssociatedTransactionsDuringRollbackOnly(x); } writeSimpleResponse(M_RESP_XA_RB_ONLY, i); } catch (XAException e) { writeExceptionResponse(M_RESP_XA_RB_ONLY, i, e); return; } }, xid, invId); }</code><technical_language>is this change identical previous behaviour? In prior code if importResult != null lines importResult.getControl().end(XAResource.TMFAIL); writeSimpleResponse(M_RESP_XA_RB_ONLY, i); executed. line of is executed importResult != null. Is some intention in that</technical_language>

Target:
void handleXaTxnRollbackOnly(final MessageInputStream message, final int invId) throws IOException { int param; int len; SimpleXid xid = null; int secContext = 0; boolean hasSecContext = false; while ((param = message.read()) != - 1) { len = StreamUtils.readPackedUnsignedInt32(message); switch (param) { case P_XID: { xid = readXid(message, len); break; } case P_SEC_CONTEXT: { secContext = readIntParam(message, len); hasSecContext = true; break; } default: { readIntParam(message, len); } } } if (xid == null) { writeParamError(invId); return; } SecurityIdentity securityIdentity = getSecurityIdentity(M_RESP_XA_RB_ONLY, invId, secContext, hasSecContext); if (securityIdentity == null) { return; } securityIdentity.runAsObjIntConsumer((x, i) -> { try { final ImportResult<LocalTransaction> importResult = localTransactionContext.findOrImportTransaction(x, 0, true); if (importResult != null) { importResult.getControl().end(XAResource.TMFAIL); } else { Log.log.debugf("No transaction associated with xid %s during setRollbackOnly execution", x); } writeSimpleResponse(M_RESP_XA_RB_ONLY, i); } catch (XAException e) { writeExceptionResponse(M_RESP_XA_RB_ONLY, i, e); return; } }, xid, invId); }
Source:
<code>private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; if (fExecNamesCache.containsEntry(status, interval)) { processName = fExecNamesCache.get(status).first().getValue(); } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } if (processName instanceof String) { <START> return new TimeGraphState(startTime, duration, status, (String) processName); <END> } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }</code><technical_language>do: interval = fExecNamesCache.get(status, interval), replace condition by: interval != null purpose of comparator implemented is return interval cache overlaps status "current thread" interval, opposed current code returns interval, potentially wrong in case of PID reuse</technical_language>

Target:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; if (fExecNamesCache.containsEntry(status, interval)) { NavigableSet<ITmfStateInterval> intervalSet = fExecNamesCache.get(status); for (ITmfStateInterval i: intervalSet) { if (CACHE_COMPARATOR.compare(i, interval) == 0) { processName = i.getValue(); break; } } } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
<code>public static void register(ScalarFunctionModule module) { module.register(NAME, new BaseFunctionResolver(FUNCTION_PARAMS) { @Override public FunctionImplementation getForTypes(List<DataType> signatureTypes) throws IllegalArgumentException { DataType returnType = null; boolean paramHadTimezone = false; int timestampParamTypeId = signatureTypes.get(1).id(); switch (timestampParamTypeId) { case LongType.ID: case TimestampType.ID_WITHOUT_TZ: returnType = DataTypes.TIMESTAMPZ; break; case TimestampType.ID_WITH_TZ: returnType = DataTypes.TIMESTAMP; paramHadTimezone = true; break; default: throw new IllegalArgumentException(String.format( Locale.ENGLISH, "invalid argument to %s: expected second parameter" + " to be of either type [%s, %s, %s] but found %s", NAME, LongType.INSTANCE.getName(), TimestampType.INSTANCE_WITH_TZ.getName(), TimestampType.INSTANCE_WITHOUT_TZ.getName(), signatureTypes.get(1))); } return new TimezoneFunction(new FunctionInfo(new FunctionIdent(NAME, signatureTypes), returnType), <START> paramHadTimezone); <END> } }); }</code><technical_language>sense infer this based FunctionInfo return type, instead of adding extra parameter</technical_language>

Target:
public static void register(ScalarFunctionModule module) { module.register(NAME, new BaseFunctionResolver(FUNCTION_PARAMS) { @Override public FunctionImplementation getForTypes(List<DataType> signatureTypes) throws IllegalArgumentException { DataType returnType = signatureTypes.get(1).id() == TimestampType.ID_WITH_TZ ? DataTypes.TIMESTAMP : DataTypes.TIMESTAMPZ; return new TimezoneFunction(new FunctionInfo(new FunctionIdent(NAME, signatureTypes), returnType)); } }); }
Source:
<code>private void initiateMocks() { int[] activeSlots = fusionVersion.aliveSlots(); accessors = new IndexAccessor[INSTANCE_COUNT]; Arrays.fill( accessors, IndexAccessor.EMPTY ); aliveAccessors = new IndexAccessor[activeSlots.length]; for ( int i = 0; i < activeSlots.length; i++ ) { IndexAccessor mock = mock( IndexAccessor.class ); aliveAccessors[i] = mock; switch ( activeSlots[i] ) { case STRING: accessors[STRING] = mock; break; case NUMBER: accessors[NUMBER] = mock; break; case SPATIAL: accessors[SPATIAL] = mock; break; case TEMPORAL: accessors[TEMPORAL] = mock; break; case LUCENE: accessors[LUCENE] = mock; break; default: throw new RuntimeException(); } } <START> fusionIndexAccessor = new FusionIndexAccessor( accessors, fusionVersion.selector(), mock( StoreIndexDescriptor.class ), dropAction ); <END> }</code><technical_language>In dropMustDropAll I test correct anymore accessors internal knowledge index id. Please change this mock a real instance indexId equal 0</technical_language>

Target:
private void initiateMocks() { int[] activeSlots = fusionVersion.aliveSlots(); accessors = new IndexAccessor[INSTANCE_COUNT]; Arrays.fill( accessors, IndexAccessor.EMPTY ); aliveAccessors = new IndexAccessor[activeSlots.length]; for ( int i = 0; i < activeSlots.length; i++ ) { IndexAccessor mock = mock( IndexAccessor.class ); aliveAccessors[i] = mock; switch ( activeSlots[i] ) { case STRING: accessors[STRING] = mock; break; case NUMBER: accessors[NUMBER] = mock; break; case SPATIAL: accessors[SPATIAL] = mock; break; case TEMPORAL: accessors[TEMPORAL] = mock; break; case LUCENE: accessors[LUCENE] = mock; break; default: throw new RuntimeException(); } } fusionIndexAccessor = new FusionIndexAccessor( fusionVersion.slotSelector(), new InstanceSelector<>( accessors ), indexDescriptor, dropAction ); }
Source:
<code>public static Locale languageLocale(@Nullable String languageCode) { if (TextUtils.isEmpty(languageCode)) { return Locale.getDefault(); } if (languageCode.contains("_")) { <START> String[] opts = languageCode.split("_"); <END> if (opts.length >= 2) { return new Locale(opts[0], opts[1]); } else { return new Locale(opts[0]); } } return new Locale(languageCode); }</code><technical_language>I this code called times app execution. thoughts a pre-compiled regexp split strings? private static Pattern languageSplitter = Pattern.compile("_"); String[] opts = languageSplitter.split(languageCode, 0); Do this improve performance</technical_language>

Target:
public static Locale languageLocale(@Nullable String languageCode) { if (TextUtils.isEmpty(languageCode)) { return Locale.getDefault(); } String[] opts = languageSplitter.split(languageCode, 0); if (opts.length > 1) { return new Locale(opts[0], opts[1]); } else { return new Locale(opts[0]); } }
Source:
<code>protected void testAccessControl() throws Exception { dataBundle = getTypicalDataBundle(); removeAndRestoreDataBundle(dataBundle); StudentAttributes unregStudent1 = dataBundle.students.get("student1InUnregisteredCourse"); String key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; String[] submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key), Const.ParamsNames.NEXT_URL, "randomUrl" }; verifyUnaccessibleWithoutLogin(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForUnregisteredUsers(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForStudents(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); <START> ______TS("testStudentCourseJoinLegacyLink"); <END> dataBundle = getTypicalDataBundle(); removeAndRestoreDataBundle(dataBundle); unregStudent1 = dataBundle.students.get("student2InUnregisteredCourse"); key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key) }; verifyAccessibleWithoutLogin(submissionParams); verifyAccessibleForUnregisteredUsers(submissionParams); verifyAccessibleForStudents(submissionParams); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }</code><technical_language>I this test case StudentCourseJoinActionTest</technical_language>

Target:
protected void testAccessControl() throws Exception { dataBundle = getTypicalDataBundle(); StudentAttributes unregStudent1 = dataBundle.students.get("student1InUnregisteredCourse"); String key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; String[] submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key), Const.ParamsNames.NEXT_URL, "randomUrl" }; verifyUnaccessibleWithoutLogin(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForUnregisteredUsers(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForStudents(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }
Source:
<code>public Integer call() throws Exception { try (CloseableThriftClient client = pool.getCloseableClient()) { <START> begin.await(); <END> int id = System.identityHashCode(client.getThriftClient()); Thread.sleep(holdClientMs); return id; } }</code><technical_language>this latch is called begin, sense put this statement of call() method, right</technical_language>

Target:
public Integer call() throws Exception { begin.await(); try (CloseableThriftClient client = pool.getCloseableClient()) { int id = System.identityHashCode(client.getThriftClient()); Thread.sleep(holdClientMs); return id; } }
Source:
<code>public Optional<FieldProjectionExpectations<YearMonth>> getFieldProjectionExpectations() { return Optional.of( new FieldProjectionExpectations<>( <START> YearMonth.of( 1980, Month.NOVEMBER ), YearMonth.of( 1984, Month.JANUARY ), YearMonth.of( 1984, Month.NOVEMBER ) <END> ) ); }</code><technical_language>here, too, test a negative year, a future year, ...</technical_language>

Target:
public Optional<FieldProjectionExpectations<YearMonth>> getFieldProjectionExpectations() { return Optional.of( new FieldProjectionExpectations<>( YearMonth.of( -320, Month.NOVEMBER ), YearMonth.of( 1984, Month.JANUARY ), YearMonth.of( 6001, Month.NOVEMBER ) ) ); }
Source:
<code>public void validate() { <START> if (Stream.of(mElements).noneMatch(e -> e.duration > 0)) { <END> throw new IllegalArgumentException("at least one timing must be non-zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> IntStream.of(e.channels) .anyMatch(a -> (a < -1 || a > 255)))) { throw new IllegalArgumentException( "amplitudes must all be DEFAULT_AMPLITUDE or between 0 and 255" + " (elements=" + Arrays.toString(mElements) + ")"); } if (mRepeat < -1 || mRepeat >= mElements.length) { throw new IllegalArgumentException( "repeat index must be within the bounds of the elements array" + " (elements.length=" + mElements.length + ", index=" + mRepeat + ")"); } }</code><technical_language>"!= 0" instead of "> 0"</technical_language>

Target:
public void validate() { if (Stream.of(mElements).noneMatch(e -> e.duration != 0)) { throw new IllegalArgumentException("at least one timing must be non-zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> e.duration < 0)) { throw new IllegalArgumentException("timings must be positive or zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> IntStream.of(e.channels) .anyMatch(a -> (a < -1 || a > 255)))) { throw new IllegalArgumentException( "amplitudes must all be DEFAULT_AMPLITUDE or between 0 and 255" + " (elements=" + Arrays.toString(mElements) + ")"); } if (mRepeat < -1 || mRepeat >= mElements.length) { throw new IllegalArgumentException( "repeat index must be within the bounds of the elements array" + " (elements.length=" + mElements.length + ", index=" + mRepeat + ")"); } }
Source:
<code>protected final IStatus run(IProgressMonitor monitor) { Collection<String> filesToUpdate; Collection<IResource> resourcesToUpdate; synchronized (lock) { filesToUpdate = files; resourcesToUpdate = resources; files = new HashSet<String>(); resources = new HashSet<IResource>(); <START> if (monitor.isCanceled() || filesToUpdate.isEmpty()) { <END> return Status.CANCEL_STATUS; } } return updateIndexDiff(filesToUpdate, resourcesToUpdate, monitor); }</code><technical_language>Small style nit: braces simple statements</technical_language>

Target:
protected final IStatus run(IProgressMonitor monitor) { Collection<String> filesToUpdate; Collection<IResource> resourcesToUpdate; synchronized (lock) { filesToUpdate = files; resourcesToUpdate = resources; files = new HashSet<String>(); resources = new HashSet<IResource>(); if (monitor.isCanceled() || filesToUpdate.isEmpty()) return Status.CANCEL_STATUS; } return updateIndexDiff(filesToUpdate, resourcesToUpdate, monitor); }
Source:
<code>public synchronized Object get(final ByteBuffer buffer, final int position) { <START> return sketches.get(buffer).get(position); <END> }</code><technical_language>Thank for calling out this</technical_language>

Target:
public Object get(final ByteBuffer buffer, final int position) { return sketchCache.get(buffer).get(position); }
Source:
<code>public boolean onMessage(Message<?> message) { String connectionId = (String) message.getHeaders().get(IpHeaders.CONNECTION_ID); if (connectionId == null) { logger.error("Cannot correlate response - no connection id"); return false; } AsyncReply reply = pendingReplies.get(connectionId); if (reply == null) { if (message instanceof ErrorMessage) { if (logger.isDebugEnabled()) { <START> logger.debug("Socket error ignored - no listener for " + connectionId); <END> } return false; } else { logger.error("Cannot correlate response - no pending reply"); return false; } } reply.setReply(message); return false; }</code><technical_language>this message explain a matter? BTW, you, please, explain a bit a reason ignore ErrorMessage? cases equal: TcpInboundGateway, TcpOutboundGateway etc</technical_language>

Target:
public boolean onMessage(Message<?> message) { String connectionId = (String) message.getHeaders().get(IpHeaders.CONNECTION_ID); if (connectionId == null) { logger.error("Cannot correlate response - no connection id"); return false; } AsyncReply reply = pendingReplies.get(connectionId); if (reply == null) { if (message instanceof ErrorMessage) { return false; } else { logger.error("Cannot correlate response - no pending reply"); return false; } } reply.setReply(message); return false; }
Source:
<code>private void loadFromDisk() { synchronized (mLock) { if (mLoaded) { return; } if (mBackupFile.exists()) { mFile.delete(); mBackupFile.renameTo(mFile); } } if (mFile.exists() && !mFile.canRead()) { Log.w(TAG, "Attempt to read preferences file " + mFile + " without permission"); } Map<String, Object> map = null; StructStat stat = null; Throwable thrown = null; <START> try { try { <END> stat = Os.stat(mFile.getPath()); if (mFile.canRead()) { BufferedInputStream str = null; try { str = new BufferedInputStream( new FileInputStream(mFile), 16 * 1024); map = (Map<String, Object>) XmlUtils.readMapXml(str); } catch (Exception e) { Log.w(TAG, "Cannot read " + mFile.getAbsolutePath(), e); } finally { IoUtils.closeQuietly(str); } } } catch (ErrnoException e) { } } catch (Throwable t) { thrown = t; } finally { synchronized (mLock) { mLoaded = true; mThrowable = thrown; if (thrown == null) { if (map != null) { mMap = map; mStatTimestamp = stat.st_mtim; mStatSize = stat.st_size; } else { mMap = new HashMap<>(); } } mLock.notifyAll(); } } }</code><technical_language>JLS, catch clauses considered left right. I fine collapse these</technical_language>

Target:
private void loadFromDisk() { synchronized (mLock) { if (mLoaded) { return; } if (mBackupFile.exists()) { mFile.delete(); mBackupFile.renameTo(mFile); } } if (mFile.exists() && !mFile.canRead()) { Log.w(TAG, "Attempt to read preferences file " + mFile + " without permission"); } Map<String, Object> map = null; StructStat stat = null; Throwable thrown = null; try { stat = Os.stat(mFile.getPath()); if (mFile.canRead()) { BufferedInputStream str = null; try { str = new BufferedInputStream( new FileInputStream(mFile), 16 * 1024); map = (Map<String, Object>) XmlUtils.readMapXml(str); } catch (Exception e) { Log.w(TAG, "Cannot read " + mFile.getAbsolutePath(), e); } finally { IoUtils.closeQuietly(str); } } } catch (ErrnoException e) { } catch (Throwable t) { thrown = t; } synchronized (mLock) { mLoaded = true; mThrowable = thrown; try { if (thrown == null) { if (map != null) { mMap = map; mStatTimestamp = stat.st_mtim; mStatSize = stat.st_size; } else { mMap = new HashMap<>(); } } } catch (Throwable t) { mThrowable = t; } finally { mLock.notifyAll(); } } }
Source:
<code>private void validateModelInfo(MLModelInfo modelInfo) throws SAXException, JAXBException { List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); if (outputFields.isEmpty()) { throw new RuntimeException( <START> String.format("PMML File %s does not support emitting output fields", modelInfo.getUploadedFileName())); <END> } StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params( MLModelInfo.NAME, modelInfo.getName())); }</code><technical_language>empty output</technical_language>

Target:
private void validateModelInfo(MLModelInfo modelInfo) throws SAXException, JAXBException { List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); if (outputFields.isEmpty()) { throw new RuntimeException( String.format("PMML File %s does not support empty output", modelInfo.getUploadedFileName())); } StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params( MLModelInfo.NAME, modelInfo.getName())); }
Source:
<code>static <T> CheckedFunction0<T> decorateCheckedSupplier(AdaptiveBulkhead bulkhead, CheckedFunction0<T> supplier) { return () -> { long start = 0; boolean isFailed=false; bulkhead.acquirePermission(); try { <START> start = Instant.now().toEpochMilli(); <END> return supplier.apply(); } catch (Exception e) { bulkhead.onError( start,TimeUnit.MILLISECONDS, e); isFailed=true; throw e; } finally { if (start != 0 && !isFailed) { bulkhead.onSuccess(start, TimeUnit.MILLISECONDS); } } }; }</code><technical_language>final long start = System.nanoTime();. reduces amount of Instant classes create call improves GC</technical_language>

Target:
static <T> CheckedFunction0<T> decorateCheckedSupplier(AdaptiveBulkhead bulkhead, CheckedFunction0<T> supplier) { return () -> { long start = 0; boolean isFailed=false; bulkhead.acquirePermission(); try { start = System.nanoTime(); return supplier.apply(); } catch (Exception e) { bulkhead.onError(System.nanoTime() - start, TimeUnit.NANOSECONDS, e); isFailed=true; throw e; } finally { if (start != 0 && !isFailed) { bulkhead.onSuccess(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } }; }
Source:
<code>private void updateAvailabilitByDatacenter(StoragePool datacenter) { if (datacenter == null) { return; } <START> getModel().getActivateDomain().setIsAvailable(datacenter.getId() != StorageModel.UnassignedDataCenterId); <END> }</code><technical_language>equals instead, objects</technical_language>

Target:
private void updateAvailabilitByDatacenter(StoragePool datacenter) { if (datacenter == null) { return; } getModel().getActivateDomain().setIsAvailable(!StorageModel.UnassignedDataCenterId.equals(datacenter.getId())); }
Source:
<code>Mono<Response<SubscriptionDescription>> updateSubscriptionWithResponse(SubscriptionDescription subscription, Context context) { if (subscription == null) { return monoError(logger, new NullPointerException("'subscription' cannot be null")); } final String topicName = subscription.getTopicName(); final String subscriptionName = subscription.getSubscriptionName(); if (topicName == null || topicName.isEmpty()) { <START> return monoError(logger, new IllegalArgumentException("'getTopicName' cannot be null or empty.")); <END> } else if (subscriptionName == null || subscriptionName.isEmpty()) { return monoError(logger, new IllegalArgumentException("'getSubscriptionName' cannot be null or empty.")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final CreateSubscriptionBodyContent content = new CreateSubscriptionBodyContent() .setType(CONTENT_TYPE) .setSubscriptionDescription(subscription); final CreateSubscriptionBody createEntity = new CreateSubscriptionBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return managementClient.getSubscriptions().putWithResponseAsync(topicName, subscriptionName, createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeSubscription(topicName, response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>topicName == null : NullPointerException ? add java doc for it</technical_language>

Target:
Mono<Response<SubscriptionDescription>> updateSubscriptionWithResponse(SubscriptionDescription subscription, Context context) { if (subscription == null) { return monoError(logger, new NullPointerException("'subscription' cannot be null")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final String topicName = subscription.getTopicName(); final String subscriptionName = subscription.getSubscriptionName(); final CreateSubscriptionBodyContent content = new CreateSubscriptionBodyContent() .setType(CONTENT_TYPE) .setSubscriptionDescription(subscription); final CreateSubscriptionBody createEntity = new CreateSubscriptionBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return managementClient.getSubscriptions().putWithResponseAsync(topicName, subscriptionName, createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeSubscription(topicName, response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public ZKSubscription subscribeForCursorsReset(final Runnable listener) { final NodeCache cursorResetCache = new NodeCache(curatorFramework, resetCursorPath); cursorResetCache.getListenable().addListener(() -> listener.run()); try { cursorResetCache.start(); } catch (final Exception e) { throw new NakadiRuntimeException(e); } return new ZKSubscription() { @Override public void refresh() { try { <START> cursorResetCache.rebuild(); <END> } catch (final Exception e) { throw new NakadiRuntimeException(e); } } @Override public void cancel() { try { cursorResetCache.getListenable().clear(); cursorResetCache.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } } }; }</code><technical_language>Is needed</technical_language>

Target:
public ZKSubscription subscribeForCursorsReset(final Runnable listener) throws NakadiRuntimeException, UnsupportedOperationException { final NodeCache cursorResetCache = new NodeCache(curatorFramework, resetCursorPath); cursorResetCache.getListenable().addListener(() -> listener.run()); try { cursorResetCache.start(); } catch (final Exception e) { throw new NakadiRuntimeException(e); } return new ZKSubscription() { @Override public void refresh() { throw new UnsupportedOperationException(); } @Override public void cancel() { try { cursorResetCache.getListenable().clear(); cursorResetCache.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } } }; }
Source:
<code>public void registerSonarQubeVersion(String sonarqubeVersion) { IAtomicReference<String> sqVersion = hzInstance.getAtomicReference(SONARQUBE_VERSION); if (sqVersion.get() == null) { ILock lock = hzInstance.getLock(SONARQUBE_VERSION); lock.lock(); try { if (sqVersion.get() == null) { sqVersion.set(sonarqubeVersion); } } finally { lock.unlock(); } } String clusterVersion = sqVersion.get(); if (!sqVersion.get().equals(sonarqubeVersion)) { <START> hzInstance.shutdown(); <END> throw new IllegalStateException( String.format("The local version %s is not the same as the cluster %s", sonarqubeVersion, clusterVersion) ); } }</code><technical_language>hzInstance is closed ? responsibility of caller cleanly call close() this class is Closeable</technical_language>

Target:
public void registerSonarQubeVersion(String sonarqubeVersion) { IAtomicReference<String> sqVersion = hzInstance.getAtomicReference(SONARQUBE_VERSION); if (sqVersion.get() == null) { ILock lock = hzInstance.getLock(SONARQUBE_VERSION); lock.lock(); try { if (sqVersion.get() == null) { sqVersion.set(sonarqubeVersion); } } finally { lock.unlock(); } } String clusterVersion = sqVersion.get(); if (!sqVersion.get().equals(sonarqubeVersion)) { throw new IllegalStateException( String.format("The local version %s is not the same as the cluster %s", sonarqubeVersion, clusterVersion) ); } }
Source:
<code>public String getTitle() { <START> return Context.getMessageSourceService().getMessage("emrapi.title"); <END> }</code><technical_language>return "emrapi.title"</technical_language>

Target:
public String getTitle() { return "emrapi.title"; }
Source:
<code>private void writeTargets(final String fullPath, List<Target> targets) { final String[][] targetValues = new String[targets.size()][NUM_TARGET_COLUMNS]; for (int i = 0; i < targets.size(); i++) { final Target target = targets.get(i); <START> targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.CONTIG.toString())] = target.getContig(); <END> targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.START.toString())] = String.valueOf(target.getStart()); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.END.toString())] = String.valueOf(target.getEnd()); } file.makeStringMatrix(fullPath, targetValues, NUM_TARGET_COLUMNS_PATH); }</code><technical_language>implementing targetColumnToPoNIndex EnumMap</technical_language>

Target:
private void writeTargets(final String fullPath, List<Target> targets) { final String[][] targetValues = new String[targets.size()][NUM_TARGET_COLUMNS]; for (int i = 0; i < targets.size(); i++) { final Target target = targets.get(i); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.CONTIG)] = target.getContig(); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.START)] = String.valueOf(target.getStart()); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.END)] = String.valueOf(target.getEnd()); } file.makeStringMatrix(fullPath, targetValues, NUM_TARGET_COLUMNS_PATH); }
Source:
<code>public static Iterable<ITmfEventAspect<?>> getEventAspects(ITmfTrace trace, Class<? extends ITmfEventAspect<?>> aspectClass) { return <START> Lists.newArrayList(Iterables.filter(Iterables.concat(trace.getEventAspects(), <END> EXTRA_ASPECTS), aspect -> aspectClass.isAssignableFrom(aspect.getClass()))); }</code><technical_language>newArrayList? Iterables.filter returns iterable</technical_language>

Target:
public static Iterable<ITmfEventAspect<?>> getEventAspects(ITmfTrace trace, Class<? extends ITmfEventAspect<?>> aspectClass) { return Iterables.filter(Iterables.concat(trace.getEventAspects(), EXTRA_ASPECTS), aspect -> aspectClass.isAssignableFrom(aspect.getClass())); }
Source:
<code>protected void startRemain() { if (checkpointPeriod != 0) { checkpointResult = scheduler.scheduleAtFixedRate(new Runnable() { public void run() { final long checkpointTimestamp = getCurrentTimestamp() - expectedDelay; <START> outputEmitter.emitWatermark( <END> new MistWatermarkEvent(checkpointTimestamp, true)); LOG.log(Level.INFO, "checkpoint event being emitted. time is : " + checkpointTimestamp); } }, checkpointPeriod, checkpointPeriod, timeUnit); } else { LOG.log(Level.INFO, "checkpointing is not turned on"); } }</code><technical_language>generate watermark if source PunctuatedWatermarkGenerator</technical_language>

Target:
protected void startRemain() { if (checkpointPeriod != 0) { checkpointResult = scheduler.scheduleAtFixedRate(new Runnable() { public void run() { outputEmitter.emitCheckpoint(new MistCheckpointEvent()); } }, checkpointPeriod, checkpointPeriod, timeUnit); } else { LOG.log(Level.INFO, "checkpointing is not turned on"); } }
Source:
<code>public static boolean filterGitReference(final Path gitRefPath, final Filters filters) { final List<String> branches = filters.getBranches(); final List<String> tags = filters.getTags(); if (branches.isEmpty() && tags.isEmpty()) { return true; } List<String> patterns; if (gitRefPath.startsWith("refs/heads/")) { patterns = branches; } else if (gitRefPath.startsWith("refs/tags/")) { patterns = tags; } else { throw new UnsupportedOperationException("Invalid git reference: " + gitRefPath.toString()); } final Path matchPath = gitRefPath.subpath(2, gitRefPath.getNameCount()); return patterns.stream().anyMatch(pattern -> { String matcherString; if (pattern.matches("^\\/.*\\/$")) { matcherString = "regex:" + pattern.substring(1, pattern.length() - 1); } else { matcherString = "glob:" + pattern; } try { final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher(matcherString); return pathMatcher.matches(matchPath); <START> } catch (PatternSyntaxException e) { <END> final String msg = ERROR_READING_DOCKSTORE_YML + e.getMessage(); LOG.warn(msg, e); return false; } }); }</code><technical_language>Is a glob syntax error (I know)? if is, throw a PatternSyntaxException else? If else, need catch it</technical_language>

Target:
public static boolean filterGitReference(final Path gitRefPath, final Filters filters) { final List<String> branches = filters.getBranches(); final List<String> tags = filters.getTags(); if (branches.isEmpty() && tags.isEmpty()) { return true; } List<String> patterns; if (gitRefPath.startsWith("refs/heads/")) { patterns = branches; } else if (gitRefPath.startsWith("refs/tags/")) { patterns = tags; } else { throw new UnsupportedOperationException("Invalid git reference: " + gitRefPath.toString()); } final Path matchPath = gitRefPath.subpath(2, gitRefPath.getNameCount()); return patterns.stream().anyMatch(pattern -> { String matcherString; if (pattern.matches("^\\/.*\\/$")) { matcherString = "regex:" + pattern.substring(1, pattern.length() - 1); } else { matcherString = "glob:" + pattern; } try { final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher(matcherString); return pathMatcher.matches(matchPath); } catch (PatternSyntaxException | UnsupportedOperationException e) { final String msg = ERROR_READING_DOCKSTORE_YML + e.getMessage(); LOG.warn(msg, e); return false; } }); }
Source:
<code>public Retention getObjectRetention(GetObjectRetentionArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); <START> if (args.versionId() != null && !args.versionId().isEmpty()) { <END> queryParamMap.put("versionId", args.versionId()); } try (Response response = executeGet(args.bucketName(), args.objectName(), null, queryParamMap)) { Retention retention = Xml.unmarshal(Retention.class, response.body().charStream()); return retention; } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return null; }</code><technical_language>I recommend versionId = "" allowed i.e. if (args.versionId() != null)</technical_language>

Target:
public Retention getObjectRetention(GetObjectRetentionArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (args.versionId() != null) { queryParamMap.put("versionId", args.versionId()); } try (Response response = executeGet(args.bucket(), args.object(), null, queryParamMap)) { Retention retention = Xml.unmarshal(Retention.class, response.body().charStream()); return retention; } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return null; }