auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public RelDataTypeField getField(String fieldName, boolean caseSensitive, boolean elideRecord) { if (fieldList == null) { throw new IllegalStateException("Requested field " + fieldName <START> + " in a type with null fieldList, type = " + this); <END> } for (RelDataTypeField field : fieldList) { if (Util.matches(caseSensitive, field.getName(), fieldName)) { return field; } } if (elideRecord) { final List<Slot> slots = new ArrayList<>(); getFieldRecurse(slots, this, 0, fieldName, caseSensitive); loop: for (Slot slot : slots) { switch (slot.count) { case 0: break; case 1: return slot.field; default: break loop; } } } if (fieldList.size() > 0) { final RelDataTypeField lastField = Iterables.getLast(fieldList); if (lastField.getName().equals("_extra")) { return new RelDataTypeFieldImpl( fieldName, -1, lastField.getType()); } } for (RelDataTypeField field : fieldList) { if (field.isDynamicStar()) { return field; } } return null; }</code><technical_language>In case, user pass in a null fieldList ? I move check builder generate RelDataTypeImpl instance. exception message is confusing, user wrong "we null field list"</technical_language>

Target:
@Override public RelDataTypeField getField(String fieldName, boolean caseSensitive, boolean elideRecord) { if (fieldList == null) { throw new IllegalStateException("Trying to access field " + fieldName + " in a type with no fields: " + this); } for (RelDataTypeField field : fieldList) { if (Util.matches(caseSensitive, field.getName(), fieldName)) { return field; } } if (elideRecord) { final List<Slot> slots = new ArrayList<>(); getFieldRecurse(slots, this, 0, fieldName, caseSensitive); loop: for (Slot slot : slots) { switch (slot.count) { case 0: break; case 1: return slot.field; default: break loop; } } } if (fieldList.size() > 0) { final RelDataTypeField lastField = Iterables.getLast(fieldList); if (lastField.getName().equals("_extra")) { return new RelDataTypeFieldImpl( fieldName, -1, lastField.getType()); } } for (RelDataTypeField field : fieldList) { if (field.isDynamicStar()) { return field; } } return null; }
Source:
<code>private void resetViewState() { mRootView.setVisibility(VISIBLE); setLayoutDirection(View.LAYOUT_DIRECTION_INHERIT); setViewClickable(mRootView, false); setViewClickable(mContent, false); mStartContainer.removeAllViews(); mEndContainer.removeAllViews(); mEndContainer.setVisibility(GONE); mPrimaryText.setText(null); mSecondaryText.setText(null); mLastUpdatedText.setText(null); mLastUpdatedText.setVisibility(GONE); mToggles.clear(); mActions.clear(); mRowAction = null; mBottomDivider.setVisibility(GONE); mActionDivider.setVisibility(GONE); if (mSeeMoreView != null) { mRootView.removeView(mSeeMoreView); mSeeMoreView = null; } mIsRangeSliding = false; mRangeHasPendingUpdate = false; mRangeItem = null; mRangeMinValue = 0; mRangeMaxValue = 0; mRangeValue = 0; mLastSentRangeUpdate = 0; mHandler = null; if (mRangeBar != null) { if (mStartItem == null) { removeView(mRangeBar); } else { <START> mSubContent.removeView(mRangeBar); <END> } mRangeBar = null; } mStartItem = null; mActionSpinner.setVisibility(GONE); if (mSelectionSpinner != null) { removeView(mSelectionSpinner); mSelectionSpinner = null; } mSelectionItem = null; }</code><technical_language>mSubContent -> mContent</technical_language>

Target:
private void resetViewState() { mRootView.setVisibility(VISIBLE); setLayoutDirection(View.LAYOUT_DIRECTION_INHERIT); setViewClickable(mRootView, false); setViewClickable(mContent, false); mStartContainer.removeAllViews(); mEndContainer.removeAllViews(); mEndContainer.setVisibility(GONE); mPrimaryText.setText(null); mSecondaryText.setText(null); mLastUpdatedText.setText(null); mLastUpdatedText.setVisibility(GONE); mToggles.clear(); mActions.clear(); mRowAction = null; mBottomDivider.setVisibility(GONE); mActionDivider.setVisibility(GONE); if (mSeeMoreView != null) { mRootView.removeView(mSeeMoreView); mSeeMoreView = null; } mIsRangeSliding = false; mRangeHasPendingUpdate = false; mRangeItem = null; mRangeMinValue = 0; mRangeMaxValue = 0; mRangeValue = 0; mLastSentRangeUpdate = 0; mHandler = null; if (mRangeBar != null) { if (mStartItem == null) { removeView(mRangeBar); } else { mContent.removeView(mRangeBar); } mRangeBar = null; } mSubContent.setVisibility(VISIBLE); mStartItem = null; mActionSpinner.setVisibility(GONE); if (mSelectionSpinner != null) { removeView(mSelectionSpinner); mSelectionSpinner = null; } mSelectionItem = null; }
Source:
<code>public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { DebuggerState nextState = session.setState(stateNum.orElse(session.getActiveStateId()), configurationNum); if (nextState == null) { System.out.println("Error Selecting State. State unchanged"); return; } <START> System.out.println("Selected State " + session.getActiveStateId()); <END> }</code><technical_language>this a state id. if changed terminology in code base call that, expose this language users. "Jumped step 523"</technical_language>

