auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( "Failed to run compensation on startup for Command '{}', Command Id '{}': {}", commandSnapshot.getValue(), commandSnapshot.getKey(), ExceptionUtils.getMessage(e)); <START> log.debug("Exception", e); <END> } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }</code><technical_language>a good idea log this in debug... i leave in error, this engine start, change state in db, easily reproduced, info can</technical_language>

Target:
private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( "Failed to run compensation on startup for Command '{}', Command Id '{}': {}", commandSnapshot.getValue(), commandSnapshot.getKey(), e.getMessage()); log.error("Exception", e); } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }
Source:
<code>public Point3D(double x, double y) { <START> this(x, y, 0); <END> }</code><technical_language>please revert this be? <LINK_0> a tiny tiny optimization</technical_language>

Target:
public Point3D(double x, double y) { this.x = x; this.y = y; this.z = 0; }
Source:
<code>void testPublicationOrderIsMaintained_AggregateAdded() { String aggregateId = UUID.randomUUID().toString(); GenericDomainEventMessage<StubAggregateCreatedEvent> event = <START> new GenericDomainEventMessage<>("StubAggregate", aggregateId, 0, new StubAggregateCreatedEvent(aggregateId)); <END> when(eventStore.readEvents(aggregateId)).thenReturn(DomainEventStream.of(event)); doAnswer(invocation -> { System.out.println("Published event: " + invocation.getArguments()[0].toString()); return Void.class; }).when(eventStore).publish(isA(EventMessage.class)); commandBus.dispatch(asCommandMessage(new UpdateStubAggregateWithExtraEventCommand(aggregateId))); InOrder inOrder = inOrder(eventStore, eventStore, eventStore); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); inOrder.verify(eventStore).publish(argThat(new NotADomainEventMatcher())); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); }</code><technical_language>this test work changes? If so, I suggest this change. If not, a compatibility issue</technical_language>

Target:
void testPublicationOrderIsMaintained_AggregateAdded() { String aggregateId = UUID.randomUUID().toString(); GenericDomainEventMessage<StubAggregateCreatedEvent> event = new GenericDomainEventMessage<>("test", aggregateId, 0, new StubAggregateCreatedEvent(aggregateId)); when(eventStore.readEvents(aggregateId)).thenReturn(DomainEventStream.of(event)); doAnswer(invocation -> { System.out.println("Published event: " + invocation.getArguments()[0].toString()); return Void.class; }).when(eventStore).publish(isA(EventMessage.class)); commandBus.dispatch(asCommandMessage(new UpdateStubAggregateWithExtraEventCommand(aggregateId))); InOrder inOrder = inOrder(eventStore, eventStore, eventStore); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); inOrder.verify(eventStore).publish(argThat(new NotADomainEventMatcher())); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); }
Source:
<code>public static int getPartitions(byte[] table, List<Partition> partitions, boolean refresh) throws StandardException { Partition root = null; try { root = SIDriver.driver().getTableFactory().getTable(table); partitions.addAll(root.subPartitions(refresh)); return partitions.size(); } catch (Exception ioe) { throw StandardException.plainWrapException(ioe); } finally { try { if (root != null) <START> root.close(); <END> } catch (IOException e) { } } }</code><technical_language>rewrite this try-with-resources block</technical_language>

Target:
public static int getPartitions(byte[] table, List<Partition> partitions, boolean refresh) throws StandardException { try (Partition root = SIDriver.driver().getTableFactory().getTable(table)) { partitions.addAll(root.subPartitions(refresh)); return partitions.size(); } catch (Exception ioe) { throw StandardException.plainWrapException(ioe); } }
Source:
<code>public ArchiveContentEncodingDetector(String extension) { <START> Assert.isNotNull(extension, "Extension can not be null"); <END> this.extension = extension; }</code><technical_language>extension empty /</technical_language>

Target:
public ArchiveContentEncodingDetector(String extension) { Assert.isLegal(extension != null && !extension.isEmpty(), "extension can't be empty"); this.extension = extension; }
Source:
<code>public PlanWithProperties visitIndexJoin(IndexJoinNode node, PreferredProperties preferredProperties) { List<VariableReferenceExpression> joinColumns = node.getCriteria().stream() .map(IndexJoinNode.EquiJoinClause::getProbe) .collect(toImmutableList()); List<LocalProperty<VariableReferenceExpression>> desiredLocalProperties = preferredProperties.getLocalProperties().isEmpty() ? grouped(joinColumns) : ImmutableList.of(); PlanWithProperties probeSource = node.getProbeSource().accept(this, PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(joinColumns), desiredLocalProperties) <START> .mergeWithParent(preferredProperties, session)); <END> ActualProperties probeProperties = probeSource.getProperties(); PlanWithProperties indexSource = node.getIndexSource().accept(this, PreferredProperties.any()); if (shouldRepartitionForIndexJoin(joinColumns, preferredProperties, probeProperties)) { probeSource = withDerivedProperties( partitionedExchange(idAllocator.getNextId(), REMOTE_STREAMING, probeSource.getNode(), createPartitioning(joinColumns), node.getProbeHashVariable()), probeProperties); } PlanNode result = ChildReplacer.replaceChildren(node, ImmutableList.of(probeSource.getNode(), node.getIndexSource())); return new PlanWithProperties(result, deriveProperties(result, ImmutableList.of(probeSource.getProperties(), indexSource.getProperties()))); }</code><technical_language>if practical sense apply exact partitioning for IndexJoin, memory. fight CPU skew</technical_language>

