auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ServiceInfo getAssertionConsumerService( AuthnRequest request, Binding preferred, Integer index) { ServiceInfo si = null; if (request != null && request.getAssertionConsumerServiceURL() != null) { si = getAssertionConsumerServiceInfoByUrl(request); if (si.getBinding().getUri().equals(SamlProtocol.POST_BINDING)) { return si; } } if (index != null) { si = assertionConsumerServices .values() .stream() .filter(serviceInfo -> index.equals(serviceInfo.getIndex())) .filter(serviceInfo -> serviceInfo.getBinding() != null) .filter(serviceInfo -> serviceInfo.getBinding().equals(Binding.HTTP_POST)) .findFirst() .orElse(null); if (si != null) { return si; } } if (request != null && request.getProtocolBinding() != null && request.getProtocolBinding().equals(SamlProtocol.POST_BINDING) && supportedBindings.contains(Binding.from(request.getProtocolBinding()))) { si = assertionConsumerServices.get(Binding.from(request.getProtocolBinding())); if (si != null) { return si; } } Binding binding = preferred != null ? preferred : PREFERRED_BINDING; si = assertionConsumerServices.get(binding); if (si != null) { return si; } if (defaultAssertionConsumerService != null) { return defaultAssertionConsumerService; } return assertionConsumerServices.values().stream().findFirst().orElse(null); }

Target:
public ServiceInfo getAssertionConsumerService( AuthnRequest request, Binding preferred, Integer index) { ServiceInfo si = null; if (request != null && request.getAssertionConsumerServiceURL() != null) { si = getAssertionConsumerServiceInfoByUrl(request); if (si != null) { return si; } } if (index != null) { si = getAssertionConsumerServiceInfoByIndex(index); if (si != null) { return si; } } if (request != null && request.getProtocolBinding() != null) { si = getAssertionConsumerServiceInfoByProtocolBinding(request); if (si != null) { return si; } } Binding binding = preferred != null ? preferred : PREFERRED_BINDING; si = assertionConsumerServices.get(binding); if (si != null) { return si; } if (defaultAssertionConsumerService != null) { return defaultAssertionConsumerService; } return assertionConsumerServices.values().stream().findFirst().orElse(null); }
Source:
public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { List<Notification> filteredNotificationsList = event.getNotifications(); CompoundCommand commands = new CompoundCommand(); for (Notification notification : filteredNotificationsList) { Command refactorCommand = handleFilteredNotification(notification); if (null != refactorCommand) { commands.append(refactorCommand); } } return commands.isEmpty() ? null : commands; }

Target:
public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { List<Notification> filteredNotificationsList = event.getNotifications(); Command refactorCommand = null; if (!filteredNotificationsList.isEmpty()) { refactorCommand = handleFilteredNotification(filteredNotificationsList.get(0)); } return refactorCommand; }
Source:
public ExpressionTree POWER_EXPR() { return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.POWER_EXPR).is( f.powerExpr( b.zeroOrMore(f.newTuple73( CONCATENATION_EXPR(), b.token(POWER))), CONCATENATION_EXPR())); }

Target:
public ExpressionTree POWER_EXPR() { return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.POWER_EXPR).is( f.powerExpr( CONCATENATION_EXPR(), b.zeroOrMore(f.newTuple73( b.token(STAR_STAR), CONCATENATION_EXPR())))); }
Source:
private List<IFile> getDependencies(IStorage storage, IContainer c) throws CoreException, IOException { List<IFile> result = new ArrayList<>(); try (InputStream contents = storage.getContents();) { BufferedReader r = new BufferedReader( new InputStreamReader(contents)); try { while (true) { String line = r.readLine(); IFile dep = c.getFile(new Path(line)); result.add(dep); } } catch (Exception e) { } } return result; }

Target:
private List<IFile> getDependencies(IStorage storage, IContainer c) throws CoreException, IOException { List<IFile> result = new ArrayList<>(); try (InputStream contents = storage.getContents();) { BufferedReader r = new BufferedReader( new InputStreamReader(contents, Charset.forName("UTF-8"))); try { while (true) { String line = r.readLine(); IFile dep = c.getFile(new Path(line)); result.add(dep); } } catch (Exception e) { } } return result; }
Source:
public static boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; }

Target:
public boolean removeAllElementChildren(final Node node) { final boolean hadChildren = node.lastChild != null; while (node.lastChild != null) { node.removeChild(node.lastChild); } return hadChildren; }
Source:
public final Object fileOpen(final SFileDescriptor file, final SBlock handler) { file.openFile(handler); return Nil.nilObject; }

Target:
public final Object fileOpen(final SFileDescriptor file, final SBlock handler) { file.openFile(handler, dispatchHandler); return file; }
Source:
public void testSetEventCall() { setting.subscribe(listener); Random random = new FastRandom(); final int n = 50; int expectedEventCallCount = 0; for (int i = 0; i < n; i++) { int r = random.nextInt(-50, 150); expectedEventCallCount += setting.setValue(r) ? 1 : 0; } assertEquals(expectedEventCallCount, eventCallCount); }

