auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Operator translateToDataFlow(Operator input) { PlanMapOperator<IN, Long> countMapOperator = new PlanMapOperator<IN, Long>( new CountingMapUdf<IN>(), "Count: map to ones", getInputType(), BasicTypeInfo.LONG_TYPE_INFO); countMapOperator.setInput(input); PlanReduceOperator<Long> countReduceOperator = new PlanReduceOperator<Long>( new CountingReduceUdf(), new int[0], "Count: sum up ones", BasicTypeInfo.LONG_TYPE_INFO); countReduceOperator.setInput(countMapOperator); return countReduceOperator; }

Target:
protected ReduceOperatorBase<Long, GenericReduce<Long>> translateToDataFlow(Operator input) { MapOperatorBase<IN, Long, GenericMap<IN, Long>> mapToOnes = new MapOperatorBase<IN, Long, GenericMap<IN, Long>>( new CountingMapUdf<IN>(), new UnaryOperatorInformation<IN, Long>(getInputType(), BasicTypeInfo.LONG_TYPE_INFO), "Count: map to ones"); mapToOnes.setInput(input); mapToOnes.setDegreeOfParallelism(input.getDegreeOfParallelism()); GenericDataSourceBase<Long, CollectionInputFormat<Long>> dummySource = new GenericDataSourceBase( new CollectionInputFormat<Long>(Arrays.asList(new Long[]{0L})), new OperatorInformation<Long>(BasicTypeInfo.LONG_TYPE_INFO), "Count: dummy source (for 0 count)"); Union<Long> unionMapToOnesAndZero = new Union<Long>(mapToOnes, dummySource); ReduceOperatorBase<Long, GenericReduce<Long>> sumOnes = new ReduceOperatorBase<Long, GenericReduce<Long>>( new CountingReduceUdf(), new UnaryOperatorInformation<Long, Long>(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO), new int[0], "Count: sum up ones"); sumOnes.setInput(unionMapToOnesAndZero); sumOnes.setDegreeOfParallelism(1); return sumOnes; }
Source:
public int[] indexPage(Page page) { Work<GroupByIdBlock> work = hash.getGroupIds(page); verify(work.process()); GroupByIdBlock groupIds = work.getResult(); int[] indexes = new int[page.getPositionCount()]; for (int i = 0; i < indexes.length; i++) { indexes[i] = toIntExact(groupIds.getGroupId(i)); } return indexes; }

Target:
public int[] indexPage(Page page) { Work<GroupByIdBlock> work = hash.getGroupIds(page); boolean done = work.process(); verify(done); GroupByIdBlock groupIds = work.getResult(); int[] indexes = new int[page.getPositionCount()]; for (int i = 0; i < indexes.length; i++) { indexes[i] = toIntExact(groupIds.getGroupId(i)); } return indexes; }
Source:
public void instructionsToMoveWestAndNorth() { Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH); robot.simulate("LAAARALA"); GridPosition expectedGridPosition = new GridPosition(-4, 1); Orientation expectedOrientation = Orientation.WEST; assertEquals(robot.getGridPosition(), expectedGridPosition); assertEquals(robot.getOrientation(), expectedOrientation); }

Target:
public void instructionsToMoveWestAndNorth() { Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH); robot.simulate("LAAARALA"); GridPosition expectedGridPosition = new GridPosition(-4, 1); Orientation expectedOrientation = Orientation.WEST; assertEquals(expectedGridPosition, robot.getGridPosition()); assertEquals(expectedOrientation, robot.getOrientation()); }
Source:
public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsNull() { List<String> attributes = null; patientService.getDuplicatePatientsByAttributes(attributes); }

Target:
public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsNull() { expectedException.expect(APIException.class); expectedException.expectMessage(NULL_ERROR_MESSAGE_FOR_ATTRIBUTES_NULL); patientService.getDuplicatePatientsByAttributes(null); }
Source:
private void verifyVariable(String variableKey, String variableValue) { int i = 0; searchService.searchEntry(variableKey, results -> assertTrue("It seems like variable <" + variableKey + ", " + variableValue + "> is not present in results", results.stream() .filter(entry -> variableKey.equals(entry.getKey()) && variableValue.equals(entry.getValue())) .findFirst() .isPresent())); }

Target:
private void verifyVariable(String variableKey, String variableValue) { int i = 0; searchService.searchEntry(variableKey, results -> assertTrue("It seems like variable <" + variableKey + ", " + variableValue + "> is not present in results", results.stream() .anyMatch(entry -> variableKey.equals(entry.getKey()) && variableValue.equals(entry.getValue())))); }
Source:
public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: case END_ROD: return true; default: return false; } }

Target:
public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: case CRYING_OBSIDIAN: case SHROOMLIGHT: case CAMPFIRE: case SOUL_CAMPFIRE: case SOUL_TORCH: case LANTERN: case CONDUIT: case RESPAWN_ANCHOR: case BROWN_MUSHROOM: case BREWING_STAND: case ENDER_CHEST: case END_PORTAL_FRAME: case END_ROD: return true; default: return false; } }
Source:
private Command addEcorePathIfRequired( final VTViewTemplate template, final EditingDomain domain, Command command, EObject view) { if (view == null) { return command; } for (final String ecorePaths : VView.class.cast(view).getEcorePaths()) { if (template.getReferencedEcores().contains(ecorePaths)) { continue; } final Command ecorePathCommand = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePaths); command = new CompoundCommand(Arrays.asList(command, ecorePathCommand)); } return command; }

