auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public WebSocketEventPublisher (ExtensionWebSocket extension) { this.extension = extension; executor = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, "ZAP-WebSocketEventPublisher"); }}); ZAP.getEventBus().registerPublisher( this, new String {EVENT_MESSAGE, EVENT_STATE_CHANGE}); }

Target:
public WebSocketEventPublisher (ExtensionWebSocket extension) { this.extension = extension; executor = Executors.newSingleThreadExecutor( r -> { return new Thread(r, "ZAP-WebSocketEventPublisher"); }); ZAP.getEventBus().registerPublisher( this, new String {EVENT_MESSAGE, EVENT_STATE_CHANGE}); }
Source:
public void setUp() { super.setUp(); secondsToWaitTillFail = Math.max(15, debug_show_browser_timeout_seconds); if (SwtTestUtil.isRunningOnEclipseOrgHudsonGTK || debug_print_test_names) { System.out.println("Running Test_org_eclipse_swt_browser_Browser#" + name.getMethodName()); } shell.setLayout(new FillLayout()); browser = new Browser(shell, SWT.NONE); String shellTitle = name.getMethodName(); if (SwtTestUtil.isGTK && browser.getBrowserType().equals("webkit")) { String webkitGtkVersionStr = System.getProperty("org.eclipse.swt.internal.webkitgtk.version"); shellTitle = shellTitle + " Webkit version: " + webkitGtkVersionStr; String[] webkitGtkVersionStrParts = webkitGtkVersionStr.split("\\."); int[] webkitGtkVersionInts = new int[3]; for (int i = 0; i < 3; i++) { webkitGtkVersionInts[i] = Integer.parseInt(webkitGtkVersionStrParts[i]); } if (webkitGtkVersionInts[0] == 1 || (webkitGtkVersionInts[0] == 2 && webkitGtkVersionInts[1] <= 4)) { isWebkit1 = true; } else if (webkitGtkVersionInts[0] == 2 && webkitGtkVersionInts[1] > 4) { isWebkit2 = true; } } shell.setText(shellTitle); setWidget(browser); testLog = new StringBuffer("\nTest log:\n"); }

Target:
public void setUp() { super.setUp(); secondsToWaitTillFail = Math.max(15, debug_show_browser_timeout_seconds); if (SwtTestUtil.isRunningOnEclipseOrgHudsonGTK || debug_print_test_names) { System.out.println("Running Test_org_eclipse_swt_browser_Browser#" + name.getMethodName()); } shell.setLayout(new FillLayout()); browser = new Browser(shell, SWT.NONE); String shellTitle = name.getMethodName(); if (SwtTestUtil.isGTK && browser.getBrowserType().equals("webkit")) { String webkitGtkVersionStr = System.getProperty("org.eclipse.swt.internal.webkitgtk.version"); shellTitle = shellTitle + " Webkit version: " + webkitGtkVersionStr; String[] webkitGtkVersionStrParts = webkitGtkVersionStr.split("\\."); for (int i = 0; i < 3; i++) { webkitGtkVersionInts[i] = Integer.parseInt(webkitGtkVersionStrParts[i]); } if (webkitGtkVersionInts[0] == 1 || (webkitGtkVersionInts[0] == 2 && webkitGtkVersionInts[1] <= 4)) { isWebkit1 = true; } else if (webkitGtkVersionInts[0] == 2 && webkitGtkVersionInts[1] > 4) { isWebkit2 = true; } } shell.setText(shellTitle); setWidget(browser); testLog = new StringBuffer("\nTest log:\n"); }
Source:
private CreateSchema parseCreateSchema() { CreateSchema command = new CreateSchema(session); command.setIfNotExists(readIfNotExists()); command.setSchemaName(readUniqueIdentifier()); if (readIf("AUTHORIZATION")) { command.setAuthorization(readUniqueIdentifier()); } else { command.setAuthorization(session.getUser().getName()); } if (readIf("WITH")) { ArrayList<String> tableEngineParams = New.arrayList(); do { tableEngineParams.add(readUniqueIdentifier()); } while (readIf(",")); command.setTableEngineParams(tableEngineParams); } return command; }

Target:
private CreateSchema parseCreateSchema() { CreateSchema command = new CreateSchema(session); command.setIfNotExists(readIfNotExists()); command.setSchemaName(readUniqueIdentifier()); if (readIf("AUTHORIZATION")) { command.setAuthorization(readUniqueIdentifier()); } else { command.setAuthorization(session.getUser().getName()); } if (readIf("WITH")) { command.setTableEngineParams(readTableEngineParams()); } return command; }
Source:
public void testJMX() throws Exception { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); Properties props = new Properties(); JettyLoggerConfiguration config = new JettyLoggerConfiguration(props); JettyLoggerFactory loggerFactory = new JettyLoggerFactory(config); ObjectName objectName = ObjectName.getInstance("org.eclipse.jetty.logging", "type", JettyLoggerFactory.class.getSimpleName().toLowerCase(Locale.ENGLISH)); mbeanServer.registerMBean(loggerFactory, objectName); JettyLoggerFactoryMBean mbean = JMX.newMBeanProxy(mbeanServer, objectName, JettyLoggerFactoryMBean.class); assertEquals(1, mbean.getLoggerCount()); JettyLogger child = loggerFactory.getJettyLogger("org.eclipse.jetty.logging"); JettyLogger parent = loggerFactory.getJettyLogger("org.eclipse.jetty"); assertEquals(3, mbean.getLoggerCount()); List<String> expected = new ArrayList<>(Arrays.asList(JettyLogger.ROOT_LOGGER_NAME, parent.getName(), child.getName())); expected.sort(String::compareTo); String[] loggerNames = mbean.getLoggerNames(); assertEquals(expected, Arrays.asList(loggerNames)); parent.setLevel(Level.DEBUG); assertEquals(Level.intToLevel(parent.getLevel()).toString(), mbean.getLoggerLevel(child.getName())); assertTrue(mbean.setLoggerLevel(child.getName(), "INFO")); assertEquals(Level.INFO.toInt(), child.getLevel()); }

