auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateServiceSync() throws Exception { testingPostgres.runUpdateStatement("update enduser set isadmin = 't' where username = 'DockstoreTestUser2';"); CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("DockstoreTestUser2", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should only have one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); service = client.refresh(service.getId()); assertNotNull(service); assertEquals("Should have two new versions master and 1.0", 2, service.getWorkflowVersions().size()); client.updateWorkflowDefaultVersion(service.getId(), "1.0"); }

Target:
public void updateServiceSync() throws Exception { testingPostgres.runUpdateStatement("update enduser set isadmin = 't' where username = 'DockstoreTestUser2';"); CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("DockstoreTestUser2", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should only have one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); service = client.refresh(service.getId()); assertNotNull(service); assertTrue("Should have at least the versions master and 1.0", service.getWorkflowVersions().size() >= 2); assertTrue("Should have a master version.", service.getWorkflowVersions().stream().anyMatch((WorkflowVersion version) -> Objects.equals(version.getName(), "master"))); assertTrue("Should have a 1.0 version.", service.getWorkflowVersions().stream().anyMatch((WorkflowVersion version) -> Objects.equals(version.getName(), "1.0"))); client.updateWorkflowDefaultVersion(service.getId(), "1.0"); }
Source:
private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; fMouseMoveListener = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = (PieChart) event.widget; switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; fMouseClickListener = new MouseListener() { @Override public void mouseUp(MouseEvent e) { } @Override public void mouseDown(MouseEvent e) { PieChart pc = (PieChart)e.widget; int slicenb = pc.getSliceIndexFromPosition(0, e.x, e.y); if (slicenb < 0) { return; } Event selectionEvent = new Event(); selectionEvent.text = pc.getSeriesSet().getSeries()[slicenb].getId(); notifyEventTypeSelectionListener(selectionEvent); } @Override public void mouseDoubleClick(MouseEvent e) { } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }

Target:
private void initContent() { setLayout(new FillLayout()); fGlobalPC = null; fTimeRangePC = null; fMouseMoveListener = new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { PieChart pc = (PieChart) event.widget; switch (event.type) { case SWT.MouseMove: int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y); if (sliceIndex < 0) { pc.setToolTipText(null); break; } float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex); String percent = String.format("%.1f", percOfSlice); Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]); String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = " + nbEvents.toString() + " (" + percent + "%)"; pc.setToolTipText(text); return; default: } } }; fMouseClickListener = new MouseListener() { @Override public void mouseUp(MouseEvent e) { } @Override public void mouseDown(MouseEvent e) { PieChart pc = (PieChart) e.widget; int slicenb = pc.getSliceIndexFromPosition(0, e.x, e.y); if (slicenb < 0 || slicenb >= pc.getSeriesSet().getSeries().length) { return; } Event selectionEvent = new Event(); selectionEvent.text = pc.getSeriesSet().getSeries()[slicenb].getId(); notifyEventTypeSelectionListener(selectionEvent); } @Override public void mouseDoubleClick(MouseEvent e) { } }; setCurrentState(new PieChartViewerStateNoContentSelected(this)); }
Source:
public List<TrackInfo> getTracks() { return isConnected() ? getImpl().getTracks() : null; }

Target:
public List<TrackInfo> getTracks() { return isConnected() ? getImpl().getTracks() : new ArrayList<>(); }
Source:
public void testExecuteAndPostProcess() { ______TS("success: delete entire account"); InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructor1OfCourse1.googleId, "account", "true" }; final String adminUserId = "admin.user"; gaeSimulation.loginAsAdmin(adminUserId); AdminAccountDeleteAction deleteAction = getAction(submissionParams); RedirectResult result = getRedirectResult(deleteAction); assertNull(AccountsLogic.inst().getAccount(instructor1OfCourse1.googleId)); assertEquals(Const.StatusMessages.INSTRUCTOR_ACCOUNT_DELETED, result.getStatusMessage()); assertEquals(getPageResultDestination("/admin/adminAccountManagementPage", false, "admin.user"), result.getDestinationWithParams()); }

Target:
public void testExecuteAndPostProcess() { ______TS("success: delete entire account"); InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructor1OfCourse1.googleId, "account", "true" }; final String adminUserId = "admin.user"; gaeSimulation.loginAsAdmin(adminUserId); AdminAccountDeleteAction deleteAction = getAction(submissionParams); RedirectResult result = getRedirectResult(deleteAction); assertNull(AccountsLogic.inst().getAccount(instructor1OfCourse1.googleId)); assertEquals(Const.StatusMessages.INSTRUCTOR_ACCOUNT_DELETED, result.getStatusMessage()); assertEquals( getPageResultDestination(Const.ActionURIs.ADMIN_ACCOUNT_MANAGEMENT_PAGE, false, adminUserId), result.getDestinationWithParams()); }
Source:
public synchronized void handleMessageLayoutPrepare( @NonNull CorfuPayloadMsg<LayoutPrepareRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (!isBootstrapped(msg, ctx, r)) { return; } if (!isSameEpoch(msg.getPayload().getEpoch(), msg, ctx, r)) { return; } final Rank messageRank = new Rank(msg.getPayload().getRank(), msg.getClientID()); final Rank highestProposedRank = getProposeRank(); final Layout acceptedLayout = getAcceptedLayout(); final Rank highestAcceptedRank = Optional.ofNullable(getAcceptedRank()) .orElseGet(() -> new Rank(-1L, msg.getClientID())); if (highestProposedRank == null || messageRank.greaterThan(highestProposedRank)) { setProposeRank(messageRank); log.debug("Phase I: New proposedRank = {}", getProposeRank()); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_ACK.payloadMsg(new LayoutPrepareResponse(highestAcceptedRank.getRank(), acceptedLayout))); } else { log.debug("Phase I: Rejected prepare: messageRank = {}, proposedRank = {}", messageRank, highestProposedRank); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_REJECT.payloadMsg(new LayoutPrepareResponse(highestProposedRank.getRank(), acceptedLayout))); } }

