auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean createChannelIfAbsent(String originator, TaskId taskid, String name, boolean isPersistent) throws IOException { if (inMemoryChannels.containsKey(name) || persistedChannels.containsKey(name)) { return false; } else { createChannel(originator, taskid, name, isPersistent); return true; } }

Target:
public boolean createChannelIfAbsent(String originator, TaskId taskid, String name, boolean isPersistent) throws IOException { if (inMemoryChannels.containsKey(name) || persistedChannels.containsKey(name)) { return false; } else { return createChannel(originator, taskid, name, isPersistent); } }
Source:
public void setTextColor(Integer textColor) { this.mTextColor = textColor; }

Target:
public void setTextColor(Integer textColor) { mTextColor = textColor; }
Source:
protected Function<Trigger, Pipeline> buildTrigger(Pipeline pipeline, TriggerEvent event) { DockerEvent dockerEvent = (DockerEvent) event; DockerEvent.Content content = dockerEvent.getContent(); String name = content.getRegistry() + "/" + content.getRepository(); String reference = name + ":" + content.getTag(); List<Artifact> artifacts = Collections.singletonList(Artifact.builder() .type("docker/image") .name(name) .version(content.getTag()) .location(reference) .reference(reference) .build()); return trigger -> pipeline.withTrigger(trigger.atTag(content.getTag())) .withReceivedArtifacts(artifacts); }

Target:
protected Function<Trigger, Pipeline> buildTrigger(Pipeline pipeline, TriggerEvent event) { DockerEvent dockerEvent = (DockerEvent) event; return trigger -> pipeline.withTrigger(trigger.atTag(dockerEvent.getContent().getTag())) .withReceivedArtifacts(getArtifacts(dockerEvent)); }
Source:
private static ResolvedType objectTypeArgumentToType(SignatureAttribute.ObjectType typeArgument, TypeSolver typeSolver, ResolvedTypeParametrizable typeParametrizable) { if(typeArgument instanceof SignatureAttribute.ArrayType){ String baseTypeName = ((SignatureAttribute.ArrayType) typeArgument).getComponentType().jvmTypeName(); ResolvedType baseType = getGenericParameterByName(baseTypeName, typeParametrizable, typeSolver); return new ResolvedArrayType(baseType); } else { String typeName = typeArgument.jvmTypeName(); return getGenericParameterByName(typeName, typeParametrizable, typeSolver); } }

Target:
private static ResolvedType objectTypeArgumentToType(SignatureAttribute.ObjectType typeArgument, TypeSolver typeSolver, ResolvedTypeParametrizable typeParametrizable) { if(typeArgument instanceof SignatureAttribute.ArrayType){ return signatureTypeToType(((SignatureAttribute.ArrayType) typeArgument).getComponentType(), typeSolver, typeParametrizable); } else { String typeName = typeArgument.jvmTypeName(); return getGenericParameterByName(typeName, typeParametrizable, typeSolver); } }
Source:
private void initMocks() throws JWTClientException, RemoteException { mockEventProcessorAdminServiceStub = Mockito.mock(EventProcessorAdminServiceStub.class); geoLocationProviderServiceImpl = Mockito.mock(GeoLocationProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS); doReturn(mockEventProcessorAdminServiceStub).when(geoLocationProviderServiceImpl).getEventProcessorAdminServiceStub(); doReturn("success").when(mockEventProcessorAdminServiceStub).validateExecutionPlan(Mockito.anyString()); }

Target:
private void initMocks() throws JWTClientException, RemoteException { mockEventProcessorAdminServiceStub = Mockito.mock(EventProcessorAdminServiceStub.class); geoLocationProviderServiceImpl = Mockito.mock(GeoLocationProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS); Mockito.doReturn(mockEventProcessorAdminServiceStub). when(geoLocationProviderServiceImpl).getEventProcessorAdminServiceStub(); Mockito.doReturn("success"). when(mockEventProcessorAdminServiceStub).validateExecutionPlan(Mockito.anyString()); }
Source:
Set<Watcher> triggerWatch(String path, EventType type, Set<Watcher> supress) { WatchedEvent e = new WatchedEvent(type, KeeperState.SyncConnected, path); Set<Watcher> watchers = new HashSet<>(); PathIterator pathIterator = new PathIterator(path); synchronized (this) { while (pathIterator.hasNext()) { String localPath = pathIterator.next(); Map<Watcher, Type> thisWatchers = watchTable.get(localPath); if (thisWatchers == null || thisWatchers.isEmpty()) { continue; } Iterator<Entry<Watcher, Type>> iterator = thisWatchers.entrySet().iterator(); while (iterator.hasNext()) { Entry<Watcher, Type> entry = iterator.next(); Type entryType = entry.getValue(); Watcher watcher = entry.getKey(); if (entryType == Type.PERSISTENT) { watchers.add(watcher); } else if (!pathIterator.atParentPath()) { watchers.add(watcher); iterator.remove(); Set<String> paths = watch2Paths.get(watcher); if (paths != null) { paths.remove(localPath); } } } if (thisWatchers.size() == 0) { watchTable.remove(localPath); } } } if (watchers.size() == 0) { if (LOG.isTraceEnabled()) { ZooTrace.logTraceMessage(LOG, ZooTrace.EVENT_DELIVERY_TRACE_MASK, "No watchers for " + path ); } return null; } for (Watcher w : watchers) { if (supress != null && supress.contains(w)) { continue; } w.process(e); } return watchers; }

