auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Lifecycle initLifecycle(Injector injector) { try { final Lifecycle lifecycle = injector.getInstance(Lifecycle.class); final StartupLoggingConfig startupLoggingConfig = injector.getInstance(StartupLoggingConfig.class); Long directSizeBytes = null; try { directSizeBytes = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); } catch (UnsupportedOperationException ignore) { } log.info( "Starting up with processors[%,d], memory[%,d], maxMemory[%,d]%s.", JvmUtils.getRuntimeInfo().getAvailableProcessors(), JvmUtils.getRuntimeInfo().getTotalHeapSizeBytes(), JvmUtils.getRuntimeInfo().getMaxHeapSizeBytes(), directSizeBytes != null ? String.format(", directMemory[%,d]", directSizeBytes) : "" ); if (startupLoggingConfig.isLogProperties()) { final Set<String> maskProperties = Sets.newHashSet(startupLoggingConfig.getMaskProperties()); final Properties props = injector.getInstance(Properties.class); for (String propertyName : Ordering.natural().sortedCopy(props.stringPropertyNames())) { String property = props.getProperty(propertyName); for (String masked : maskProperties) { if (propertyName.contains(masked)) { property = "<masked>"; break; } } log.info("* %s: %s", propertyName, property); } } try { lifecycle.start(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } return lifecycle; } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public Lifecycle initLifecycle(Injector injector) { try { final Lifecycle lifecycle = injector.getInstance(Lifecycle.class); final StartupLoggingConfig startupLoggingConfig = injector.getInstance(StartupLoggingConfig.class); Long directSizeBytes = null; try { directSizeBytes = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); } catch (UnsupportedOperationException ignore) { } log.info( "Starting up with processors[%,d], memory[%,d], maxMemory[%,d]%s.", JvmUtils.getRuntimeInfo().getAvailableProcessors(), JvmUtils.getRuntimeInfo().getTotalHeapSizeBytes(), JvmUtils.getRuntimeInfo().getMaxHeapSizeBytes(), directSizeBytes != null ? StringUtils.format(", directMemory[%,d]", directSizeBytes) : "" ); if (startupLoggingConfig.isLogProperties()) { final Set<String> maskProperties = Sets.newHashSet(startupLoggingConfig.getMaskProperties()); final Properties props = injector.getInstance(Properties.class); for (String propertyName : Ordering.natural().sortedCopy(props.stringPropertyNames())) { String property = props.getProperty(propertyName); for (String masked : maskProperties) { if (propertyName.contains(masked)) { property = "<masked>"; break; } } log.info("* %s: %s", propertyName, property); } } try { lifecycle.start(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } return lifecycle; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void setPreferredAgencies(String s) { if (!s.isEmpty()) { preferredAgencies = new HashSet<>(); Collections.addAll( preferredAgencies, Arrays.stream(s.split(",")) .map(FeedScopedId::convertFromString) .toArray(FeedScopedId[]::new) ); } }

Target:
public void setPreferredAgencies(String s) { if (!s.isEmpty()) { preferredAgencies = FeedScopedId.parseListOfIds(s); } }
Source:
private AccountGroup createGroup(ReviewDb db, String groupName, AccountGroup.UUID adminGroupUUID, String description) throws OrmException { final AccountGroup.Id groupId = new AccountGroup.Id(db.nextAccountGroupId()); final AccountGroup.NameKey nameKey = new AccountGroup.NameKey(groupName); final AccountGroup.UUID uuid = GroupUUID.make(groupName, serverUser); final AccountGroup group = new AccountGroup(nameKey, groupId, uuid); group.setOwnerGroupUUID(adminGroupUUID); group.setDescription(description); final AccountGroupName gn = new AccountGroupName(group); db.accountGroupNames().insert(Collections.singleton(gn)); db.accountGroups().insert(Collections.singleton(group)); return group; }

Target:
private AccountGroup createGroup(ReviewDb db, String groupName, AccountGroup.UUID adminGroupUUID, String description) throws OrmException { AccountGroup.Id groupId = new AccountGroup.Id(db.nextAccountGroupId()); AccountGroup.NameKey nameKey = new AccountGroup.NameKey(groupName); AccountGroup.UUID uuid = GroupUUID.make(groupName, serverUser); AccountGroup group = new AccountGroup(nameKey, groupId, uuid); group.setOwnerGroupUUID(adminGroupUUID); group.setDescription(description); AccountGroupName gn = new AccountGroupName(group); db.accountGroupNames().insert(Collections.singleton(gn)); db.accountGroups().insert(Collections.singleton(group)); return group; }
Source:
protected double apply(double a) { return Double.NaN; }

Target:
protected double apply(double a) { throw new IllegalStateException("Illegal unary input to " + getLabel() + "()"); }
Source:
public void onPlayerInteract(final PlayerInteractEvent event) { boolean updateActivity = true; switch (event.getAction()) { case RIGHT_CLICK_BLOCK: if (!event.isCancelled() && MaterialUtil.isBed(event.getClickedBlock().getType()) && ess.getSettings().getUpdateBedAtDaytime()) { User player = ess.getUser(event.getPlayer()); if (player.isAuthorized("essentials.sethome.bed") && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation()); player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())); } } break; case LEFT_CLICK_AIR: if (event.getPlayer().isFlying()) { final User user = ess.getUser(event.getPlayer()); if (user.isFlyClickJump()) { useFlyClickJump(user); break; } } case LEFT_CLICK_BLOCK: if (event.getItem() != null && event.getItem().getType() != Material.AIR) { final User user = ess.getUser(event.getPlayer()); if (user.hasPowerTools() && user.arePowerToolsEnabled() && usePowertools(user, event.getItem().getType())) { event.setCancelled(true); } } break; case PHYSICAL: if(event.getItem().getType().toString().contains("pressure_plate")) { final User user = ess.getUser(event.getPlayer()); if(user.isVanished()){ event.setCancelled(true); }} updateActivity = false; break; } if (updateActivity) { ess.getUser(event.getPlayer()).updateActivityOnInteract(true); } }