Target:
public synchronized void handleMessageLayoutPrepare( @NonNull CorfuPayloadMsg<LayoutPrepareRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (!isBootstrapped(msg, ctx, r)) { return; } final long payloadEpoch = msg.getPayload().getEpoch(); final Rank payloadRank = new Rank(msg.getPayload().getRank(), msg.getClientID()); final Rank highestProposedRank = getProposedRank(payloadEpoch); final Layout acceptedLayout = getAcceptedLayout(payloadEpoch); final Rank highestAcceptedRank = Optional.ofNullable(getAcceptedRank(payloadEpoch)) .orElse(new Rank(UNINITIALIZED_RANK, msg.getClientID())); if (!isSameEpoch(payloadEpoch, msg, ctx, r)) { return; } if (highestProposedRank == null || payloadRank.greaterThan(highestProposedRank)) { setProposeRank(payloadRank, payloadEpoch); log.debug("Phase I: New proposedRank = {}", getProposedRank(payloadEpoch)); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_ACK.payloadMsg(new LayoutPrepareResponse(highestAcceptedRank.getRank(), acceptedLayout))); } else { log.debug("Phase I: Rejected prepare: payloadRank = {}, proposedRank = {}", payloadRank, highestProposedRank); r.sendResponse(ctx, msg, CorfuMsgType.LAYOUT_PREPARE_REJECT.payloadMsg(new LayoutPrepareResponse(highestProposedRank.getRank(), acceptedLayout))); } }
Source:
public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError, int generation) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _generation = generation; _producerId = PRODUCER_ID_SEED.getAndIncrement(); _logger = LoggerFactory.getLogger(String.format("%s:%s:%d", MODULE, _producerId, _generation)); if (!customCheckpointing) { _checkpointHandler = new CheckpointHandler(config); } else { _logger.info("Disabling periodic flush/checkpoint handler for customCheckpoint."); _checkpointHandler = null; } _availabilityThresholdSlaMs = Integer.parseInt(config.getProperty(AVAILABILITY_THRESHOLD_SLA_MS, DEFAULT_AVAILABILITY_THRESHOLD_SLA_MS)); _logger.info( String.format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); }

Target:
public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError, int generation) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _generation = generation; _producerId = PRODUCER_ID_SEED.getAndIncrement(); _logger = LoggerFactory.getLogger(String.format("%s:%s:%d", MODULE, _producerId, _generation)); if (!customCheckpointing) { _checkpointHandler = Optional.of(new CheckpointHandler(config)); } else { _logger.info("Disabling periodic flush/checkpoint handler for customCheckpoint."); _checkpointHandler = Optional.empty(); } _availabilityThresholdSlaMs = Integer.parseInt(config.getProperty(AVAILABILITY_THRESHOLD_SLA_MS, DEFAULT_AVAILABILITY_THRESHOLD_SLA_MS)); _logger.info( String.format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); }
Source:
public ExecutorService getProcessingExecutorService(DruidProcessingConfig config) { if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { log.error("numThreads[%d] configured, that is ingnored on Router", config.getNumThreadsConfigured()); } return Execs.dummy(); }

Target:
public ExecutorService getProcessingExecutorService(DruidProcessingConfig config) { if (config.getNumThreadsConfigured() != ExecutorServiceConfig.DEFAULT_NUM_THREADS) { log.error("numThreads[%d] configured, that is ignored on Router", config.getNumThreadsConfigured()); } return Execs.dummy(); }
Source:
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readonly) throw new IOException("Buffer is read only."); if (readLength > 0) clearReadBuffer(); long lastPosition = position(); int bytesWrite; long remaining = count; try { if (position != lastPosition) seek(position); if (writeWrap == null) writeWrap = ByteBuffer.wrap(writeBuffer); while (remaining > 0) { writeWrap.limit((int) Math.min((long) (writeBuffer.length), writeOffset + remaining)).position(writeOffset); while (writeWrap.hasRemaining()) { bytesWrite = src.read(writeWrap); if (bytesWrite == -1) break; writeOffset += bytesWrite; remaining -= bytesWrite; if (writeOffset == writeBuffer.length) flushForced(); else writePending = true; } } } finally { seek(lastPosition); } return count - remaining; }