Target:
Set<Watcher> triggerWatch(String path, EventType type, Set<Watcher> supress) { WatchedEvent e = new WatchedEvent(type, KeeperState.SyncConnected, path); Set<Watcher> watchers = new HashSet<>(); synchronized (this) { PathParentIterator pathParentIterator = getPathParentIterator(path); for (String localPath : pathParentIterator.asIterable()) { Map<Watcher, Type> thisWatchers = watchTable.get(localPath); if (thisWatchers == null || thisWatchers.isEmpty()) { continue; } Iterator<Entry<Watcher, Type>> iterator = thisWatchers.entrySet().iterator(); while (iterator.hasNext()) { Entry<Watcher, Type> entry = iterator.next(); Type entryType = entry.getValue(); Watcher watcher = entry.getKey(); if (entryType.isRecursive()) { if ( type != EventType.NodeChildrenChanged ) { watchers.add(watcher); } } else if (!pathParentIterator.atParentPath()) { watchers.add(watcher); if (!entryType.isPersistent()) { iterator.remove(); Set<String> paths = watch2Paths.get(watcher); if (paths != null) { paths.remove(localPath); } } } } if (thisWatchers.isEmpty()) { watchTable.remove(localPath); } } } if (watchers.isEmpty()) { if (LOG.isTraceEnabled()) { ZooTrace.logTraceMessage(LOG, ZooTrace.EVENT_DELIVERY_TRACE_MASK, "No watchers for " + path ); } return null; } for (Watcher w : watchers) { if (supress != null && supress.contains(w)) { continue; } w.process(e); } return watchers; }
Source:
public CameraNode(NodeChannel channel, int period) { super(new BuggyBaseNode(channel), period, "Camera_Node"); statePub = new Publisher(channel.getStatePath()); List<Webcam> webcams; try { webcams = Webcam.getWebcams(); } catch (Exception e) { e.printStackTrace(); new RobobuggyLogicNotification("Couldn't load webcams!", RobobuggyMessageLevel.EXCEPTION); statePub.publish(new StateMessage(NodeState.ERROR)); return; } for (Webcam webcam : webcams) { if (webcam.getName().contains("Logitech")) { this.webcam = webcam; this.webcam.setViewSize(WebcamResolution.QVGA.getSize()); this.webcam.open(); break; } } if (this.webcam == null) { new RobobuggyLogicNotification("Couldn't find Logitech webcam!", RobobuggyMessageLevel.EXCEPTION); this.webcam = Webcam.getDefault(); Webcam webcam = Webcam.getDefault(); webcam.setCustomViewSizes(new Dimension[] { WebcamResolution.QVGA.getSize(), WebcamResolution.HD720.getSize() }); webcam.setViewSize(WebcamResolution.QVGA.getSize()); } imagePublisher = new Publisher(channel.getMsgPath()); setupLoggingTrigger(); resume(); }

Target:
public CameraNode(NodeChannel channel, int period) { super(new BuggyBaseNode(channel), period, "Camera_Node"); statePub = new Publisher(channel.getStatePath()); List<Webcam> webcams; try { webcams = Webcam.getWebcams(); } catch (WebcamException e) { e.printStackTrace(); new RobobuggyLogicNotification("Couldn't load webcams!", RobobuggyMessageLevel.EXCEPTION); statePub.publish(new StateMessage(NodeState.ERROR)); return; } for (Webcam webcam : webcams) { if (webcam.getName().contains("Logitech")) { this.webcam = webcam; this.webcam.setViewSize(WebcamResolution.QVGA.getSize()); this.webcam.open(); break; } } if (this.webcam == null) { new RobobuggyLogicNotification("Couldn't find Logitech webcam!", RobobuggyMessageLevel.EXCEPTION); this.webcam = Webcam.getDefault(); Webcam webcam = Webcam.getDefault(); webcam.setCustomViewSizes(new Dimension[] { WebcamResolution.QVGA.getSize(), WebcamResolution.HD720.getSize() }); webcam.setViewSize(WebcamResolution.QVGA.getSize()); } imagePublisher = new Publisher(channel.getMsgPath()); setupLoggingTrigger(); resume(); }
Source:
private String getTokenFromHeader(HttpServletRequest request) { String token = null; String headerValue = request.getHeader(SsoConstants.HEADER_AUTHORIZATION); if (headerValue != null && headerValue.startsWith(BEARER)) { token = headerValue.substring("Bearer".length()).trim(); } return token; }

Target:
private String getTokenFromHeader(HttpServletRequest request) { String token = null; String headerValue = request.getHeader(SsoConstants.HEADER_AUTHORIZATION); if (headerValue != null && headerValue.startsWith(BEARER)) { token = headerValue.substring(BEARER.length()).trim(); } return token; }
Source:
public void run(String[] args) throws IOException { CmdLineParser parser = new CmdLineParser(this); parser.setUsageWidth(80); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(VERSION); System.err.println(e.getMessage()); System.err.println("java Fastq_liftOver [options...] arguments..."); parser.printUsage(System.err); System.err.println(); return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { final File outFile = (outFiles != null && outFiles.size() == 1) ? outFiles.get(0) : null; log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }

Target:
public void run(String[] args) throws IOException { CmdLineParser parser = new CmdLineParser(this); parser.setUsageWidth(80); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(VERSION); System.err.println(e.getMessage()); System.err.println("java Fastq_liftOver [options...] arguments..."); parser.printUsage(System.err); System.err.println(); return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }
Source:
public void deleteWithId() throws Exception { dao.deleteAccount(ACCOUNT_ID_WITH_ID); verify(mockHibernateHelper).deleteById(HibernateAccount.class, ACCOUNT_ID); }

Target:
public void deleteWithId() throws Exception { dao.deleteAccount(ACCOUNT_ID_WITH_ID); verify(mockHibernateHelper).deleteById(HibernateAccount.class, ACCOUNT_ID); verify(mockHibernateHelper, never()).queryGet(any(), any(), any(), any()); }
Source:
public final void doInit() { if (this.selector instanceof AbstractMessageProcessingSelector) { ((AbstractMessageProcessingSelector) this.selector).setConversionService(this.getConversionService()); } if (this.selector instanceof BeanFactoryAware) { ((BeanFactoryAware) this.selector).setBeanFactory(this.getBeanFactory()); } }

Target:
protected void doInit() { if (this.selector instanceof AbstractMessageProcessingSelector) { ((AbstractMessageProcessingSelector) this.selector).setConversionService(this.getConversionService()); } if (this.selector instanceof BeanFactoryAware) { ((BeanFactoryAware) this.selector).setBeanFactory(this.getBeanFactory()); } }
Source:
public void refreshAllElementsVisibility(final DDiagram diagram) { deactivateCache(); activateCache(); Session session = SessionManager.INSTANCE.getSession(((DSemanticDiagram) diagram).getTarget()); DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(session, diagram); NotificationUtil.sendNotification(diagram, Notification.Kind.START, Notification.REFRESH_VISIBILITY_ON_DIAGRAM); DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.IS_VISIBLE_KEY); for (final DDiagramElement diagramElement : diagram.getDiagramElements()) { boolean visibility = computeVisibility(mappingManager, diagram, diagramElement); if (visibility != diagramElement.isVisible()) { diagramElement.setVisible(computeVisibility(mappingManager, diagram, diagramElement)); } } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.IS_VISIBLE_KEY); NotificationUtil.sendNotification(diagram, Notification.Kind.STOP, Notification.REFRESH_VISIBILITY_ON_DIAGRAM); deactivateCache(); }