Target:
public void onPlayerInteract(final PlayerInteractEvent event) { boolean updateActivity = true; switch (event.getAction()) { case RIGHT_CLICK_BLOCK: if (!event.isCancelled() && MaterialUtil.isBed(event.getClickedBlock().getType()) && ess.getSettings().getUpdateBedAtDaytime()) { User player = ess.getUser(event.getPlayer()); if (player.isAuthorized("essentials.sethome.bed") && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation()); player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())); } } break; case LEFT_CLICK_AIR: if (event.getPlayer().isFlying()) { final User user = ess.getUser(event.getPlayer()); if (user.isFlyClickJump()) { useFlyClickJump(user); break; } } case LEFT_CLICK_BLOCK: if (event.getItem() != null && event.getItem().getType() != Material.AIR) { final User user = ess.getUser(event.getPlayer()); if (user.hasPowerTools() && user.arePowerToolsEnabled() && usePowertools(user, event.getItem().getType())) { event.setCancelled(true); } } break; case PHYSICAL: if(event.getClickedBlock().getType().toString().contains("PRESSURE_PLATE")) { final User user = ess.getUser(event.getPlayer()); if(user.isVanished()){ event.setCancelled(true); } } updateActivity = false; break; } if (updateActivity) { ess.getUser(event.getPlayer()).updateActivityOnInteract(true); } }
Source:
public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) { checkNotNull(resourceGroup, "resourceGroup cannot be null"); checkNotNull(vaultUri, "vaultUri cannot be null"); return retry(new Predicate<String>() { @Override public boolean apply(final String name) { checkNotNull(name, "name cannot be null"); boolean result = false; KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name); if (key != null) { if (isRecovered) { result = true; } else { result = key.attributes().recoveryLevel().contains("Recoverable"); } } return result; } }, operationTimeout, initialPeriod, maxPeriod); }

Target:
public Predicate<String> create(final String resourceGroup, final URI vaultUri, final boolean isRecovered) { checkNotNull(resourceGroup, "resourceGroup cannot be null"); checkNotNull(vaultUri, "vaultUri cannot be null"); return retry(new Predicate<String>() { @Override public boolean apply(final String name) { checkNotNull(name, "name cannot be null"); boolean result = false; KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name); return key != null ? (isRecovered ? true : key.attributes().recoveryLevel().contains("Recoverable")) : false; } }, operationTimeout, initialPeriod, maxPeriod); }
Source:
protected void findAndResetInvoiceColumn(ResultRow row) { row.getColumns().stream() .filter(col -> StringUtils.equalsAnyIgnoreCase(col.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) .findFirst() .ifPresent(col -> resetInvoiceColumn(row, col)); }

Target:
protected void findAndResetInvoiceColumn(ResultRow row) { row.getColumns().stream() .filter(col -> StringUtils.equalsIgnoreCase(col.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) .findFirst() .ifPresent(col -> resetInvoiceColumn(row, col)); }
Source:
public static SnippetType fromString(String type) { if (type == null) { throw new IllegalArgumentException(); } for (SnippetType snippetType : SnippetType.values()) { if (type.equalsIgnoreCase(snippetType.type)) { return snippetType; } } throw new IllegalArgumentException(); }

Target:
public static SnippetType fromString(String type) { if (type == null) { throw new CucumberException("Cannot pass null as SnippetType"); } for (SnippetType snippetType : SnippetType.values()) { if (type.equalsIgnoreCase(snippetType.type)) { return snippetType; } } throw new CucumberException(String.format("Unrecognized SnippetType %s", type)); }
Source:
public void testIssue() throws Exception { int port = SocketUtil.getAvailablePort(); final WebSocketClient client = new WebSocketClient(new URI("ws://localhost:" + port)) { @Override public void onOpen(ServerHandshake handshakedata) { } @Override public void onMessage(String message) { } @Override public void onClose(int code, String reason, boolean remote) { } @Override public void onError(Exception ex) { } }; WebSocketServer server = new WebSocketServer(new InetSocketAddress(port)) { @Override public void onOpen(WebSocket conn, ClientHandshake handshake) { } @Override public void onClose(WebSocket conn, int code, String reason, boolean remote) { countCloseCallsDownLatch.countDown(); } @Override public void onMessage(WebSocket conn, String message) { } @Override public void onError(WebSocket conn, Exception ex) { } @Override public void onStart() { countServerDownLatch.countDown(); } }; new Thread(server).start(); countServerDownLatch.await(); client.connectBlocking(); WebSocketImpl websocketImpl = (WebSocketImpl)new ArrayList<WebSocket>(server.getConnections()).get(0); websocketImpl.setChannel(new ExceptionThrowingByteChannel()); server.broadcast("test"); countCloseCallsDownLatch.await(); }

Target:
public void testIssue() throws Exception { int port = SocketUtil.getAvailablePort(); final WebSocketClient client = new WebSocketClient(new URI("ws://localhost:" + port)) { @Override public void onOpen(ServerHandshake handshakedata) { } @Override public void onMessage(String message) { } @Override public void onClose(int code, String reason, boolean remote) { } @Override public void onError(Exception ex) { } }; WebSocketServer server = new WebSocketServer(new InetSocketAddress(port)) { @Override public void onOpen(WebSocket conn, ClientHandshake handshake) { } @Override public void onClose(WebSocket conn, int code, String reason, boolean remote) { closeCalledLatch.countDown(); } @Override public void onMessage(WebSocket conn, String message) { } @Override public void onError(WebSocket conn, Exception ex) { } @Override public void onStart() { serverStartLatch.countDown(); } }; new Thread(server).start(); serverStartLatch.await(); client.connectBlocking(); WebSocketImpl websocketImpl = (WebSocketImpl)new ArrayList<WebSocket>(server.getConnections()).get(0); websocketImpl.setChannel(new ExceptionThrowingByteChannel()); server.broadcast("test"); closeCalledLatch.await(); }
Source:
private boolean equalButForId(SCMSource a, SCMSource b) { if (!a.getClass().equals(b.getClass())) { return false; } boolean fallBack = false; Class<?> clazz = a.getClass(); REFLECTION: while (clazz != null && SCMSource.class.isAssignableFrom(clazz) && clazz != SCMSource.class) { for (Field field : clazz.getDeclaredFields()) { int modifiers = field.getModifiers(); if (Modifier.isStatic(modifiers)) { continue; } if (Modifier.isTransient(modifiers)) { continue; } if (!field.isAccessible()) { field.setAccessible(true); } if (!field.isAccessible()) { fallBack = true; break REFLECTION; } Object aField; Object bField; try { aField = field.get(a); bField = field.get(b); } catch (IllegalAccessException e) { fallBack = true; break REFLECTION; } if (aField == null && bField == null) { continue; } if (aField == null || bField == null) { return false; } if (aField.equals(bField)) { continue; } if (aField instanceof Boolean || aField instanceof Number || aField instanceof String) { return false; } if (SOURCE_ID_OMITTED_XSTREAM.toXML(aField).equals(SOURCE_ID_OMITTED_XSTREAM.toXML(bField))) { continue; } return false; } clazz = clazz.getSuperclass(); } return !fallBack || SOURCE_ID_OMITTED_XSTREAM.toXML(a).equals(SOURCE_ID_OMITTED_XSTREAM.toXML(b)); }

Target:
private boolean equalButForId(SCMSource a, SCMSource b) { if (!a.getClass().equals(b.getClass())) { return false; } return SOURCE_ID_OMITTED_XSTREAM.toXML(a).equals(SOURCE_ID_OMITTED_XSTREAM.toXML(b)); }
Source:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (newVersion <= oldVersion) { Timber.w("Can't downgrade from version %d to version %d", oldVersion, newVersion); return; } if (oldVersion < 2) { db.execSQL("DROP TABLE IF EXISTS " + TranslationsTable.TABLE_NAME); db.execSQL(CREATE_TRANSLATIONS_TABLE); } }

Target:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion < 2) { final String BACKUP_TABLE = TranslationsTable.TABLE_NAME + "_backup"; db.execSQL(TranslationsTable.getCreateTableSql(BACKUP_TABLE)); db.execSQL("INSERT INTO " + BACKUP_TABLE + " (" + TranslationsTable.ID + ", " + TranslationsTable.NAME + ", " + TranslationsTable.TRANSLATOR + ", " + TranslationsTable.FILENAME + ", " + TranslationsTable.URL + ", " + TranslationsTable.VERSION + ")" + "SELECT " + TranslationsTable.ID + ", " + TranslationsTable.NAME + ", " + TranslationsTable.TRANSLATOR + ", " + TranslationsTable.FILENAME + ", " + TranslationsTable.URL + ", " + TranslationsTable.VERSION + " FROM " + TranslationsTable.TABLE_NAME + ";"); db.execSQL("DROP TABLE " + TranslationsTable.TABLE_NAME); db.execSQL("ALTER TABLE " + BACKUP_TABLE + " RENAME TO " + TranslationsTable.TABLE_NAME); } }
Source:
public Response<AppendBlobItem> createWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context) { return StorageImplUtils.blockWithOptionalTimeout(appendBlobAsyncClient. createWithResponse(options, context), options == null ? null : timeout); }