Target:
public void testJMX() throws Exception { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); Properties props = new Properties(); JettyLoggerConfiguration config = new JettyLoggerConfiguration(props); JettyLoggerFactory loggerFactory = new JettyLoggerFactory(config); ObjectName objectName = ObjectName.getInstance("org.eclipse.jetty.logging", "type", JettyLoggerFactory.class.getSimpleName().toLowerCase(Locale.ENGLISH)); mbeanServer.registerMBean(loggerFactory, objectName); JettyLoggerFactoryMBean mbean = JMX.newMBeanProxy(mbeanServer, objectName, JettyLoggerFactoryMBean.class); assertEquals(1, mbean.getLoggerCount()); JettyLogger child = loggerFactory.getJettyLogger("org.eclipse.jetty.logging"); JettyLogger parent = loggerFactory.getJettyLogger("org.eclipse.jetty"); assertEquals(3, mbean.getLoggerCount()); List<String> expected = new ArrayList<>(Arrays.asList(JettyLogger.ROOT_LOGGER_NAME, parent.getName(), child.getName())); expected.sort(String::compareTo); String[] loggerNames = mbean.getLoggerNames(); assertEquals(expected, Arrays.asList(loggerNames)); parent.setLevel(JettyLevel.DEBUG); assertEquals(parent.getLevel().toString(), mbean.getLoggerLevel(child.getName())); assertTrue(mbean.setLoggerLevel(child.getName(), "INFO")); assertEquals(JettyLevel.INFO, child.getLevel()); }
Source:
public static Type getIterableElementType(Type context, Class<?> contextRawType) { Type collectionType = getSupertype(context, contextRawType, Iterable.class); if (collectionType instanceof WildcardType) { collectionType = ((WildcardType)collectionType).getUpperBounds()[0]; } if (collectionType instanceof ParameterizedType) { return ((ParameterizedType) collectionType).getActualTypeArguments()[0]; } return Object.class; }

Target:
public static Type getIterableElementType(Type context, Class<?> contextRawType) { Type iterableType = getSupertype(context, contextRawType, Iterable.class); if (iterableType instanceof WildcardType) { iterableType = ((WildcardType)iterableType).getUpperBounds()[0]; } if (iterableType instanceof ParameterizedType) { return ((ParameterizedType) iterableType).getActualTypeArguments()[0]; } return Object.class; }
Source:
private GetMapRequest parseAssociatedGetMap(LegendRequest legend, Rule[] rules) throws Exception { Map<String, Object> kvp = new CaseInsensitiveMap(request.getKvp()); Map<String, String> rawKvp = new CaseInsensitiveMap(request.getRawKvp()); String layerName = getLayerName(legend); kvp.put("LAYERS", layerName); rawKvp.put("LAYERS", layerName); kvp.put("STYLES", ""); rawKvp.put("STYLES", ""); rawKvp.put("WIDTH", rawKvp.get("SRCWIDTH")); rawKvp.put("HEIGHT", rawKvp.get("SRCHEIGHT")); rawKvp.putIfAbsent("HEIGHT", String.valueOf(GetLegendGraphicRequest.DEFAULT_HEIGHT)); rawKvp.putIfAbsent("WIDTH", String.valueOf(GetLegendGraphicRequest.DEFAULT_WIDTH)); kvp.putIfAbsent("HEIGHT", String.valueOf(GetLegendGraphicRequest.DEFAULT_HEIGHT)); kvp.putIfAbsent("WIDTH", String.valueOf(GetLegendGraphicRequest.DEFAULT_WIDTH)); rawKvp.putIfAbsent("BBOX", legend.getLayerInfo().getResource().boundingBox().toString()); kvp.putIfAbsent("BBOX", legend.getLayerInfo().getResource().boundingBox()); final Map formatOptions = (Map) kvp.get("FORMAT_OPTIONS"); if(formatOptions != null) { formatOptions.remove("layout"); } GetMapRequest getMap = getMapReader.read(getMapReader.createRequest(), kvp, rawKvp); Style style = buildStyleFromRules(rules); getMap.setStyles(Arrays.asList(style)); return getMap; }

Target:
private GetMapRequest parseAssociatedGetMap(LegendRequest legend, Rule[] rules) throws Exception { Map<String, Object> kvp = new CaseInsensitiveMap(request.getKvp()); Map<String, String> rawKvp = new CaseInsensitiveMap(request.getRawKvp()); String layerName = getLayerName(legend); kvp.put("LAYERS", layerName); rawKvp.put("LAYERS", layerName); kvp.put("STYLES", ""); rawKvp.put("STYLES", ""); rawKvp.put("WIDTH", rawKvp.get("SRCWIDTH")); rawKvp.put("HEIGHT", rawKvp.get("SRCHEIGHT")); rawKvp.putIfAbsent("HEIGHT", String.valueOf(GetLegendGraphicRequest.DEFAULT_HEIGHT)); rawKvp.putIfAbsent("WIDTH", String.valueOf(GetLegendGraphicRequest.DEFAULT_WIDTH)); kvp.putIfAbsent("HEIGHT", String.valueOf(GetLegendGraphicRequest.DEFAULT_HEIGHT)); kvp.putIfAbsent("WIDTH", String.valueOf(GetLegendGraphicRequest.DEFAULT_WIDTH)); rawKvp.putIfAbsent("BBOX", legend.getLayerInfo().getResource().boundingBox().toString()); kvp.putIfAbsent("BBOX", legend.getLayerInfo().getResource().boundingBox()); rawKvp.putIfAbsent("SRS", legend.getLayerInfo().getResource().getSRS()); kvp.putIfAbsent("SRS", legend.getLayerInfo().getResource().getSRS()); final Map formatOptions = (Map) kvp.get("FORMAT_OPTIONS"); if(formatOptions != null) { formatOptions.remove("layout"); } GetMapRequest getMap = getMapReader.read(getMapReader.createRequest(), kvp, rawKvp); Style style = buildStyleFromRules(rules); getMap.setStyles(Arrays.asList(style)); return getMap; }
Source:
public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); if (!this.graphingEnabled){ return true; } for (int r = 0, n = getNumberOfRegexs(); r < n; r++) { String regexErrorMessage = regexErrorMessages.get(r); if (regexErrorMessage != null){ setErrorMessage(String.format("Expression \"%s\": %s", regularExpressionCombo.getItems()[r], regexErrorMessage)); return false; } } return true; }

