auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldThrowStreamsExceptionForOldTopicPartitions() throws IOException { final HashMap<TopicPartition, Long> expectedOffsets = new HashMap<>(); expectedOffsets.put(t1, 1L); expectedOffsets.put(t2, 1L); expectedOffsets.put(t3, 1L); expectedOffsets.put(t4, 1L); final HashMap<TopicPartition, Long> startOffsets = new HashMap<>(expectedOffsets); final TopicPartition tOld = new TopicPartition("oldTopic", 1); startOffsets.put(tOld, 1L); final OffsetCheckpoint checkpoint = new OffsetCheckpoint(checkpointFile); checkpoint.write(startOffsets); <START> stateManager.initialize(); <END> }</code><technical_language>Use: StreamsException e = assertThrows(StreamsException.class, () -> stateManager.initialize); add assertThat(e.getMessage(), is("..."));</technical_language>

Target:
public void shouldThrowStreamsExceptionForOldTopicPartitions() throws IOException { final HashMap<TopicPartition, Long> expectedOffsets = new HashMap<>(); expectedOffsets.put(t1, 1L); expectedOffsets.put(t2, 1L); expectedOffsets.put(t3, 1L); expectedOffsets.put(t4, 1L); final HashMap<TopicPartition, Long> startOffsets = new HashMap<>(expectedOffsets); final TopicPartition tOld = new TopicPartition("oldTopic", 1); startOffsets.put(tOld, 1L); final OffsetCheckpoint checkpoint = new OffsetCheckpoint(checkpointFile); checkpoint.write(startOffsets); final StreamsException e = assertThrows(StreamsException.class, () -> stateManager.initialize()); assertThat(e.getMessage(), equalTo("Encountered a topic-partition not associated with any global state store")); }
Source:
<code><START> public void dumpRingStructure(IgniteLogger log) { <END> ClusterNode[] serverNodes = getRemoteNodes().stream() .filter(node -> !node.isClient()) .sorted((o1, o2) -> (int)(o1.order() - o2.order())) .toArray(ClusterNode[]::new); U.quietAndInfo(log, Arrays.toString(serverNodes)); }</code><technical_language>@override function declaration line</technical_language>

Target:
@Override public void dumpRingStructure(IgniteLogger log) { ClusterNode[] serverNodes = getRemoteNodes().stream() .filter(node -> !node.isClient()) .sorted(Comparator.comparingLong(ClusterNode::order)) .toArray(ClusterNode[]::new); U.quietAndInfo(log, Arrays.toString(serverNodes)); }
Source:
<code>protected boolean filter(String name) { if (filters == null || filters.isEmpty()) { <START> String filters = Framework.getProperty(FILTER_PROPERTY, DEFAULT_METRICS); <END> return matchesFilter(name, Arrays.stream(filters.split(","))); } else { return matchesFilter(name, filters.stream()); } }</code><technical_language>local variable String filters is name List<String> filters (which I find confusing). - is filter() method called? Do want set List<String> filters filters.split() values need do time</technical_language>

Target:
public boolean filter(String name) { return allowedMetrics.stream().anyMatch(f -> ALL_METRICS.equals(f) || name.startsWith(f)) || deniedMetrics.stream().noneMatch(f -> ALL_METRICS.equals(f) || name.startsWith(f)); }
Source:
<code>protected Object cast(Object value) { switch (type) { case STRING : return valueFactories.getStringFactory().create(value); case LONG : return valueFactories.getLongFactory().create(value); case NAME : return valueFactories.getNameFactory().create(value); case PATH : return valueFactories.getPathFactory().create(value); case DATE : return valueFactories.getDateFactory().create(value); case BOOLEAN : return valueFactories.getBooleanFactory().create(value); case URI : return valueFactories.getUriFactory().create(value); case REFERENCE : return valueFactories.getReferenceFactory().create(value); case SIMPLEREFERENCE : return valueFactories.getSimpleReferenceFactory().create(value); case WEAKREFERENCE : return valueFactories.getWeakReferenceFactory().create(value); <START> } <END> return value; }</code><technical_language>Again, this switch is incomplete. IIUC, this compile checkstyle rules</technical_language>

Target:
protected Object cast(Object value) { switch (type) { case STRING : return valueFactories.getStringFactory().create(value); case LONG : return valueFactories.getLongFactory().create(value); case NAME : return valueFactories.getNameFactory().create(value); case PATH : return valueFactories.getPathFactory().create(value); case DATE : return valueFactories.getDateFactory().create(value); case BOOLEAN : return valueFactories.getBooleanFactory().create(value); case URI : return valueFactories.getUriFactory().create(value); case REFERENCE : return valueFactories.getReferenceFactory().create(value); case SIMPLEREFERENCE : return valueFactories.getSimpleReferenceFactory().create(value); case WEAKREFERENCE : return valueFactories.getWeakReferenceFactory().create(value); default : return value; } }
Source:
<code>protected IJavaType getPrimitiveType(String name) throws CoreException { IJavaReferenceType type = null; if <START> (null != name) switch <END> (name) { case "boolean": type = (IJavaReferenceType) getType("java.lang.Boolean"); break; case "byte": type = (IJavaReferenceType) getType("java.lang.Byte"); break; case "char": type = (IJavaReferenceType) getType("java.lang.Character"); break; case "double": type = (IJavaReferenceType) getType("java.lang.Double"); break; case "float": type = (IJavaReferenceType) getType("java.lang.Float"); break; case "int": type = (IJavaReferenceType) getType("java.lang.Integer"); break; case "long": type = (IJavaReferenceType) getType("java.lang.Long"); break; case "short": type = (IJavaReferenceType) getType("java.lang.Short"); break; case "void": type = (IJavaReferenceType) getType("java.lang.Void"); break; default: break; } if (type != null) { IJavaFieldVariable field = type.getField("TYPE"); IJavaClassObject clazz = (IJavaClassObject) field.getValue(); return clazz.getInstanceType(); } throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, NLS.bind( InstructionsEvaluationMessages.Instruction_No_type, new String[] { name }), null)); }</code><technical_language>=> name != null</technical_language>