Target:
public void testSetEventCall() { setting.subscribe(listener); Random random = new FastRandom(); final int MAX_SET_VALUE_COUNT = 50; int expectedEventCallCount = 0; for (int i = 0; i < MAX_SET_VALUE_COUNT; i++) { int randomInt = random.nextInt(-50, 150); expectedEventCallCount += setting.setValue(randomInt) ? 1 : 0; } assertEquals(expectedEventCallCount, eventCallCount); }
Source:
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { Set<Bean<?>> beans = manager.getBeans(TransactionSynchronizationRegistry.class); if (beans == null || beans.isEmpty()) { event.addBean(new JNDIBean<>(jtaPropertyManager.getJTAEnvironmentBean().getTransactionSynchronizationRegistryJNDIContext(), TransactionSynchronizationRegistry.class)); beans = manager.getBeans(InitialContext.class); if (beans == null || beans.isEmpty()) { event.addBean(new AbstractBean<InitialContext>() { @Override public final Set<Type> getTypes() { return Collections.singleton(InitialContext.class); } @Override public final Class<? extends Annotation> getScope() { return Singleton.class; } @Override protected String getTypeName() { return InitialContext.class.getName(); } @Override public final InitialContext create(final CreationalContext<InitialContext> cc) { try { return new InitialContext(); } catch (final NamingException namingException) { throw new CreationException(namingException.getMessage(), namingException); } } @Override public final void destroy(final InitialContext context, final CreationalContext<InitialContext> cc) { if (context != null) { try { context.close(); } catch (final NamingException namingException) { } } } }); } } event.addContext(new TransactionContext(() -> { final Bean<?> tmBean = manager.resolve(manager.getBeans(TransactionManager.class)); return (TransactionManager)manager.getReference(tmBean, TransactionManager.class, manager.createCreationalContext(tmBean)); }, () -> { final Bean<?> tsrBean = manager.resolve(manager.getBeans(TransactionSynchronizationRegistry.class)); return (TransactionSynchronizationRegistry)manager.getReference(tsrBean, TransactionSynchronizationRegistry.class, manager.createCreationalContext(tsrBean)); })); }

Target:
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { Set<Bean<?>> beans = manager.getBeans(TransactionSynchronizationRegistry.class); if (beans == null || beans.isEmpty()) { event.addBean(new JNDIBean<>(jtaPropertyManager.getJTAEnvironmentBean().getTransactionSynchronizationRegistryJNDIContext(), TransactionSynchronizationRegistry.class, Singleton.class)); } event.addContext(new TransactionContext(() -> { final Bean<?> tmBean = manager.resolve(manager.getBeans(TransactionManager.class)); return (TransactionManager)manager.getReference(tmBean, TransactionManager.class, manager.createCreationalContext(tmBean)); }, () -> { final Bean<?> tsrBean = manager.resolve(manager.getBeans(TransactionSynchronizationRegistry.class)); return (TransactionSynchronizationRegistry)manager.getReference(tsrBean, TransactionSynchronizationRegistry.class, manager.createCreationalContext(tsrBean)); })); }
Source:
public <RESP extends J4pResponse<REQ>, REQ extends J4pRequest> RESP extract(REQ pRequest, JSONObject pJsonResp) throws J4pRemoteException { int status = 0; if( pJsonResp.containsKey("status") { status = pJsonResp.get("status") instanceof Long ? ((Long) pJsonResp.get("status")).intValue() : 0; } if (!allowedCodes.contains(status)) { throw new J4pRemoteException(pRequest, pJsonResp); } return status == 200 ? pRequest.<RESP>createResponse(pJsonResp) : null; }

Target:
public <RESP extends J4pResponse<REQ>, REQ extends J4pRequest> RESP extract(REQ pRequest, JSONObject pJsonResp) throws J4pRemoteException { int status = 0; if( pJsonResp.containsKey("status")) { Object o = pJsonResp.get("status"); if( o instanceof Long ) { status = ((Long)o).intValue(); } } if (!allowedCodes.contains(status)) { throw new J4pRemoteException(pRequest, pJsonResp); } return status == 200 ? pRequest.<RESP>createResponse(pJsonResp) : null; }
Source:
public Response streamingPredict(@Multipart("modelId") long modelId, @Multipart("dataFormat") String dataFormat, @Multipart("file") InputStream inputStream) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { if (inputStream == null || inputStream.available() == 0) { logger.error("Cannot read the file."); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Cannot read the file").build(); } final String predictions = mlModelHandler.streamingPredict(tenantId, userName, modelId, dataFormat, inputStream); StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream)); writer.write(predictions); writer.flush(); writer.close(); } }; return Response.ok(stream).header("Content-disposition", "attachment; filename=predictions.csv").build(); } catch (Exception e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while predicting from model [id] %s of tenant [id] %s and [user] %s.", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } }

Target:
public Response streamingPredict(@Multipart("modelId") long modelId, @Multipart("dataFormat") String dataFormat, @Multipart("file") InputStream inputStream) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { if (inputStream == null || inputStream.available() == 0) { String msg = String.format( "Error occurred while reading the file for model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName); logger.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } final String predictions = mlModelHandler.streamingPredict(tenantId, userName, modelId, dataFormat, inputStream); StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream)); writer.write(predictions); writer.flush(); writer.close(); } }; return Response.ok(stream).header("Content-disposition", "attachment; filename=Predictions_" + modelId + "_" + MLUtils.getDate() + MLConstants.CSV).build(); } catch (Exception e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while predicting from model [id] %s of tenant [id] %s and [user] %s.", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } }
Source:
public static String getCountryNameFromCode(@NonNull String countryCode) { return new Locale("", countryCode).getDisplayCountry(); }

Target:
public static String getCountryNameFromCode(@NonNull String countryCode) throws InvalidLocaleException { final String uppercaseRegion = countryCode.toUpperCase(Locale.ROOT); if (!isValidBcp47Alpha(uppercaseRegion, 2, 2)) { throw new InvalidLocaleException("Invalid region: " + countryCode); } return new Locale("", countryCode).getDisplayCountry(); }
Source:
public void disableOkButton() { modal.disableOkButton(); }

Target:
void disableOkButton() { modal.disableOkButton(); }
Source:
public ItemsWrapper<SubscriptionEventTypeStats> getSubscriptionStats( @PathVariable("id") final String subscriptionId, @RequestParam(value = "show_time_lag", required = false, defaultValue = "false") final boolean showTimeLag, final HttpServletRequest request) throws InconsistentStateException, NoSuchEventTypeException, NoSuchSubscriptionException, ServiceTemporarilyUnavailableException { final Span statsSpan = TracingService.extractSpan(request, "fetch_stats") .setTag("subscription_id", subscriptionId) .setTag("time_lag", showTimeLag); final StatsMode statsMode = showTimeLag ? StatsMode.TIMELAG : StatsMode.NORMAL; return subscriptionService.getSubscriptionStat(subscriptionId, statsMode, statsSpan); }

Target:
public ItemsWrapper<SubscriptionEventTypeStats> getSubscriptionStats( @PathVariable("id") final String subscriptionId, @RequestParam(value = "show_time_lag", required = false, defaultValue = "false") final boolean showTimeLag, final HttpServletRequest request) throws InconsistentStateException, NoSuchEventTypeException, NoSuchSubscriptionException, ServiceTemporarilyUnavailableException { final Span statsSpan = TracingService.extractSpan(request, "fetch_stats") .setTag("subscription_id", subscriptionId) .setTag("show_time_lag", showTimeLag); final StatsMode statsMode = showTimeLag ? StatsMode.TIMELAG : StatsMode.NORMAL; return subscriptionService.getSubscriptionStat(subscriptionId, statsMode, statsSpan); }
Source:
public void onDestroy() { StatisticsService.sessionPause(); StatisticsService.sessionStop(this); super.onDestroy(); }

Target:
public void onDestroy() { StatisticsService.sessionStop(this); super.onDestroy(); }
Source:
private void onDomRetrieved(String dom) { webView.loadDataWithBaseURL( wikiUrl, "<head>".concat(Wiki.getGlobalCustomCss()).concat("</head>").concat(StringEscapeUtils.unescapeHtml4(dom)), "text/html", "utf-8", null); }

Target:
private void onDomRetrieved(String dom) { webView.loadDataWithBaseURL( wikiUrl, "<head>".concat(Wiki.getGlobalCustomCss()).concat("</head>").concat(dom), "text/html", "utf-8", null); }
Source:
public AnonymousClassDeclarationContext(ObjectCreationExpr node, TypeSolver typeSolver) { super(node, typeSolver); Preconditions.checkArgument(node.getAnonymousClassBody().isPresent(), "An anonymous class must have a body present"); }

Target:
public AnonymousClassDeclarationContext(ObjectCreationExpr node, TypeSolver typeSolver) { super(node, typeSolver); Preconditions.checkArgument(node.getAnonymousClassBody().isPresent(), "An anonymous class must have a body"); }
Source:
protected String buildAuthorizationHeaderString() { return "Token " + paymentworksAuthorizationToken; }

Target:
protected String buildAuthorizationHeaderString() { return PaymentWorksConstants.TOKEN_HEADER_KEY + paymentworksAuthorizationToken; }
Source:
public static void main(String args[]) throws DocumentException { Options options = new Options(); options.addOption("h", false, "displays help"); options.addOption("a", "addModule", true, "adds module to pom.xml in openmrs-project"); Option o = options.getOption("a"); o.setArgName("path"); CommandLineParser parser = new BasicParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); if (cmd.hasOption('h')) { usage(options); } if (cmd.hasOption('a')) { String filePath = cmd.getOptionValue('a'); if (filePath == null) System.out.println("File Path missing."); else addModule(filePath); } } catch (ParseException e) { usage(options); } }