Target:
public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { int requestedState = stateNum.orElse(session.getActiveStateId()); DebuggerState nextState = session.setState(requestedState); if (nextState == null) { System.out.println("State Number specified does not exist"); } else if (!configurationNum.isPresent()) { System.out.println("Selected State " + requestedState); } else { int requestedConfig = configurationNum.orElse(nextState.getStepNum()); DebuggerState finalState = session.jumpTo(requestedState, requestedConfig); if (finalState == null) { System.out.println("Requested Step Number couldn't be selected."); } else if (!stateNum.isPresent()) { System.out.println("Jumped to Step Number " + requestedConfig); } else { System.out.println("Jumped to State Number " + requestedState + " and Step Number " + requestedConfig); } } }
Source:
<code>public void verifyTablePattern(int tableNum, int column, String patternString){ String[] splitString = patternString.split(java.util.regex.Pattern.quote("{*}")); boolean isFirstRowEmpty = (splitString.length >= 0) && splitString[0].isEmpty(); int expectedNumberOfRowsInTable = isFirstRowEmpty ? splitString.length : splitString.length + 1; assertEquals(expectedNumberOfRowsInTable, getNumberOfRowsFromDataTable(tableNum)); for(int row=1;row < splitString.length;row++){ int rowIndex = isFirstRowEmpty ? row : (row - 1); String tableCellString = this.getCellValueFromDataTable(tableNum, row, column); assertEquals(splitString[rowIndex], tableCellString); } <START> } <END></code><technical_language>avoid this duplication? method call method tableNum=0</technical_language>

Target:
public void verifyTablePattern(int tableNum, int column, String patternString){ String[] splitString = patternString.split(java.util.regex.Pattern.quote("{*}")); int expectedNumberOfRowsInTable = splitString.length + 1; assertEquals(expectedNumberOfRowsInTable, getNumberOfRowsFromDataTable(tableNum)); for(int row=1;row < splitString.length;row++){ String tableCellString = this.getCellValueFromDataTable(tableNum, row, column); assertEquals(splitString[row - 1], tableCellString); } }
Source:
<code>public static List<String> readItemsFromClasspathString(Set<String> depsModules) { Set<String> items = new HashSet<>(); if (SystemUtils.IS_OS_LINUX) { items = process(depsModules, ":"); } else if (SystemUtils.IS_OS_WINDOWS) { items = process(depsModules, ";"); } return new ArrayList<>(items); <START> } <END></code><technical_language>Suggestion, inline this logic for selecting delimiter process method public static final String COLON = ":"; public static final String SEMICOLON = ";"; // Windows need semicolon, normal colon other OS String delimiter = SystemUtils.IS_OS_WINDOWS ? SEMICOLON : COLON call items = process(depsModules);</technical_language>

Target:
public static List<String> readItemsFromClasspathString(Set<String> depsModules) { Set<String> items = process(depsModules, delimiter); return new ArrayList<>(items); }
Source:
<code><START> Map<Integer, List<String>> studentsByGradeAlphabetical() { <END> Map<Integer, List<String>> sortedStudents = new HashMap<>(); for (Integer grade : database.keySet()) { List<String> studentsInGrade = fetchGradeFromDatabase(grade); sortedStudents.put(grade, studentsInGrade); } return sortedStudents; }</code><technical_language>I this method private</technical_language>

Target:
private Map<Integer, List<String>> studentsByGradeAlphabetical() { Map<Integer, List<String>> sortedStudents = new HashMap<>(); for (Integer grade : database.keySet()) { List<String> studentsInGrade = fetchGradeFromDatabase(grade); sortedStudents.put(grade, studentsInGrade); } return sortedStudents; }
Source:
<code>public void redoneWithException() { <START> top++; <END> mostRecentCommand = null; Iterator<ICompareCopyCommand> commands = commandList.listIterator(top--); while (commands.hasNext()) { commands.next(); commands.remove(); } }</code><technical_language>Remove this increment</technical_language>

Target:
public void redoneWithException() { mostRecentCommand = null; commandList.subList(top + 1, commandList.size()).clear(); }
Source:
<code><START> public ValidationResult <END> validateNetworkAttachmentIpConfiguration(Collection<NetworkAttachment> attachmentsToConfigure) { return validateNetworkAttachmentIpConfiguration(attachmentsToConfigure, null); }</code><technical_language>public required for unit test</technical_language>

Target:
ValidationResult validateNetworkAttachmentIpConfiguration(Collection<NetworkAttachment> attachmentsToConfigure) { return validateNetworkAttachmentIpConfiguration(attachmentsToConfigure, null); }
Source:
<code>public void addRowsFromPersistedPath(Path persistedDir) throws IOException { FileSystem persistFs = persistedDir.getFileSystem(getConf()); FileStatus[] partFiles = persistFs.listStatus(persistedDir, new PathFilter() { @Override public boolean accept(Path path) { if (path.getName().startsWith("_")) { return false; } return true; } }); TreeMap<PartFile, FileStatus> partFileMap = new TreeMap<PartFile, FileStatus>(); try { for (FileStatus file : partFiles) { partFileMap.put(new PartFile(file.getPath().getName()), file); } for (Map.Entry<PartFile, FileStatus> entry : partFileMap.entrySet()) { <START> BufferedReader in = new BufferedReader(new InputStreamReader( <END> persistFs.open(entry.getValue().getPath()))); String row = in.readLine(); while (row != null) { writeRow(row); numRows++; row = in.readLine(); } } } catch (ParseException e) { throw new IOException(e); } }</code><technical_language>Inputstream is closed</technical_language>

