auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void storeToLocalStorage(HasConsoleModel model) { if (model.isPool()) { return; } ConsoleProtocol selectedProtocol = model.getUserSelectedProtocol(); ConsoleContext context = model.getConsoleContext(); String id = model.getVM().getId().toString(); KeyMaker keyMaker = new KeyMaker(id, context); clientStorage.setLocalItem(keyMaker.make(SELECTED_PROTOCOL), selectedProtocol.toString()); switch (selectedProtocol) { case SPICE: storeSpiceData(model, keyMaker); break; case VNC: storeVncData(model, keyMaker); break; case RDP : storeRdpData(model, keyMaker); break; } }

Target:
public void storeToLocalStorage(HasConsoleModel model) { if (model.isPool()) { return; } ConsoleProtocol selectedProtocol = model.getUserSelectedProtocol(); ConsoleContext context = model.getConsoleContext(); String id = model.getVM().getId().toString(); KeyMaker keyMaker = new KeyMaker(id, context); clientStorage.setLocalItem(keyMaker.make(SELECTED_PROTOCOL), selectedProtocol.toString()); if (selectedProtocol == ConsoleProtocol.SPICE) { storeSpiceData(model, keyMaker); } else if (selectedProtocol == ConsoleProtocol.VNC) { storeVncData(model, keyMaker); } else if (selectedProtocol == ConsoleProtocol.RDP) { storeRdpData(model, keyMaker); } }
Source:
public void execute(Runnable command) { final Runnable runnable = doWrap(command, controlPoint); try { super.execute(doIdentityWrap(runnable)); } catch (RejectedExecutionException e) { controlPoint.requestComplete(); throw e; } }

Target:
public void execute(Runnable command) { final Runnable runnable = doWrap(command, controlPoint); try { super.execute(doIdentityWrap(runnable)); } catch (Exception e) { controlPoint.requestComplete(); throw e; } }
Source:
public void run() { if (!immediateShutdown) { try { LOG.info("Sleeping for 5 seconds before shutting down"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } try { LOG.info("Calling stop for all the services"); stop(); synchronized (shutdownHandlerLock) { shutdownHandlerRunning.set(false); shutdownHandlerLock.notify(); } LOG.info("Exiting DAGAppMaster..GoodBye!"); sysexit(); } catch (Throwable t) { LOG.warn("Graceful stop failed ", t); } }

Target:
public void run() { if (!immediateShutdown) { try { LOG.info("Sleeping for 5 seconds before shutting down"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } try { LOG.info("Calling stop for all the services"); stop(); synchronized (shutdownHandlerRunning) { shutdownHandlerRunning.set(false); shutdownHandlerRunning.notify(); } LOG.info("Exiting DAGAppMaster..GoodBye!"); sysexit(); } catch (Throwable t) { LOG.warn("Graceful stop failed ", t); } }
Source:
public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/main/test/resources/client$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/test/resources/client$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }
Source:
private Frame loadFrame(String chapterSlug, String frameSlug) { String complexSlug = chapterSlug + "-" + frameSlug; Frame frame = mLibrary.getFrame(mSourceTranslation, chapterSlug, frameSlug); return frame; }

Target:
private Frame loadFrame(String chapterSlug, String frameSlug) { Frame frame = mLibrary.getFrame(mSourceTranslation, chapterSlug, frameSlug); return frame; }
Source:
public void compute( final IterableInterval< T > input, final Img< DoubleType > output ) { final int numDimensions = input.numDimensions(); if ( input.numDimensions() != 2 ) { throw new IllegalArgumentException( "Cannot compute Hough circle transform for non-2D images. Got " + numDimensions + "D image." ); } maxRadius = Math.max( minRadius, maxRadius ); minRadius = Math.min( minRadius, maxRadius ); final long nRadiuses = ( maxRadius - minRadius ) / stepRadius + 1; final DoubleType weight = new DoubleType( Double.NaN ); final RandomAccess< R > raWeight = weights.randomAccess( input ); final double sum = ops().stats().sum( input ).getRealDouble(); int progress = 0; final Cursor< T > cursor = input.localizingCursor(); while ( cursor.hasNext() ) { cursor.fwd(); if ( !cursor.get().get() ) continue; raWeight.setPosition( cursor ); weight.set( raWeight.get().getRealDouble() ); for ( int i = 0; i < nRadiuses; i++ ) { final IntervalView< DoubleType > slice = Views.hyperSlice( output, numDimensions, i ); final long r = minRadius + i * stepRadius; MidPointAlgorithm.add( Views.extendZero( slice ), cursor, r, weight ); } statusService.showProgress( ++progress, ( int ) sum ); } }

Target:
public void compute(final IterableInterval<T> input, final Img<DoubleType> output) { final long maxR = Math.max(minRadius, maxRadius); final long minR = Math.min(minRadius, maxRadius); maxRadius = maxR; minRadius = minR; final long nRadiuses = (maxRadius - minRadius) / stepRadius + 1; final DoubleType weight = new DoubleType(Double.NaN); final RandomAccess<R> raWeight = weights.randomAccess(input); final double sum = ops().stats().sum(input).getRealDouble(); int progress = 0; final Cursor<T> cursor = input.localizingCursor(); while (cursor.hasNext()) { cursor.fwd(); if (!cursor.get().get()) continue; raWeight.setPosition(cursor); weight.set(raWeight.get().getRealDouble()); for (int i = 0; i < nRadiuses; i++) { final IntervalView<DoubleType> slice = Views.hyperSlice(output, input .numDimensions(), i); final long r = minRadius + i * stepRadius; MidPointAlgorithm.add(Views.extendZero(slice), cursor, r, weight); } statusService.showProgress(++progress, (int) sum); } }
Source:
public FunctionInvoker(MethodHandle methodHandle) { this.methodHandle = requireNonNull(methodHandle, "Method handle is null"); }

Target:
public FunctionInvoker(MethodHandle methodHandle) { this.methodHandle = requireNonNull(methodHandle, "methodHandle is null"); }
Source:
public void testLoadDataObjectsWithNullWorkspaceProject() { assertTrue(dataObjectsService.loadDataObjects(null).isEmpty()); }

Target:
public void testLoadDataObjectsWithNullWorkspaceProject() { assertThat(dataObjectsService.loadDataObjects(null)).isEmpty(); }
Source:
public void setEnabled(ThingUID thingUID, boolean enabled) { Thing thing = getThing(thingUID); if (enabled) { logger.debug("Thing will be enabled.", thing.getUID().getAsString()); if (storage != null) { storage.remove(thingUID.getAsString()); } setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.NONE)); registerAndInitializeHandler(thing, findThingHandlerFactory(thing.getThingTypeUID())); } else { logger.debug("Thing will be disabled.", thing.getUID().getAsString()); if (storage != null) { storage.put(thingUID.getAsString(), enabled); } setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.DISABLED)); unregisterAndDisposeHandler(findThingHandlerFactory(thing.getThingTypeUID()), thing, thing.getHandler()); } }