Target:
public void refreshAllElementsVisibility(final DDiagram diagram) { deactivateCache(); activateCache(); Session session = SessionManager.INSTANCE.getSession(((DSemanticDiagram) diagram).getTarget()); DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(session, diagram); NotificationUtil.sendNotification(diagram, Notification.Kind.START, Notification.REFRESH_VISIBILITY_ON_DIAGRAM); DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.IS_VISIBLE_KEY); for (final DDiagramElement diagramElement : diagram.getDiagramElements()) { boolean visibility = computeVisibility(mappingManager, diagram, diagramElement); if (visibility != diagramElement.isVisible()) { diagramElement.setVisible(visibility); } } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.IS_VISIBLE_KEY); NotificationUtil.sendNotification(diagram, Notification.Kind.STOP, Notification.REFRESH_VISIBILITY_ON_DIAGRAM); deactivateCache(); }
Source:
private <T> T executeToJsonObjectWithRetry(final HttpConnection connection, Class<T> c) throws CouchException { InputStream is = this.executeToInputStreamWithRetry(connection); InputStreamReader isr = new InputStreamReader(is); try { T json = new JSONHelper().fromJson(isr, c); return json; } finally { try { is.close(); } catch (Exception e) { ; } } }

Target:
private <T> T executeToJsonObjectWithRetry(final HttpConnection connection, Class<T> c) throws CouchException { InputStream is = this.executeToInputStreamWithRetry(connection); InputStreamReader isr = new InputStreamReader(is); try { T json = new JSONHelper().fromJson(isr, c); return json; } finally { IOUtils.closeQuietly(is); } }
Source:
public void normalClearFromDataStoreWithWriterOnDataStore() { configureServers(true, true); client1.invoke(this::initClientCache); client2.invoke(this::initClientCache); accessor.invoke(() -> feed(false)); verifyServerRegionSize(NUM_ENTRIES); dataStore3.invoke(() -> getRegion(false).clear()); verifyServerRegionSize(0); verifyCacheListenerTriggerCount(dataStore3); assertThat(dataStore1.invoke(getWriterClears)).isEqualTo(0); assertThat(dataStore2.invoke(getWriterClears)).isEqualTo(0); assertThat(dataStore3.invoke(getWriterClears)).isEqualTo(1); assertThat(accessor.invoke(getWriterClears)).isEqualTo(0); dataStore3.invoke(() -> { Region region = getRegion(false); region.destroyRegion(); }); assertThat(dataStore1.invoke(getWriterDestroys)).isEqualTo(0); assertThat(dataStore2.invoke(getWriterDestroys)).isEqualTo(0); assertThat(dataStore3.invoke(getWriterDestroys)).isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(0); }

Target:
public void normalClearFromDataStoreWithWriterOnDataStore() { configureServers(true, true); client1.invoke(this::initClientCache); client2.invoke(this::initClientCache); accessor.invoke(() -> feed(false)); verifyServerRegionSize(NUM_ENTRIES); dataStore3.invoke(() -> getRegion(false).clear()); verifyServerRegionSize(0); dataStore3.invoke(() -> { Region region = getRegion(false); region.destroyRegion(); }); assertThat(dataStore1.invoke(getWriterDestroys)).isEqualTo(dataStore1.invoke(getWriterClears)) .isEqualTo(0); assertThat(dataStore2.invoke(getWriterDestroys)).isEqualTo(dataStore2.invoke(getWriterClears)) .isEqualTo(0); assertThat(dataStore3.invoke(getWriterDestroys)).isEqualTo(dataStore3.invoke(getWriterClears)) .isEqualTo(1); assertThat(accessor.invoke(getWriterDestroys)).isEqualTo(accessor.invoke(getWriterClears)) .isEqualTo(0); }
Source:
public static CodeBlock join(Iterable<CodeBlock> codeBlocks, String separator) { Collection<CodeBlock> collection; if (codeBlocks instanceof Collection) { collection = (Collection<CodeBlock>) codeBlocks; } else { collection = new ArrayList<>(); codeBlocks.forEach(collection::add); } return collection.stream().collect(joining(separator)); }

Target:
public static CodeBlock join(Iterable<CodeBlock> codeBlocks, String separator) { return StreamSupport.stream(codeBlocks.spliterator(), false).collect(joining(separator)); }
Source:
public Image getBaseImage(DirectoryItems imageDirectory) { String category = (Crew.ROOT_PORTRAIT.equals(getCategory())) ? "" : getCategory(); String filename = getFileName(); if ((category == null) || (filename == null) || Crew.PORTRAIT_NONE.equals(filename)) { filename = "default.gif"; } Image portrait = null; try { portrait = (Image) imageDirectory.getItem(category, filename); if (portrait == null) { portrait = (Image) imageDirectory.getItem("", "default.gif"); } } catch (Exception e) { MegaMek.getLogger().error(getClass(), "setPortrait", e); } return portrait; }

