auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Optional<JmxDump> getJMXDump() { out.println( "Finding running instance of neo4j" ); Optional<Long> pid = getPid(); if ( pid.isPresent() ) { try { LocalVirtualMachine vm = LocalVirtualMachine.from( pid.get() ); out.println( "Attached to running process with process id " + pid.get() ); try { JmxDump jmxDump = JmxDump.connectTo( vm.getJmxAddress() ); jmxDump.attachSystemProperties( vm.getSystemProperties() ); out.println( "Connected to JMX endpoint" ); return Optional.of( jmxDump ); } catch ( IOException e ) { printError( "Unable to communicate with JMX endpoint. Reason: " + e.getMessage(), e ); } } catch ( Throwable e ) { if ( e instanceof IOException ) { printError( "Unable to connect to process. Reason: " + e.getMessage(), e ); } else if ( e instanceof java.lang.NoClassDefFoundError ) { printError( "Unable to attach to process. Reason: JDK is not available, please point " + "environment variable JAVA_HOME to a valid JDK location.", e); } else { throw new RuntimeException( e ); } } } else { out.println( "No running instance of neo4j was found. Online reports will be omitted." ); } return Optional.empty(); }

Target:
public Optional<JmxDump> getJMXDump() { out.println( "Finding running instance of neo4j" ); Optional<Long> pid = getPid(); if ( pid.isPresent() ) { try { LocalVirtualMachine vm = LocalVirtualMachine.from( pid.get() ); out.println( "Attached to running process with process id " + pid.get() ); try { JmxDump jmxDump = JmxDump.connectTo( vm.getJmxAddress() ); jmxDump.attachSystemProperties( vm.getSystemProperties() ); out.println( "Connected to JMX endpoint" ); return Optional.of( jmxDump ); } catch ( IOException e ) { printError( "Unable to communicate with JMX endpoint. Reason: " + e.getMessage(), e ); } } catch ( java.lang.NoClassDefFoundError e ) { printError( "Unable to attach to process. Reason: JDK is not available, please point " + "environment variable JAVA_HOME to a valid JDK location.", e); } catch ( IOException e ) { printError( "Unable to connect to process. Reason: " + e.getMessage(), e ); } } else { out.println( "No running instance of neo4j was found. Online reports will be omitted." ); } return Optional.empty(); }
Source:
private static boolean sameConstraintWhenSameProgramPoint(ExplodedGraph.Node currentNode, Symbol symbol, Class<? extends Constraint> domain) { ProgramState programState = currentNode.programState; SymbolicValue sv = programState.getValue(symbol); if (sv == null) { return false; } Constraint constraint = programState.getConstraint(sv, domain); if (constraint == null) { return false; } Collection<Node> siblingNodes = currentNode.siblings(); return siblingNodes.isEmpty() || siblingNodes.stream() .map(node -> node.programState) .allMatch(ps -> { SymbolicValue siblingSV = ps.getValue(symbol); if (siblingSV == null) { return false; } Constraint siblingConstraint = ps.getConstraint(siblingSV, domain); return constraint.equals(siblingConstraint); }); }

Target:
private static boolean sameConstraintWhenSameProgramPoint(ExplodedGraph.Node currentNode, Symbol symbol, Class<? extends Constraint> domain) { ProgramState programState = currentNode.programState; SymbolicValue sv = programState.getValue(symbol); if (sv == null) { return false; } Constraint constraint = programState.getConstraint(sv, domain); if (constraint == null) { return false; } Collection<Node> siblingNodes = currentNode.siblings(); return siblingNodes.stream() .map(node -> node.programState) .allMatch(ps -> { SymbolicValue siblingSV = ps.getValue(symbol); if (siblingSV == null) { return false; } Constraint siblingConstraint = ps.getConstraint(siblingSV, domain); return constraint.equals(siblingConstraint); }); }
Source:
public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final StreamJoined<K, V, VO> streamJoined) { return doJoin( otherStream, joiner, windows, streamJoined, new KStreamImplJoin(this, false, false) ); }

Target:
public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final StreamJoined<K, V, VO> streamJoined) { return doJoin(otherStream, joiner, windows, streamJoined, new KStreamImplJoin(builder, false, false) ); }
Source:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime > stateSystem.getCurrentEndTime()) { stateSystem.waitUntilBuilt(500); } while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue.unboxLong(), depth); boolean findChildren = findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor); fRootFunctions.add(segment); if (!findChildren) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }

Target:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue.unboxLong(), depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }
Source:
private Table addDataForTesting(String rowKeyPrefix, byte[] qualA) throws IOException { Table table = getConnection().getTable(TABLE_NAME); for (int i = 0; i < 100; i++) { String indexStr = String.valueOf(i); byte[] rowKey = Bytes.toBytes(rowKeyPrefix + indexStr); Put put = new Put(rowKey).addColumn(COLUMN_FAMILY, qualA, Bytes.toBytes(indexStr)); table.put(put); } return table; }

Target:
private Table addDataForTesting(String rowKeyPrefix, byte[] qualA) throws IOException { Table table = getConnection().getTable(TABLE_NAME); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 100; i++) { String indexStr = String.valueOf(i); byte[] rowKey = Bytes.toBytes(rowKeyPrefix + indexStr); puts.add(new Put(rowKey).addColumn(COLUMN_FAMILY, qualA, Bytes.toBytes(indexStr))); } table.put(puts); return table; }
Source:
public <T> T getInitParameter(String name, Class<T> clazz) { Object o = properties.get(name); if (o != null) { if (clazz.isInstance(o)) { return (T) properties.get(name); } else throw new ClassCastException(name + " property is not of type " + clazz.getCanonicalName()); } else return null; }