Target:
public void setEnabled(ThingUID thingUID, boolean enabled) { Thing thing = getThing(thingUID); if (enabled) { if (storage != null) { storage.remove(thingUID.getAsString()); } if (thing.getStatus().equals(ThingStatus.ONLINE)) { logger.debug("Thing is already in the required state.", thingUID); return; } logger.debug("Thing will be enabled.", thingUID); if (isHandlerRegistered(thing)) { initializeHandler(thing); } else { registerAndInitializeHandler(thing, findThingHandlerFactory(thing.getThingTypeUID())); } } else { if (storage != null) { storage.put(thingUID.getAsString(), enabled); } if (!thing.isEnabled()) { logger.debug("Thing is already in the required state.", thingUID); return; } logger.debug("Thing will be disabled.", thingUID); if (isHandlerRegistered(thing)) { ThingHandlerFactory thingHandlerFactory = findThingHandlerFactory(thing.getThingTypeUID()); unregisterAndDisposeHandler(thingHandlerFactory, thing, thing.getHandler()); } else { setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.DISABLED)); } } }
Source:
private void putLabelType(Map<String, LabelType> types, LabelType type) { LabelType old = types.get(type.getName()); if (old == null || !old.canOverride()) { types.put(type.getName(), type); } }

Target:
private void putLabelType(Map<String, LabelType> types, LabelType type) { LabelType old = types.get(type.getName()); if (old == null || old.canOverride()) { types.put(type.getName(), type); } }
Source:
public void start(Stage primaryStage) throws IOException { Constants.stage = primaryStage; Constants.stage.setTitle("Bulls & Cows"); Constants.stage.setResizable(false); Pane mainPane = new Pane(); mainPane.setPrefSize(Constants.ScreenHeight, Constants.ScreenWidht); InputStream is = Files.newInputStream(Paths.get("resourses/image/Background.png")); Image image = new Image(is); is.close(); ImageView imageView = new ImageView(image); Constants.imageView = imageView; imageView.setFitWidth(Constants.ImageWidth); imageView.setFitHeight(Constants.ImageHeight); GameMenu gameMenu = new GameMenu(); mainPane.getChildren().addAll(imageView, gameMenu); Scene mainScene = new Scene(mainPane); Constants.stage.setScene(mainScene); Constants.stage.show(); }

Target:
public void start(Stage primaryStage) throws IOException { GlobalVariables.stage = primaryStage; GlobalVariables.stage.setTitle("Bulls & Cows"); GlobalVariables.stage.setResizable(false); Pane mainPane = new Pane(); mainPane.setPrefSize(SCREEN_HEIGHT, SCREEN_WIDTH); InputStream is = Files.newInputStream(Paths.get("resourses/image/Background.png")); Image image = new Image(is); is.close(); ImageView imageView = new ImageView(image); GlobalVariables.imageView = imageView; imageView.setFitWidth(IMAGE_WIDTH); imageView.setFitHeight(IMAGE_HEIGHT); GameMenu gameMenu = new GameMenu(); mainPane.getChildren().addAll(imageView, gameMenu); Scene mainScene = new Scene(mainPane); GlobalVariables.stage.setScene(mainScene); GlobalVariables.stage.show(); }
Source:
protected Sheet createSheet() { final BlackboardArtifact artifact = getArtifact(); BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (fromID != TSK_CONTACT) { return super.createSheet(); } Sheet sheet = new Sheet(); List<Tag> tags = getAllTagsFromDatabase(); Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); if (sheetSet == null) { sheetSet = Sheet.createPropertiesSet(); sheet.put(sheetSet); } sheetSet.put(new NodeProperty<>("email", Bundle.ContactNode_Email(), "", getAttributeDisplayString(artifact, TSK_EMAIL))); sheetSet.put(new NodeProperty<>("phone", Bundle.ContactNode_Phone(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER))); sheetSet.put(new NodeProperty<>("mobile", Bundle.ContactNode_Mobile_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_MOBILE))); sheetSet.put(new NodeProperty<>("home", Bundle.ContactNode_Home_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_HOME))); sheetSet.put(new NodeProperty<>("office", Bundle.ContactNode_Office_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_OFFICE))); sheetSet.put(new NodeProperty<>("url", Bundle.ContactNode_URL(), "", getAttributeDisplayString(artifact, TSK_URL))); return sheet; }