Target:
private Command addEcorePathIfRequired( final VTViewTemplate template, final EditingDomain domain, Command command, EObject view) { if (view == null) { return command; } final List<Command> ecorePathCommands = new ArrayList<Command>(); ecorePathCommands.add(command); for (final String ecorePaths : VView.class.cast(view).getEcorePaths()) { if (template.getReferencedEcores().contains(ecorePaths)) { continue; } ecorePathCommands.add( AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePaths)); } if (ecorePathCommands.size() > 1) { return new CompoundCommand(ecorePathCommands); } return command; }
Source:
public void handleStateChanged(Watcher.Event.KeeperState state) { }

Target:
public void handleStateChanged(Watcher.Event.KeeperState state) { if (state == Watcher.Event.KeeperState.Expired) { LOG.info("ZkStateChangeListener::Session expired."); if (_assignmentList != null) { _assignmentList.close(); _assignmentList = null; } } }
Source:
public int getUpdatedSwitchColor() { int color; switch (baseTheme) { case DARK_THEME: color = getColor(R.color.md_dark_background); break; case AMOLED_THEME: color = getColor(R.color.md_brown_300); break; case LIGHT_THEME: default: color = getColor(R.color.md_light_background); } return color; }

Target:
public int getUpdatedSwitchColor() { int color; switch (baseTheme) { case DARK_THEME: color = getColor(R.color.md_dark_background); break; case AMOLED_THEME: color = getColor(R.color.md_blue_grey_900); break; case LIGHT_THEME: default: color = getColor(R.color.md_light_background); } return color; }
Source:
private void serveFile(HttpExchange exchange, File file) throws IOException { Headers headers = exchange.getResponseHeaders(); headers.set("Content-Description", "File Transfer"); headers.set("Content-Type", "application/octet-stream"); headers.set("Content-Disposition", "attachment; filename=" + file.getName()); headers.set("Expires", "0"); headers.set("Cache-Control", "must-revalidate"); headers.set("Pragma", "public"); exchange.sendResponseHeaders(200, file.length()); OutputStream out = exchange.getResponseBody(); byte[] buf = new byte[8192]; InputStream in = new FileInputStream(file); int c = 0; while ((c = in.read(buf, 0, buf.length)) > 0) { out.write(buf, 0, c); } out.close(); in.close(); }

Target:
private void serveFile(HttpExchange exchange, File file) throws IOException { OutputStream out = exchange.getResponseBody(); if (file.exists()) { Debug.log(file.toString() + " exists, serving..."); Headers headers = exchange.getResponseHeaders(); headers.set("Content-Description", "File Transfer"); headers.set("Content-Type", "application/octet-stream"); headers.set("Content-Disposition", "attachment; filename=" + file.getName()); headers.set("Expires", "0"); headers.set("Cache-Control", "must-revalidate"); headers.set("Pragma", "public"); exchange.sendResponseHeaders(200, file.length()); byte[] buf = new byte[64*1024]; InputStream in = new FileInputStream(file); int c = 0; while ((c = in.read(buf, 0, buf.length)) > 0) { out.write(buf, 0, c); } in.close(); } else { Debug.log(file.toString() + " does not exist, failing..."); byte resp = ("404 Not Found").getBytes(); exchange.getResponseHeaders().set("Content-Type", "text/plain"); exchange.sendResponseHeaders(StatusCode.NOT_FOUND, resp.length); out.write(resp); } out.close(); }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCScoreboard s; if (args.length == 0) { s = getBoard(MAIN, t); } else { s = getBoard(args[0].val(), t); } CArray ret = new CArray(t); for (MCTeam team : s.getTeams()) { CArray to = CArray.GetAssociativeArray(t); to.set("name", new CString(team.getName(), t), t); to.set("displayname", new CString(team.getDisplayName(), t), t); to.set("prefix", new CString(team.getPrefix(), t), t); to.set("suffix", new CString(team.getSuffix(), t), t); to.set("size", new CInt(team.getSize(), t), t); CArray ops = CArray.GetAssociativeArray(t); ops.set("friendlyfire", CBoolean.get(team.allowFriendlyFire()), t); ops.set("friendlyinvisibles", CBoolean.get(team.canSeeFriendlyInvisibles()), t); if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_8)) { ops.set("nametagvisibility", new CString(team.getNameTagVisibility().name(), t), t); } if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_9_4)) { ops.set("collisionrule", new CString(team.getOption(MCOption.COLLISION_RULE).name(), t), t); ops.set("deathmessagevisibility", new CString(team.getOption(MCOption.DEATH_MESSAGE_VISIBILITY).name(), t), t); } to.set("options", ops, t); CArray pl = new CArray(t); for (String entry : team.getEntries()) { pl.push(new CString(entry, t), t); } to.set("players", pl, t); ret.push(to, t); } return ret; }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCScoreboard s; if (args.length == 0) { s = getBoard(MAIN, t); } else { s = getBoard(args[0].val(), t); } CArray ret = new CArray(t); for (MCTeam team : s.getTeams()) { CArray to = CArray.GetAssociativeArray(t); to.set("name", new CString(team.getName(), t), t); to.set("displayname", new CString(team.getDisplayName(), t), t); to.set("prefix", new CString(team.getPrefix(), t), t); to.set("suffix", new CString(team.getSuffix(), t), t); to.set("size", new CInt(team.getSize(), t), t); CArray ops = CArray.GetAssociativeArray(t); ops.set("friendlyfire", CBoolean.get(team.allowFriendlyFire()), t); ops.set("friendlyinvisibles", CBoolean.get(team.canSeeFriendlyInvisibles()), t); if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_8)) { ops.set("nametagvisibility", new CString(team.getNameTagVisibility().name(), t), t); } if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_9)) { ops.set("collisionrule", new CString(team.getOption(MCOption.COLLISION_RULE).name(), t), t); ops.set("deathmessagevisibility", new CString(team.getOption(MCOption.DEATH_MESSAGE_VISIBILITY).name(), t), t); } to.set("options", ops, t); CArray pl = new CArray(t); for (String entry : team.getEntries()) { pl.push(new CString(entry, t), t); } to.set("players", pl, t); ret.push(to, t); } return ret; }
Source:
static Block2BlockwiseStatus forOutboundResponse(final Exchange exchange, final Response response, final int preferredBlockSize) { Block2BlockwiseStatus status = new Block2BlockwiseStatus(response.getOptions().getContentFormat()); status.response = response; status.buf = ByteBuffer.allocate(response.getPayloadSize()); status.buf.put(response.getPayload()); status.buf.flip(); if (response.isNotification()) { status.observe = response.getOptions().getObserve(); } status.setCurrentSzx(determineResponseBlock2Szx(exchange, preferredBlockSize)); return status; }