Target:
public <T> T getInitParameter(String name, Class<T> clazz) { Object o = properties.get(name); if (o != null) { if (clazz.isInstance(o)) { return (T) properties.get(name); } else { throw new ClassCastException(name + " property is not of type " + clazz.getCanonicalName()); } } else { return null; } }
Source:
protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor) throws GerritException { PatchSetDetail patchSetDetail = null; if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getPatchSetDetail(idBase, idTarget, monitor); } else { patchSetDetail = new PatchSetDetail(); CommitInfo commitInfo = retrieveCommitInfo(idTarget, monitor); patchSetDetail.setInfo(adaptRestPatchSetInfo(commitInfo, idTarget)); patchSetDetail.setPatchSet(adaptRestPatchSet(commitInfo, idTarget)); patchSetDetail.setPatches(adaptRestPatches(idTarget, monitor)); } return patchSetDetail; }

Target:
protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor) throws GerritException { if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getPatchSetDetail(idBase, idTarget, monitor); } PatchSetDetail patchSetDetail = new PatchSetDetail(); CommitInfo commitInfo = retrieveCommitInfo(idTarget, monitor); patchSetDetail.setInfo(adaptRestPatchSetInfo(commitInfo, idTarget)); patchSetDetail.setPatchSet(adaptRestPatchSet(commitInfo, idTarget)); patchSetDetail.setPatches(adaptRestPatches(idTarget, monitor)); return patchSetDetail; }
Source:
private Artifact getTopContainer() throws OseeCoreException { Artifact root = null; if (this.equals(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch()))) { root = this; } else { for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) { root = parent; } } return root; }

Target:
private Artifact getTopContainer() throws OseeCoreException { Artifact root = null; if (this.equals(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch()))) { root = this; } else { Set<Artifact> set = new HashSet<Artifact>(); set.add(this); for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) { if (set.add(parent)) { root = parent; } else { OseeLog.log(Activator.class, Level.SEVERE, String.format("Cycle detected with artifact: %s", parent)); root = null; break; } } } return root; }
Source:
private void restoreNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); if (noteId == null) { return; } NotebookService notebookService = new NotebookService(notebook()); notebookService.restoreNote(noteId, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn)); }

Target:
private void restoreNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); if (noteId == null) { return; } getNotebookService().restoreNote(noteId, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn)); }
Source:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace("@ENGINE_ETC@", ENGINE_ETC), "properties" ); } for(File f : files) { logger.debug("Loading extension file '{}'", f.getName()); try { proxies.put(extensionsManager.load(f), null); } catch (Exception ex) { logger.error(ex.getMessage()); logger.debug("Exception:", ex); } } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); logger.debug("Extension '{}' initilized", entry.getKey()); } }

Target:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace("@ENGINE_ETC@", ENGINE_ETC), "properties" ); } for(File f : files) { logger.debug("Loading extension file '{}'", f.getName()); try { proxies.put(extensionsManager.load(f), null); } catch (Exception ex) { logger.error("Can't load extension '{}', ignoring.", f.getName()); logger.debug("Exception:", ex); } } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); logger.debug("Extension '{}' initilized", entry.getKey()); } }
Source:
public static ConfigSyntax syntaxFromExtension(String filename) { if (filename == null) return null; if (filename.endsWith(".json")) return ConfigSyntax.JSON; else if (filename.endsWith(".conf")) return ConfigSyntax.CONF; else if (filename.endsWith(".properties")) return ConfigSyntax.PROPERTIES; else return null; }

Target:
public static ConfigSyntax syntaxFromExtension(String filename) { if (filename == null) return null; else if (filename.endsWith(".json")) return ConfigSyntax.JSON; else if (filename.endsWith(".conf")) return ConfigSyntax.CONF; else if (filename.endsWith(".properties")) return ConfigSyntax.PROPERTIES; else return null; }
Source:
public void onRecipeCraftedEvent(OnRecipeCrafted event, EntityRef entity) { EntityRef ingredients[] = event.getIngredients(); LOGGER.info(ingredients[0].getComponent(GenomeComponent.class).genes); LOGGER.info(ingredients[1].getComponent(GenomeComponent.class).genes); LOGGER.info(entity.toString()); SimpleGenomeManager genomeManager = new SimpleGenomeManager(); boolean result = genomeManager.applyBreeding(ingredients[0], ingredients[1], entity); LOGGER.info(result + ""); if (entity.hasComponent(GenomeComponent.class)) { GenomeMap genomeMap = genomeRegistry.getGenomeDefinition(entity.getComponent(GenomeComponent.class).genomeId).getGenomeMap(); float newFilling = genomeMap.getProperty("filling", entity.getComponent(GenomeComponent.class).genes, Float.class); entity.send(new ModifyFilling(newFilling)); } }