Target:
protected Sheet createSheet() { final BlackboardArtifact artifact = getArtifact(); BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (fromID != TSK_CONTACT) { return super.createSheet(); } Sheet sheet = new Sheet(); Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); if (sheetSet == null) { sheetSet = Sheet.createPropertiesSet(); sheet.put(sheetSet); } sheetSet.put(new NodeProperty<>("email", Bundle.ContactNode_Email(), "", getAttributeDisplayString(artifact, TSK_EMAIL))); sheetSet.put(new NodeProperty<>("phone", Bundle.ContactNode_Phone(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER))); sheetSet.put(new NodeProperty<>("mobile", Bundle.ContactNode_Mobile_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_MOBILE))); sheetSet.put(new NodeProperty<>("home", Bundle.ContactNode_Home_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_HOME))); sheetSet.put(new NodeProperty<>("office", Bundle.ContactNode_Office_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_OFFICE))); sheetSet.put(new NodeProperty<>("url", Bundle.ContactNode_URL(), "", getAttributeDisplayString(artifact, TSK_URL))); return sheet; }
Source:
public boolean onTouchEvent(MotionEvent event) { if (this.implementation.getCurrentForm() == null) { return true; } int[] x = null; int[] y = null; int size = event.getPointerCount(); if (size > 1) { x = new int[size]; y = new int[size]; for (int i = 0; i < size; i++) { x[i] = (int) event.getX(i); y[i] = (int) event.getY(i); } } Component componentAt; if (x == null) { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)event.getX(), (int)event.getY()); } else { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)x[0], (int)y[0]); } boolean isPeer = (componentAt != null && componentAt instanceof PeerComponent); boolean consumeEvent = !isPeer || cn1GrabbedPointer; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (x == null) { this.implementation.pointerPressed((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerPressed(x, y); } if (!isPeer) cn1GrabbedPointer = true; break; case MotionEvent.ACTION_UP: if (x == null) { this.implementation.pointerReleased((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerReleased(x, y); } cn1GrabbedPointer = false; break; case MotionEvent.ACTION_CANCEL: cn1GrabbedPointer = false; break; case MotionEvent.ACTION_MOVE: if (x == null) { this.implementation.pointerDragged((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerDragged(x, y); } break; } return consumeEvent; }

Target:
public boolean onTouchEvent(MotionEvent event) { if (this.implementation.getCurrentForm() == null) { return true; } int[] x = null; int[] y = null; int size = event.getPointerCount(); if (size > 1) { x = new int[size]; y = new int[size]; for (int i = 0; i < size; i++) { x[i] = (int) event.getX(i); y[i] = (int) event.getY(i); } } Component componentAt; if (x == null) { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)event.getX(), (int)event.getY()); } else { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)x[0], (int)y[0]); } boolean isPeer = (componentAt instanceof PeerComponent); boolean consumeEvent = !isPeer || cn1GrabbedPointer; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (x == null) { this.implementation.pointerPressed((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerPressed(x, y); } if (!isPeer) cn1GrabbedPointer = true; break; case MotionEvent.ACTION_UP: if (x == null) { this.implementation.pointerReleased((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerReleased(x, y); } cn1GrabbedPointer = false; break; case MotionEvent.ACTION_CANCEL: cn1GrabbedPointer = false; break; case MotionEvent.ACTION_MOVE: if (x == null) { this.implementation.pointerDragged((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerDragged(x, y); } break; } return consumeEvent; }
Source:
public void appendTextToConsole(String text) { appendTextToConsole(text, ConsoleTextType.NORMAL); }

Target:
public void appendTextToConsole(String text) { appendTextToConsole(text, ConsoleTextType.DEFAULT); }
Source:
public Optional<String> getTimedMemberStateJson() { if (tmsFactoryInitialized.compareAndSet(false, true)) { tmsFactory.init(); } if (System.nanoTime() - lastTMSUpdateNanos <= TMS_CACHE_TIMEOUT_NANOS) { return Optional.ofNullable(tmsJson.get()); } synchronized (tmsFactory) { try { TimedMemberState tms = tmsFactory.createTimedMemberState(); JsonObject json = new JsonObject(); json.add("timedMemberState", tms.toJson()); tmsJson.set(json.toString()); lastTMSUpdateNanos = System.nanoTime(); } catch (Throwable e) { if (e instanceof RetryableException) { logger.warning("Failed to create TimedMemberState. Will try again on next request " + "from Management Center."); } else { inspectOutOfMemoryError(e); } } } return Optional.ofNullable(tmsJson.get()); }

Target:
public Optional<String> getTimedMemberStateJson() { if (tmsFactoryInitialized.compareAndSet(false, true)) { tmsFactory.init(); } if (System.nanoTime() - lastTMSUpdateNanos <= TMS_CACHE_TIMEOUT_NANOS) { return Optional.ofNullable(tmsJson.get()); } try { TimedMemberState tms; synchronized (tmsFactory) { tms = tmsFactory.createTimedMemberState(); lastTMSUpdateNanos = System.nanoTime(); } JsonObject json = new JsonObject(); json.add("timedMemberState", tms.toJson()); tmsJson.set(json.toString()); } catch (Throwable e) { if (e instanceof RetryableException) { logger.warning("Failed to create TimedMemberState. Will try again on next request " + "from Management Center."); } else { inspectOutOfMemoryError(e); } } return Optional.ofNullable(tmsJson.get()); }
Source:
public static RepositoryMapping getMapping(@NonNull final IResource resource) { if (isNonWorkspace(resource)) { return null; } IPath location = resource.getLocation(); if (location == null) { return null; } return getMapping(location); }

Target:
public static RepositoryMapping getMapping(@NonNull final IResource resource) { if (isNonWorkspace(resource)) { return null; } if (resource.isLinked(IResource.CHECK_ANCESTORS)) { IPath location = resource.getLocation(); if (location == null) { return null; } return getMapping(location); } return findMapping(resource); }
Source:
public void killQuery(@PathParam("queryId") QueryId queryId, String reason) { requireNonNull(queryId, "queryId is null"); queryManager.failQuery(queryId, new PrestoException(ADMINISTRATIVELY_KILLED, reason)); }

Target:
public Response killQuery(@PathParam("queryId") QueryId queryId, String reason) { requireNonNull(queryId, "queryId is null"); try { QueryInfo queryInfo = queryManager.getQueryInfo(queryId); if (queryInfo.getState().isDone()) { return Response.status(Status.CONFLICT).build(); } queryManager.failQuery(queryId, new PrestoException(ADMINISTRATIVELY_KILLED, reason)); if (queryInfo.getState() == QueryState.FAILED && queryInfo.getErrorCode() == StandardErrorCode.ADMINISTRATIVELY_KILLED.toErrorCode()) { return Response.status(Status.OK).build(); } else { return Response.status(Status.CONFLICT).build(); } } catch (NoSuchElementException e) { return Response.status(Status.CONFLICT).build(); } }
Source:
private void clearClientTrackedAtReconnectComplete() { if (!reconnectComplete.get()) { boolean success = reconnectComplete.compareAndSet(false, true); if (success) { ehcacheStateService.getClientMessageTracker().reconcileTrackedClients(trackedClients); } } }

Target:
private void clearClientTrackedAtReconnectComplete() { if (!reconnectComplete.get()) { if (reconnectComplete.compareAndSet(false, true)) { ehcacheStateService.getClientMessageTracker().reconcileTrackedClients(trackedClients); } } }
Source:
public org.springframework.cloud.client.ServiceInstance getLocalServiceInstance() { ServiceInstance<Object> serviceInstance = serviceDiscovery.getServiceInstance(); return createServiceInstance(serviceInstance.getId(), serviceInstance); }

Target:
public org.springframework.cloud.client.ServiceInstance getLocalServiceInstance() { ServiceInstance<ZookeeperInstance> serviceInstance = serviceDiscovery.getServiceInstance(); return createServiceInstance(serviceInstance.getId(), serviceInstance); }
Source:
public List<ChangeSet> changeSet(Launcher launcher, FilePath workspace, TaskListener listener, String branch, String baseline, PrintStream output, Node node, FilePath repository) throws IOException, InterruptedException { FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ArgumentListBuilder logCmd = findHgExe(node, listener, false); logCmd.add("log", "--style", tmpFile.getRemote()); logCmd.add("--rev", branch); logCmd.add("--no-merges"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ForkOutputStream fos = new ForkOutputStream(baos, output); logCmd.add("--prune", baseline); joinWithPossibleTimeout( launch(launcher).cmds(logCmd).stdout(fos).pwd(repository), true, listener); return parsePollingLogOutput(baos); } finally { tmpFile.delete(); } }

Target:
public List<ChangeSet> changeSet(Launcher launcher, FilePath workspace, TaskListener listener, String branch, String baseline, PrintStream output, Node node, FilePath repository) throws IOException, InterruptedException { FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ArgumentListBuilder logCmd = findHgExe(node, listener, false); logCmd.add("log", "--style", tmpFile.getRemote()); logCmd.add("--branch", branch); logCmd.add("--no-merges"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ForkOutputStream fos = new ForkOutputStream(baos, output); logCmd.add("--prune", baseline); joinWithPossibleTimeout( launch(launcher).cmds(logCmd).stdout(fos).pwd(repository), true, listener); return parsePollingLogOutput(baos); } finally { tmpFile.delete(); } }
Source:
CircleSelector(final double fraction) { assert (fraction >= 0); assert (fraction <= 1); final double p; if (fraction > 0.5) { p = 1 - fraction; positiveSelection = false; } else { p = fraction; positiveSelection = true; } radiusSquared = p / Math.PI; offset = Math.sqrt(radiusSquared - p * p / 4); }

Target:
CircleSelector(final double fraction) { final double p; if (fraction > 0.5) { p = 1 - fraction; positiveSelection = false; } else { p = fraction; positiveSelection = true; } radiusSquared = p / Math.PI; if (p < 0) { throw new PicardException("This shouldn't happen..."); } offset = Math.sqrt(radiusSquared - p * p / 4); }
Source:
public String _ensureParents(String name) { String s = ""; List<String> path = path(name); if (path.size() < 2) { return name; } for(int i=0; i<path.size() - 1; i++) { String p = path.get(i); if (TextUtils.isEmpty(s)) { s += p; } else { s += "::" + p; } long did = id(s); s = name(did); } name = s + "::" + path.get(path.size() - 1); return name; }

Target:
public String _ensureParents(String name) { String s = ""; String[] path = path(name); if (path.length < 2) { return name; } for(int i = 0; i < path.length - 1; i++) { String p = path[i]; if (TextUtils.isEmpty(s)) { s += p; } else { s += "::" + p; } long did = id(s); s = name(did); } name = s + "::" + path[path.length - 1]; return name; }
Source:
public SqlEnvironmentConfig setPath(String path) { if (path == null) { this.path = Optional.empty(); } else { this.path = Optional.of(path); } return this; }

Target:
public SqlEnvironmentConfig setPath(String path) { this.path = Optional.ofNullable(path); return this; }
Source:
public void scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len == PADDING_MASK) { if (journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { throw new IOException("Invalid record found with negative length : " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } lastLogMark.setCurLogMark(journalId, recLog.fc.position()); } finally { recLog.close(); } }

Target:
public void scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len == PADDING_MASK) { if (journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { throw new IOException("Invalid record found with negative length : " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } } finally { recLog.close(); } }
Source:
public void testConversionToOnOffType() { assertEquals(OnOffType.ON, new QuantityType<>("1").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0").as(OnOffType.class)); }

Target:
public void testConversionToOnOffType() { assertEquals(OnOffType.ON, new QuantityType<>("1").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0").as(OnOffType.class)); assertEquals(OnOffType.ON, new QuantityType<>("1 %").as(OnOffType.class)); assertEquals(OnOffType.ON, new QuantityType<>("100 %").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0 %").as(OnOffType.class)); }
Source:
public DemoApplication(@Context ServletContext servletContext) throws Exception { gondola = initializeGondola(); DemoService demoService = new DemoService(gondola); register(new AbstractBinder() { @Override protected void configure() { bind(demoService).to(DemoService.class); } }); RoutingFilter routingFilter = new RoutingFilter(gondola, new DemoRoutingHelper(gondola, demoService), new ProxyClientProvider()); register(routingFilter); packages(true, "com.yahoo.gondola.demo"); instance = this; Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { Thread.sleep(2000); Runtime.getRuntime().halt(0); } catch (InterruptedException e) { } } }); }

Target:
public DemoApplication(@Context ServletContext servletContext) throws Exception { gondola = initializeGondola(); DemoService demoService = new DemoService(gondola); register(new AbstractBinder() { @Override protected void configure() { bind(demoService).to(DemoService.class); } }); RoutingFilter routingFilter = new RoutingFilter(gondola, new DemoRoutingHelper(gondola, demoService), new ProxyClientProvider(), new CommandListenerProvider() ); register(routingFilter); packages(true, "com.yahoo.gondola.demo"); instance = this; Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { Thread.sleep(2000); Runtime.getRuntime().halt(0); } catch (InterruptedException e) { } } }); }
Source:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { if (blobProperties == null || channel == null) { throw new IllegalArgumentException("blobProperties or channel must not be null"); } currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }

Target:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { if (blobProperties == null || channel == null) { throw new IllegalArgumentException("blobProperties or channel must not be null"); } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
public void verifyEmbededMap(String mapID){ waitForElementByElement(embededMap); String embededMapID = embededMap.getAttribute("data-map-id"); System.out.println(embededMapID); Assert.assertEquals(mapID,embededMapID); PageObjectLogging.log("verifyEmbededMap", "Map was embeded properly", true, driver); }

Target:
public void verifyEmbededMap(String mapID){ driver.switchTo().defaultContent(); waitForElementByElement(embededMap); String embededMapID = embededMap.getAttribute("data-map-id"); Assertion.assertEquals(mapID, embededMapID); }
Source:
public void noPropertiesComponent() { showMessage("This component has no properties."); }

Target:
public void noPropertiesComponent() { showMessage(i18n.noPropertiesComponent()); }
Source:
public VanishManager(final VanishPlugin plugin) { this.plugin = plugin; this.announceManipulator = new VanishAnnounceManipulator(this.plugin); this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, this.showPlayer, 4, 4); Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "vanishStatus", new PluginMessageListener() { public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (channel.equals("vanishStatus") && new String(message).equals("check")) { player.sendPluginMessage(plugin, "vanishStatus", isVanished(player) ? "vanishActive".getBytes() : "vanishInactive".getBytes()); } } }); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "vanishStatus"); }