Target:
public Image getBaseImage(DirectoryItems imageDirectory) { String category = (Crew.ROOT_PORTRAIT.equals(getCategory())) ? "" : getCategory(); String filename = getFileName(); if ((category == null) || (filename == null) || Crew.PORTRAIT_NONE.equals(filename)) { filename = DEFAULT_PORTRAIT_FILENAME; } Image portrait = null; try { portrait = (Image) imageDirectory.getItem(category, filename); if (portrait == null) { portrait = (Image) imageDirectory.getItem("", DEFAULT_PORTRAIT_FILENAME); } } catch (Exception e) { MegaMek.getLogger().error(getClass(), "setPortrait", e); } return portrait; }
Source:
private static Stream<StructuralElement> treeStream(StructuralElement tree) { return Stream.concat(Stream.of(tree), tree instanceof IncludedStructuralElement ? ((IncludedStructuralElement) tree).getChildren().stream().flatMap(child -> treeStream(child)) : Stream.empty()); }

Target:
private static Stream<StructuralElement> treeStream(StructuralElement tree) { List<StructuralElement> result = new ArrayList<>(); result.add(tree); if (tree instanceof IncludedStructuralElement) { for (StructuralElement child : ((IncludedStructuralElement) tree).getChildren()) { result.addAll(treeStream(child).collect(Collectors.toList())); } } return result.stream(); }
Source:
public static void uploadGravatar(final File file, final GravatarUploadListener gravatarUploadListener) { Request request = prepareGravatarUpload(AccountHelper.getDefaultAccount().getEmail(), file); createClient(API_BASE_URL).newCall(request).enqueue( new Callback() { @Override public void onResponse(Call call, final Response response) throws IOException { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (response.isSuccessful()) { gravatarUploadListener.onSuccess(); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_UPLOAD_UNSUCCESSFUL); AppLog.w(AppLog.T.API, "Network call unsuccessful trying to upload Gravatar: " + response.message()); gravatarUploadListener.onError(); } } }); } @Override public void onFailure(okhttp3.Call call, final IOException e) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_UPLOAD_EXCEPTION); CrashlyticsUtils.logException(e, CrashlyticsUtils.ExceptionType.SPECIFIC, AppLog.T.API, "Network call failure trying to upload Gravatar!"); AppLog.w(AppLog.T.API, "Network call failure trying to upload Gravatar!" + e .getMessage()); gravatarUploadListener.onError(); } }); } }); }

Target:
public static void uploadGravatar(final File file, final GravatarUploadListener gravatarUploadListener) { Request request = prepareGravatarUpload(AccountHelper.getDefaultAccount().getEmail(), file); createClient(API_BASE_URL).newCall(request).enqueue( new Callback() { @Override public void onResponse(Call call, final Response response) throws IOException { if (!response.isSuccessful()) { Map<String, Object> properties = new HashMap<>(); properties.put("network_response_code", response.code()); String responseBody; try { responseBody = response.body().string(); } catch (IOException e) { responseBody = "null"; } properties.put("network_response_body", responseBody); AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_UPLOAD_UNSUCCESSFUL, properties); AppLog.w(AppLog.T.API, "Network call unsuccessful trying to upload Gravatar: " + responseBody); } new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (response.isSuccessful()) { gravatarUploadListener.onSuccess(); } else { gravatarUploadListener.onError(); } } }); } @Override public void onFailure(okhttp3.Call call, final IOException e) { Map<String, Object> properties = new HashMap<>(); properties.put("network_exception_class", e != null ? e.getClass().getCanonicalName() : "null"); properties.put("network_exception_message", e != null ? e.getMessage() : "null"); AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_UPLOAD_EXCEPTION, properties); CrashlyticsUtils.logException(e, CrashlyticsUtils.ExceptionType.SPECIFIC, AppLog.T.API, "Network call failure trying to upload Gravatar!"); AppLog.w(AppLog.T.API, "Network call failure trying to upload Gravatar!" + (e != null ? e.getMessage() : "null")); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { gravatarUploadListener.onError(); } }); } }); }
Source:
void shutdown() { LOG.info("Shutting down BookieNettyServer"); isRunning.set(false); allChannels.close().awaitUninterruptibly(); if (eventLoopGroup != null) { eventLoopGroup.shutdownGracefully(); } if (jvmEventLoopGroup != null) { jvmEventLoopGroup.shutdownGracefully(); LocalBookiesRegistry.registerLocalBookieAddress(bookieAddress); } authProviderFactory.close(); }

Target:
void shutdown() { LOG.info("Shutting down BookieNettyServer"); isRunning.set(false); allChannels.close().awaitUninterruptibly(); if (eventLoopGroup != null) { eventLoopGroup.shutdownGracefully(); } if (jvmEventLoopGroup != null) { LocalBookiesRegistry.unregisterLocalBookieAddress(bookieAddress); jvmEventLoopGroup.shutdownGracefully(); } authProviderFactory.close(); }
Source:
protected StreamTask( Environment environment, @Nullable TimerService timerService, Thread.UncaughtExceptionHandler uncaughtExceptionHandler, StreamTaskActionExecutor actionExecutor, TaskMailbox mailbox) throws Exception { super(environment); this.configuration = new StreamConfig(getTaskConfiguration()); this.recordWriter = createRecordWriterDelegate(configuration, environment); this.actionExecutor = Preconditions.checkNotNull(actionExecutor); this.mailboxProcessor = new MailboxProcessor(this::processInput, mailbox, actionExecutor); this.asyncExceptionHandler = new StreamTaskAsyncExceptionHandler(environment); this.asyncOperationsThreadPool = Executors.newCachedThreadPool( new ExecutorThreadFactory("AsyncOperations", uncaughtExceptionHandler)); this.stateBackend = createStateBackend(); this.subtaskCheckpointCoordinator = new SubtaskCheckpointCoordinatorImpl( stateBackend.createCheckpointStorage(getEnvironment().getJobID()), getName(), getCancelables(), getAsyncOperationsThreadPool(), getEnvironment(), this); if (timerService == null) { ThreadFactory timerThreadFactory = new DispatcherThreadFactory(TRIGGER_THREAD_GROUP, "Time Trigger for " + getName()); this.timerService = new SystemProcessingTimeService(this::handleTimerException, timerThreadFactory); } else { this.timerService = timerService; } }