Target:
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readonly) throw new IOException("Buffer is read only."); if (readLength > 0) clearReadBuffer(); long lastPosition = position(); int bytesWrite; long remaining = count; try { if (position != lastPosition) seek(position); if (writeWrap == null) writeWrap = ByteBuffer.wrap(writeBuffer); while (remaining > 0) { writeWrap.limit((int) Math.min((long) (writeBuffer.length), writeOffset + remaining)).position(writeOffset); while (writeWrap.hasRemaining()) { bytesWrite = src.read(writeWrap); if (bytesWrite == -1) break; writeOffset += bytesWrite; remaining -= bytesWrite; if (writeOffset == writeBuffer.length) flushOptimized(); else writePending = true; } } } finally { seek(lastPosition); } return count - remaining; }
Source:
private static void showPopup(final String title, final String message, final Logger log) { final JPanel pan = new JPanel(new BorderLayout(0, 5)) {{ setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); }}; final String wrapper = "<html><style type=\"text/css\">body { font:12pt dialog,sans-serif; }</style><body>%s</body></html>"; final JEditorPane ed = new JEditorPane("text/html", String.format(wrapper, message)) {{ setBackground(pan.getBackground()); setHighlighter(null); setEditable(false); addHyperlinkListener(new Link(log)); }}; final JButton ok = new JButton("Ok"); pan.add(ed, BorderLayout.CENTER); pan.add(new JPanel() {{ add(ok); }}, BorderLayout.SOUTH); final Dimension size = new Dimension(500, 200); final JDialog dialog = new JDialog((Frame)null, title, true) {{ setMinimumSize(size); setPreferredSize(size); setContentPane(pan); ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); }}; dialog.pack(); final Point p = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); dialog.setLocation(new Point(p.x - dialog.getWidth() / 2, p.y - dialog.getHeight() / 2)); dialog.setVisible(true); }

Target:
private static void showPopup(final String title, final String message, final Logger log) { final String wrapper = "<html><style type=\"text/css\">body { font:12pt dialog,sans-serif; }</style><body>%s</body></html>"; final JEditorPane ed = new JEditorPane("text/html", String.format(wrapper, message)) {{ setBackground(UIManager.getDefaults().getColor("Panel.background")); setHighlighter(null); setEditable(false); addHyperlinkListener(new Link(log)); }}; final JScrollPane sp = new JScrollPane(ed) {{ setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); setPreferredSize(new Dimension(500, 100)); }}; JOptionPane.showMessageDialog(null, sp, title, JOptionPane.ERROR_MESSAGE); }
Source:
private ConjunctionNode(List<QueryTree> children) { this.children.addAll(children); this.children.sort(Comparator.comparingDouble(QueryTree::weight).reversed()); }

Target:
private ConjunctionNode(List<QueryTree> children) { this.children.addAll(children); this.children.sort(COMPARATOR); }
Source:
public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCounterAspect other = (AbstractCounterAspect) obj; return Objects.equals(fFieldName, other.fFieldName); }

Target:
public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCounterAspect other = (AbstractCounterAspect) obj; return Objects.equals(fFieldName, other.fFieldName) && Objects.equals(fLabel, other.fLabel); }
Source:
private void writeValue(Type type, FieldSchema pigType, Tuple t, int i) { try { if (type.isPrimitive()) { switch (type.asPrimitiveType().getPrimitiveTypeName()) { case BINARY: byte[] bytes; if (pigType.type == DataType.BYTEARRAY) { bytes = ((DataByteArray)t.get(i)).get(); } else if (pigType.type == DataType.CHARARRAY) { bytes = ((String)t.get(i)).getBytes("UTF-8"); } else { throw new UnsupportedOperationException("can not convert from " + DataType.findTypeName(pigType.type) + " to BINARY "); } recordConsumer.addBinary(Binary.fromConstantByteArray(bytes)); break; case BOOLEAN: recordConsumer.addBoolean((Boolean)t.get(i)); break; case INT32: recordConsumer.addInteger(((Number)t.get(i)).intValue()); break; case INT64: recordConsumer.addLong(((Number)t.get(i)).longValue()); break; case DOUBLE: recordConsumer.addDouble(((Number)t.get(i)).doubleValue()); break; case FLOAT: recordConsumer.addFloat(((Number)t.get(i)).floatValue()); break; default: throw new UnsupportedOperationException(type.asPrimitiveType().getPrimitiveTypeName().name()); } } else { assert pigType.type == DataType.TUPLE; recordConsumer.startGroup(); writeTuple(type.asGroupType(), pigType.schema, (Tuple)t.get(i)); recordConsumer.endGroup(); } } catch (Exception e) { throw new ParquetEncodingException("can not write value at " + i + " in tuple " + t + " from type '" + pigType + "' to type '" + type +"'", e); } }

Target:
private void writeValue(Type type, FieldSchema pigType, Tuple t, int i) { try { if (type.isPrimitive()) { switch (type.asPrimitiveType().getPrimitiveTypeName()) { case BINARY: byte[] bytes; if (pigType.type == DataType.BYTEARRAY) { bytes = ((DataByteArray)t.get(i)).get(); } else if (pigType.type == DataType.CHARARRAY) { bytes = ((String)t.get(i)).getBytes("UTF-8"); } else { throw new UnsupportedOperationException("can not convert from " + DataType.findTypeName(pigType.type) + " to BINARY "); } recordConsumer.addBinary(Binary.fromReusedByteArray(bytes)); break; case BOOLEAN: recordConsumer.addBoolean((Boolean)t.get(i)); break; case INT32: recordConsumer.addInteger(((Number)t.get(i)).intValue()); break; case INT64: recordConsumer.addLong(((Number)t.get(i)).longValue()); break; case DOUBLE: recordConsumer.addDouble(((Number)t.get(i)).doubleValue()); break; case FLOAT: recordConsumer.addFloat(((Number)t.get(i)).floatValue()); break; default: throw new UnsupportedOperationException(type.asPrimitiveType().getPrimitiveTypeName().name()); } } else { assert pigType.type == DataType.TUPLE; recordConsumer.startGroup(); writeTuple(type.asGroupType(), pigType.schema, (Tuple)t.get(i)); recordConsumer.endGroup(); } } catch (Exception e) { throw new ParquetEncodingException("can not write value at " + i + " in tuple " + t + " from type '" + pigType + "' to type '" + type +"'", e); } }
Source:
public int getWidth() { return width; }