Target:
static Block2BlockwiseStatus forOutboundResponse(final Exchange exchange, final Response response, final int preferredBlockSize) { Block2BlockwiseStatus status = new Block2BlockwiseStatus(response.getPayloadSize(), response.getOptions().getContentFormat()); status.response = response; status.buf.put(response.getPayload()); status.buf.flip(); if (response.isNotification()) { status.observe = response.getOptions().getObserve(); } status.setCurrentSzx(determineResponseBlock2Szx(exchange, preferredBlockSize)); return status; }
Source:
public UnorderedDistinctMap() { resultSet = new HashSet<>(); mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); }

Target:
public UnorderedDistinctMap() { resultSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); }
Source:
protected void add(Node n, Context ctx) { if (n == null) return; maybeAddNewline(n); String comment = nodeComments.getComment(n); if (comment != null) { add(comment); add("\n"); } if (maybeOverrideCodeGen(n)) { return; } super.add(n, ctx); switch (n.getToken()) { case MEMBER_VARIABLE_DEF: if (n.hasChildren()) { add(" = "); add(n.getLastChild()); } break; case NEW: if (n.hasOneChild()) { add("()"); } break; default: break; } }

Target:
protected void add(Node n, Context ctx) { maybeAddNewline(n); String comment = nodeComments.getComment(n); if (comment != null) { add(comment); add("\n"); } if (maybeOverrideCodeGen(n)) { return; } super.add(n, ctx); switch (n.getToken()) { case MEMBER_VARIABLE_DEF: if (n.hasChildren()) { add(" = "); add(n.getLastChild()); } break; case NEW: if (n.hasOneChild()) { add("()"); } break; default: break; } }
Source:
private static Request consume(final Request req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); new RqPrint(req).printBody(baos); return new RqOf( req::head, () -> new ByteArrayInputStream(baos.toByteArray()) ); }

Target:
private static Request consume(final Request req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); new RqPrint(req).printBody(baos); return new RequestOf( req::head, () -> new ByteArrayInputStream(baos.toByteArray()) ); }
Source:
public @Nullable Object resolve(ITmfEvent event) { ITmfEventField field; if (fFieldArray.length == 1) { field = event.getContent().getField(fFieldArray[0]); } else { field = event.getContent().getSubField(fFieldArray); } if (field == null) { return null; } return field.getValue(); }

Target:
public @Nullable Object resolve(ITmfEvent event) { ITmfEventField field = event.getContent().getField(fFieldArray); if (field == null) { return null; } return field.getValue(); }
Source:
private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean wasError = false; try { Parser.parse(getText()); } catch (ParseException e) { wasError = true; } return ValidationResult.fromErrorIf(this, "Parse error", wasError); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if(key == null || key.isEmpty() || isModifierKeyPress){ return; } char typed = e.getCharacter().charAt(0); if (typed == ')') { if (getCharAfterCaret().equals(")")) { e.consume(); positionCaret(getCaretPosition()+1); } } else if (typed == '(') { e.consume(); insertMatchingBracket(); } else if (typed == '\t') { e.consume(); if (getSelectedText().isEmpty()) { movePastRemainingBrackets(); } else { confirmCompletion(); } } else if (typed == '\b') { } else if (Character.isAlphabetic(typed)) { performCompletion(e); } else if (typed == ' ' && getText().isEmpty()){ e.consume(); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { revertEdit(); getParent().requestFocus(); } }); }

Target:
private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean wasError = false; try { Parser.parse(getText()); } catch (ParseException e) { wasError = true; } return ValidationResult.fromErrorIf(this, "Parse error", wasError); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if(key == null || key.isEmpty() || isModifierKeyPress){ return; } char typed = e.getCharacter().charAt(0); if (typed == ')') { if (getCharAfterCaret().equals(")")) { e.consume(); positionCaret(getCaretPosition()+1); } } else if (typed == '(') { e.consume(); insertMatchingBracket(); } else if (typed == '\t') { e.consume(); if (getSelectedText().isEmpty()) { movePastRemainingBrackets(); } else { confirmCompletion(); } } else if (typed == '\b') { } else if (Character.isAlphabetic(typed)) { performCompletion(e); } else if (typed == ' ' && (getText().isEmpty() || getText().endsWith(" "))){ e.consume(); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { revertEdit(); getParent().requestFocus(); } }); }
Source:
public Integer getPort() { if (server==null) return null; try { NetworkConnector networkConnector = (NetworkConnector) server.getConnectors()[0]; return networkConnector.getLocalPort(); } catch (ClassCastException ex) { return null; } }