Target:
public PlanWithProperties visitIndexJoin(IndexJoinNode node, PreferredProperties preferredProperties) { List<VariableReferenceExpression> joinColumns = node.getCriteria().stream() .map(IndexJoinNode.EquiJoinClause::getProbe) .collect(toImmutableList()); List<LocalProperty<VariableReferenceExpression>> desiredLocalProperties = preferredProperties.getLocalProperties().isEmpty() ? grouped(joinColumns) : ImmutableList.of(); PlanWithProperties probeSource = node.getProbeSource().accept(this, PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(joinColumns), desiredLocalProperties) .mergeWithParent(preferredProperties, true)); ActualProperties probeProperties = probeSource.getProperties(); PlanWithProperties indexSource = node.getIndexSource().accept(this, PreferredProperties.any()); if (shouldRepartitionForIndexJoin(joinColumns, preferredProperties, probeProperties)) { probeSource = withDerivedProperties( partitionedExchange(idAllocator.getNextId(), REMOTE_STREAMING, probeSource.getNode(), createPartitioning(joinColumns), node.getProbeHashVariable()), probeProperties); } PlanNode result = ChildReplacer.replaceChildren(node, ImmutableList.of(probeSource.getNode(), node.getIndexSource())); return new PlanWithProperties(result, deriveProperties(result, ImmutableList.of(probeSource.getProperties(), indexSource.getProperties()))); }
Source:
<code>public Response undoFeedbackUpdate(@Auth final AccessToken token, @PathParam("id") final Long id) { final int updated = feedbackDAO.undoFeedbackUpdate(id); if (updated == 0) { <START> throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(new JsonError(404, "Feedback not found!")).build()); <END> } return Response.noContent().build(); }</code><technical_language>BAD_REQUEST != NOT_FOUND</technical_language>

Target:
public Response undoFeedbackUpdate(@Auth final AccessToken token, @PathParam("id") final Long id) { final int updated = feedbackDAO.undoFeedbackUpdate(id); if (updated == 0) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(new JsonError(Response.Status.NOT_FOUND.getStatusCode(), "Feedback not found!")).build()); } return Response.noContent().build(); }
Source:
<code>public boolean conditionMet() { <START> final Set<String> allTopics = new HashSet<>(getAllTopics()); <END> return !allTopics.removeAll(deletedTopics); }</code><technical_language>need a copy anymore</technical_language>

Target:
public boolean conditionMet() { final Set<String> allTopics = getAllTopicsInCluster(); return !allTopics.removeAll(deletedTopics); }
Source:
<code>public static void verifyContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { assertEquals(results.size(), values.size()); values.forEach(value -> assertTrue("Expected value <" + value.getK1() + ", " + value.getK2() + "> is not present in results but was expected", <START> results.stream() <END> .filter(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())) .findFirst() .isPresent())); }</code><technical_language>simplified to: java results.stream().anyMatch(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue()))</technical_language>

Target:
public static void verifyContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { assertEquals(results.size(), values.size()); values.forEach(value -> assertTrue("Expected value <" + value.getK1() + ", " + value.getK2() + "> is not present in results but was expected", results.stream() .anyMatch(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())))); }
Source:
<code>public void testExplicitNullness() throws Exception { assertBugReported(ColumnWithoutElement.class, detector, bugReporter); <START> } <END></code><technical_language>exchange 2 methods name ? testImplicitNullness, testExplicitNullness</technical_language>

Target:
public void testExplicitNullness() throws Exception { assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); }
Source:
<code>public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { Class<?> recievedMsgClass = msg.getClass(); if (HttpRequest.class.isAssignableFrom(recievedMsgClass)) { @SuppressWarnings("rawtypes") HttpRequest rxRequest = (HttpRequest) msg; if (rxRequest.getHeaders().hasContent()) { MultipleFutureListener allWritesListener = new MultipleFutureListener(promise); allWritesListener.listen(ctx.write(rxRequest.getNettyRequest())); <START> ContentSource<?> contentSource = null; <END> if (rxRequest.getContentFactory() != null) { contentSource = rxRequest.getContentFactory().newContentSource(); } else { contentSource = rxRequest.getContentSource(); } if (contentSource instanceof RawContentSource) { @SuppressWarnings("rawtypes") RawContentSource<?> rawContentSource = (RawContentSource) contentSource; while (rawContentSource.hasNext()) { @SuppressWarnings("rawtypes") ContentTransformer transformer = rawContentSource.getTransformer(); @SuppressWarnings("unchecked") ByteBuf byteBuf = transformer.transform(rawContentSource.next(), ctx.alloc()); allWritesListener.listen(ctx.write(byteBuf)); } } else { while (contentSource.hasNext()) { allWritesListener.listen(ctx.write(contentSource.next())); } } } else { ctx.write(rxRequest.getNettyRequest(), promise); } } else { ctx.write(msg, promise); } }</code><technical_language>null initialization is redundant</technical_language>

