auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
QueryInfo getQueryInfo(Optional<StageInfo> rootStage) { QueryState state = queryState.get(); ExecutionFailureInfo failureCause = null; ErrorCode errorCode = null; if (state == QueryState.FAILED) { failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode(); } } boolean completeInfo = getAllStages(rootStage).stream().allMatch(StageInfo::isFinalStageInfo); boolean isScheduled = isScheduled(rootStage); List<TaskId> failedTasks = getAllStages(rootStage).stream() .map(StageInfo::getTasks) .flatMap(List::stream) .filter(taskInfo -> taskInfo.getTaskStatus().getState() == TaskState.FAILED) .map(TaskInfo::getTaskStatus) .map(TaskStatus::getTaskId) .collect(toImmutableList()); return new QueryInfo( queryId, session.toSessionRepresentation(), state, memoryPool.get().getId(), isScheduled, self, outputManager.getQueryOutputInfo().map(QueryOutputInfo::getColumnNames).orElse(ImmutableList.of()), query, getQueryStats(rootStage), Optional.ofNullable(setCatalog.get()), Optional.ofNullable(setSchema.get()), Optional.ofNullable(setPath.get()), setSessionProperties, resetSessionProperties, setRoles, addedPreparedStatements, deallocatedPreparedStatements, Optional.ofNullable(startedTransactionId.get()), clearTransactionId.get(), updateType.get(), rootStage, failureCause, errorCode, warningCollector.getWarnings(), inputs.get(), output.get(), completeInfo, resourceGroup, queryType, failedTasks); }

Target:
QueryInfo getQueryInfo(Optional<StageInfo> rootStage) { QueryState state = queryState.get(); ExecutionFailureInfo failureCause = null; ErrorCode errorCode = null; if (state == QueryState.FAILED) { failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode(); } } boolean completeInfo = getAllStages(rootStage).stream().allMatch(StageInfo::isFinalStageInfo); boolean isScheduled = isScheduled(rootStage); Optional<List<TaskId>> failedTasks; if (state.isDone()) { failedTasks = Optional.of(getAllStages(rootStage).stream() .map(StageInfo::getTasks) .flatMap(List::stream) .filter(taskInfo -> taskInfo.getTaskStatus().getState() == TaskState.FAILED) .map(TaskInfo::getTaskStatus) .map(TaskStatus::getTaskId) .collect(toImmutableList())); } else { failedTasks = Optional.empty(); } return new QueryInfo( queryId, session.toSessionRepresentation(), state, memoryPool.get().getId(), isScheduled, self, outputManager.getQueryOutputInfo().map(QueryOutputInfo::getColumnNames).orElse(ImmutableList.of()), query, getQueryStats(rootStage), Optional.ofNullable(setCatalog.get()), Optional.ofNullable(setSchema.get()), Optional.ofNullable(setPath.get()), setSessionProperties, resetSessionProperties, setRoles, addedPreparedStatements, deallocatedPreparedStatements, Optional.ofNullable(startedTransactionId.get()), clearTransactionId.get(), updateType.get(), rootStage, failureCause, errorCode, warningCollector.getWarnings(), inputs.get(), output.get(), completeInfo, resourceGroup, queryType, failedTasks); }
Source:
protected void delete(Context context, UUID id) { context.turnOffAuthorisationSystem(); Bitstream bit = null; try { bit = bs.find(context, id); if (bit.getCommunity() != null | bit.getCollection() != null) { throw new RuntimeException(); } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } try { bs.delete(context, bit); } catch (SQLException | AuthorizeException | IOException e) { throw new RuntimeException(e.getMessage(), e); } context.restoreAuthSystemState(); }

