auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DelegatingResourceDescription getRepresentationDescription(Representation representation) { if (representation instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition", Representation.REF); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (representation instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); <START> description.addProperty("condition", Representation.REF); <END> description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("additionalDetail"); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }</code><technical_language>leave Representation.REF condition for default representation</technical_language>

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation representation) { if (representation instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition", Representation.REF); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion", Representation.REF); description.addProperty("onsetDate"); description.addProperty("endDate"); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (representation instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition"); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("endDate"); description.addProperty("additionalDetail"); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
Source:
<code>public ConfigurationClientBuilder() { policies = new ArrayList<>(); <START> httpLogOptions = new HttpLogOptions().setLogLevel(HttpLogDetailLevel.NONE); <END> headers = new HttpHeaders() .put(ECHO_REQUEST_ID_HEADER, "true") .put(CONTENT_TYPE_HEADER, CONTENT_TYPE_HEADER_VALUE) .put(ACCEPT_HEADER, ACCEPT_HEADER_VALUE); }</code><technical_language>sense log level default</technical_language>

Target:
public ConfigurationClientBuilder() { policies = new ArrayList<>(); httpLogOptions = new HttpLogOptions(); headers = new HttpHeaders() .put(ECHO_REQUEST_ID_HEADER, "true") .put(CONTENT_TYPE_HEADER, CONTENT_TYPE_HEADER_VALUE) .put(ACCEPT_HEADER, ACCEPT_HEADER_VALUE); }
Source:
<code>public static byte[] getNextStartRowUnlessTerminal(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { <START> if (isTerminalRow(reverse, rowName)) { <END> return null; } else { return previousLexicographicName(rowName); } } else { return nextLexicographicNameInternal(rowName); } }</code><technical_language>isFirstRowName reverse is true. move if (isTerminalRow(reverse, rowName)) { return null; } of nested if</technical_language>

Target:
public static byte[] getNextStartRowUnlessTerminal(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { if (isFirstRowName(rowName)) { return null; } else { return previousLexicographicName(rowName); } } else { return nextLexicographicNameInternal(rowName); } }
Source:
<code>public Receive createReceive() { return receiveBuilder() <START> .matchEquals("tick", tick -> { <END> LOGGER.trace() .setMessage("Searching for added/updated/deleted hosts") .addData("actor", self()) .log(); LOGGER.debug().setMessage("No hosts found!").log(); }) .build(); }</code><technical_language>"tick" psf</technical_language>

Target:
public Receive createReceive() { return receiveBuilder() .matchEquals(TICK, tick -> { LOGGER.trace() .setMessage("Searching for added/updated/deleted hosts") .addData("actor", self()) .log(); LOGGER.debug().setMessage("No hosts found!").log(); }) .build(); }
Source:
<code>public void remove(final Expression oldExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { <START> LOG.trace("Expression not found when trying to remove: " + ExpressionDumper.dump(oldExpr) + "; in: " + ExpressionDumper.dump(this)); <END> } return; } steps.remove(idx); }</code><technical_language>LOG.trace("{} {}")</technical_language>

Target:
public void remove(final Expression oldExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { LOG.trace("Expression not found when trying to remove: {}; in: {}", ExpressionDumper.dump(oldExpr), ExpressionDumper.dump(this)); } return; } steps.remove(idx); }
Source:
<code><START> public ProtobufDataCodec(SymbolTable symbolTable, boolean supportsASCIIOnlyStrings) <END> { this(symbolTable, supportsASCIIOnlyStrings, false); }</code><technical_language>deprecate this if config class argument</technical_language>

Target:
public ProtobufDataCodec(SymbolTable symbolTable, boolean supportsASCIIOnlyStrings) { this(new ProtobufCodecOptions.Builder() .setSymbolTable(symbolTable) .setEnableASCIIOnlyStrings(supportsASCIIOnlyStrings) .build()); }
Source:
<code><START> public void addInstructorRespondant(String email, FeedbackSessionAttributes feedbackSession) throws InvalidParametersException, EntityDoesNotExistException { <END> Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, email); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSession); feedbackSession.sanitizeForSaving(); if (!feedbackSession.isValid()) { throw new InvalidParametersException(feedbackSession.getInvalidityInfo()); } FeedbackSession fs = (FeedbackSession) getEntity(feedbackSession); if (fs == null) { throw new EntityDoesNotExistException( ERROR_UPDATE_NON_EXISTENT + feedbackSession.toString()); } fs.getRespondingInstructorList().add(email); getPM().close(); }</code><technical_language>This method simply put email arraylist call method below? methods same</technical_language>