Target:
public static void main(String args[]) throws DocumentException { Options options = new Options(); options.addOption("h", "help", false, "displays help"); options.addOption("a", "addModule", true, "adds module to pom.xml in openmrs-project"); Option o = options.getOption("a"); o.setArgName("path"); CommandLineParser parser = new BasicParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); if (cmd.hasOption('h') | cmd.hasOption("help")) { usage(options); } if (cmd.hasOption('a') | cmd.hasOption("addModule")) { String filePath = cmd.getOptionValue('a'); if (filePath == null) info("File Path missing."); else addModule(filePath); } } catch (ParseException e) { usage(options); } }
Source:
private GlusterBrickEntity getBrick(Guid clusterId, Guid volumeId, String brickInfo, int brickOrder) { String[] brickParts = brickInfo.split(":", -1); if (brickParts.length != 2) { throw new RuntimeException("Invalid brick representation [" + brickInfo + "]"); } String hostnameOrIp = brickParts[0]; String brickDir = brickParts[1]; VdsStatic server = dbUtils.getServer(clusterId, hostnameOrIp); if (server == null) { log.errorFormat("Could not add brick {0} to volume {1} - server {2} not found in cluster {3}", brickInfo, volumeId, hostnameOrIp, clusterId); return null; } return getBrickEntity(clusterId, volumeId, brickOrder, server, brickDir); }

Target:
private GlusterBrickEntity getBrick(Guid clusterId, Guid volumeId, String brickInfo, int brickOrder) { String[] brickParts = brickInfo.split(":", -1); if (brickParts.length != 2) { throw new RuntimeException("Invalid brick representation [" + brickInfo + "]"); } String hostnameOrIp = brickParts[0]; String brickDir = brickParts[1]; VdsStatic server = dbUtils.getServer(clusterId, hostnameOrIp); if (server == null) { log.warnFormat("Could not add brick {0} to volume {1} - server {2} not found in cluster {3}", brickInfo, volumeId, hostnameOrIp, clusterId); return null; } return getBrickEntity(clusterId, volumeId, brickOrder, server, brickDir); }
Source:
public Optional<Config.ConfigProvider> create() { JsonNode node = null; try { String configDir = System.getProperty("jboss.server.config.dir"); if (node == null && configDir != null) { File f = new File(configDir + File.separator + "keycloak-server.json"); if (f.isFile()) { ServicesLogger.LOGGER.loadingFrom(f.getAbsolutePath()); node = new ObjectMapper().readTree(f); } } if (node == null) { URL resource = Thread.currentThread().getContextClassLoader().getResource("META-INF/keycloak-server.json"); if (resource != null) { ServicesLogger.LOGGER.loadingFrom(resource); node = new ObjectMapper().readTree(resource); } } } catch (IOException e) { LOG.warn("Failed to load JSON config", e); } return createJsonProvider(node); }