Target:
protected StreamTask( Environment environment, @Nullable TimerService timerService, Thread.UncaughtExceptionHandler uncaughtExceptionHandler, StreamTaskActionExecutor actionExecutor, TaskMailbox mailbox) throws Exception { super(environment); this.configuration = new StreamConfig(getTaskConfiguration()); this.recordWriter = createRecordWriterDelegate(configuration, environment); this.actionExecutor = Preconditions.checkNotNull(actionExecutor); this.mailboxProcessor = new MailboxProcessor(this::processInput, mailbox, actionExecutor); this.asyncExceptionHandler = new StreamTaskAsyncExceptionHandler(environment); this.asyncOperationsThreadPool = Executors.newCachedThreadPool( new ExecutorThreadFactory("AsyncOperations", uncaughtExceptionHandler)); this.stateBackend = createStateBackend(); this.subtaskCheckpointCoordinator = new SubtaskCheckpointCoordinatorImpl( stateBackend.createCheckpointStorage(getEnvironment().getJobID()), getName(), actionExecutor, getCancelables(), getAsyncOperationsThreadPool(), getEnvironment(), this, false); if (timerService == null) { ThreadFactory timerThreadFactory = new DispatcherThreadFactory(TRIGGER_THREAD_GROUP, "Time Trigger for " + getName()); this.timerService = new SystemProcessingTimeService(this::handleTimerException, timerThreadFactory); } else { this.timerService = timerService; } }
Source:
public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); String responseContent; try (DefaultBHttpClientConnection conn = getConnection()) { HttpEntity response = executeRequest(request, conn); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); consumeResponse(response); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return ImageTicketInformationHelper.fromJson(responseContent); }

Target:
public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); String responseContent; try (DefaultBHttpClientConnection conn = getConnection()) { HttpEntity response = executeRequest(request, conn); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); EntityUtils.consume(response); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return ImageTicketInformationHelper.fromJson(responseContent); }
Source:
public String value() { return statusMsg.toUpperCase(); }

Target:
public String value() { return statusMsg; }
Source:
protected void abortOnBadSetup(@NonNull IJavaProject javaProject, @Nullable ProjectState projectState) throws AbortBuildException, CoreException { IProject iProject = javaProject.getProject(); Sdk sdk = Sdk.getCurrent(); if (sdk == null) { throw new AbortBuildException(); } if (projectState == null) { projectState = Sdk.getProjectState(javaProject.getProject()); } IAndroidTarget target = projectState.getTarget(); if (target == null) { throw new AbortBuildException(); } if (sdk.checkAndLoadTargetData(target, javaProject) != LoadStatus.LOADED) { throw new AbortBuildException(); } mBuildToolInfo = projectState.getBuildToolInfo(); if (mBuildToolInfo == null) { mBuildToolInfo = sdk.getLatestBuildTool(); if (mBuildToolInfo == null) { AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject, "No Build Tool available"); throw new AbortBuildException(); } else { AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject, String.format("Using default Build Tools revision %s", mBuildToolInfo.getRevision()) ); } } stopOnMarker(iProject, AdtConstants.MARKER_TARGET, IResource.DEPTH_ZERO, false ); stopOnMarker(iProject, AdtConstants.MARKER_ADT, IResource.DEPTH_ZERO, false ); }

Target:
protected void abortOnBadSetup(@NonNull IJavaProject javaProject, @Nullable ProjectState projectState) throws AbortBuildException, CoreException { IProject iProject = javaProject.getProject(); Sdk sdk = Sdk.getCurrent(); if (sdk == null) { throw new AbortBuildException(); } if (projectState == null) { projectState = Sdk.getProjectState(javaProject.getProject()); } IAndroidTarget target = projectState.getTarget(); if (target == null) { throw new AbortBuildException(); } if (sdk.checkAndLoadTargetData(target, javaProject) != LoadStatus.LOADED) { throw new AbortBuildException(); } mBuildToolInfo = projectState.getBuildToolInfo(); if (mBuildToolInfo == null) { mBuildToolInfo = sdk.getLatestBuildTool(); if (mBuildToolInfo == null) { AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject, "No \"Build Tools\" package available; use SDK Manager to install one."); throw new AbortBuildException(); } else { AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject, String.format("Using default Build Tools revision %s", mBuildToolInfo.getRevision()) ); } } stopOnMarker(iProject, AdtConstants.MARKER_TARGET, IResource.DEPTH_ZERO, false ); stopOnMarker(iProject, AdtConstants.MARKER_ADT, IResource.DEPTH_ZERO, false ); }
Source:
public boolean equals(Object o) { Page other = (Page) o; return getTitle().equals(other.getTitle()) && getSections().equals(other.getSections()); }

Target:
public boolean equals(Object o) { if (!(o instanceof Page)) { return false; } Page other = (Page) o; return getTitle().equals(other.getTitle()) && getSections().equals(other.getSections()); }
Source:
public Integer mergingUpdate(Collection<Statement> insertStatements, Collection<String> valueSet, Collection<String> refSet) { log.trace("Running Merging Update"); long startQuery = System.currentTimeMillis(); final ContentResponse response; try { ResponseHandler<Integer> responseHandler = UPDATE_COUNT_RESPONSE; response = retryer.call(() -> { OutputStreamContentProvider content = new OutputStreamContentProvider(); Request request = makeMergingUpdateRequest(content, valueSet, refSet, responseHandler.acceptHeader()); FutureResponseListener listener = new FutureResponseListener(request); try (OutputStream output = content.getOutputStream()) { request.send(listener); OutputStreamWriter sw = new OutputStreamWriter(output, StandardCharsets.UTF_8); TurtleWriter w = new TurtleWriter(sw); try { w.startRDF(); for (Statement st: insertStatements) { w.handleStatement(st); } w.endRDF(); } catch (RDFHandlerException e) { throw new RuntimeException("Error writing insertStatements", e); } } return listener.get(); } ); if (response.getStatus() != OK_200) { throw new ContainedException("Non-200 response from triple store: " + response + " body=\n" + response.getContentAsString()); } log.debug("Completed in ms", System.currentTimeMillis() - startQuery); return responseHandler.parse(response); } catch (ExecutionException | RetryException | IOException e) { throw new FatalException("Error accessing triple store", e); } }