Target:
public void addRowsFromPersistedPath(Path persistedDir) throws IOException { FileSystem persistFs = persistedDir.getFileSystem(ctx.getConf()); FileStatus[] partFiles = persistFs.listStatus(persistedDir, new PathFilter() { @Override public boolean accept(Path path) { if (path.getName().startsWith("_")) { return false; } return true; } }); TreeMap<PartFile, FileStatus> partFileMap = new TreeMap<PartFile, FileStatus>(); try { for (FileStatus file : partFiles) { partFileMap.put(new PartFile(file.getPath().getName()), file); } for (Map.Entry<PartFile, FileStatus> entry : partFileMap.entrySet()) { LOG.info("Processing file:" + entry.getValue().getPath()); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader( persistFs.open(entry.getValue().getPath()))); String row = in.readLine(); while (row != null) { writeRow(row); row = in.readLine(); } } finally { if (in != null) { in.close(); } } } } catch (ParseException e) { throw new IOException(e); } }
Source:
<code>public static void scan(AbstractBuild build, PrintStream buildLog) { try { Collection<FailureCause> causes = PluginImpl.getInstance().getKnowledgeBase().getCauses(); List<FoundFailureCause> foundCauseList = findCauses(causes, build, buildLog); <START> if (PluginImpl.isTestResultParsingEnabled()) { <END> foundCauseList.addAll(findFailedTests(build, buildLog)); } FailureCauseBuildAction buildAction = new FailureCauseBuildAction(foundCauseList); buildAction.setBuild(build); build.addAction(buildAction); StatisticsLogger.getInstance().log(build, foundCauseList); } catch (Exception e) { logger.log(Level.SEVERE, "Could not scan build " + build, e); } }</code><technical_language>This problems for some KnowledgeBase implementations reporting statistics list of contains in knoledge base key in database uses. A QnD of fixing this include in statistics logging all, i.e. add list stat logging call</technical_language>

Target:
public static void scan(AbstractBuild build, PrintStream buildLog) { try { Collection<FailureCause> causes = PluginImpl.getInstance().getKnowledgeBase().getCauses(); List<FoundFailureCause> foundCauseListToLog = findCauses(causes, build, buildLog); List<FoundFailureCause> foundCauseList; if (PluginImpl.getInstance().isTestResultParsingEnabled()) { foundCauseList = Collections.synchronizedList( new LinkedList<FoundFailureCause>(foundCauseListToLog)); foundCauseList.addAll(findFailedTests(build, buildLog)); } else { foundCauseList = foundCauseListToLog; } FailureCauseBuildAction buildAction = new FailureCauseBuildAction(foundCauseList); buildAction.setBuild(build); build.addAction(buildAction); StatisticsLogger.getInstance().log(build, foundCauseListToLog); } catch (Exception e) { logger.log(Level.SEVERE, "Could not scan build " + build, e); } }
Source:
<code>public void testEnvironmentVariableReplacement() { ImmutableMap<String, String> original = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "${ENV:GRAPE}") .put("peach", "${ENV:PEACH}") .put("grass", "${ENV:!!!}") .put("pear", "${ENV:X_PEAR}") .put("cherry", "${ENV:X_CHERRY}") .put("orange", "orange-value") .build(); <START> ImmutableMap<String, String> environment = ImmutableMap.<String, String>builder() <END> .put("GRAPE", "env-grape") .put("X_CHERRY", "env-cherry") .build(); List<String> errors = new ArrayList<>(); Map<String, String> actual = replaceEnvironmentVariables(original, environment, (key, error) -> errors.add(error)); ImmutableMap<String, String> expected = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "env-grape") .put("grass", "${ENV:!!!}") .put("cherry", "env-cherry") .put("orange", "orange-value") .build(); assertEquals(actual, expected); assertThat(errors).containsExactly( "Configuration property 'peach' references unset environment variable 'PEACH'", "Configuration property 'pear' references unset environment variable 'X_PEAR'"); }</code><technical_language>Map for declared type</technical_language>

Target:
public void testEnvironmentVariableReplacement() { Map<String, String> original = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "${ENV:GRAPE}") .put("peach", "${ENV:PEACH}") .put("grass", "${ENV:!!!}") .put("pear", "${ENV:X_PEAR}") .put("cherry", "${ENV:X_CHERRY}") .put("orange", "orange-value") .build(); Map<String, String> environment = ImmutableMap.<String, String>builder() .put("GRAPE", "env-grape") .put("X_CHERRY", "env-cherry") .build(); List<String> errors = new ArrayList<>(); Map<String, String> actual = replaceEnvironmentVariables(original, environment, (key, error) -> errors.add(error)); Map<String, String> expected = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "env-grape") .put("grass", "${ENV:!!!}") .put("cherry", "env-cherry") .put("orange", "orange-value") .build(); assertEquals(actual, expected); assertThat(errors).containsExactly( "Configuration property 'peach' references unset environment variable 'PEACH'", "Configuration property 'pear' references unset environment variable 'X_PEAR'"); }
Source:
<code>public ButtonRs() { this(ButtonRs.DEFAULT_BUILD); final GraphicsEnvironment env = GraphicsEnvironment .getLocalGraphicsEnvironment(); <START> font(env, "<LINK_0>"); <END> font(env, "<LINK_1>"); }</code><technical_language>this.font(), next line</technical_language>

Target:
public ButtonRs() { this(ButtonRs.DEFAULT_BUILD); final GraphicsEnvironment env = GraphicsEnvironment .getLocalGraphicsEnvironment(); this.font(env, "<LINK_0>"); this.font(env, "<LINK_1>"); }
Source:
<code>public static Pair<Integer, Integer> findMatchingLines(String input, String match) { String[] lines = input.split("\n"); String[] matchLines = match.split("\n"); for (int i = 0; i < lines.length - matchLines.length; i++) { boolean isMatch = true; for (int j = 0; j < matchLines.length; j++) { String cLine = lines[i + j]; String fLine = matchLines[j]; if (j == 0 && !cLine.endsWith(fLine) || j != 0 && j != matchLines.length - 1 && !cLine.equals(fLine) || j == matchLines.length - 1 && !cLine.startsWith(fLine)) { isMatch = false; break; } } if (isMatch) { <START> return new Pair<>(i + 1, i + matchLines.length); <END> } } return null; }</code><technical_language>Return int[2] here</technical_language>

Target:
public static int[] findMatchingLines(String input, String match) { int pos = input.indexOf(match); if (pos < 0) { return null; } int start = input.substring(0, pos).split("\n").length; int end = start + match.split("\n").length - 1; return new int[] { start, end }; }
Source:
<code>public void parse(CommandSource source, CommandArgs args, CommandContext context) throws ArgumentParseException { String key = getUntranslatedKey(); if (key != null) { <START> context.addFlag(key); <END> if (valueElement != null) { valueElement.parse(source, args, context); } else { context.putArg(key, true); } } }</code><technical_language>If flag fails parse is as, say, a negative number, flag in context be, right</technical_language>