Target:
public void addInstructorRespondant(String email, FeedbackSessionAttributes feedbackSession) throws InvalidParametersException, EntityDoesNotExistException { List<String> emails = new ArrayList<String>(); emails.add(email); addInstructorRespondants(emails, feedbackSession); }
Source:
<code><START> static WSTrustResponse execute(String mexURL, <END> String cloudAudienceUrn, Proxy proxy, SSLSocketFactory sslSocketFactory) throws Exception { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/soap+xml"); headers.put("return-client-request-id", "true"); String mexResponse = HttpHelper.executeHttpGet(log, mexURL, proxy, sslSocketFactory); BindingPolicy policy = MexParser.getPolicyFromMexResponseForIntegrated(mexResponse); String soapAction = "<LINK_0>"; if (policy.getVersion() == WSTrustVersion.WSTRUST2005) { soapAction = "<LINK_1>"; } headers.put("SOAPAction", soapAction); String body = buildMessage(policy.getUrl(), null, null, policy.getVersion(), cloudAudienceUrn).toString(); String response = HttpHelper.executeHttpPost(log, policy.getUrl(), body, headers, proxy, sslSocketFactory); return WSTrustResponse.parse(response, policy.getVersion()); }</code><technical_language>refactor this function a lot of is code duplication of existing execute(...) function</technical_language>

Target:
static WSTrustResponse execute(String mexURL, String cloudAudienceUrn, Proxy proxy, SSLSocketFactory sslSocketFactory) throws Exception { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/soap+xml"); headers.put("return-client-request-id", "true"); String mexResponse = HttpHelper.executeHttpGet(log, mexURL, proxy, sslSocketFactory); BindingPolicy policy = MexParser.getPolicyFromMexResponseForIntegrated(mexResponse); return getAndParseWSTrustResponse(cloudAudienceUrn, proxy, sslSocketFactory, headers, policy, null, null); }
Source:
<code>public static Object wrap(Object object, boolean useJavaNullAsJsonNull) { try { if (object == null) { return NULL; } if (object instanceof JSONObject || object instanceof JSONArray || NULL.equals(object) || object instanceof JSONString || object instanceof Byte || object instanceof Character || object instanceof Short || object instanceof Integer || object instanceof Long || object instanceof Boolean || object instanceof Float || object instanceof Double || object instanceof String || object instanceof BigInteger || object instanceof BigDecimal || object instanceof Enum) { return object; } if (object instanceof Collection) { Collection<?> coll = (Collection<?>) object; return new JSONArray(coll); } if (object.getClass().isArray()) { return new JSONArray(object); } if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; <START> return new JSONObject(map, useJavaNullAsJsonNull); <END> } Package objectPackage = object.getClass().getPackage(); String objectPackageName = objectPackage != null ? objectPackage .getName() : ""; if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || object.getClass().getClassLoader() == null) { return object.toString(); } return new JSONObject(object); } catch (Exception exception) { return null; } }</code><technical_language>update lines 1852 1855 new JSONArray constructors: java if (object instanceof Collection) { Collection<?> coll = (Collection<?>) object; return new JSONArray(coll, useJavaNullAsJsonNull); } if (object.getClass().isArray()) { return new JSONArray(object, useJavaNullAsJsonNull); }</technical_language>

Target:
public static Object wrap(Object object, boolean useJavaNullAsJsonNull) { try { if (object == null) { return NULL; } if (object instanceof JSONObject || object instanceof JSONArray || NULL.equals(object) || object instanceof JSONString || object instanceof Byte || object instanceof Character || object instanceof Short || object instanceof Integer || object instanceof Long || object instanceof Boolean || object instanceof Float || object instanceof Double || object instanceof String || object instanceof BigInteger || object instanceof BigDecimal || object instanceof Enum) { return object; } if (object instanceof Collection) { Collection<?> coll = (Collection<?>) object; return new JSONArray(coll, useJavaNullAsJsonNull); } if (object.getClass().isArray()) { return new JSONArray(object, useJavaNullAsJsonNull); } if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; return new JSONObject(map, useJavaNullAsJsonNull); } Package objectPackage = object.getClass().getPackage(); String objectPackageName = objectPackage != null ? objectPackage .getName() : ""; if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || object.getClass().getClassLoader() == null) { return object.toString(); } return new JSONObject(object, useJavaNullAsJsonNull); } catch (Exception exception) { return null; } }
Source:
<code>public void multipartSigned__shouldCallOpenPgpApiAsync() throws Exception { BodyPart signedBodyPart; Message message = messageFromBody( multipart("signed", "application/pgp-signature", <START> signedBodyPart = spy(bodypart("text/plain", "content")), <END> bodypart("application/pgp-signature", "content") ) ); message.setFrom(Address.parse("Test <test@example.org>")[0]); OutputStream outputStream = mock(OutputStream.class); processSignedMessageAndCaptureMocks(message, signedBodyPart, outputStream); assertEquals(OpenPgpApi.ACTION_DECRYPT_VERIFY, capturedApiIntent.getAction()); assertEquals("test@example.org", capturedApiIntent.getStringExtra(OpenPgpApi.EXTRA_SENDER_ADDRESS)); verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(message, capturedApiIntent); verifyNoMoreInteractions(autocryptOperations); }</code><technical_language>a fan of inline assignments. Especially syntax for named arguments in Kotlin</technical_language>

Target:
public void multipartSigned__shouldCallOpenPgpApiAsync() throws Exception { BodyPart signedBodyPart = spy(bodypart("text/plain", "content")); Message message = messageFromBody( multipart("signed", "protocol=\"application/pgp-signature\"", signedBodyPart, bodypart("application/pgp-signature", "content") ) ); message.setFrom(Address.parse("Test <test@example.org>")[0]); OutputStream outputStream = mock(OutputStream.class); processSignedMessageAndCaptureMocks(message, signedBodyPart, outputStream); assertEquals(OpenPgpApi.ACTION_DECRYPT_VERIFY, capturedApiIntent.getAction()); assertEquals("test@example.org", capturedApiIntent.getStringExtra(OpenPgpApi.EXTRA_SENDER_ADDRESS)); verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(message, capturedApiIntent); verifyNoMoreInteractions(autocryptOperations); }
Source:
<code>public int compareTo(RMEvent event) { <START> return (int) this.getCounter() - (int) event.getCounter(); <END> }</code><technical_language>I casting counters computing difference is a mistake. end truncate long computing a false difference, we? safer do return (int) (this.getCounter() - event.getCounter());. Also, field access instead of getters for counter</technical_language>