Target:
protected IJavaType getPrimitiveType(String name) throws CoreException { IJavaReferenceType type = null; if (name != null) { switch (name) { case "boolean": type = (IJavaReferenceType) getType("java.lang.Boolean"); break; case "byte": type = (IJavaReferenceType) getType("java.lang.Byte"); break; case "char": type = (IJavaReferenceType) getType("java.lang.Character"); break; case "double": type = (IJavaReferenceType) getType("java.lang.Double"); break; case "float": type = (IJavaReferenceType) getType("java.lang.Float"); break; case "int": type = (IJavaReferenceType) getType("java.lang.Integer"); break; case "long": type = (IJavaReferenceType) getType("java.lang.Long"); break; case "short": type = (IJavaReferenceType) getType("java.lang.Short"); break; case "void": type = (IJavaReferenceType) getType("java.lang.Void"); break; default: break; } } if (type != null) { IJavaFieldVariable field = type.getField("TYPE"); IJavaClassObject clazz = (IJavaClassObject) field.getValue(); return clazz.getInstanceType(); } throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, NLS.bind( InstructionsEvaluationMessages.Instruction_No_type, new String[] { name }), null)); }
Source:
<code>public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (isStoreAsBinary()) { for (Object key : command.getKeys()) { <START> if (getMightGoRemote(ctx, key, command)) <END> checkMarshallable(key); } } return super.visitGetAllCommand(ctx, command); }</code><technical_language>marshallable check happen if storeIsBinary is enabled if command replicated another node. TBH is way, serialization happen user thread in cases (at async marshalling disabled), is ok</technical_language>

Target:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { for (Object key : command.getKeys()) { if (isStoreAsBinary() || getMightGoRemote(ctx, key, command)) checkMarshallable(key); } return super.visitGetAllCommand(ctx, command); }
Source:
<code>public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext ) { validate( queryParameters ); EmbeddedCacheManager embeddedCacheManager = getCacheManager().getCacheManager(); <START> Cache<String, String> cache = embeddedCacheManager.getCache( "___stored_procedures", true ); <END> String className = cache.getOrDefault( storedProcedureName, storedProcedureName ); Callable<?> callable = instantiate( storedProcedureName, className ); setParams( storedProcedureName, queryParameters, callable ); Object res = execute( storedProcedureName, embeddedCacheManager, callable ); return CollectionHelper.newClosableIterator( extractTuples( storedProcedureName, res ) ); }</code><technical_language>extract "___stored_procedures" constants, in API register alias procedure name</technical_language>

Target:
public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext ) { EmbeddedCacheManager embeddedCacheManager = getCacheManager().getCacheManager(); return storedProceduresDelegate.callStoredProcedure( embeddedCacheManager, storedProcedureName, queryParameters, classLoaderService ); }
Source:
<code><START> protected void after() throws Throwable { <END> }</code><technical_language>change signature of published methods</technical_language>

Target:
protected void after() { }
Source:
<code><START> private void flushToFile() throws IOException { <END> if (!closed) { if (outStream == null) { createStream(); } if (pos > 0) { outStream.write(writeBuffer, 0, pos); pos = 0; } } else { throw new IOException("closed"); } }</code><technical_language>this public, tests call directly</technical_language>

Target:
public void flushToFile() throws IOException { if (!closed) { if (outStream == null) { createStream(); } if (pos > 0) { outStream.write(writeBuffer, 0, pos); pos = 0; } } else { throw new IOException("closed"); } }
Source:
<code>private void readDataInFetch() { if (this.closed.get()) { return; } while (remainingDataInCurrentRequest > 0) { if (CompileTimeConstants.PROFILE_CODE) { boolean acquired = this.bufferWriteMutex.tryAcquire(); if (acquired == false) { long aquireTime = System.nanoTime(); this.bufferWriteMutex.acquireUninterruptibly(); aquireTime = System.nanoTime() - aquireTime; mutexWaitTimeNS += aquireTime; } } else { this.bufferWriteMutex.acquireUninterruptibly(); } int totalBufferCapacity = this.readBufferCapacity.get(); int currentBufferLen = this.readBufferDataLen.get(); int remainingBufferCapacity = totalBufferCapacity - currentBufferLen; remainingBufferCapacity = totalBufferCapacity - currentBufferLen; int bytesToRead = 0; try { <START> bytesToRead = Math.max(512,this.dis.available()); <END> bytesToRead = Math.min(remainingBufferCapacity, Math.min(bytesToRead,remainingDataInCurrentRequest)); dis.readFully(this.readBuffer, currentBufferLen, bytesToRead); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } this.readBufferDataLen.addAndGet(bytesToRead); remainingDataInCurrentRequest -= bytesToRead; bufferWriteMutex.release(); if (this.readBufferDataLen.get() > (this.bufferPrefetchThresholdKB * 1024)) { return; } } }</code><technical_language>significance of 512</technical_language>