Target:
public Response<AppendBlobItem> createWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context) { return StorageImplUtils.blockWithOptionalTimeout(appendBlobAsyncClient. createWithResponse(options, context), timeout); }
Source:
protected String callValidateSession(String sessionID) { try { String data = String.format(SESSION_DATA_FORMAT, URLEncoder.encode(sessionID, "UTF-8")); HttpURLConnection servletConnection = createURLConnection(); if (servletConnection == null) { logger.error("Unable to create servlet connection."); return null; } DataOutputStream output = new DataOutputStream(servletConnection.getOutputStream()); output.writeBytes(data); output.flush(); output.close(); if (servletConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { logger.error("ValidateSession servlet returned " + servletConnection.getResponseCode()); return null; } InputStream inputStream = servletConnection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String inputLine; inputLine = reader.readLine(); return inputLine; } catch (MalformedURLException e) { e.printStackTrace(); logger.error(e); return null; } catch (IOException e) { e.printStackTrace(); logger.error(e); return null; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); logger.error(e); return null; } catch (CertificateException e) { e.printStackTrace(); logger.error(e); return null; } catch (KeyStoreException e) { e.printStackTrace(); logger.error(e); return null; } catch (KeyManagementException e) { e.printStackTrace(); logger.error(e); return null; } }