Target:
public void parse(CommandSource source, CommandArgs args, CommandContext context) throws ArgumentParseException { String key = getUntranslatedKey(); if (valueElement != null) { valueElement.parse(source, args, context); } else { context.putArg(key, true); } context.addFlag(key); }
Source:
<code>private static boolean isReference(String value) { String trimmedVal = value == null ? null : value.trim(); <START> return trimmedVal != null && trimmedVal.startsWith("${") && trimmedVal.lastIndexOf("${") == 0 END> && trimmedVal.indexOf('}') == trimmedVal.lastIndexOf('}') && trimmedVal.indexOf('}') == trimmedVal.length() - 1 && trimmedVal.length() > 3; }</code><technical_language>trimmedVal.startsWith("${") is imho redundant, is covered trimmedVal.lastIndexOf("${") == 0</technical_language>

Target:
private static boolean isReference(String value) { String trimmedVal = value == null ? null : value.trim(); return trimmedVal != null && trimmedVal.lastIndexOf("${") == 0 && trimmedVal.indexOf('}') == trimmedVal.length() - 1 && trimmedVal.length() > 3; }
Source:
<code>protected Optional<TreeType> getVal(ItemStack stack) { if (stack.getItem() == ItemTypes.LEAVES2 || stack.getItem() == ItemTypes.LOG2) { return Optional.of(getFromMeta(stack.getItemDamage() + 4)); <START> } else if (stack.getItem() == ItemTypes.BOAT) { <END> return Optional.of(TreeTypes.OAK); } else if (stack.getItem() == ItemTypes.ACACIA_BOAT) { return Optional.of(TreeTypes.ACACIA); } else if (stack.getItem() == ItemTypes.BIRCH_BOAT) { return Optional.of(TreeTypes.BIRCH); } else if (stack.getItem() == ItemTypes.DARK_OAK_BOAT) { return Optional.of(TreeTypes.DARK_OAK); } else if (stack.getItem() == ItemTypes.JUNGLE_BOAT) { return Optional.of(TreeTypes.JUNGLE); } else if (stack.getItem() == ItemTypes.SPRUCE_BOAT) { return Optional.of(TreeTypes.SPRUCE); } else { return Optional.of(getFromMeta(stack.getItemDamage())); } }</code><technical_language>extract stack.getItem() a local variable</technical_language>

Target:
protected Optional<TreeType> getVal(ItemStack stack) { if (stack.getItem() == ItemTypes.LEAVES2 || stack.getItem() == ItemTypes.LOG2) { return Optional.of(getFromMeta(stack.getItemDamage() + 4)); } else if (boatMapping.containsKey((ItemType) stack.getItem())) { return Optional.of(boatMapping.get(stack.getItem())); } else { return Optional.of(getFromMeta(stack.getItemDamage())); } }
Source:
<code>HttpResponse head(URI uri) { HttpHead head = new HttpHead(uri); <START> addHttpBasicAuthHeader(head); <END> return executeRequest(head); }</code><technical_language>add creds in executeRequest? calls executeRequest needed? (Can executeRequest private?)</technical_language>