Target:
public Optional<Config.ConfigProvider> create() { JsonNode node = null; try { String configDir = System.getProperty("jboss.server.config.dir"); if (configDir != null) { File f = new File(configDir + File.separator + "keycloak-server.json"); if (f.isFile()) { ServicesLogger.LOGGER.loadingFrom(f.getAbsolutePath()); node = JsonSerialization.mapper.readTree(f); } } if (node == null) { URL resource = Thread.currentThread().getContextClassLoader().getResource("META-INF/keycloak-server.json"); if (resource != null) { ServicesLogger.LOGGER.loadingFrom(resource); node = JsonSerialization.mapper.readTree(resource); } } } catch (IOException e) { LOG.warn("Failed to load JSON config", e); } return createJsonProvider(node); }
Source:
protected List<VariantContext> getVCsAtThisLocation(final List<Haplotype> haplotypes, final int loc, final List<VariantContext> activeAllelesToGenotype) { final List<VariantContext> eventsAtThisLoc = new ArrayList<>(); if( activeAllelesToGenotype.isEmpty() ) { haplotypes.stream().map(h -> h.getEventMap().get(loc)) .filter(vc -> vc != null && eventsAtThisLoc.stream().noneMatch(vc::hasSameAllelesAs)) .forEach(eventsAtThisLoc::add); } else { int compCount = 0; for( final VariantContext compVC : activeAllelesToGenotype ) { if( compVC.getStart() == loc ) { int alleleCount = 0; for( final Allele compAltAllele : compVC.getAlternateAlleles() ) { final List<Allele> alleleSet = Arrays.asList(compVC.getReference(), compAltAllele); final String vcSourceName = "Comp" + compCount + "Allele" + alleleCount; final VariantContext candidateEventToAdd = new VariantContextBuilder(compVC).alleles(alleleSet).source(vcSourceName).make(); if (eventsAtThisLoc.stream().noneMatch(vc -> vc.hasSameAllelesAs(candidateEventToAdd))) { eventsAtThisLoc.add(candidateEventToAdd); } alleleCount++; } } compCount++; } } return eventsAtThisLoc; }

Target:
protected List<VariantContext> getVCsAtThisLocation(final List<Haplotype> haplotypes, final int loc, final List<VariantContext> activeAllelesToGenotype) { final List<VariantContext> eventsAtThisLoc = new ArrayList<>(); if( activeAllelesToGenotype.isEmpty() ) { final List<VariantContext> events = haplotypes.stream().map(h -> h.getEventMap().get(loc)) .filter(Objects::nonNull).collect(Collectors.toList()); for (final VariantContext vc : events) { if (eventsAtThisLoc.stream().noneMatch(vc::hasSameAllelesAs)) { eventsAtThisLoc.add(vc); } } } else { int compCount = 0; for( final VariantContext compVC : activeAllelesToGenotype ) { if( compVC.getStart() == loc ) { int alleleCount = 0; for( final Allele compAltAllele : compVC.getAlternateAlleles() ) { final List<Allele> alleleSet = Arrays.asList(compVC.getReference(), compAltAllele); final String vcSourceName = "Comp" + compCount + "Allele" + alleleCount; final VariantContext candidateEventToAdd = new VariantContextBuilder(compVC).alleles(alleleSet).source(vcSourceName).make(); if (eventsAtThisLoc.stream().noneMatch(candidateEventToAdd::hasSameAllelesAs)) { eventsAtThisLoc.add(candidateEventToAdd); } alleleCount++; } } compCount++; } } return eventsAtThisLoc; }
Source:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (order == DeliverOrder.TOTAL) { unexpectedDeliverMode(command, order); } try { final int commandTopologyId = extractCommandTopologyId(command); final boolean onExecutorService = executeOnExecutorService(order, command); final BlockingRunnable runnable; switch (command.getCommandId()) { case SingleRpcCommand.COMMAND_ID: if (isCommandSentBeforeFirstTopology(commandTopologyId)) { reply.reply(CacheNotFoundResponse.INSTANCE); return; } runnable = createLockAwareRunnable(command, reply, commandTopologyId, true, onExecutorService, getLockPromise((SingleRpcCommand) command)); break; case MultipleRpcCommand.COMMAND_ID: if (isCommandSentBeforeFirstTopology(commandTopologyId)) { reply.reply(CacheNotFoundResponse.INSTANCE); return; } runnable = createLockAwareRunnable(command, reply, commandTopologyId, true, onExecutorService, getLockPromise((MultipleRpcCommand) command)); break; default: runnable = createDefaultRunnable(command, reply, commandTopologyId, command.getCommandId() != StateRequestCommand.COMMAND_ID, onExecutorService); break; } handleRunnable(runnable, onExecutorService); } catch (Throwable throwable) { reply.reply(exceptionHandlingCommand(command, throwable)); } }