Target:
public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); if (!this.graphingEnabled){ return true; } for (int r = 0, n = getNumberOfRegexs(); r < n; r++) { String regexErrorMessage = regexErrorMessages.get(r); if (regexErrorMessage != null){ setErrorMessage(MessageFormat.format(Messages.SystemTapScriptGraphOptionsTab_regexErrorMsgFormat, regularExpressionCombo.getItems()[r], regexErrorMessage)); return false; } } return true; }
Source:
public Patient readTransaction(long patientId, boolean allRecords) { LOG.trace("PatientDAO.readTransaction() -- begin"); Session session = null; List<Patient> queryList; Patient foundRecord = null; try { session = hibernateUtil.getSessionFactory().openSession(); LOG.info("Reading Record..."); Criteria aCriteria = session.createCriteria(Patient.class); aCriteria.add(Expression.eq("id", patientId)); queryList = aCriteria.list(); if (CollectionUtils.isNotEmpty(queryList)) { foundRecord = queryList.get(0); LOG.info("Lazy-initialize-Personnames: {}", foundRecord.getPersonnames().size()); if (allRecords) { LOG.info("Lazy-initialize-Addresses: {}", foundRecord.getAddresses().size()); LOG.info("Lazy-initialize-Identifiers: {}", foundRecord.getIdentifiers().size()); LOG.info("Lazy-initialize-Phonenumbers: {}", foundRecord.getPhonenumbers().size()); } } } catch (HibernateException | NullPointerException e) { LOG.error("Exception during read occured due to : {}", e.getMessage(), e); } finally { if (session != null) { try { session.flush(); session.close(); } catch (HibernateException e) { LOG.error("Exception while closing the session after a read: {}", e.getMessage(), e); } } } LOG.trace("PatientDAO.readTransaction() -- end"); return foundRecord; }

Target:
public Patient readTransaction(long patientId, boolean allRecords) { LOG.trace("PatientDAO.readTransaction() -- begin"); Session session = null; List<Patient> queryList; Patient foundRecord = null; try { session = getSessionFactory().openSession(); LOG.info("Reading Record..."); Criteria aCriteria = session.createCriteria(Patient.class); aCriteria.add(Expression.eq("id", patientId)); queryList = aCriteria.list(); if (CollectionUtils.isNotEmpty(queryList)) { foundRecord = queryList.get(0); foundRecord.getPersonnames(); if (allRecords) { foundRecord.getAddresses(); foundRecord.getIdentifiers(); foundRecord.getPhonenumbers(); } } } catch (HibernateException | NullPointerException e) { LOG.error("Exception during read occured due to : {}", e.getMessage(), e); } finally { HibernateUtil.closeSession(session, true); } LOG.trace("PatientDAO.readTransaction() -- end"); return foundRecord; }
Source:
public void setChoices(Object choices) { if (choices instanceof String) { setChoicesText((String) choices); return; } if (choices instanceof Collection) { this.choices = new ArrayList<>(); for (Object o : (Collection) choices) { if (o != null) { this.choices.add(o.toString()); } } return; } throw new IllegalArgumentException("expected String or Collection, but got " + choices); }

Target:
public void setChoices(Object choices) { if (choices instanceof String) { setChoicesText((String) choices); return; } if (choices instanceof List) { ArrayList<String> newChoices = new ArrayList<>(); for (Object o : (List) choices) { if (o != null) { newChoices.add(o.toString()); } } this.choices = newChoices; return; } throw new IllegalArgumentException("expected String or List, but got " + choices.getClass().getName()); }
Source:
public void run() { mImportController.importDB(uri, new IImportController.IImportControllerCallback() { @Override public void onComplete() { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onComplete(); } }); } @Override public void onError(Throwable throwable) { throwable.printStackTrace(); mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onImportError(); } }); } }); }

Target:
public void run() { mImportController.importDB(uri, new IImportController.IImportControllerCallback() { @Override public void onComplete() { notifyOnComplete(); } @Override public void onError(Throwable throwable) { throwable.printStackTrace(); notifyOnError(); } }); }
Source:
private void initAttestation() { List<Cluster> clusters = dbFacade.getClusterDao().getTrustedClusters(); List<VDS> trustedVdsList = new ArrayList<>(); List<String> trustedVdsNames = new ArrayList<>(); if (clusters == null || clusters.size() == 0) { return; } for (Cluster cluster : clusters) { List<VDS> vdssInGroup = dbFacade.getVdsDao(). getAllForClusterWithStatus(cluster.getId(), VDSStatus.Up); if (vdssInGroup != null) { trustedVdsList.addAll(vdssInGroup); } } for (VDS vds : trustedVdsList) { trustedVdsNames.add(vds.getHostName()); setNonOperational(NonOperationalReason.UNINITIALIZED, vds); } try { AttestThread attestThread = new AttestThread(trustedVdsNames); attestThread.start(); } catch (Exception e) { log.error("Failed to initialize attestation cache", e); } }

Target:
private void initAttestation() { List<Cluster> clusters = dbFacade.getClusterDao().getTrustedClusters(); List<VDS> trustedVdsList = new ArrayList<>(); List<String> trustedVdsNames = new ArrayList<>(); if (clusters == null || clusters.size() == 0) { return; } for (Cluster cluster : clusters) { List<VDS> hostsInCluster = dbFacade.getVdsDao(). getAllForClusterWithStatus(cluster.getId(), VDSStatus.Up); if (hostsInCluster != null) { trustedVdsList.addAll(hostsInCluster); } } for (VDS vds : trustedVdsList) { trustedVdsNames.add(vds.getHostName()); setNonOperational(NonOperationalReason.UNINITIALIZED, vds); } try { AttestThread attestThread = new AttestThread(trustedVdsNames); attestThread.start(); } catch (Exception e) { log.error("Failed to initialize attestation cache", e); } }
Source:
public static @Nullable Set<Integer> getThreadsOfCpus(KernelAnalysisModule module, List<Long> cpus, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } Set<Integer> set = new HashSet<>(); for (Long cpu : cpus) { List<ITmfStateInterval> intervals = null; try { int threadQuark = ss.getQuarkAbsolute(Attributes.CPUS, cpu.toString(), Attributes.CURRENT_THREAD); intervals = StateSystemUtils.queryHistoryRange(ss, threadQuark, rangeStart, rangeEnd); } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { continue; } intervals.stream() .map(interval -> interval.getStateValue()) .filter(e -> !e.isNull()) .mapToInt(ITmfStateValue::unboxInt) .distinct() .filter(tid -> tid != 0) .forEach(e -> set.add(e)); } return set; }