Target:
HttpResponse head(URI uri) { HttpHead head = new HttpHead(uri); return executeRequest(head); }
Source:
<code>private static LocalDate calculatedUnadjustedDateFromAdjusted( LocalDate baseDate, RollConvention rollConvention, BusinessDayAdjustment businessDayAdjustment, ReferenceData refData) { <START> if (rollConvention != null) { <END> int rollDom = rollConvention.getDayOfMonth(); if (rollDom > 0 && baseDate.getDayOfMonth() != rollDom) { int lengthOfMonth = baseDate.lengthOfMonth(); int actualDom = Math.min(rollDom, lengthOfMonth); if (baseDate.getDayOfMonth() != actualDom) { LocalDate rollImpliedDate = baseDate.withDayOfMonth(actualDom); LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } else if (rollDom == 0) { LocalDate unadjustedValidRollDate = rollConvention.adjust(baseDate); if (!unadjustedValidRollDate.equals(baseDate)) { LocalDate adjustedRollDate = businessDayAdjustment.adjust(unadjustedValidRollDate, refData); if (adjustedRollDate.equals(baseDate)) { return unadjustedValidRollDate; } } } } return baseDate; }</code><technical_language>Worth checking this in calling code I</technical_language>

Target:
private static LocalDate calculatedUnadjustedDateFromAdjusted( LocalDate baseDate, RollConvention rollConvention, BusinessDayAdjustment businessDayAdjustment, ReferenceData refData) { int rollDom = rollConvention.getDayOfMonth(); if (rollDom > 0 && baseDate.getDayOfMonth() != rollDom) { int lengthOfMonth = baseDate.lengthOfMonth(); int actualDom = Math.min(rollDom, lengthOfMonth); if (baseDate.getDayOfMonth() != actualDom) { LocalDate rollImpliedDate = baseDate.withDayOfMonth(actualDom); LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } else if (rollDom == 0) { LocalDate rollImpliedDate = rollConvention.adjust(baseDate); if (!rollImpliedDate.equals(baseDate)) { LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } return baseDate; }
Source:
<code>public int compareTo(ImmutableBanData o) { <START> return 0; <END> }</code><technical_language>comparison</technical_language>

Target:
public int compareTo(ImmutableBanData o) { return o.bans().get() == this.bans ? 1 : 0; }
Source:
<code>private static String persist(@SuppressWarnings("rawtypes") HashMap map) { DataBundle bundle = new DataBundle(); int count = 0; @SuppressWarnings("unchecked") Set<String> set = map.keySet(); @SuppressWarnings("rawtypes") Iterator itr = set.iterator(); String type = ""; while (itr.hasNext()) { String key = (String) itr.next(); Object obj = map.get(key); if (obj instanceof AccountAttributes) { type = "AccountData"; AccountAttributes accountData = (AccountAttributes) obj; bundle.accounts.put(key, accountData); } else if (obj instanceof InstructorAttributes) { type = "InstructorData"; InstructorAttributes instructorData = (InstructorAttributes) obj; bundle.instructors.put(key, instructorData); } else if (obj instanceof CourseAttributes) { type = "CourseData"; CourseAttributes courseData = (CourseAttributes) obj; bundle.courses.put(key, courseData); } else if (obj instanceof StudentAttributes) { type = "StudentData"; StudentAttributes studentData = (StudentAttributes) obj; bundle.students.put(key, studentData); } count++; itr.remove(); System.out.print(key + "\n"); if (type.equals("EvaluationData") && count >= MAX_NUMBER_OF_EVALUATION_PER_REQUEST) { break; } if (count >= MAX_NUMBER_OF_ENTITY_PER_REQUEST) { break; <START> } <END> } System.out.print(count + " entities of type " + type + " left " + map.size() + " \n"); String status = BackDoor.persistNewDataBundle(gson.toJson(bundle)); try { Thread.sleep(WAIT_TIME_BETWEEN_REQUEST); } catch (InterruptedException e) { e.printStackTrace(); } return status; }</code><technical_language>collapse conditions in if statement</technical_language>

Target:
private static String persist(@SuppressWarnings("rawtypes") HashMap map) { DataBundle bundle = new DataBundle(); int count = 0; @SuppressWarnings("unchecked") Set<String> set = map.keySet(); @SuppressWarnings("rawtypes") Iterator itr = set.iterator(); String type = ""; while (itr.hasNext()) { String key = (String) itr.next(); Object obj = map.get(key); if (obj instanceof AccountAttributes) { type = "AccountData"; AccountAttributes accountData = (AccountAttributes) obj; bundle.accounts.put(key, accountData); } else if (obj instanceof InstructorAttributes) { type = "InstructorData"; InstructorAttributes instructorData = (InstructorAttributes) obj; bundle.instructors.put(key, instructorData); } else if (obj instanceof CourseAttributes) { type = "CourseData"; CourseAttributes courseData = (CourseAttributes) obj; bundle.courses.put(key, courseData); } else if (obj instanceof StudentAttributes) { type = "StudentData"; StudentAttributes studentData = (StudentAttributes) obj; bundle.students.put(key, studentData); } count++; itr.remove(); System.out.print(key + "\n"); if ("EvaluationData".equals(type) && count >= MAX_NUMBER_OF_EVALUATION_PER_REQUEST || count >= MAX_NUMBER_OF_ENTITY_PER_REQUEST) { break; } } System.out.print(count + " entities of type " + type + " left " + map.size() + " \n"); String status = BackDoor.persistNewDataBundle(gson.toJson(bundle)); try { Thread.sleep(WAIT_TIME_BETWEEN_REQUEST); } catch (InterruptedException e) { e.printStackTrace(); } return status; }
Source:
<code>public void updateProfile(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleProfile> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateProfile: cannot update a profile with ID null"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { <START> listener.onSuccess(new KuzzleProfile(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result"))); <END> } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options); } }</code><technical_language>need pass result._source instead of result a profile content</technical_language>

Target:
public void updateProfile(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleProfile> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateProfile: cannot update a profile with ID null"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(new KuzzleProfile(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result").getJSONObject("_source"))); } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options); } }
Source:
<code>public synchronized Map<String, DbEntityType> getEntities(final String schemaPattern) throws DatabaseEngineException { final Map<String, DbEntityType> entities = new LinkedHashMap<>(); ResultSet rs = null; try { getConnection(); <START> rs = conn.getMetaData().getTables(schemaPattern, null, "%", null); <END> while (rs.next()) { String entityName = rs.getString("table_name"); String entityType = rs.getString("table_type"); DbEntityType type; if ("TABLE".equals(entityType)) { type = DbEntityType.TABLE; } else if ("VIEW".equals(entityType)) { type = DbEntityType.VIEW; } else if ("SYSTEM TABLE".equals(entityType)) { type = DbEntityType.SYSTEM_TABLE; } else if ("SYSTEM VIEW".equals(entityType)) { type = DbEntityType.SYSTEM_VIEW; } else { type = DbEntityType.UNMAPPED; } entities.put(entityName, type); } return entities; } catch (final Exception e) { throw new DatabaseEngineException("Could not get entities", e); } finally { try { if (rs != null) { rs.close(); } } catch (final Exception a) { logger.trace("Error closing result set.", a); } } }</code><technical_language>missing "this" instance variable, please :)</technical_language>

Target:
public synchronized Map<String, DbEntityType> getEntities(final String schemaPattern) throws DatabaseEngineException { final Map<String, DbEntityType> entities = new LinkedHashMap<>(); ResultSet rs = null; try { getConnection(); rs = this.conn.getMetaData().getTables(schemaPattern, null, "%", null); while (rs.next()) { final String entityName = rs.getString("table_name"); final String entityType = rs.getString("table_type"); final DbEntityType type; if ("TABLE".equals(entityType)) { type = DbEntityType.TABLE; } else if ("VIEW".equals(entityType)) { type = DbEntityType.VIEW; } else if ("SYSTEM TABLE".equals(entityType)) { type = DbEntityType.SYSTEM_TABLE; } else if ("SYSTEM VIEW".equals(entityType)) { type = DbEntityType.SYSTEM_VIEW; } else { type = DbEntityType.UNMAPPED; } entities.put(entityName, type); } return entities; } catch (final Exception e) { throw new DatabaseEngineException("Could not get entities", e); } finally { try { if (rs != null) { rs.close(); } } catch (final Exception a) { logger.trace("Error closing result set.", a); } } }
Source:
<code>public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String s = getPath(); <START> s = s.replace('\\', '/'); <END> String[] elements = s.split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (Constants.DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(Constants.DOT_GIT_EXT)) result = result.substring(0, result.length() - Constants.DOT_GIT_EXT.length()); return result; }</code><technical_language>check for Windows platform replacing "\" "/"? "\" part of file folder names UNIX</technical_language>