Target:
public int compareTo(RMEvent event) { return Long.compare(this.counter, event.counter); }
Source:
<code>private void processShallow(@Nullable List<ObjectId> shallowCommits, List<ObjectId> unshallowCommits, boolean writeToPckOut) throws IOException { if (options.contains(OPTION_DEEPEN_RELATIVE) || shallowSince != 0 || <START> shallowExcludeRefs.size() > 0) { <END> throw new UnsupportedOperationException(); } int walkDepth = depth - 1; try (DepthWalk.RevWalk depthWalk = new DepthWalk.RevWalk( walk.getObjectReader(), walkDepth)) { for (ObjectId o : wantIds) { try { depthWalk.markRoot(depthWalk.parseCommit(o)); } catch (IncorrectObjectTypeException notCommit) { } } RevCommit o; while ((o = depthWalk.next()) != null) { DepthWalk.Commit c = (DepthWalk.Commit) o; if (c.getDepth() == walkDepth && !clientShallowCommits.contains(c)) { if (shallowCommits != null) { shallowCommits.add(c.copy()); } if (writeToPckOut) { pckOut.writeString("shallow " + o.name()); } } if (c.getDepth() < walkDepth && clientShallowCommits.remove(c)) { unshallowCommits.add(c.copy()); if (writeToPckOut) { pckOut.writeString("unshallow " + c.name()); } } } } if (writeToPckOut) { pckOut.end(); } }</code><technical_language>!isEmpty()</technical_language>

Target:
private void processShallow(@Nullable List<ObjectId> shallowCommits, List<ObjectId> unshallowCommits, boolean writeToPckOut) throws IOException { if (options.contains(OPTION_DEEPEN_RELATIVE) || shallowSince != 0 || !shallowExcludeRefs.isEmpty()) { throw new UnsupportedOperationException(); } int walkDepth = depth - 1; try (DepthWalk.RevWalk depthWalk = new DepthWalk.RevWalk( walk.getObjectReader(), walkDepth)) { for (ObjectId o : wantIds) { try { depthWalk.markRoot(depthWalk.parseCommit(o)); } catch (IncorrectObjectTypeException notCommit) { } } RevCommit o; while ((o = depthWalk.next()) != null) { DepthWalk.Commit c = (DepthWalk.Commit) o; if (c.getDepth() == walkDepth && !clientShallowCommits.contains(c)) { if (shallowCommits != null) { shallowCommits.add(c.copy()); } if (writeToPckOut) { pckOut.writeString("shallow " + o.name()); } } if (c.getDepth() < walkDepth && clientShallowCommits.remove(c)) { unshallowCommits.add(c.copy()); if (writeToPckOut) { pckOut.writeString("unshallow " + c.name()); } } } } if (writeToPckOut) { pckOut.end(); } }
Source:
<code>public List<String> getDependencies() { List<String> dependencies = new ArrayList<String>(); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxGID"); <START> dependencies.add(A_R_unixGroupName_namespace + ":*"); <END> return dependencies; }</code><technical_language>output like: dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxGID"); //Disallowed of crosschecks modules peformance reason //dependencies.add(A_R_unixGroupName_namespace + ":*"); //dependencies.add(A_G_unixGID_namespace + ":*"); //dependencies.add(A_G_unixGroupName_namespace + ":*"); //Temporary disallowed for performance reason //dependencies.add(A_E_usedGids);</technical_language>

Target:
public List<String> getDependencies() { List<String> dependencies = new ArrayList<String>(); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxGID"); return dependencies; }
Source:
<code><START> public void addChild(TimeGraphEntry entry) { <END> int index; for (index = 0; index < getChildren().size(); index++) { ResourcesEntry other = (ResourcesEntry) getChildren().get(index); if (entry.compareTo(other) < 0) { break; } } entry.setParent(this); getChildren().add(index, entry); }</code><technical_language>this change base class</technical_language>

Target:
public void addChild(TimeGraphEntry entry) { if (!(entry instanceof ResourcesEntry)) { throw new IllegalArgumentException(); } ResourcesEntry rEntry = (ResourcesEntry) entry; int index; for (index = 0; index < getChildren().size(); index++) { ResourcesEntry other = (ResourcesEntry) getChildren().get(index); if (rEntry.compareTo(other) < 0) { break; } } entry.setParent(this); getChildren().add(index, entry); }
Source:
<code><START> private DayActivity createNewDayActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) <END> { DayActivity dayActivity = DayActivity.createInstance(userAnonymized.getID(), matchingGoal, getZonedStartOfDay(payload.startTime, userAnonymized)); ZonedDateTime zonedStartOfWeek = getZonedStartOfWeek(payload.startTime, userAnonymized); WeekActivity weekActivity = cacheService.fetchWeekActivityForUser(userAnonymized.getID(), matchingGoal.getID(), zonedStartOfWeek); if (weekActivity == null) { weekActivity = WeekActivity.createInstance(userAnonymized.getID(), matchingGoal, zonedStartOfWeek); } weekActivity.addActivity(dayActivity); cacheService.updateWeekActivityForUser(weekActivity); return dayActivity; }</code><technical_language>If threads concurrently conclude day activity is missing, end entities for day. need figure out handle that. I propose create a separate ticket for this</technical_language>

