auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void publish(@NotNull Review review) { long numFilesWithComments = review.getFiles().stream().filter(files -> !files.getComments().isEmpty()).count(); if (numFilesWithComments == 0) { <START> info("No sputnik comments"); <END> return; } for (String message : review.getMessages()) { warn(message); } for (ReviewFile file : review.getFiles()) { if (file.getComments().isEmpty()) { continue; } warn(""); warn(String.format("%d comment(s) on %s", file.getComments().size(), file.getReviewFilename())); for (Comment comment : file.getComments()) { warn(String.format("Line %d: %s", comment.getLine(), comment.getMessage())); } } }</code><technical_language>Please Slf4j for logging</technical_language>

Target:
public void publish(@NotNull Review review) { long numFilesWithComments = review.getFiles().stream().filter(files -> !files.getComments().isEmpty()).count(); if (numFilesWithComments == 0) { output.info("No sputnik comments"); return; } for (String message : review.getMessages()) { output.warn(message); } for (ReviewFile file : review.getFiles()) { if (file.getComments().isEmpty()) { continue; } output.warn(""); output.warn("{} comment(s) on {}", file.getComments().size(), file.getReviewFilename()); for (Comment comment : file.getComments()) { output.warn("Line {}: {}", comment.getLine(), comment.getMessage()); } } }
Source:
<code>public static File getChromeDriver() { Path resultPath; Platform current = getCurrent(); <START> if (current.is(WINDOWS)) { <END> resultPath = ROOT_TEST_PATH.resolve("chromedriver.exe"); } else if (current.is(MAC)) { resultPath = ROOT_TEST_PATH.resolve("chromedriver_mac"); } else { resultPath = ROOT_TEST_PATH.resolve("chromedriver_linux"); } return resultPath.toFile(); }</code><technical_language>switch () case ...: return here? this allow get rid of temporary variables</technical_language>

Target:
public static File getChromeDriver() { Platform current = getCurrent(); if (current.is(WINDOWS)) { return ROOT_TEST_PATH.resolve("chromedriver.exe").toFile(); } else if (current.is(MAC)) { return ROOT_TEST_PATH.resolve("chromedriver_mac").toFile(); } return ROOT_TEST_PATH.resolve("chromedriver_linux").toFile(); }
Source:
<code>private void attemptOnePassEncoding() { try { triggerFullWrite(); } catch (IOException e) { throw new SearchException( e ); } if ( nextBodyToEncodeIndex == bodyParts.size() ) { <START> hintContentLength( writer.buffer.contentSize() ); <END> } }</code><technical_language>awesome optimisation! Great idea</technical_language>

Target:
private void attemptOnePassEncoding() { try { triggerFullWrite(); } catch (IOException e) { throw new SearchException( e ); } if ( nextBodyToEncodeIndex == bodyParts.size() ) { hintContentLength( writer.bufferedContentSize() ); } }
Source:
<code>public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } Schema schema = (Schema)o; <START> return pathRegex.equals(schema.pathRegex); <END> }</code><technical_language>missing here? :)</technical_language>

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } Schema schema = (Schema)o; if ( !pathRegex.equals(schema.pathRegex) ) { return false; } return path.equals(schema.path); }
Source:
<code>default void inputDetail() { <START> optional(cluster()); <END> optional(clone()); optional(exclusive()); optional(vm().name()); or(optional(storageDomain().id()), optional(storageDomain().name())); optional(vm().diskAttachments()[COLLECTION].disk().format()); optional(vm().diskAttachments()[COLLECTION].id()); optional(vm().diskAttachments()[COLLECTION].disk().sparse()); }</code><technical_language>or(optional(cluster().id()), optional(cluster().name()));</technical_language>