Target:
private void readDataInFetch() { if (this.closed.get()) { return; } while (remainingDataInCurrentRequest > 0) { if (CompileTimeConstants.PROFILE_CODE) { boolean acquired = this.bufferWriteMutex.tryAcquire(); if (acquired == false) { long aquireTime = System.nanoTime(); this.bufferWriteMutex.acquireUninterruptibly(); aquireTime = System.nanoTime() - aquireTime; mutexWaitTimeNS += aquireTime; } } else { this.bufferWriteMutex.acquireUninterruptibly(); } int totalBufferCapacity = this.readBufferCapacity.get(); int currentBufferLen = this.readBufferDataLen.get(); int remainingBufferCapacity = totalBufferCapacity - currentBufferLen; remainingBufferCapacity = totalBufferCapacity - currentBufferLen; int bytesToRead = 0; try { bytesToRead = Math.max(MIN_SOCKET_READ_SIZE,this.dis.available()); bytesToRead = Math.min(remainingBufferCapacity, Math.min(bytesToRead,remainingDataInCurrentRequest)); dis.readFully(this.readBuffer, currentBufferLen, bytesToRead); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } this.readBufferDataLen.addAndGet(bytesToRead); remainingDataInCurrentRequest -= bytesToRead; bufferWriteMutex.release(); if (this.readBufferDataLen.get() > (this.bufferPrefetchThresholdKB * 1024)) { return; } } }
Source:
<code><START> public Void visitAnnotation(AnnotationTree node, Void p) { <END> AnnotationMirror annot = TreeUtils.annotationFromAnnotationTree(node); if (AnnotationUtils.areSame(annot, getTypeFactory().THIS_ANNOTATION)) { TreePath parentPath = getCurrentPath().getParentPath(); Tree parent = parentPath.getLeaf(); Tree grandparent = parentPath.getParentPath().getLeaf(); boolean isReturnAnnot = grandparent instanceof MethodTree && (parent.equals(((MethodTree) grandparent).getReturnType()) || parent instanceof ModifiersTree); boolean isCastAnnot = grandparent instanceof TypeCastTree && parent.equals(((TypeCastTree) grandparent).getType()); if (!(isReturnAnnot || isCastAnnot)) { checker.report( node, new DiagMessage(Diagnostic.Kind.ERROR, "invalid.this.location")); } } return super.visitAnnotation(node, p); }</code><technical_language>Note this validates explicit annotations in source code. instead validate methods/fields ensure correct usage ensure stub files correct</technical_language>

Target:
public Void visitAnnotation(AnnotationTree node, Void p) { AnnotationMirror annot = TreeUtils.annotationFromAnnotationTree(node); if (AnnotationUtils.areSame(annot, getTypeFactory().THIS_ANNOTATION)) { TreePath parentPath = getCurrentPath().getParentPath(); Tree parent = parentPath.getLeaf(); Tree grandparent = parentPath.getParentPath().getLeaf(); Tree greatGrandparent = parentPath.getParentPath().getParentPath().getLeaf(); boolean isReturnAnnot = grandparent instanceof MethodTree && (parent.equals(((MethodTree) grandparent).getReturnType()) || parent instanceof ModifiersTree); boolean isReceiverAnnot = greatGrandparent instanceof MethodTree && grandparent.equals( ((MethodTree) greatGrandparent).getReceiverParameter()) && parent.equals(((VariableTree) grandparent).getModifiers()); boolean isCastAnnot = grandparent instanceof TypeCastTree && parent.equals(((TypeCastTree) grandparent).getType()); if (!(isReturnAnnot || isReceiverAnnot || isCastAnnot)) { checker.reportError(node, "type.invalid.this.location"); } if (isReturnAnnot && ElementUtils.isStatic( TreeUtils.elementFromDeclaration((MethodTree) grandparent))) { checker.reportError(node, "type.invalid.this.location"); } } return super.visitAnnotation(node, p); }
Source:
<code>public A value() { <START> return supplier != null ? supplier.f() : null; <END> }</code><technical_language>return supplier.f(). In FJ do special case null imput value: protecting input parameter null litter code garbage, impact perf and, in this case, hide root issue propagating a null value. dedicated APIs Option.fromNull explicitly deal null</technical_language>

Target:
public final A value() { return supplier.f(); }
Source:
<code>private static boolean isValidClaimValue(Object value) { if (value == null) { return true; } Class<?> clazz = value.getClass(); if (clazz.isArray() && SUPPORTED_ARRAY_TYPES.contains(clazz)) { return true; } return SUPPORTED_TYPES.contains(clazz); <START> } <END></code><technical_language>I suggest, instead of returning boolean, throw IllegalArgumentException for bad claim classes right here. benefit is provide class of offending claim right in exception message, GREATLY simplifies troubleshooting</technical_language>

Target:
private static boolean isValidClaimValue(Object value) { if (value == null) { return true; } Class<?> clazz = value.getClass(); if (clazz.isArray() && SUPPORTED_ARRAY_TYPES.contains(clazz)) { return true; } if(SUPPORTED_TYPES.contains(clazz)) return true; throw new IllegalArgumentException("For the claim, of value {" + value + "}, it's type {" + clazz + "} is not supported"); }
Source:
<code>public Object getValueAt(int row, int col) { boolean compact = butCompact.isSelected(); Entity entity = getEntityAt(row); boolean blindDrop = !entity.getOwner().equals(clientgui.getClient().getLocalPlayer()) && clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.BASE_BLIND_DROP); String value = ""; if (col == COL_BV) { value += entity.calculateBattleValue(); } else if (col == COL_PLAYER) { if (compact) { value += entity.getOwner().getName(); } else { value += entity.getOwner().getName() + "<br>Team " + clientgui.getClient().getGame().getPlayer(entity.getOwnerId()).getTeam(); } } else if (col == COL_PILOT) { <START> boolean rpgSkills = clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.RPG_RPG_GUNNERY); <END> if (compact) { return formatPilotCompact(entity.getCrew(), blindDrop, rpgSkills); } return formatPilotHTML(entity.getCrew(), blindDrop, rpgSkills); } else { if (compact) { return formatUnitCompact(entity, blindDrop); } return formatUnitHTML(entity, blindDrop); } return value; }</code><technical_language>suggestion final boolean rpgSkills = clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.RPG_RPG_GUNNERY);</technical_language>