Target:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (order == DeliverOrder.TOTAL) { unexpectedDeliverMode(command, order); } try { final int commandTopologyId = extractCommandTopologyId(command); final boolean onExecutorService = executeOnExecutorService(order, command); final BlockingRunnable runnable; switch (command.getCommandId()) { case SingleRpcCommand.COMMAND_ID: runnable = createReadyActionRunnable(command, reply, commandTopologyId, true, onExecutorService, createReadyActionForSingleRpcCommand(commandTopologyId, (SingleRpcCommand) command)); break; case MultipleRpcCommand.COMMAND_ID: runnable = createReadyActionRunnable(command, reply, commandTopologyId, true, onExecutorService, createReadyActionForMultipleRpcCommand(commandTopologyId, (MultipleRpcCommand) command)); break; default: runnable = createDefaultRunnable(command, reply, commandTopologyId, command.getCommandId() != StateRequestCommand.COMMAND_ID, onExecutorService); break; } handleRunnable(runnable, onExecutorService); } catch (Throwable throwable) { reply.reply(exceptionHandlingCommand(command, throwable)); } }
Source:
public static BookingGridSettings changeLookupForScreening(BookingGridSettings settings) throws IOException { Map<String, Object> fieldsMap = new HashMap<>(); DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); DateFilter defaultDateFilter = DateFilter.TODAY; if (StringUtils.isBlank(settings.getFields())) { settings.setFields("{}"); } if (StringUtils.isBlank(settings.getLookup())) { settings.setLookup("Find By Date"); } else { String fields = settings.getFields(); fieldsMap = OBJECT_MAPPER.readValue(fields, new TypeReference<HashMap>() {}); if (settings.getLookup().equals("Find By Volunteer Name")) { settings.setLookup("Find By Date And Volunteer Name"); } else { settings.setLookup("Find By Date And Clinic Location"); } } if (settings.getDateFilter() != null) { defaultDateFilter = settings.getDateFilter(); } Map<String, String> dateRange = new HashMap<>(); if (defaultDateFilter == DateFilter.DATE_RANGE) { if (StringUtils.isNotBlank(settings.getStartDate())) { dateRange.put("min", settings.getStartDate()); } else { dateRange.put("min", ""); } if (StringUtils.isNotBlank(settings.getEndDate())) { dateRange.put("max", settings.getEndDate()); } else { dateRange.put("max", ""); } } else if(defaultDateFilter == DateFilter.TODAY) { dateRange.put("min", LocalDate.now().toString(formatter)); dateRange.put("max", LocalDate.now().toString(formatter)); } else if(defaultDateFilter == DateFilter.TOMORROW) { dateRange.put("min", LocalDate.now().plusDays(1).toString(formatter)); dateRange.put("max", LocalDate.now().plusDays(1).toString(formatter)); } else { dateRange.put("min", settings.getStartDate()); dateRange.put("max", LocalDate.now().plusDays(7).toString(formatter)); } fieldsMap.put(Screening.DATE_PROPERTY_NAME, dateRange); settings.setFields(OBJECT_MAPPER.writeValueAsString(fieldsMap)); return settings; }

Target:
public static BookingGridSettings changeLookupForScreening(BookingGridSettings settings) throws IOException { Map<String, Object> fieldsMap = new HashMap<>(); DateFilter dateFilter = settings.getDateFilter(); if (dateFilter != null) { if (StringUtils.isBlank(settings.getFields())) { settings.setFields("{}"); } if (StringUtils.isBlank(settings.getLookup())) { settings.setLookup("Find By Date"); } else { fieldsMap = getFields(settings.getFields()); settings.setLookup(settings.getLookup() + " And Date"); } Map<String, String> rangeMap = new HashMap<>(); if (DateFilter.DATE_RANGE.equals(dateFilter)) { rangeMap.put("min", settings.getStartDate()); rangeMap.put("max", settings.getEndDate()); } else { Range<LocalDate> dateRange = dateFilter.getRange(); rangeMap.put("min", dateRange.getMin().toString(BookingAppConstants.SIMPLE_DATE_FORMAT)); rangeMap.put("max", dateRange.getMax().toString(BookingAppConstants.SIMPLE_DATE_FORMAT)); } fieldsMap.put(Screening.DATE_PROPERTY_NAME, rangeMap); settings.setFields(OBJECT_MAPPER.writeValueAsString(fieldsMap)); } return settings; }
Source:
private static CustomXmlTraceDefinition lookupXmlDefinition(String definitionName, DocumentBuilder db, String source) throws SAXException, IOException { File file = new File(source); Document doc = db.parse(file); Element root = doc.getDocumentElement(); if (!root.getNodeName().equals(CUSTOM_XML_TRACE_DEFINITION_ROOT_ELEMENT)) { return null; } NodeList nodeList = root.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element && node.getNodeName().equals(DEFINITION_ELEMENT) && definitionName.equals(((Element) node).getAttribute(NAME_ATTRIBUTE))) { return extractDefinition((Element) node); } } return null; }

Target:
private static CustomXmlTraceDefinition lookupXmlDefinition(String definitionName, DocumentBuilder db, String source) throws SAXException, IOException { File file = new File(source); if( !file.exists()){ return null; } Document doc = db.parse(file); Element root = doc.getDocumentElement(); if (!root.getNodeName().equals(CUSTOM_XML_TRACE_DEFINITION_ROOT_ELEMENT)) { return null; } NodeList nodeList = root.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element && node.getNodeName().equals(DEFINITION_ELEMENT) && definitionName.equals(((Element) node).getAttribute(NAME_ATTRIBUTE))) { return extractDefinition((Element) node); } } return null; }
Source:
public static void injectResources() { Configuration.addDefaultResource(azkabanInjectFile); Configuration.addDefaultResource(azkabanLinksFile); }