Target:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { Class<?> recievedMsgClass = msg.getClass(); if (HttpRequest.class.isAssignableFrom(recievedMsgClass)) { HttpRequest<?> rxRequest = (HttpRequest<?>) msg; if (rxRequest.getHeaders().hasContent()) { if (!rxRequest.getHeaders().isContentLengthSet()) { rxRequest.getHeaders().add(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); } MultipleFutureListener allWritesListener = new MultipleFutureListener(promise); allWritesListener.listen(ctx.write(rxRequest.getNettyRequest())); ContentSource<?> contentSource; if (rxRequest.hasRawContentSource()) { contentSource = rxRequest.getRawContentSource(); @SuppressWarnings("rawtypes") RawContentSource<?> rawContentSource = (RawContentSource) contentSource; while (rawContentSource.hasNext()) { @SuppressWarnings("rawtypes") ContentTransformer transformer = rawContentSource.getTransformer(); @SuppressWarnings("unchecked") ByteBuf byteBuf = transformer.transform(rawContentSource.next(), ctx.alloc()); allWritesListener.listen(ctx.write(byteBuf)); } } else { contentSource = rxRequest.getContentSource(); while (contentSource.hasNext()) { allWritesListener.listen(ctx.write(contentSource.next())); } } } else { if (!rxRequest.getHeaders().isContentLengthSet() && rxRequest.getMethod() != HttpMethod.GET) { rxRequest.getHeaders().set(HttpHeaders.Names.CONTENT_LENGTH, 0); } ctx.write(rxRequest.getNettyRequest(), promise); } } else { ctx.write(msg, promise); } }
Source:
<code>public void setPwdName(String pwdName) { <START> if (pwdName == null) { <END> return; } preferences.edit().putString(PreferenceKeys.PWD_NAME, pwdName).apply(); }</code><technical_language>I (not 100% sure) preferences no-ops if setter argument is null. I this check is redundant</technical_language>

Target:
public void setPwdName(String pwdName) { preferences.edit().putString(PreferenceKeys.PWD_NAME, pwdName).apply(); }
Source:
<code>private List<String> extractSecurityGroups(final ConfigGroup groupConfig) { <START> ConfigItem<List<String>> securityGroups = backwardCompatibleUtil.compat(groupConfig).getConfigItem("security:groups"); <END> return securityGroups.getValue(); }</code><technical_language>"security:groups"</technical_language>

Target:
private List<String> extractSecurityGroups(final ConfigGroup groupConfig) { ConfigItem<List<String>> securityGroups = backwardCompatibleUtil.compat(groupConfig).getConfigItem(SECURITY_GROUPS); return securityGroups.getValue(); }
Source:
<code>private boolean buildAndSendRequestToLeader(String urlSuffix, HttpConstants.RestVerbs requestMethod, int expectedResponseCode) throws IllegalArgumentException { String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId(); String url = leaderHostName + urlSuffix; HttpUriRequest request; switch (requestMethod) { case PUT: request = new HttpPut(url); break; case DELETE: request = new HttpDelete(url); break; default: <START> LOG.error("Unsupported requestMethod: " + requestMethod.name()); <END> return false; } return sendRequestToLeader(request, expectedResponseCode, leaderHostName); }</code><technical_language>I throw exception this is supposed happen</technical_language>

Target:
private boolean buildAndSendRequestToLeader(String urlSuffix, HttpConstants.RestVerbs requestMethod, int expectedResponseCode) throws IllegalArgumentException { String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId(); String url = leaderHostName + urlSuffix; HttpUriRequest request; switch (requestMethod) { case PUT: request = new HttpPut(url); break; case DELETE: request = new HttpDelete(url); break; default: throw new IllegalArgumentException("Unsupported requestMethod: " + requestMethod.name()); } return sendRequestToLeader(request, expectedResponseCode, leaderHostName); }
Source:
<code><START> public CorrelationIdGenerator getCorrelationIdGenerator() { <END> return correlationIdGenerator; }</code><technical_language>do need a getter</technical_language>

Target:
CorrelationIdGenerator getCorrelationIdGenerator() { return correlationIdGenerator; }
Source:
<code>public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; <START> } <END> numSeen++; } logger.info("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }</code><technical_language>Test, STDOUT for final report..</technical_language>

Target:
public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; } numSeen++; } System.out.println("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }
Source:
<code>private void sendNopMessage(HelixDataAccessor accessor, String instanceName) { try { Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString()); nopMsg.setSrcName(instanceName); <START> nopMsg.setTgtName(instanceName); <END> accessor .setProperty(accessor.keyBuilder().message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg); LOG.info("Send NO_OP message to " + nopMsg.getTgtName() + ", msgId: " + nopMsg.getId()); } catch (Exception e) { LOG.error(e.toString()); } }</code><technical_language>This function trigger another event retry message, right? in PR message automatically retried</technical_language>

Target:
private void sendNopMessage(HelixDataAccessor accessor, String instanceName) { try { Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString()); nopMsg.setSrcName(instanceName); nopMsg.setTgtName(instanceName); accessor .setProperty(accessor.keyBuilder().message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg); LOG.info("Send NO_OP message to {}}, msgId: {}.", nopMsg.getTgtName(), nopMsg.getId()); } catch (Exception e) { LOG.error("Failed to send NO_OP message to {}.", instanceName, e); } }
Source:
<code>public static ParsedParameters named(List<String> names) { if (names.contains(ParsedSql.POSITIONAL_PARAM)) { throw new IllegalArgumentException("Named parameters " <START> + "list must not contain positional parameter " <END> + ParsedSql.POSITIONAL_PARAM); } return new ParsedParameters(false, names); }</code><technical_language>I UnableToCreateStatementException</technical_language>