Target:
public static @Nullable Set<Integer> getThreadsOfCpus(KernelAnalysisModule module, List<Long> cpus, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } Set<Integer> set = new HashSet<>(); for (Long cpu : cpus) { List<ITmfStateInterval> intervals = null; try { int threadQuark = ss.getQuarkAbsolute(Attributes.CPUS, cpu.toString(), Attributes.CURRENT_THREAD); intervals = StateSystemUtils.queryHistoryRange(ss, threadQuark, rangeStart, rangeEnd); } catch (AttributeNotFoundException e) { continue; } catch (StateSystemDisposedException e) { return null; } intervals.stream() .map(interval -> interval.getStateValue()) .filter(sv -> sv.getType() == Type.INTEGER) .mapToInt(ITmfStateValue::unboxInt) .filter(tid -> tid != 0) .forEach(e -> set.add(e)); } return set; }
Source:
public IStatus discardComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = 1; String id = item.getId(); if (id.startsWith("base-")) { id = id.substring(5); side = 0; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; DiscardDraftRequest request = new DiscardDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); request.setUuid(comment.getId()); GerritOperation<VoidResult> operation = getOperationFactory().createDiscardDraftOperation(getTask(), request); return operation.run(monitor); } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }

Target:
public IStatus discardComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = RIGHT_SIDE; String id = item.getId(); if (id.startsWith(BASE)) { id = id.substring(BASE.length()); side = LEFT_SIDE; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; DiscardDraftRequest request = new DiscardDraftRequest(key, lineLocation.getRangeMin(), side, comment.getId()); request.setMessage(comment.getDescription()); GerritOperation<VoidResult> operation = getOperationFactory().createDiscardDraftOperation(getTask(), request); return operation.run(monitor); } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }
Source:
public static BookieSocketAddress getBookieAddress(ServerConfiguration conf) throws UnknownHostException { String iface = conf.getListeningInterface(); if (iface == null) { iface = "default"; } InetSocketAddress inetAddr = new InetSocketAddress(DNS.getDefaultHost(iface), conf.getBookiePort()); String hostAddress = "127.0.0.1"; if (!inetAddr.isUnresolved()) { hostAddress = inetAddr.getAddress().getHostAddress(); if (conf.getUseHostNameAsBookieID()) { hostAddress = inetAddr.getAddress().getCanonicalHostName(); } } BookieSocketAddress addr = new BookieSocketAddress(hostAddress, conf.getBookiePort()); if (addr.getSocketAddress().getAddress().isLoopbackAddress() && !conf.getAllowLoopback()) { throw new UnknownHostException("Trying to listen on loopback address, " + addr + " but this is forbidden by default " + "(see ServerConfiguration#getAllowLoopback())"); } return addr; }

Target:
public static BookieSocketAddress getBookieAddress(ServerConfiguration conf) throws UnknownHostException { String iface = conf.getListeningInterface(); if (iface == null) { iface = "default"; } String hostName = DNS.getDefaultHost(iface); InetSocketAddress inetAddr = new InetSocketAddress(hostName, conf.getBookiePort()); if (inetAddr.isUnresolved()) { throw new UnknownHostException("Unable to resolve default hostname: " + hostName + " for interface: " + iface); } String hostAddress = inetAddr.getAddress().getHostAddress(); if (conf.getUseHostNameAsBookieID()) { hostAddress = inetAddr.getAddress().getCanonicalHostName(); } BookieSocketAddress addr = new BookieSocketAddress(hostAddress, conf.getBookiePort()); if (addr.getSocketAddress().getAddress().isLoopbackAddress() && !conf.getAllowLoopback()) { throw new UnknownHostException("Trying to listen on loopback address, " + addr + " but this is forbidden by default " + "(see ServerConfiguration#getAllowLoopback())"); } return addr; }
Source:
public String match(AbstractPlanNode node) { PlanNodeType mainNodeType = node.getPlanNodeType(); if (m_type != mainNodeType) { return String.format("PlanWithInlineNode: #xpected main plan node type %s, got %s", m_type, mainNodeType); } for (PlanNodeType nodeType : m_branches) { AbstractPlanNode inlineNode = node.getInlinePlanNode(nodeType); if (inlineNode == null) { return String.format("Expected inline node type %s but didn't find it.", nodeType.name()); } } if (m_branches.size() != node.getInlinePlanNodes().size()) { return String.format("Expected %d inline nodes, found %d", m_branches.size(), node.getInlinePlanNodes().size()); } return null; }

Target:
public String match(AbstractPlanNode node) { PlanNodeType mainNodeType = node.getPlanNodeType(); if (m_type != mainNodeType) { return String.format("PlanWithInlineNode: expected main plan node type %s, got %s", m_type, mainNodeType); } for (PlanNodeType nodeType : m_branches) { AbstractPlanNode inlineNode = node.getInlinePlanNode(nodeType); if (inlineNode == null) { return String.format("Expected inline node type %s but didn't find it.", nodeType.name()); } } if (m_branches.size() != node.getInlinePlanNodes().size()) { return String.format("Expected %d inline nodes, found %d", m_branches.size(), node.getInlinePlanNodes().size()); } return null; }
Source:
public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } @Override public byte[] createExtendedReconnectData() { return new byte[0]; } @Override public void didDisconnectUnexpectedly() { } }); }

Target:
public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; this.messageFactory = new LifeCycleMessageFactory(); endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { if (messageFromServer instanceof EhcacheEntityResponse) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } } @Override public byte[] createExtendedReconnectData() { return new byte[0]; } @Override public void didDisconnectUnexpectedly() { connected = false; fireDisconnectionEvent(); } }); }
Source:
public void testGetData() { if (particle.getType() != Effect.Type.PARTICLE) return; switch (particle) { case ITEM_BREAK: assertEquals("Wrong getData for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong data for " + particle, new int[]{Material.STONE.getId(), 1}, GlowParticle.getData(particle, STONE)); break; case TILE_BREAK: assertEquals("Wrong getData for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong data for " + particle, new int[]{4097}, GlowParticle.getData(particle, STONE)); break; case TILE_DUST: assertEquals("Wrong getData for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong data for " + particle, new int[]{Material.STONE.getId()}, GlowParticle.getData(particle, STONE)); break; default: assertEquals("Wrong getData for " + particle, false, particle.getData() != null); assertArrayEquals("Wrong data for " + particle, new int[0], GlowParticle.getData(particle, null)); } }