Target:
public static void injectResources() { Configuration.addDefaultResource(injectFile); }
Source:
public void onOffline(@Nonnull Computer computer, @CheckForNull OfflineCause cause) { try { final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } logger.fine("Start DatadogComputerListener#onOffline"); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = TagsUtil.merge( DatadogUtilities.getDatadogGlobalDescriptor().getGlobalTags(), DatadogUtilities.getComputerTags(computer)); DatadogEvent event = new ComputerOfflineEventImpl(computer, cause, tags, false); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.computer.offline", hostname, tags); logger.fine("End DatadogComputerListener#onOffline"); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }

Target:
public void onOffline(@Nonnull Computer computer, @CheckForNull OfflineCause cause) { try { final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } logger.fine("Start DatadogComputerListener#onOffline"); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = TagsUtil.merge( DatadogUtilities.getTagsFromGlobalTags(), DatadogUtilities.getComputerTags(computer)); DatadogEvent event = new ComputerOfflineEventImpl(computer, cause, tags, false); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.computer.offline", hostname, tags); logger.fine("End DatadogComputerListener#onOffline"); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }
Source:
@Test public void smokeTest() throws Exception { boolean notNative = (platform != TestPlatform.NATIVE); int sleepSeconds = 0; if (notNative) { switch (platform) { case CENTOS: case UBUNTU: case TINI: case SIMPLE: sleepSeconds = 10; break; case ALPINE: case SLIM: sleepSeconds = 45; break; default: Assert.fail("Unknown enum value: " + platform); break; } } String script = String.format("echo hello world; sleep %s", sleepSeconds); Controller c = new BourneShellScript(script).launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws,baos); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertTrue(baos.toString().contains("hello world")); c.cleanup(ws); if (notNative) { assertTrue("no zombies running", noZombies()); } }

Target:
@Test public void smokeTest() throws Exception { int sleepSeconds = -1; switch (platform) { case NATIVE: sleepSeconds = 0; break; case CENTOS: case UBUNTU: case UBUNTU_NO_BINARY: case SIMPLE: sleepSeconds = 10; break; case ALPINE: case SLIM: sleepSeconds = 45; break; default: Assert.fail("Unknown enum value: " + platform); break; } String script = String.format("echo hello world; sleep %s", sleepSeconds); Controller c = new BourneShellScript(script).launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws,baos); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertTrue(baos.toString().contains("hello world")); c.cleanup(ws); assertThat(getZombies(), isEmptyString()); }
Source:
protected void logJobProperties() { if (this.jobProps != null && this.jobProps.getBoolean(JOB_DUMP_PROPERTIES_IN_LOG, false)){ try { Map<String,String> flattenedProps = this.jobProps.getFlattened(); this.info("****** Job properties ******"); this.info(String.format("- Note : value is masked if property name ends with '%s'.", SENSITIVE_JOB_PROP_NAME_SURFFIX )); for(Map.Entry<String, String> entry : flattenedProps.entrySet()){ String key = entry.getKey(); String value = key.endsWith(SENSITIVE_JOB_PROP_NAME_SURFFIX)? SENSITIVE_JOB_PROP_VALUE_PLACEHOLDER : entry.getValue(); this.info(String.format("%s=%s",key,value)); } this.info("****** End Job properties ******"); } catch (Exception ex){ log.error("failed to log job properties ", ex); } } }

Target:
protected void logJobProperties() { if (this.jobProps != null && this.jobProps.getBoolean(JOB_DUMP_PROPERTIES_IN_LOG, false)){ try { Map<String,String> flattenedProps = this.jobProps.getFlattened(); this.info("****** Job properties ******"); this.info(String.format("- Note : value is masked if property name ends with '%s'.", SENSITIVE_JOB_PROP_NAME_SUFFIX )); for(Map.Entry<String, String> entry : flattenedProps.entrySet()){ String key = entry.getKey(); String value = key.endsWith(SENSITIVE_JOB_PROP_NAME_SUFFIX)? SENSITIVE_JOB_PROP_VALUE_PLACEHOLDER : entry.getValue(); this.info(String.format("%s=%s",key,value)); } this.info("****** End Job properties ******"); } catch (Exception ex){ log.error("failed to log job properties ", ex); } } }
Source:
private void getVersion(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { VersionInfo vi = new VersionInfo(serverContext.getServerConfig(), serverContext.getNodeIdBase64()); HeaderMsg responseHeader = getHeaderMsg(req.getHeader(), false, true); ResponseMsg response = getResponseMsg(responseHeader, getVersionResponseMsg(vi)); r.sendResponse(response, ctx); }

Target:
private void getVersion(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { VersionInfo versionInfo = new VersionInfo(serverContext.getServerConfig(), serverContext.getNodeIdBase64()); HeaderMsg responseHeader = getHeaderMsg(req.getHeader(), false, true); ResponseMsg response = getResponseMsg(responseHeader, getVersionResponseMsg(versionInfo)); r.sendResponse(response, ctx); }
Source:
public TestMethodTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method testMethod, JupiterConfiguration configuration) { super(uniqueId, testClass, testMethod, configuration); this.interceptorCall = DEFAULT_INTERCEPTOR_CALL; }

Target:
public TestMethodTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method testMethod, JupiterConfiguration configuration) { super(uniqueId, testClass, testMethod, configuration); this.interceptorCall = defaultInterceptorCall; }
Source:
public void handleFailure() { log.error("Command id: '{} failed child command status for step '{}'", getCommandId(), getParameters().getCommandStep()); }

Target:
public void handleFailure() { log.error("Command '{}' id '{}' failed executing step '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); }
Source:
public void setUp() throws Exception { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); File inputFile = new File("/tmp/input/input.csv"); FileUtils.writeLines(inputFile, ImmutableList.of("15/02/2016 10:15:00 +0000,1,paint1,11", "15/02/2016 10:16:00 +0000,2,paint2,12", "15/02/2016 10:17:00 +0000,3,paint3,13", "15/02/2016 10:18:00 +0000,4,paint4,14", "15/02/2016 10:19:00 +0000,5,paint5,15", "15/02/2016 10:10:00 +0000,6,abcde6,16")); }

Target:
public void setUp() throws Exception { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); outputFolder += testName.getMethodName() + "/"; }
Source:
public void bindServiceToRoute(String serviceInstanceId, String routeId) throws CloudFoundryException { log.debug("bindRouteToService"); try { cfClient.serviceInstances() .bindToRoute(BindServiceInstanceToRouteRequest.builder() .serviceInstanceId(serviceInstanceId) .routeId(routeId) .parameters(null).build()) .get(Config.CF_API_TIMEOUT_IN_S, TimeUnit.SECONDS); } catch (RuntimeException r) { throw new CloudFoundryException(r); } }