Target:
public final int getWidth() { return width; }
Source:
public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); if (extensions == null) { extensions = ServiceLoader.load(AutoValueExtension.class, getClass().getClassLoader()); } errorReporter = new ErrorReporter(processingEnv); }

Target:
public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); errorReporter = new ErrorReporter(processingEnv); }
Source:
public void setVisible(final boolean visible) { if (visible) { final AbstractCustomParserInputWizardPage inputPage = getWizard().getInputPage(); setDefinition(inputPage.getDefinition()); final List<String> outputNames = inputPage.getInputNames(); final Iterator<Output> iter = getOutputs().iterator(); while (iter.hasNext()) { final Output output = iter.next(); boolean found = false; for (final String name : outputNames) { if (output.name.equals(name)) { found = true; break; } } if (!found) { output.dispose(); iter.remove(); } } for (final String name : outputNames) { boolean found = false; for (final Output output : getOutputs()) { if (output.name.equals(name)) { found = true; break; } } if (!found) { getOutputs().add(new Output(getOutputsContainer(), name)); } } getOutputsContainer().layout(); getOutputsScrolledComposite().setMinSize(getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).x, getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 5); updatePreviewTable(); if (getSash().getSize().y > getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y + getPreviewTable().getTable().getItemHeight()) { getSash().setWeights(new int[] { getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y, getSash().getSize().y - getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y }); } else { getSash().setWeights(new int[] { getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y, getPreviewTable().getTable().getItemHeight() }); } setPageComplete(true); } else { setPageComplete(false); } super.setVisible(visible); }

Target:
public void setVisible(final boolean visible) { if (visible) { setDefinition(getDefinition()); final List<String> outputNames = getOutputNames(); final Iterator<Output> iter = getOutputs().iterator(); while (iter.hasNext()) { final Output output = iter.next(); boolean found = false; for (final String name : outputNames) { if (output.name.equals(name)) { found = true; break; } } if (!found) { output.dispose(); iter.remove(); } } for (final String name : outputNames) { boolean found = false; for (final Output output : getOutputs()) { if (output.name.equals(name)) { found = true; break; } } if (!found) { getOutputs().add(new Output(getOutputsContainer(), name)); } } getOutputsContainer().layout(); getOutputsScrolledComposite().setMinSize(getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).x, getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 5); updatePreviewTable(); if (getSash().getSize().y > getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y + getPreviewTable().getTable().getItemHeight()) { getSash().setWeights(new int[] { getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y, getSash().getSize().y - getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y }); } else { getSash().setWeights(new int[] { getOutputsContainer().computeSize(SWT.DEFAULT, SWT.DEFAULT).y, getPreviewTable().getTable().getItemHeight() }); } setPageComplete(true); } else { setPageComplete(false); } super.setVisible(visible); }
Source:
public StringBuffer generate(final I input) throws GeneratorException { final StringBuffer shapeRaw = super.generate(input); final StyleDefinition styleDefinition = input.getStyleDefinition(); if (null != styleDefinition) { if (null != styleDefinition.getFillColor()) { shapeRaw.append(formatString(FILL_COLOR, styleDefinition.getFillColor())); } if (null != styleDefinition.getFillAlpha()) { shapeRaw.append(formatDouble(FILL_ALPHA, styleDefinition.getFillAlpha())); } if (null != styleDefinition.getStrokeColor()) { shapeRaw.append(formatString(STROKE_COLOR, styleDefinition.getStrokeColor())); } if (null != styleDefinition.getStrokeAlpha()) { shapeRaw.append(formatDouble(STROKE_ALPHA, styleDefinition.getStrokeAlpha())); } if (null != styleDefinition.getStrokeWidth()) { shapeRaw.append(formatDouble(STROKE_WIDTH, styleDefinition.getStrokeWidth())); } if (null != styleDefinition.getStrokeDashArray()) { int i = 0; String dashArrayCmd = ""; while (i < styleDefinition.getStrokeDashArray().length) { if ((i > 0) && (i < styleDefinition.getStrokeDashArray().length)) { dashArrayCmd = dashArrayCmd + ", "; } dashArrayCmd = dashArrayCmd + formatDouble(styleDefinition.getStrokeDashArray()[i]); i++; } shapeRaw.append(formatString(STROKE_DASHARRAY, dashArrayCmd)); } return shapeRaw; } return new StringBuffer(); }