Target:
private DayActivity createNewDayActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { UserAnonymized userAnonymizedEntity = userAnonymizedService.getUserAnonymizedEntity(userAnonymized.getID()); DayActivity dayActivity = DayActivity.createInstance(userAnonymizedEntity, matchingGoal, getStartOfDay(payload.startTime, userAnonymized)); ZonedDateTime startOfWeek = getStartOfWeek(payload.startTime, userAnonymized); WeekActivity weekActivity = cacheService.fetchWeekActivityForUser(userAnonymized.getID(), matchingGoal.getID(), startOfWeek); if (weekActivity == null) { weekActivity = WeekActivity.createInstance(userAnonymizedEntity, matchingGoal, startOfWeek); } weekActivity.addDayActivity(dayActivity); cacheService.updateWeekActivityForUser(weekActivity); return dayActivity; }
Source:
<code>public Collection<Proposal> getProposals(JsonPointer pointer, JsonDocument document, Scope scope) { final ContextType type = contextTypes.get(document.getModel(), pointer); final IFile currentFile = getActiveFile(); final IPath basePath = currentFile.getParent().getFullPath(); final List<Proposal> proposals = Lists.newArrayList(); TypeDefinition schemaType = document.getModel().find(pointer).getType(); <START> System.out.println("SCHEMA TYPE: " + schemaType.getPointer()); <END> if (scope == Scope.LOCAL) { proposals.addAll(type.collectProposals(document, null)); } else if (!type.isLocalOnly()) { final SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType); for (IFile file : fileFinder.collectFiles(scope, currentFile)) { IPath relative = file.equals(currentFile) ? null : file.getFullPath().makeRelativeTo(basePath); if (file.equals(currentFile)) { proposals.addAll(type.collectProposals(document, relative)); } else { proposals.addAll(type.collectProposals(manager.getDocument(file.getLocationURI()), relative)); } } } return proposals; }</code><technical_language>this log removed</technical_language>

Target:
public Collection<Proposal> getProposals(JsonPointer pointer, JsonDocument document, Scope scope) { final ContextType type = contextTypes.get(document.getModel(), pointer); final IFile currentFile = getActiveFile(); final IPath basePath = currentFile.getParent().getFullPath(); final List<Proposal> proposals = Lists.newArrayList(); if (scope == Scope.LOCAL) { proposals.addAll(type.collectProposals(document, null)); } else if (!type.isLocalOnly()) { final SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType); for (IFile file : fileFinder.collectFiles(scope, currentFile)) { IPath relative = file.equals(currentFile) ? null : file.getFullPath().makeRelativeTo(basePath); if (file.equals(currentFile)) { proposals.addAll(type.collectProposals(document, relative)); } else { proposals.addAll(type.collectProposals(manager.getDocument(file.getLocationURI()), relative)); } } } return proposals; }
Source:
<code>private void pushdown(TopNKeyOperator topNKey) throws SemanticException { final Operator<? extends OperatorDesc> parent = topNKey.getParentOperators().get(0); switch (parent.getType()) { case SELECT: pushdownThroughSelect(topNKey); break; case FORWARD: moveDown(topNKey); pushdown(topNKey); break; case GROUPBY: pushdownThroughGroupBy(topNKey); break; case REDUCESINK: pushdownThroughReduceSink(topNKey); break; case MERGEJOIN: case JOIN: { final CommonJoinOperator<? extends JoinDesc> join = (CommonJoinOperator<? extends JoinDesc>) parent; final JoinCondDesc[] joinConds = join.getConf().getConds(); final JoinCondDesc firstJoinCond = joinConds[0]; for (JoinCondDesc joinCond : joinConds) { if (!firstJoinCond.equals(joinCond)) { return; } } switch (firstJoinCond.getType()) { case JoinDesc.FULL_OUTER_JOIN: pushdownThroughFullOuterJoin(topNKey); break; case JoinDesc.LEFT_OUTER_JOIN: pushdownThroughLeftOuterJoin(topNKey); break; case JoinDesc.RIGHT_OUTER_JOIN: pushdownThroughRightOuterJoin(topNKey); break; <START> case JoinDesc.INNER_JOIN: <END> pushdownThroughInnerJoin(topNKey); break; } } break; case TOPNKEY: if (hasSameTopNKeyDesc(parent, topNKey.getConf())) { parent.removeChildAndAdoptItsChildren(topNKey); } break; } }</code><technical_language>pushdown Join guarantees a record is producing output record</technical_language>

Target:
private void pushdown(TopNKeyOperator topNKey) throws SemanticException { final Operator<? extends OperatorDesc> parent = topNKey.getParentOperators().get(0); switch (parent.getType()) { case SELECT: pushdownThroughSelect(topNKey); break; case FORWARD: moveDown(topNKey); pushdown(topNKey); break; case GROUPBY: pushdownThroughGroupBy(topNKey); break; case REDUCESINK: pushdownThroughReduceSink(topNKey); break; case MERGEJOIN: case JOIN: { final CommonJoinOperator<? extends JoinDesc> join = (CommonJoinOperator<? extends JoinDesc>) parent; final JoinCondDesc[] joinConds = join.getConf().getConds(); final JoinCondDesc firstJoinCond = joinConds[0]; for (JoinCondDesc joinCond : joinConds) { if (!firstJoinCond.equals(joinCond)) { return; } } switch (firstJoinCond.getType()) { case JoinDesc.FULL_OUTER_JOIN: pushdownThroughFullOuterJoin(topNKey); break; case JoinDesc.LEFT_OUTER_JOIN: pushdownThroughLeftOuterJoin(topNKey); break; case JoinDesc.RIGHT_OUTER_JOIN: pushdownThroughRightOuterJoin(topNKey); break; default: break; } } break; case TOPNKEY: if (hasSameTopNKeyDesc(parent, topNKey.getConf())) { parent.removeChildAndAdoptItsChildren(topNKey); } break; default: break; } }
Source:
<code>public void changeElementOpacity(String selector, int value) { <START> driver.findElement(By.cssSelector(selector)); <END> js.executeScript( "document.querySelector(arguments[0]).style.opacity = arguments[1];", selector, value); }</code><technical_language>is purpose of this line</technical_language>