Target:
public void testGetData() { if (particle.getType() != Effect.Type.PARTICLE) return; switch (particle) { case ITEM_BREAK: assertEquals("Wrong data for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong extra data for " + particle, new int[]{Material.STONE.getId(), 1}, GlowParticle.getExtData(particle, STONE)); break; case TILE_BREAK: assertEquals("Wrong data for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong extra data for " + particle, new int[]{4097}, GlowParticle.getExtData(particle, STONE)); break; case TILE_DUST: assertEquals("Wrong data for " + particle, true, particle.getData() != null); assertArrayEquals("Wrong extra data for " + particle, new int[]{Material.STONE.getId()}, GlowParticle.getExtData(particle, STONE)); break; default: assertEquals("Wrong data for " + particle, false, particle.getData() != null); assertArrayEquals("Wrong extra data for " + particle, new int[0], GlowParticle.getExtData(particle, null)); } }
Source:
public SignatureKeyManager( @Named("che.auth.signature_key_size") int keySize, @Named("che.auth.signature_key_algorithm") String algorithm, EventService eventService, SignatureKeyDao signatureKeyDao) { this.keySize = keySize; this.algorithm = algorithm; this.eventService = eventService; this.signatureKeyDao = signatureKeyDao; this.workspaceEventsSubscriber = (org.eclipse.che.api.core.notification.EventSubscriber< org.eclipse.che.api.workspace.shared.dto.event.WorkspaceStatusEvent>) event -> { if (event.getStatus() == STOPPED) { removeKeyPair(event.getWorkspaceId()); } else if (event.getStatus() == STARTING) { generateKeyPair(event.getWorkspaceId()); } }; }

Target:
public SignatureKeyManager( @Named("che.auth.signature_key_size") int keySize, @Named("che.auth.signature_key_algorithm") String algorithm, EventService eventService, SignatureKeyDao signatureKeyDao) { this.keySize = keySize; this.algorithm = algorithm; this.eventService = eventService; this.signatureKeyDao = signatureKeyDao; this.workspaceEventsSubscriber = new EventSubscriber<WorkspaceStatusEvent>() { @Override public void onEvent(WorkspaceStatusEvent event) { if (event.getStatus() == STOPPED) { removeKeyPair(event.getWorkspaceId()); } } }; }
Source:
public SqlBitOpAggFunction(SqlKind kind) { super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.INTEGER, SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.BIT_AND || kind == SqlKind.BIT_OR); }

Target:
public SqlBitOpAggFunction(SqlKind kind) { super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.INTEGER, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.BIT_AND || kind == SqlKind.BIT_OR); }
Source:
public void testGetNetworkSelectionMode() { if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { return; } int networkMode = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager, (tm) -> tm.getNetworkSelectionMode()); assertEquals(2, networkMode); }

Target:
public void testGetNetworkSelectionMode() { if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { return; } int networkMode = mTelephonyManager.getNetworkSelectionMode(); assertEquals(0, networkMode); }
Source:
private void updateDefaultSelectedConsoleProtocol(final VM vm) { if (vm.getId() == null) { return; } final ArrayList<ConsoleModel> cachedModels = cachedConsoleModels.get(vm.getId()); if (cachedModels == null) { return; } deselectUserSelectedProtocol(vm.getId()); final boolean isWindowsExplorer = parentModel.getConfigurator().isClientWindowsExplorer(); Boolean hasSpiceSupport = AsyncDataProvider.hasSpiceSupport(vm.getOs(), vm.getVdsGroupCompatibilityVersion()); if (isWindowsExplorer && hasSpiceSupport != null && hasSpiceSupport.booleanValue()) { cachedModels.get(RDP_INDEX).setUserSelected(true); } else { determineConsoleModelFromVm(vm, cachedModels).setUserSelected(true); } setupSelectionContext(vm); }

Target:
private void updateDefaultSelectedConsoleProtocol(final VM vm) { if (vm.getId() == null) { return; } final ArrayList<ConsoleModel> cachedModels = cachedConsoleModels.get(vm.getId()); if (cachedModels == null) { return; } deselectUserSelectedProtocol(vm.getId()); final boolean isWindowsExplorer = parentModel.getConfigurator().isClientWindowsExplorer(); Boolean hasSpiceSupport = AsyncDataProvider.hasSpiceSupport(vm.getOs(), vm.getVdsGroupCompatibilityVersion()); if (isWindowsExplorer && hasSpiceSupport != null && hasSpiceSupport) { cachedModels.get(RDP_INDEX).setUserSelected(true); } else { determineConsoleModelFromVm(vm, cachedModels).setUserSelected(true); } setupSelectionContext(vm); }
Source:
private void ensureProjectExplorerPart() { PartStack navigationPartStack = workspaceAgent.getPartStack(NAVIGATION); PartPresenter activePart = navigationPartStack.getActivePart(); if (!(activePart instanceof ProjectExplorerPresenter)) { ProjectExplorerPresenter projectExplorerPresenter = projectExplorerPresenterProvider.get(); if (activePart == null) { workspaceAgent.openPart(projectExplorerPresenter, NAVIGATION); } workspaceAgent.setActivePart(projectExplorerPresenter); } }

Target:
private void ensureProjectExplorerPart() { PartStack navigationPartStack = workspaceAgent.getPartStack(NAVIGATION); PartPresenter activePart = navigationPartStack.getActivePart(); ProjectExplorerPresenter projectExplorerPresenter = projectExplorerPresenterProvider.get(); if (activePart == null) { workspaceAgent.openPart(projectExplorerPresenter, NAVIGATION); } if (!(activePart instanceof ProjectExplorerPresenter)) { workspaceAgent.setActivePart(projectExplorerPresenter); } }
Source:
public ConceptName getFullySpecifiedName(Locale locale) { if (locale != null && !getNames(locale).isEmpty()) { for (ConceptName conceptName : getNames(locale)) { if (ObjectUtils.nullSafeEquals(conceptName.isFullySpecifiedName(), true)) { return conceptName; } } ConceptName bestMatch = null; for (ConceptName conceptName : getPartiallyCompatibleNames(locale)) { if (ObjectUtils.nullSafeEquals(conceptName.isFullySpecifiedName(), true)) { Locale nameLocale = conceptName.getLocale(); if (locale.getLanguage().equals(nameLocale.getLanguage())) { return conceptName; } bestMatch = conceptName; } } return bestMatch; } return null; }