Target:
public static ParsedParameters named(List<String> names) { if (names.contains(ParsedSql.POSITIONAL_PARAM)) { throw new IllegalArgumentException("Named parameters " + "list must not contain positional parameter " + "\"" + ParsedSql.POSITIONAL_PARAM + "\""); } return new ParsedParameters(false, names); }
Source:
<code>public Blob getBlob() { <START> Rendition rendition = Framework.getLocalService(RenditionService.class).getDefaultRendition(doc, "download", <END> null); return rendition != null ? rendition.getBlob() : null; }</code><technical_language>getLocalService -> getService</technical_language>

Target:
public Blob getBlob() { Rendition rendition = Framework.getService(RenditionService.class).getDefaultRendition(doc, "download", null); return rendition != null ? rendition.getBlob() : null; }
Source:
<code>public MethodOutcome createFHIRPerson(@ResourceParam Person person) { person = personResource.createFHIRPerson(person); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdDt(FHIRConstants.PERSON, person.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); <START> coding.setDisplay("Person is successfully created"); <END> outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }</code><technical_language>move messages constants</technical_language>

Target:
public MethodOutcome createFHIRPerson(@ResourceParam Person person) { person = personResource.createFHIRPerson(person); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdType(FHIRConstants.PERSON, person.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Person is successfully created with id " + person.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
<code>public void testLegacyACLBehavior() { String customName = "foo"; ACP acp = getInheritedReadWriteACP(); ACE customACE = ACE.builder("bar", READ_WRITE).creator("admin").build(); acp.addACE(customName, customACE); <START> ACL[] acLs = acp.getACLs(); <END> assertEquals(3, acLs.length); assertEquals(customName, acLs[1].getName()); assertEquals(ACL.LOCAL_ACL, acLs[0].getName()); }</code><technical_language>acLs -> acls</technical_language>

Target:
public void testLegacyACLBehavior() { doTestACLBehavior(true); }
Source:
<code>public void process(Node externs, Node root) { for (Node child : root.children()) { if (child.isScript()) { this.types = new LinkedHashMap<>(); <START> this.typesToRename = new HashMap<>(); <END> NodeTraversal.traverseEs6(compiler, child, new TypeConverter()); NodeTraversal.traverseEs6(compiler, child, new TypeMemberConverter()); NodeTraversal.traverseEs6(compiler, child, new FieldOnThisConverter()); NodeTraversal.traverseEs6(compiler, child, new InheritanceConverter()); if (!typesToRename.isEmpty()) { NodeTraversal.traverseEs6(compiler, child, new typeAliasConverter()); } } } }</code><technical_language>LinkedHashMap for iteration order matches insertion order</technical_language>

Target:
public void process(Node externs, Node root) { for (Node child : root.children()) { if (child.isScript()) { this.types = new LinkedHashMap<>(); this.typesToRename = new LinkedHashMap<>(); NodeTraversal.traverseEs6(compiler, child, new TypeConverter()); NodeTraversal.traverseEs6(compiler, child, new TypeMemberConverter()); NodeTraversal.traverseEs6(compiler, child, new FieldOnThisConverter()); NodeTraversal.traverseEs6(compiler, child, new InheritanceConverter()); if (!typesToRename.isEmpty()) { NodeTraversal.traverseEs6(compiler, child, new TypeAliasConverter()); } } } }
Source:
<code>public Sequence<T> run(final Query<T> query) { return new BaseSequence<T, Iterator<T>>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { List<Future<List<T>>> futures = Lists.newArrayList( Iterables.transform( queryables, new Function<QueryRunner<T>, Future<List<T>>>() { @Override public Future<List<T>> apply(final QueryRunner<T> input) { return exec.submit( new PrioritizedCallable<List<T>>() { @Override public int getPriority() { <START> return Queries.Priority.valueOf( <END> query.getContextValue( "priority", Queries.Priority.NORMAL.name() ) ).ordinal(); } @Override public List<T> call() throws Exception { try { return Sequences.toList(input.run(query), Lists.<T>newArrayList()); } catch (Exception e) { log.error(e, "Exception with one of the sequences!"); throw Throwables.propagate(e); } } } ); } } ) ); return new MergeIterable<T>( ordering.nullsFirst(), Iterables.transform( futures, new Function<Future<List<T>>, Iterable<T>>() { @Override public Iterable<T> apply(Future<List<T>> input) { try { return input.get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } } ) ).iterator(); } @Override public void cleanup(Iterator<T> tIterator) { } } ); }</code><technical_language>This is figuring out priority lazily, I done eagerly passed a parameter PrioritizedCallable</technical_language>

Target:
public Sequence<T> run(final Query<T> query) { final int priority = Integer.parseInt(query.getContextValue("priority", "0")); return new BaseSequence<T, Iterator<T>>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { List<Future<List<T>>> futures = Lists.newArrayList( Iterables.transform( queryables, new Function<QueryRunner<T>, Future<List<T>>>() { @Override public Future<List<T>> apply(final QueryRunner<T> input) { return exec.submit( new PrioritizedCallable<List<T>>(priority) { @Override public List<T> call() throws Exception { try { return Sequences.toList(input.run(query), Lists.<T>newArrayList()); } catch (Exception e) { log.error(e, "Exception with one of the sequences!"); throw Throwables.propagate(e); } } } ); } } ) ); return new MergeIterable<T>( ordering.nullsFirst(), Iterables.transform( futures, new Function<Future<List<T>>, Iterable<T>>() { @Override public Iterable<T> apply(Future<List<T>> input) { try { return input.get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } } ) ).iterator(); } @Override public void cleanup(Iterator<T> tIterator) { } } ); }
Source:
<code><START> private String formatJavaDoc(String str) { <END> if (str != null) { int paramPos = str.indexOf(PARAM); if (paramPos != -1) { str = str.substring(0, paramPos); } int returnPos = str.indexOf(RETURN); if (returnPos != -1) { str = str.substring(0, returnPos); } str = str.trim(); } return str; }</code><technical_language>this static</technical_language>