Target:
public Integer mergingUpdate(Collection<Statement> insertStatements, Collection<String> valueSet, Collection<String> refSet) { log.trace("Running Merging Update"); long startQuery = System.currentTimeMillis(); final ContentResponse response; try { ResponseHandler<Integer> responseHandler = UPDATE_COUNT_RESPONSE; response = retryer.call(() -> { OutputStreamContentProvider content = new OutputStreamContentProvider(); Request request = makeMergingUpdateRequest(content, valueSet, refSet, responseHandler.acceptHeader()); FutureResponseListener listener = new FutureResponseListener(request); try (OutputStream output = content.getOutputStream()) { request.send(listener); OutputStreamWriter sw = new OutputStreamWriter(output, StandardCharsets.UTF_8); TurtleWriter w = new TurtleWriter(sw); w.startRDF(); for (Statement st: insertStatements) { w.handleStatement(st); } w.endRDF(); } catch (RDFHandlerException e) { throw new RuntimeException("Error writing insertStatements", e); } return listener.get(); } ); if (response.getStatus() != OK_200) { throw new ContainedException("Non-200 response from triple store: " + response + " body=\n" + response.getContentAsString()); } log.debug("Completed in ms", System.currentTimeMillis() - startQuery); return responseHandler.parse(response); } catch (ExecutionException | RetryException | IOException e) { throw new FatalException("Error accessing triple store", e); } }
Source:
void initiate(ByteBuf toSend, int entryLength) { if (callbackTriggered) { return; } if (timeoutSec > -1) { this.timeout = lh.bk.getBookieClient().scheduleTimeout(this, timeoutSec, TimeUnit.SECONDS); } this.requestTimeNanos = MathUtils.nowInNano(); this.toSend = toSend; this.toSend.retain(); this.entryLength = entryLength; DistributionSchedule.WriteSet writeSet = lh.distributionSchedule.getWriteSet(entryId); for (int i = 0; i < writeSet.size(); i++) { sendWriteRequest(writeSet.get(i)); } writeSet.recycle(); }

Target:
void initiate(ByteBuf toSend, int entryLength) { if (callbackTriggered) { return; } if (timeoutSec > -1) { this.timeout = lh.bk.getBookieClient().scheduleTimeout(this, timeoutSec, TimeUnit.SECONDS); } this.requestTimeNanos = MathUtils.nowInNano(); this.toSend = toSend; this.toSend.retain(); this.entryLength = entryLength; DistributionSchedule.WriteSet writeSet = lh.distributionSchedule.getWriteSet(entryId); try { for (int i = 0; i < writeSet.size(); i++) { sendWriteRequest(writeSet.get(i)); } } finally { writeSet.recycle(); } }
Source:
public void serializeStatsSnapshotTest() throws IOException { Long val = 100L; Map<String, StatsSnapshot> subMap = new HashMap<>(); subMap.put("first", new StatsSnapshot(40L, null)); subMap.put("second", new StatsSnapshot(60L, null)); StatsSnapshot snapshot = new StatsSnapshot(val, subMap); String result = new ObjectMapper().writeValueAsString(snapshot); assertThat(result, containsString("first")); assertThat(result, containsString("second")); assertThat(result, not(containsString("subMap"))); assertThat(result, not(containsString("null"))); }

Target:
public void serializeStatsSnapshotTest() throws IOException { Long val = 100L; Map<String, StatsSnapshot> subMap = new HashMap<>(); subMap.put("first", new StatsSnapshot(40L, null)); subMap.put("second", new StatsSnapshot(60L, null)); StatsSnapshot snapshot = new StatsSnapshot(val, subMap); String result = new ObjectMapper().writeValueAsString(snapshot); assertThat("Result should contain \"first\" keyword and associated entry", result, containsString("first")); assertThat("Result should contain \"second\" keyword and associated entry", result, containsString("second")); assertThat("Result should not contain \"subMap\" keyword", result, not(containsString("subMap"))); assertThat("Result should ignore any null fields", result, not(containsString("null"))); }
Source:
public byte[] readRawReplayData(Path replayFile) { logger.debug("Reading replay file: {}", replayFile); Optional<String> replayData = Files.lines(replayFile).skip(1).findFirst(); if (replayData.isPresent()) { return QtCompress.qUncompress(BaseEncoding.base64().decode(replayData.get())); } throw new IOException(String.format("Failed to extract replay data from replay file: {}", replayFile)); }

Target:
public byte[] readRawReplayData(Path replayFile) { logger.debug("Reading replay file: {}", replayFile); try (Stream<String> stream = Files.lines(replayFile)) { return stream .skip(1) .findFirst() .map(base64String -> noCatch(() -> QtCompress.qUncompress(BaseEncoding.base64().decode(base64String)))) .orElseThrow(() -> new IOException(String.format("Failed to extract replay data from replay file: {}", replayFile))); } }
Source:
public void beforeSession(TestSession session) { super.beforeSession(session); String udid = String.valueOf(session.getSlot().getCapabilities().get("udid")); if (STF.isSTFRequired(session.getSlot().getCapabilities(), session.getRequestedCapabilities())) { STF.reserveDevice(udid); } if (!StringUtils.isEmpty(udid)) { session.getRequestedCapabilities().put("slotCapabilities", getSlotCapabilities(session, udid)); session.put("Device", udid); LOGGER.info("Extracted udid:".concat(udid)); LOGGER.info("Session:".concat(session.toString())); } }