Target:
public VanishManager(final VanishPlugin plugin) { this.plugin = plugin; this.announceManipulator = new VanishAnnounceManipulator(this.plugin); this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, this.showPlayer, 4, 4); this.plugin.getServer().getMessenger().registerIncomingPluginChannel(this.plugin, "vanishStatus", new PluginMessageListener() { public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (channel.equals("vanishStatus") && new String(message).equals("check")) { player.sendPluginMessage(plugin, "vanishStatus", isVanished(player) ? new byte[] {0x01} : new byte[] {0x00} ); } } }); this.plugin.getServer().getMessenger().registerOutgoingPluginChannel(this.plugin, "vanishStatus"); }
Source:
private boolean canMaintenanceGlusterHosts(Guid clusterID, Iterable<Guid> hostIdsFromParams, List<VDS> hostList) { List<GlusterVolumeEntity> volumesInCluster = DbFacade.getInstance().getGlusterVolumeDao().getByClusterId(clusterID); boolean serverQuorumEnabled = false; double quorumRatioRequired = 0.5; for (GlusterVolumeEntity volume : volumesInCluster) { List<GlusterVolumeOptionEntity> volumeOptions = DbFacade.getInstance().getGlusterOptionDao().getOptionsOfVolume(volume.getId()); for (GlusterVolumeOptionEntity option : volumeOptions) { if (option.getKey().equalsIgnoreCase("cluster.server-quorum-type") && option.getValue().equals("server")) { serverQuorumEnabled = true; break; } } } if (serverQuorumEnabled) { Set<Guid> upHostIDsInCluster = new HashSet<>(); for (VDS vds : hostList) { if (vds.getStatus() == VDSStatus.Up) { upHostIDsInCluster.add(vds.getId()); } } int numOfUpHostsInCluster = upHostIDsInCluster.size(); int numOfUpHostsToBeMovedToMaintanence = 0; for (Guid vdsID : hostIdsFromParams) { if (upHostIDsInCluster.contains(vdsID)) { numOfUpHostsToBeMovedToMaintanence++; } } float newQuorumRatio = (numOfUpHostsInCluster - numOfUpHostsToBeMovedToMaintanence) / (float) hostList.size(); return newQuorumRatio >= quorumRatioRequired; } return true; }