Target:
default void inputDetail() { or(optional(cluster().id()), optional(cluster().name())); optional(clone()); optional(exclusive()); optional(vm().name()); or(optional(storageDomain().id()), optional(storageDomain().name())); optional(vm().diskAttachments()[COLLECTION].disk().format()); optional(vm().diskAttachments()[COLLECTION].id()); optional(vm().diskAttachments()[COLLECTION].disk().sparse()); }
Source:
<code>private static void appendBodyColorsRule(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { StringBuilder fg= new StringBuilder(); appendColor(fg, fgRGB); StringBuilder bg= new StringBuilder(); appendColor(bg, bgRGB); <START> buffer.append("body {color:" + fg.toString() + "; background-color:" + bg.toString() + ";}"); END> }</code><technical_language>I missing something. simply buffer.append("body {color:"); appendColor(buffer, fgRGB); buffer.append("; background-color:"); appendColor(buffer, bgRGB); buffer.append(";}");</technical_language>

Target:
private static void appendBodyColorsRule(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { StringBuilder fg= new StringBuilder(); appendColor(fg, fgRGB); StringBuilder bg= new StringBuilder(); appendColor(bg, bgRGB); buffer.append("body {color:"); appendColor(buffer, fgRGB); buffer.append("; background-color:"); appendColor(buffer, bgRGB); buffer.append(";}"); }
Source:
<code>private boolean isDuplicate(IndexEntry copyCandidate, FileSpan duplicateSearchSpan, Offset indexSegmentStartOffset, boolean checkAlreadyCopied) { try { boolean isDuplicate = false; IndexValue copyCandidateValue = copyCandidate.getValue(); if (duplicateSearchSpan != null && alreadyExists(srcIndex, duplicateSearchSpan, copyCandidate.getKey(), copyCandidateValue)) { logger.trace("Skipping the copying of in segment with start offset in - it already exists", copyCandidate, indexSegmentStartOffset, storeId); isDuplicate = true; } else if (checkAlreadyCopied && alreadyExists(tgtIndex, null, copyCandidate.getKey(), copyCandidateValue)) { logger.trace("Skipping the copying of in segment with start offset in - it has already been copied", copyCandidate, indexSegmentStartOffset, storeId); isDuplicate = true; } else { logger.trace( <START> "Adding index entry in index segment with start offset in because it does not already exist", <END> copyCandidate, indexSegmentStartOffset, storeId); } return isDuplicate; } catch (StoreException e) { throw new IllegalStateException(e); } }</code><technical_language>statements rephrased this method a check add anything</technical_language>

Target:
private boolean isDuplicate(IndexEntry copyCandidate, FileSpan duplicateSearchSpan, Offset indexSegmentStartOffset, boolean checkAlreadyCopied) { try { boolean isDuplicate = false; IndexValue copyCandidateValue = copyCandidate.getValue(); if (duplicateSearchSpan != null && alreadyExists(srcIndex, duplicateSearchSpan, copyCandidate.getKey(), copyCandidateValue)) { logger.trace("{} in segment with start offset in is a duplicate because it already exists in store", copyCandidate, indexSegmentStartOffset, storeId); isDuplicate = true; } else if (checkAlreadyCopied && alreadyExists(tgtIndex, null, copyCandidate.getKey(), copyCandidateValue)) { logger.trace("{} in segment with start offset in is a duplicate because it has already been copied", copyCandidate, indexSegmentStartOffset, storeId); isDuplicate = true; } else { logger.trace("{} in index segment with start offset in is not a duplicate", copyCandidate, indexSegmentStartOffset, storeId); } return isDuplicate; } catch (StoreException e) { throw new IllegalStateException(e); } }
Source:
<code><START> private FetchV2Request(@NonNull <END> List<ObjectId> peerHas, @NonNull TreeMap<String, ObjectId> wantedRefs, @NonNull Set<ObjectId> wantIds, @NonNull Set<ObjectId> clientShallowCommits, int deepenSince, @NonNull List<String> deepenNotRefs, int depth, long filterBlobLimit, boolean doneReceived, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); this.peerHas = peerHas; this.wantedRefs = wantedRefs; this.deepenSince = deepenSince; this.deepenNotRefs = deepenNotRefs; this.doneReceived = doneReceived; }</code><technical_language>likewise: package-private avoid a synthetic accessor</technical_language>

Target:
FetchV2Request(@NonNull List<ObjectId> peerHas, @NonNull TreeMap<String, ObjectId> wantedRefs, @NonNull Set<ObjectId> wantIds, @NonNull Set<ObjectId> clientShallowCommits, int deepenSince, @NonNull List<String> deepenNotRefs, int depth, long filterBlobLimit, boolean doneReceived, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); this.peerHas = Objects.requireNonNull(peerHas); this.wantedRefs = Objects.requireNonNull(wantedRefs); this.deepenSince = deepenSince; this.deepenNotRefs = Objects.requireNonNull(deepenNotRefs); this.doneReceived = doneReceived; }
Source:
<code>public static void prepare() throws Exception { IntegrationTestInitService.getInstance().init(); resource = new PushPublishFilterResource(); response = new MockHttpResponse(); <START> APILocator.getPublisherAPI().getFilterDescriptorMap().clear(); <END> filterKey = "filterTestAPI.yml"; createFilter(); }</code><technical_language>I suggest internal map is exposed offer methods need API (e.g. clearFileDescriptors())</technical_language>

Target:
public static void prepare() throws Exception { IntegrationTestInitService.getInstance().init(); resource = new PushPublishFilterResource(); response = new MockHttpResponse(); PublisherAPIImpl.class.cast(APILocator.getPublisherAPI()).getFilterDescriptorMap().clear(); filterKey = "filterTestAPI.yml"; createFilter(); }
Source:
<code>public void createPartControl(Composite parent) { super.createPartControl(parent); fTimeGraphViewer = new TimeGraphViewer(parent, SWT.NONE); fTimeGraphContentProvider = new FlameGraphContentProvider(); fPresentationProvider = new FlameGraphPresentationProvider(); fTimeGraphViewer.setTimeGraphContentProvider(fTimeGraphContentProvider); fTimeGraphViewer.setTimeGraphProvider(fPresentationProvider); IEditorPart editor = getSite().getPage().getActiveEditor(); if (editor instanceof ITmfTraceEditor) { ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace(); if (trace != null) { traceSelected(new TmfTraceSelectedSignal(this, trace)); } } contributeToActionBars(); loadSortOption(); getSite().setSelectionProvider(fTimeGraphViewer.getSelectionProvider()); createTimeEventContextMenu(); fTimeGraphViewer.getTimeGraphControl().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { <START> System.out.println(e); <END> TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl(); ISelection selection = timeGraphControl.getSelection(); if (selection instanceof IStructuredSelection) { for (Object object : ((IStructuredSelection) selection).toList()) { if (object instanceof FlamegraphEvent) { FlamegraphEvent event = (FlamegraphEvent) object; long startTime = event.getTime(); long endTime = startTime + event.getDuration(); getTimeGraphViewer().setStartFinishTime(startTime, endTime); break; } } } } }); }</code><technical_language>remove</technical_language>

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); fTimeGraphViewer = new TimeGraphViewer(parent, SWT.NONE); fTimeGraphContentProvider = new FlameGraphContentProvider(); fPresentationProvider = new FlameGraphPresentationProvider(); fTimeGraphViewer.setTimeGraphContentProvider(fTimeGraphContentProvider); fTimeGraphViewer.setTimeGraphProvider(fPresentationProvider); IEditorPart editor = getSite().getPage().getActiveEditor(); if (editor instanceof ITmfTraceEditor) { ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace(); if (trace != null) { traceSelected(new TmfTraceSelectedSignal(this, trace)); } } contributeToActionBars(); loadSortOption(); getSite().setSelectionProvider(fTimeGraphViewer.getSelectionProvider()); createTimeEventContextMenu(); fTimeGraphViewer.getTimeGraphControl().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl(); ISelection selection = timeGraphControl.getSelection(); if (selection instanceof IStructuredSelection) { for (Object object : ((IStructuredSelection) selection).toList()) { if (object instanceof FlamegraphEvent) { FlamegraphEvent event = (FlamegraphEvent) object; long startTime = event.getTime(); long endTime = startTime + event.getDuration(); getTimeGraphViewer().setStartFinishTime(startTime, endTime); break; } } } } }); }
Source:
<code>public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int groupCount, RelNode input, RelDataType type, String name) { <START> distinct = aggFunction.getDistinctOptionality() != Optionality.IGNORED && distinct; <END> return create(aggFunction, distinct, false, false, argList, -1, RelCollations.EMPTY, groupCount, input, type, name); }</code><technical_language>move this common logic a method more readable</technical_language>