Target:
public void changeElementOpacity(String selector, int value) { js.executeScript( "document.querySelector(arguments[0]).style.opacity = arguments[1];", selector, value); }
Source:
<code>public void reset(LogPartition partition) { <START> ChronicleLogTailer<M> tailer = tailers.stream().filter(t -> t.assignments().contains(partition)).findFirst().orElse(null); <END> if (tailer == null) { throw new IllegalArgumentException(String.format("Cannot reset, partition: %s not found on tailer assignments: %s", partition, logPartitions)); } }</code><technical_language>orElse(null) leverage Optional#isPresent Optional#orElseThrown</technical_language>

Target:
public void reset(LogPartition partition) { ChronicleLogTailer<M> tailer = tailers.stream() .filter(t -> t.assignments().contains(partition)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(String.format( "Cannot reset, partition: %s not found on tailer assignments: %s", partition, logPartitions))); tailer.reset(); }
Source:
<code>private void monitorAndForwardSplits( SourceContext<TimestampedHiveInputSplit> context) throws IOException, TException { assert (Thread.holdsLock(checkpointLock)); List<Partition> partitions = client.listPartitionsByFilter( tablePath.getDatabaseName(), tablePath.getObjectName(), strategy.generateFetchFilter(partitionKeys, currentReadTime), (short) -1); if (partitions.isEmpty()) { return; } long maxTime = Long.MIN_VALUE; <START> for (Partition partition : partitions) { <END> List<String> partSpec = partition.getValues(); if (!this.distinctPartitions.contains(partSpec)) { this.distinctPartitions.add(partition.getValues()); long time = this.strategy.extractPartTime(partitionKeys, partition.getValues()); if (time > maxTime) { maxTime = time; } HiveTableInputSplit[] splits = HiveTableInputFormat.createInputSplits( this.readerParallelism, Collections.singletonList(toHiveTablePartition(partition)), this.conf.conf()); for (HiveTableInputSplit split : splits) { context.collect(new TimestampedHiveInputSplit(time, split)); } } } this.currentReadTime = maxTime; this.distinctPartitions.removeIf(partSpec -> this.strategy.canExpireForDistinct( this.strategy.extractPartTime(partitionKeys, partSpec), this.currentReadTime)); }</code><technical_language>java doc mentions splits forwarded in a specific order. sorting partitions here</technical_language>

Target:
private void monitorAndForwardSplits( SourceContext<TimestampedHiveInputSplit> context) throws Exception { assert (Thread.holdsLock(checkpointLock)); List<Tuple2<Partition, Long>> partitions = fetcher.fetchPartitions(this.context, currentReadTime); if (partitions.isEmpty()) { return; } partitions.sort((o1, o2) -> (int) (o1.f1 - o2.f1)); long maxTimestamp = Long.MIN_VALUE; Set<List<String>> nextDistinctParts = new HashSet<>(); for (Tuple2<Partition, Long> tuple2 : partitions) { Partition partition = tuple2.f0; List<String> partSpec = partition.getValues(); if (!this.distinctPartitions.contains(partSpec)) { this.distinctPartitions.add(partSpec); long timestamp = tuple2.f1; if (timestamp > currentReadTime) { nextDistinctParts.add(partSpec); } if (timestamp > maxTimestamp) { maxTimestamp = timestamp; } HiveTableInputSplit[] splits = HiveTableInputFormat.createInputSplits( this.readerParallelism, Collections.singletonList(toHiveTablePartition(partition)), this.conf.conf()); for (HiveTableInputSplit split : splits) { context.collect(new TimestampedHiveInputSplit(timestamp, split)); } } } if (maxTimestamp > currentReadTime) { currentReadTime = maxTimestamp; distinctPartitions.clear(); distinctPartitions.addAll(nextDistinctParts); } }
Source:
<code>public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); try { nextStatement.evaluate(); } catch (Throwable e) { errors.add(e); } IAfterTest after = null; log.debug("Run after test extensions for test class " + testClass.getJavaClass().getName()); for (IAfterTest each : afters) { try { after = each; if (after.hasToRun()){ log.debug("Run method runAfterTest() of class " + after.getClass().getCanonicalName()); after.runAfterTest(config, target, frameworkMethod); } } catch (Throwable e) { <START> log.error("Run method runAfterTest() of class " + after.getClass().getCanonicalName() + " failed", e); <END> if (isScreenshotRequired(e)) { createScreenshot("AfterTestExt", after.getClass()); } errors.add(e); } } MultipleFailureException.assertEmpty(errors); }</code><technical_language>move error log condition body</technical_language>

Target:
public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); try { nextStatement.evaluate(); } catch (Throwable e) { errors.add(e); } IAfterTest after = null; log.debug("Run after test extensions for test class " + testClass.getJavaClass().getName()); for (IAfterTest each : afters) { try { after = each; if (after.hasToRun()){ log.debug("Run method runAfterTest() of class " + after.getClass().getCanonicalName()); after.runAfterTest(config, target, frameworkMethod); } } catch (Throwable e) { if(ScreenshotCapturer.shouldCaptureScreenshotOnException(e)){ log.error("Run method runAfterTest() of class " + after.getClass().getCanonicalName() + " failed", e); createScreenshot("AfterTestExt", after.getClass()); } errors.add(e); } } MultipleFailureException.assertEmpty(errors); }
Source:
<code>public void testImportDump() throws OWLOntologyCreationException, IOException { String journalPath = "/tmp/journal.jrnl"; String sourceModelPath = "src/test/resources/dummy-noctua-model.ttl"; String targetModelPath = "/tmp/http:/model.geneontology.org/0000000300000001.ttl"; File journalFile = new File(journalPath); File targetModelFile = new File(journalPath); FileUtils.deleteQuietly(journalFile); FileUtils.deleteQuietly(targetModelFile); final ParserWrapper pw1 = new ParserWrapper(); pw1.addIRIMapper(new CatalogXmlIRIMapper(new File("src/test/resources/mmg/catalog-v001.xml"))); OWLGraphWrapper g = pw1.parseToOWLGraph(getResourceIRIString("mmg/basic-tbox-importer.omn")); <START> BlazegraphMolecularModelManager m3 = new BlazegraphMolecularModelManager<>(g, "go", journalPath, "/tmp"); <END> try { m3.importModelToDatabase(new File(sourceModelPath)); m3.dumpAllStoredModels(); Model sourceModel = ModelFactory.createDefaultModel() ; Model targetModel = ModelFactory.createDefaultModel() ; sourceModel.read(sourceModelPath); targetModel.read(targetModelPath); if (compareModels(sourceModel, targetModel) != true) fail("Missing statements in target model."); if (compareModels(targetModel, sourceModel) != true) fail("Sprious statements in target model."); } catch (Exception e) { e.printStackTrace(); fail(); } }</code><technical_language>JUnit some methods for more safely making tmp folders. is example in UndoAwareMolecularModelManagerTest. this matters</technical_language>