Target:
protected String callValidateSession(String sessionID) { DataOutputStream output = null; try { String data = String.format(SESSION_DATA_FORMAT, URLEncoder.encode(sessionID, "UTF-8")); HttpURLConnection servletConnection = createURLConnection(); if (servletConnection == null) { logger.error("Unable to create servlet connection."); return null; } output = new DataOutputStream(servletConnection.getOutputStream()); output.writeBytes(data); output.flush(); output.close(); if (servletConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { logger.error("ValidateSession servlet returned " + servletConnection.getResponseCode()); return null; } InputStream inputStream = servletConnection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String inputLine; inputLine = reader.readLine(); return inputLine; } catch (Exception ex) { logger.error(ex); } finally { try { if (output != null) output.close(); } catch (IOException ex) { logger.error(ex); } } return null; }
Source:
private void readLinesLoop(Pattern success, Pattern failure, BufferedReader reader) throws IOException { StringBuilder output = new StringBuilder(); output.append(String.format("Webpack build failed with errors:%n")); Consumer<String> info = s -> getLogger().debug(GREEN, s); Consumer<String> error = s -> getLogger().error(RED, s); Consumer<String> warn = s -> getLogger().debug(YELLOW, s); Consumer<String> log = info; for (String line; ((line = reader.readLine()) != null);) { String cleanLine = line .replaceAll("\u001b\\[[;\\d]*m", "") .replaceAll("\\?babel-target=[\\w\\d]+", ""); log = line.contains("WARNING") ? warn : line.contains("ERROR") ? error : log; log.accept(cleanLine); if(line.contains("ERROR")) { output.append(cleanLine).append(System.lineSeparator()); } boolean succeed = success.matcher(line).find(); boolean failed = failure.matcher(line).find(); if (succeed || failed) { log.accept(succeed ? SUCCEED_MSG : FAILED_MSG); failedOutput = failed ? output.toString() : null; output = new StringBuilder(); log = info; doNotify(); } } }

Target:
private void readLinesLoop(Pattern success, Pattern failure, BufferedReader reader) throws IOException { StringBuilder output = getOutputBuilder(); Consumer<String> info = s -> getLogger().debug(GREEN, s); Consumer<String> error = s -> getLogger().error(RED, s); Consumer<String> warn = s -> getLogger().debug(YELLOW, s); Consumer<String> log = info; for (String line; ((line = reader.readLine()) != null);) { String cleanLine = line .replaceAll("\u001b\\[[;\\d]*m", "") .replaceAll("\\?babel-target=[\\w\\d]+", ""); log = line.contains("WARNING") ? warn : line.contains("ERROR") ? error : log; log.accept(cleanLine); if(line.contains("ERROR")) { output.append(cleanLine).append(System.lineSeparator()); } boolean succeed = success.matcher(line).find(); boolean failed = failure.matcher(line).find(); if (succeed || failed) { log.accept(succeed ? SUCCEED_MSG : FAILED_MSG); failedOutput = failed ? output.toString() : null; output = getOutputBuilder(); log = info; doNotify(); } } }
Source:
protected RoleDTO initSourceObject() { RoleDTO source = new RoleDTO(); List<UserDTO> users = new ArrayList<>(); List<PermissionBlueprintDTO> permissions = new ArrayList<>(); for (int i = 0; i < 5; ++i) { UserDTO user = (UserDTO) this.userDTOTranslatorTest.initSourceObject(); user.setId("test-user-" + i); PermissionBlueprintDTO permission = (PermissionBlueprintDTO) this.permDTOTranslatorTest.initSourceObject(); permission.setId("test-perm-" + i); users.add(user); permissions.add(permission); } source.id("test-role-id") .name("test-role-name") .users(users) .permissions(permissions) .created(new Date().toInstant().atOffset(ZoneOffset.UTC)) .updated(new Date().toInstant().atOffset(ZoneOffset.UTC)); return source; }

Target:
protected RoleDTO initSourceObject() { RoleDTO source = new RoleDTO(); Set<UserDTO> users = new HashSet<>(); List<PermissionBlueprintDTO> permissions = new ArrayList<>(); for (int i = 0; i < 5; ++i) { UserDTO user = (UserDTO) this.userDTOTranslatorTest.initSourceObject(); user.setUsername("user_username" + i); PermissionBlueprintDTO permission = (PermissionBlueprintDTO) this.permDTOTranslatorTest.initSourceObject(); permission.setId("test-perm-" + i); users.add(user); permissions.add(permission); } source.id("test-role-id") .name("test-role-name") .users(users) .permissions(permissions) .created(OffsetDateTime.now()) .updated(OffsetDateTime.now()); return source; }
Source:
public CustomProcessorInfo addCustomProcessorInfo (CustomProcessorInfo customProcessorInfo, InputStream jarFile, InputStream imageFile) throws IOException { try { uploadFileToStorage(jarFile, customProcessorInfo.getJarFileName()); uploadFileToStorage(imageFile, customProcessorInfo.getImageFileName()); TopologyComponentDefinition topologyComponentDefinition = customProcessorInfo.toTopologyComponent(); topologyComponentDefinition.setId(this.dao.nextId(TopologyComponentDefinition.NAME_SPACE)); this.dao.add(topologyComponentDefinition); } catch (StorageException|IOException e) { LOG.error(String.format("Unexpected exception thrown while adding custom processor info %s", customProcessorInfo.getName())); throw e; } finally { try { deleteFileFromStorage(customProcessorInfo.getJarFileName()); deleteFileFromStorage(customProcessorInfo.getJarFileName()); } catch (IOException e) { LOG.error(String.format("Unexpected exception thrown while cleaning up custom processor info %s", customProcessorInfo.getName())); throw e; } } return customProcessorInfo; }

Target:
public CustomProcessorInfo addCustomProcessorInfo (CustomProcessorInfo customProcessorInfo, InputStream jarFile, InputStream imageFile) throws IOException { try { uploadFileToStorage(jarFile, customProcessorInfo.getJarFileName()); uploadFileToStorage(imageFile, customProcessorInfo.getImageFileName()); TopologyComponentDefinition topologyComponentDefinition = customProcessorInfo.toTopologyComponent(); topologyComponentDefinition.setId(this.dao.nextId(TopologyComponentDefinition.NAME_SPACE)); this.dao.add(topologyComponentDefinition); } catch (StorageException|IOException e) { LOG.error("Unexpected exception thrown while adding custom processor info %s", customProcessorInfo.getName()); throw e; } finally { try { deleteFileFromStorage(customProcessorInfo.getJarFileName()); deleteFileFromStorage(customProcessorInfo.getImageFileName()); } catch (IOException e) { LOG.error("Unexpected exception thrown while cleaning up custom processor info %s", customProcessorInfo.getName()); throw e; } } return customProcessorInfo; }
Source:
public void testUnattributedOutcomeSuccess() throws Exception { service.setSuccess(true); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); new Thread(new Runnable() { @Override public void run() { handler.setOutcomes(repository.getSavedOutcomeEvents()); } }, "OS_GET_SAVED_OUTCOMES_SUCCESS").start(); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{\"id\":\"testing\",\"sources\":{},\"device_type\":1}", service.getLastJsonObjectSent()); }