Target:
private static String formatJavaDoc(String str) { if (str != null) { int paramPos = str.indexOf(PARAM); if (paramPos != -1) { str = str.substring(0, paramPos); } int returnPos = str.indexOf(RETURN); if (returnPos != -1) { str = str.substring(0, returnPos); } str = str.trim(); } return str; }
Source:
<code>public synchronized void readAsync(final int numBytes, final AsyncCompletionHandler<ByteBuf> handler) { <START> ensureOpen(new AsyncCompletionHandler<Void>() { <END> @Override public void completed(final Void t) { if (!hasBytesAvailable(numBytes)) { pendingReader = new PendingReader(numBytes, handler); } else { CompositeByteBuf composite = allocator.compositeBuffer(pendingInboundBuffers.size()); int bytesNeeded = numBytes; for (Iterator<io.netty.buffer.ByteBuf> iter = pendingInboundBuffers.iterator(); iter.hasNext();) { io.netty.buffer.ByteBuf next = iter.next(); int bytesNeededFromCurrentBuffer = Math.min(next.readableBytes(), bytesNeeded); if (bytesNeededFromCurrentBuffer == next.readableBytes()) { composite.addComponent(next); iter.remove(); } else { next.retain(); composite.addComponent(next.readSlice(bytesNeededFromCurrentBuffer)); } composite.writerIndex(composite.writerIndex() + bytesNeededFromCurrentBuffer); bytesNeeded -= bytesNeededFromCurrentBuffer; if (bytesNeeded == 0) { break; } } NettyByteBuf buffer = new NettyByteBuf(composite); handler.completed(buffer.flip()); } } @Override public void failed(final Throwable t) { handler.failed(t); } }); }</code><technical_language>I need ensureOpen a read, MongoDB protocol, a read is operation a socket. A write is first</technical_language>

Target:
public synchronized void readAsync(final int numBytes, final AsyncCompletionHandler<ByteBuf> handler) { if (pendingException != null) { handler.failed(pendingException); } else if (!hasBytesAvailable(numBytes)) { pendingReader = new PendingReader(numBytes, handler); } else { CompositeByteBuf composite = allocator.compositeBuffer(pendingInboundBuffers.size()); int bytesNeeded = numBytes; for (Iterator<io.netty.buffer.ByteBuf> iter = pendingInboundBuffers.iterator(); iter.hasNext();) { io.netty.buffer.ByteBuf next = iter.next(); int bytesNeededFromCurrentBuffer = Math.min(next.readableBytes(), bytesNeeded); if (bytesNeededFromCurrentBuffer == next.readableBytes()) { composite.addComponent(next); iter.remove(); } else { next.retain(); composite.addComponent(next.readSlice(bytesNeededFromCurrentBuffer)); } composite.writerIndex(composite.writerIndex() + bytesNeededFromCurrentBuffer); bytesNeeded -= bytesNeededFromCurrentBuffer; if (bytesNeeded == 0) { break; } } NettyByteBuf buffer = new NettyByteBuf(composite); handler.completed(buffer.flip()); } }
Source:
<code>public Response toResponse(TransactionStatusException exception) { <START> return Response.status(Response.Status.CONFLICT).build(); <END> }</code><technical_language>this detected findbugs</technical_language>

Target:
public Response toResponse(TransactionStatusException exception) { return Response.status(HttpResponseCodes.SC_CONFLICT).build(); }
Source:
<code>void toDateString() { assertThat( DateTimeFormatterUtil.toDateString( LocalDateTime.ofInstant(JAN_FIRST_INSTANT, ZoneOffset.UTC)), <START> is("Wed. Jan. 01 14:30:00 UTC 2020")); <END> }</code><technical_language>this test is failing travis. a typo, I imagine a locale issue. code tests fail executed in a part of world, default date format (or simply is in a language)</technical_language>