Target:
public void beforeSession(TestSession session) { super.beforeSession(session); String udid = String.valueOf(session.getSlot().getCapabilities().get("udid")); if (STF.isSTFRequired(session.getSlot().getCapabilities(), session.getRequestedCapabilities())) { STF.reserveDevice(udid); } if (!StringUtils.isEmpty(udid)) { session.getRequestedCapabilities().put("slotCapabilities", getSlotCapabilities(session, udid)); } }
Source:
public void should_get_all_tag_names() throws Exception { List<String> tagsNames = tags.allNames(); assertEquals(5, tagsNames.size()); assertEquals(csharp.getName(), tagsNames.get(0)); assertEquals(cplus.getName(), tagsNames.get(1)); assertEquals(weirdCharacters.getName(), tagsNames.get(2)); assertEquals(java.getName(), tagsNames.get(3)); assertEquals(ruby.getName(), tagsNames.get(4)); }

Target:
public void should_get_all_tag_names() throws Exception { List<String> tagsNames = tags.allNames(); assertEquals(5, tagsNames.size()); assertThat(tagsNames, Matchers.containsInAnyOrder( csharp.getName(), cplus.getName(), weirdCharacters.getName(), java.getName(),ruby.getName())); }
Source:
public void testCopy() throws Exception { RaParser parser = new RaParser(); InputStream is1 = JCA10TestCase.class.getClassLoader(). getResourceAsStream("../../resources/test/spec/ra-1.0.xml"); assertNotNull(is1); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); XMLStreamReader xsr1 = inputFactory.createXMLStreamReader(is1); Connector c1 = parser.parse(xsr1); assertNotNull(c1); is1.close(); Connector c2 = c1.copy(); assertEquals(c1, c2); }

Target:
public void testCopy() throws Exception { RaParser parser = new RaParser(); InputStream is1 = JCA10TestCase.class.getClassLoader(). getResourceAsStream("../../resources/test/spec/ra-1.0.xml"); assertNotNull(is1); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); XMLStreamReader xsr1 = inputFactory.createXMLStreamReader(is1); Connector c1 = parser.parse(xsr1); assertNotNull(c1); is1.close(); Connector c2 = c1.copy(); assertEquals(c1, c2); assertFalse(c1 == c2); assertEquals(c1.toString(), c2.toString()); }
Source:
public JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.ARRAY) { ArrayType arrayType = (ArrayType) type; LogicalTypeRoot elemType = arrayType.getElementType().getTypeRoot(); if (elemType == LogicalTypeRoot.VARBINARY) { return v -> { PgArray pgArray = (PgArray) v; Object[] in = (Object[]) pgArray.getArray(); Object[] out = new Object[in.length]; for (int i = 0; i < in.length; i++) { out[i] = ((PGobject) in[i]).getValue().getBytes(); } return out; }; } else { return v -> ((PgArray) v).getArray(); } } else { return createPrimitiveConverter(type); } }

Target:
public JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.ARRAY) { ArrayType arrayType = (ArrayType) type; if (LogicalTypeChecks.hasFamily(arrayType.getElementType(), LogicalTypeFamily.BINARY_STRING)) { return v -> { PgArray pgArray = (PgArray) v; Object[] in = (Object[]) pgArray.getArray(); Object[] out = new Object[in.length]; for (int i = 0; i < in.length; i++) { out[i] = ((PGobject) in[i]).getValue().getBytes(); } return out; }; } else { return v -> ((PgArray) v).getArray(); } } else { return createPrimitiveConverter(type); } }
Source:
public AnnotateCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("A", "annotation-file", true, "add annotation from a file"); o.addOption("O", "ontology-iri", true, "set the ontology IRI"); o.addOption("V", "version-iri", true, "set the ontology version IRI"); o.addOption("i", "input", true, "convert ontology from a file"); o.addOption("I", "input-iri", true, "convert ontology from an IRI"); o.addOption("o", "output", true, "save ontology to a file"); options = o; Option a = new Option("R", "remove-annotations", true, "remove all annotations on the ontology"); a.setOptionalArg(true); o.addOption(a); a = new Option("a", "annotate ontology with PROP VALUE"); a.setLongOpt("annotation"); a.setArgs(2); options.addOption(a); a = new Option("k", "annotate ontology with PROP IRI"); a.setLongOpt("link-annotation"); a.setArgs(2); options.addOption(a); a = new Option("l", "annotate ontology with PROP VALUE LANG"); a.setLongOpt("language-annotation"); a.setArgs(3); options.addOption(a); a = new Option("t", "annotate ontology with PROP VALUE LANG"); a.setLongOpt("typed-annotation"); a.setArgs(3); options.addOption(a); a = new Option("x", "annotate all axioms in the ontology " + "with PROP VALUE"); a.setLongOpt("axiom-annotation"); a.setArgs(3); options.addOption(a); }

Target:
public AnnotateCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("A", "annotation-file", true, "add annotation from a file"); o.addOption("O", "ontology-iri", true, "set the ontology IRI"); o.addOption("V", "version-iri", true, "set the ontology version IRI"); o.addOption("i", "input", true, "convert ontology from a file"); o.addOption("I", "input-iri", true, "convert ontology from an IRI"); o.addOption("o", "output", true, "save ontology to a file"); options = o; Option a = new Option("R", "remove-annotations", true, "remove all annotations on the ontology"); a.setOptionalArg(true); o.addOption(a); a = new Option("a", "annotate ontology with PROP VALUE"); a.setLongOpt("annotation"); a.setArgs(2); options.addOption(a); a = new Option("k", "annotate ontology with PROP IRI"); a.setLongOpt("link-annotation"); a.setArgs(2); options.addOption(a); a = new Option("l", "annotate ontology with PROP VALUE LANG"); a.setLongOpt("language-annotation"); a.setArgs(3); options.addOption(a); a = new Option("t", "annotate ontology with PROP VALUE TYPE"); a.setLongOpt("typed-annotation"); a.setArgs(3); options.addOption(a); a = new Option("x", "annotate all axioms in the ontology " + "with PROP VALUE"); a.setLongOpt("axiom-annotation"); a.setArgs(3); options.addOption(a); }
Source:
public void removeMessage(String reason) { waitForElementByCss("div.msg-toolbar"); executeScript("document.getElementsByClassName(\"buttons\")[1].style.display = \"block\""); waitForElementByElement(moreButton); mouseOver(moreButtonCss); executeScript("document.querySelectorAll(\"div.msg-toolbar nav.wikia-menu-button.secondary.combined\")[0].click()"); mouseOver(".WikiaMenuElement .remove-message"); jQueryNthElemClick(".WikiaMenuElement .remove-message", 0); waitForElementByElement(removeCloseMessageOverLay); waitForElementByElement(removeCloseMessageConfirmButton); if (Global.BROWSER.equals("IE")) { WebElement removeMessageReasonParent = getParentElement(removeCloseMessageReason); clickAndWait(removeMessageReasonParent); removeMessageReasonParent.sendKeys(reason); clickAndWait(removeCloseMessageConfirmButton); } else { removeCloseMessageReason.sendKeys(reason); clickAndWait(removeCloseMessageConfirmButton); } waitForElementByElement(removeMessageConfirmation); driver.navigate().refresh(); PageObjectLogging.log("removeMessage", "message is removed", true, driver); }