Target:
public ConceptName getFullySpecifiedName(Locale locale) { if (locale != null && CollectionUtils.isNotEmpty(getNames(locale))) { for (ConceptName conceptName : getNames(locale)) { if (ObjectUtils.nullSafeEquals(conceptName.isFullySpecifiedName(), true)) { return conceptName; } } ConceptName bestMatch = null; for (ConceptName conceptName : getPartiallyCompatibleNames(locale)) { if (ObjectUtils.nullSafeEquals(conceptName.isFullySpecifiedName(), true)) { Locale nameLocale = conceptName.getLocale(); if (locale.getLanguage().equals(nameLocale.getLanguage())) { return conceptName; } bestMatch = conceptName; } } return bestMatch; } return null; }
Source:
String getBuilderClassName(@NotNull PsiClass psiClass, String returnTypeName) { final ConfigDiscovery configDiscovery = ConfigDiscovery.getInstance(); final String builderClassNamePattern = configDiscovery.getStringLombokConfigProperty(BUILDER_CLASS_NAME, psiClass); return StringUtil.replace(builderClassNamePattern, "*", returnTypeName); }

Target:
String getBuilderClassName(@NotNull PsiClass psiClass, String returnTypeName) { final ConfigDiscovery configDiscovery = ConfigDiscovery.getInstance(); final String builderClassNamePattern = configDiscovery.getStringLombokConfigProperty(BUILDER_CLASS_NAME, psiClass); return replace(builderClassNamePattern, "*", capitalize(returnTypeName)); }
Source:
public T build() { T result = createMessage(messageClass); ((Message) result).tags.addAll(tags); if (((Message) result).tags.isEmpty()) { Set<String> defaultTags = result.getDefaultTags(); if (defaultTags != null) { ((Message) result).tags.addAll(defaultTags); } } if (text != null) { ((Message) result).text = text; } if (cssClass != null) { ((Message) result).cssClass = cssClass; } else { ((Message) result).cssClass = result.getDefaultCssClass(); } if (duration != null) { ((Message) result).duration = duration; } return result; }

Target:
public T build() { T result = createMessage(messageClass); fillData(result); return result; }
Source:
public static BriefcaseAnalytics getInstance() { return instance == null ? new BriefcaseAnalytics() : instance; }

Target:
public static BriefcaseAnalytics getInstance() { return instance == null ? (instance = new BriefcaseAnalytics()) : instance; }
Source:
public Comment createComment(CoreSession session, Comment comment) throws IllegalArgumentException { if (!session.exists(new IdRef(comment.getDocumentId()))) { throw new IllegalArgumentException("The document " + comment.getDocumentId() + " does not exist."); } return CoreInstance.doPrivileged(session, s -> { DocumentModel commentModel = s.createDocumentModel(COMMENT_DOC_TYPE); commentModel.setPropertyValue(COMMENT_AUTHOR, comment.getAuthor()); commentModel.setPropertyValue(COMMENT_TEXT, comment.getText()); commentModel.setPropertyValue(COMMENT_DOCUMENT_ID, comment.getDocumentId()); commentModel.setPropertyValue(COMMENT_CREATION_DATE, comment.getCreationDate()); commentModel.setPropertyValue(COMMENT_MODIFICATION_DATE, comment.getModificationDate()); commentModel = s.createDocument(commentModel); Comment createdComment = new CommentImpl(); Comments.documentModelToComment().accept(commentModel, createdComment); return createdComment; }); }

Target:
public Comment createComment(CoreSession session, Comment comment) throws IllegalArgumentException { if (!session.exists(new IdRef(comment.getDocumentId()))) { throw new IllegalArgumentException("The document " + comment.getDocumentId() + " does not exist."); } return CoreInstance.doPrivileged(session, s -> { DocumentModel commentModel = s.createDocumentModel(COMMENT_DOC_TYPE); commentModel.setPropertyValue(COMMENT_AUTHOR, comment.getAuthor()); commentModel.setPropertyValue(COMMENT_TEXT, comment.getText()); commentModel.setPropertyValue(COMMENT_DOCUMENT_ID, comment.getDocumentId()); commentModel.setPropertyValue(COMMENT_CREATION_DATE, comment.getCreationDate()); commentModel.setPropertyValue(COMMENT_MODIFICATION_DATE, comment.getModificationDate()); if (comment instanceof ExternalEntity) { commentModel.setPropertyValue(EXTERNAL_ENTITY_ID_PROPERTY, ((ExternalEntity) comment).getEntityId()); commentModel.setPropertyValue(EXTERNAL_ENTITY_ORIGIN_PROPERTY, ((ExternalEntity) comment).getOrigin()); commentModel.setPropertyValue(EXTERNAL_ENTITY_PROPERTY, ((ExternalEntity) comment).getEntity()); commentModel = s.createDocument(commentModel); Comment createdComment = new CommentImpl(); Comments.documentModelToExternalComment().accept(commentModel, createdComment); return createdComment; } commentModel = s.createDocument(commentModel); Comment createdComment = new CommentImpl(); Comments.documentModelToComment().accept(commentModel, createdComment); return createdComment; }); }
Source:
protected void onUnload() { if (regNavigation != null) { regNavigation.removeHandler(); regNavigation = null; } if (regAction != null) { regAction.removeHandler(); regAction = null; } detailCache.removeValueChangeHandler(this); super.onUnload(); }

Target:
protected void onUnload() { if (regNavigation != null) { regNavigation.removeHandler(); regNavigation = null; } if (regAction != null) { regAction.removeHandler(); regAction = null; } if (regDetailCache != null) { regDetailCache.removeHandler(); regDetailCache = null; } super.onUnload(); }
Source:
public static Kind fromBinaryType(int binaryType) { Kind kind = BINARYTYPE_KINDS.get(new Integer(binaryType)); Preconditions.checkArgument(kind != null); return kind; }