Target:
private boolean canMaintenanceGlusterHosts(Guid clusterID, Iterable<Guid> hostIdsFromParams, List<VDS> hostList) { List<GlusterVolumeEntity> volumesInCluster = getDbFacade().getGlusterVolumeDao().getByClusterId(clusterID); boolean serverQuorumEnabled = false; double quorumRatioRequired = 0.5; for (GlusterVolumeEntity volume : volumesInCluster) { serverQuorumEnabled = isGlusterServerQuorumEnabled(volume); if(serverQuorumEnabled){ break; } } if (serverQuorumEnabled) { Set<Guid> upHostIDsInCluster = new HashSet<>(); for (VDS vds : hostList) { if (vds.getStatus() == VDSStatus.Up) { upHostIDsInCluster.add(vds.getId()); } } int numOfUpHostsInCluster = upHostIDsInCluster.size(); int numOfUpHostsToBeMovedToMaintanence = 0; for (Guid vdsID : hostIdsFromParams) { if (upHostIDsInCluster.contains(vdsID)) { numOfUpHostsToBeMovedToMaintanence++; } } float newQuorumRatio = (numOfUpHostsInCluster - numOfUpHostsToBeMovedToMaintanence) / (float) hostList.size(); return newQuorumRatio >= quorumRatioRequired; } return true; }
Source:
private String getTopicName(Datastream datastream) { return String.format("%s.%s", datastream.getName(), System.currentTimeMillis()); }

Target:
private String getTopicName(Datastream datastream) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss"); String currentTime = formatter.format(LocalDateTime.now()); return String.format("%s_%s", datastream.getName(), currentTime); }
Source:
public void drawColumnNames(GameContainer container) { typeFontPlayer.drawString(container.getWidth() / 5 * 2, container.getHeight() / 4, "SCORE", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 3, container.getHeight() / 4, "MONEY", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 4, container.getHeight() / 4, "NAME", Color.yellow); }

Target:
private void drawColumnNames(GameContainer container) { typeFontPlayer.drawString(container.getWidth() / 5 * 2, container.getHeight() / 4, "SCORE", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 3, container.getHeight() / 4, "MONEY", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 4, container.getHeight() / 4, "NAME", Color.yellow); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((requestCode == REQUEST_SHOW_COLLABORATORS) && (resultCode == RESULT_OK)) { InviteCollaboratorsFragment fragment = (InviteCollaboratorsFragment) getSupportFragmentManager().findFragmentByTag(InviteCollaboratorsFragment.TAG); fragment.refreshUi(); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_SHOW_COLLABORATORS && resultCode == RESULT_OK) { InviteCollaboratorsFragment fragment = (InviteCollaboratorsFragment) getSupportFragmentManager().findFragmentByTag(InviteCollaboratorsFragment.TAG); fragment.refreshUi(); } }
Source:
public void reset() { uriTextMap.keySet().forEach(uri -> getOrCreateSpecificationBuilder().forgetURI(uri)); uriTextMap.clear(); diagnosticsMap.clear(); impactCache.clear(); }

Target:
public void reset() { uriTextMap.keySet().forEach(uri -> getOrCreateSpecificationBuilder().forgetURI(uri)); uriTextMap.clear(); diagnosticsMap.clear(); dependencyCache.clear(); }
Source:
public Iterator<List<Object>> getDataRows() { return tableDefinitionDescriptor.getDataFile() .map(dataFile -> sqlResultDescriptorFor(dataFile).getRows().iterator()) .orElse(ImmutableList.<List<Object>>of().iterator()); }

Target:
public Iterator<List<Object>> getDataRows() { return tableDefinitionDescriptor.getDataFile() .map(dataFile -> sqlResultDescriptorFor(dataFile).getRows().iterator()) .orElse(emptyIterator()); }
Source:
public boolean disjoint(OGCGeometry another) { if (isEmpty() || another.isEmpty()) return true; if (this == another) return false; OGCConcreteGeometryCollection flattened1 = flatten(); if (flattened1.isEmpty()) return true; OGCConcreteGeometryCollection otherCol = new OGCConcreteGeometryCollection(another, esriSR); OGCConcreteGeometryCollection flattened2 = otherCol.flatten(); if (flattened2.isEmpty()) return true; for (int i = 0, n1 = flattened1.numGeometries(); i < n1; ++i) { OGCGeometry g1 = flattened1.geometryN(i); for (int j = 0, n2 = flattened2.numGeometries(); j < n2; ++j) { OGCGeometry g2 = flattened2.geometryN(i); if (!g1.disjoint(g2)) return false; } } return true; }