Target:
protected void delete(Context context, UUID id) throws AuthorizeException { Bitstream bit = null; try { bit = bs.find(context, id); if (bit.getCommunity() != null | bit.getCollection() != null) { throw new UnprocessableEntityException("The bitstream cannot be deleted it is a logo"); } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } try { bs.delete(context, bit); } catch (SQLException | IOException e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
public void testReadConfigurationFile() throws IOException, ConfigException { File file = new File("test.conf"); OutputStream io = new FileOutputStream(file); try { io.write((ENABLE_CLIENT_SASL_KEY + "=true\n").getBytes()); io.write((ZK_SASL_CLIENT_USERNAME + "=ZK\n").getBytes()); io.write((LOGIN_CONTEXT_NAME_KEY + "=MyClient\n").getBytes()); io.write((ZOOKEEPER_SERVER_REALM + "=HADOOP.COM\n").getBytes()); io.write(("dummyProperty=dummyValue").getBytes()); io.flush(); } finally { io.close(); } try { ZKClientConfig conf = new ZKClientConfig(); conf.addConfiguration(file.getAbsolutePath()); assertEquals(conf.getProperty(ENABLE_CLIENT_SASL_KEY), "true"); assertEquals(conf.getProperty(ZK_SASL_CLIENT_USERNAME), "ZK"); assertEquals(conf.getProperty(LOGIN_CONTEXT_NAME_KEY), "MyClient"); assertEquals(conf.getProperty(ZOOKEEPER_SERVER_REALM), "HADOOP.COM"); assertNotNull(conf.getProperty("dummyProperty")); } finally { if (file != null) { file.delete(); } } }

Target:
public void testReadConfigurationFile() throws IOException, ConfigException { File file = File.createTempFile("clientConfig", ".conf", testData); file.deleteOnExit(); Properties clientConfProp = new Properties(); clientConfProp.setProperty(ENABLE_CLIENT_SASL_KEY, "true"); clientConfProp.setProperty(ZK_SASL_CLIENT_USERNAME, "ZK"); clientConfProp.setProperty(LOGIN_CONTEXT_NAME_KEY, "MyClient"); clientConfProp.setProperty(ZOOKEEPER_SERVER_REALM, "HADOOP.COM"); clientConfProp.setProperty("dummyProperty", "dummyValue"); OutputStream io = new FileOutputStream(file); try { clientConfProp.store(io, "Client Configurations"); } finally { io.close(); } ZKClientConfig conf = new ZKClientConfig(); conf.addConfiguration(file.getAbsolutePath()); assertEquals(conf.getProperty(ENABLE_CLIENT_SASL_KEY), "true"); assertEquals(conf.getProperty(ZK_SASL_CLIENT_USERNAME), "ZK"); assertEquals(conf.getProperty(LOGIN_CONTEXT_NAME_KEY), "MyClient"); assertEquals(conf.getProperty(ZOOKEEPER_SERVER_REALM), "HADOOP.COM"); assertEquals(conf.getProperty("dummyProperty"), "dummyValue"); file.delete(); }
Source:
private void processWithAccessKeyLogger(Set<AccessLogData> logSet, File file) throws IOException { FileWriter writer = new FileWriter(file, true); try { for (Iterator<AccessLogData> iterator = logSet.iterator(); iterator.hasNext(); iterator.remove()) { writer.write(iterator.next().getLogMessage()); writer.write("\r\n"); } writer.flush(); } finally { writer.close(); } }

Target:
private void processWithAccessKeyLogger(Set<AccessLogData> logSet, File file) throws IOException { try (FileWriter writer = new FileWriter(file, true)) { for (Iterator<AccessLogData> iterator = logSet.iterator(); iterator.hasNext(); iterator.remove()) { writer.write(iterator.next().getLogMessage()); writer.write("\r\n"); } writer.flush(); } }
Source:
private void addPartitionSplitChangeToPendingAssignments(Collection<KafkaPartitionSplit> newPartitionSplits) { int numReaders = context.currentParallelism(); for (KafkaPartitionSplit split : newPartitionSplits) { int ownerReader = split.getTopicPartition().hashCode() % numReaders; pendingPartitionSplitAssignment.computeIfAbsent(ownerReader, r -> new HashSet<>()).add(split); } LOG.debug("Assigned to readers of consumer group {}.", newPartitionSplits, numReaders, consumerGroupId); }

Target:
private void addPartitionSplitChangeToPendingAssignments(Collection<KafkaPartitionSplit> newPartitionSplits) { int numReaders = context.currentParallelism(); for (KafkaPartitionSplit split : newPartitionSplits) { int ownerReader = getSplitOwner(split.getTopicPartition(), numReaders); pendingPartitionSplitAssignment.computeIfAbsent(ownerReader, r -> new HashSet<>()).add(split); } LOG.debug("Assigned to readers of consumer group {}.", newPartitionSplits, numReaders, consumerGroupId); }
Source:
public void testRangeRequestSimpleBlob() throws Exception { for (int i = 0; i < 5; i++) { blobSize = random.nextInt(maxChunkSize) + 1; int randomOne = random.nextInt(blobSize); int randomTwo = random.nextInt(blobSize); testRangeRequestClosedRange(Math.min(randomOne, randomTwo), Math.max(randomOne, randomTwo), true); } blobSize = random.nextInt(maxChunkSize) + 1; testRangeRequestClosedRange(0, blobSize - 1, true); testRangeRequestOpenRange(random.nextInt(blobSize), true); testRangeRequestLastNBytes(random.nextInt(blobSize) + 1, true); testRangeRequestLastNBytes(blobSize + 1, false); testRangeRequestClosedRange(random.nextInt(blobSize), blobSize + 5, false); testRangeRequestOpenRange(blobSize, false); testRangeRequestClosedRange(blobSize, blobSize + 20, false); testRangeRequestLastNBytes(0, true); }

Target:
public void testRangeRequestSimpleBlob() throws Exception { for (int i = 0; i < 5; i++) { blobSize = random.nextInt(maxChunkSize) + 1; int randomOne = random.nextInt(blobSize); int randomTwo = random.nextInt(blobSize); testRangeRequestOffsetRange(Math.min(randomOne, randomTwo), Math.max(randomOne, randomTwo), true); } blobSize = random.nextInt(maxChunkSize) + 1; testRangeRequestOffsetRange(0, blobSize - 1, true); testRangeRequestFromStartOffset(random.nextInt(blobSize), true); testRangeRequestLastNBytes(random.nextInt(blobSize) + 1, true); testRangeRequestLastNBytes(blobSize + 1, false); testRangeRequestOffsetRange(random.nextInt(blobSize), blobSize + 5, false); testRangeRequestFromStartOffset(blobSize, false); testRangeRequestOffsetRange(blobSize, blobSize + 20, false); testRangeRequestLastNBytes(0, true); testRangeRequestOffsetRange(0, 0, true); testRangeRequestOffsetRange(blobSize - 1, blobSize - 1, true); testRangeRequestFromStartOffset(blobSize - 1, true); testRangeRequestLastNBytes(1, true); }
Source:
protected void onSelectionChanged(int selStart, int selEnd) { if (hintVisible) { selStart = 0; } selEnd = selStart; if (tokenClickStyle != null && tokenClickStyle.isSelectable()) { Editable text = getText(); if (text != null) { clearSelections(); } } if (prefix != null && (selStart < prefix.length() || selEnd < prefix.length())) { setSelection(prefix.length()); } else { Editable text = getText(); if (text != null) { TokenImageSpan[] spans = text.getSpans(selStart, selEnd, TokenImageSpan.class); for (TokenImageSpan span: spans) { int spanEnd = text.getSpanEnd(span); if (selStart <= spanEnd && text.getSpanStart(span) < selStart) { setSelection(spanEnd); return; } } } super.onSelectionChanged(selStart, selEnd); } }

Target:
protected void onSelectionChanged(int selStart, int selEnd) { if (hintVisible) { selStart = 0; } selEnd = selStart; if (tokenClickStyle != null && tokenClickStyle.isSelectable()) { Editable text = getText(); if (text != null) { clearSelections(); } } if (prefix != null && (selStart < prefix.length() || selEnd < prefix.length())) { setSelection(prefix.length()); } else { Editable text = getText(); if (text != null) { TokenImageSpan[] spans = text.getSpans(selStart, selEnd, TokenImageSpan.class); for (TokenImageSpan span: spans) { int spanEnd = text.getSpanEnd(span); if (selStart <= spanEnd && text.getSpanStart(span) < selStart) { if(spanEnd==text.length()) setSelection(spanEnd); else setSelection(spanEnd+1); return; } } } super.onSelectionChanged(selStart, selEnd); } }
Source:
public ByteBuffer getResponseBodyAsByteBuffer() { int length = 0; for (HttpResponseBodyPart part : bodyParts) length += part.length(); ByteBuffer target = ByteBuffer.wrap(new byte[length]); for (HttpResponseBodyPart part : bodyParts) target.put(part.getBodyPartBytes()); target.rewind(); return target; }

Target:
public ByteBuffer getResponseBodyAsByteBuffer() { int length = 0; for (HttpResponseBodyPart part : bodyParts) length += part.length(); ByteBuffer target = ByteBuffer.wrap(new byte[length]); for (HttpResponseBodyPart part : bodyParts) target.put(part.getBodyPartBytes()); target.flip(); return target; }
Source:
public void abort() { this.a=true; }

Target:
public void abort() { this.shouldAbort=true; }
Source:
public void createControls(Composite parent, EEFTabbedPropertySheetPage tabbedPropertySheetPage) { if (EEFCommonPreferences.isDebugEnabled()) { EEFIdeUiPlugin.getPlugin().info("EEFSection#createControls(...)"); } EEFPage eefPage = this.eefSectionDescriptor.getEEFPage(); List<EEFGroup> eefGroups = eefPage.getGroups(); for (EEFGroup eefGroup : eefGroups) { EEFGroupLifecycleManager groupLifecycleManager = new EEFGroupLifecycleManager(eefGroup.getDescription(), eefGroup.getVariableManager(), eefGroup.getInterpreter(), eefGroup.getEditingDomain()); groupLifecycleManager.createControl(parent, tabbedPropertySheetPage); this.lifecycleManagers.add(groupLifecycleManager); } }

Target:
public void createControls(Composite parent, EEFTabbedPropertySheetPage tabbedPropertySheetPage) { EEFIdeUiPlugin.getPlugin().debug("EEFSection#createControls(...)"); EEFPage eefPage = this.eefSectionDescriptor.getEEFPage(); List<EEFGroup> eefGroups = eefPage.getGroups(); for (EEFGroup eefGroup : eefGroups) { EEFGroupLifecycleManager groupLifecycleManager = new EEFGroupLifecycleManager(eefGroup.getDescription(), eefGroup.getVariableManager(), eefGroup.getInterpreter(), eefGroup.getEditingDomain()); groupLifecycleManager.createControl(parent, tabbedPropertySheetPage); this.lifecycleManagers.add(groupLifecycleManager); } }
Source:
private String writeCriticalityWithDesignCheck(ArtifactReadable art, String criticality, IAttributeType thisType, IRelationTypeSide relType, IAttributeType otherType) throws IOException { String current = art.getSoleAttributeAsString(thisType, "Error"); if ("Error".equals(criticality) || "Error".equals(current)) { writer.writeCell("Error: invalid content"); return "Error"; } if ("Unspecified".equals(current)) { writer.writeCell("Unspecified"); return "Unspecified"; } if ("Unspecified".equals(criticality)) { criticality = "E"; } int parentValue = SafetyCriticalityLookup.getDALLevel(criticality); int childValue = SafetyCriticalityLookup.getDALLevel(current); if (parentValue < childValue) { writer.writeCell(String.format("%s [Error:<%s]", current, criticality)); } else { checkBackTrace(art, childValue, thisType, relType, otherType); } return current; }

Target:
private String writeCriticalityWithDesignCheck(ArtifactReadable art, String criticality, IAttributeType thisType, IRelationTypeSide relType, IAttributeType otherType) throws IOException { String current = art.getSoleAttributeAsString(thisType, "Error"); if ("Error".equals(criticality) || "Error".equals(current)) { writer.writeCell("Error: invalid content"); return "Error"; } if (IAttribute.UNSPECIFIED.equals(current)) { writer.writeCell(IAttribute.UNSPECIFIED); return IAttribute.UNSPECIFIED; } if (IAttribute.UNSPECIFIED.equals(criticality)) { criticality = "E"; } int parentValue = SafetyCriticalityLookup.getDALLevel(criticality); int childValue = SafetyCriticalityLookup.getDALLevel(current); if (parentValue < childValue) { writer.writeCell(String.format("%s [Error:<%s]", current, criticality)); } else { checkBackTrace(art, childValue, thisType, relType, otherType); } return current; }
Source:
public EList<CommentInfo> getAllComments() { EList<CommentInfo> allComments = new BasicEList<>(); System.err.println("Getting all comments"); allComments.addAll(getComments()); System.err.println("Getting all drafts"); allComments.addAll(getDraftComments()); return allComments; }

Target:
public EList<CommentInfo> getAllComments() { EList<CommentInfo> allComments = new BasicEList<>(); allComments.addAll(getComments()); allComments.addAll(getDraftComments()); return allComments; }
Source:
protected String colorize(String string) { if (string.indexOf(ChatColor.COLOR_CHAR) < 0) { return string; } for (ChatColor color : colors) { if (this.color && replacements.containsKey(color)) { string = string.replaceAll("(?i)" + color, replacements.get(color)); } else { string = string.replaceAll("(?i)" + color, ""); } } return string; }

Target:
protected String colorize(String string) { if (string.indexOf(ChatColor.COLOR_CHAR) < 0) { return string; } for (ChatColor color : colors) { string = string.replaceAll("(?i)" + color, this.color ? replacements.getOrDefault(color, "") : ""); } return string; }
Source:
public Long toModelValue(final String time) { if (time == null || time.trim().equals("")) { return 0l; } return Long.valueOf(time); }

Target:
public Long toModelValue(final String time) { if (time == null || time.trim().equals("")) { return 0L; } try { return Long.valueOf(time); } catch (NumberFormatException ex){ return 0L; } }
Source:
ListenableFuture<Boolean> maybeAddPool(final Host host, Connection reusedConnection) { final HostDistance distance = cluster.manager.loadBalancingPolicy().distance(host); if (distance == HostDistance.IGNORED) return Futures.immediateFuture(true); HostConnectionPool previous = pools.get(host); if (previous != null && !previous.isClosed()) return Futures.immediateFuture(true); while (true) { previous = pools.get(host); if (previous != null && !previous.isClosed()) return Futures.immediateFuture(true); final SettableFuture<Boolean> future = SettableFuture.create(); ListenableFuture<Void> newPoolInit = replacePool(host, distance, previous, reusedConnection); if (newPoolInit != null) { Futures.addCallback(newPoolInit, new FutureCallback<Void>() { @Override public void onSuccess(Void result) { logger.debug("Added connection pool for {}", host); future.set(true); } @Override public void onFailure(Throwable t) { if (t instanceof UnsupportedProtocolVersionException) { cluster.manager.logUnsupportedVersionProtocol(host, ((UnsupportedProtocolVersionException) t).getUnsupportedVersion()); cluster.manager.triggerOnDown(host, false); } else if (t instanceof ClusterNameMismatchException) { ClusterNameMismatchException e = (ClusterNameMismatchException) t; cluster.manager.logClusterNameMismatch(host, e.expectedClusterName, e.actualClusterName); cluster.manager.triggerOnDown(host, false); } else { logger.warn("Error creating pool to " + host, t); cluster.manager.triggerOnDown(host, true); } if (t instanceof Error) future.setException(t); else future.set(false); } }); return future; } } }

Target:
ListenableFuture<Boolean> maybeAddPool(final Host host, Connection reusedConnection) { final HostDistance distance = cluster.manager.loadBalancingPolicy().distance(host); if (distance == HostDistance.IGNORED) return Futures.immediateFuture(true); HostConnectionPool previous = pools.get(host); if (previous != null && !previous.isClosed()) return Futures.immediateFuture(true); while (true) { previous = pools.get(host); if (previous != null && !previous.isClosed()) return Futures.immediateFuture(true); final SettableFuture<Boolean> future = SettableFuture.create(); ListenableFuture<Void> newPoolInit = replacePool(host, distance, previous, reusedConnection); if (newPoolInit != null) { Futures.addCallback(newPoolInit, new FutureCallback<Void>() { @Override public void onSuccess(Void result) { logger.debug("Added connection pool for {}", host); future.set(true); } @Override public void onFailure(Throwable t) { if (t instanceof UnsupportedProtocolVersionException) { cluster.manager.logUnsupportedVersionProtocol(host, ((UnsupportedProtocolVersionException) t).getUnsupportedVersion()); cluster.manager.triggerOnDown(host, false); } else if (t instanceof ClusterNameMismatchException) { ClusterNameMismatchException e = (ClusterNameMismatchException) t; cluster.manager.logClusterNameMismatch(host, e.expectedClusterName, e.actualClusterName); cluster.manager.triggerOnDown(host, false); } else { logger.warn("Error creating pool to " + host, t); } if (t instanceof Error) future.setException(t); else future.set(false); } }); return future; } } }
Source:
public void init(FilterConfig filterConfig) throws ServletException { String schemes = filterConfig.getInitParameter("schemes"); if (schemes == null) { schemes = ""; } additionalSchemes = Arrays.asList(schemes.split(",")); }

Target:
public void init(FilterConfig filterConfig) throws ServletException { for (String paramName : Collections.list(filterConfig.getInitParameterNames())) { if (paramName.startsWith("scheme")) { additionalSchemes.add(filterConfig.getInitParameter(paramName)); } } }
Source:
public void fillRubricColumn(int qnNumber, int choiceIndex, String[] values) { fillRubricChoiceBox(values[0], qnNumber, choiceIndex); int rubDescIndex = 1; if (isRubricWeightsEnabled(qnNumber)) { fillRubricWeightBox(values[1], qnNumber, choiceIndex); rubDescIndex = 2; } int subQnIndex = 0; while (rubDescIndex < values.length) { fillRubricDescriptionBox(values[rubDescIndex], qnNumber, subQnIndex, choiceIndex); subQnIndex++; rubDescIndex++; } }

Target:
public void fillRubricColumn(int qnNumber, int choiceIndex, String[] values) { fillRubricChoiceBox(values[0], qnNumber, choiceIndex); int rubDescriptionIndex = 1; if (isRubricWeightsEnabled(qnNumber)) { fillRubricWeightBox(values[1], qnNumber, choiceIndex); rubDescriptionIndex = 2; } int subQnIndex = 0; while (rubDescriptionIndex < values.length) { fillRubricDescriptionBox(values[rubDescriptionIndex], qnNumber, subQnIndex, choiceIndex); subQnIndex++; rubDescriptionIndex++; } }
Source:
private void setProperties(final int tableId, final KeyValueSetProto properties) { final String updateSql = "UPDATE " + TB_OPTIONS + " SET VALUE_=? WHERE TID=? AND KEY_=?"; final String insertSql = "INSERT INTO " + TB_OPTIONS + " (TID, KEY_, VALUE_) VALUES(?, ?, ?)"; PreparedStatement pstmt = null; Map<String, String> oldProperties = getTableOptions(tableId); try (Connection conn = getConnection()) { conn.setAutoCommit(false); for (KeyValueProto entry : properties.getKeyvalList()) { if (oldProperties.containsKey(entry.getKey())) { pstmt = conn.prepareStatement(updateSql); pstmt.setString(1, entry.getValue()); pstmt.setInt(2, tableId); pstmt.setString(3, entry.getKey()); pstmt.executeUpdate(); pstmt.close(); } else { pstmt = conn.prepareStatement(insertSql); pstmt.setInt(1, tableId); pstmt.setString(2, entry.getKey()); pstmt.setString(3, entry.getValue()); pstmt.executeUpdate(); pstmt.close(); } } conn.commit(); } catch (Throwable sqlException) { throw new TajoInternalError(sqlException); } finally { CatalogUtil.closeQuietly(pstmt); } }

Target:
private void setProperties(final int tableId, final KeyValueSetProto properties) { final String updateSql = "UPDATE " + TB_OPTIONS + " SET VALUE_=? WHERE TID=? AND KEY_=?"; final String insertSql = "INSERT INTO " + TB_OPTIONS + " (TID, KEY_, VALUE_) VALUES(?, ?, ?)"; Connection conn; PreparedStatement pstmt = null; Map<String, String> oldProperties = getTableOptions(tableId); try { conn = getConnection(); conn.setAutoCommit(false); for (KeyValueProto entry : properties.getKeyvalList()) { if (oldProperties.containsKey(entry.getKey())) { pstmt = conn.prepareStatement(updateSql); pstmt.setString(1, entry.getValue()); pstmt.setInt(2, tableId); pstmt.setString(3, entry.getKey()); pstmt.executeUpdate(); pstmt.close(); } else { pstmt = conn.prepareStatement(insertSql); pstmt.setInt(1, tableId); pstmt.setString(2, entry.getKey()); pstmt.setString(3, entry.getValue()); pstmt.executeUpdate(); pstmt.close(); } } conn.commit(); } catch (Throwable sqlException) { throw new TajoInternalError(sqlException); } finally { CatalogUtil.closeQuietly(pstmt); } }
Source:
protected boolean querySettingsEquals(Query that) { boolean criteriaEqual = this.criteria.equals(that.criteria); boolean fieldsEqual = this.fieldSpec == null ? that.fieldSpec == null : this.fieldSpec.equals(that.fieldSpec); boolean sortEqual = this.sort == null ? that.sort == null : this.sort.equals(that.sort); boolean hintEqual = this.hint == null ? that.hint == null : this.hint.equals(that.hint); boolean skipEqual = this.skip == that.skip; boolean limitEqual = this.limit == that.limit; boolean metaEqual = nullSafeEquals(this.meta, that.meta); return criteriaEqual && fieldsEqual && sortEqual && hintEqual && skipEqual && limitEqual && metaEqual; }

Target:
protected boolean querySettingsEquals(Query that) { boolean criteriaEqual = this.criteria.equals(that.criteria); boolean fieldsEqual = nullSafeEquals(this.fieldSpec, that.fieldSpec); boolean sortEqual = nullSafeEquals(this.sort, that.sort); boolean hintEqual = nullSafeEquals(this.hint, that.hint); boolean skipEqual = this.skip == that.skip; boolean limitEqual = this.limit == that.limit; boolean metaEqual = nullSafeEquals(this.meta, that.meta); return criteriaEqual && fieldsEqual && sortEqual && hintEqual && skipEqual && limitEqual && metaEqual; }
Source:
public ProtobufMessageParser(SecorConfig config) { super(config); String messageClassName = mConfig.getProtobufMessageClass(); if (messageClassName != null) { try { Class<?> messageClass = (Class<?>) Class.forName(messageClassName); messageParseMethod = messageClass.getDeclaredMethod("parseFrom", new Class<?>[] { byte[].class }); String timestampFieldName = mConfig.getMessageTimestampName(); String timestampFieldSeparator = mConfig.getMessageTimestampNameSeparator(); if (timestampFieldSeparator == null || timestampFieldSeparator.isEmpty()) { timestampFieldSeparator = "."; } timestampFieldPath = timestampFieldName.split(Pattern.quote(timestampFieldSeparator)); } catch (ClassNotFoundException e) { LOG.error("Unable to load protobuf message class", e); } catch (NoSuchMethodException e) { LOG.error("Unable to find parseFrom() method in protobuf message class", e); } catch (SecurityException e) { LOG.error("Unable to use parseFrom() method from protobuf message class", e); } } }

Target:
public ProtobufMessageParser(SecorConfig config) { super(config); String messageClassName = mConfig.getProtobufMessageClass(); if (messageClassName != null) { try { Class<?> messageClass = (Class<?>) Class.forName(messageClassName); messageParseMethod = messageClass.getDeclaredMethod("parseFrom", new Class<?>[] { byte[].class }); String timestampFieldName = mConfig.getMessageTimestampName(); String timestampFieldSeparator = mConfig.getMessageTimestampNameSeparator(); if (timestampFieldSeparator == null || timestampFieldSeparator.isEmpty()) { timestampFieldSeparator = "."; } LOG.info("Using protobuf timestamp field path: with separator: {}", timestampFieldName, timestampFieldSeparator); timestampFieldPath = timestampFieldName.split(Pattern.quote(timestampFieldSeparator)); } catch (ClassNotFoundException e) { LOG.error("Unable to load protobuf message class", e); } catch (NoSuchMethodException e) { LOG.error("Unable to find parseFrom() method in protobuf message class", e); } catch (SecurityException e) { LOG.error("Unable to use parseFrom() method from protobuf message class", e); } } }
Source:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; InputStreamFullResponseHolder responseHolder; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query) ); responseHolder = coordinatorClient.go( request, new InputStreamFullResponseHandler() ); if (responseHolder.getStatus().getCode() != HttpServletResponse.SC_OK) { throw new RE( "Failed to talk to coordinator leader at [%s]. Error code[%d], description[%s].", query, responseHolder.getStatus().getCode(), responseHolder.getStatus().getReasonPhrase() ); } } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, Futures.immediateFuture(responseHolder.getContent()), request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, null ); }