Target:
public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int groupCount, RelNode input, RelDataType type, String name) { return create(aggFunction, distinct, false, false, argList, -1, RelCollations.EMPTY, groupCount, input, type, name); }
Source:
<code>public static void writeObjectIntoJsonFormat(Object obj, Path outputFile) { String objectInJson = new Gson().toJson(obj); try { writeOutputFile(objectInJson, outputFile); } catch (IOException ex) { <START> Logger.getLogger(JsonWriter.class.getName()).log(Level.SEVERE, null, ex); <END> } }</code><technical_language>Bad idea rethrow exceptions in a generic helper this. I necessary log exception - handles final exception do logging</technical_language>

Target:
public static void writeObjectIntoJsonFormat(Object obj, Path outputFile) throws IOException { FileWriter writer = new FileWriter(outputFile.toAbsolutePath().toFile()); writer.write(new Gson().toJson(obj)); writer.close(); }
Source:
<code>for (int i = 0; i < STATE_TABLE.length; i++) { State state = State.values()[i]; float heightFactor = 1.0f; if (state.equals(State.NETWORK_ARROW)) { networkArrowIndex = i; heightFactor = 0.1f; } else if (state.equals(State.UNKNOWN_ARROW)) { unknownNetworkIndex = i; heightFactor = 0.1f; } RGB stateColor = state.rgb; String stateType = state.equals(State.NETWORK_ARROW) || state.equals(State.UNKNOWN_ARROW) ? ITimeEventStyleStrings.linkType() : ITimeEventStyleStrings.stateType(); ImmutableMap<String, Object> styleMap = ImmutableMap.of( StyleProperties.BACKGROUND_COLOR, <START> X11ColorUtils.toHexColor(stateColor.red, <END> stateColor.green, stateColor.blue), StyleProperties.STYLE_NAME, String.valueOf(state.toString()), StyleProperties.HEIGHT, heightFactor, ITimeEventStyleStrings.itemTypeProperty(), stateType); STATE_TABLE[i] = new StateItem(styleMap); }</code><technical_language>ColorUtils</technical_language>

Target:
for (int i = 0; i < STATE_TABLE.length; i++) { State state = State.values()[i]; float heightFactor = 1.0f; if (state.equals(State.NETWORK_ARROW)) { networkArrowIndex = i; heightFactor = 0.1f; } else if (state.equals(State.UNKNOWN_ARROW)) { unknownNetworkIndex = i; heightFactor = 0.1f; } RGB stateColor = state.rgb; String stateType = state.equals(State.NETWORK_ARROW) || state.equals(State.UNKNOWN_ARROW) ? ITimeEventStyleStrings.linkType() : ITimeEventStyleStrings.stateType(); ImmutableMap<String, Object> styleMap = ImmutableMap.of( StyleProperties.BACKGROUND_COLOR, ColorUtils.toHexColor(stateColor.red, stateColor.green, stateColor.blue), StyleProperties.STYLE_NAME, String.valueOf(state.toString()), StyleProperties.HEIGHT, heightFactor, ITimeEventStyleStrings.itemTypeProperty(), stateType); STATE_TABLE[i] = new StateItem(styleMap); }
Source:
<code>private void readAmount(int numChars) throws IOException { int bytesRead = is.read(buffer, end, Math.min(numChars, buffer.length - end)); if (bytesRead < 0) { <START> throw new IOException(String.format("Reached end of stream.")); <END> } end = end + bytesRead; }</code><technical_language>a raw string need for String.format</technical_language>

Target:
private void readAmount(int numChars) throws IOException { int bytesRead = reader.read(buffer, end, Math.min(numChars, buffer.length - end)); if (bytesRead < 0) { throw new IOException("Reached end of stream."); } end = end + bytesRead; }
Source:
<code>protected boolean useDirectReplyTo() { if (this.useTemporaryReplyQueues) { if (this.replyAddress != null) { logger.warn("'useTemporaryReplyQueues' is ignored when a 'replyAddress' is provided"); } else { return false; } } if (this.replyAddress == null || Address.AMQ_RABBITMQ_REPLY_TO.equals(this.replyAddress)) { try { return execute(channel -> { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return true; }); } catch (AmqpConnectException | AmqpIOException ex) { Throwable cause = ex; while (cause != null && !(cause instanceof ShutdownSignalException)) { cause = cause.getCause(); } if (cause instanceof ShutdownSignalException) { if (RabbitUtils.isPassiveDeclarationChannelClose((ShutdownSignalException) cause)) { if (logger.isDebugEnabled()) { <START> logger.warn("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " <END> + "queues will be used:" + ex.getMessage() + "."); } this.replyAddress = null; return false; } } if (logger.isDebugEnabled()) { logger.debug("IO error, deferring directReplyTo detection"); } throw ex; } } return false; }</code><technical_language>isDebugEnabled(), a warn(). Is expectable</technical_language>