Target:
public void onRecipeCraftedEvent(OnRecipeCrafted event, EntityRef entity) { EntityRef ingredients[] = event.getIngredients(); if (ingredients.length != 2) { return; } if (!(ingredients[0].hasComponent(GenomeComponent.class) || ingredients[1].hasComponent(GenomeComponent.class))) { return; } SimpleGenomeManager genomeManager = new SimpleGenomeManager(); boolean result = genomeManager.applyBreeding(ingredients[0], ingredients[1], entity); if (entity.hasComponent(GenomeComponent.class)) { GenomeMap genomeMap = genomeRegistry.getGenomeDefinition(entity.getComponent(GenomeComponent.class).genomeId).getGenomeMap(); float newFilling = genomeMap.getProperty("filling", entity.getComponent(GenomeComponent.class).genes, Float.class); entity.send(new ModifyFilling(newFilling)); } }
Source:
public Vector2 worldToScreen(SolShip ship) { Vector2 distanceDifference = new Vector2(this.getPosition()); distanceDifference.sub(ship.getPosition()); distanceDifference.x /= this.getViewWidth(); distanceDifference.x = .5f - distanceDifference.x; distanceDifference.y /= this.getViewHeight(); distanceDifference.y = .5f - distanceDifference.y; distanceDifference.y -= .1f; return distanceDifference; }

Target:
public Vector2 worldToScreen(SolShip ship) { Vector2 distanceDifference = new Vector2(this.getPosition()); distanceDifference.sub(ship.getPosition()); distanceDifference.x /= this.getViewWidth(); distanceDifference.x = .5f - distanceDifference.x; distanceDifference.y /= this.getViewHeight(); distanceDifference.y = .5f - distanceDifference.y; return distanceDifference; }
Source:
protected RulesCache( @GerritServerConfig Config config, SitePaths site) { this.config = config; this.site = site; }

Target:
protected RulesCache ( @GerritServerConfig Config config, SitePaths site) { this.cacheDir = site.resolve( config.getString("cache", null, "directory")); if (this.cacheDir != null) { this.rulesDir = new File(cacheDir, "rules"); } else { this.rulesDir = null; } }
Source:
public void load() { images.clear(); File brushDir = new File(worldEdit.getPlatformManager().getConfiguration().getWorkingDirectory(), "brushes"); if (!brushDir.exists() || !brushDir.isDirectory()) { return; } for (File file : brushDir.listFiles()) { String fileName = file.getName(); if (fileName.indexOf(' ') != -1) { logger.warn("Brush file '{}' contains spaces.", fileName); continue; } BufferedImage image; try { image = ImageIO.read(file); } catch (IOException e) { logger.error("Error reading file from brushes directory", e); continue; } int index = fileName.lastIndexOf('.'); String brushName = index != -1 ? fileName.substring(0, index) : fileName; images.put(brushName.toLowerCase(Locale.ROOT), image); } if (!images.isEmpty()) { logger.info("Loaded image brushes", images.size()); } }

Target:
public void load() { images.clear(); File brushDir = new File(worldEdit.getPlatformManager().getConfiguration().getWorkingDirectory(), "brushes"); if (!brushDir.exists() || !brushDir.isDirectory()) { return; } for (File file : brushDir.listFiles()) { BufferedImage image; try { image = ImageIO.read(file); } catch (IOException e) { logger.error("Error reading file from brushes directory", e); continue; } String fileName = file.getName(); int index = fileName.lastIndexOf('.'); String brushName = index != -1 ? fileName.substring(0, index) : fileName; images.put(brushName.toLowerCase(Locale.ROOT), image); } if (!images.isEmpty()) { logger.info("Loaded image brushes", images.size()); } }
Source:
@Test public void testDivideWraperPrimitive() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperLong\" / \"primitiveLong\" as c\n" + " from \"s\".\"everyTypes\" where \"primitiveLong\" <> 0") .planContains( "final Long input_value = current.wrapperLong;") .planContains( "final boolean input_isNull = input_value == null;") .planContains( "return input_isNull ? (Long) null : Long.valueOf(input_isNull ? 0L : input_value / Long.valueOf(current.primitiveLong));") .returns("C=null\n"); }

Target:
@Test public void testDivideWraperPrimitive() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperLong\" / \"primitiveLong\" as c\n" + " from \"s\".\"everyTypes\" where \"primitiveLong\" <> 0") .planContains( "final Long input_value = current.wrapperLong;") .planContains( "return input_value == null ? (Long) null : Long.valueOf(input_value.longValue() / current.primitiveLong);") .returns("C=null\n"); }
Source:
public void validatesInMultipleThreads() throws Exception { final int zero = 0; final int ten = 10; final int hundred = 100; final int fifty = 50; final Random rand = new SecureRandom(); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(hundred); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema ", "xmlns:xs='<LINK_0>' >", "<xs:element name='root'><xs:complexType>", "<xs:sequence>", "<xs:element name='a' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<root>", StringUtils.repeat("<a>hey you</a>", cnt), "</root>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = zero; count < fifty; count = count + 1) { executorService.submit(callable); } executorService.awaitTermination(ten, TimeUnit.SECONDS); executorService.shutdown(); }