Target:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; InputStreamFullResponseHolder responseHolder; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query) ); responseHolder = coordinatorClient.go( request, new InputStreamFullResponseHandler() ); if (responseHolder.getStatus().getCode() != HttpServletResponse.SC_OK) { throw new RE( "Failed to talk to coordinator leader at [%s]. Error code[%d], description[%s].", query, responseHolder.getStatus().getCode(), responseHolder.getStatus().getReasonPhrase() ); } } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, Futures.immediateFuture(responseHolder.getContent()), request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); }
Source:
public void receive(final String name, final String value, final NamedValueSource source, final int recordCount, final int entityCount) { matcher.reset(value); if (null == format) { while (matcher.find()) { final String group = matcher.group(); if (!group.isEmpty()) { getNamedValueReceiver().receive(name, group, source, recordCount, entityCount); } } } else { while (matcher.find()) { if (!matchAndFormatIsEmpty()) { getNamedValueReceiver().receive(name, StringUtil.format(format, tempVars), source, recordCount, entityCount); } } } }

Target:
public void receive(final String name, final String value, final NamedValueSource source, final int recordCount, final int entityCount) { matcher.reset(value); if (null == format) { while (matcher.find()) { final String group = matcher.group(); if (!group.isEmpty()) { getNamedValueReceiver().receive(name, group, source, recordCount, entityCount); } } } else { while (matcher.find()) { populateVars(); if (!tempVars.isEmpty()) { getNamedValueReceiver().receive(name, StringUtil.format(format, tempVars), source, recordCount, entityCount); } } } }
Source:
private synchronized void sendUpdate(Update update, PilightConnection connection) { if (connection.getDelay() != null) { Date now = new Date(); long delayBetweenUpdates = connection.getDelay(); if (connection.getLastUpdate() != null) { long diff = now.getTime() - connection.getLastUpdate().getTime(); if (diff < delayBetweenUpdates) { try { Thread.sleep(delayBetweenUpdates-diff); } catch (InterruptedException e) { logger.error("Error while processing pilight throttling delay"); } } } } doUpdateCall(update, connection); }