Target:
protected boolean useDirectReplyTo() { if (this.useTemporaryReplyQueues) { if (this.replyAddress != null) { logger.warn("'useTemporaryReplyQueues' is ignored when a 'replyAddress' is provided"); } else { return false; } } if (this.replyAddress == null || Address.AMQ_RABBITMQ_REPLY_TO.equals(this.replyAddress)) { try { return execute(channel -> { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return true; }); } catch (AmqpConnectException | AmqpIOException ex) { Throwable cause = ex; while (cause != null && !(cause instanceof ShutdownSignalException)) { cause = cause.getCause(); } if (cause instanceof ShutdownSignalException) { if (RabbitUtils.isPassiveDeclarationChannelClose((ShutdownSignalException) cause)) { if (logger.isWarnEnabled()) { logger.warn("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used: " + cause.getMessage() + "."); } this.replyAddress = null; return false; } } if (logger.isDebugEnabled()) { logger.debug("IO error, deferring directReplyTo detection: " + ex.toString()); } throw ex; } } return false; }
Source:
<code>protected void handleMessage(ClientConnection conn, ContextImpl context, ChannelHandlerContext chctx, Object msg) throws Exception { if (msg instanceof HttpObject) { HttpObject obj = (HttpObject) msg; DecoderResult result = obj.decoderResult(); if (result.isFailure()) { conn.handleException(result.cause()); conn.close(); return; } if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) obj; conn.handleResponse(response); return; } if (msg instanceof HttpContent) { HttpContent chunk = (HttpContent) obj; if (chunk.content().isReadable()) { Buffer buff = Buffer.buffer(chunk.content().slice()); conn.handleResponseChunk(buff); } if (chunk instanceof LastHttpContent) { conn.handleResponseEnd((LastHttpContent) chunk); } return; } } else if (msg instanceof WebSocketFrameInternal) { WebSocketFrameInternal frame = (WebSocketFrameInternal) msg; switch (frame.type()) { case BINARY: case CONTINUATION: case TEXT: case PONG: <START> conn.handleWsFrame(frame); <END> break; case PING: WebSocketFrameImpl pong = new WebSocketFrameImpl(FrameType.PONG, frame.getBinaryData()); conn.reportBytesWritten(pong.binaryData().length()); conn.writeToChannel(pong); break; case CLOSE: if (!closeFrameSent) { chctx.writeAndFlush(frame).addListener(ChannelFutureListener.CLOSE); closeFrameSent = true; } break; default: throw new IllegalStateException("Invalid type: " + frame.type()); } return; } throw new IllegalStateException("Invalid object " + msg); }</code><technical_language>no, case is for websocket is payload, need receive specific data, in general application is interested receive ping (as response a pong). is interested send ping check if connection is alive</technical_language>

Target:
protected void handleMessage(ClientConnection conn, ContextImpl context, ChannelHandlerContext chctx, Object msg) throws Exception { if (msg instanceof HttpObject) { HttpObject obj = (HttpObject) msg; DecoderResult result = obj.decoderResult(); if (result.isFailure()) { conn.handleException(result.cause()); conn.close(); return; } if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) obj; conn.handleResponse(response); return; } if (msg instanceof HttpContent) { HttpContent chunk = (HttpContent) obj; if (chunk.content().isReadable()) { Buffer buff = Buffer.buffer(chunk.content().slice()); conn.handleResponseChunk(buff); } if (chunk instanceof LastHttpContent) { conn.handleResponseEnd((LastHttpContent) chunk); } return; } } else if (msg instanceof WebSocketFrameInternal) { WebSocketFrameInternal frame = (WebSocketFrameInternal) msg; switch (frame.type()) { case BINARY: case CONTINUATION: case TEXT: case PONG: conn.handleWsFrame(frame); break; case PING: chctx.writeAndFlush(new PongWebSocketFrame(frame.getBinaryData().copy())); break; case CLOSE: if (!closeFrameSent) { chctx.writeAndFlush(frame).addListener(ChannelFutureListener.CLOSE); closeFrameSent = true; } break; default: throw new IllegalStateException("Invalid type: " + frame.type()); } return; } throw new IllegalStateException("Invalid object " + msg); }
Source:
<code>public String toValue(String string, INode node) throws ValueConverterException { <START> String result = ""; <END> if (string.split(".").length > 0) { for (String str : string.split(".")) { String partResult = idValueConverter.toValue(str, node); result = reassembleString(string, result, str, partResult); } } else { result = idValueConverter.toValue(string, node); } return result; }</code><technical_language>QualifiedName</technical_language>

Target:
public String toValue(String string, INode node) throws ValueConverterException { QualifiedName name = converter.toQualifiedName(string); QualifiedName result = QualifiedName.EMPTY; for(String str : name.getSegments()){ result = result.append(idValueConverter.toValue(str, node)); } return result.toString(); }
Source:
<code>public CompletableFuture<Map<K, V>> getAllAsync(List<K> keys) { readMetrics.numGetAlls.inc(); Map<K, V> getAllResult = new HashMap<>(cache.getAll(keys)); List<K> missingKeys = lookupCache(keys, getAllResult); if (missingKeys.isEmpty()) { return CompletableFuture.completedFuture(getAllResult); <START> } <END> long startNs = System.nanoTime(); return rdTable.getAllAsync(missingKeys).handle((records, e) -> { if (e != null) { throw new SamzaException("Failed to get records for " + keys, e); } else { if (records != null) { cache.putAll(records.entrySet().stream() .map(r -> new Entry<>(r.getKey(), r.getValue())) .collect(Collectors.toList())); getAllResult.putAll(records); } readMetrics.getAllNs.update(System.nanoTime() - startNs); return getAllResult; } }); }</code><technical_language>getAll time include cache lookup? is captured elsewhere</technical_language>