Target:
public boolean disjoint(OGCGeometry another) { if (isEmpty() || another.isEmpty()) return true; if (this == another) return false; OGCConcreteGeometryCollection flattened1 = flatten(); if (flattened1.isEmpty()) return true; OGCConcreteGeometryCollection otherCol = new OGCConcreteGeometryCollection(another, esriSR); OGCConcreteGeometryCollection flattened2 = otherCol.flatten(); if (flattened2.isEmpty()) return true; for (int i = 0, n1 = flattened1.numGeometries(); i < n1; ++i) { OGCGeometry g1 = flattened1.geometryN(i); for (int j = 0, n2 = flattened2.numGeometries(); j < n2; ++j) { OGCGeometry g2 = flattened2.geometryN(j); if (!g1.disjoint(g2)) return false; } } return true; }
Source:
private void emitModifiers(Set<Modifier> modifiers) throws IOException { if (!(modifiers instanceof EnumSet)) { if(modifiers.isEmpty()) modifiers = EnumSet.noneOf(Modifier.class); else modifiers = EnumSet.copyOf(modifiers); } for (Modifier modifier : modifiers) { out.append(modifier.toString()).append(' '); } }

Target:
private void emitModifiers(Set<Modifier> modifiers) throws IOException { if (!modifiers.isEmpty()) { modifiers = EnumSet.copyOf(modifiers); } for (Modifier modifier : modifiers) { out.append(modifier.toString()).append(' '); } }
Source:
private Pair<String, String[]> processAndValidateV2Payload(JSONObject obj) throws JSONException, PrivilagePayloadException { Pair<String[], String[]> payload = processV2Payload(obj); if(validateV2PayloadSignature(payload.first[0], payload.first[1], payload.second)) { return new Pair(payload.first[0], payload.second); } else { throw new InvalidPrivilegeSignatureException("Signatures don't match"); } }

Target:
private Pair<String, String[]> processAndValidateV2Payload(JSONObject obj) throws JSONException, PrivilagePayloadException { Pair<String[], String[]> payload = processV2Payload(obj); String username = payload.first[0]; String signature = payload.first[1]; String[] privileges = payload.second; if (validatePayloadSignature(getInputForSignatureValidationV2(privileges, username), signature)) { return new Pair(username, privileges); } else { throw new InvalidPrivilegeSignatureException("Signatures don't match"); } }
Source:
public InsecureCryptoIvRule() { addRuleChainVisit(ASTCompilationUnit.class); }

Target:
public InsecureCryptoIvRule() { addRuleChainVisit(ASTClassOrInterfaceBodyDeclaration.class); }
Source:
public SCMBlockLocationResponse send(RpcController controller, SCMBlockLocationRequest request) throws ServiceException { String traceId = request.getTraceID(); if (LOG.isTraceEnabled()) { LOG.trace("BlockLocationProtocol request is received: <json>{}</json>", request.getCmdType().toString(), request.toString().replaceAll("\n", "\\\\n")); } else if (LOG.isDebugEnabled()) { LOG.debug("BlockLocationProtocol request is received", request.getCmdType().toString()); } protocolMessageMetrics.increment(request.getCmdType()); try (Scope scope = TracingUtil .importAndCreateScope( "ScmBlockLocationProtocol." + request.getCmdType(), request.getTraceID())) { SCMBlockLocationResponse response = processMessage(request, traceId); if (LOG.isTraceEnabled()) { LOG.trace( "BlockLocationProtocol request is processed. Response: " + "<json>{}</json>", request.getCmdType().toString(), request.toString().replaceAll("\n", "\\\\n")); } return response; } }

Target:
public SCMBlockLocationResponse send(RpcController controller, SCMBlockLocationRequest request) throws ServiceException { String traceId = request.getTraceID(); if (LOG.isTraceEnabled()) { LOG.trace("BlockLocationProtocol request is received: <json>{}</json>", request.getCmdType().toString(), request.toString().replaceAll("\n", "\\\\n")); } else if (LOG.isDebugEnabled()) { LOG.debug("BlockLocationProtocol request is received", request.getCmdType().toString()); } protocolMessageMetrics.increment(request.getCmdType()); try (Scope scope = TracingUtil .importAndCreateScope( "ScmBlockLocationProtocol." + request.getCmdType(), request.getTraceID())) { SCMBlockLocationResponse response = processMessage(request, traceId); if (LOG.isTraceEnabled()) { LOG.trace( "BlockLocationProtocol request is processed. Response: " + "<json>{}</json>", request.getCmdType().toString(), response.toString().replaceAll("\n", "\\\\n")); } return response; } }
Source:
public void shouldCheckPage404WithParent() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; ; given(parent.isCustomPage(message, type)).willReturn(true); plugin.init(message, parent); boolean result = plugin.isPage404(message); assertThat(result, is(equalTo(true))); verify(parent).isCustomPage(message, type); }

Target:
public void shouldCheckPage404WithParent() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; given(parent.isCustomPage(message, type)).willReturn(true); plugin.init(message, parent); boolean result = plugin.isPage404(message); assertThat(result, is(equalTo(true))); verify(parent).isCustomPage(message, type); }
Source:
public Long getLastVerifiedSeq(Client client, String useCase) { return execute(dao -> { Optional<Long> lastVerifiedSeq = dao.getLastVerifiedSeq(client, useCase); return lastVerifiedSeq.orElseGet(() -> setInitialProgress(client, useCase)); }); }