Target:
public Object getValueAt(int row, int col) { boolean compact = butCompact.isSelected(); Entity entity = getEntityAt(row); boolean blindDrop = !entity.getOwner().equals(clientgui.getClient().getLocalPlayer()) && clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.BASE_BLIND_DROP); String value = ""; if (col == COL_BV) { value += entity.calculateBattleValue(); } else if (col == COL_PLAYER) { if (compact) { value += entity.getOwner().getName(); } else { value += entity.getOwner().getName() + "<br>Team " + clientgui.getClient().getGame().getPlayer(entity.getOwnerId()).getTeam(); } } else if (col == COL_PILOT) { final boolean rpgSkills = clientgui.getClient().getGame().getOptions().booleanOption(OptionsConstants.RPG_RPG_GUNNERY); if (compact) { return formatPilotCompact(entity.getCrew(), blindDrop, rpgSkills); } return formatPilotHTML(entity.getCrew(), blindDrop, rpgSkills); } else { if (compact) { return formatUnitCompact(entity, blindDrop); } return formatUnitHTML(entity, blindDrop); } return value; }
Source:
<code>public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch <START> (object.getContainer().getStorage().getStatus()){ <END> case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }</code><technical_language>Add space curly brackets please</technical_language>

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } }
Source:
<code>public void mouseUp(MouseEvent event) { if (fDragState == DRAG_RANGE && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (event.x != fStartPosition) { int pointDelta = event.x - fStartPosition; long deltaNs = (long) (pointDelta * fScaledData.fBucketDuration); long startTime = fRangeStartTime - deltaNs; <START> fRangeStartTime = Math.min(fFullRangeEndTime - fRangeDuration, startTime); <END> ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); setOffset(0); } return; } else if (fDragState == DRAG_ZOOM && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (fRangeDuration < 0) { fRangeStartTime = fRangeStartTime + fRangeDuration; fRangeDuration = -fRangeDuration; } if (fRangeDuration > 0) { ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); } else { fRangeStartTime = fZoom.getStartTime(); fRangeDuration = fZoom.getDuration(); fCanvas.redraw(); } return; } super.mouseUp(event); }</code><technical_language>need max check, try range beginning of trace middle-drag right</technical_language>

Target:
public void mouseUp(MouseEvent event) { if (fDragState == DRAG_RANGE && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (event.x != fStartPosition) { int pointDelta = event.x - fStartPosition; long deltaNs = (long) (pointDelta * fScaledData.fBucketDuration); long startTime = fRangeStartTime - deltaNs; fRangeStartTime = Math.max(fFullRangeStartTime, Math.min(fFullRangeEndTime - fRangeDuration, startTime)); ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); setOffset(0); } return; } else if (fDragState == DRAG_ZOOM && event.button == fDragButton) { fDragState = DRAG_NONE; fDragButton = 0; if (fRangeDuration < 0) { fRangeStartTime = fRangeStartTime + fRangeDuration; fRangeDuration = -fRangeDuration; } if (fRangeDuration > 0) { ((HistogramView) fParentView).updateTimeRange(fRangeStartTime, fRangeStartTime + fRangeDuration); } else { fRangeStartTime = fZoom.getStartTime(); fRangeDuration = fZoom.getDuration(); fCanvas.redraw(); } return; } super.mouseUp(event); }
Source:
<code>public void testThreadLeakWhenClientCanNotConstructDueToIncorrectSerializationServiceFactoryClassName() { try { ClientConfig config = new ClientConfig(); SerializationConfig serializationConfig = new SerializationConfig(); serializationConfig.addDataSerializableFactoryClass(5, "invalid.factory"); config.setSerializationConfig(serializationConfig); HazelcastClient.newHazelcastClient(config); Assert.fail(); <START> } catch (HazelcastSerializationException e) { <END> } }</code><technical_language>remove this catch replace @Test(expected=HazelcastSerializationException). for other catches</technical_language>

Target:
public void testThreadLeakWhenClientCanNotConstructDueToIncorrectSerializationServiceFactoryClassName() { ClientConfig config = new ClientConfig(); SerializationConfig serializationConfig = new SerializationConfig(); serializationConfig.addDataSerializableFactoryClass(5, "invalid.factory"); config.setSerializationConfig(serializationConfig); Set<Thread> testStartThreads = getThreads(); try { HazelcastClient.newHazelcastClient(config); } finally { assertHazelcastThreadShutdown(testStartThreads); } }
Source:
<code>public void testWhereColumnEqualsValues() throws Exception { <START> DataSet ds = dc.query().from(testTableName).select("id").and("title").where("id") <END> .isEquals(firstRowId).execute(); assertEquals(FilteredDataSet.class, ds.getClass()); try { assertTrue(ds.next()); assertEquals("Row[values=["+firstRowId+", "+firstRowTitle+"]]", ds.getRow().toString()); assertFalse(ds.next()); } finally { ds.close(); } }</code><technical_language>test methods check isConfigured(), else break a non-configured machine's build</technical_language>

Target:
public void testWhereColumnEqualsValues() throws Exception { if (!isConfigured()) { System.err.println(getInvalidConfigurationMessage()); return; } DataSet ds = dc.query().from(testTableName).select("id").and("title").where("id") .isEquals(firstRowId).execute(); assertEquals(FilteredDataSet.class, ds.getClass()); try { assertTrue(ds.next()); assertEquals("Row[values=["+firstRowId+", "+firstRowTitle+"]]", ds.getRow().toString()); assertFalse(ds.next()); } finally { ds.close(); } }
Source:
<code>public static Map<String, String> postData(EndPointInfo endPointInfo, Map<String, String> headers) throws IDPTokenManagerException { HTTP_METHODS httpMethod = endPointInfo.getHttpMethod(); String url = endPointInfo.getEndPoint(); <START> String params = ""; <END> if(endPointInfo.getRequestParams() != null){ params = endPointInfo.getRequestParams(); } Map<String, String> responseParams = new HashMap<String, String>(); switch (httpMethod) { case GET: responseParams = sendGetRequest(url, params, headers); break; case POST: responseParams = sendPostRequest(url, params, headers); break; case DELETE: responseParams = sendDeleteRequest(url, params, headers); break; case PUT: responseParams = sendPutRequest(url, params, headers); break; } return responseParams; }</code><technical_language>is variable "params" assigned empty string? If specific reason do this assignment, null assigned aforementioned variable default value</technical_language>