Target:
public void removeMessage(String reason) { waitForElementByElement(msgToolbar); setStyle(".buttons", "1", "block"); waitForElementByElement(moreButton); mouseOver(moreButtonCss); jQueryClick(msgToolbarNav); mouseOver(".WikiaMenuElement .remove-message"); jQueryNthElemClick(".WikiaMenuElement .remove-message", 0); waitForElementByElement(removeCloseOverLay); waitForElementByElement(removeCloseConfirmButton); if (Global.BROWSER.equals("IE")) { WebElement removeMessageReasonParent = getParentElement(removeCloseReason); clickAndWait(removeMessageReasonParent); removeMessageReasonParent.sendKeys(reason); click(removeCloseConfirmButton); } else { removeCloseReason.sendKeys(reason); click(removeCloseConfirmButton); } waitForElementByElement(removeMessageConfirmation); driver.navigate().refresh(); PageObjectLogging.log("removeMessage", "message is removed", true, driver); }
Source:
public ChangeInfo apply(ChangeResource req, final AbandonInput input) throws AuthException, RestApiException, UpdateException, OrmException { if (!req.getControl().canAbandon()) { throw new AuthException("abandon not permitted"); } Op op = new Op(input); try (BatchUpdate u = batchUpdateFactory.create(dbProvider.get(), req.getChange().getProject(), TimeUtil.nowTs())) { u.addOp(req.getControl(), op).execute(); } return json.format(op.change); }

Target:
public ChangeInfo apply(ChangeResource req, final AbandonInput input) throws AuthException, RestApiException, UpdateException, OrmException { if (!req.getControl().canAbandon()) { throw new AuthException("abandon not permitted"); } change = abandon(control, input.message, caller.getAccount()); return json.create(ChangeJson.NO_OPTIONS).format(change); }
Source:
private void testDisabledOutputPaging() throws Exception { consoleWriter.println("/subsystem=elytron:read-resource-description(recursive=true)"); Assert.assertFalse(consoleWriter.checkError()); String window = queue.poll(100, TimeUnit.SECONDS); Assert.assertNotNull(window); checkWithRegex(window, promptPattern); Assert.assertTrue(Pattern.compile("^\\{.*^\\}", Pattern.MULTILINE | Pattern.DOTALL) .matcher(window).find()); }

Target:
private void testDisabledOutputPaging() throws Exception { consoleWriter.println("/subsystem=elytron:read-resource-description(recursive=true)"); Assert.assertFalse(consoleWriter.checkError()); String window = queue.poll(TimeoutUtil.adjust(20), TimeUnit.SECONDS); Assert.assertNotNull(window); checkWithRegex(window, promptPattern); Assert.assertTrue(Pattern.compile("^\\{.*^\\}", Pattern.MULTILINE | Pattern.DOTALL) .matcher(window).find()); }
Source:
private void checkFunctionDeclaration(SubscriptionContext ctx) { FunctionDef functionDef = (FunctionDef) ctx.syntaxNode(); Tree ancestor = TreeUtils.firstAncestorOfKind(functionDef, Tree.Kind.FUNCDEF, Tree.Kind.CLASSDEF); if ((ancestor == null || ancestor.getKind().equals(Tree.Kind.FUNCDEF)) && shouldReportIssue(functionDef.name(), functionDef)) { ctx.addIssue(functionDef.name(), String.format(MESSAGE, "function")); } ParameterList parameterList = functionDef.parameters(); if (parameterList != null) { for (Parameter parameter : parameterList.nonTuple()) { Name parameterName = parameter.name(); if (parameterName != null && isBuiltInName(parameterName)) { ctx.addIssue(parameterName, String.format(MESSAGE, "parameter")); } } } }

Target:
private void checkFunctionDeclaration(SubscriptionContext ctx) { FunctionDef functionDef = (FunctionDef) ctx.syntaxNode(); if (!functionDef.isMethodDefinition() && shouldReportIssue(functionDef.name())) { ctx.addIssue(functionDef.name(), String.format(MESSAGE, "function")); } }
Source:
public StreamsTaskCounter(String id) { this.emitted = new AtomicLong(0); this.received = new AtomicLong(0); this.errors = new AtomicLong(0); this.totalTime = new AtomicLong(0); this.maxTime = -1; try { ObjectName name = new ObjectName(String.format(NAME_TEMPLATE, id)); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, name); } catch (MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) { LOGGER.error("Failed to register MXBean : {}", e); throw new RuntimeException(e); } }

Target:
public StreamsTaskCounter(String id) { this.emitted = new AtomicLong(0); this.received = new AtomicLong(0); this.errors = new AtomicLong(0); this.totalTime = new AtomicLong(0); this.maxTime = -1; ComponentUtils.registerLocalMBean(String.format(NAME_TEMPLATE, id), this); }