Target:
public CompletableFuture<Map<K, V>> getAllAsync(List<K> keys) { readMetrics.numGetAlls.inc(); Map<K, V> getAllResult = new HashMap<>(); List<K> missingKeys = lookupCache(keys, getAllResult); if (missingKeys.isEmpty()) { return CompletableFuture.completedFuture(getAllResult); } long startNs = System.nanoTime(); return rdTable.getAllAsync(missingKeys).handle((records, e) -> { if (e != null) { throw new SamzaException("Failed to get records for " + keys, e); } else { if (records != null) { cache.putAll(records.entrySet().stream() .map(r -> new Entry<>(r.getKey(), r.getValue())) .collect(Collectors.toList())); getAllResult.putAll(records); } readMetrics.getAllNs.update(System.nanoTime() - startNs); return getAllResult; } }); }
Source:
<code>protected InputStream getInputStream(Path path) throws IOException { InputStream stream = null; for (; ; ) { try { stream = createFileInputStream(path); } catch (FileNotFoundException e) { if (e.getMessage().endsWith("(Interrupted system call)")) { continue; } else { throw e; } } catch (AccessDeniedException e) { throw new IOException(e.getMessage() + " (Permission denied)", e); } break; } byte[] buf = new byte[1]; int buflen = 0; try { buflen = stream.read(buf, 0, 1); } catch (IOException e) { if (e.getMessage().equals("Is a directory")) { <START> throw new IOException(path.toString() + " (Is a directory)", e); <END> } throw e; } return new SequenceInputStream(new ByteArrayInputStream(buf, 0, buflen), stream); }</code><technical_language>throw e;? (granted, this a slightly nicer stack trace)</technical_language>

Target:
protected InputStream getInputStream(Path path) throws IOException { for (; ; ) { try { return createMaybeProfiledInputStream(path); } catch (FileNotFoundException e) { if (e.getMessage().endsWith("(Interrupted system call)")) { continue; } else { throw e; } } } }
Source:
<code>public static void getAdditionalDeviceImageList(AsyncQuery<List<String>> aQuery, Guid storagePoolId, int osId, Version clusterVersion) { <START> AsyncDataProvider.isFloppySupported(new AsyncQuery<>(isFloppySupported -> { <END> if (isFloppySupported) { getIrsImageList(aQuery, storagePoolId, false, ImageFileType.Floppy, new RepoImageToImageFileNameAsyncConverter()); } }), osId, clusterVersion); }</code><technical_language>move this call calling method RunOnceModel::updateFloppyImages ? strange a method called 'get' calls callback if floppy is supported</technical_language>

Target:
public static void getAdditionalDeviceImageList(AsyncQuery<List<String>> aQuery, Guid storagePoolId, int osId, Version clusterVersion) { getIrsImageList(aQuery, storagePoolId, false, ImageFileType.Floppy, new RepoImageToImageFileNameAsyncConverter()); }
Source:
<code>private void ensureSize(int index) { List<@Nullable IEventDeclaration> list = fEvents; if (list instanceof ArrayList) { if (index > 50000) { fEvents = new SparseList(fEvents); } <START> ((ArrayList<@Nullable IEventDeclaration>) list).ensureCapacity(index); <END> while (list.size() <= index) { list.add(null); } } }</code><technical_language>Do care list if replaced a SparseList</technical_language>

Target:
private void ensureSize(int index) { List<@Nullable IEventDeclaration> list = fEvents; if (list instanceof ArrayList) { if (index > 50000) { fEvents = new SparseList(fEvents); return; } ((ArrayList<@Nullable IEventDeclaration>) list).ensureCapacity(index); while (list.size() <= index) { list.add(null); } } }
Source:
<code>public void testSubmit() throws Exception { Service service = connect(); String indexName = temporaryName(); <START> Integer tcpPort = 10000; <END> while (service.getInputs().containsKey(tcpPort.toString())) { tcpPort += 1; } Index index = null; TcpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(tcpPort.toString(), InputKind.Tcp, args); int nEvents = index.getTotalEventCount(); input.submit(getTimestamp() + " Boris the mad baboon!\r\n"); int nTries = 50; while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }</code><technical_language>Extract 4 lines of a common method findUnusedTcpPort? Also, a good reason Integer, int better</technical_language>