Target:
private void sendUpdate(Update update, PilightConnection connection) { if (connection.getDelay() != null) { delayedUpdateCall(update, connection); } else { doUpdateCall(update, connection); } }
Source:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; boolean firstPriorityEvent = false; synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); SequenceBuffer sequenceBuffer = new SequenceBuffer(buffer, sequenceNumber); DataType dataType = buffer.getDataType(); if (dataType.hasPriority()) { checkPriorityXorAnnouncement(buffer); firstPriorityEvent = addPriorityBuffer(sequenceBuffer); } else { receivedBuffers.add(sequenceBuffer); channelStatePersister.maybePersist(buffer); if (dataType.requiresAnnouncement()) { checkPriorityXorAnnouncement(buffer); firstPriorityEvent = addPriorityBuffer(announce(sequenceBuffer)); } } ++expectedSequenceNumber; } recycleBuffer = false; if (firstPriorityEvent) { notifyPriorityEvent(sequenceNumber); } if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }

Target:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; boolean firstPriorityEvent = false; synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); SequenceBuffer sequenceBuffer = new SequenceBuffer(buffer, sequenceNumber); DataType dataType = buffer.getDataType(); if (dataType.hasPriority()) { firstPriorityEvent = addPriorityBuffer(sequenceBuffer); } else { receivedBuffers.add(sequenceBuffer); channelStatePersister.maybePersist(buffer); if (dataType.requiresAnnouncement()) { firstPriorityEvent = addPriorityBuffer(announce(sequenceBuffer)); } } ++expectedSequenceNumber; } recycleBuffer = false; if (firstPriorityEvent) { notifyPriorityEvent(sequenceNumber); } if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }
Source:
protected void adjustManifests(IProgressMonitor monitor, IProject project, IPluginBase base) throws CoreException { super.adjustManifests(monitor, project, base); int units = fData.doFindDependencies() ? 4 : 2; units += fData.isUpdateReferences() ? 1 : 0; SubMonitor subMonitor = SubMonitor.convert(monitor, new String(), units); IBundle bundle = (base instanceof BundlePluginBase) ? ((BundlePluginBase) base).getBundle() : null; if (bundle != null) { adjustExportRoot(project, bundle); monitor.worked(1); addExportedPackages(project, bundle); monitor.worked(1); if (fData.doFindDependencies()) { addDependencies(project, base.getModel(), subMonitor.newChild(2)); } if (fData.isUpdateReferences()) { updateReferences(monitor, project); monitor.worked(1); } } }