Target:
public void validatesInMultipleThreads() throws Exception { final int timeout = 10; final int random = 100; final int loop = 50; final Random rand = new SecureRandom(); final Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { final int cnt = rand.nextInt(random); final XSD xsd = new XSDDocument( StringUtils.join( "<xs:schema ", "xmlns:xs='<LINK_0>' >", "<xs:element name='root'><xs:complexType>", "<xs:sequence>", "<xs:element name='a' type='xs:integer'", " minOccurs='0' maxOccurs='unbounded'/>", "</xs:sequence></xs:complexType></xs:element>", "</xs:schema>" ) ); MatcherAssert.assertThat( xsd.validate( new DOMSource( new XMLDocument( StringUtils.join( "<root>", StringUtils.repeat("<a>hey you</a>", cnt), "</root>" ) ).node() ) ), Matchers.hasSize(cnt << 1) ); return null; } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = 0; count < loop; count = count + 1) { executorService.submit(callable); } executorService.shutdown(); MatcherAssert.assertThat( executorService.awaitTermination(timeout, TimeUnit.SECONDS), Matchers.is(true) ); executorService.shutdownNow(); }
Source:
public CompletableFuture<Acknowledge> sendSlotReport(ResourceID taskManagerResourceId, InstanceID taskManagerRegistrationId, SlotReport slotReport, Time timeout) { final WorkerRegistration<WorkerType> workerTypeWorkerRegistration = taskExecutors.get(taskManagerResourceId); if (workerTypeWorkerRegistration.getInstanceID().equals(taskManagerRegistrationId)) { slotManager.registerTaskManager(workerTypeWorkerRegistration, slotReport); onTaskManagerRegistration(workerTypeWorkerRegistration); return CompletableFuture.completedFuture(Acknowledge.get()); } else { return FutureUtils.completedExceptionally(new ResourceManagerException(String.format("Unknown TaskManager registration id %s.", taskManagerRegistrationId))); } }

Target:
public CompletableFuture<Acknowledge> sendSlotReport(ResourceID taskManagerResourceId, InstanceID taskManagerRegistrationId, SlotReport slotReport, Time timeout) { final WorkerRegistration<WorkerType> workerTypeWorkerRegistration = taskExecutors.get(taskManagerResourceId); if (workerTypeWorkerRegistration.getInstanceID().equals(taskManagerRegistrationId)) { if (slotManager.registerTaskManager(workerTypeWorkerRegistration, slotReport)) { onTaskManagerRegistration(workerTypeWorkerRegistration); } return CompletableFuture.completedFuture(Acknowledge.get()); } else { return FutureUtils.completedExceptionally(new ResourceManagerException(String.format("Unknown TaskManager registration id %s.", taskManagerRegistrationId))); } }
Source:
public String getFormattedValue(float value, AxisBase axis) { int days = (int) value; int year = determineYear(days); int month = determineMonth(days); String monthName = mMonths[month % mMonths.length]; String yearName = String.valueOf(year); if (chart.getVisibleXRange() > 30 * 6) { return monthName + " " + yearName; } else { int dayOfMonth = determineDayOfMonth(days, month + 12 * (year - 2016)); String appendix = "th"; switch (dayOfMonth) { case 1: appendix = "st"; break; case 2: appendix = "nd"; break; case 3: appendix = "rd"; break; case 21: appendix = "st"; break; case 22: appendix = "nd"; break; case 23: appendix = "rd"; break; case 31: appendix = "st"; break; } return dayOfMonth == 0 ? "" : dayOfMonth + appendix + " " + monthName; } }

Target:
public String getFormattedValue(float value, AxisBase axis) { int intValue = (int) value; Date vitalDate = DateUtils.getDateFromString(dates.get(Math.abs(intValue))); DateFormat dateFormat = new SimpleDateFormat("MMM d, ''yy"); return dateFormat.format(vitalDate); }
Source:
public String show(@RequestParam(value = "name", required = true) String name, ModelMap model) { long start = System.currentTimeMillis(); try{ ClusterConfig config = UIUtils.clusterConfig.get(name); StringBuffer builder = new StringBuffer(""); for (String ip:config.getZkServers()){ builder.append(ip).append(","); } builder.substring(0, builder.length() -1); builder.append(":"); builder.append(config.getZkPort()); model.addAttribute("zkServers", builder.toString()); model.addAttribute("clusterName",name); model.addAttribute("requestUri", "/zookeeper/node"); }catch (Exception e){ LOG.error(e.getMessage(), e); UIUtils.addErrorAttribute(model, e); } LOG.info("zookeeper page show cost:{}ms", System.currentTimeMillis() - start); return "zookeeper"; }

Target:
public String show(@RequestParam(value = "name", required = true) String name, ModelMap model) { long start = System.currentTimeMillis(); try{ ClusterConfig config = UIUtils.clusterConfig.get(name); StringBuilder builder = new StringBuilder(""); for (String ip:config.getZkServers()){ builder.append(ip).append(","); } builder.deleteCharAt(builder.length() - 1); builder.append(":"); builder.append(config.getZkPort()); model.addAttribute("zkRoot", config.getZkRoot()); model.addAttribute("zkServers", builder.toString()); model.addAttribute("clusterName",name); }catch (Exception e){ LOG.error(e.getMessage(), e); UIUtils.addErrorAttribute(model, e); } LOG.info("zookeeper page show cost:{}ms", System.currentTimeMillis() - start); return "zookeeper"; }
Source:
public boolean commitCursors(final String subscriptionId, final List<SubscriptionCursor> cursors) throws NakadiException, InvalidCursorException { final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); boolean allCommitted = true; for (final String eventTypeName : subscription.getEventTypes()) { final EventType eventType = eventTypeRepository.findByName(eventTypeName); createSubscriptionInZkIfNeeded(subscription); final List<SubscriptionCursor> eventTypeCursors = cursors.stream() .filter(cursor -> eventTypeName.equals(cursor.getEventType())) .collect(Collectors.toList()); topicRepository.validateCommitCursors(eventType.getTopic(), eventTypeCursors); for (final SubscriptionCursor cursor : eventTypeCursors) { final boolean cursorCommitted = commitCursor(subscriptionId, eventType.getTopic(), cursor); allCommitted = allCommitted && cursorCommitted; } } return allCommitted; }