Target:
public void testUnattributedOutcomeSuccess() throws Exception { service.setSuccess(true); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); handler.setOutcomes(repository.getSavedOutcomeEvents()); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{\"id\":\"testing\",\"sources\":{},\"device_type\":1}", service.getLastJsonObjectSent()); }
Source:
public String graphData( Map<String, Object> model, @RequestParam(value = "id", defaultValue = "") String id, @RequestParam(value = "uri", defaultValue = "") String uri, @RequestParam(value = "min_edges", required = false, defaultValue = "1") String minEdges ) { if (Strings.isNullOrEmpty(uri) && Strings.isNullOrEmpty(id)) { throw new IllegalArgumentException("Must specify at least one of 'uri' or 'id'"); } int minimumEdgeCount = Integer.parseInt(minEdges); model.put("id", id); model.put("uri", uri); model.put("min_edges", minimumEdgeCount); String uriFromId = getUriFromId(id).get(); LookupEntry subj = Iterables.getOnlyElement( lookupStore.entriesForCanonicalUris(ImmutableList.of(uri, uriFromId)), null ); if (subj != null) { Iterable<LookupEntry> equivs = lookupStore.entriesForCanonicalUris( subj.equivalents() .stream() .map(LookupRef.TO_URI::apply) .collect(Collectors.toList())); List<SimpleModel> nodes = Lists.newLinkedList(); for (LookupEntry equiv : equivs) { if (edgeCount(equiv) >= minimumEdgeCount) { SimpleModel nodeModel = modelNode(equiv); if (equiv.uri().equals(uri)) { nodeModel.put("fixed", true); } nodes.add(nodeModel); } } model.put("content", new SimpleModelList(nodes)); } return "equivalence.graph"; }

Target:
public String graphData( Map<String, Object> model, @RequestParam(value = "id", defaultValue = "") String id, @RequestParam(value = "uri", defaultValue = "") String uri, @RequestParam(value = "min_edges", required = false, defaultValue = "1") String minEdges ) { if (Strings.isNullOrEmpty(uri) && Strings.isNullOrEmpty(id)) { throw new IllegalArgumentException("Must specify at least one of 'uri' or 'id'"); } int minimumEdgeCount = Integer.parseInt(minEdges); model.put("id", id); model.put("uri", uri); model.put("min_edges", minimumEdgeCount); String uriFromId = ""; if (getUriFromId(id).isPresent()) { uriFromId = getUriFromId(id).get(); } LookupEntry subj = Iterables.getOnlyElement( lookupStore.entriesForCanonicalUris(ImmutableList.of(uri, uriFromId)), null ); if (subj != null) { Iterable<LookupEntry> equivs = lookupStore.entriesForCanonicalUris( subj.equivalents() .stream() .map(LookupRef.TO_URI::apply) .collect(Collectors.toList())); List<SimpleModel> nodes = Lists.newLinkedList(); for (LookupEntry equiv : equivs) { if (edgeCount(equiv) >= minimumEdgeCount) { SimpleModel nodeModel = modelNode(equiv); if (equiv.uri().equals(uri)) { nodeModel.put("fixed", true); } nodes.add(nodeModel); } } model.put("content", new SimpleModelList(nodes)); } return "equivalence.graph"; }
Source:
private synchronized boolean performCheck(Nameable entity, Predicate<IAuthorizationPlugin> predicate) { lock.readLock().lock(); try { return stack.isAllowed(entity, predicate); } finally { lock.readLock().unlock(); } }

Target:
private boolean performCheck(Nameable entity, Predicate<IAuthorizationPlugin> predicate) { lock.readLock().lock(); try { return stack.isAllowed(entity, predicate); } finally { lock.readLock().unlock(); } }
Source:
protected Node visitShowStats(ShowStats node, Void context) { checkState(queryExplainer.isPresent(), "Query explainer must be provided for SHOW STATS SELECT"); if (node.getRelation() instanceof TableSubquery) { QuerySpecification specification = (QuerySpecification) ((TableSubquery) node.getRelation()).getQuery().getQueryBody(); Plan plan = queryExplainer.get().getLogicalPlan(session, new Query(Optional.empty(), specification, Optional.empty(), Optional.empty()), parameters); validateShowStats(node, plan); Table table = (Table) specification.getFrom().get(); Constraint<ColumnHandle> constraint = getConstraint(specification, plan); return rewriteShowStats(node, table, constraint); } else if (node.getRelation() instanceof Table) { Table table = (Table) node.getRelation(); return rewriteShowStats(node, table, Constraint.alwaysTrue()); } else { throw new IllegalArgumentException("Expected either TableSubquery or Table as relation"); } }

Target:
protected Node visitShowStats(ShowStats node, Void context) { checkState(queryExplainer.isPresent(), "Query explainer must be provided for SHOW STATS SELECT"); if (node.getRelation() instanceof TableSubquery) { Query query = ((TableSubquery) node.getRelation()).getQuery(); QuerySpecification specification = (QuerySpecification) query.getQueryBody(); Plan plan = queryExplainer.get().getLogicalPlan(session, new Query(Optional.empty(), specification, Optional.empty(), Optional.empty()), parameters, warningCollector); validateShowStatsSubquery(node, query, specification, plan); Table table = (Table) specification.getFrom().get(); Constraint<ColumnHandle> constraint = getConstraint(plan); return rewriteShowStats(node, table, constraint); } else if (node.getRelation() instanceof Table) { Table table = (Table) node.getRelation(); return rewriteShowStats(node, table, Constraint.alwaysTrue()); } else { throw new IllegalArgumentException("Expected either TableSubquery or Table as relation"); } }
Source:
private void updateCommand(Class<?> handlerType, Object[] elements, IEnabledTarget[] actions) { boolean hasMultipleWindowServices = hasMultipleWindowServices(); if (!hasMultipleWindowServices) { Job.getJobManager().cancel(handlerType); } if (elements.length == 1) { Object element = elements[0]; IDebugCommandHandler handler = getHandler(element, handlerType); if (handler != null) { UpdateActionsRequest request = new UpdateActionsRequest(elements, actions); handler.canExecute(request); return; } } else { Map<IDebugCommandHandler, List<Object>> map = collate(elements, handlerType); if (map != null) { ActionsUpdater updater = new ActionsUpdater(actions, map.size()); for (Entry<IDebugCommandHandler, List<Object>> entry : map.entrySet()) { UpdateHandlerRequest request = new UpdateHandlerRequest(entry.getValue().toArray(), updater); entry.getKey().canExecute(request); } return; } } for (IEnabledTarget action : actions) { action.setEnabled(false); } }