Target:
public StringBuffer generate(final I input) throws GeneratorException { final StringBuffer shapeRaw = super.generate(input); final StyleDefinition styleDefinition = input.getStyleDefinition(); if (null != styleDefinition) { if (null != styleDefinition.getFillColor()) { shapeRaw.append(formatString(FILL_COLOR, styleDefinition.getFillColor())); } if (null != styleDefinition.getFillAlpha()) { shapeRaw.append(formatDouble(FILL_ALPHA, styleDefinition.getFillAlpha())); } if (null != styleDefinition.getStrokeColor()) { shapeRaw.append(formatString(STROKE_COLOR, styleDefinition.getStrokeColor())); } if (null != styleDefinition.getStrokeAlpha()) { shapeRaw.append(formatDouble(STROKE_ALPHA, styleDefinition.getStrokeAlpha())); } if (null != styleDefinition.getStrokeWidth()) { shapeRaw.append(formatDouble(STROKE_WIDTH, styleDefinition.getStrokeWidth())); } if (null != styleDefinition.getStrokeDashArray()) { String commaSeparatedValues = Stream.of(styleDefinition.getStrokeDashArray()).map(AbstractGenerator::formatDouble).collect(Collectors.joining(",")); shapeRaw.append(formatString(STROKE_DASHARRAY, commaSeparatedValues)); } return shapeRaw; } return new StringBuffer(); }
Source:
public void missedEventThrows() { setupInitialState(); assertThatThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 5L, ImmutableList.of(UNLOCK_EVENT)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasMessageContaining("Events missing between last snapshot and this batch of events"); }