Target:
public static Map<String, String> postData(EndPointInfo endPointInfo, Map<String, String> headers) throws IDPTokenManagerException { HTTP_METHODS httpMethod = endPointInfo.getHttpMethod(); String url = endPointInfo.getEndPoint(); String params = null; if(endPointInfo != null && endPointInfo.getRequestParams() != null){ params = endPointInfo.getRequestParams(); } Map<String, String> responseParams = new HashMap<String, String>(); switch (httpMethod) { case GET: responseParams = sendGetRequest(url, headers); break; case POST: responseParams = sendPostRequest(url, params, headers); break; case DELETE: responseParams = sendDeleteRequest(url, headers); break; case PUT: responseParams = sendPutRequest(url, params, headers); break; } return responseParams; }
Source:
<code>public void shouldNotifyEventWhenRemoveAnnotation() { Annotation createdAnnotation = createAnnotationAndAddSubscription("CommentRemoved"); DocumentModel annotationDocModel = session.getDocument(new IdRef(createdAnnotation.getId())); annotationDocModel.detach(true); captureAndVerifyAnnotationEventNotification(() -> { annotationService.deleteAnnotation(session, createdAnnotation.getId()); return annotationDocModel; <START> <END> }, COMMENT_REMOVED, DOCUMENT_REMOVED, 0); }</code><technical_language>Useless blank line</technical_language>

Target:
public void shouldNotifyEventWhenRemoveAnnotation() { Annotation createdAnnotation = createAnnotationAndAddSubscription("CommentRemoved"); DocumentModel annotationDocModel = session.getDocument(new IdRef(createdAnnotation.getId())); annotationDocModel.detach(true); captureAndVerifyAnnotationEventNotification(() -> { annotationService.deleteAnnotation(session, createdAnnotation.getId()); return annotationDocModel; }, COMMENT_REMOVED, DOCUMENT_REMOVED); }
Source:
<code>public ServiceTest(TOptions options) throws IOException, EventHubException { super(options); String connectionString = System.getenv("EVENTHUBS_CONNECTION_STRING"); String eventHubName = System.getenv("EVENTHUB_NAME"); if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalStateException("Environment variable EVENTHUBS_CONNECTION_STRING must be set"); } if (CoreUtils.isNullOrEmpty(eventHubName)) { System.out.println("Environment variable EVENTHUB_NAME must be set"); System.exit(1); } <START> ScheduledExecutorService executor = Executors.newScheduledThreadPool(4); <END> eventHubClient = EventHubClient.createSync( new ConnectionStringBuilder(connectionString).setEventHubName(eventHubName).toString(), executor); }</code><technical_language>is this hardcoded 4 threads? option control this</technical_language>

Target:
public ServiceTest(TOptions options) throws IOException, EventHubException { super(options); connectionString = System.getenv("EVENTHUBS_CONNECTION_STRING"); eventHubName = System.getenv("EVENTHUB_NAME"); poolSize = System.getenv("EVENTHUB_POOL_SIZE"); if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalStateException("Environment variable EVENTHUBS_CONNECTION_STRING must be set"); } if (CoreUtils.isNullOrEmpty(eventHubName)) { System.out.println("Environment variable EVENTHUB_NAME must be set"); System.exit(1); } }
Source:
<code>public void restorePanels() { getChildren().clear(); List<PanelInfo> panelInfo = prefs.getPanelInfo(); if (panelInfo.isEmpty()) { addPanel(); return; } <START> for (int i = 0; i < panelInfo.size(); i++) { <END> addPanel().restorePanel(panelInfo.get(i).getPanelName(), panelInfo.get(i).getPanelFilter()); } }</code><technical_language>replace forEach</technical_language>

Target:
public void restorePanels() { getChildren().clear(); List<PanelInfo> panels = prefs.getPanelInfo(); if (panels.isEmpty()) { addPanel(); return; } for (PanelInfo panel : panels) { addPanel().restorePanel(panel.getPanelName(), panel.getPanelFilter()); } }
Source:
<code>public void setProvider(String provider) { <START> this.provider = PROVIDERS_PLUGIN_MAPPING.getOrDefault(provider, provider.toLowerCase()); <END> }</code><technical_language>In deserializer, provider name is uppercased searching in map: java String provider = providerNode.asText().toUpperCase(); String providerPlugin = EndpointDiscoveryProviderMapper.getProvider(provider); do this: this.provider = PROVIDERS_PLUGIN_MAPPING.getOrDefault(provider.toUpperCase(), provider.toLowerCase());</technical_language>