Target:
public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String s = getPath(); if (File.separatorChar == '\\') s = s.replace('\\', '/'); String[] elements = s.split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (Constants.DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(Constants.DOT_GIT_EXT)) result = result.substring(0, result.length() - Constants.DOT_GIT_EXT.length()); return result; }
Source:
<code>public void testMessageIsShownIfAccountRequiresAuthorization() throws InterruptedException, UnsupportedEncodingException { MockResponse loginNeedAuthorizationResponse = new MockResponse(); loginNeedAuthorizationResponse.setResponseCode(401); <START> List<RecordedRequest> requests = mockDispatcher.setSignupResponse(loginNeedAuthorizationResponse); <END> String signupText = getResources().getString(R.string.security_signup) + " test@example.com"; signUpUsingEmail("test@example.com"); assertQueryStringEquals(getRequest("test@example.com"), requests.get(0).getUtf8Body()); onView(withText(signupText)).check(matches(isDisplayed())); }</code><technical_language>Overload SignupResponse method allow response code</technical_language>

Target:
public void testMessageIsShownIfAccountRequiresAuthorization() throws InterruptedException, UnsupportedEncodingException { MockResponse loginNeedAuthorizationResponse = new MockResponse(); loginNeedAuthorizationResponse.setResponseCode(401); List<RecordedRequest> requests = getMockDispatcher().setSignupResponse(loginNeedAuthorizationResponse); String signupText = getResources().getString(R.string.security_signup) + " test@example.com"; signUpUsingEmail("test@example.com"); assertQueryStringEquals(getRequest("test@example.com"), requests.get(0).getUtf8Body()); onView(withText(signupText)).check(matches(isDisplayed())); }
Source:
<code>public byte[] persistToBytes() { try { return OBJECT_MAPPER.writeValueAsBytes(this); } catch (JsonProcessingException e) { <START> throw new RuntimeException("Exception processing JSON"); <END> } }</code><technical_language>nit: log.warn("Exception processing JSON", e);? useful for debugging happened</technical_language>

Target:
public byte[] persistToBytes() { try { return OBJECT_MAPPER.writeValueAsBytes(this); } catch (JsonProcessingException e) { throw new RuntimeException("Exception processing JSON", e); } }
Source:
<code>public long getSafePointDrId() { <START> synchronized (m_map) { <END> assert (!m_map.isEmpty()); return end(m_map.asRanges().iterator().next()); } }</code><technical_language>good me, worth protect getFirstDrId() getLastDrId() too, throw NoSuchElementException if m_map is empty</technical_language>

Target:
public long getSafePointDrId() { assert (!m_map.isEmpty()); return end(m_map.asRanges().iterator().next()); }
Source:
<code>protected <T> void render(Cell.Context context, VM value, SafeHtmlBuilder sb, HasCell<VM, T> hasCell) { Cell<T> cell = hasCell.getCell(); if (cell instanceof StyledImageResourceCell) { <START> ((StyledImageResourceCell) cell).setStyle("display:inline-block;vertical-align:middle;"); END> } if (cell instanceof TextCellWithTooltip) { ((TextCellWithTooltip) cell).setStyle("display:inline-block;"); } cell.render(context, hasCell.getValue(value), sb); }</code><technical_language>Instead of adding inline styles this pass in a class name apply element instead? This maintenance a lot easier making branding applying styles</technical_language>

Target:
protected <T> void render(Cell.Context context, VM value, SafeHtmlBuilder sb, HasCell<VM, T> hasCell) { Cell<T> cell = hasCell.getCell(); if (cell instanceof StyledImageResourceCell) { ((StyledImageResourceCell) cell).setStyleClass(getTable().getDivImageInlineBlockStyleName()); } if (cell instanceof TextCellWithTooltip) { ((TextCellWithTooltip) cell).setStyleClass(getTable().getDivInlineBlockStyleName()); } cell.render(context, hasCell.getValue(value), sb); }
Source:
<code>public void close() throws Exception { CloseablesListener closeablesListener = new CloseablesListener(); closeablesListener.sample( streamToDisk ); closeablesListener.sample( clientPageCache ); <START> closeablesListener.close(); <END> }</code><technical_language>IOUtils.closeAll these</technical_language>

Target:
public void close() throws Exception { IOUtils.closeAll( streamToDisk, clientPageCache ); }
Source:
<code><START> public HashSet<Project> getProjects() { <END> return projects; }</code><technical_language>supertype Set</technical_language>

Target:
public Map<String,Project> getProjects() { return projects; }
Source:
<code>private String result() { <START> return new String(stream.toString()); <END> }</code><technical_language>I need this new String</technical_language>

Target:
private String result() { return stream.toString(); }
Source:
<code>private void closeAuthenticatedChannel(boolean signalServer) { mSaslClientHandler.close(); mChannelAuthenticated = false; if (signalServer) { try { mRequestObserver.onCompleted(); } catch (Exception e) { <START> LogUtils.warnWithException(LOG, "Failed signaling server for stream completion.", e); <END> } } }</code><technical_language>include channel info in message</technical_language>