Target:
protected void adjustManifests(IProgressMonitor monitor, IProject project, IPluginBase base) throws CoreException { super.adjustManifests(monitor, project, base); int units = fData.doFindDependencies() ? 4 : 2; units += fData.isUpdateReferences() ? 1 : 0; SubMonitor subMonitor = SubMonitor.convert(monitor, units); IBundle bundle = (base instanceof BundlePluginBase) ? ((BundlePluginBase) base).getBundle() : null; if (bundle != null) { adjustExportRoot(project, bundle); subMonitor.worked(1); addExportedPackages(project, bundle); subMonitor.worked(1); if (fData.doFindDependencies()) { addDependencies(project, base.getModel(), subMonitor.newChild(2)); } if (fData.isUpdateReferences()) { updateReferences(subMonitor.newChild(1), project); } } }
Source:
public ValidationResult isReadOnlyPropertyCompatibleWithInterface() { if (Boolean.TRUE.equals(disk.getReadOnly())) { DiskInterface diskInterface = disk.getDiskInterface(); if (diskInterface == DiskInterface.IDE) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR, String.format("$interface %1$s", diskInterface)); } boolean isVirtioScsiDirectLunPassthrough = diskInterface == DiskInterface.VirtIO_SCSI && disk.getDiskStorageType() == DiskStorageType.LUN && disk.isScsiPassthrough(); if (isVirtioScsiDirectLunPassthrough) { return new ValidationResult(VdcBllMessages.SCSI_PASSTHROUGH_IS_NOT_SUPPORTED_FOR_READ_ONLY_DISK); } } return ValidationResult.VALID; }