Target:
public void bindServiceToRoute(String serviceInstanceId, String routeId) throws CloudFoundryException { log.debug("bindRouteToService"); try { cfClient.serviceInstances() .bindToRoute(BindServiceInstanceToRouteRequest.builder() .serviceInstanceId(serviceInstanceId) .routeId(routeId).build()) .get(Config.CF_API_TIMEOUT_IN_S, TimeUnit.SECONDS); } catch (RuntimeException r) { throw new CloudFoundryException(r); } }
Source:
public static void logThreadDump(String message) { try { ThreadInfo[] threadInfo = THREAD_MX_BEAN.dumpAllThreads(true, true); StringBuilder sb = new StringBuilder(); sb.append(message).append("\n"); for (ThreadInfo ti: threadInfo) { sb.append(toString(ti)).append("\n"); } System.out.println(sb.toString()); } catch (Exception e) { LOGGER.error("Could not get and log a thread dump.", e); } }

Target:
public static void logThreadDump(String message) { try { ThreadInfo[] threadInfo = THREAD_MX_BEAN.dumpAllThreads(true, true); StringBuilder sb = new StringBuilder(); sb.append(message).append("\n"); for (ThreadInfo ti: threadInfo) { sb.append(toString(ti)).append("\n"); } LOGGER.info(sb.toString()); } catch (Exception e) { LOGGER.error("Could not get and log a thread dump.", e); } }
Source:
public boolean isAvailable() { return !stopped && (asyncConfiguration.failSilently() || delegateAvailable || stateLock.hasCapacity()); }

Target:
public boolean isAvailable() { if (stopped) return false; if (asyncConfiguration.failSilently()) return true; boolean available = false; try { available = actual.isAvailable(); } catch (Throwable t) { log.debugf("Error encountered when calling isAvailable on %s: %s", actual, t); } availabilityLock.lock(); try { if (available != delegateAvailable) { delegateAvailable = available; if (delegateAvailable) availability.signalAll(); } } finally { availabilityLock.unlock(); } return delegateAvailable || stateLock.hasCapacity(); }
Source:
protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), parameters .isForce())); setSucceeded(returnValue.getSucceeded()); if(!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, returnValue.getVdsError().getMessage()); return; } else { getGeoRepSession().setStatus(GeoRepSessionStatus.ACTIVE); getGlusterGeoRepDao().updateSession(getGeoRepSession()); } }

Target:
protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), parameters.isForce())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, returnValue.getVdsError().getMessage()); return; } }
Source:
@Override protected void readChunk(ReadableByteChannel ch) throws IOException { assert buf != null : "Buffer is used to deilver readed data to the used and cannot be null: " + this; buf.rewind(); int readed = 0; int res; while (true) { res = ch.read(buf); if (res < 0) { if (transferred + readed != meta.count()) { throw new IOException("Input data channel reached its end, but file has not fully loaded " + "[transferred=" + transferred + ", readed=" + readed + ", total=" + meta.count() + ']'); } break; } readed += res; if (readed == buf.capacity() || buf.position() == buf.capacity()) break; } if (readed == 0) return; transferred += readed; buf.flip(); hnd.accept(buf); }

Target:
@Override protected void readChunk(ReadableByteChannel ch) throws IOException { assert buf != null : "Buffer cannot be null since it is used to receive the data from channel: " + this; buf.rewind(); int read = 0; int res; while (true) { res = ch.read(buf); if (res < 0) { if (transferred + read != meta.count()) { throw new IOException("Input data channel reached its end, but file has not fully loaded " + "[transferred=" + transferred + ", read=" + read + ", total=" + meta.count() + ']'); } break; } read += res; if (read == buf.capacity() || buf.position() == buf.capacity()) break; } if (read == 0) return; transferred += read; buf.flip(); hnd.accept(buf); }
Source:
public EmptyMarkupContainer(String id) { super(id); setMarkupId(id); setOutputMarkupId(true); }

Target:
public EmptyMarkupContainer(String id) { super(id); setOutputMarkupId(true); }
Source:
public void beforeStartingVertx(VertxOptions options) { }

Target:
protected void beforeStartingVertx(VertxOptions options) { }
Source:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { List<TmfAnalysisRequirement> requirements = new ArrayList<>(); List<String> eventNames = new ArrayList<>(); eventNames.add(UstMemoryStrings.MALLOC); eventNames.add(UstMemoryStrings.FREE); eventNames.add(UstMemoryStrings.CALLOC); eventNames.add(UstMemoryStrings.REALLOC); eventNames.add(UstMemoryStrings.MEMALIGN); eventNames.add(UstMemoryStrings.POSIX_MEMALIGN); TmfAnalysisRequirement eventsReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, eventNames, AnalysisRequirementValueLevel.MANDATORY); eventsReq.addInformation(Messages.UstMemoryAnalysisModule_EventsLoadingInformation); requirements.add(eventsReq); return requirements; }

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { List<TmfAnalysisRequirement> requirements = new LinkedList<>(); List<String> eventNames = new LinkedList<>(); eventNames.add(UstMemoryStrings.MALLOC); eventNames.add(UstMemoryStrings.FREE); eventNames.add(UstMemoryStrings.CALLOC); eventNames.add(UstMemoryStrings.REALLOC); eventNames.add(UstMemoryStrings.MEMALIGN); eventNames.add(UstMemoryStrings.POSIX_MEMALIGN); TmfAnalysisRequirement eventsReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, eventNames, AnalysisRequirementValueLevel.MANDATORY); eventsReq.addInformation(Messages.UstMemoryAnalysisModule_EventsLoadingInformation); eventsReq.addInformation(Messages.UstMemoryAnalysisModule_EventsLoadingExampleInformation); TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN); domainReq.addValue(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN_TYPE_UST, AnalysisRequirementValueLevel.MANDATORY); requirements.add(domainReq); requirements.add(eventsReq); return requirements; }
Source:
public <T> void get( final String key, final AsyncCallback<T> callback ) { final Class<?> asyncCallbackType = ReflectionUtil.getCallbackGenericType( callback ); ThreadPoolService.getPoolExecutor().execute( new Runnable() { @Override public void run() { try { T result = (T) get( key, asyncCallbackType ); ResponseCarrier.getInstance().deliverMessage( new AsyncMessage<T>( result, callback ) ); } catch( BackendlessException e ) { ResponseCarrier.getInstance().deliverMessage( new AsyncMessage<T>( new BackendlessFault( e ), callback ) ); } catch( Exception e ) { callback.handleFault( new BackendlessFault( e.getMessage() ) ); } } } ); }