Target:
private void closeAuthenticatedChannel(boolean signalServer) { mSaslClientHandler.close(); mChannelAuthenticated = false; if (signalServer) { try { mRequestObserver.onCompleted(); } catch (Exception e) { LogUtils.warnWithException(LOG, "Failed signaling server for stream completion for channel: {}.", mChannelKey.toStringShort(), e); } } }
Source:
<code>private DefaultQuerySubmitterImpl(final OperatorChainer operatorChainer, final OperatorChainAllocator chainAllocator, final PhysicalPlanGenerator physicalPlanGenerator, final SSM ssm, final StringIdentifierFactory idfactory, @Parameter(NumSubmitterThreads.class) final int numThreads) { this.tpStage = new ThreadPoolStage<>((tuple) -> { final PhysicalPlan<Operator> physicalPlan = physicalPlanGenerator.generate(tuple); final Iterator<Operator> iterator = GraphUtils.topologicalSort(physicalPlan.getOperators()); final Map<Identifier, OperatorState> operatorStateMap = getInitialStateOfQuery(iterator); final Identifier queryId = idfactory.getNewInstance(tuple.getKey()); ssm.create(queryId, operatorStateMap); final PhysicalPlan<OperatorChain> chainedPlan = operatorChainer.chainOperators(physicalPlan); <START> <END> final DAG<OperatorChain> chainedOperators = chainedPlan.getOperators(); chainAllocator.allocate(chainedOperators); start(chainedPlan); }, numThreads); }</code><technical_language>remove line</technical_language>

Target:
private DefaultQuerySubmitterImpl(final OperatorChainer operatorChainer, final OperatorChainAllocator chainAllocator, final PhysicalPlanGenerator physicalPlanGenerator, final SSM ssm, final StringIdentifierFactory idfactory, @Parameter(NumSubmitterThreads.class) final int numThreads) { this.physicalPlanMap = new ConcurrentHashMap<>(); this.tpStage = new ThreadPoolStage<>((tuple) -> { final PhysicalPlan<Operator> physicalPlan = physicalPlanGenerator.generate(tuple); final Iterator<Operator> iterator = GraphUtils.topologicalSort(physicalPlan.getOperators()); final Map<Identifier, OperatorState> operatorStateMap = getInitialQueryState(iterator); final Identifier queryId = idfactory.getNewInstance(tuple.getKey()); ssm.create(queryId, operatorStateMap); final PhysicalPlan<OperatorChain> chainedPlan = operatorChainer.chainOperators(physicalPlan); physicalPlanMap.putIfAbsent(tuple.getKey(), chainedPlan); final DAG<OperatorChain> chainedOperators = chainedPlan.getOperators(); chainAllocator.allocate(chainedOperators); start(chainedPlan); }, numThreads); }
Source:
<code>private static int getHttpServicePortProperty(final BundleContext bc, final String propertyName) { Object value; int port = -1; try { int candidate = Integer.MIN_VALUE; final ServiceReference[] refs = bc.getAllServiceReferences("org.osgi.service.http.HttpService", null); for (final ServiceReference ref : refs) { value = ref.getProperty(propertyName); if (value == null) { continue; } final int servicePort; try { servicePort = Integer.parseInt(value.toString()); } catch (final NumberFormatException ex) { continue; } value = ref.getProperty(Constants.SERVICE_RANKING); final int serviceRanking; if (value == null || !(value instanceof Integer)) { serviceRanking = 0; } else { serviceRanking = (Integer) value; } if (serviceRanking >= candidate) { candidate = serviceRanking; port = servicePort; } } <START> } catch (final InvalidSyntaxException ex) { <END> } if (port > 0) { return port; } value = bc.getProperty(propertyName); if (value != null) { if (value instanceof String) { try { return Integer.parseInt(value.toString()); } catch (final NumberFormatException ex) { } } else if (value instanceof Integer) { return (Integer) value; } } return -1; }</code><technical_language>I know, this in theory happen. However, if for crazy circumstances, hard do find. IMHO hurt log anyway...</technical_language>

Target:
private static int getHttpServicePortProperty(final BundleContext bc, final String propertyName) { Object value; int port = -1; try { int candidate = Integer.MIN_VALUE; final ServiceReference[] refs = bc.getAllServiceReferences("org.osgi.service.http.HttpService", null); for (final ServiceReference ref : refs) { value = ref.getProperty(propertyName); if (value == null) { continue; } final int servicePort; try { servicePort = Integer.parseInt(value.toString()); } catch (final NumberFormatException ex) { continue; } value = ref.getProperty(Constants.SERVICE_RANKING); final int serviceRanking; if (value == null || !(value instanceof Integer)) { serviceRanking = 0; } else { serviceRanking = (Integer) value; } if (serviceRanking >= candidate) { candidate = serviceRanking; port = servicePort; } } } catch (final InvalidSyntaxException ex) { final Logger logger = LoggerFactory.getLogger(HttpServiceUtil.class); logger.warn("This error should only be thrown if a filter could not be parsed. We don't use a filter..."); } if (port > 0) { return port; } value = bc.getProperty(propertyName); if (value != null) { if (value instanceof String) { try { return Integer.parseInt(value.toString()); } catch (final NumberFormatException ex) { } } else if (value instanceof Integer) { return (Integer) value; } } return -1; }
Source:
<code>public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { <START> ITask updatedReview = (ITask) delta.getElement(); <END> if (updatedReview != null && isTaskAssosciatedWithReviewConnector(updatedReview)) { SynchronizationState taskState = updatedReview.getSynchronizationState(); if (taskState.isIncoming()) { ITask assosciatedTask = getTasksAssociatedWithReviewTask(updatedReview); if (assosciatedTask != null) { updateTaskWithIncomingReviewState(assosciatedTask, true); } } else { forceFullRefreshFor(updatedReview); } } } }</code><technical_language>Need instanceof check</technical_language>