Target:
public void setProvider(String provider) { if (provider == null) { this.provider = null; } else { this.provider = PROVIDERS_PLUGIN_MAPPING.getOrDefault(provider.toUpperCase(), provider.toLowerCase()); } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TypeaheadSearchResp)) return false; TypeaheadSearchResp that = (TypeaheadSearchResp) o; if (getGene() != null ? !getGene().equals(that.getGene()) : that.getGene() != null) return false; if (getVariant() != null ? !getVariant().equals(that.getVariant()) : that.getVariant() != null) return false; if (getOncogenicity() != null ? !getOncogenicity().equals(that.getOncogenicity()) : that.getOncogenicity() != null) return false; if (getHighestLevelOfSensitivity() != null ? !getHighestLevelOfSensitivity().equals(that.getHighestLevelOfSensitivity()) : that.getHighestLevelOfSensitivity() != null) return false; if (getHighestLevelOfResistance() != null ? !getHighestLevelOfResistance().equals(that.getHighestLevelOfResistance()) : that.getHighestLevelOfResistance() != null) return false; if (getVariantExist() != null ? !getVariantExist().equals(that.getVariantExist()) : that.getVariantExist() != null) <START> return false; <END> if (getAnnotation() != null ? !getAnnotation().equals(that.getAnnotation()) : that.getAnnotation() != null) return false; if (getQueryType() != null ? !getQueryType().equals(that.getQueryType()) : that.getQueryType() != null) return false; return getLink() != null ? getLink().equals(that.getLink()) : that.getLink() == null; }</code><technical_language>put this duplicated check pattern a function, instead of writting for attribute. if (A != null ? !A.equals(B) : B != null) return false;</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TypeaheadSearchResp)) return false; TypeaheadSearchResp that = (TypeaheadSearchResp) o; if (getGene() != null ? !getGene().equals(that.getGene()) : that.getGene() != null) return false; if (getVariant() != null ? !getVariant().equals(that.getVariant()) : that.getVariant() != null) return false; if (getOncogenicity() != null ? !getOncogenicity().equals(that.getOncogenicity()) : that.getOncogenicity() != null) return false; if (getHighestSensitiveLevel() != null ? !getHighestSensitiveLevel().equals(that.getHighestSensitiveLevel()) : that.getHighestSensitiveLevel() != null) return false; if (getHighestResistanceLevel() != null ? !getHighestResistanceLevel().equals(that.getHighestResistanceLevel()) : that.getHighestResistanceLevel() != null) return false; if (getVariantExist() != null ? !getVariantExist().equals(that.getVariantExist()) : that.getVariantExist() != null) return false; if (isVUS != null ? !isVUS.equals(that.isVUS) : that.isVUS != null) return false; if (getAnnotation() != null ? !getAnnotation().equals(that.getAnnotation()) : that.getAnnotation() != null) return false; if (getQueryType() != null ? !getQueryType().equals(that.getQueryType()) : that.getQueryType() != null) return false; return getLink() != null ? getLink().equals(that.getLink()) : that.getLink() == null; }
Source:
<code>void cancel() { <START> synchronized (submittedJobs) { <END> for (Future<DocumentRevsList> f : submittedJobs) { f.cancel(false); } try { while (!submittedJobs.isEmpty()) { Future<DocumentRevsList> r = completionService.take(); submittedJobs.remove(r); } } catch (InterruptedException e) { ; } finally { shutdownThreadPool(); } } }</code><technical_language>need this synchronized block submittedJobs constructed synchronizedSet</technical_language>

Target:
void cancel() { synchronized (submittedJobs) { for (Future<DocumentRevsList> f : submittedJobs) { f.cancel(false); } } try { while (!submittedJobs.isEmpty()) { try { Future<DocumentRevsList> r = completionService.poll(responseTimeout, responseTimeoutUnits); if (r != null) { submittedJobs.remove(r); } } catch (InterruptedException e) { continue; } } } finally { shutdownThreadPool(); } }
Source:
<code>public void run() throws IOException { if (this.isStarted() || this.isComplete()) { throw new IllegalStateException("The process can only be used once."); } ProcessBuilder builder = new ProcessBuilder(cmd); builder.directory(new File(workingDir)); builder.environment().putAll(env); builder.redirectErrorStream(true); this.process = builder.start(); try { this.processId = processId(process); if (processId == 0) { logger.debug("Spawned thread with unknown process id"); } else { logger.debug("Spawned thread with process id " + processId); } this.startupLatch.countDown(); LogGobbler outputGobbler = new LogGobbler(new InputStreamReader(process.getInputStream()), logger, Level.INFO, 30); LogGobbler errorGobbler = new LogGobbler(new InputStreamReader(process.getErrorStream()), logger, Level.ERROR, 30); outputGobbler.start(); errorGobbler.start(); int exitCode = -1; try { exitCode = process.waitFor(); } catch (InterruptedException e) { logger.info("Process interrupted. Exit code is " + exitCode, e); } completeLatch.countDown(); outputGobbler.awaitCompletion(5000); errorGobbler.awaitCompletion(5000); if (exitCode != 0) { <START> throw new ProcessFailureException(exitCode, errorGobbler.getRecentLog()); <END> } } finally { IOUtils.closeQuietly(process.getInputStream()); IOUtils.closeQuietly(process.getOutputStream()); IOUtils.closeQuietly(process.getErrorStream()); } }</code><technical_language>append stdout ? While fixing Java 1.8 test cases, I observed some failures logged in stdout stderr</technical_language>

Target:
public void run() throws IOException { if (this.isStarted() || this.isComplete()) { throw new IllegalStateException("The process can only be used once."); } ProcessBuilder builder = new ProcessBuilder(cmd); builder.directory(new File(workingDir)); builder.environment().putAll(env); builder.redirectErrorStream(true); this.process = builder.start(); try { this.processId = processId(process); if (processId == 0) { logger.debug("Spawned thread with unknown process id"); } else { logger.debug("Spawned thread with process id " + processId); } this.startupLatch.countDown(); LogGobbler outputGobbler = new LogGobbler(new InputStreamReader(process.getInputStream()), logger, Level.INFO, 30); LogGobbler errorGobbler = new LogGobbler(new InputStreamReader(process.getErrorStream()), logger, Level.ERROR, 30); outputGobbler.start(); errorGobbler.start(); int exitCode = -1; try { exitCode = process.waitFor(); } catch (InterruptedException e) { logger.info("Process interrupted. Exit code is " + exitCode, e); } completeLatch.countDown(); outputGobbler.awaitCompletion(5000); errorGobbler.awaitCompletion(5000); if (exitCode != 0) { String output = new StringBuilder().append("Stdout:\n") .append(outputGobbler.getRecentLog()).append("\n\n") .append("Stderr:\n").append(errorGobbler.getRecentLog()) .append("\n").toString(); throw new ProcessFailureException(exitCode, output); } } finally { IOUtils.closeQuietly(process.getInputStream()); IOUtils.closeQuietly(process.getOutputStream()); IOUtils.closeQuietly(process.getErrorStream()); } }
Source:
<code>public void doublePairVsThree() { String doublePair2And8 = "2S 8H 2H 8D JH"; String threeOf4 = "4S 5H 4C 8S 4H"; <START> assertEquals(Arrays.asList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands()); <END> }</code><technical_language>object in list Collections.singletonList instead of Arrays.asList</technical_language>