Target:
void toDateString() { assertThat( DateTimeFormatterUtil.toDateString( LocalDateTime.ofInstant(JAN_FIRST_INSTANT, ZoneOffset.UTC)), is("Wed Jan 01 14:30:00 UTC 2020")); }
Source:
<code>private Criteria getCriteriaPersonModifier(Criteria criteria, List<PERSON_TYPE> personTypes) { if (personTypes.contains(PERSON_TYPE.PATIENT)) { DetachedCriteria crit = DetachedCriteria.forClass(Patient.class, "patient").setProjection( Property.forName("patientId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.USER)) { DetachedCriteria crit = DetachedCriteria.forClass(User.class, "user").setProjection(Property.forName("userId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.PERSON)) { <START> } <END> return criteria; }</code><technical_language>@Nuwantha remove this entire if, doesnt do anything. @dkayiwa do agree</technical_language>

Target:
private Criteria getCriteriaPersonModifier(Criteria criteria, List<PERSON_TYPE> personTypes) { if (personTypes.contains(PERSON_TYPE.PATIENT)) { DetachedCriteria crit = DetachedCriteria.forClass(Patient.class, "patient").setProjection( Property.forName("patientId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.USER)) { DetachedCriteria crit = DetachedCriteria.forClass(User.class, "user").setProjection(Property.forName("userId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } return criteria; }
Source:
<code><START> protected void setRefLogIdent(final PatchSetApproval submitAudit) { <END> if (submitAudit != null) { branchUpdate.setRefLogIdent(mArguments.identifiedUserFactory.create( submitAudit.getAccountId()).newRefLogIdent()); } }</code><technical_language>subclasses allowed override this method</technical_language>

Target:
protected final void setRefLogIdent(final PatchSetApproval submitAudit) { if (submitAudit != null) { branchUpdate.setRefLogIdent(mArguments.identifiedUserFactory.create( submitAudit.getAccountId()).newRefLogIdent()); } }
Source:
<code>static BattleGroup createGeneral( final Collection<UnitType> unitTypes, final GameProperties properties) { final List<FiringSquadron> firingSquadronsWithoutFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, Predicate.not(unitIsFirstStrike(properties)), noDestroyerPresent()) .name(UNITS) .build(); }) .collect(Collectors.toList()); final List<FiringSquadron> firingSquadronsWithFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, firingUnitFilterData -> true, Predicate.not(noDestroyerPresent())) .name(UNITS) .build(); }) .collect(Collectors.toList()); final List<FiringSquadron> offenseSquadrons = Stream.of(firingSquadronsWithFirstStrikeUnits, firingSquadronsWithoutFirstStrikeUnits) .flatMap(Collection::stream) .collect(Collectors.toList()); final List<FiringSquadron> defenseSquadrons; <START> if (Properties.getDefendingSubsSneakAttack(properties)) { <END> defenseSquadrons = offenseSquadrons; } else { defenseSquadrons = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, firingUnitFilterData -> true, units -> true) .name(UNITS) .build(); }) .collect(Collectors.toList()); } return BattleGroup.builder() .offenseSquadrons(offenseSquadrons) .defenseSquadrons(defenseSquadrons) .fireType(BattleState.FireType.NORMAL) .build(); }</code><technical_language>nit, good place for a ternary</technical_language>