Target:
public void testImportDump() throws OWLOntologyCreationException, IOException, RepositoryException, RDFParseException, RDFHandlerException, OWLOntologyStorageException { String journalPath = folder.newFile().getAbsolutePath(); String tempRootPath = folder.getRoot().getAbsolutePath(); String sourceModelPath = "src/test/resources/dummy-noctua-model.ttl"; final ParserWrapper pw1 = new ParserWrapper(); pw1.addIRIMapper(new CatalogXmlIRIMapper(new File("src/test/resources/mmg/catalog-v001.xml"))); OWLGraphWrapper g = pw1.parseToOWLGraph(getResourceIRIString("mmg/basic-tbox-importer.omn")); BlazegraphMolecularModelManager<Void> m3 = new BlazegraphMolecularModelManager<>(g, "http:/model.geneontology.org/", journalPath, tempRootPath); m3.importModelToDatabase(new File(sourceModelPath)); for (IRI modelId : m3.getStoredModelIds()) m3.dumpStoredModel(modelId, folder.getRoot()); Model sourceModel = ModelFactory.createDefaultModel(); sourceModel.read(sourceModelPath); Model targetModel = ModelFactory.createDefaultModel(); for (IRI modelId : m3.getStoredModelIds()) targetModel.read(tempRootPath + File.separator + modelId + ".ttl"); if (sourceModel.isIsomorphicWith(targetModel) != true) fail("Source graphs and target graphs are not isomorphic."); }
Source:
<code>private String[] getSparkHomeConf() { String sparkHome = null; String sparkConf = null; <START> String jobSparkVer = getJobProps().get(SparkJobArg.SPARK_VERSION.azPropName); <END> if (jobSparkVer != null) { sparkHome = getSysProps().get("spark." + jobSparkVer + ".home"); if (sparkHome != null) { sparkConf = getSysProps().get("spark." + jobSparkVer + ".conf"); if (sparkConf == null) { sparkConf = sparkHome + "/conf"; } info("Using job specific spark: " + sparkHome + " and conf: " + sparkConf); getJobProps().put("env." + SPARK_HOME_ENV_VAR, sparkHome); getJobProps().put("env." + SPARK_CONF_DIR_ENV_VAR, sparkConf); } } if (sparkHome == null) { sparkHome = getSysProps().get("spark.home"); if (sparkHome == null) { sparkHome = System.getenv(SPARK_HOME_ENV_VAR); } sparkConf = (System.getenv(SPARK_CONF_DIR_ENV_VAR) != null) ? System.getenv(SPARK_CONF_DIR_ENV_VAR) : (sparkHome + "/conf"); info("Using system default spark: " + sparkHome + " and conf: " + sparkConf); } if (sparkHome == null) { throw new RuntimeException("SPARK is not available on the azkaban machine."); } return new String[]{sparkHome, sparkConf}; }</code><technical_language>aware of BangBang project? discuss @cwsteinbach future directions manage user dependencies</technical_language>

Target:
private String[] getSparkHomeConf() { String sparkHome = null; String sparkConf = null; String jobSparkVer = getJobProps().get(SparkJobArg.SPARK_VERSION.azPropName); if (jobSparkVer != null) { info("This job set spark version: " + jobSparkVer); sparkHome = getSysProps().get("spark." + jobSparkVer + ".home"); if (sparkHome != null) { sparkConf = getSysProps().get("spark." + jobSparkVer + ".conf"); if (sparkConf == null) { sparkConf = sparkHome + "/conf"; } info("Using job specific spark: " + sparkHome + " and conf: " + sparkConf); getJobProps().put("env." + SPARK_HOME_ENV_VAR, sparkHome); getJobProps().put("env." + SPARK_CONF_DIR_ENV_VAR, sparkConf); } else { info("The spark version " + jobSparkVer +" is not supported. Using system default."); } } if (sparkHome == null) { sparkHome = getSysProps().get("spark.home"); if (sparkHome == null) { sparkHome = System.getenv(SPARK_HOME_ENV_VAR); } sparkConf = (System.getenv(SPARK_CONF_DIR_ENV_VAR) != null) ? System.getenv(SPARK_CONF_DIR_ENV_VAR) : (sparkHome + "/conf"); info("Using system default spark: " + sparkHome + " and conf: " + sparkConf); } if (sparkHome == null) { throw new RuntimeException("SPARK is not available on the azkaban machine."); } else { File homeDir = new File(sparkHome); if (!homeDir.exists()) { throw new RuntimeException("SPARK home dir does not exist."); } File confDir = new File(sparkConf); if (!confDir.exists()) { error("SPARK conf dir does not exist. Will use SPARK_HOME/conf as default."); } } return new String[]{sparkHome, sparkConf}; }
Source:
<code>private boolean isObjectInInnerClass(VariableTree variableTree) { if (nestedClassesLevel > 1) { <START> if (variableTree.type().is(Tree.Kind.IDENTIFIER)) { <END> return !"String".equals(((IdentifierTree) variableTree.type()).name()); } else { ExpressionTree initializer = variableTree.initializer(); return !(variableTree.type().is(Tree.Kind.PRIMITIVE_TYPE) && initializer != null && ConstantUtils.resolveAsConstant(initializer) != null); } } return false; }</code><technical_language>I this removed consistent minimizing FP. Currently, compliant test case for case non-compliant for strings: private final long creation = valueAtCreationTime; // compliant private final String creationStr = "" + valueAtCreationTime; // Noncompliant</technical_language>