Target:
public Integer getPort() { if (server==null) return null; NetworkConnector networkConnector = (NetworkConnector) server.getConnectors()[0]; return networkConnector.getLocalPort(); }
Source:
public static String encode(final String s) { return Base64.getEncoder().encodeToString(s.getBytes(Charset.defaultCharset())); }

Target:
public static String encode(final String s) { return Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8)); }
Source:
public void process() { sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); scenePrePost = frameBuffersManager.getFBO("scenePrePost"); if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/downsamplesceneandupdateexposure"); downsampleSceneInto1x1pixelsBuffer(); frameBuffersManager.getCurrentReadbackPBO().copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); frameBuffersManager.swapReadbackPBOs(); ByteBuffer pixels = frameBuffersManager.getCurrentReadbackPBO().readBackPixels(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; float targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } float maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } postProcessor.setExposure(TeraMath.lerp(postProcessor.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { postProcessor.setExposure(hdrMaxExposureNight); } else { postProcessor.setExposure(hdrExposureDefault); } } }

Target:
public void process() { if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/updateExposure"); downSampleSceneInto1x1pixelsBuffer(); frameBuffersManager.getCurrentReadbackPBO().copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); frameBuffersManager.swapReadbackPBOs(); pixels = frameBuffersManager.getCurrentReadbackPBO().readBackPixels(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } postProcessor.setExposure(TeraMath.lerp(postProcessor.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { postProcessor.setExposure(hdrMaxExposureNight); } else { postProcessor.setExposure(hdrExposureDefault); } } }
Source:
private Stick setupStick(Dictionary<String, ?> config) { String port = (String) config.get("stick.port"); if (port == null) { return null; } Stick stick = new Stick(port, this); logger.info("Plugwise added Stick connected to serial port {}", port); String interval = (String) config.get("stick.interval"); if (interval != null) { stick.setInterval(Integer.valueOf(interval)); logger.info("Setting the interval to send ZigBee PDUs to ms", interval); } String retries = (String) config.get("stick.retries"); if (retries != null) { stick.setRetries(Integer.valueOf(retries)); logger.info("Setting the maximum number of attempts to send a message to ", retries); } return stick; }

Target:
private Stick setupStick(Dictionary<String, ?> config) { String port = (String) config.get("stick.port"); if (port == null) { return null; } Stick stick = new Stick(port, this); logger.debug("Plugwise added Stick connected to serial port {}", port); String interval = (String) config.get("stick.interval"); if (interval != null) { stick.setInterval(Integer.valueOf(interval)); logger.debug("Setting the interval to send ZigBee PDUs to ms", interval); } String retries = (String) config.get("stick.retries"); if (retries != null) { stick.setRetries(Integer.valueOf(retries)); logger.debug("Setting the maximum number of attempts to send a message to ", retries); } return stick; }
Source:
public static @NonNull String getIpv4NetAddress(@NonNull String ipAddressString, short netMask) { String subnetMaskString = networkPrefixLengthToNetmask(netMask); String[] netMaskOctets = subnetMaskString.split("\\."); String[] ipv4AddressOctets = ipAddressString.split("\\."); String netAddress = ""; for (int i = 0; i < 4; i++) { netAddress += Integer.parseInt(ipv4AddressOctets[i]) & Integer.parseInt(netMaskOctets[i]); if (i < 3) { netAddress += "."; } } return netAddress; }

Target:
public static @NonNull String getIpv4NetAddress(@NonNull String ipAddressString, short netMask) { String errorString = "IP '" + ipAddressString + "' not a valid IPv4 address or netmask '" + netMask + "' out of bounds (1-31)"; if (!isValidIPConfig(ipAddressString) || netMask < 1 || netMask > 31) { throw new IllegalArgumentException(errorString); } String subnetMaskString = networkPrefixLengthToNetmask(netMask); String[] netMaskOctets = subnetMaskString.split("\\."); String[] ipv4AddressOctets = ipAddressString.split("\\."); String netAddress = ""; try { for (int i = 0; i < 4; i++) { netAddress += Integer.parseInt(ipv4AddressOctets[i]) & Integer.parseInt(netMaskOctets[i]); if (i < 3) { netAddress += "."; } } } catch (NumberFormatException e) { throw new IllegalArgumentException(errorString); } return netAddress; }
Source:
public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(statusImageHtml); sb.appendHtmlConstant("<div id=\"" + id + "\" style=\"text-align: center;\">"); sb.appendHtmlConstant("</div>"); }

Target:
public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(statusImageHtml); templates.hostAdditionalStatusIcon(id, statusImageHtml); }
Source:
public void init() throws MessagingException { plainTextFooter = getInitParameter("text", String.class); }

Target:
public void init() throws MessagingException { plainTextFooter = getInitParameter("text"); }
Source:
public @Nonnull List<RangeItem> _getUsages() { List<RangeItem> r = new ArrayList<>(); final Jenkins instance = Jenkins.get(); for (Entry<String, RangeSet> e : usages.entrySet()) { final String itemName = e.getKey(); if (instance.hasPermission(Jenkins.CONFIGURE) || canDiscoverItem(itemName)) { r.add(new RangeItem(itemName, e.getValue())); } } return r; }