Target:
public static Kind fromBinaryType(int binaryType) { Kind kind = BINARYTYPE_KINDS.get(binaryType); Preconditions.checkArgument(kind != null); return kind; }
Source:
private boolean canExecute(final String runScriptFile) { try { return retryTemplate.execute(c -> { FileUtils.touch(new File(runScriptFile)); return true; }); } catch (Exception e) { log.warn("Failed touching the run script file", e); } return false; }

Target:
private boolean canExecute(final String runScriptFile) { try { return retryTemplate.execute(c -> { FileUtils.touch(new File(runScriptFile)); return true; }); } catch (Exception e) { registry.counter("genie.jobs.tasks.jobKickoffTask.run.failure").increment(); log.warn("Failed touching the run script file", e); } return false; }
Source:
public Map<String, List<Integer>> readLineCoverage() { JacocoBuildAction jacocoAction = getJacocoBuildAction(); JacocoPublisher jacocoPublisher = getJacocoPublisher(); if (jacocoAction == null || jacocoPublisher == null) { return null; } HashMap<String, List<Integer>> lineCoverage = new HashMap<String, List<Integer>>(); String[] includes = null; if (jacocoPublisher.getInclusionPattern() != null) { includes = new String[] {jacocoPublisher.getInclusionPattern()}; } String[] excludes = null; if (jacocoPublisher.getExclusionPattern() != null) { excludes = new String[] {jacocoPublisher.getExclusionPattern()}; } try { ExecutionFileLoader executionFileLoader = jacocoAction.getJacocoReport().parse(includes, excludes); for (IPackageCoverage packageCoverage : executionFileLoader.getBundleCoverage().getPackages()) { for (IClassCoverage classCoverage : packageCoverage.getClasses()) { String relativePathFromProjectRoot = getRelativePathFromProjectRoot( classCoverage.getSourceFileName()); if (relativePathFromProjectRoot != null) { lineCoverage.put(relativePathFromProjectRoot, getPerLineCoverage(classCoverage)); } } } } catch (IOException e) { e.printStackTrace(); return null; } return lineCoverage; }

Target:
public Map<String, List<Integer>> readLineCoverage() { JacocoBuildAction jacocoAction = getJacocoBuildAction(); JacocoPublisher jacocoPublisher = getJacocoPublisher(); if (jacocoAction == null || jacocoPublisher == null) { return null; } HashMap<String, List<Integer>> lineCoverage = new HashMap<String, List<Integer>>(); String[] includes = null; if (jacocoPublisher.getInclusionPattern() != null) { includes = new String[] {jacocoPublisher.getInclusionPattern()}; } String[] excludes = null; if (jacocoPublisher.getExclusionPattern() != null) { excludes = new String[] {jacocoPublisher.getExclusionPattern()}; } try { ExecutionFileLoader executionFileLoader = jacocoAction.getJacocoReport().parse(includes, excludes); for (IPackageCoverage packageCoverage : executionFileLoader.getBundleCoverage().getPackages()) { for (ISourceFileCoverage fileCoverage : packageCoverage.getSourceFiles()) { String relativePathFromProjectRoot = getRelativePathFromProjectRoot(fileCoverage.getPackageName() + "/" + fileCoverage.getName()); if (relativePathFromProjectRoot != null) { lineCoverage.put(relativePathFromProjectRoot, getPerLineCoverage(fileCoverage)); } } } } catch (IOException e) { e.printStackTrace(); return null; } return lineCoverage; }
Source:
public void create_instance_by_hours_offset() { final int secondsInTwoHours = SECONDS_PER_MINUTE * MINUTES_PER_HOUR * 2; assertEquals(secondsInTwoHours, ZoneOffsets.ofHours(2) .getAmountSeconds()); }

Target:
public void create_instance_by_hours_offset() { final int secondsInTwoHours = secondsInHours(2); assertEquals(secondsInTwoHours, ZoneOffsets.ofHours(2) .getAmountSeconds()); }
Source:
public final Long countRoles(String filter) throws UserStoreException { if (!isSecureCall.get()) { Class[] argTypes = new Class[]{String.class}; Object object = callSecure("countRoles", new Object[]{filter}, argTypes); return (Long) object; } int index; Long countRoles; String domain = null; index = filter.indexOf(CarbonConstants.DOMAIN_SEPARATOR); if (index > 0) { domain = filter.substring(0, index); filter = filter.substring(index + 1); UserStoreManager SecondaryUserStoreManager = getSecondaryUserStoreManager(domain); if (SecondaryUserStoreManager != null) { if (SecondaryUserStoreManager instanceof AbstractUserStoreManager) { return ((AbstractUserStoreManager) SecondaryUserStoreManager).doCountRoles(filter); } else { return null; } } } else if (index == 0) { countRoles = doCountRoles(filter.substring(1)); return countRoles; } try { if (domain != null) { if (domain.equals("Internal") || domain.equals("Application")) { filter = domain + "%" + filter; } } countRoles = doCountRoles(filter); } catch (UserStoreException ex) { handleGetUserCountFailure(ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT.getCode(), String.format(ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT.getMessage(), ex.getMessage()), null, null); throw ex; } return countRoles; }

Target:
public long countRoles(String filter) throws UserStoreException { if (!isSecureCall.get()) { Class[] argTypes = new Class[]{String.class}; Object object = callSecure("countRoles", new Object[]{filter}, argTypes); return (long) object; } int index; index = filter.indexOf(CarbonConstants.DOMAIN_SEPARATOR); if (index > 0) { String domain = filter.substring(0, index); if (isInternalRole(domain)) { return doCountRoles(filter); } filter = filter.substring(index + 1); UserStoreManager secondaryUserStoreManager = getSecondaryUserStoreManager(domain); if (secondaryUserStoreManager != null) { if (secondaryUserStoreManager instanceof AbstractUserStoreManager) { return ((AbstractUserStoreManager) secondaryUserStoreManager).doCountRoles(filter); } else { throw new UserStoreException("User store not supported"); } } } else if (index == 0) { return doCountRoles(filter.substring(1)); } return doCountRoles(filter); }
Source:
public void onRestoreInstanceState(Bundle bundle) { super.onRestoreInstanceState(bundle); BaseShape baseShape = (BaseShape) bundle.getSerializable(BUNDLE_BASE_SHAPE); ShapeDrawType shapeDrawType = (ShapeDrawType) bundle.getSerializable(BUNDLE_SHAPE_DRAW_TYPE); int shapeOutlineWidth = (int) bundle.getSerializable(BUNDLE_OUTLINE_WIDTH); if (baseShape != null && shapeDrawType != null && (this.baseShape != baseShape || this.shapeDrawType != shapeDrawType)) { this.baseShape = baseShape; this.shapeDrawType = shapeDrawType; this.shapeOutlineWidth = shapeOutlineWidth; shapeToolOptionsListener.setShapeActivated(baseShape); shapeToolOptionsListener.setDrawTypeActivated(shapeDrawType); shapeToolOptionsListener.setShapeOutlineWidth(shapeOutlineWidth); createAndSetBitmap(); } }