Target:
static BattleGroup createGeneral( final Collection<UnitType> unitTypes, final GameProperties properties) { final List<FiringSquadron> firingSquadronsWithoutFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> firingSquadron.toBuilder() .firingUnitsAnd(Predicate.not(unitIsFirstStrike(properties))) .enemyUnitRequirements(noDestroyerPresent()) .name(UNITS) .build()) .collect(Collectors.toList()); final List<FiringSquadron> firingSquadronsWithFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> firingSquadron.toBuilder() .enemyUnitRequirements(Predicate.not(noDestroyerPresent())) .name(UNITS) .build()) .collect(Collectors.toList()); final List<FiringSquadron> offenseSquadrons = Stream.of(firingSquadronsWithFirstStrikeUnits, firingSquadronsWithoutFirstStrikeUnits) .flatMap(Collection::stream) .collect(Collectors.toList()); final List<FiringSquadron> defenseSquadrons = Properties.getDefendingSubsSneakAttack(properties) ? offenseSquadrons : FiringSquadron.createWithTargetInformation(unitTypes).stream() .map(firingSquadron -> firingSquadron.toBuilder().name(UNITS).build()) .collect(Collectors.toList()); return BattleGroup.builder() .offenseSquadrons(offenseSquadrons) .defenseSquadrons(defenseSquadrons) .fireType(BattleState.FireType.NORMAL) .build(); }
Source:
<code>public void testReadAheadCounters() throws IOException { describe("Test to check correct values for readAhead counters in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readAheadCountersPath = path(getMethodName()); abfss.getAbfsConfiguration().setReadBufferSize(CUSTOM_BLOCK_BUFFER_SIZE); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readAheadCountersPath); out.write(defBuffer); out.close(); in = abfss.openFileForRead(readAheadCountersPath, fs.getFsStatistics()); for (int i = 0; i < 5; i++) { in.seek(ONE_KB * i); in.read(defBuffer, ONE_KB * i, ONE_KB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); while (stats.getRemoteBytesRead() < CUSTOM_READ_AHEAD_BUFFER_SIZE || stats.getReadAheadBytesRead() < CUSTOM_BLOCK_BUFFER_SIZE) { Thread.sleep(THREAD_SLEEP_10_SECONDS); } <START> assertTrue(String.format("actual value of %d is not greater than or " <END> + "equal to the expected value %d for readAheadReadBytes counter", stats.getReadAheadBytesRead(), CUSTOM_BLOCK_BUFFER_SIZE), stats.getReadAheadBytesRead() >= CUSTOM_BLOCK_BUFFER_SIZE); assertTrue(String.format("actual value of %d is not greater than or " + "equal to the expected value %d for remoteBytesRead counter", stats.getRemoteBytesRead(), CUSTOM_READ_AHEAD_BUFFER_SIZE), stats.getRemoteBytesRead() >= CUSTOM_READ_AHEAD_BUFFER_SIZE); } catch (InterruptedException e) { e.printStackTrace(); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }</code><technical_language>Try AssertJ.assertThat here, lets declare specific "isGreaterThan" assertion; describedAs() string formatting too</technical_language>

Target:
public void testReadAheadCounters() throws IOException, InterruptedException { describe("Test to check correct values for readAhead counters in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readAheadCountersPath = path(getMethodName()); abfss.getAbfsConfiguration().setReadBufferSize(CUSTOM_BLOCK_BUFFER_SIZE); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readAheadCountersPath); out.write(defBuffer); out.close(); in = abfss.openFileForRead(readAheadCountersPath, fs.getFsStatistics()); for (int i = 0; i < 5; i++) { in.seek(ONE_KB * i); in.read(defBuffer, ONE_KB * i, ONE_KB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); while (stats.getRemoteBytesRead() < CUSTOM_READ_AHEAD_BUFFER_SIZE || stats.getReadAheadBytesRead() < CUSTOM_BLOCK_BUFFER_SIZE) { Thread.sleep(THREAD_SLEEP_10_SECONDS); } Assertions.assertThat(stats.getReadAheadBytesRead()).describedAs( "Mismatch in readAheadBytesRead counter value") .isGreaterThanOrEqualTo(CUSTOM_BLOCK_BUFFER_SIZE); Assertions.assertThat(stats.getRemoteBytesRead()).describedAs( "Mismatch in remoteBytesRead counter value") .isGreaterThanOrEqualTo(CUSTOM_READ_AHEAD_BUFFER_SIZE); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }
Source:
<code>private Configuration toggleConfiguration(Configuration config) throws IOException { String newFpid; <START> Dictionary<String, Object> properties; <END> if (config.getFactoryPid().contains(DISABLED_CONFIGURATION_SUFFIX)) { newFpid = config.getFactoryPid().replace(DISABLED_CONFIGURATION_SUFFIX, ""); properties = copyConfigProperties(config.getProperties(), newFpid); } else { newFpid = config.getFactoryPid().concat(DISABLED_CONFIGURATION_SUFFIX); properties = copyConfigProperties(config.getProperties(), config.getFactoryPid()); } config.delete(); Configuration newConfig = configurationAdmin.createFactoryConfiguration(newFpid, null); newConfig.update(properties); return newConfig; }</code><technical_language>suggestion final Dictionary<String, Object> properties;</technical_language>

Target:
private Configuration toggleConfiguration(Configuration config) throws IOException { String newFpid; final Dictionary<String, Object> properties; String configFactoryPid = config.getFactoryPid(); if (configFactoryPid.contains(DISABLED_CONFIGURATION_SUFFIX)) { newFpid = configFactoryPid.replace(DISABLED_CONFIGURATION_SUFFIX, ""); properties = copyConfigProperties(config.getProperties(), newFpid); } else { newFpid = configFactoryPid.concat(DISABLED_CONFIGURATION_SUFFIX); properties = copyConfigProperties(config.getProperties(), configFactoryPid); } config.delete(); Configuration newConfig = configurationAdmin.createFactoryConfiguration(newFpid, null); newConfig.update(properties); return newConfig; }
Source:
<code>private void registerUser(String email, String password, String role) throws UserAlreadyExistsException { User user = userRepository.findByUsername(email); if(user != null) { throw new UserAlreadyExistsException(); } try { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); user = new User(email, passwordEncoder.encode(password),role); user.setEmail(email); KeystorePasswordHolder keystorePassword = new KeystorePasswordHolder(); keystorePassword.setPassword( KeystorePasswordUtils.generatePassword(KeystorePasswordUtils.KEYSTORE_PASSWORD_BYTES), password); KeystoreHolder keystoreHolder = new KeystoreHolder(); try { KeyStore keystore = keystoreHolder.getKeystore(keystorePassword.getPassword(password)); } catch (Exception e) { <START> logger.warn("could not create keystore for user " + email); <END> } user.setKeystorePasswordHolder(keystorePassword); user.setKeystoreHolder(keystoreHolder); userRepository.save(user); } catch (DataIntegrityViolationException e) { throw new UserAlreadyExistsException(); } }</code><technical_language>exit method here? return missing</technical_language>

Target:
private void registerUser(String email, String password, String role) throws UserAlreadyExistsException { User user = userRepository.findByUsername(email); if(user != null) { throw new UserAlreadyExistsException(); } try { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); user = new User(email, passwordEncoder.encode(password),role); user.setEmail(email); KeystorePasswordHolder keystorePassword = new KeystorePasswordHolder(); keystorePassword.setPassword( KeystorePasswordUtils.generatePassword(KeystorePasswordUtils.KEYSTORE_PASSWORD_BYTES), password); KeystoreHolder keystoreHolder = new KeystoreHolder(); try { keystoreHolder.getKeystore(keystorePassword.getPassword(password)); } catch (Exception e) { throw new IllegalStateException("could not create keystore for user " + email); } user.setKeystorePasswordHolder(keystorePassword); user.setKeystoreHolder(keystoreHolder); userRepository.save(user); } catch (DataIntegrityViolationException e) { throw new UserAlreadyExistsException(); } }
Source:
<code>public static List<DataSegment> getPublishedSegments(HadoopDruidIndexerConfig config) { final Configuration conf = new Configuration(); final ObjectMapper jsonMapper = HadoopDruidIndexerConfig.jsonMapper; ImmutableList.Builder<DataSegment> publishedSegmentsBuilder = ImmutableList.builder(); for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } final Path descriptorInfoDir = config.makeDescriptorInfoDir(); try { FileSystem fs = descriptorInfoDir.getFileSystem(conf); for (FileStatus status : fs.listStatus(descriptorInfoDir)) { final DataSegment segment = jsonMapper.readValue(fs.open(status.getPath()), DataSegment.class); publishedSegmentsBuilder.add(segment); <START> log.info("Published %s", segment.getIdentifier()); <END> } } catch (IOException e) { throw Throwables.propagate(e); } List<DataSegment> publishedSegments = publishedSegmentsBuilder.build(); return publishedSegments; }</code><technical_language>Segments published here, this log line is accurate</technical_language>

Target:
public static List<DataSegment> getPublishedSegments(HadoopDruidIndexerConfig config) { final Configuration conf = new Configuration(); final ObjectMapper jsonMapper = HadoopDruidIndexerConfig.jsonMapper; ImmutableList.Builder<DataSegment> publishedSegmentsBuilder = ImmutableList.builder(); for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } final Path descriptorInfoDir = config.makeDescriptorInfoDir(); try { FileSystem fs = descriptorInfoDir.getFileSystem(conf); for (FileStatus status : fs.listStatus(descriptorInfoDir)) { final DataSegment segment = jsonMapper.readValue(fs.open(status.getPath()), DataSegment.class); publishedSegmentsBuilder.add(segment); log.info("Adding segment %s to the list of published segments", segment.getIdentifier()); } } catch (IOException e) { throw Throwables.propagate(e); } List<DataSegment> publishedSegments = publishedSegmentsBuilder.build(); return publishedSegments; }
Source:
<code>public RemoteTableDescriptor<K, V> withReadFunction(TableReadFunction<K, V> readFn) { Preconditions.checkNotNull(readFn, "null read function"); this.readFn = readFn; <START> this.readFn.setTableId(String.format("%s.%s", tableId, READ_FN)); <END> return this; }</code><technical_language>Is this anywhere</technical_language>