Target:
public void testSubmit() throws Exception { Service service = connect(); String indexName = temporaryName(); int tcpPort = findNextUnusedTcpPort(service, 10000); Index index = null; TcpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(String.valueOf(tcpPort), InputKind.Tcp, args); int nEvents = index.getTotalEventCount(); input.submit(createTimestamp() + " Boris the mad baboon!\r\n"); int nTries = 50; while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }
Source:
<code>public void visitNode(Tree tree) { VariableTree varTree = (VariableTree) tree; int varLineCurrent = varTree.endToken().line(); if (varLineCurrent == varLineLast) { varsOnSameLine.add(varTree.symbol().name()); } else { if (!varsOnSameLine.isEmpty()) { <START> addIssue(varLineLast, String.format("Declare \"%s\" on a separate line.", StringUtils.join(varsOnSameLine, "\", \""))); <END> } varLineLast = varLineCurrent; varsOnSameLine.clear(); } }</code><technical_language>approach miss some cases, in case of variable declaration. For instance, current implementation, miss issue in code: java class A { int a; // Compliant int b, c; // Noncompliant detected int d, e; // Noncompliant detected }</technical_language>

Target:
public void visitNode(Tree tree) { if (tree instanceof ClassTree) { for (Tree member : ((ClassTree) tree).members()) { if (member.is(Tree.Kind.VARIABLE)) { checkVariable((VariableTree) member); } } } if (tree instanceof BlockTree) { for (StatementTree statment : ((BlockTree) tree).body()) { if (statment.is(Tree.Kind.VARIABLE)) { checkVariable((VariableTree) statment); } } } }
Source:
<code><START> public Vote[] getPredictionVotes() { <END> Attribute classAttribute = this.lastSeenInstance.dataset().classAttribute(); double trueValue = this.lastSeenInstance.classValue(); List<String> classAttributeValues = classAttribute.getAttributeValues(); int trueNominalIndex = (int) trueValue; String trueNominalValue = classAttributeValues.get(trueNominalIndex); Vote[] votes = new Vote[classAttributeValues.size() + 3]; votes[0] = new Vote("instance number", this.instanceIdentifier); votes[1] = new Vote("true class value", trueNominalValue); votes[2] = new Vote("predicted class value", classAttributeValues.get(Utils.maxIndex(classVotes))); for (int i = 0; i < classAttributeValues.size(); i++) { if (i < classVotes.length) { votes[3 + i] = new Vote("votes_" + classAttributeValues.get(i), classVotes[i], 10); } else { votes[3 + i] = new Vote("votes_" + classAttributeValues.get(i), 0); } } return votes; }</code><technical_language>This a lot of object creation. reuse some of objects</technical_language>

Target:
public Vote[] getPredictionVotes() { Attribute classAttribute = this.lastSeenInstance.dataset().classAttribute(); double trueValue = this.lastSeenInstance.classValue(); List<String> classAttributeValues = classAttribute.getAttributeValues(); int trueNominalIndex = (int) trueValue; String trueNominalValue = classAttributeValues.get(trueNominalIndex); if (votes == null) { this.votes = new Vote[classAttributeValues.size() + 3]; votes[0] = new Vote("instance number"); votes[1] = new Vote("true class value"); votes[2] = new Vote("predicted class value"); for (int i = 0; i < classAttributeValues.size(); i++) { votes[3 + i] = new Vote("votes_" + classAttributeValues.get(i)); } } votes[0].setValue(this.instanceIdentifier); votes[1].setValue(trueNominalValue); votes[2].setValue(classAttributeValues.get(Utils.maxIndex(classVotes))); for (int i = 0; i < classAttributeValues.size(); i++) { if (i < classVotes.length) { votes[3 + i].setValue(classVotes[i], this.DECIMAL_PLACES); } else { votes[3 + i].setValue(this.NO_VOTE_FOR_CLASS, 0); } } return votes; }
Source:
<code>private CommandResponse executeSimpleCommandWithResponse(String command, boolean sensitive) throws IOException, MessagingException { <START> List<String> results = new ArrayList<String>(); <END> if (command != null) { writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; String message = line; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } if (length > 4) { message = line.substring(4); } else { message = ""; } } char c = line.charAt(0); if ((c == '4') || (c == '5')) { throw new NegativeSmtpReplyException(replyCode, message); } return new CommandResponse(replyCode, message); }</code><technical_language>diamond operator~</technical_language>