Target:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { if (delta.getElement() instanceof ITask) { ITask updatedReview = (ITask) delta.getElement(); if (updatedReview != null && isTaskAssosciatedWithReviewConnector(updatedReview)) { SynchronizationState taskState = updatedReview.getSynchronizationState(); if (taskState.isIncoming()) { ITask assosciatedTask = getTasksAssociatedWithReviewTask(updatedReview); if (assosciatedTask != null) { updateTaskWithIncomingReviewState(assosciatedTask, true); } } else { forceFullRefreshFor(updatedReview); } } } } }
Source:
<code>protected void assignPIDs(Document mets) { int count = 0; Iterator<Element> divs = mets.getDescendants(new ElementFilter("div", JDOMNamespaceUtil.METS_NS)); while(divs.hasNext()) { Element div = divs.next(); String cids = div.getAttributeValue("CONTENTIDS"); if(cids != null && cids.contains("info:fedora/")) continue; PID pid = repository.mintContentPid(); if(cids == null) { div.setAttribute("CONTENTIDS", pid.getURI()); } else { StringBuilder sb = new StringBuilder(pid.getURI()); for(String s : cids.split("\\s")) { sb.append(" ").append(s); } div.setAttribute("CONTENTIDS", sb.toString()); } <START> PremisLogger premisLogger = premisLoggerFactory.createPremisLogger(pid); <END> Resource premisEvent = premisLogger.buildEvent(Premis.Normalization) .addEventDetail("Assigned PID, {0}, to object defined in a METS div", pid) .addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .create(); premisLogger.writeEvent(premisEvent); count++; } log.info(count + " PIDs assigned"); PID depositPID = getDepositPID(); PremisLogger premisDepositLogger = premisLoggerFactory.createPremisLogger(depositPID); Resource premisDepositEvent = premisDepositLogger.buildEvent(Premis.Normalization) .addEventDetail("Assigned {0,choice,1#PID|2#PIDs} to {0,choice,1#one object|2#{0,number} objects} ", count) .create(); premisDepositLogger.writeEvent(premisDepositEvent); }</code><technical_language>I suggest changing behavior of getPremisLogger call premisLoggerFactory.createPremisLogger replacing usage. update of deposit jobs. Additionally, getPremisLogger calls new FilePremisLogger(pid, file, repository);, passing in file is pretty critical in this case</technical_language>

Target:
protected void assignPIDs(Document mets) { int count = 0; Iterator<Element> divs = mets.getDescendants(new ElementFilter("div", JDOMNamespaceUtil.METS_NS)); while(divs.hasNext()) { Element div = divs.next(); String cids = div.getAttributeValue("CONTENTIDS"); if(cids != null && cids.contains("info:fedora/")) continue; PID pid = repository.mintContentPid(); if(cids == null) { div.setAttribute("CONTENTIDS", pid.getURI()); } else { StringBuilder sb = new StringBuilder(pid.getURI()); for(String s : cids.split("\\s")) { sb.append(" ").append(s); } div.setAttribute("CONTENTIDS", sb.toString()); } PremisLogger premisLogger = getPremisLogger(pid); Resource premisEvent = premisLogger.buildEvent(Premis.Normalization) .addEventDetail("Assigned PID, {0}, to object defined in a METS div", pid) .addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .create(); premisLogger.writeEvent(premisEvent); count++; } log.info(count + " PIDs assigned"); PID depositPID = getDepositPID(); PremisLogger premisDepositLogger = getPremisLogger(depositPID); Resource premisDepositEvent = premisDepositLogger.buildEvent(Premis.Normalization) .addEventDetail("Assigned {0,choice,1#PID|2#PIDs} to {0,choice,1#one object|2#{0,number} objects} ", count) .create(); premisDepositLogger.writeEvent(premisDepositEvent); }
Source:
<code>public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { synchronized (q) { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (isAlive() && (end - now > 0L)) { <START> q.wait((end - now) / 1000L); <END> now = System.nanoTime(); } } return isTerminated(); }</code><technical_language>I find 1000000L nanoseconds in a millisecond 1000L suspect</technical_language>

Target:
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { synchronized (q) { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (isAlive() && (end - now > 0L)) { q.wait(TimeUnit.NANOSECONDS.toMillis(end - now)); now = System.nanoTime(); } } return isTerminated(); }
Source:
<code>public void testExecuteSimpleRuleFlowProcessWithFireAndForgetResponseHandler() throws InterruptedException { List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME)); commands.add(commandsFactory.newStartProcess(PROCESS_ID)); commands.add(commandsFactory.newFireAllRules()); BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION); ruleClient.setResponseHandler(new FireAndForgetResponseHandler()); assertNoResponse(ruleClient.executeCommandsWithResults(CONTAINER_ID, batchExecution)); <START> Thread.sleep(5000); END> Command getGlobalCommand = commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME); ruleClient.setResponseHandler(new RequestReplyResponseHandler()); ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(CONTAINER_ID, getGlobalCommand); KieServerAssert.assertSuccess(response); ExecutionResults result = response.getResult(); List<String> outcome = (List<String>) result.getValue(LIST_OUTPUT_NAME); assertThat(outcome).isNotNull(); assertThat(outcome).containsExactly("Rule from first ruleflow group executed", "Rule from second ruleflow group executed"); }</code><technical_language>other tests delay() method - parametrized reused. Out of curiosity - 5 sec</technical_language>

Target:
public void testExecuteSimpleRuleFlowProcessWithFireAndForgetResponseHandler() throws Exception { List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME)); commands.add(commandsFactory.newStartProcess(PROCESS_ID)); commands.add(commandsFactory.newFireAllRules()); BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION); ruleClient.setResponseHandler(new FireAndForgetResponseHandler()); ServiceResponse<?> response = ruleClient.executeCommandsWithResults(CONTAINER_ID, batchExecution); assertThat(response).isNull(); ruleClient.setResponseHandler(new RequestReplyResponseHandler()); Command getGlobalCommand = commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME); List<String> value = new ArrayList<String>(); value.add("Rule from first ruleflow group executed"); value.add("Rule from second ruleflow group executed"); KieServerSynchronization.waitForCommandResult(ruleClient, CONTAINER_ID, getGlobalCommand, LIST_OUTPUT_NAME, value); }