Target:
private void updateCommand(Class<?> handlerType, Object[] elements, IEnabledTarget[] actions) { cancelHandlerEnablementUpdateJobs(handlerType); if (elements.length == 1) { Object element = elements[0]; IDebugCommandHandler handler = getHandler(element, handlerType); if (handler != null) { UpdateActionsRequest request = new UpdateActionsRequest(elements, actions); handler.canExecute(request); return; } } else { Map<IDebugCommandHandler, List<Object>> map = collate(elements, handlerType); if (map != null) { ActionsUpdater updater = new ActionsUpdater(actions, map.size()); for (Entry<IDebugCommandHandler, List<Object>> entry : map.entrySet()) { UpdateHandlerRequest request = new UpdateHandlerRequest(entry.getValue().toArray(), updater); entry.getKey().canExecute(request); } return; } } for (IEnabledTarget action : actions) { action.setEnabled(false); } }
Source:
private ReplLoadOpType getLoadTableType(Table table, boolean isBootstrapDuringInc) throws InvalidOperationException, HiveException { if (table == null) { return ReplLoadOpType.LOAD_NEW; } if (isBootstrapDuringInc && AcidUtils.isTransactionalTable(table)) { LOG.info("Transactional table " + table.getTableName() + " will be replaced"); return ReplLoadOpType.LOAD_REPLACE; } if (ReplUtils.replCkptStatus(table.getDbName(), table.getParameters(), context.dumpDirectory)) { return ReplLoadOpType.LOAD_SKIP; } return ReplLoadOpType.LOAD_REPLACE; }

Target:
private ReplLoadOpType getLoadTableType(Table table, boolean isBootstrapDuringInc) throws InvalidOperationException, HiveException { if (table == null) { return ReplLoadOpType.LOAD_NEW; } if (isBootstrapDuringInc) { LOG.info("Table " + table.getTableName() + " will be replaced as bootstrap is requested during incremental load"); return ReplLoadOpType.LOAD_REPLACE; } if (ReplUtils.replCkptStatus(table.getDbName(), table.getParameters(), context.dumpDirectory)) { return ReplLoadOpType.LOAD_SKIP; } return ReplLoadOpType.LOAD_REPLACE; }
Source:
public void received( final Object o ) { if ( o instanceof Initialize ) { init( (Initialize) o ); } else if ( o instanceof RequestStatus ) { requestStatus(); } else if ( o instanceof RemoveRule ) { getUpdateManager().removeRule( ( (RemoveRule) o ).getDeletedRow() ); } else if ( o instanceof Update ) { try { getUpdateManager().update( ( (Update) o ).getModel(), ( (Update) o ).getCoordinates() ); } catch ( final UpdateException e ) { poster.post( new WebWorkerException( e.getMessage() ) ); } } else if ( o instanceof DeleteColumns ) { getUpdateManager().deleteColumns( ( (DeleteColumns) o ).getFirstColumnIndex(), ( (DeleteColumns) o ).getNumberOfColumns() ); } else if ( o instanceof MakeRule ) { makeRule( (MakeRule) o ); } else if ( o instanceof NewColumn ) { newColumn( (NewColumn) o ); } }

Target:
public void received( final Object o ) { if ( o instanceof Initialize ) { init( (Initialize) o ); } else if ( o instanceof RequestStatus ) { requestStatus(); } else if ( o instanceof RemoveRule ) { removeRule( (RemoveRule) o ); } else if ( o instanceof Update ) { update( (Update) o ); } else if ( o instanceof DeleteColumns ) { deleteColumns( (DeleteColumns) o ); } else if ( o instanceof MakeRule ) { makeRule( (MakeRule) o ); } else if ( o instanceof NewColumn ) { newColumn( (NewColumn) o ); } }
Source:
private void buildSwitchStatement(SwitchStatementTree switchStatementTree) { Block switchSuccessor = currentBlock; currentBlock = createBlock(); currentBlock.terminator = switchStatementTree; switches.addLast(currentBlock); build(switchStatementTree.expression()); currentBlock = createBlock(switchSuccessor); breakTargets.addLast(switchSuccessor); boolean defaultCaseMet = false; if (!switchStatementTree.cases().isEmpty()) { CaseGroupTree firstCase = switchStatementTree.cases().get(0); for (CaseGroupTree caseGroupTree : Lists.reverse(switchStatementTree.cases())) { build(caseGroupTree.body()); for (CaseLabelTree caseLabel : caseGroupTree.labels()) { if ("default".equals(caseLabel.caseOrDefaultKeyword().text())) { defaultCaseMet = true; } } switches.getLast().addSuccessor(currentBlock); if (!caseGroupTree.equals(firstCase)) { currentBlock = createBlock(currentBlock); } } } breakTargets.removeLast(); currentBlock = switches.removeLast(); if (!defaultCaseMet) { currentBlock.addSuccessor(switchSuccessor); } }

Target:
private void buildSwitchStatement(SwitchStatementTree switchStatementTree) { Block switchSuccessor = currentBlock; currentBlock = createBlock(); currentBlock.terminator = switchStatementTree; switches.addLast(currentBlock); build(switchStatementTree.expression()); currentBlock = createBlock(switchSuccessor); breakTargets.addLast(switchSuccessor); boolean hasDefaultCase = false; if (!switchStatementTree.cases().isEmpty()) { CaseGroupTree firstCase = switchStatementTree.cases().get(0); for (CaseGroupTree caseGroupTree : Lists.reverse(switchStatementTree.cases())) { build(caseGroupTree.body()); if (!hasDefaultCase) { for (CaseLabelTree caseLabel : caseGroupTree.labels()) { if ("default".equals(caseLabel.caseOrDefaultKeyword().text())) { hasDefaultCase = true; break; } } } switches.getLast().addSuccessor(currentBlock); if (!caseGroupTree.equals(firstCase)) { currentBlock = createBlock(currentBlock); } } } breakTargets.removeLast(); currentBlock = switches.removeLast(); if (!hasDefaultCase) { currentBlock.addSuccessor(switchSuccessor); } }
Source:
private List<ItemDefinition> setItemDefinitionsNamespace(final List<ItemDefinition> itemDefinitions, final String namespace) { return itemDefinitions .stream() .peek(itemDefinition -> setItemDefinitionNamespace(itemDefinition, namespace)) .collect(Collectors.toList()); }