Target:
public <T> void get( final String key, final AsyncCallback<T> callback ) { final Class<?> asyncCallbackType = ReflectionUtil.getCallbackGenericType( callback ); ThreadPoolService.getPoolExecutor().execute( new Runnable() { @Override public void run() { try { T result = (T) get( key, asyncCallbackType ); ResponseCarrier.getInstance().deliverMessage( new AsyncMessage<T>( result, callback ) ); } catch( BackendlessException e ) { ResponseCarrier.getInstance().deliverMessage( new AsyncMessage<T>( new BackendlessFault( e ), callback ) ); } catch( Exception e ) { ResponseCarrier.getInstance().deliverMessage( new AsyncMessage<T>( new BackendlessFault( e ), callback ) ); } } } ); }
Source:
public void createServer(int clientAwakeTime) { server = createServerBuilder(clientAwakeTime).build(); server.getPresenceService().addListener(new PresenceListener() { @Override public void onAwake(Registration registration) { if (registration.getEndpoint().equals(currentEndpointIdentifier.get())) { awakeNotifications++; } } @Override public void onSleeping(Registration registration) { awakeNotifications = 0; awakeLatch.countDown(); scheduleUpdateAfterSleeping((int) SLEEPTIME); } }); setupRegistrationMonitoring(); }

Target:
public void createServer(int clientAwakeTime) { server = createServerBuilder(clientAwakeTime).build(); awakeNotifications.set(0); server.getPresenceService().addListener(new PresenceListener() { @Override public void onAwake(Registration registration) { if (registration.getEndpoint().equals(currentEndpointIdentifier.get())) { awakeNotifications.addAndGet(1); } } @Override public void onSleeping(Registration registration) { awakeNotifications.set(0); awakeLatch.countDown(); } }); setupRegistrationMonitoring(); }
Source:
OCFileListFragment.class.getPackage().getName() : "com.owncloud.android.ui.fragment"; protected final static String ARG_ALLOW_CONTEXTUAL_MODE = MY_PACKAGE + ".ALLOW_CONTEXTUAL"; protected final static String ARG_HIDE_FAB = MY_PACKAGE + ".HIDE_FAB"; private static final String KEY_FILE = MY_PACKAGE + ".extra.FILE"; private static final String KEY_FAB_EVER_CLICKED = "FAB_EVER_CLICKED"; private static final String GRID_IS_PREFERED_PREFERENCE = "gridIsPrefered"; private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER"; private FileFragment.ContainerActivity mContainerActivity; private OCFile mFile = null; private FileListListAdapter mAdapter; private LinearLayout uploadFilesLinearLayout; private LinearLayout uploadFromCameraLinearLayout; private TextView uploadToTextView; private BottomSheetBehavior uploadBottomSheetBehavior; private int mStatusBarColorActionMode; private int mStatusBarColor; private boolean mHideFab = true; private boolean miniFabClicked = false; private ActionMode mActiveActionMode; private OCFileListFragment.MultiChoiceModeListener mMultiChoiceModeListener; public static OCFileListFragment newInstance( boolean justFolders, boolean hideFAB, boolean allowContextualMode ) { OCFileListFragment frag = new OCFileListFragment(); Bundle args = new Bundle(); args.putBoolean(ARG_JUST_FOLDERS, justFolders); args.putBoolean(ARG_HIDE_FAB, hideFAB); args.putBoolean(ARG_ALLOW_CONTEXTUAL_MODE, allowContextualMode); frag.setArguments(args); return frag; }

Target:
OCFileListFragment.class.getPackage().getName() : "com.owncloud.android.ui.fragment"; protected final static String ARG_ALLOW_CONTEXTUAL_MODE = MY_PACKAGE + ".ALLOW_CONTEXTUAL"; protected final static String ARG_HIDE_FAB = MY_PACKAGE + ".HIDE_FAB"; private static final String KEY_FILE = MY_PACKAGE + ".extra.FILE"; private static final String KEY_FAB_EVER_CLICKED = "FAB_EVER_CLICKED"; private static final String GRID_IS_PREFERED_PREFERENCE = "gridIsPrefered"; private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER"; private FileFragment.ContainerActivity mContainerActivity; private OCFile mFile = null; private FileListListAdapter mAdapter; private int mStatusBarColorActionMode; private int mStatusBarColor; private boolean mHideFab = true; private boolean miniFabClicked = false; private ActionMode mActiveActionMode; private OCFileListFragment.MultiChoiceModeListener mMultiChoiceModeListener; public static OCFileListFragment newInstance( boolean justFolders, boolean hideFAB, boolean allowContextualMode ) { OCFileListFragment frag = new OCFileListFragment(); Bundle args = new Bundle(); args.putBoolean(ARG_JUST_FOLDERS, justFolders); args.putBoolean(ARG_HIDE_FAB, hideFAB); args.putBoolean(ARG_ALLOW_CONTEXTUAL_MODE, allowContextualMode); frag.setArguments(args); return frag; }