Target:
public @Nonnull List<RangeItem> _getUsages() { List<RangeItem> r = new ArrayList<>(); final Jenkins instance = Jenkins.get(); for (Entry<String, RangeSet> e : usages.entrySet()) { final String itemName = e.getKey(); if (instance.hasPermission(Jenkins.ADMINISTER) || canDiscoverItem(itemName)) { r.add(new RangeItem(itemName, e.getValue())); } } return r; }
Source:
void onExecute(CommandSender sender, String[] args) { advancedAchievements.reloadConfig(); try { mainConfig.loadConfiguration(); langConfig.loadConfiguration(); guiConfig.loadConfiguration(); pluginLoader.get().loadAdvancedAchievements(false); achievementCache.load(); System.out.println("Reloaded CacheManager"); } catch (PluginLoadError | IOException | InvalidConfigurationException e) { if (sender instanceof Player) { sender.sendMessage(langConfigReloadFailed); } logger.log(Level.SEVERE, "A non recoverable error was encountered while reloading the plugin, disabling it:", e); Bukkit.getPluginManager().disablePlugin(advancedAchievements); return; } if (sender instanceof Player) { sender.sendMessage(langConfigSuccessfullyReloaded); } logger.info("Configuration successfully reloaded."); }

Target:
void onExecute(CommandSender sender, String[] args) { advancedAchievements.reloadConfig(); try { mainConfig.loadConfiguration(); langConfig.loadConfiguration(); guiConfig.loadConfiguration(); pluginLoader.get().loadAdvancedAchievements(false); System.out.println("Reloaded CacheManager"); } catch (PluginLoadError | IOException | InvalidConfigurationException e) { if (sender instanceof Player) { sender.sendMessage(langConfigReloadFailed); } logger.log(Level.SEVERE, "A non recoverable error was encountered while reloading the plugin, disabling it:", e); Bukkit.getPluginManager().disablePlugin(advancedAchievements); return; } if (sender instanceof Player) { sender.sendMessage(langConfigSuccessfullyReloaded); } logger.info("Configuration successfully reloaded."); }
Source:
public boolean canExecute(@NonNull ITmfTrace trace) { return StreamSupport.stream(trace.getEventAspects().spliterator(), false) .anyMatch(aspect -> aspect instanceof ITmfCounterAspect); }

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { return Iterables.any(trace.getEventAspects(), aspect -> aspect instanceof ITmfCounterAspect); }
Source:
public @Nonnull List<String> getLog(int maxLines) throws IOException { final List<String> lastLines = new ArrayList<>(maxLines); if(maxLines == 0) { return lastLines; } int lines = 0; final List<Byte> bytes = new ArrayList<>(); try (RandomAccessFile fileHandler = new RandomAccessFile(getLogFile(), "r")) { long fileLength = fileHandler.length() - 1; for (long filePointer = fileLength; filePointer != -1 && maxLines != lines; filePointer--) { fileHandler.seek(filePointer); byte readByte = fileHandler.readByte(); if (readByte == 0x0A) { if (filePointer < fileLength) { lines = lines + 1; lastLines.add(convertBytesToString(bytes)); bytes.clear(); } } else if (readByte != 0xD) { bytes.add(readByte); } } } if (lines != maxLines) { lastLines.add(convertBytesToString(bytes)); } Collections.reverse(lastLines); if (lines == maxLines) { lastLines.set(0, "[...truncated lines...]"); } return ConsoleNote.removeNotes(lastLines); }

Target:
public @Nonnull List<String> getLog(int maxLines) throws IOException { if (maxLines == 0) { return Collections.emptyList(); } int lines = 0; long filePointer; final List<String> lastLines = new ArrayList<>(Math.min(maxLines, 128)); final List<Byte> bytes = new ArrayList<>(); try (RandomAccessFile fileHandler = new RandomAccessFile(getLogFile(), "r")) { long fileLength = fileHandler.length() - 1; for (filePointer = fileLength; filePointer != -1 && maxLines != lines; filePointer--) { fileHandler.seek(filePointer); byte readByte = fileHandler.readByte(); if (readByte == 0x0A) { if (filePointer < fileLength) { lines = lines + 1; lastLines.add(convertBytesToString(bytes)); bytes.clear(); } } else if (readByte != 0xD) { bytes.add(readByte); } } } if (lines != maxLines) { lastLines.add(convertBytesToString(bytes)); } Collections.reverse(lastLines); if (lines == maxLines) { lastLines.set(0, "[...truncated " + Functions.humanReadableByteSize(filePointer)+ "...]"); } return ConsoleNote.removeNotes(lastLines); }
Source:
public void testMnemonicCode() throws Exception { final List<String> mnemonicCode = mc.toMnemonic(HEX.decode(entropy)); final byte[] seed = MnemonicCode.toSeed(mnemonicCode, passphrase); final byte[] entropy = mc.toEntropy(split(this.mnemonicCode)); assertEquals(this.entropy, HEX.encode(entropy)); assertEquals(this.mnemonicCode, Utils.SPACE_JOINER.join(mnemonicCode)); assertEquals(this.seed, HEX.encode(seed)); }

Target:
public void testMnemonicCode() throws Exception { final List<String> mnemonicCode = mc.toMnemonic(HEX.decode(vectorEntropy)); final byte[] seed = MnemonicCode.toSeed(mnemonicCode, vectorPassphrase); final byte[] entropy = mc.toEntropy(split(vectorMnemonicCode)); assertEquals(vectorEntropy, HEX.encode(entropy)); assertEquals(vectorMnemonicCode, SPACE_JOINER.join(mnemonicCode)); assertEquals(vectorSeed, HEX.encode(seed)); }
Source:
String buildClientResponse() { final String sbOauth2 = N_A + emailId + COMMA + ImapClientConstants.SOH + "host=" + hostname + ImapClientConstants.SOH + "port=" + port + ImapClientConstants.SOH + AUTH_BEARER + token + ImapClientConstants.SOH + ImapClientConstants.SOH; return Base64.encodeBase64String(sbOauth2.getBytes(StandardCharsets.US_ASCII)); }