Target:
public boolean commitCursors(final String subscriptionId, final List<SubscriptionCursor> cursors) throws NakadiException, InvalidCursorException { final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); createSubscriptionInZkIfNeeded(subscription); boolean allCommitted = true; for (final SubscriptionCursor cursor: cursors) { final EventType eventType = eventTypeRepository.findByName(cursor.getEventType()); topicRepository.validateCommitCursors(eventType.getTopic(), ImmutableList.of(cursor)); final boolean cursorCommitted = commitCursor(subscriptionId, eventType.getTopic(), cursor); allCommitted = allCommitted && cursorCommitted; } return allCommitted; }
Source:
public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter) { if (packetInterceptor == null) { throw new NullPointerException("Packet interceptor is null."); } InterceptorWrapper interceptorWrapper = new InterceptorWrapper(packetInterceptor, packetFilter); synchronized (interceptors) { interceptors.put(packetInterceptor, interceptorWrapper); } }

Target:
public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter) { addStanzaInterceptor(packetInterceptor, packetFilter); }
Source:
public int readCallback(String path, ByteBuffer buf, long size, long offset, ByteBuffer fibuf) { try { return read(path, buf, size, offset, FuseFileInfo.wrap(fibuf)); } catch (Exception e) { e.printStackTrace(); return -ErrorCodes.EIO(); } }

Target:
public int readCallback(String path, ByteBuffer buf, long size, long offset, ByteBuffer fibuf) { try { return read(path, buf, size, offset, FuseFileInfo.wrap(fibuf)); } catch (Exception e) { LOG.error("Failed to read {}, size {}, offset {}: ", path, size, offset, e); return -ErrorCodes.EIO(); } }
Source:
public Server2ControllerSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient, String controllerSegmentUploadCommitUrl, String segmentName, int segmentUploadRequestTimeoutMs, ServerMetrics serverMetrics) { _segmentLogger = segmentLogger; _fileUploadDownloadClient = fileUploadDownloadClient; _controllerSegmentUploadCommitUrl = controllerSegmentUploadCommitUrl; _segmentName = segmentName; _segmentUploadRequestTimeoutMs = segmentUploadRequestTimeoutMs; _serverMetrics = serverMetrics; }

Target:
public Server2ControllerSegmentUploader(Logger segmentLogger, FileUploadDownloadClient fileUploadDownloadClient, String controllerSegmentUploadCommitUrl, String segmentName, int segmentUploadRequestTimeoutMs, ServerMetrics serverMetrics) throws URISyntaxException { _segmentLogger = segmentLogger; _fileUploadDownloadClient = fileUploadDownloadClient; _controllerSegmentUploadCommitUrl = new URI(controllerSegmentUploadCommitUrl); _segmentName = segmentName; _segmentUploadRequestTimeoutMs = segmentUploadRequestTimeoutMs; _serverMetrics = serverMetrics; }
Source:
public List<SecretDeliveryResponse> getBatchSecret(@Auth Client client, @Valid BatchSecretRequest request) { List<SanitizedSecret> sanitizedSecrets = aclDAO.getBatchSanitizedSecretsFor(client, request.secrets); List<Secret> secrets = secretController.getSecretsByName(request.secrets); boolean clientExists = clientDAO.getClient(client.getName()).isPresent(); Iterator reqsecretsiter = request.secrets.iterator(); while (reqsecretsiter.hasNext()) { String secretname = (String) reqsecretsiter.next(); SanitizedSecret sanitizedsecret = null; for (SanitizedSecret s : sanitizedSecrets) { if (s.name().equals(secretname)) { sanitizedsecret = s; break; } } Secret secret = null; for (Secret s : secrets) { if (s.getName().equals(secretname)) { secret = s; break; } } boolean secretExists = secret != null; boolean sanitzedsecretExists = sanitizedsecret != null; if (!sanitzedsecretExists) { if (clientExists && secretExists) { throw new ForbiddenException(format("Access denied: %s at '%s' by '%s'", client.getName(), "/batchsecret " + secretname, client)); } else { if (clientExists) { logger.info("Client requested unknown secret {}", client.getName(), secretname); } throw new NotFoundException(); } } } logger.info("Client granted access to {}.", client.getName(), sanitizedSecrets); try { return secrets.stream() .map(SecretDeliveryResponse::fromSecret) .collect(toList()); } catch (IllegalArgumentException e) { logger.error(format("Failed creating batch response for secrets %s", secrets), e); throw new InternalServerErrorException(); } }