Target:
public void missedEventThrows() { setupInitialState(); assertThatLoggableExceptionThrownBy(() -> eventCache.processStartTransactionsUpdate(TIMESTAMPS_2, LockWatchStateUpdate.success(LEADER, 5L, ImmutableList.of(UNLOCK_EVENT)))) .isExactlyInstanceOf(SafeIllegalArgumentException.class) .hasLogMessage("Events missing between last snapshot and this batch of events"); }
Source:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant, tenantDomain, tenantId); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); } catch (Exception e) { if (e instanceof TenantManagementClientException) { throw (TenantManagementClientException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }

Target:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }
Source:
public void stop(BundleContext context) throws Exception { if (cluster != null) { cluster.close(); Thread.sleep(10000); } }

Target:
public void stop(BundleContext context) throws Exception { if (cluster != null) { cluster.close(); Thread.sleep(1000); } }
Source:
public Object call() throws Exception { Preconditions.checkNotNull(getMachine(), "machine"); ConfigBag config = ConfigBag.newInstance(); if (stdout!=null) config.put(SshTool.PROP_OUT_STREAM, stdout); if (stderr!=null) config.put(SshTool.PROP_ERR_STREAM, stderr); if (runAsRoot) config.put(SshTool.PROP_RUN_AS_ROOT, true); if (runAsScript) exitCode = getMachine().execScript(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); else exitCode = getMachine().execCommands(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); if (requireExitCodeZero && exitCode!=0) throw new IllegalStateException("Ssh job ended with exit code "+exitCode+" when 0 was required, in "+Tasks.current()+": "+getSummary()); if (returnType==ScriptReturnType.STDOUT_STRING) return stdout.toString(); if (returnType==ScriptReturnType.STDOUT_BYTES) return stdout.toByteArray(); if (returnType==ScriptReturnType.STDERR_STRING) return stderr.toString(); if (returnType==ScriptReturnType.STDERR_BYTES) return stderr.toByteArray(); if (returnType==ScriptReturnType.EXIT_CODE) return exitCode; throw new IllegalStateException("Unknown return type for ssh job "+getSummary()+": "+returnType); }

Target:
public Object call() throws Exception { Preconditions.checkNotNull(getMachine(), "machine"); ConfigBag config = ConfigBag.newInstance(); if (stdout!=null) config.put(SshTool.PROP_OUT_STREAM, stdout); if (stderr!=null) config.put(SshTool.PROP_ERR_STREAM, stderr); if (runAsRoot) config.put(SshTool.PROP_RUN_AS_ROOT, true); if (runAsScript) exitCode = getMachine().execScript(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); else exitCode = getMachine().execCommands(config.getAllConfigRaw(), getSummary(), commands, shellEnvironment); if (requireExitCodeZero && exitCode!=0) throw new IllegalStateException("Ssh job ended with exit code "+exitCode+" when 0 was required, in "+Tasks.current()+": "+getSummary()); switch (returnType) { case STDOUT_STRING: return stdout.toString(); case STDOUT_BYTES: return stdout.toByteArray(); case STDERR_STRING: return stderr.toString(); case STDERR_BYTES: return stderr.toByteArray(); case EXIT_CODE: return exitCode; } throw new IllegalStateException("Unknown return type for ssh job "+getSummary()+": "+returnType); }
Source:
public List<MongoCredential> buildCredentials() { if ( getUsername() != null ) { switch ( authenticationMechanism ) { case MONGODB_CR: return Arrays.asList( MongoCredential.createMongoCRCredential( getUsername(), getDatabaseName(), password() ) ); case GSSAPI: return Arrays.asList( MongoCredential.createGSSAPICredential( getUsername() ) ); case X509: return Arrays.asList( MongoCredential.createMongoX509Credential( getUsername() ) ); case PLAIN: return Arrays.asList( MongoCredential.createPlainCredential( getUsername(), getDatabaseName(), password() ) ); default: throw log.authenticationMechanismNotRecognized( authenticationMechanism.getAuthenticationType() ); } } return null; }

Target:
public List<MongoCredential> buildCredentials() { if ( getUsername() != null ) { return Arrays.asList( authenticationMechanism.createCredential( getUsername(), getDatabaseName(), getPassword() ) ); } return null; }
Source:
public JsonNode newSession(@Context ContainerRequestContext requestContext, @ApiParam(name = "Login request", value = "Credentials. The default " + "implementation requires presence of two properties: 'username' and " + "'password'. However a plugin may customize which kind of credentials " + "are accepted and therefore expect different properties.", required = true) @NotNull JsonNode createRequest) { final SecurityContext securityContext = requestContext.getSecurityContext(); if (!(securityContext instanceof ShiroSecurityContext)) { throw new InternalServerErrorException("Unsupported SecurityContext class, this is a bug!"); } final ShiroSecurityContext shiroSecurityContext = (ShiroSecurityContext) securityContext; final ActorAwareAuthenticationToken authToken; try { authToken = tokenFactory.forRequestBody(createRequest); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } final String sessionId = shiroSecurityContext.getUsername(); final String host = RestTools.getRemoteAddrFromRequest(grizzlyRequest, trustedSubnets); try { Optional<Session> session = sessionCreator.create(sessionId, host, authToken); if (session.isPresent()) { return sessionResponseFactory.forSession(session.get()); } else { throw new NotAuthorizedException("Invalid credentials.", "Basic realm=\"Graylog Server session\""); } } catch (AuthenticationServiceUnavailableException e) { throw new ServiceUnavailableException(e.getMessage()); } }

Target:
public JsonNode newSession(@Context ContainerRequestContext requestContext, @ApiParam(name = "Login request", value = "Credentials. The default " + "implementation requires presence of two properties: 'username' and " + "'password'. However a plugin may customize which kind of credentials " + "are accepted and therefore expect different properties.", required = true) @NotNull JsonNode createRequest) { final SecurityContext securityContext = requestContext.getSecurityContext(); if (!(securityContext instanceof ShiroSecurityContext)) { throw new InternalServerErrorException("Unsupported SecurityContext class, this is a bug!"); } final ShiroSecurityContext shiroSecurityContext = (ShiroSecurityContext) securityContext; final ActorAwareAuthenticationToken authToken; try { authToken = tokenFactory.forRequestBody(createRequest); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } final String sessionId = shiroSecurityContext.getUsername(); final String host = RestTools.getRemoteAddrFromRequest(grizzlyRequest, trustedSubnets); try { Optional<Session> session = sessionCreator.create(sessionId, host, authToken); if (session.isPresent()) { return sessionResponseFactory.forSession(session.get()); } else { throw new NotAuthorizedException("Invalid credentials.", "Basic realm=\"Graylog Server session\""); } } catch (AuthenticationServiceUnavailableException e) { throw new ServiceUnavailableException("Authentication service unavailable"); } }
Source:
private void reconnectSessions(final RemotingConnection oldConnection, final int reconnectAttempts, final ActiveMQException cause) { HashSet<ClientSessionInternal> sessionsToFailover; synchronized (sessions) { sessionsToFailover = new HashSet<>(sessions); } for (ClientSessionInternal session : sessionsToFailover) { session.preHandleFailover(connection); } getConnectionWithRetry(reconnectAttempts, oldConnection); if (connection == null) { if (!clientProtocolManager.isAlive()) ActiveMQClientLogger.LOGGER.failedToConnectToServer(); return; } List<FailureListener> oldListeners = oldConnection.getFailureListeners(); List<FailureListener> newListeners = new ArrayList<>(connection.getFailureListeners()); for (FailureListener listener : oldListeners) { if (listener instanceof DelegatingFailureListener == false) { newListeners.add(listener); } } connection.setFailureListeners(newListeners); ((CoreRemotingConnection) connection).syncIDGeneratorSequence(((CoreRemotingConnection) oldConnection).getIDGeneratorSequence()); for (ClientSessionInternal session : sessionsToFailover) { if (session.handleFailover(connection, cause)) { connection.destroy(); this.connection = null; return; } } }

Target:
private void reconnectSessions(final RemotingConnection oldConnection, final int reconnectAttempts, final ActiveMQException cause) { HashSet<ClientSessionInternal> sessionsToFailover; synchronized (sessions) { sessionsToFailover = new HashSet<>(sessions); } for (ClientSessionInternal session : sessionsToFailover) { session.preHandleFailover(connection); } getConnectionWithRetry(reconnectAttempts, oldConnection); if (connection == null) { if (!clientProtocolManager.isAlive()) ActiveMQClientLogger.LOGGER.failedToConnectToServer(); return; } List<FailureListener> oldListeners = oldConnection.getFailureListeners(); List<FailureListener> newListeners = new ArrayList<>(connection.getFailureListeners()); for (FailureListener listener : oldListeners) { if (listener instanceof DelegatingFailureListener == false) { newListeners.add(listener); } } connection.setFailureListeners(newListeners); ((CoreRemotingConnection) connection).syncIDGeneratorSequence(((CoreRemotingConnection) oldConnection).getIDGeneratorSequence()); for (ClientSessionInternal session : sessionsToFailover) { if (!session.handleFailover(connection, cause)) { connection.destroy(); this.connection = null; return; } } }
Source:
private PagedFile mapWithCorrectPageSize( PageCache pageCache, File indexFile, PagedFile pagedFile ) throws IOException { if ( pageSize != pageCache.pageSize() ) { if ( pageSize > pageCache.pageSize() ) { throw new MetadataMismatchException( " was created with page size %d, but page cache used to open it this time " + "has a smaller page size %d so cannot be opened", pageSize, pageCache.pageSize() ); } pagedFile.close(); return pageCache.map( indexFile, pageSize ); } return pagedFile; }

Target:
private PagedFile mapWithCorrectPageSize( PageCache pageCache, File indexFile, PagedFile pagedFile ) throws IOException { if ( pageSize != pageCache.pageSize() ) { if ( pageSize > pageCache.pageSize() ) { throw new MetadataMismatchException( "Tried to create tree with page size %d, but page cache used to open it this time " + "has a smaller page size %d so cannot be opened", pageSize, pageCache.pageSize() ); } pagedFile.close(); return pageCache.map( indexFile, pageSize ); } return pagedFile; }
Source:
public DownloadFailedException(Throwable cause) { super(ERROR_CODE, cause); this.cause = cause; }

Target:
public DownloadFailedException(Throwable cause) { super(ERROR_CODE, cause); this.cause = requireNonNull(cause); }
Source:
public void testOverwrite() throws IOException { URI path = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path hadoopPath = ghfsHelper.castAsHadoopPath(path); assertThrows(FileNotFoundException.class, () -> ghfs.getFileStatus(hadoopPath)); String text = "Hello World!"; int numBytesWritten = ghfsHelper.writeFile(hadoopPath, text, 1, false); assertThat(numBytesWritten).isEqualTo(text.getBytes(UTF_8).length); assertThrows( IOException.class, () -> ghfsHelper.writeFile(hadoopPath, text, 1, false)); ghfsHelper.writeFile(hadoopPath, text, 1, true); String readText = ghfsHelper.readTextFile(hadoopPath, 0, text.getBytes().length, true); assertThat(readText).isEqualTo(text); }

Target:
public void testOverwrite() throws IOException { URI path = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path hadoopPath = ghfsHelper.castAsHadoopPath(path); assertThrows(FileNotFoundException.class, () -> ghfs.getFileStatus(hadoopPath)); String text = "Hello World!"; int numBytesWritten = ghfsHelper.writeFile(hadoopPath, text, 1, false); assertThat(numBytesWritten).isEqualTo(text.getBytes(UTF_8).length); assertThrows( IOException.class, () -> ghfsHelper.writeFile(hadoopPath, text, 1, false)); String textToOverwrite = "World Hello!"; ghfsHelper.writeFile(hadoopPath, textToOverwrite, 1, true); String readText = ghfsHelper.readTextFile(hadoopPath); assertThat(readText).isEqualTo(textToOverwrite); }
Source:
private void prepareDescription(Description description) { if (TextUtils.isEmpty(description.getContent()) || description == Description.emptyDescription) { return; } if (description.getType() != Description.HTML) { videoDescriptionView.setAutoLinkMask(Linkify.WEB_URLS); } if (description.getType() == Description.HTML) { disposables.add(Single.just(description.getContent()) .map((@io.reactivex.annotations.NonNull String descriptionText) -> { Spanned parsedDescription; if (Build.VERSION.SDK_INT >= 24) { parsedDescription = Html.fromHtml(descriptionText, 0); } else { parsedDescription = Html.fromHtml(descriptionText); } return parsedDescription; }) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@io.reactivex.annotations.NonNull Spanned spanned) -> { videoDescriptionView.setText(spanned); videoDescriptionView.setVisibility(View.VISIBLE); })); } else if (description.getType() == Description.MARKDOWN) { videoDescriptionView.setText(description.getContent().replace("**", ""), TextView.BufferType.SPANNABLE); videoDescriptionView.setVisibility(View.VISIBLE); } else { videoDescriptionView.setText(description.getContent(), TextView.BufferType.SPANNABLE); videoDescriptionView.setVisibility(View.VISIBLE); } }