Target:
public void doublePairVsThree() { String doublePair2And8 = "2S 8H 2H 8D JH"; String threeOf4 = "4S 5H 4C 8S 4H"; assertEquals(Collections.singletonList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands()); }
Source:
<code>public void testRoundTripTypes(List<Type> types, List<List<?>> readValues, List<Map<Integer, Map<Subfield, TupleDomainFilter>>> filters, List<List<Integer>> expectedFilterOrder) throws Exception { assertEquals(types.size(), readValues.size()); <START> if (expectedFilterOrder.size() > 0) { <END> assertEquals(filters.size(), expectedFilterOrder.size()); } assertRoundTrip(types, readValues, filters, expectedFilterOrder); if (reverseTestsEnabled) { assertRoundTrip(types, Lists.transform(readValues, OrcTester::reverse), filters, ImmutableList.of()); } if (nullTestsEnabled) { assertRoundTrip(types, insertNulls(types, readValues), filters, expectedFilterOrder); if (reverseTestsEnabled) { assertRoundTrip(types, insertNulls(types, Lists.transform(readValues, OrcTester::reverse)), filters, ImmutableList.of()); } } }</code><technical_language>nit: isEmpty() - if (! expectedFilterOrder.isEmpty())</technical_language>

Target:
public void testRoundTripTypes(List<Type> types, List<List<?>> readValues, List<Map<Integer, Map<Subfield, TupleDomainFilter>>> filters, List<List<Integer>> expectedFilterOrder) throws Exception { assertEquals(types.size(), readValues.size()); if (!expectedFilterOrder.isEmpty()) { assertEquals(filters.size(), expectedFilterOrder.size()); } assertRoundTrip(types, readValues, filters, expectedFilterOrder); if (reverseTestsEnabled) { assertRoundTrip(types, Lists.transform(readValues, OrcTester::reverse), filters, expectedFilterOrder); } if (nullTestsEnabled) { assertRoundTrip(types, insertNulls(types, readValues), filters, expectedFilterOrder); if (reverseTestsEnabled) { assertRoundTrip(types, insertNulls(types, Lists.transform(readValues, OrcTester::reverse)), filters, expectedFilterOrder); } } }
Source:
<code>public Set<ConnectorCapabilities> getConnectorCapabilities(Session session, ConnectorId catalogName) { <START> return emptySet(); <END> }</code><technical_language>this throw UnsupportedOperationException behavior of other methods in this abstract class. want this behavior avoid accidentally calling in a test</technical_language>

Target:
public Set<ConnectorCapabilities> getConnectorCapabilities(Session session, ConnectorId catalogName) { throw new UnsupportedOperationException(); }
Source:
<code>private void deployStream(CuratorFramework client, Stream stream) throws InterruptedException { try { <START> client.setData().forPath( <END> Paths.build(Paths.STREAM_DEPLOYMENTS, stream.getName(), Paths.STATUS), ZooKeeperUtils.mapToBytes(new DeploymentUnitStatus(DeploymentUnitStatus.State.deploying).toMap())); StreamModuleDeploymentPropertiesProvider provider = new StreamModuleDeploymentPropertiesProvider(stream); Collection<ModuleDeploymentStatus> deploymentStatus = moduleDeploymentWriter.writeDeployment(stream.getDeploymentOrderIterator(), provider); DeploymentUnitStatus status = stateCalculator.calculate(stream, provider, deploymentStatus); logger.info("Deployment state for stream: {}", status); client.setData().forPath( Paths.build(Paths.STREAM_DEPLOYMENTS, stream.getName(), Paths.STATUS), ZooKeeperUtils.mapToBytes(status.toMap())); } catch (NoContainerException e) { logger.warn("No containers available for deployment of stream {}", stream.getName()); } catch (InterruptedException e) { throw e; } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }</code><technical_language>I this is discussed Assert instead, set "deploying" this invoked</technical_language>