Target:
String buildClientResponse() { final int len = N_A.length() + emailId.length() + hostname.length() + token.length() + EXTRA_LEN; final StringBuilder sbOauth2 = new StringBuilder(len).append(N_A).append(emailId).append(COMMA).append(ImapClientConstants.SOH); sbOauth2.append("host=").append(hostname).append(ImapClientConstants.SOH).append("port=").append(port).append(ImapClientConstants.SOH); sbOauth2.append(AUTH_BEARER).append(token).append(ImapClientConstants.SOH).append(ImapClientConstants.SOH); return Base64.encodeBase64String(sbOauth2.toString().getBytes(StandardCharsets.US_ASCII)); }
Source:
public ResponseEntity<String> startRun(@RequestBody GeoJsonDiseaseOccurrenceFeatureCollection occurrenceData) { if (occurrenceData == null) { return new ResponseEntity<String>("Must be provided", HttpStatus.BAD_REQUEST); } try { RunConfiguration runConfiguration = runConfigurationFactory.createDefaultConfiguration(); modelRunner.runModel(runConfiguration, occurrenceData); } catch (Exception e) { return new ResponseEntity<String>("Could not start model run.", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<String> startRun(@RequestBody GeoJsonDiseaseOccurrenceFeatureCollection occurrenceData) { if (occurrenceData == null) { return new ResponseEntity<String>("Occurrence data must be provided", HttpStatus.BAD_REQUEST); } try { RunConfiguration runConfiguration = runConfigurationFactory.createDefaultConfiguration(); modelRunner.runModel(runConfiguration, occurrenceData); } catch (Exception e) { return new ResponseEntity<String>("Could not start model run.", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(HttpStatus.NO_CONTENT); }
Source:
public ModelAndView updateAttributes(HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestBody Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager.getUserInstance(request).getPreferencesManager().getUserLayoutManager(); if (!ulm.getNode(targetId).isAddChildAllowed()) { response.setStatus(403); return null; } IUserLayoutNodeDescription node = ulm.getNode(targetId); setObjectAttributes(node, request, attributes); final Locale locale = RequestContextUtils.getLocale(request); try { ulm.saveUserLayout(); } catch (Exception e) { log.warn("Error saving layout", e); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.persisting.attribute.change", "Unable to save attribute changes", locale))); } Map<String, String> model = Collections.singletonMap("success", getMessage("success.element.update", "Updated element attributes", locale)); return new ModelAndView("jsonView", model); }

Target:
public ModelAndView updateAttributes(HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestBody Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager.getUserInstance(request).getPreferencesManager().getUserLayoutManager(); if (!ulm.getNode(targetId).isEditAllowed()) { response.setStatus(403); return null; } IUserLayoutNodeDescription node = ulm.getNode(targetId); if (node == null) { log.warn("[updateAttributes()] Unable to locate node with id: " + targetId); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.element.update", "Unable to find layout element", RequestContextUtils.getLocale(request)))); } else { setObjectAttributes(node, request, attributes); final Locale locale = RequestContextUtils.getLocale(request); try { ulm.saveUserLayout(); } catch (Exception e) { log.warn("Error saving layout", e); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.persisting.attribute.change", "Unable to save attribute changes", locale))); } Map<String, String> model = Collections.singletonMap("success", getMessage("success.element.update", "Updated element attributes", locale)); return new ModelAndView("jsonView", model); } }
Source:
private RequestDescriptor createAmazonRequestDescriptor() { final RequestDescriptor requestDescriptor = new RequestDescriptor(); requestDescriptor.setName(AMAZON_NAME_BEFORE); requestDescriptor.setClassification(Classification.amazons3); requestDescriptor.setDescription(AMAZON_DESCRIPTOR); return requestDescriptor; }

Target:
private static RequestDescriptor createAmazonRequestDescriptor() { final RequestDescriptor requestDescriptor = new RequestDescriptor(); requestDescriptor.setName(AMAZON_NAME_BEFORE); requestDescriptor.setClassification(Classification.amazons3); requestDescriptor.setDescription(AMAZON_DESCRIPTOR); return requestDescriptor; }
Source:
public void providesDefaultHeader() throws IOException { final String expected = String.format("%s: %s", DEF_HEADER, DEF_HEADER_VAL); MatcherAssert.assertThat( new RqPrint( new RqWithDefaultHeader( new RqFake(), DEF_HEADER, DEF_HEADER_VAL ) ).print(), Matchers.startsWith( Joiner.on("\r\n").join( "GET /", "Host: www.example.com", expected ) ) ); }

Target:
public void providesDefaultHeader() throws IOException { final String req = "GET /"; MatcherAssert.assertThat( new RqPrint( new RqWithDefaultHeader( new RqFake(Collections.singletonList(req), "body"), "X-Default-Header1", "X-Default-Value1" ) ).print(), Matchers.startsWith( Joiner.on(RqWithDefaultHeaderTest.CRLF).join( req, "X-Default-Header1: X-Default-Value" ) ) ); }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); discussionTopicsSearchView.setQuery(searchQuery, false); discussionTopicsSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if (query == null || query.trim().length() == 0) return false; SoftKeyboardUtil.hide(getActivity()); searchQuery = query; nextPage = 1; controller.reset(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); discussionTopicsSearchView.setQuery(searchQuery, false); discussionTopicsSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if (query == null || query.trim().isEmpty()) return false; SoftKeyboardUtil.hide(getActivity()); searchQuery = query; nextPage = 1; controller.reset(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); }
Source:
public void deleteMedia(final ArrayList<Integer> ids) { final ArrayList<MediaModel> mediaToDelete = new ArrayList<>(); int processedItemCount = 0; for (int currentId : ids) { MediaModel mediaModel = mMediaStore.getMediaWithLocalId(currentId); if (mediaModel == null) { continue; } if (!UploadService.isMediaBeingUploadedForAPost(mediaModel)) { if (UploadService.isPendingOrInProgressMediaUpload(mediaModel)) { MediaStore.CancelMediaPayload payload = new MediaStore.CancelMediaPayload(mSite, mediaModel, false); mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload)); } if (mediaModel.getUploadState() != null && MediaUtils.isLocalFile(mediaModel.getUploadState().toLowerCase())) { mDispatcher.dispatch(MediaActionBuilder.newRemoveMediaAction(mediaModel)); } else { mediaToDelete.add(mediaModel); mediaModel.setUploadState(MediaUploadState.DELETING); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } processedItemCount++; } } if (processedItemCount != ids.size()) { ToastUtils.showToast(this, R.string.cannot_delete_some_multi_media_items, ToastUtils.Duration.LONG); } if (!mediaToDelete.isEmpty()) { startMediaDeleteService(mediaToDelete); } if (mMediaGridFragment != null) { mMediaGridFragment.clearSelection(); } }