Target:
public void onRestoreInstanceState(Bundle bundle) { super.onRestoreInstanceState(bundle); BaseShape baseShape = (BaseShape) bundle.getSerializable(BUNDLE_BASE_SHAPE); ShapeDrawType shapeDrawType = (ShapeDrawType) bundle.getSerializable(BUNDLE_SHAPE_DRAW_TYPE); int shapeOutlineWidth = bundle.getInt(BUNDLE_OUTLINE_WIDTH); if (baseShape != null && shapeDrawType != null && (this.baseShape != baseShape || this.shapeDrawType != shapeDrawType)) { this.baseShape = baseShape; this.shapeDrawType = shapeDrawType; this.shapeOutlineWidth = shapeOutlineWidth; shapeToolOptionsListener.setShapeActivated(baseShape); shapeToolOptionsListener.setDrawTypeActivated(shapeDrawType); shapeToolOptionsListener.setShapeOutlineWidth(shapeOutlineWidth); createAndSetBitmap(); } }
Source:
public SupremeCourtChamber getOrCreateScChamber(String chamberName) { Preconditions.checkArgument(!StringUtils.isBlank(chamberName)); SupremeCourtChamber scChamber = scChamberRepository.findOneByName(chamberName); if (scChamber == null) { scChamber = new SupremeCourtChamber(); scChamber.setName(chamberName); scChamberRepository.saveAndFlush(scChamber); } return scChamber; }

Target:
public SupremeCourtChamber getOrCreateScChamber(String chamberName) { Preconditions.checkArgument(StringUtils.isNotBlank(chamberName)); SupremeCourtChamber scChamber = scChamberRepository.findOneByName(chamberName); if (scChamber == null) { scChamber = new SupremeCourtChamber(); scChamber.setName(chamberName); scChamberRepository.saveAndFlush(scChamber); } return scChamber; }
Source:
public boolean delete( final ConcreteResource resource, final EventMetadata eventMetadata ) throws TransferException { final Transfer item = getCacheReference( resource ); if ( !resource.allowsDeletion() ) { throw new TransferException( "Deletion not allowed for: {}", resource ); } return doDelete( item, eventMetadata ); }

Target:
public boolean delete( final ConcreteResource resource, final EventMetadata eventMetadata ) throws TransferException { if ( !resource.allowsDeletion() ) { throw new TransferException( "Deletion not allowed for: {}", resource ); } final Transfer item = getCacheReference( resource ); return doDelete( item, eventMetadata ); }
Source:
public void scan() { HttpMessage message = getNewMsg(); try { sendAndReceive(message); if (message.getResponseHeader().getStatusCode() != HttpStatusCode.FORBIDDEN) { return; } URI uri = message.getRequestHeader().getURI(); String host = uri.getEscapedAuthority(); String path = uri.getEscapedPath(); String schema = uri.getScheme(); if (sendPathPayloads(path, host, schema, uri)) { return; } ; if (sendHeaderPayloads(path, host, schema, uri)) { return; } ; } catch (IOException e) { LOG.warn(e.getMessage(), e); } }

Target:
public void scan() { HttpMessage message = getNewMsg(); try { sendAndReceive(message); if (message.getResponseHeader().getStatusCode() != HttpStatusCode.FORBIDDEN) { return; } URI uri = message.getRequestHeader().getURI(); String host = uri.getEscapedAuthority(); String path = uri.getEscapedPath(); String schema = uri.getScheme(); if (sendPathPayloads(path, host, schema, uri)) { return; } if (sendHeaderPayloads(path, host, schema, uri)) { return; } } catch (IOException e) { LOG.warn(e.getMessage(), e); } }
Source:
public DocumentModelListImpl fetchDocuments() { DocumentModelListImpl ret = new DocumentModelListImpl(getResponse().getHits().getHits().length); DocumentModel doc; String sid = getSession().getSessionId(); for (SearchHit hit : getResponse().getHits()) { doc = DocumentModelReaders.fromSource(hit.getSource()).sid(sid).getDocumentModel(); Map<String, HighlightField> esHighlights = hit.highlightFields(); if (!esHighlights.isEmpty()) { Map<String, List<String>> fields = new HashMap<>(); for (String field : esHighlights.keySet()) { fields.put(field, new ArrayList<>()); for (Text fragment : esHighlights.get(field).getFragments()) { fields.get(field).add(fragment.toString()); } } doc.putContextData(HIGHLIGHT_CTX_DATA, (Serializable) fields); } ret.add(doc); } return ret; }

Target:
public DocumentModelListImpl fetchDocuments() { DocumentModelListImpl ret = new DocumentModelListImpl(getResponse().getHits().getHits().length); DocumentModel doc; String sid = getSession().getSessionId(); for (SearchHit hit : getResponse().getHits()) { doc = DocumentModelReaders.fromSource(hit.getSource()).sid(sid).getDocumentModel(); Map<String, HighlightField> esHighlights = hit.highlightFields(); if (!esHighlights.isEmpty()) { Map<String, List<String>> fields = new HashMap<>(); for (Map.Entry<String, HighlightField> entry : esHighlights.entrySet()) { String field = entry.getKey(); List<String> list = new ArrayList<>(); for (Text fragment : entry.getValue().getFragments()) { list.add(fragment.toString()); } fields.put(field, list); } doc.putContextData(HIGHLIGHT_CTX_DATA, (Serializable) fields); } ret.add(doc); } return ret; }