Target:
public ValidationResult isReadOnlyPropertyCompatibleWithInterface() { if (Boolean.TRUE.equals(disk.getReadOnly())) { DiskInterface diskInterface = disk.getDiskInterface(); if (diskInterface == DiskInterface.IDE) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR, String.format("$interface %1$s", diskInterface)); } if (disk.isScsiPassthrough()) { return new ValidationResult(VdcBllMessages.SCSI_PASSTHROUGH_IS_NOT_SUPPORTED_FOR_READ_ONLY_DISK); } } return ValidationResult.VALID; }
Source:
protected void updateInstanceToTaskAssignmentsFromContext(JobContext jobCtx, Map<String, SortedSet<Integer>> prevInstanceToTaskAssignments) { for (Integer partition : jobCtx.getPartitionSet()) { if (jobCtx.getPartitionState(partition) == TaskPartitionState.RUNNING || jobCtx.getPartitionState(partition) == TaskPartitionState.INIT) { String instance = jobCtx.getAssignedParticipant(partition); if (prevInstanceToTaskAssignments.containsKey(instance) && !prevInstanceToTaskAssignments.get(instance).contains(partition)) { prevInstanceToTaskAssignments.get(instance).add(partition); } } } }

Target:
protected void updateInstanceToTaskAssignmentsFromContext(JobContext jobCtx, Map<String, SortedSet<Integer>> prevInstanceToTaskAssignments) { for (Integer partition : jobCtx.getPartitionSet()) { if (jobCtx.getPartitionState(partition) == TaskPartitionState.RUNNING || jobCtx.getPartitionState(partition) == TaskPartitionState.INIT) { String instance = jobCtx.getAssignedParticipant(partition); if (instance != null) { if (prevInstanceToTaskAssignments.containsKey(instance) && !prevInstanceToTaskAssignments.get(instance).contains(partition)) { prevInstanceToTaskAssignments.get(instance).add(partition); } } } } }
Source:
public QueryBuilder byId(Iterable<?> ids) { this.ids = ImmutableSet.builder() .add(ids) .build(); return this; }