Target:
public void deleteMedia(final ArrayList<Integer> ids) { final ArrayList<MediaModel> mediaToDelete = new ArrayList<>(); int processedItemCount = 0; for (int currentId : ids) { MediaModel mediaModel = mMediaStore.getMediaWithLocalId(currentId); if (mediaModel == null) { continue; } if (UploadService.isPendingOrInProgressMediaUpload(mediaModel)) { MediaStore.CancelMediaPayload payload = new MediaStore.CancelMediaPayload(mSite, mediaModel, false); mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload)); PostModel post = UploadService.isMediaBeingUploadedForAPost(mediaModel); if (post != null) { UploadService.markPostAsError(post); } } if (mediaModel.getUploadState() != null && MediaUtils.isLocalFile(mediaModel.getUploadState().toLowerCase())) { mDispatcher.dispatch(MediaActionBuilder.newRemoveMediaAction(mediaModel)); } else { mediaToDelete.add(mediaModel); } processedItemCount++; } if (processedItemCount != ids.size()) { ToastUtils.showToast(this, R.string.cannot_delete_multi_media_items, ToastUtils.Duration.LONG); } if (!mediaToDelete.isEmpty()) { startMediaDeleteService(mediaToDelete); } if (mMediaGridFragment != null) { mMediaGridFragment.clearSelection(); } }
Source:
public void testWritingDocumentsWithDynamicIndex() throws Exception { TableSchema schema = TableSchema.builder() .field("a", DataTypes.BIGINT().notNull()) .field("b", DataTypes.TIMESTAMP().notNull()) .primaryKey("a") .build(); GenericRowData rowData = GenericRowData.of( 1L, TimestampData.fromLocalDateTime(LocalDateTime.parse("2012-12-12T12:12:12"))); String index = "dynamic-index-{b|yyyy-MM-dd}"; String myType = "MyType"; Elasticsearch6DynamicSinkFactory sinkFactory = new Elasticsearch6DynamicSinkFactory(); SinkFunctionProvider sinkRuntimeProvider = (SinkFunctionProvider) sinkFactory.createDynamicTableSink( context() .withSchema(schema) .withOption(ElasticsearchOptions.INDEX_OPTION.key(), index) .withOption(ElasticsearchOptions.DOCUMENT_TYPE_OPTION.key(), myType) .withOption(ElasticsearchOptions.HOSTS_OPTION.key(), "<LINK_0>") .withOption(ElasticsearchOptions.FLUSH_ON_CHECKPOINT_OPTION.key(), "false") .build() ).getSinkRuntimeProvider(new MockContext()); SinkFunction<RowData> sinkFunction = sinkRuntimeProvider.createSinkFunction(); StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment(); rowData.setRowKind(RowKind.UPDATE_AFTER); environment.<RowData>fromElements(rowData).addSink(sinkFunction); environment.execute(); Client client = elasticsearchResource.getClient(); Map<String, Object> response = client.get(new GetRequest("dynamic-index-2012-12-12", myType, "1")).actionGet().getSource(); Map<Object, Object> expectedMap = new HashMap<>(); expectedMap.put("a", 1); expectedMap.put("b", "2012-12-12 12:12:12"); assertThat(response, equalTo(expectedMap)); }