Target:
private List<ItemDefinition> setItemDefinitionsNamespace(final List<ItemDefinition> itemDefinitions, final String namespace) { return itemDefinitions .stream() .map(itemDefinition -> setItemDefinitionNamespace(itemDefinition, namespace)) .collect(Collectors.toList()); }
Source:
public ExecutionEngineJNI( final int clusterIndex, final long siteId, final int partitionId, final int hostId, final String hostname, final int drClusterId, final int defaultDrBufferSize, final int tempTableMemory, final HashinatorConfig hashinatorConfig, final boolean createDrReplicatedStream) { super(siteId, partitionId); LOG.trace("Creating Execution Engine on clusterIndex=" + clusterIndex + ", site_id = " + siteId + "..."); pointer = nativeCreate(System.getProperty("java.vm.vendor") .toLowerCase().contains("sun microsystems")); nativeSetLogLevels(pointer, EELoggers.getLogLevels()); int errorCode = nativeInitialize( pointer, clusterIndex, siteId, partitionId, hostId, getStringBytes(hostname), drClusterId, defaultDrBufferSize, tempTableMemory * 1024 * 1024, createDrReplicatedStream, EE_COMPACTION_THRESHOLD); checkErrorCode(errorCode); setupPsetBuffer(smallBufferSize); setupPerFragmentStatsBuffer(smallBufferSize); setupUDFBuffer(2 * 1024 * 1024); updateEEBufferPointers(); updateHashinator(hashinatorConfig); }

Target:
public ExecutionEngineJNI( final int clusterIndex, final long siteId, final int partitionId, final int hostId, final String hostname, final int drClusterId, final int defaultDrBufferSize, final int tempTableMemory, final HashinatorConfig hashinatorConfig, final boolean createDrReplicatedStream) { super(siteId, partitionId); LOG.trace("Creating Execution Engine on clusterIndex=" + clusterIndex + ", site_id = " + siteId + "..."); pointer = nativeCreate(System.getProperty("java.vm.vendor") .toLowerCase().contains("sun microsystems")); nativeSetLogLevels(pointer, EELoggers.getLogLevels()); int errorCode = nativeInitialize( pointer, clusterIndex, siteId, partitionId, hostId, getStringBytes(hostname), drClusterId, defaultDrBufferSize, tempTableMemory * 1024 * 1024, createDrReplicatedStream, EE_COMPACTION_THRESHOLD); checkErrorCode(errorCode); setupPsetBuffer(smallBufferSize); setupPerFragmentStatsBuffer(smallBufferSize); setupUDFBuffer(smallBufferSize); updateEEBufferPointers(); updateHashinator(hashinatorConfig); }
Source:
public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("ServiceStartArguments", android.os.Process.THREAD_PRIORITY_BACKGROUND); thread.start(); Looper serviceLooper = thread.getLooper(); mServiceHandler = getHandler(serviceLooper); Replicator[] replicators = getReplicators(getApplicationContext()); if (replicators != null && replicators.length > 0) { if (mReplicationPolicyManager == null) { mReplicationPolicyManager = new ReplicationPolicyManager() { @Override public void start() { } @Override public void stop() { } }; } mReplicationPolicyManager.addReplicators(replicators); mReplicationPolicyManager.setReplicationsCompletedListener(this); mReplicationPolicyManager.start(); } else { throw new RuntimeException( "No replications setup. Please return Replicators from getReplicators()"); } }

Target:
public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("ServiceStartArguments", android.os.Process.THREAD_PRIORITY_BACKGROUND); thread.start(); Looper serviceLooper = thread.getLooper(); mServiceHandler = getHandler(serviceLooper); Replicator[] replicators = getReplicators(getApplicationContext()); if (replicators != null && replicators.length > 0) { if (mReplicationPolicyManager == null) { mReplicationPolicyManager = new ReplicationPolicyManager(); } mReplicationPolicyManager.addReplicators(replicators); mReplicationPolicyManager.setReplicationsCompletedListener(this); } else { throw new RuntimeException( "No replications setup. Please return Replicators from getReplicators()"); } }
Source:
public String getCanonicalName(ApiMethodArg argument) throws MojoExecutionException { final Class<?> type = argument.getType(); if (type.isPrimitive()) { return getCanonicalName(ClassUtils.primitiveToWrapper(type)); } String canonicalName = getCanonicalName(type); final String typeArgs = argument.getTypeArgs(); if (typeArgs != null) { StringBuilder parameterizedType = new StringBuilder(canonicalName); parameterizedType.append('<'); final String[] argTypes = typeArgs.split(","); boolean ignore = false; final int nTypes = argTypes.length; int i = 0; for (String argType : argTypes) { try { parameterizedType.append(getCanonicalName(getProjectClassLoader().loadClass(argType))); } catch (ClassNotFoundException e) { try { if (log.isDebugEnabled()) { log.debug("Could not load " + argType + ", trying to load java.lang." + argType); } parameterizedType.append( getCanonicalName(getProjectClassLoader().loadClass("java.lang." + argType))); } catch (ClassNotFoundException e1) { if (argType.trim().length() > 1) { log.warn("Ignoring type parameters <" + typeArgs + "> for argument " + argument.getName() + ", unable to load parametric type argument " + argType, e1); ignore = true; } else { parameterizedType.append("?"); } } } if (ignore) { break; } else if (++i < nTypes) { parameterizedType.append(","); } } if (!ignore) { parameterizedType.append('>'); canonicalName = parameterizedType.toString(); } } return canonicalName; }