Target:
public List<SecretDeliveryResponse> getBatchSecret(@Auth Client client, @Valid BatchSecretRequest request) { List<SanitizedSecret> clientAccessibleSecrets = aclDAO.getBatchSanitizedSecretsFor(client, request.secrets()); List<Secret> existingSecrets = secretController.getSecretsByName(request.secrets()); boolean clientExists = clientDAO.getClientByName(client.getName()).isPresent(); List<String> forbiddenSecrets = new ArrayList<>(); for (String secretname : request.secrets()) { boolean secretExists = existingSecrets.stream().anyMatch(s -> s.getName().equals(secretname)); boolean secretAccessible = clientAccessibleSecrets.stream().anyMatch(s -> s.name().equals(secretname)); if (!(clientExists && secretExists)) { logger.warn("Client or secret does not exist (client exists={}, secret exists={})", client.getName(), secretname, clientExists, secretExists); throw new NotFoundException(); } if (!secretAccessible) { forbiddenSecrets.add(secretname); } } if (!forbiddenSecrets.isEmpty()) { throw new ForbiddenException(format("Access denied: %s to secret(s) '%s'", client.getName(), forbiddenSecrets)); } logger.info("Client granted access to {}.", client.getName(), clientAccessibleSecrets.stream().map(s -> s.name()).collect(toList())); try { return existingSecrets.stream() .map(SecretDeliveryResponse::fromSecret) .collect(toList()); } catch (IllegalArgumentException e) { logger.error(format("Failed creating batch response for secrets %s", existingSecrets.stream().map(s -> s.getName()).collect(toList())), e); throw new InternalServerErrorException(); } }
Source:
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); validateAndThrow(prefetchCount); final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); final ReceiverOptions receiverOptions = new ReceiverOptions(receiveMode, prefetchCount, sessionId, isRollingSessionReceiver(), maxConcurrentSessions); final UnnamedSessionManager sessionManager; if (CoreUtils.isNullOrEmpty(sessionId)) { sessionManager = new UnnamedSessionManager(entityPath, entityType, connectionProcessor, connectionProcessor.getRetryOptions().getTryTimeout(), tracerProvider, messageSerializer, receiverOptions, maxAutoRenewDuration); } else { sessionManager = new UnnamedSessionManager(entityPath, entityType, connectionProcessor, connectionProcessor.getRetryOptions().getTryTimeout(), tracerProvider, messageSerializer, receiverOptions, maxAutoRenewDuration, sessionId); } return new ServiceBusReceiverAsyncClient(connectionProcessor.getFullyQualifiedNamespace(), entityPath, entityType, receiverOptions, connectionProcessor, ServiceBusConstants.OPERATION_TIMEOUT, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose, maxAutoRenewDuration, sessionManager); }

Target:
public ServiceBusReceiverAsyncClient buildAsyncClient() { final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); final String entityPath = getEntityPath(logger, entityType, queueName, topicName, subscriptionName, SubQueue.NONE); final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); if (receiveMode == ReceiveMode.RECEIVE_AND_DELETE) { maxAutoLockRenewDuration = Duration.ZERO; } final ReceiverOptions receiverOptions = new ReceiverOptions(receiveMode, prefetchCount, sessionId, isRollingSessionReceiver(), maxConcurrentSessions, maxAutoLockRenewDuration); final ServiceBusSessionManager sessionManager = new ServiceBusSessionManager(entityPath, entityType, connectionProcessor, tracerProvider, messageSerializer, receiverOptions); return new ServiceBusReceiverAsyncClient(connectionProcessor.getFullyQualifiedNamespace(), entityPath, entityType, receiverOptions, connectionProcessor, ServiceBusConstants.OPERATION_TIMEOUT, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose, sessionManager); }
Source:
public void verifyNoFrameworkClassSendToClient() { val request = mock(HttpServletRequest.class); val msg = "test"; val map = CollectionUtils.<String, Throwable>wrap( UnauthorizedAuthenticationException.class.getSimpleName(), new UnauthorizedAuthenticationException(msg) ); ResponseEntity<String> response = RestResourceUtils.createResponseEntityForAuthnFailure( new AuthenticationException(msg, map, new HashMap<>(0)), request, context ); assertTrue(response.getStatusCode().isError()); assertFalse(response.getBody().contains(UnauthorizedAuthenticationException.class.getSimpleName())); }

Target:
public void verifyNoFrameworkClassSendToClient() { val request = mock(HttpServletRequest.class); val msg = "test"; val map = CollectionUtils.<String, Throwable>wrap( UnauthorizedAuthenticationException.class.getSimpleName(), new UnauthorizedAuthenticationException(msg) ); val response = RestResourceUtils.createResponseEntityForAuthnFailure( new AuthenticationException(msg, map, new HashMap<>(0)), request, context ); assertTrue(response.getStatusCode().isError()); assertFalse(response.getBody().contains(UnauthorizedAuthenticationException.class.getSimpleName())); }
Source:
public BAMMediator createBAMMediator() { BAMMediatorImpl bamMediator = new BAMMediatorImpl(); bamMediator.setInputConnector(createBAMMediatorInputConnector()); bamMediator.setOutputConnector(createBAMMediatorOutputConnector()); bamMediator.setServerProfile("server_profile_name"); bamMediator.setStreamName("stream_name"); bamMediator.setStreamVersion("1.0.0"); return bamMediator; }

Target:
public BAMMediator createBAMMediator() { BAMMediatorImpl bamMediator = new BAMMediatorImpl(); bamMediator.setInputConnector(createBAMMediatorInputConnector()); bamMediator.setOutputConnector(createBAMMediatorOutputConnector()); return bamMediator; }
Source:
public GetContainerReportResponse getContainerReport( GetContainerReportRequest request) throws YarnException, IOException { ContainerId containerId = request.getContainerId(); if (containerId == null) { throw new ContainerNotFoundException("ContainerId doesn't exist"); } ApplicationAttemptId appAttemptId = containerId.getApplicationAttemptId(); ApplicationId appId = appAttemptId.getApplicationId(); UserGroupInformation callerUGI = getCallerUgi(appId, AuditConstants.GET_CONTAINER_REPORT); RMApp application = verifyUserAccessForRMApp(appId, callerUGI, AuditConstants.GET_CONTAINER_REPORT, ApplicationAccessType.VIEW_APP, false); boolean allowAccess = checkAccess(callerUGI, application.getUser(), ApplicationAccessType.VIEW_APP, application); GetContainerReportResponse response = null; if (allowAccess) { RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId); if (appAttempt == null) { throw new ApplicationAttemptNotFoundException( "ApplicationAttempt with id '" + appAttemptId + "' doesn't exist in RM."); } RMContainer rmContainer = this.rmContext.getScheduler().getRMContainer( containerId); if (rmContainer == null) { throw new ContainerNotFoundException("Container with id '" + containerId + "' doesn't exist in RM."); } response = GetContainerReportResponse.newInstance(rmContainer .createContainerReport()); } else { throw new YarnException("User " + callerUGI.getShortUserName() + " does not have privilege to see this application " + appId); } return response; }