Target:
private void deployStream(CuratorFramework client, Stream stream) throws InterruptedException { String statusPath = Paths.build(Paths.STREAM_DEPLOYMENTS, stream.getName(), Paths.STATUS); DeploymentUnitStatus deployingStatus = null; try { deployingStatus = new DeploymentUnitStatus(ZooKeeperUtils.bytesToMap( client.getData().forPath(statusPath))); } catch (Exception e) { } Assert.state(deployingStatus != null && deployingStatus.getState() == DeploymentUnitStatus.State.deploying, String.format("Expected 'deploying' status for stream '%s'; current status: %s", stream.getName(), deployingStatus)); try { StreamModuleDeploymentPropertiesProvider provider = new StreamModuleDeploymentPropertiesProvider(stream); Collection<ModuleDeploymentStatus> deploymentStatus = moduleDeploymentWriter.writeDeployment(stream.getDeploymentOrderIterator(), provider); DeploymentUnitStatus status = stateCalculator.calculate(stream, provider, deploymentStatus); logger.info("Deployment status for stream '{}': {}", stream.getName(), status); client.setData().forPath(statusPath, ZooKeeperUtils.mapToBytes(status.toMap())); } catch (NoContainerException e) { logger.warn("No containers available for deployment of stream {}", stream.getName()); } catch (InterruptedException e) { throw e; } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }
Source:
<code><START> protected void deleteDepthFirst(final Transaction tx, final PersistentStorageSession pSession, <END> final FedoraResource fedoraResource, final String userPrincipal) throws PersistentStorageException { final FedoraId fedoraId = fedoraResource.getFedoraId(); if (fedoraResource instanceof Container) { final Stream<String> children = getContained(tx, fedoraResource); children.forEach(childResourceId -> { try { final FedoraResource res = resourceFactory.getResource(tx, FedoraId.create(childResourceId)); deleteDepthFirst(tx, pSession, res, userPrincipal); } catch (final PathNotFoundException ex) { log.error("Path not found for {}: {}", fedoraId.getFullId(), ex.getMessage()); throw new PathNotFoundRuntimeException(ex); } catch (final PersistentStorageException ex) { throw new RepositoryRuntimeException(format("failed to delete resource %s", fedoraId.getFullId()), ex); } }); } else if (fedoraResource instanceof Binary) { doAction(tx, pSession, fedoraResource.getDescribedResource().getFedoraId(), userPrincipal); } if (!fedoraResource.isAcl()) { final FedoraResource acl = fedoraResource.getAcl(); if (acl != null) { doAction(tx, pSession, acl.getFedoraId(), userPrincipal); } } doAction(tx, pSession, fedoraId, userPrincipal); }</code><technical_language>changed private</technical_language>

Target:
private void deleteDepthFirst(final Transaction tx, final PersistentStorageSession pSession, final FedoraResource fedoraResource, final String userPrincipal) throws PersistentStorageException { final FedoraId fedoraId = fedoraResource.getFedoraId(); if (fedoraResource instanceof Container) { final Stream<String> children = getContained(tx, fedoraResource); children.forEach(childResourceId -> { try { final FedoraResource res = resourceFactory.getResource(tx, FedoraId.create(childResourceId)); deleteDepthFirst(tx, pSession, res, userPrincipal); } catch (final PathNotFoundException ex) { log.error("Path not found for {}: {}", fedoraId.getFullId(), ex.getMessage()); throw new PathNotFoundRuntimeException(ex); } catch (final PersistentStorageException ex) { throw new RepositoryRuntimeException(format("failed to delete resource %s", fedoraId.getFullId()), ex); } }); } else if (fedoraResource instanceof Binary) { doAction(tx, pSession, fedoraResource.getDescribedResource().getFedoraId(), userPrincipal); } if (!fedoraResource.isAcl()) { final FedoraResource acl = fedoraResource.getAcl(); if (acl != null) { doAction(tx, pSession, acl.getFedoraId(), userPrincipal); } } doAction(tx, pSession, fedoraId, userPrincipal); }
Source:
<code>public static List<GameObject> parse(FileHandle file) throws IOException { List<GameObject> result = new ArrayList<GameObject>(); Scanner sc = new Scanner(file.read()); if(sc.hasNext()) { String enemyType = sc.nextLine(); switch(enemyType) { case "SimpleEnemy": enemyFactory = new SimpleEnemyFactory(); break; case "StrongEnemy": enemyFactory = new StrongEnemyFactory(); break; default: enemyFactory = new SimpleEnemyFactory(); result.add(getObject(enemyType)); } <START> } <END> while (sc.hasNext()) { String object = sc.nextLine(); try { result.add(getObject(object)); } catch (IOException ioe) { ioe.printStackTrace(); } } return result; }</code><technical_language>Clean solution for new enemy types</technical_language>

Target:
public static List<GameObject> parse(FileHandle file) throws IOException { List<GameObject> result = new ArrayList<GameObject>(); Scanner sc = new Scanner(file.read()); if(sc.hasNext()) { String enemyType = sc.nextLine(); switch(enemyType) { case "SimpleEnemy": enemyFactory = new SimpleEnemyFactory(); break; case "StrongEnemy": enemyFactory = new StrongEnemyFactory(); break; default: enemyFactory = new SimpleEnemyFactory(); result.add(getObject(enemyType)); break; } } while (sc.hasNext()) { String object = sc.nextLine(); result.add(getObject(object)); } return result; }
Source:
<code>private void cleanupOldDocVer(DBObject doc) { DBObject hidden=getHidden(doc,false); if(hidden!=null) { List<ObjectId> list=(List<ObjectId>)hidden.get(DOCVER); if(list!=null) { List<ObjectId> copy=new ArrayList<>(list.size()); <START> long now=docVer.getDate().getTime(); <END> for(ObjectId id:list) { if(!id.equals(docVer)) { Date d=id.getDate(); if(now-d.getTime()<TOO_OLD) { copy.add(id); } } else { copy.add(id); } } if(copy.size()!=list.size()) { hidden.put(DOCVER,copy); LOGGER.debug("cleanupInput={}, cleanupOutput={}",list,copy); } } } }</code><technical_language>Forgot mongo ObjectId encodes a timestamp... nice</technical_language>

Target:
private void cleanupOldDocVer(DBObject doc) { DBObject hidden=getHidden(doc,false); if(hidden!=null) { List<ObjectId> list=(List<ObjectId>)hidden.get(DOCVER); if(list!=null) { List<ObjectId> copy=new ArrayList<>(list.size()); long now=docVer.getDate().getTime(); for(ObjectId id:list) { if(!id.equals(docVer)) { Date d=id.getDate(); if(now-d.getTime()<TOO_OLD_MS) { copy.add(id); } } else { copy.add(id); } } if(copy.size()!=list.size()) { hidden.put(DOCVER,copy); LOGGER.debug("cleanupInput={}, cleanupOutput={}",list,copy); } } } }