Target:
private void prepareDescription(Description description) { if (TextUtils.isEmpty(description.getContent()) || description == Description.emptyDescription) { return; } if (description.getType() == Description.HTML) { disposables.add(Single.just(description.getContent()) .map((@io.reactivex.annotations.NonNull String descriptionText) -> { Spanned parsedDescription; if (Build.VERSION.SDK_INT >= 24) { parsedDescription = Html.fromHtml(descriptionText, 0); } else { parsedDescription = Html.fromHtml(descriptionText); } return parsedDescription; }) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@io.reactivex.annotations.NonNull Spanned spanned) -> { videoDescriptionView.setText(spanned); videoDescriptionView.setVisibility(View.VISIBLE); })); } else if (description.getType() == Description.MARKDOWN) { final Markwon markwon = Markwon.builder(getContext()) .usePlugin(LinkifyPlugin.create()) .build(); markwon.setMarkdown(videoDescriptionView, description.getContent()); videoDescriptionView.setVisibility(View.VISIBLE); } else { videoDescriptionView.setAutoLinkMask(Linkify.WEB_URLS); videoDescriptionView.setText(description.getContent(), TextView.BufferType.SPANNABLE); videoDescriptionView.setVisibility(View.VISIBLE); } }
Source:
public boolean isUserDefined() { if (m_userAggregateId != null) { return FunctionForVoltDB.isUserDefinedFunctionId(Integer.parseInt(m_userAggregateId)); } else { return false; } }