Target:
public GetContainerReportResponse getContainerReport( GetContainerReportRequest request) throws YarnException, IOException { ContainerId containerId = request.getContainerId(); if (containerId == null) { throw new ContainerNotFoundException("Invalid container id: null"); } ApplicationAttemptId appAttemptId = containerId.getApplicationAttemptId(); ApplicationId appId = appAttemptId.getApplicationId(); UserGroupInformation callerUGI = getCallerUgi(appId, AuditConstants.GET_CONTAINER_REPORT); RMApp application = verifyUserAccessForRMApp(appId, callerUGI, AuditConstants.GET_CONTAINER_REPORT, ApplicationAccessType.VIEW_APP, false); boolean allowAccess = checkAccess(callerUGI, application.getUser(), ApplicationAccessType.VIEW_APP, application); GetContainerReportResponse response = null; if (allowAccess) { RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId); if (appAttempt == null) { throw new ApplicationAttemptNotFoundException( "ApplicationAttempt with id '" + appAttemptId + "' doesn't exist in RM."); } RMContainer rmContainer = this.rmContext.getScheduler().getRMContainer( containerId); if (rmContainer == null) { throw new ContainerNotFoundException("Container with id '" + containerId + "' doesn't exist in RM."); } response = GetContainerReportResponse.newInstance(rmContainer .createContainerReport()); } else { throw new YarnException("User " + callerUGI.getShortUserName() + " does not have privilege to see this application " + appId); } return response; }
Source:
public void addFieldViews(Context context, Detail detail, Entity entity) { this.removeAllViews(); addBuffers(context); GridCoordinate[] coordinatesOfEachField = detail.getGridCoordinates(); String[] typesOfEachField = detail.getTemplateForms(); GridStyle[] stylesOfEachField = detail.getGridStyles(); Log.v("TempForms", "Template: " + Arrays.toString(typesOfEachField) + " | Coords: " + Arrays.toString(coordinatesOfEachField) + " | Styles: " + Arrays.toString(stylesOfEachField)); setPaddingIfNotInGridView(); if (tileBeingShownInGridView()) { setBackgroundColor(Color.parseColor("#ffffff")); } mFieldViews = new View[coordinatesOfEachField.length]; for (int i = 0; i < mFieldViews.length; i++) { addFieldView(context, typesOfEachField[i], stylesOfEachField[i], coordinatesOfEachField[i], entity.getFieldString(i), entity.getSortField(i), i); } }

Target:
public void addFieldViews(Context context, Detail detail, Entity entity) { this.removeAllViews(); addBuffers(context); GridCoordinate[] coordinatesOfEachField = detail.getGridCoordinates(); String[] typesOfEachField = detail.getTemplateForms(); GridStyle[] stylesOfEachField = detail.getGridStyles(); Log.v("TempForms", "Template: " + Arrays.toString(typesOfEachField) + " | Coords: " + Arrays.toString(coordinatesOfEachField) + " | Styles: " + Arrays.toString(stylesOfEachField)); setPaddingIfNotInGridView(); if (tileBeingShownInGridView()) { setBackgroundColor(Color.WHITE); } mFieldViews = new View[coordinatesOfEachField.length]; for (int i = 0; i < mFieldViews.length; i++) { addFieldView(context, typesOfEachField[i], stylesOfEachField[i], coordinatesOfEachField[i], entity.getFieldString(i), entity.getSortField(i), i); } }
Source:
private static void updateOption(VdcOption option) { Map<String, Object> values = _vdcOptionCache.get(option.getoption_name()); if (values != null) { values.put(option.getversion(), GetValue(option)); } else { values = new HashMap<String, Object>(); values.put(option.getversion(), GetValue(option)); _vdcOptionCache.put(option.getoption_name(), values); } }

Target:
private static void updateOption(VdcOption option) { Map<String, Object> values = _vdcOptionCache.get(option.getoption_name()); if (values == null) { values = new HashMap<String, Object>(); _vdcOptionCache.put(option.getoption_name(), values); } values.put(option.getversion(), GetValue(option)); }
Source:
public int setBlockRangeByBounds(EntityPlayer player, String range, BlockPos offset1, BlockPos offset2) { AreaDescriptor descriptor = this.getBlockRange(range); DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, getBlockPos()); switch (this.currentRitual.canBlockRangeBeModified(range, descriptor, this, offset1, offset2, holder)) { case 1: descriptor.modifyAreaByBlockPositions(offset1, offset2); return 1; case -1: return -1; case -2: return -2; default: return 0; } }

Target:
public EnumReaderBoundaries setBlockRangeByBounds(EntityPlayer player, String range, BlockPos offset1, BlockPos offset2) { AreaDescriptor descriptor = this.getBlockRange(range); DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, getBlockPos()); EnumReaderBoundaries modificationType = currentRitual.canBlockRangeBeModified(range, descriptor, this, offset1, offset2, holder); if (modificationType == EnumReaderBoundaries.SUCCESS) descriptor.modifyAreaByBlockPositions(offset1, offset2); return modificationType; }
Source:
public void trackUnitVideoDelete(@NonNull String courseId, @NonNull String unitId) { final FirebaseEvent event = new FirebaseEvent(Events.VIDEOS_UNDO_UNIT_DELETE, Values.VIDEOS_UNDO_UNIT_DELETE); event.putString(Keys.COURSE_ID, courseId); event.putString(Keys.UNIT_ID, unitId); logFirebaseEvent(event.getName(), event.getBundle()); }