Target:
public long getLastVerifiedSeq(Client client, String useCase) { return execute(dao -> { OptionalLong lastVerifiedSeq = dao.getLastVerifiedSeq(client, useCase); return lastVerifiedSeq.orElseGet(() -> setInitialProgress(client, useCase)); }); }
Source:
public Map<String, Object> getMovingAverages() { Map<String, Object> movingAverages = Maps.newHashMap(); Map<String, Object> oneMinute = Maps.newHashMap(); oneMinute.put(PROCESSED, processed.getOneMinuteRate()); oneMinute.put(PROCESSED_WITH_ERROR, processedWithError.getOneMinuteRate()); oneMinute.put(UNPARSEABLE, unparseable.getOneMinuteRate()); oneMinute.put(THROWN_AWAY, thrownAway.getOneMinuteRate()); Map<String, Object> fiveMinute = Maps.newHashMap(); fiveMinute.put(PROCESSED, processed.getFiveMinuteRate()); fiveMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFiveMinuteRate()); fiveMinute.put(UNPARSEABLE, unparseable.getFiveMinuteRate()); fiveMinute.put(THROWN_AWAY, thrownAway.getFiveMinuteRate()); Map<String, Object> fifteenMinute = Maps.newHashMap(); fifteenMinute.put(PROCESSED, processed.getFifteenMinuteRate()); fifteenMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFifteenMinuteRate()); fifteenMinute.put(UNPARSEABLE, unparseable.getFifteenMinuteRate()); fifteenMinute.put(THROWN_AWAY, thrownAway.getFifteenMinuteRate()); movingAverages.put("1m", oneMinute); movingAverages.put("5m", fiveMinute); movingAverages.put("15m", fifteenMinute); return movingAverages; }

Target:
public Map<String, Object> getMovingAverages() { Map<String, Object> movingAverages = Maps.newHashMap(); Map<String, Object> oneMinute = Maps.newHashMap(); oneMinute.put(PROCESSED, processed.getOneMinuteRate()); oneMinute.put(PROCESSED_WITH_ERROR, processedWithError.getOneMinuteRate()); oneMinute.put(UNPARSEABLE, unparseable.getOneMinuteRate()); oneMinute.put(THROWN_AWAY, thrownAway.getOneMinuteRate()); Map<String, Object> fiveMinute = Maps.newHashMap(); fiveMinute.put(PROCESSED, processed.getFiveMinuteRate()); fiveMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFiveMinuteRate()); fiveMinute.put(UNPARSEABLE, unparseable.getFiveMinuteRate()); fiveMinute.put(THROWN_AWAY, thrownAway.getFiveMinuteRate()); Map<String, Object> fifteenMinute = Maps.newHashMap(); fifteenMinute.put(PROCESSED, processed.getFifteenMinuteRate()); fifteenMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFifteenMinuteRate()); fifteenMinute.put(UNPARSEABLE, unparseable.getFifteenMinuteRate()); fifteenMinute.put(THROWN_AWAY, thrownAway.getFifteenMinuteRate()); movingAverages.put(ONE_MINUTE_NAME, oneMinute); movingAverages.put(FIVE_MINUTE_NAME, fiveMinute); movingAverages.put(FIFTEEN_MINUTE_NAME, fifteenMinute); return movingAverages; }
Source:
private ServiceConfiguration buildServerPropertiesServiceConfiguration(Config config) { ServiceConfiguration serverProperties = new ServiceConfiguration(); serverProperties.setName(CONFIG_SERVER_PROPERTIES); Map<String, String> confMap = new HashMap<>(); if (config.contains(PARAM_ZOOKEEPER_CONNECT)) { String zookeeperConnect = config.getString(PARAM_ZOOKEEPER_CONNECT); confMap.put(PARAM_ZOOKEEPER_CONNECT, zookeeperConnect); } if (config.contains(PARAM_SECURITY_INTER_BROKER_PROTOCOL)) { String securityInterBrokerProtocol = config.getString(PARAM_SECURITY_INTER_BROKER_PROTOCOL); confMap.put(PARAM_SECURITY_INTER_BROKER_PROTOCOL, securityInterBrokerProtocol); } try { String json = objectMapper.writeValueAsString(confMap); serverProperties.setConfiguration(json); } catch (JsonProcessingException e) { throw new RuntimeException(e); } return serverProperties; }

Target:
private ServiceConfiguration buildServerPropertiesServiceConfiguration(Config config) { ServiceConfiguration serverProperties = new ServiceConfiguration(); serverProperties.setName(CONFIG_SERVER_PROPERTIES); Map<String, String> confMap = new HashMap<>(); if (config.contains(PARAM_ZOOKEEPER_CONNECT)) { confMap.put(PARAM_ZOOKEEPER_CONNECT, config.getString(PARAM_ZOOKEEPER_CONNECT)); } if (config.contains(PARAM_SECURITY_INTER_BROKER_PROTOCOL)) { confMap.put(PARAM_SECURITY_INTER_BROKER_PROTOCOL, config.getString(PARAM_SECURITY_INTER_BROKER_PROTOCOL)); } try { String json = objectMapper.writeValueAsString(confMap); serverProperties.setConfiguration(json); } catch (JsonProcessingException e) { throw new RuntimeException(e); } return serverProperties; }
Source:
public RX16Packet(XBee16BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { super(XBeeAPIType.RX_16); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }

Target:
public RX16Packet(XBee16BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { super(APIFrameType.RX_16); if (sourceAddress == null) throw new NullPointerException("Source address cannot be null."); if (rssi < 0 || rssi > 100) throw new IllegalArgumentException("RSSI value must be between 0 and 100."); if (receiveOptions < 0 || receiveOptions > 255) throw new IllegalArgumentException("Receive options value must be between 0 and 255."); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }
Source:
public Iterator<T> iterator() { ensureOrder(); return super.iterator(); }

Target:
public Iterator<T> iterator() { sort(); return super.iterator(); }