Target:
public QueryBuilder byId(Iterable<?> ids) { checkNotNull(ids); this.ids = ImmutableSet.builder() .addAll(ids) .build(); return this; }
Source:
private AsyncRetryMetrics(String prefix, Iterable<AsyncRetry> retries) { requireNonNull(prefix); requireNonNull(retries); retries.forEach(retry -> { String name = retry.getName(); metricRegistry.register(name(prefix, name, AsyncRetry.class.getSimpleName(), SUCCESSFUL_CALLS_WITHOUT_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfSuccessfulCallsWithoutRetryAttempt()); metricRegistry.register(name(prefix, name, AsyncRetry.class.getSimpleName(), SUCCESSFUL_CALLS_WITH_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfSuccessfulCallsWithRetryAttempt()); metricRegistry.register(name(prefix, name, AsyncRetry.class.getSimpleName(), FAILED_CALLS_WITHOUT_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfFailedCallsWithoutRetryAttempt()); metricRegistry.register(name(prefix, name, AsyncRetry.class.getSimpleName(), FAILED_CALLS_WITH_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfFailedCallsWithRetryAttempt()); }); }

Target:
private AsyncRetryMetrics(String prefix, Iterable<AsyncRetry> retries) { requireNonNull(prefix); requireNonNull(retries); retries.forEach(retry -> { String name = retry.getName(); metricRegistry.register(name(prefix, name, SUCCESSFUL_CALLS_WITHOUT_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfSuccessfulCallsWithoutRetryAttempt()); metricRegistry.register(name(prefix, name, SUCCESSFUL_CALLS_WITH_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfSuccessfulCallsWithRetryAttempt()); metricRegistry.register(name(prefix, name, FAILED_CALLS_WITHOUT_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfFailedCallsWithoutRetryAttempt()); metricRegistry.register(name(prefix, name, FAILED_CALLS_WITH_RETRY), (Gauge<Long>) () -> retry.getMetrics().getNumberOfFailedCallsWithRetryAttempt()); }); }
Source:
public boolean performNextOperation(int completedChildCount) { restoreCommandState(); switch (getParameters().getPhase()) { case CREATE_TEMPLATE: if (!getParameters().isSealTemplate()) { return false; } getParameters().setPhase(Phase.ASSIGN_ILLEGAL); break; case ASSIGN_ILLEGAL: getParameters().setPhase(Phase.SEAL); break; case SEAL: getParameters().setPhase(Phase.ASSIGN_LEGAL_SHARED); break; case ASSIGN_LEGAL_SHARED: return false; } persistCommandIfNeeded(); executeNextOperation(); return true; }

Target:
public boolean performNextOperation(int completedChildCount) { if (!getParameters().isSealTemplate()) { return false; } restoreCommandState(); switch (getParameters().getPhase()) { case CREATE_TEMPLATE: getParameters().setPhase(Phase.ASSIGN_ILLEGAL); break; case ASSIGN_ILLEGAL: getParameters().setPhase(Phase.SEAL); break; case SEAL: getParameters().setPhase(Phase.ASSIGN_LEGAL_SHARED); break; case ASSIGN_LEGAL_SHARED: return false; } persistCommandIfNeeded(); executeNextOperation(); return true; }
Source:
public VeluxGwState getState() { String deviceStatus = this.getDeviceStatus(); byte stateValue = (byte) VeluxGatewayState.GW_S_GWM.getStateValue(); byte subStateValue; if (deviceStatus.equals("discovering")) { subStateValue = (byte) VeluxGatewaySubState.GW_SS_P1.getStateValue(); } else if (deviceStatus.equals("IDLE")) { subStateValue = (byte) VeluxGatewaySubState.GW_SS_IDLE.getStateValue(); } else { subStateValue = (byte) VeluxGatewaySubState.GW_SS_P2.getStateValue(); } VeluxGwState thisGwState = new VeluxGwState(stateValue, subStateValue); return thisGwState; }

Target:
public VeluxGwState getState() { String deviceStatus = this.getDeviceStatus(); byte stateValue = (byte) VeluxGatewayState.GW_S_GWM.getStateValue(); byte subStateValue; if (deviceStatus.equals("discovering")) { subStateValue = (byte) VeluxGatewaySubState.GW_SS_P1.getStateValue(); } else if (deviceStatus.equals("IDLE")) { subStateValue = (byte) VeluxGatewaySubState.GW_SS_IDLE.getStateValue(); } else { subStateValue = (byte) VeluxGatewaySubState.GW_SS_P2.getStateValue(); } return new VeluxGwState(stateValue, subStateValue); }
Source:
public PaxosResponses<PaxosPromise> prepare(long seq, PaxosProposalId proposalId) { try { return prepare.apply(Maps.immutableEntry(client, WithSeq.of(seq, proposalId))).get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); } catch (InterruptedException e) { throw new RuntimeException(e); } }

Target:
public PaxosResponses<PaxosPromise> prepare(long seq, PaxosProposalId proposalId) { try { return prepare.apply(Maps.immutableEntry(client, WithSeq.of(seq, proposalId))).get(); } catch (ExecutionException | InterruptedException e) { throw AutobatcherExecutionExceptions.handleAutobatcherExceptions(e); } }
Source:
void unregister() { checkLocked(); try { owner.mbeanServer.unregisterMBean(objectName); } catch (Exception e) { throw new RuntimeException("Failed to reregister bean " + mbeanName, e); } }

Target:
void unregister() { checkLocked(); try { owner.mbeanServer.unregisterMBean(objectName); } catch (Exception e) { throw new KafkaException("Failed to unreregister bean " + mbeanName, e); } }
Source:
@Override public SelectSpanNames clone() { return new AutoValue_SelectSpanNames(session(), preparedStatement(), service()); }

Target:
@Override public SelectSpanNames clone() { return new SelectSpanNames(factory, service); }
Source:
public List<Contributor> getContributors() { return this.configuration.get(List.class, "contributors", new ArrayList<Contributor>()); }

Target:
public List<Contributor> getContributors() { return this.configuration.get(List.class, CONTRIBUTORS, new ArrayList<Contributor>()); }
Source:
public Collection<GrantedAuthority> convert(Jwt jwt) { Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>(); for (String authority : getAuthorities(jwt)) { grantedAuthorities.add(new SimpleGrantedAuthority(authorityPrefix + authority)); } return grantedAuthorities; }

Target:
public Collection<GrantedAuthority> convert(Jwt jwt) { Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>(); for (String authority : getAuthorities(jwt)) { grantedAuthorities.add(new SimpleGrantedAuthority(this.authorityPrefix + authority)); } return grantedAuthorities; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VariantDeclaration other = (VariantDeclaration) obj; if (fDeclarationToPopulate == null) { if (other.fDeclarationToPopulate != null) { return false; } } else if (!fDeclarationToPopulate.equals(other.fDeclarationToPopulate)) { return false; } if (!NonNullUtils.equalsNullable(fFields, other.fFields)) { return false; } if (!NonNullUtils.equalsNullable(fPrevDefinitionScope, other.fPrevDefinitionScope)) { return false; } if (!NonNullUtils.equalsNullable(fTag, other.fTag)) { return false; } return NonNullUtils.equalsNullable(fTagDef, other.fTagDef); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VariantDeclaration other = (VariantDeclaration) obj; if (fDeclarationToPopulate == null) { if (other.fDeclarationToPopulate != null) { return false; } } else if (!fDeclarationToPopulate.equals(other.fDeclarationToPopulate)) { return false; } if (!equalsNullable(fFields, other.fFields)) { return false; } if (!equalsNullable(fPrevDefinitionScope, other.fPrevDefinitionScope)) { return false; } if (!equalsNullable(fTag, other.fTag)) { return false; } if (!equalsNullable(fTagDef, other.fTagDef)){ return false; } return true; }
Source:
public void sendSmallEventsFullBatchPartitionKey() { final EventDataBatch batch = new EventDataBatch(ClientConstants.MAX_MESSAGE_LENGTH_BYTES, null, PARTITION_KEY, contextProvider, null); int count = 0; while (batch.tryAdd(createData())) { if (count % 100 == 0) { logger.verbose("Batch size: {}", batch.getSize()); } count++; } StepVerifier.create(producer.send(batch.getEvents())) .verifyComplete(); }

Target:
public void sendSmallEventsFullBatchPartitionKey() { final EventDataBatch batch = new EventDataBatch(ClientConstants.MAX_MESSAGE_LENGTH_BYTES, null, PARTITION_KEY, contextProvider, new TracerProvider(Collections.emptyList())); int count = 0; while (batch.tryAdd(createData())) { if (count % 100 == 0) { logger.verbose("Batch size: {}", batch.getCount()); } count++; } StepVerifier.create(producer.send(batch.getEvents())) .verifyComplete(); }
Source:
public Iterator<SpreadsheetRecord> iterator() { Iterator<SpreadsheetRecord> iterator = null; if(myBook.getNumberOfSheets() > 1) { Iterator<SpreadsheetRecord> it = null; for (int i = 0; i < myBook.getNumberOfSheets(); ++i) { Sheet sheet = myBook.getSheetAt(i); if (i < myBook.getNumberOfSheets() - 1) { int lastRow = sheet.getPhysicalNumberOfRows(); sheet.createRow(lastRow + 1); sheet.createRow(lastRow + 2); } it = Iterators.transform(sheet.iterator(), (input) -> new XlsRecordImpl(getCellValues(input), myHeaders)); iterator = (iterator == null) ? it : Iterators.concat(iterator, it); } } else { iterator = Iterators.transform(myBook.getSheetAt(0).iterator(), (input) -> new XlsRecordImpl(getCellValues(input), myHeaders)); } return iterator; }

Target:
public Iterator<SpreadsheetRecord> iterator() { Iterator<SpreadsheetRecord> iterator = null; Iterator<SpreadsheetRecord> it = null; for (int i = 0; i < myBook.getNumberOfSheets(); ++i) { Sheet sheet = myBook.getSheetAt(i); if (i < myBook.getNumberOfSheets() - 1) { int lastRow = sheet.getPhysicalNumberOfRows(); sheet.createRow(lastRow + 1); sheet.createRow(lastRow + 2); } it = Iterators.transform(sheet.iterator(), (input) -> new XlsRecordImpl(getCellValues(input), myHeaders)); iterator = (iterator == null) ? it : Iterators.concat(iterator, it); } return iterator; }
Source:
public void invalidInlineScript() throws Exception { Message<?> message = new ErrorMessage(new ReplyRequiredException(new GenericMessage<String>("test"), "reply required!")); try { this.invalidInlineScript.send(message); fail("MessageHandlingException expected!"); } catch (MessageHandlingException e) { Throwable cause = e.getCause(); assertEquals(MissingPropertyException.class, cause.getClass()); assertThat(cause.getMessage(), Matchers.containsString("No such property: ReplyRequiredException for class: script")); } }

Target:
public void invalidInlineScript() throws Exception { Message<?> message = new ErrorMessage(new ReplyRequiredException(new GenericMessage<String>("test"), "reply required!")); try { this.invalidInlineScript.send(message); fail("MessageHandlingException expected!"); } catch (MessageHandlingException e) { Throwable cause = e.getCause(); assertEquals(ScriptCompilationException.class, cause.getClass()); assertThat(cause.getMessage(), Matchers.containsString("No such property: ReplyRequiredException for class: script")); } }