Target:
public void trackUnitVideoDelete(@NonNull String courseId, @NonNull String unitId) { final FirebaseEvent event = new FirebaseEvent(Events.VIDEOS_UNIT_DELETE, Values.VIDEOS_UNIT_DELETE); event.putString(Keys.COURSE_ID, courseId); event.putString(Keys.UNIT_ID, unitId); logFirebaseEvent(event.getName(), event.getBundle()); }
Source:
private boolean isKnownCost(PlanNode node) { return !Objects.equals(UNKNOWN_COST, costs.getOrDefault(node.getId(), UNKNOWN_COST)); }

Target:
private boolean isKnownCost(PlanNode node) { return !UNKNOWN_COST.equals(costs.getOrDefault(node.getId(), UNKNOWN_COST)); }
Source:
public void exitNonReserved(SqlBaseParser.NonReservedContext context) { if (!(context.getChild(0) instanceof TerminalNode)) { int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex(); throw new AssertionError("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule)); } context.getParent().removeLastChild(); Token token = (Token) context.getChild(0).getPayload(); if (token.getText().equalsIgnoreCase("CURRENT_ROLE")) { warningConsumer.accept(new ParsingWarning(format("Reserved word used: %s", token.getText()), token.getLine(), token.getCharPositionInLine())); } if (SqlParserOptions.RESERVED_WORDS_WARNING.contains(token.getText())) { warningConsumer.accept(new ParsingWarning(format("This will soon be made a reserved word: %s", token.getText()), token.getLine(), token.getCharPositionInLine())); } context.getParent().addChild(new CommonToken( new Pair<>(token.getTokenSource(), token.getInputStream()), SqlBaseLexer.IDENTIFIER, token.getChannel(), token.getStartIndex(), token.getStopIndex())); }

Target:
public void exitNonReserved(SqlBaseParser.NonReservedContext context) { if (!(context.getChild(0) instanceof TerminalNode)) { int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex(); throw new AssertionError("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule)); } context.getParent().removeLastChild(); Token token = (Token) context.getChild(0).getPayload(); if (RESERVED_WORDS_WARNING.contains(token.getText().toUpperCase())) { warningConsumer.accept(new ParsingWarning( format("%s should be a reserved word, please use double quote (\"%s\"). This will be made a reserved word in future release.", token.getText(), token.getText()), token.getLine(), token.getCharPositionInLine())); } context.getParent().addChild(new CommonToken( new Pair<>(token.getTokenSource(), token.getInputStream()), SqlBaseLexer.IDENTIFIER, token.getChannel(), token.getStartIndex(), token.getStopIndex())); }
Source:
public void dontRunOnExclusiveSlave() throws Exception { List<MatrixProject> projects = new ArrayList<MatrixProject>(); for (int i = 0; i <= 10; i++) { MatrixProject m = j.createProject(MatrixProject.class); AxisList axes = new AxisList(); axes.add(new TextAxis("p", "only")); m.setAxes(axes); projects.add(m); } TemporaryFolder tf = new TemporaryFolder(); tf.create(); DumbSlave s = new DumbSlave( "big", "this is a big slave", tf.getRoot().getPath(), "20", EXCLUSIVE, "", j.createComputerLauncher(null), RetentionStrategy.NOOP, new ArrayList()); j.jenkins.addNode(s); s.toComputer().connect(false).get(); for (MatrixProject p : projects) { MatrixBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(2)); assertSame(b.getBuiltOn(), j.jenkins); } }

Target:
public void dontRunOnExclusiveSlave() throws Exception { List<MatrixProject> projects = new ArrayList<MatrixProject>(); for (int i = 0; i <= 10; i++) { MatrixProject m = j.createProject(MatrixProject.class); AxisList axes = new AxisList(); axes.add(new TextAxis("p", "only")); m.setAxes(axes); projects.add(m); } tmp.create(); DumbSlave s = new DumbSlave( "big", "this is a big slave", tmp.getRoot().getPath(), "20", EXCLUSIVE, "", j.createComputerLauncher(null), RetentionStrategy.NOOP, new ArrayList()); j.jenkins.addNode(s); s.toComputer().connect(false).get(); for (MatrixProject p : projects) { MatrixBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(2)); assertSame(b.getBuiltOn(), j.jenkins); } }
Source:
public void updateModel(OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { if (attributeDefinition.getType() != ModelType.LIST || !(attributeDefinition instanceof ListAttributeDefinition)) { throw new OperationFailedException("Attribute type is not list"); } updateModel(context, model, (ListAttributeDefinition) attributeDefinition, attribute); }

Target:
public void updateModel(OperationContext context, ModelNode model, AttributeDefinition attributeDefinition, ModelNode attribute) throws OperationFailedException { if (attributeDefinition.getType() != ModelType.LIST || !(attributeDefinition instanceof ListAttributeDefinition)) { throw ControllerLogger.MGMT_OP_LOGGER.attributeIsWrongType(attributeDefinition.getName(), ModelType.LIST,attributeDefinition.getType()); } updateModel(context, model, (ListAttributeDefinition) attributeDefinition, attribute); }