Target:
private boolean isObjectInInnerClass(VariableTree variableTree) { if (nestedClassesLevel > 1) { ExpressionTree initializer = variableTree.initializer(); return !((variableTree.type().is(Tree.Kind.PRIMITIVE_TYPE) || variableTree.symbol().type().is("java.lang.String")) && initializer != null && ConstantUtils.resolveAsConstant(initializer) != null); } return false; }
Source:
<code>public MessageFormatSend(MessageReadSet readSet, MessageFormatFlags flag, MessageFormatMetrics metrics) throws IOException, MessageFormatException { this.readSet = readSet; this.flag = flag; totalSizeToWrite = 0; <START> this.metrics = metrics; <END> calculateOffsets(); sizeWritten = 0; currentWriteIndex = 0; sizeWrittenFromCurrentIndex = 0; }</code><technical_language>cleaner for calculateOffsets metrics argument, return passed metrics method invocation, for timing of cacluateOffsets updating of metrics done constructor. I prefer option in list. In cases, is need for metrics member of this class</technical_language>

Target:
public MessageFormatSend(MessageReadSet readSet, MessageFormatFlags flag, MessageFormatMetrics metrics) throws IOException, MessageFormatException { this.readSet = readSet; this.flag = flag; totalSizeToWrite = 0; long startTime = SystemTime.getInstance().milliseconds(); calculateOffsets(); metrics.calculateOffsetMessageFormatSendTime.update(SystemTime.getInstance().milliseconds() - startTime); sizeWritten = 0; currentWriteIndex = 0; sizeWrittenFromCurrentIndex = 0; }
Source:
<code>public Set<Message> getAllMessages() { List<Message> allMessages = null; LinkedHashSet<Message> allOrderedMessages = null; if (useCache) { if (allMessagesCache != null) { allMessages = Lists.newArrayList(allMessagesCache); } allOrderedMessages = allOrderedMessagesCache; } if (allOrderedMessages == null) { if (allMessages == null) { allMessages = Lists.newArrayList(); for (Edge edge : Iterables.filter(Iterables.filter(getNotationDiagram().getEdges(), Edge.class), Message.notationPredicate())) { Option<Message> message = ISequenceElementAccessor.getMessage(edge); assert message.some() : INTERNAL_ERROR; allMessages.add(message.get()); } if (useCache) { allMessagesCache = <START> Lists.newArrayList(allMessages); <END> } } Collections.sort(allMessages, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedMessages = Sets.newLinkedHashSet(allMessages); if (useCache) { allOrderedMessagesCache = allOrderedMessages; } } return allOrderedMessages; }</code><technical_language>getAllLifelines remarks</technical_language>

Target:
public Set<Message> getAllMessages() { List<Message> allMessages = null; LinkedHashSet<Message> allOrderedMessages = null; if (useCache) { if (allMessagesCache != null) { allMessages = Lists.newArrayList(allMessagesCache); } allOrderedMessages = allOrderedMessagesCache; } if (allOrderedMessages == null) { if (allMessages == null) { allMessages = Lists.newArrayList(); for (Edge edge : Iterables.filter(Iterables.filter(getNotationDiagram().getEdges(), Edge.class), Message.notationPredicate())) { Option<Message> message = ISequenceElementAccessor.getMessage(edge); assert message.some() : INTERNAL_ERROR; allMessages.add(message.get()); } if (useCache) { allMessagesCache = allMessages; } } Collections.sort(allMessages, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedMessages = Sets.newLinkedHashSet(allMessages); if (useCache) { allOrderedMessagesCache = allOrderedMessages; } } return allOrderedMessages; }
Source:
<code>public void remove(KeyCacheObject key, @Nullable CacheDataRow prevRow) throws IgniteCheckedException { <START> if (!qryProcEnabled && !QueryUtils.isEnabled(cctx.config())) <END> return; if (!enterBusy()) return; try { if (isIndexingSpiEnabled()) { Object key0 = unwrapIfNeeded(key, cctx.cacheObjectContext()); cctx.kernalContext().indexing().remove(cacheName, key0); } if (qryProcEnabled && prevRow != null) qryProc.remove(cctx, prevRow); } finally { invalidateResultCache(); leaveBusy(); } }</code><technical_language>condition matter? QueryUtils.isEnabled(cctx.config())</technical_language>

Target:
public void remove(KeyCacheObject key, @Nullable CacheDataRow prevRow) throws IgniteCheckedException { if (!qryProcEnabled) return; if (!enterBusy()) return; try { if (isIndexingSpiEnabled()) { Object key0 = unwrapIfNeeded(key, cctx.cacheObjectContext()); cctx.kernalContext().indexing().remove(cacheName, key0); } if (qryProcEnabled && prevRow != null) qryProc.remove(cctx, prevRow); } finally { invalidateResultCache(); leaveBusy(); } }
Source:
<code>static String handleId(String id) { if (id == null) return null; boolean isAlphanumericLowCase = true; boolean isAlphanumeric = true; for (int i = 0; i < id.length(); i++) { char c = id.charAt(i); if (c >= 65 && c <= 90) { isAlphanumericLowCase = false; } else { <START> if (!( <END> (c >= 48 && c <= 57) || (c == 95) || (c >= 97 && c <= 122) )) { isAlphanumeric = false; isAlphanumericLowCase = false; break; } } } if (isAlphanumericLowCase) { return id; } if (isAlphanumeric) { return id.toLowerCase(); } return ParseUtils.unDoubleQuote(id); }</code><technical_language>Nit: else if here</technical_language>

Target:
static String handleId(String id) { if (id == null) return null; boolean isAlphanumericLowCase = true; boolean isAlphanumeric = true; for (int i = 0; i < id.length(); i++) { char c = id.charAt(i); if (c >= 65 && c <= 90) { isAlphanumericLowCase = false; } else if (!( (c >= 48 && c <= 57) || (c == 95) || (c >= 97 && c <= 122) )) { isAlphanumeric = false; isAlphanumericLowCase = false; break; } } if (isAlphanumericLowCase) { return id; } if (isAlphanumeric) { return id.toLowerCase(); } return ParseUtils.unDoubleQuote(id); }
Source:
<code>public String toString() { StringBuilder result = new StringBuilder(); result.append('[').append(currentPage).append(',').append(totalPages) .append(',').append(totalItems).append(',').append(firstIndex) .append(',').append(lastIndex).append(',').append(pageSize) <START> .append(']'); <END> return result.toString(); }</code><technical_language>return new StringBuilder().append()....toString();</technical_language>

Target:
public String toString() { return new StringBuilder().append('[').append(currentPage).append(',') .append(totalPages).append(',').append(totalItems).append(',') .append(firstIndex).append(',').append(lastIndex).append(',') .append(pageSize).append(']').toString(); }
Source:
<code>public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Project context) { List<StandardUsernamePasswordCredentials> creds = lookupCredentials(StandardUsernamePasswordCredentials.class, context, ACL.SYSTEM, HTTP_SCHEME, HTTPS_SCHEME); <START> return new StandardUsernameListBoxModel().withAll(creds); <END> }</code><technical_language>This method needs a permission check. credentials plugin docs for like</technical_language>

Target:
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Project context) { if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(context.EXTENDED_READ) && !context.hasPermission(CredentialsProvider.USE_ITEM)) { return new StandardUsernameListBoxModel(); } List<StandardUsernamePasswordCredentials> creds = lookupCredentials(StandardUsernamePasswordCredentials.class, context, ACL.SYSTEM, HTTP_SCHEME, HTTPS_SCHEME); return new StandardUsernameListBoxModel().withAll(creds); }
Source:
<code>private Response specSuspendOrResume(final String id, boolean suspend) { return asLeaderWithSupervisorManager( manager -> { if (manager.suspendOrResumeSupervisor(id, suspend)) { Optional<SupervisorSpec> spec = manager.getSupervisorSpec(id); return Response.ok(spec.get()).build(); } else { Optional<SupervisorSpec> spec = manager.getSupervisorSpec(id); final Response.Status status = spec.isPresent() ? Response.Status.BAD_REQUEST : Response.Status.NOT_FOUND; <START> final String errMsg = spec.isPresent() ? StringUtils.format( <END> "[%s] is already %s", id, suspend ? "suspended" : "running" ) : StringUtils.format("[%s] does not exist", id); return Response.status(status) .entity(ImmutableMap.of("error", errMsg)) .build(); } } ); }</code><technical_language>I this is stuff for a ternary assignment, Response.Status status; String errMsg; if (spec.isPresent()) { ... easier follow double check spec.isPresent</technical_language>

Target:
private Response specSuspendOrResume(final String id, boolean suspend) { return asLeaderWithSupervisorManager( manager -> { if (manager.suspendOrResumeSupervisor(id, suspend)) { Optional<SupervisorSpec> spec = manager.getSupervisorSpec(id); return Response.ok(spec.get()).build(); } else { Optional<SupervisorSpec> spec = manager.getSupervisorSpec(id); Response.Status status; String errMsg; if (spec.isPresent()) { status = Response.Status.BAD_REQUEST; errMsg = StringUtils.format("[%s] is already %s", id, suspend ? "suspended" : "running"); } else { status = Response.Status.NOT_FOUND; errMsg = StringUtils.format("[%s] does not exist", id); } return Response.status(status) .entity(ImmutableMap.of("error", errMsg)) .build(); } } ); }
Source:
<code>public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { checkPermission(CONFIGURE); String proposedName = Util.fixEmptyAndTrim(req.getSubmittedForm().getString("name")); Jenkins.checkGoodName(proposedName); Node node = getNode(); if (node == null) { throw new ServletException("No such node " + nodeName); } if ((!proposedName.equals(nodeName)) && Jenkins.getInstance().getNode(proposedName) != null) { <START> throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(proposedName)); <END> } Node result = node.reconfigure(req, req.getSubmittedForm()); replaceBy(result); rsp.sendRedirect2("../" + result.getNodeName() + '/'); }</code><technical_language>I throw <code>FormException</code></technical_language>

Target:
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { checkPermission(CONFIGURE); String proposedName = Util.fixEmptyAndTrim(req.getSubmittedForm().getString("name")); Jenkins.checkGoodName(proposedName); Node node = getNode(); if (node == null) { throw new ServletException("No such node " + nodeName); } if ((!proposedName.equals(nodeName)) && Jenkins.getActiveInstance().getNode(proposedName) != null) { throw new FormException(Messages.ComputerSet_SlaveAlreadyExists(proposedName), "name"); } Node result = node.reconfigure(req, req.getSubmittedForm()); replaceBy(result); rsp.sendRedirect2("../" + result.getNodeName() + '/'); }