Target:
public RemoteTableDescriptor<K, V> withReadFunction(TableReadFunction<K, V> readFn) { Preconditions.checkNotNull(readFn, "null read function"); this.readFn = readFn; return this; }
Source:
<code>public static void main(String[] args) throws IOException { <START> try(AsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient()) { <END> asyncHttpClient .prepareGet("<LINK_0>") .execute() .toCompletableFuture() .thenApply(Response::getResponseBody) .thenAccept(System.out::println) .join(); } }</code><technical_language>Dsl</technical_language>

Target:
public static void main(String[] args) throws IOException { try(AsyncHttpClient asyncHttpClient = asyncHttpClient()) { asyncHttpClient .prepareGet("<LINK_0>") .execute() .toCompletableFuture() .thenApply(Response::getResponseBody) .thenAccept(System.out::println) .join(); } }
Source:
<code>public void acknowledgeResultsAsync(long nextToken) { executor.execute(() -> { try { <START> thriftClient.acknowledgeResults(taskId, outputBufferId, nextToken); <END> } catch (Exception exception) { log.debug(exception, "Acknowledge request failed: %s/%s/%s", taskId, outputBufferId, nextToken); } }); }</code><technical_language>Instead of popping this executor, instead Thrift interface async? need handle future if care result</technical_language>

Target:
public void acknowledgeResultsAsync(long nextToken) { thriftClient.acknowledgeResults(taskId, outputBufferId, nextToken); }
Source:
<code>private int getSleepTimeMs() { <START> int backoff = 1 << Math.min(31, retries.get()); <END> int sleepMs = base_sleep_ms * random.nextInt(backoff); if ( sleepMs > max_sleep_ms ) sleepMs = max_sleep_ms; if ( sleepMs < base_sleep_ms ) sleepMs = base_sleep_ms; return sleepMs; }</code><technical_language>a 32 bit signed integer, of retries exceeding 31 overflow. Yeah right on-I raising a question implementation of back-off in general. (EDIT add quote)</technical_language>

Target:
private int getSleepTimeMs() { int backoff = 1 << retries.get(); int sleepMs = base_sleep_ms * Math.max(1, random.nextInt(backoff)); if ( sleepMs > max_sleep_ms ) sleepMs = max_sleep_ms; return sleepMs; }
Source:
<code>public static String typeNameToFileName (String typeName, String iconOrThumbnail) { ComponentType type; try { type = Enum.valueOf(ComponentType.class, typeName); } catch (IllegalArgumentException e) { type = Enum.valueOf(ComponentType.class, "UNKNOWN"); } String filename; if (iconOrThumbnail == "icon") { filename = ComponentIcons.iconNameForType(type); <START> } else if (iconOrThumbnail == "thumb" || iconOrThumbnail == "thumbnail"){ <END> filename = ComponentIcons.thumbnailNameForType(type); } else { filename = ""; } return filename; }</code><technical_language>"thumb", "thumbnail" "icon" a times, worth pulling out constants avoid typos</technical_language>

Target:
public static String typeNameToFileName (String typeName, String iconOrThumbnail) { ComponentType type; try { type = Enum.valueOf(ComponentType.class, typeName); } catch (IllegalArgumentException e) { type = Enum.valueOf(ComponentType.class, "UNKNOWN"); } String filename; if (iconOrThumbnail == GET_ICON) { filename = ComponentIcons.iconNameForType(type); } else if (iconOrThumbnail == GET_THUMBNAIL){ filename = ComponentIcons.thumbnailNameForType(type); } else { filename = ""; } return filename; }
Source:
<code>private void addToMap(Map<String, Object> map, AMFDataObj o, String key) { AMFData obj = o.get(key); if (obj != null) { map.put(key, obj.getValue()); } else { <START> logger.debug(key + " is not found in AMFDataObj"); <END> } }</code><technical_language>this happen? If log error</technical_language>

Target:
private void addToMap(Map<String, Object> map, AMFDataObj o, String key) { AMFData obj = o.get(key); if (obj != null) { map.put(key, obj.getValue()); } else { throw new NoSuchElementException(key + " is not found in AMFDataObj"); } }