Target:
public String getCanonicalName(ApiMethodArg argument) throws MojoExecutionException { final Class<?> type = argument.getType(); if (type.isPrimitive()) { return getCanonicalName(ClassUtils.primitiveToWrapper(type)); } String canonicalName = getCanonicalName(type); final String typeArgs = argument.getTypeArgs(); if (typeArgs != null) { StringBuilder parameterizedType = new StringBuilder(canonicalName); parameterizedType.append('<'); final String[] argTypes = typeArgs.split(","); final int nTypes = argTypes.length; int i = 0; for (String argType : argTypes) { try { parameterizedType.append(getCanonicalName(getProjectClassLoader().loadClass(argType))); } catch (ClassNotFoundException e) { try { if (log.isDebugEnabled()) { log.debug("Could not load " + argType + ", trying to load java.lang." + argType); } parameterizedType.append( getCanonicalName(getProjectClassLoader().loadClass("java.lang." + argType))); } catch (ClassNotFoundException e1) { parameterizedType.append("?"); if (argType.trim().length() > 1) { log.warn("Ignoring type parameters <" + typeArgs + "> for argument " + argument.getName() + ", unable to load parametric type argument " + argType, e1); } } } if (++i < nTypes) { parameterizedType.append(","); } } parameterizedType.append('>'); canonicalName = parameterizedType.toString(); } return canonicalName; }
Source:
private static void assertObjectsAreDistinct(GetBlobOptions a, GetBlobOptions b) { assertThat("GetBlobOptions should not be equal.", a, not(b)); assertThat("GetBlobOptions hashcodes should not be equal", a.hashCode(), not(b.hashCode())); assertThat("GetBlobOptions toString should not be equal", a.toString(), not(b.toString())); }

Target:
private static void assertObjectsAreDistinct(GetBlobOptions a, GetBlobOptions b) { assertThat("GetBlobOptions should not be equal.", a, not(b)); assertThat("GetBlobOptions toString should not be equal", a.toString(), not(b.toString())); }
Source:
private InputStream getManagedFile(Run<?, ?> run, String fileName) throws UnsupportedEncodingException { InputStream stream = null; Plugin plugin = Jenkins.get().getPlugin("config-file-provider"); if (plugin != null) { Config config = null; assert getProviderClass() != null; List<Config> configs = ConfigFiles.getConfigsInContext(run.getParent().getParent(), getProviderClass()); for (Config c : configs) { if (c.name.equalsIgnoreCase(fileName)) { config = c; break; } } if (config != null) { stream = new ByteArrayInputStream(config.content.getBytes("UTF-8")); } } return stream; }

Target:
private InputStream getManagedFile(Run<?, ?> run, String fileName) throws UnsupportedEncodingException { InputStream stream = null; Plugin plugin = Jenkins.get().getPlugin("config-file-provider"); if (plugin != null) { Config config = null; List<Config> configs = ConfigFiles.getConfigsInContext(run.getParent().getParent(), getProviderClass()); for (Config c : configs) { if (c.name.equalsIgnoreCase(fileName)) { config = c; break; } } if (config != null) { stream = new ByteArrayInputStream(config.content.getBytes("UTF-8")); } } return stream; }
Source:
public void create() { if (exists()) { return; } final CreateIndexRequestBuilder req = client().admin().indices().prepareCreate(name); final Multimap<String, Map<String, Object>> esMappings = HashMultimap.create(); for (DocumentMapping mapping : mappings.getMappings()) { final String type = mapping.typeAsString(); Map<String, Object> typeMapping = ImmutableMap.of(type, ImmutableMap.builder() .put("_all", ImmutableMap.of("enabled", false)) .putAll(toProperties(mapping)) .build() ); esMappings.put(type, typeMapping); } for (String type : esMappings.keySet()) { final Map<String, Object> typeMapping = esMappings.get(type).stream().sorted((m1, m2) -> -1 * Ints.compare(m1.toString().length(), m2.toString().length())).findFirst().get(); req.addMapping(type, typeMapping); } try { final Map<String, Object> indexSettings = createSettings(); log.info("Configuring '{}' index with settings: {}", name, indexSettings); req.setSettings(indexSettings); } catch (IOException e) { throw new IndexException("Couldn't prepare settings for index " + name, e); } CreateIndexResponse response = req.get(); checkState(response.isAcknowledged(), "Failed to create index %s", name); waitForYellowHealth(); }

Target:
public void create() { if (exists()) { waitForYellowHealth(); return; } final CreateIndexRequestBuilder req = client().admin().indices().prepareCreate(name); final Multimap<String, Map<String, Object>> esMappings = HashMultimap.create(); for (DocumentMapping mapping : mappings.getMappings()) { final String type = mapping.typeAsString(); Map<String, Object> typeMapping = ImmutableMap.of(type, ImmutableMap.builder() .put("_all", ImmutableMap.of("enabled", false)) .putAll(toProperties(mapping)) .build() ); esMappings.put(type, typeMapping); } for (String type : esMappings.keySet()) { final Map<String, Object> typeMapping = esMappings.get(type).stream().sorted((m1, m2) -> -1 * Ints.compare(m1.toString().length(), m2.toString().length())).findFirst().get(); req.addMapping(type, typeMapping); } try { final Map<String, Object> indexSettings = createSettings(); log.info("Configuring '{}' index with settings: {}", name, indexSettings); req.setSettings(indexSettings); } catch (IOException e) { throw new IndexException("Couldn't prepare settings for index " + name, e); } CreateIndexResponse response = req.get(); checkState(response.isAcknowledged(), "Failed to create index %s", name); waitForYellowHealth(); }
Source:
public Object getCustomParam(String name) { return (customParams!=null)?customParams.get(name):null; }

Target:
public Object getCustomParam(String name) { return customParams.get(name); }
Source:
public static String getSisSectionIDChunk(HttpServletRequest request) { String courseId = getLTICustomParam(request, LTI_PARAM_CANVAS_COURSE_ID); if(courseId==null){ M_log.warn("Course id could not be found for making a SIS Section Id"); long epoch = System.currentTimeMillis(); courseId = String.valueOf(epoch); } return "ccmS" + courseId + "-"; }

Target:
public static String getSisSectionIDChunk(HttpServletRequest request) { String courseId = getLTICustomParam(request, LTI_PARAM_CANVAS_COURSE_ID); if(courseId==null){ long epoch = System.currentTimeMillis(); courseId = String.valueOf(epoch); M_log.warn("Course id could not be found for making a SIS Section Id. Used current timestamp for course id:"); } return "ccmS" + courseId + "-"; }