Target:
public boolean isUserDefined() { return FunctionForVoltDB.isUserDefinedFunctionId(m_userAggregateId); }
Source:
public CloseablePart getFilePart(Request req, Transaction t) throws PublishException, BadRequestException { if (req == null) { throw new PublishException("error getting file part from request as request was null"); } if (t == null) { throw new PublishException("error getting file part from request transaction expected but was null"); } HttpServletRequest raw = req.raw(); if (raw == null) { throw new PublishException("error getting file part from request as HttpServletRequest was null", t); } req.attribute(MULTIPART_CONFIG, new MultipartConfigElement(tmpDir.toString(), maxFileSize, maxRequestSize, fileThresholdSize)); info().transactionID(t).log("parsing request body for file item"); Part part = null; try { part = raw.getPart(FILE_PART_NAME); } catch (Exception ex) { throw new BadRequestException(ex, "error attempting to retriving multipart file upload request body", t.id()); } if (part == null) { throw new BadRequestException("expected multipart file upload request body but was null", t.id()); } return new CloseablePart(part, t.id()); }

Target:
public CloseablePart getFilePart(Request req, Transaction t) throws PublishException, BadRequestException { if (req == null) { throw new PublishException("error getting file part from request as request was null"); } if (t == null) { throw new PublishException("error getting file part from request transaction expected but was null"); } HttpServletRequest raw = req.raw(); if (raw == null) { throw new PublishException("error getting file part from request as HttpServletRequest was null", t); } req.attribute(MULTIPART_CONFIG, new MultipartConfigElement(tmpDir.toString(), maxFileSize, maxRequestSize, fileThresholdSize)); info().transactionID(t).log("parsing request body for file item"); Part part = null; try { part = raw.getPart(FILE_PART_NAME); } catch (Exception ex) { throw new BadRequestException(ex, "error attempting to retrieve multipart file upload request body", t.id()); } if (part == null) { throw new BadRequestException("expected multipart file upload request body but was null", t.id()); } return new CloseablePart(part, t.id()); }
Source:
static Spannable getSpannableContentForRanges(FormattableContent formattableContent, TextView textView, final Function1<FormattableRange, Unit> clickHandler, boolean isFooter) { return getSpannableContentForRanges(formattableContent, textView, isFooter, new Function1<NoteBlockClickableSpan, Unit>() { @Override public Unit invoke(NoteBlockClickableSpan noteBlockClickableSpan) { clickHandler.invoke(noteBlockClickableSpan.getFormattableRange()); return null; } }); }

Target:
static Spannable getSpannableContentForRanges(FormattableContent formattableContent, TextView textView, final Function1<FormattableRange, Unit> clickHandler, boolean isFooter) { Function1<NoteBlockClickableSpan, Unit> clickListener = clickHandler != null ? new Function1<NoteBlockClickableSpan, Unit>() { @Override public Unit invoke(NoteBlockClickableSpan noteBlockClickableSpan) { clickHandler.invoke(noteBlockClickableSpan.getFormattableRange()); return null; } } : null; return getSpannableContentForRanges(formattableContent, textView, isFooter, clickListener); }
Source:
protected Collection<String> defaultSuppressionAnnotations() { Collection defaultValues = new ArrayList<String>(); defaultValues.addAll(LOMBOK_ANNOTATIONS); return defaultValues; }

Target:
protected Collection<String> defaultSuppressionAnnotations() { return LOMBOK_ANNOTATIONS; }
Source:
private IdealState trimIdealState(IdealState originalIdealState) { IdealState trimmedIdealState = new IdealState(originalIdealState.getRecord()); ZNRecord idealStateRecord = trimmedIdealState.getRecord(); switch (originalIdealState.getRebalanceMode()) { case FULL_AUTO: idealStateRecord.setListFields(idealStateRecord.getListFields().keySet().stream().collect( Collectors.toMap(partition -> partition, partition -> Collections.emptyList()))); case SEMI_AUTO: idealStateRecord.setMapFields(idealStateRecord.getMapFields().keySet().stream().collect( Collectors.toMap(partition -> partition, partition -> Collections.emptyMap()))); break; default: break; } return trimmedIdealState; }

Target:
private IdealState trimIdealState(IdealState originalIdealState) { IdealState trimmedIdealState = new IdealState(originalIdealState.getRecord()); ZNRecord trimmedIdealStateRecord = trimmedIdealState.getRecord(); switch (originalIdealState.getRebalanceMode()) { case FULL_AUTO: trimmedIdealStateRecord.setListFields(trimmedIdealStateRecord.getListFields().keySet().stream().collect( Collectors.toMap(partition -> partition, partition -> Collections.emptyList()))); case SEMI_AUTO: trimmedIdealStateRecord.setMapFields(trimmedIdealStateRecord.getMapFields().keySet().stream().collect( Collectors.toMap(partition -> partition, partition -> Collections.emptyMap()))); break; default: break; } return trimmedIdealState; }