Target:
private CommandResponse executeSimpleCommandWithResponse(String command, boolean sensitive) throws IOException, MessagingException { List<String> results = new ArrayList<>(); if (command != null) { writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; String message = line; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } if (length > 4) { message = line.substring(4); } else { message = ""; } } char c = line.charAt(0); if ((c == '4') || (c == '5')) { throw new NegativeSmtpReplyException(replyCode, message); } return new CommandResponse(replyCode, message); }
Source:
<code>public void testServerEnvElements() throws Exception { File in = new File(CONFIG_XML); FileInputStream input = new FileInputStream(in); DocumentBuilderFactory inputBuilderFactory = DocumentBuilderFactory.newInstance(); inputBuilderFactory.setIgnoringComments(true); inputBuilderFactory.setCoalescing(true); inputBuilderFactory.setIgnoringElementContentWhitespace(true); inputBuilderFactory.setValidating(false); DocumentBuilder inputBuilder = inputBuilderFactory.newDocumentBuilder(); Document inputDoc = inputBuilder.parse(input); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/liberty-plugin-config/serverEnv/text()"; String nodeValue = (String) xPath.compile(expression).evaluate(inputDoc, XPathConstants.STRING); File f1 = new File(SOURCE_SERVER_ENV); File f2 = new File(nodeValue); Assert.assertEquals("serverEnv value", f1.getAbsolutePath(), f2.getAbsolutePath()); <START> Assert.assertEquals("verify target server server.env", FileUtils.fileRead(f2), <END> FileUtils.fileRead(TARGET_SERVER_ENV)); }</code><technical_language>If import static org.junit.Assert.*; reference static methods Assert class class in field is defined. I for cleaner test code</technical_language>

Target:
public void testServerEnvElements() throws Exception { File in = new File(CONFIG_XML); FileInputStream input = new FileInputStream(in); DocumentBuilderFactory inputBuilderFactory = DocumentBuilderFactory.newInstance(); inputBuilderFactory.setIgnoringComments(true); inputBuilderFactory.setCoalescing(true); inputBuilderFactory.setIgnoringElementContentWhitespace(true); inputBuilderFactory.setValidating(false); DocumentBuilder inputBuilder = inputBuilderFactory.newDocumentBuilder(); Document inputDoc = inputBuilder.parse(input); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/liberty-plugin-config/serverEnv/text()"; String nodeValue = (String) xPath.compile(expression).evaluate(inputDoc, XPathConstants.STRING); File f1 = new File(SOURCE_SERVER_ENV); File f2 = new File(nodeValue); assertEquals("serverEnv value", f1.getAbsolutePath(), f2.getAbsolutePath()); assertEquals("verify target server server.env", FileUtils.fileRead(f2), FileUtils.fileRead(TARGET_SERVER_ENV)); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { mAppWidgetId = extras.getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId)); if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); return; } if (!AccountHelper.isSignedIn()) { ToastUtils.showToast(getBaseContext(), R.string.stats_widget_error_no_account, ToastUtils.Duration.LONG); finish(); return; } List<Map<String, Object>> accounts = WordPress.wpDB.getBlogsBy("isHidden = 0", null); if (accounts.size() == 0) { ToastUtils.showToast(getBaseContext(), R.string.stats_widget_error_no_visible_blog, ToastUtils.Duration.LONG); finish(); return; } if (accounts.size() == 1) { Map<String, Object> account = accounts.get(0); Integer localID = (Integer) account.get("id"); addWidgetToScreenAndFinish(localID); return; } <START> setContentView(R.layout.site_picker_activity); <END> final boolean isInSearchMode = false; String lastSearch = ""; setNewAdapter(lastSearch, isInSearchMode); setupActionBar(); setupRecycleView(); }</code><technical_language>Reusing site picker layout is problems road. easily add site picker layout sense here. for reusing site picker adapter intended for site picker. a approach site picker activity itself, hide features (like search) needed here</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { mAppWidgetId = extras.getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId)); if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); return; } if (!AccountHelper.isSignedIn()) { ToastUtils.showToast(getBaseContext(), R.string.stats_widget_error_no_account, ToastUtils.Duration.LONG); finish(); return; } List<Map<String, Object>> accounts = WordPress.wpDB.getBlogsBy("isHidden = 0", null); if (accounts.size() == 0) { ToastUtils.showToast(getBaseContext(), R.string.stats_widget_error_no_visible_blog, ToastUtils.Duration.LONG); finish(); return; } if (accounts.size() == 1) { Map<String, Object> account = accounts.get(0); Integer localID = (Integer) account.get("id"); addWidgetToScreenAndFinish(localID); return; } setContentView(R.layout.stats_widget_config_activity); setNewAdapter(); setupActionBar(); setupRecycleView(); }
Source:
<code>public BlobAsyncClient buildBlobAsyncClient() { <START> Objects.requireNonNull(containerName); <END> Objects.requireNonNull(blobName); HttpPipeline pipeline = super.getPipeline(); if (pipeline == null) { pipeline = super.buildPipeline(); } return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s/%s/%s", endpoint, containerName, blobName)) .pipeline(pipeline) .build(), snapshot, cpk); }</code><technical_language>Add a message. it, get a NullPointerException message. ie. "'containerName' null." another usages of this</technical_language>

Target:
public BlobAsyncClient buildBlobAsyncClient() { Objects.requireNonNull(containerName, "'containerName' cannot be null."); Objects.requireNonNull(blobName, "'blobName' cannot be null."); HttpPipeline pipeline = super.getPipeline(); if (pipeline == null) { pipeline = super.buildPipeline(); } return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s/%s/%s", endpoint, containerName, blobName)) .pipeline(pipeline) .build(), snapshot, customerProvidedKey); }
Source:
<code>private Map<String, IPath> importAsBinary(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { try { <START> SubMonitor subMonitor = SubMonitor.convert(monitor, "", 4); END> File srcFile = new File(model.getInstallLocation()); if (isJARd(model)) { PluginImportHelper.copyArchive(srcFile, project.getFile(srcFile.getName()), subMonitor.newChild(1)); } else { PluginImportHelper.importContent(new File(model.getInstallLocation()), project.getFullPath(), FileSystemStructureProvider.INSTANCE, null, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; } finally { monitor.done(); } }</code><technical_language>2-argument constructor</technical_language>

Target:
private Map<String, IPath> importAsBinary(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 4); File srcFile = new File(model.getInstallLocation()); if (isJARd(model)) { PluginImportHelper.copyArchive(srcFile, project.getFile(srcFile.getName()), subMonitor.newChild(1)); } else { PluginImportHelper.importContent(new File(model.getInstallLocation()), project.getFullPath(), FileSystemStructureProvider.INSTANCE, null, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; }
Source:
<code>public Issue getIssue(final PullRequest pullRequest) throws NotFoundException, MalformedURLException { <START> Objects.requireNonNull(pullRequest, "url cannot be null"); <END> checkIssueTrackerExists(); final String body = pullRequest.getBody(); final String[] url = extractURLs(body, ISSUE, false); if (url == null || url.length == 0 || url[0] == null) return null; else return getIssue(new URL(url[0])); }</code><technical_language>incorrect message "url null"</technical_language>

Target:
public Issue getIssue(final PullRequest pullRequest) throws NotFoundException, MalformedURLException { Objects.requireNonNull(pullRequest, "pull request cannot be null"); checkIssueTrackerExists(); final String body = pullRequest.getBody(); final String[] url = extractURLs(body, ISSUE, false); if (url == null || url.length == 0 || url[0] == null) return null; else return getIssue(new URL(url[0])); }
Source:
<code>EWAHCompressedBitmap getBitmap() { Object r = bitmapContainer; if (r instanceof EWAHCompressedBitmap) return (EWAHCompressedBitmap) r; XorCompressedBitmap xb = (XorCompressedBitmap) r; EWAHCompressedBitmap out = xb.bitmap; <START> while (true) { <END> r = xb.xorBitmap.bitmapContainer; if (r instanceof EWAHCompressedBitmap) { bitmapContainer = out = out.xor((EWAHCompressedBitmap) r); return out; } xb = (XorCompressedBitmap) r; out = out.xor(xb.bitmap); } }</code><technical_language>nit: jgit spells this for (;;)</technical_language>

Target:
EWAHCompressedBitmap getBitmap() { Object r = bitmapContainer; if (r instanceof EWAHCompressedBitmap) return (EWAHCompressedBitmap) r; XorCompressedBitmap xb = (XorCompressedBitmap) r; EWAHCompressedBitmap out = xb.bitmap; for (;;) { r = xb.xorBitmap.bitmapContainer; if (r instanceof EWAHCompressedBitmap) { out = out.xor((EWAHCompressedBitmap) r); bitmapContainer = out; return out; } xb = (XorCompressedBitmap) r; out = out.xor(xb.bitmap); } }
Source:
<code><START> private RbAclAccessRolesProvider getAccessRolesProvider() { <END> return accessRolesProvider; }</code><technical_language>Revert this change</technical_language>

Target:
private AccessRolesProvider getAccessRolesProvider() { return accessRolesProvider; }
Source:
<code>public void handleLightStatus(StateResponse packet) { DecimalType hue = new DecimalType(packet.getHue() * 360 / 65535.0f); PercentType saturation = new PercentType(Math.round((packet.getSaturation() / 65535.0f) * 100)); PercentType brightness = new PercentType(Math.round((packet.getBrightness() / 65535.0f) * 100)); DecimalType temperature = new DecimalType(packet.getKelvin()); currentColorState = new HSBType(hue, saturation, brightness); currentPowerState = packet.getPower(); currentTempState = temperature; if (currentPowerState == PowerState.OFF) { <START> updateState(CHANNEL_COLOR, OnOffType.OFF); <END> } else if (currentColorState != null) { updateState(CHANNEL_COLOR, currentColorState); } else { updateState(CHANNEL_COLOR, OnOffType.ON); } updateState(CHANNEL_TEMPERATURE, temperature); updateStatus(ThingStatus.ONLINE); }</code><technical_language>set HSBType states - currentColorState set brightness 0</technical_language>

Target:
public void handleLightStatus(StateResponse packet) { DecimalType hue = new DecimalType(packet.getHue() * 360 / 65535.0f); PercentType saturation = new PercentType(Math.round((packet.getSaturation() / 65535.0f) * 100)); PercentType brightness = new PercentType(Math.round((packet.getBrightness() / 65535.0f) * 100)); PercentType temperature = new PercentType(toPercent(packet.getKelvin())); currentColorState = new HSBType(hue, saturation, brightness); currentPowerState = packet.getPower(); currentTempState = temperature; if (currentPowerState == PowerState.OFF) { updateState(CHANNEL_COLOR, new HSBType(hue, saturation, PercentType.ZERO)); updateState(CHANNEL_BRIGHTNESS, PercentType.ZERO); } else if (currentColorState != null) { updateState(CHANNEL_COLOR, currentColorState); updateState(CHANNEL_BRIGHTNESS, currentColorState.getBrightness()); } else { updateState(CHANNEL_COLOR, new HSBType(hue, saturation, PercentType.HUNDRED)); updateState(CHANNEL_BRIGHTNESS, PercentType.HUNDRED); } updateState(CHANNEL_TEMPERATURE, temperature); updateStatus(ThingStatus.ONLINE); }
Source:
<code>private void checkAccess(Run<?, ?> run, KubernetesCloud kubernetesCloud) throws AbortException { if(kubernetesCloud.isUsageRestricted()) { Job<?, ?> job = run.getParent(); LOGGER.info("Job:" + job); LOGGER.info("JobStr: " + ReflectionToStringBuilder.toString(job)); ItemGroup<?> parent = job.getParent(); Set<String> allowedClouds = new HashSet<>(); <START> if(parent instanceof Folder) { <END> Folder folder = (Folder) parent; LOGGER.info("Job in Folder: " + folder.getName()); collectAllowedClouds(allowedClouds, folder); } else { LOGGER.info("Job not associated with Folder"); } if(! allowedClouds.contains(kubernetesCloud.name)) { throw new AbortException(String.format("Not authorized to use Kubernetes cloud: %s", step.getCloud())); } LOGGER.fine("Verification succeeded for cloud: " + step.getCloud()); } }</code><technical_language>AbstractFolder is a check Folder</technical_language>

Target:
private void checkAccess(Run<?, ?> run, KubernetesCloud kubernetesCloud) throws AbortException { Job<?, ?> job = run.getParent(); ItemGroup<?> parent = job.getParent(); Set<String> allowedClouds = new HashSet<>(); KubernetesFolderProperty.collectAllowedClouds(allowedClouds, parent); if (!allowedClouds.contains(kubernetesCloud.name)) { throw new AbortException(String.format("Not authorized to use Kubernetes cloud: %s", step.getCloud())); } }
Source:
<code>public void testAddIncompleteParameters() throws Exception { Cluster model = new Cluster(); model.setName(NAMES[0]); setUriInfo(setUpBasicUriExpectations()); control.replay(); try { collection.add(model); fail("expected WebApplicationException on incomplete parameters"); } catch (WebApplicationException wae) { <START> verifyIncompleteException(wae, "Cluster", "add", "dataCenter.name|id"); <END> } }</code><technical_language>need supply "dataCenter.name|id"</technical_language>

Target:
public void testAddIncompleteParameters() throws Exception { Cluster model = new Cluster(); setUriInfo(setUpBasicUriExpectations()); control.replay(); try { collection.add(model); fail("expected WebApplicationException on incomplete parameters"); } catch (WebApplicationException wae) { verifyIncompleteException(wae, "Cluster", "add", "name"); } }