Target:
public void testWritingDocumentsWithDynamicIndex() throws Exception { TableEnvironment tableEnvironment = TableEnvironment.create(EnvironmentSettings.newInstance() .useBlinkPlanner() .inStreamingMode() .build()); String index = "dynamic-index-{b|yyyy-MM-dd}"; String myType = "MyType"; tableEnvironment.executeSql("CREATE TABLE esTable (" + "a BIGINT NOT NULL,\n" + "b TIMESTAMP NOT NULL,\n" + "PRIMARY KEY (a) NOT ENFORCED\n" + ")\n" + "WITH (\n" + String.format("'%s'='%s',\n", "connector", "elasticsearch-6") + String.format("'%s'='%s',\n", ElasticsearchOptions.INDEX_OPTION.key(), index) + String.format("'%s'='%s',\n", ElasticsearchOptions.DOCUMENT_TYPE_OPTION.key(), myType) + String.format("'%s'='%s',\n", ElasticsearchOptions.HOSTS_OPTION.key(), "<LINK_0>") + String.format("'%s'='%s'\n", ElasticsearchOptions.FLUSH_ON_CHECKPOINT_OPTION.key(), "false") + ")"); tableEnvironment.fromValues(row(1L, LocalDateTime.parse("2012-12-12T12:12:12"))) .executeInsert("esTable") .getJobClient() .get() .getJobExecutionResult(this.getClass().getClassLoader()) .get(); Client client = elasticsearchResource.getClient(); Map<String, Object> response = client.get(new GetRequest("dynamic-index-2012-12-12", myType, "1")).actionGet().getSource(); Map<Object, Object> expectedMap = new HashMap<>(); expectedMap.put("a", 1); expectedMap.put("b", "2012-12-12 12:12:12"); assertThat(response, equalTo(expectedMap)); }
Source:
protected void assertOwnershipAndNonOwnership(Object key, boolean allowL1) { for (MultimapCache<String, String> mc : multimapCacheCluster.values()) { Cache cache = ((EmbeddedMultimapCache) mc).getCache(); DataContainer dc = ((EmbeddedMultimapCache) mc).getCache().getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(key); if (isOwner(cache, key)) { assertNotNull(ice); assertTrue(ice instanceof ImmortalCacheEntry); } else { if (allowL1) { assertTrue("ice is null or L1Entry", ice == null || ice.isL1Entry()); } else { eventuallyEquals("Fail on non-owner cache " + addressOf(cache) + ": dc.get(" + key + ")", null, () -> dc.get(key)); } } } }

Target:
protected void assertOwnershipAndNonOwnership(Object key, boolean allowL1) { for (Cache cache : caches) { Wrapper keyWrapper = cache.getAdvancedCache().getKeyWrapper(); Encoder keyEncoder = cache.getAdvancedCache().getKeyEncoder(); Object keyToBeChecked = keyEncoder != null && keyWrapper != null ? EncodingUtils.toStorage(key, keyEncoder, keyWrapper) : key; DataContainer dc = cache.getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(keyToBeChecked); if (isOwner(cache, keyToBeChecked)) { assertNotNull(ice); assertTrue(ice instanceof ImmortalCacheEntry); } else { if (allowL1) { assertTrue("ice is null or L1Entry", ice == null || ice.isL1Entry()); } else { eventuallyEquals("Fail on non-owner cache " + addressOf(cache) + ": dc.get(" + key + ")", null, () -> dc.get(keyToBeChecked)); } } } }
Source:
public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[" + "extSource=<").append(getExtSource() == null ? "\\0" : getExtSource().serializeToString()).append(">" + ", parentGroupName=<").append(getParentGroupName()).append(">" + ", group=<").append(asGroup() == null ? "\\0" : asGroup().serializeToString()).append(">" + ']').toString(); }

Target:
public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()) .append(":[extSource=<") .append(getExtSource() == null ? "\\0" : getExtSource().serializeToString()) .append(">, parentGroupName=<") .append(getParentGroupName()) .append(">, group=<") .append(asGroup() == null ? "\\0" : asGroup().serializeToString()) .append(">]").toString(); }
Source:
public void invokeCommand(String itemName) { GC100ItemBean itemBean = getGC100ItemBean(itemName); String preparedCode = GC100ItemUtility.prepareCode(itemBean); String result = gc100ControlPoint.doAction(gc100.getHostname(), itemBean.getModule(), itemBean.getConnector(), preparedCode); if (!result.contains("complete")) { logger.warn("Failed to execute command over GC100: " + gc100.getHostname() + " with Module: " + itemBean.getModule() + " of Connector: " + itemBean.getConnector() + " to Item: " + itemName); return; } logger.info("Successfully executed command over GC100: " + gc100.getHostname() + " with Module: " + itemBean.getModule() + " of Connector: " + itemBean.getConnector() + " to Item: " + itemName); }

Target:
public void invokeCommand(String itemName) { GC100ItemBean itemBean = getGC100ItemBean(itemName); String preparedCode = gc100ItemUtility.prepareCode(itemBean); GC100IRCommand result = gc100ControlPoint.doAction(gc100.getHostname(), itemBean.getModule(), itemBean.getConnector(), preparedCode); if (GC100IRCommandCode.COMPLETED_SUCCESSFULLY != result.getCommandCode()) { logger.warn( "Failed to execute command over GC100: with Module: of Connector: to Item: {}, the response was {}", gc100.getHostname(), itemBean.getModule(), itemBean.getConnector(), itemName, result); return; } logger.info( "Successfully executed command over GC100: with Module: of Connector: to Item: {}, the response was {}", gc100.getHostname(), itemBean.getModule(), itemBean.getConnector(), itemName, result); }
Source:
public void testFilterParams() { startHumanTaskProcess(10, "john's task", "john"); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("id", 1); parameters.put("priority", 0); QueryFilter queryFilter = new QueryFilter("t.id=:id AND t.priority=:priority", parameters, "t.name", true); List<TaskSummary> taskList = taskService.getTasksAssignedAsPotentialOwner("john", null, null, queryFilter); logger.debug("### Potential owner task list: " + taskList); Assertions.assertThat(taskList).hasSize(1); abortHumanTaskProcess(10); }

Target:
public void testFilterParams() { startHumanTaskProcess(10, "john's task", "john"); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("id", 1L); parameters.put("priority", 0); QueryFilter queryFilter = new QueryFilter("t.id=:id AND t.priority=:priority", parameters, "t.name", true); List<TaskSummary> taskList = taskService.getTasksAssignedAsPotentialOwner("john", null, null, queryFilter); logger.debug("### Potential owner task list: " + taskList); Assertions.assertThat(taskList).hasSize(1); abortHumanTaskProcess(10); }