auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String resolveEnvVars(String str) throws SAXException { Matcher m = Pattern.compile("\\$\\{(.*?)\\}").matcher(str); if (m.find()) { String var = m.group(1); String val = System.getenv(var); if (val != null) { return resolveEnvVars(m.replaceFirst(val)); } else { String msg = "The variable is not defined in the system environment: " + var; throw new SAXException(msg); } } else { return str; } }

Target:
private String resolveEnvVars(String str) { Matcher m = Pattern.compile("\\$\\{(.*?)\\}").matcher(str); if (m.find()) { String var = m.group(1); String val = System.getenv(var); if (val != null) { return resolveEnvVars(m.replaceFirst(val)); } else { String msg = "The variable is not defined in the system environment: " + var; GlobalSettings.kem.registerCriticalError(msg); return null; } } else { return str; } }
Source:
protected void fillOptions(Map<Enum, String> options) { options.put(EnumModel.VAL1, EnumModel.VAL1.toString()); options.put(EnumModel.VAL2, EnumModel.VAL2.toString()); options.put(EnumModel.VAL3, EnumModel.VAL3.toString()); options.put(EnumModel.VAL4, EnumModel.VAL4.toString()); }

Target:
protected void fillOptions(Map<Enum, String> options) { options.put(EnumModel.VAL1, EnumModel.VAL1.name()); options.put(EnumModel.VAL2, EnumModel.VAL2.name()); options.put(EnumModel.VAL3, EnumModel.VAL3.name()); options.put(EnumModel.VAL4, EnumModel.VAL4.name()); }
Source:
private VisibilityControl getVisibility(final ChangeResource rsrc) { VisibilityControl visibilityControl; if (rsrc.getControl().getRefControl().isVisibleByRegisteredUsers()) { visibilityControl = new VisibilityControl() { @Override public boolean isVisibleTo(Account account) throws OrmException { return true; } }; } else { visibilityControl = new VisibilityControl() { @Override public boolean isVisibleTo(Account account) throws OrmException { IdentifiedUser who = identifiedUserFactory.create(dbProvider, account.getId()); return rsrc.getControl().forUser(who).isRefVisible(); } }; } return visibilityControl; }

Target:
private VisibilityControl getVisibility(final ChangeResource rsrc) { if (rsrc.getControl().getRefControl().isVisibleByRegisteredUsers()) { return new VisibilityControl() { @Override public boolean isVisibleTo(Account account) throws OrmException { return true; } }; } else { return new VisibilityControl() { @Override public boolean isVisibleTo(Account account) throws OrmException { IdentifiedUser who = identifiedUserFactory.create(dbProvider, account.getId()); return rsrc.getControl().forUser(who).isRefVisible(); } }; } }
Source:
public final void setTaskContext(TaskContext taskContext) { this.cacheManager = taskContext.getCacheManager(); Map<String, byte[]> rawParams = (Map<String, byte[]>) taskContext.getParameters().get(); parameters = new HashMap<>(rawParams.size()); rawParams.entrySet().stream().forEach(entry -> { parameters.put(entry.getKey(), new String(entry.getValue(), CharsetUtil.UTF_8)); }); String sFlags = parameters.remove("flags"); flags = AdminFlag.fromString(sFlags); }

Target:
public final void setTaskContext(TaskContext taskContext) { this.cacheManager = taskContext.getCacheManager(); Map<String, byte[]> rawParams = (Map<String, byte[]>) taskContext.getParameters().get(); parameters = rawParams.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> new String(entry.getValue(), CharsetUtil.UTF_8))); String sFlags = this.parameters.remove("flags"); flags = AdminFlag.fromString(sFlags); }
Source:
public void setSize(Dimension d) { if (d.width <= 0 || d.height <= 0) { d = new Dimension(600, 600); } float ewidth = d.width / 1.5f; float eheight = d.height / 1.5f; lensShape.setFrame(d.width / 2 - ewidth / 2, d.height / 2 - eheight / 2, ewidth, eheight); }

Target:
public void setSize(Dimension d) { Preconditions.checkNotNull(d); Preconditions.checkArgument(d.width > 0, "width must be > 0"); Preconditions.checkArgument(d.height > 0, "height must be > 0"); float width = d.width / 1.5f; float height = d.height / 1.5f; lensShape.setFrame((d.width - width) / 2, (d.height - height) / 2, width, height); }
Source:
private ComponentKeySource(Properties allKeys, String keyName, boolean isEncrypt) { this.availableKeys = allKeys; this.keyName = keyName; this.isEncrypt = isEncrypt; this.keyForEncrypt = this.availableKeys.stringPropertyNames().stream().max(Comparator.comparing(e -> getVersion(e))) .get(); }

Target:
private ComponentKeySource(Properties allKeys, String keyName, boolean isEncrypt) { this.availableKeys = allKeys; this.keyName = keyName; this.isEncrypt = isEncrypt; if (this.isEncrypt) { this.keyName = this.availableKeys.stringPropertyNames().stream().max(Comparator.comparing(e -> getVersion(e))).get(); } }
Source:
public void clearAllDismissedEvents() { ClearDismissedAuditLogsBySeverityParameters params = new ClearDismissedAuditLogsBySeverityParameters( Arrays.asList( AuditLogSeverity.ERROR, AuditLogSeverity.WARNING, AuditLogSeverity.NORMAL )); Frontend.getInstance().runAction(VdcActionType.ClearDismissedAuditLogsBySeverity, params, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { EventListModel.this.refresh(); } }); }

Target:
public void clearAllDismissedEvents() { Frontend.getInstance().runAction(VdcActionType.ClearDismissedAuditLogEvents, new VdcActionParametersBase(), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { EventListModel.this.refresh(); } }); }
Source:
public static UserProfile buildProfile(final String typedId, final Map<String, Object> attributes) { if (CommonHelper.isBlank(typedId)) { return null; } logger.info("Building user profile based on typedId {}", typedId); try { if (!typedId.contains("#")) { final String completeName = determineProfileClassByName("HttpProfile"); return buildUserProfileByClassCompleteName(typedId, attributes, completeName); } final String[] values = typedId.split("#"); final String className = values[0]; final String completeName = determineProfileClassByName(className); return buildUserProfileByClassCompleteName(typedId, attributes, completeName); } catch (final Exception e) { logger.error("Cannot build instance", e); } return null; }

Target:
public static UserProfile buildProfile(final String typedId, final Map<String, Object> attributes) { if (CommonHelper.isBlank(typedId)) { return null; } logger.info("Building user profile based on typedId {}", typedId); try { final String[] values = typedId.split(UserProfile.SEPARATOR); if (values.length >= 1) { final String className = values[0]; final String completeName = determineProfileClassByName(className); return buildUserProfileByClassCompleteName(typedId, attributes, completeName); } } catch (final Exception e) { logger.error("Cannot build instance", e); } return null; }
Source:
synchronized void resetTo() { for(int i = 0; i < checkpoints.length; i++){ checkpoints[i] = null; } c = 0; s = -1L; lag = new long[lagLen]; }

Target:
synchronized void resetTo() { Arrays.fill(checkpoints, null); c = 0; s = -1L; lag = new long[lagLen]; }
Source:
public ClusteringServiceConfigurationBuilder readOperationTimeout(long duration, TimeUnit unit) { Duration readTimeout = Duration.of(duration, toChronoUnit(unit)); return timeouts(Timeouts.builder().setReadOperationTimeout(readTimeout).build()); }

Target:
public ClusteringServiceConfigurationBuilder readOperationTimeout(long duration, TimeUnit unit) { Duration readTimeout = Duration.of(duration, toChronoUnit(unit)); return timeouts(TimeoutsBuilder.timeouts().read(readTimeout).build()); }
Source:
public static String getToken(final HttpServletRequest req) { String token = req.getPathInfo(); if (token == null || token.isEmpty()) { token = '#' + PageLinks.MINE; } else { token = Url.decode(token.substring(1)); } return token; }

Target:
public static String getToken(final HttpServletRequest req) { String token; String encodedToken = req.getPathInfo(); if (encodedToken == null || encodedToken.isEmpty()) { token = DEFAULT_TOKEN; } else { if (encodedToken.startsWith("/")) { encodedToken = encodedToken.substring(1); } token = Url.decode(encodedToken); } return token; }
Source:
public void testBytesRowsForSelectWithLimitIgnored() throws Exception { String sql = "SELECT * FROM " + tableA + " where (c1.a > c2.b) limit 1"; List<Object> binds = Lists.newArrayList(); try (Connection conn = DriverManager.getConnection(getUrl())) { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 979L, info.estimatedBytes); assertEquals((Long) 10L, info.estimatedRows); assertTrue(info.estimateInfoTs > 0); } }

Target:
public void testBytesRowsForSelectWithLimitIgnored() throws Exception { String sql = "SELECT * FROM " + tableA + " where (c1.a > c2.b) limit 1"; List<Object> binds = Lists.newArrayList(); try (Connection conn = DriverManager.getConnection(getUrl())) { ResultSet rs = conn.createStatement().executeQuery(sql); assertFalse(rs.next()); Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 390L, info.estimatedBytes); assertEquals((Long) 10L, info.estimatedRows); assertTrue(info.estimateInfoTs > 0); } }
Source:
public JobResource toResource(JobDto job) { JobResource jobResource = instantiateResource(job); addSelfLink(jobResource); addEditLink(jobResource); return jobResource; }

Target:
public JobResource toResource(JobDto job) { JobResource jobResource = instantiateResource(job); addSelfLink(jobResource); return jobResource; }
Source:
public SchemaRepository<Schema> provide() { return new SchemaRepository<>(schemaSourceProvider, Executors.newFixedThreadPool(2), source -> new Schema.Parser().parse(source.value())); }

Target:
public SchemaRepository<Schema> provide() { return new SchemaRepository<>(configFactory, schemaSourceProvider, createSchemaReloadExecutorService(configFactory, "avro"), source -> new Schema.Parser().parse(source.value())); }
Source:
public GdbEventsTable(Composite parent, int cacheSize) { super(parent, cacheSize, GDB_COLUMNS); fTable.getColumns()[2].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_REFERENCE); fTable.getColumns()[3].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT); addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { TableItem[] selection = fTable.getSelection(); if (selection.length > 0) { TableItem selectedTableItem = selection[0]; if (selectedTableItem != null) { Object data = selectedTableItem.getData(); if (data instanceof GdbTraceEvent) { GdbTraceEvent event = (GdbTraceEvent) data; GdbTrace gdbTrace = (GdbTrace) event.getTrace(); GdbTraceEventContent content = event.getContent(); selectFrame(gdbTrace, content.getFrameNumber()); return; } } } fSelectedTrace = null; } }); }

Target:
public GdbEventsTable(Composite parent, int cacheSize) { super(parent, cacheSize, GDB_COLUMNS); fTable.getColumns()[0].setAlignment(SWT.RIGHT); fTable.getColumns()[1].setAlignment(SWT.RIGHT); addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { TableItem[] selection = fTable.getSelection(); if (selection.length > 0) { TableItem selectedTableItem = selection[0]; if (selectedTableItem != null) { Object data = selectedTableItem.getData(); if (data instanceof GdbTraceEvent) { GdbTraceEvent event = (GdbTraceEvent) data; GdbTrace gdbTrace = (GdbTrace) event.getTrace(); GdbTraceEventContent content = event.getContent(); selectFrame(gdbTrace, content.getFrameNumber()); return; } } } fSelectedTrace = null; } }); }
Source:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (!(element instanceof GoConditionalExpr)) { return; } GoConditionalExpr expr = (GoConditionalExpr)element; if (expr.getEq() == null) { return; } GoExpression left = expr.getLeft(); GoExpression right = expr.getRight(); if (left instanceof GoIndexOrSliceExpr && right instanceof GoStringLiteral) { GoStringLiteral literal = (GoStringLiteral)right; if (!isSingleCharLiteral(literal)) { return; } expr.replace(createComparison(project, left.getText() + " == " + extractSingleCharFromText(literal))); } else if (left instanceof GoStringLiteral && right instanceof GoIndexOrSliceExpr) { GoStringLiteral literal = (GoStringLiteral)left; if (!isSingleCharLiteral(literal)) { return; } expr.replace(createComparison(project, extractSingleCharFromText(literal) + " == " + right.getText())); } }

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (!(element instanceof GoConditionalExpr)) { return; } GoConditionalExpr expr = (GoConditionalExpr)element; GoStringLiteral literal = getFirstElementOfType(GoStringLiteral.class, expr.getLeft(), expr.getRight()); if (literal == null || !isSingleCharLiteral(literal)) { return; } literal.replace(createExpression(project, extractSingleCharFromText(literal))); }
Source:
public void addPartitions(String databaseName, String tableName, List<CatalogProtos.PartitionDescProto> partitions , boolean ifNotExists) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; List<Partition> addPartitions = TUtil.newList(); CatalogProtos.PartitionDescProto existingPartition = null; try { client = clientPool.getClient(); for (CatalogProtos.PartitionDescProto partitionDescProto : partitions) { existingPartition = getPartition(databaseName, tableName, partitionDescProto.getPartitionName()); if (existingPartition != null) { Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); List<String> values = Lists.newArrayList(); for(CatalogProtos.PartitionKeyProto keyProto : partitionDescProto.getPartitionKeysList()) { values.add(keyProto.getPartitionValue()); } partition.setValues(values); Table table = client.getHiveClient().getTable(databaseName, tableName); StorageDescriptor sd = table.getSd(); sd.setLocation(partitionDescProto.getPath()); partition.setSd(sd); addPartitions.add(partition); } } if (addPartitions.size() > 0) { client.getHiveClient().add_partitions(addPartitions, true, true); } } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }

Target:
public void addPartitions(String databaseName, String tableName, List<CatalogProtos.PartitionDescProto> partitions , boolean ifNotExists) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; List<Partition> addPartitions = TUtil.newList(); CatalogProtos.PartitionDescProto existingPartition = null; try { client = clientPool.getClient(); for (CatalogProtos.PartitionDescProto partitionDescProto : partitions) { existingPartition = getPartition(databaseName, tableName, partitionDescProto.getPartitionName()); if (existingPartition == null) { Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); List<String> values = Lists.newArrayList(); for(CatalogProtos.PartitionKeyProto keyProto : partitionDescProto.getPartitionKeysList()) { values.add(keyProto.getPartitionValue()); } partition.setValues(values); Table table = client.getHiveClient().getTable(databaseName, tableName); StorageDescriptor sd = table.getSd(); sd.setLocation(partitionDescProto.getPath()); partition.setSd(sd); addPartitions.add(partition); } } if (addPartitions.size() > 0) { client.getHiveClient().add_partitions(addPartitions, true, true); } } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }
Source:
public void addFavourite(@PathVariable WorkflowName workflowName) throws IOException { User user = securityManager.getUserById((long) 1); Set<WorkflowName> favouriteWorkflows = user.getFavouriteWorkflows(); favouriteWorkflows.add(workflowName); user.setFavouriteWorkflows(favouriteWorkflows); securityManager.saveUser(user); }

Target:
public void addFavourite(@PathVariable WorkflowName workflowName) throws IOException { User user = authorizationManager.getCurrentUser(); Set<WorkflowName> favouriteWorkflows = user.getFavouriteWorkflows(); favouriteWorkflows.add(workflowName); securityManager.saveUser(user); }
Source:
public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException { PooledConnectionFactoryConfiguration poolConfig; if (config instanceof PooledConnectionFactoryConfiguration) { poolConfig = (PooledConnectionFactoryConfiguration) config; } else { throw new PersistenceException("ConnectionFactoryConfiguration passed in must be an instance of " + "PooledConnectionFactoryConfiguration"); } try { String propsFile = poolConfig.propertyFile(); if (propsFile != null) { dataSource = AgroalDataSource.from(new AgroalPropertiesReader(PROPERTIES_PREFIX).readProperties(propsFile)); } else { String password = poolConfig.password() != null ? poolConfig.password() : ""; AgroalDataSourceConfigurationSupplier configuration = new AgroalDataSourceConfigurationSupplier() .connectionPoolConfiguration(cp -> cp .minSize(10) .maxSize(10) .acquisitionTimeout(Duration.ofSeconds(30)) .connectionFactoryConfiguration(cf -> cf .jdbcUrl(poolConfig.connectionUrl()) .connectionProviderClassName(poolConfig.driverClass()) .jdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation.UNDEFINED) .principal(new NamePrincipal(poolConfig.username())) .credential(new SimplePassword(password)) )); dataSource = AgroalDataSource.from(configuration); } } catch (Exception e) { throw new PersistenceException("Failed to create a AgroalDataSource", e); } }

Target:
public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException { PooledConnectionFactoryConfiguration poolConfig; if (config instanceof PooledConnectionFactoryConfiguration) { poolConfig = (PooledConnectionFactoryConfiguration) config; } else { throw new PersistenceException("ConnectionFactoryConfiguration passed in must be an instance of " + "PooledConnectionFactoryConfiguration"); } try { String propsFile = poolConfig.propertyFile(); if (propsFile != null) { dataSource = AgroalDataSource.from(new AgroalPropertiesReader(PROPERTIES_PREFIX).readProperties(propsFile)); } else { String password = poolConfig.password() != null ? poolConfig.password() : ""; AgroalDataSourceConfigurationSupplier configuration = new AgroalDataSourceConfigurationSupplier() .connectionPoolConfiguration(cp -> cp .maxSize(10) .acquisitionTimeout(Duration.ofSeconds(30)) .connectionFactoryConfiguration(cf -> cf .jdbcUrl(poolConfig.connectionUrl()) .connectionProviderClassName(poolConfig.driverClass()) .jdbcTransactionIsolation(AgroalConnectionFactoryConfiguration.TransactionIsolation.UNDEFINED) .principal(new NamePrincipal(poolConfig.username())) .credential(new SimplePassword(password)) )); dataSource = AgroalDataSource.from(configuration); } } catch (Exception e) { throw new PersistenceException("Failed to create a AgroalDataSource", e); } }
Source:
private void setupComboBox() { comboBox.setFocusTraversable(false); comboBox.setEditable(true); comboBox.valueProperty().addListener((observable, old, newVal) -> { if (newVal == null) { return; } String repoId = Utility.removeAllWhiteSpaces(newVal); if (!repoId.equals(newVal)) { comboBox.setValue(repoId); return; } if (Utility.isWellFormedRepoId(repoId) && !changesDisabled) { onValueChangeCallback.accept(repoId); } }); comboBox.addEventFilter(KeyEvent.KEY_RELEASED, event -> { event.consume(); if (event.getCode() == KeyboardShortcuts.REMOVE_FOCUS) { if (ui.isTestMode()) { ui.triggerEvent(new UIComponentFocusEvent(UIComponentFocusEvent.EventType.REPO_SELECTOR)); } getParent().requestFocus(); } }); }

Target:
private void setupComboBox() { comboBox.setFocusTraversable(false); comboBox.setEditable(true); comboBox.valueProperty().addListener((observable, old, newVal) -> { if (newVal == null) { return; } String repoId = Utility.removeAllWhiteSpaces(newVal); if (!repoId.equals(newVal)) { comboBox.setValue(repoId); return; } if (Utility.isWellFormedRepoId(repoId) && !changesDisabled) { onValueChangeCallback.accept(repoId); } }); comboBox.addEventFilter(KeyEvent.KEY_RELEASED, event -> { event.consume(); if (event.getCode() == KeyboardShortcuts.REMOVE_FOCUS) { getParent().requestFocus(); } }); }
Source:
public FormRecognizerClientBuilder credential(TokenCredential tokenCredential) { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.tokenCredential = tokenCredential; return this; }

Target:
public FormRecognizerClientBuilder credential(TokenCredential tokenCredential) { this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); return this; }
Source:
public void setScanner(DirectoryScanner scanner) { Assert.notNull(scanner, "scanner must not be null"); this.fileSource.setScanner(scanner); this.scannerExplicitlySet = true; }

Target:
public void setScanner(DirectoryScanner scanner) { this.fileSource.setScanner(scanner); this.scannerExplicitlySet = true; }
Source:
public synchronized void notifyDisconnect(Channel channel) { logger.debug("Peer {}: notifies about disconnect", channel); channel.onDisconnect(); syncPool.onDisconnect(channel); activePeers.values().remove(channel); newPeers.remove(channel); }

Target:
public void notifyDisconnect(Channel channel) { logger.debug("Peer {}: notifies about disconnect", channel); channel.onDisconnect(); syncPool.onDisconnect(channel); synchronized(this) { activePeers.values().remove(channel); newPeers.remove(channel); } }
Source:
protected LanguageFilteringGraph(Graph g, List<String> preferredLanguages) { super(g); this.langs = preferredLanguages; this.toString = "LanguageFilteringGraph[wrapping " + ToString.graphToString(g) + "]"; }

Target:
protected LanguageFilteringGraph(Graph g, List<String> preferredLanguages) { super(g); this.langs = preferredLanguages; }
Source:
private LifecycleException stopInstances( List<LifecycleInstance> instances ) { LifecycleException ex = null; for ( int i = instances.size() - 1; i >= 0; i-- ) { LifecycleInstance lifecycleInstance = instances.get( i ); try { lifecycleInstance.stop(); } catch ( LifecycleException e ) { if ( ex != null ) { ex.addSuppressed( e ); } else { ex = e; } } } return ex; }

Target:
private LifecycleException stopInstances( List<LifecycleInstance> instances ) { LifecycleException ex = null; for ( int i = instances.size() - 1; i >= 0; i-- ) { LifecycleInstance lifecycleInstance = instances.get( i ); try { lifecycleInstance.stop(); } catch ( LifecycleException e ) { ex = Exceptions.chain( ex, e ); } } return ex; }
Source:
public EventResource findById(@PathVariable long eventId) { Optional<ProcessEngineEventEntity> findResult = eventsRepository.findById(eventId); if (!findResult.isPresent()) { throw new ActivitiException("Unable to find events for the given id:'" + eventId + "'"); } return eventResourceAssembler.toResource(findResult.get()); }

Target:
public EventResource findById(@PathVariable long eventId) { Optional<ProcessEngineEventEntity> findResult = eventsRepository.findById(eventId); if (!findResult.isPresent()) { throw new ActivitiException("Unable to find event for the given id:'" + eventId + "'"); } return eventResourceAssembler.toResource(findResult.get()); }
Source:
private AbstractPack200 getPack200() { StringTokenizer st = new StringTokenizer(System.getProperty("java.version"), "."); int major = st.hasMoreTokens() ? Integer.parseInt(st.nextToken()) : -1; int minor = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : -1; if (major <= 1 && minor <= 6) { return new ForkedPack200(); } return new InprocessPack200(); }

Target:
private Pack200Wrapper getPack200() { try { Class.forName("java.nio.file.FileSystem"); return new Pack200Wrapper(); } catch (ClassNotFoundException mustBeJava6orEarlier) { return new ForkedPack200Wrapper(); } }
Source:
public int[] findMatchingLines() { int[] index = new int[report.size()]; int dbLine = database.size(); int reportLine = report.size(); try { PathNode node = MyersDiff.buildPath(database.toArray(), report.toArray()); while (node.prev != null) { PathNode prevNode = node.prev; if (!node.isSnake()) { reportLine -= (node.j - prevNode.j); dbLine -= (node.i - prevNode.i); } else { for (int i = node.i; i > prevNode.i; i--) { index[reportLine - 1] = dbLine; reportLine--; dbLine--; } } node = prevNode; } } catch (Exception e) { return index; } return index; }

Target:
public int[] findMatchingLines() { int[] index = new int[right.size()]; int dbLine = left.size(); int reportLine = right.size(); try { PathNode node = MyersDiff.buildPath(left.toArray(), right.toArray()); while (node.prev != null) { PathNode prevNode = node.prev; if (!node.isSnake()) { reportLine -= (node.j - prevNode.j); dbLine -= (node.i - prevNode.i); } else { for (int i = node.i; i > prevNode.i; i--) { index[reportLine - 1] = dbLine; reportLine--; dbLine--; } } node = prevNode; } } catch (DifferentiationFailedException e) { LOG.error("Error finding matching lines", e); return index; } return index; }
Source:
private String formatDate(Date date) { if (date == null) return null; else return DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(date.getTime())); }

Target:
private String formatDate(Date date) { if (date == null) return null; else return DATE_TIME_FORMATTER.format(date.toInstant()); }
Source:
public NotImplementedError() { super("an implementation is missing"); }

Target:
public NotImplementedError() { super("An implementation is missing."); }
Source:
protected Optional<TokenRingDiagnosticGenerator> createForSimpleStrategy( KeyspaceMetadata keyspace, ConsistencyLevel consistencyLevel) { ConsistencyLevel filteredConsistencyLevel = ConsistencyLevels.filterForSimpleStrategy(consistencyLevel); if (filteredConsistencyLevel != consistencyLevel) { LOG.warn( String.format( "Consistency level %s is not compatible with the SimpleStrategy replication configured for keyspace %s." + "Token ring health reports will assume %s instead.", consistencyLevel, keyspace.getName().asCql(true), filteredConsistencyLevel)); } ReplicationFactor replicationFactor = ReplicationFactor.fromString(keyspace.getReplication().get("replication_factor")); DefaultTokenRingDiagnosticGenerator generator = new DefaultTokenRingDiagnosticGenerator( metadata, keyspace, filteredConsistencyLevel, replicationFactor); return Optional.of(generator); }

Target:
protected TokenRingDiagnosticGenerator createForSimpleStrategy( KeyspaceMetadata keyspace, ConsistencyLevel consistencyLevel) { if (consistencyLevel.isDcLocal() || consistencyLevel == ConsistencyLevel.EACH_QUORUM) { throw new IllegalArgumentException( String.format( "Consistency level %s is not compatible with the SimpleStrategy replication configured for keyspace %s", consistencyLevel, keyspace.getName().asCql(true))); } ReplicationFactor replicationFactor = ReplicationFactor.fromString(keyspace.getReplication().get("replication_factor")); return new DefaultTokenRingDiagnosticGenerator( metadata, keyspace, consistencyLevel, replicationFactor); }
Source:
public static List<Object> map(EntityType entityType) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : ENTITIES_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_ENTITIES_TAGS: row.add(getTags(entityType)); break; case EMX_ENTITIES_EXTENDS: row.add(entityType.getExtends() != null ? entityType.getExtends().getId() : ""); break; case EMX_ENTITIES_PACKAGE: row.add(getPackageId(entityType)); break; case EMX_ENTITIES_NAME: row.add(getName(entityType)); break; default: Object value = entityType.get(entry.getValue()); row.add(value != null ? value.toString() : ""); break; } } return row; }

Target:
public static List<Object> map(EntityType entityType) { List<Object> row = new ArrayList<>(ENTITIES_ATTRS.size()); for (Entry<String, String> entry : ENTITIES_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_ENTITIES_TAGS: row.add(getTags(entityType)); break; case EMX_ENTITIES_EXTENDS: row.add(entityType.getExtends() != null ? entityType.getExtends().getId() : ""); break; case EMX_ENTITIES_PACKAGE: row.add(getPackageId(entityType)); break; case EMX_ENTITIES_NAME: row.add(getName(entityType)); break; default: Object value = entityType.get(entry.getValue()); row.add(value != null ? value.toString() : ""); break; } } return row; }
Source:
private Response doGetAllSchemaVersionForBranch(String schemaName, String branchName) { try { LOG.info("Get all versions for schema : {}", schemaName); List<Byte> states = Collections.singletonList(SchemaVersionLifecycleStates.ENABLED.getId()); Collection<SchemaVersionInfo> schemaVersionInfos = schemaRegistryClient.getAllVersions(effectiveBranchName(branchName), schemaName, states); Collection<String> schemaVersions = new ArrayList<>(); if (schemaVersionInfos != null && !schemaVersionInfos.isEmpty()) { LOG.debug("Received schema versions from schema registry: {}", schemaVersionInfos); schemaVersions = schemaVersionInfos.stream().map(x -> x.getVersion().toString()).collect(Collectors.toList()); return WSUtils.respondEntities(schemaVersions, OK); } else { LOG.debug("Received null response for schema versions from schema registry for schema: {}", schemaName); return WSUtils.respondEntity(schemaVersions, NOT_FOUND); } } catch (SchemaNotFoundException e) { LOG.error("Schema not found: [{}]", schemaName, e); throw EntityNotFoundException.byName(schemaName); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private Response doGetAllSchemaVersionForBranch(String schemaName, String branchName) { try { LOG.info("Get all versions for schema : {}", schemaName); Collection<SchemaVersionInfo> schemaVersionInfos = schemaRegistryClient.getAllVersions(effectiveBranchName(branchName), schemaName); LOG.debug("Received schema versions from schema registry for schema: {}", schemaVersionInfos, schemaName); if (schemaVersionInfos != null && !schemaVersionInfos.isEmpty()) { List<String> schemaVersions = schemaVersionInfos.stream().map(x -> x.getVersion().toString()).collect(Collectors.toList()); return WSUtils.respondEntities(schemaVersions, OK); } else { return WSUtils.respondEntity(Collections.EMPTY_LIST, NOT_FOUND); } } catch (SchemaNotFoundException e) { LOG.error("Schema not found: [{}]", schemaName, e); throw EntityNotFoundException.byName(schemaName); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
private IBranchNameProvider getBranchNameProvider() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] config = registry .getConfigurationElementsFor(BRANCH_NAME_PROVIDER_ID); if (config.length > 0) { Object provider; try { provider = config[0].createExecutableExtension("class"); if (provider instanceof IBranchNameProvider) return (IBranchNameProvider) provider; } catch (Throwable e) { Activator.logError("Failed to create branch name provider", e); } } return null; }

Target:
private IBranchNameProvider getBranchNameProvider() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] config = registry .getConfigurationElementsFor(BRANCH_NAME_PROVIDER_ID); if (config.length > 0) { Object provider; try { provider = config[0].createExecutableExtension("class"); if (provider instanceof IBranchNameProvider) return (IBranchNameProvider) provider; } catch (Throwable e) { Activator.logError( UIText.CreateBranchPage_CreateBranchNameProviderFailed, e); } } return null; }
Source:
private void testFormulaEditorInput(int phiroLedColorEditText, int phiroLedColorTextView) { solo.clickOnView(solo.getView(phiroLedColorEditText)); solo.clickOnView(solo.getView(phiroLedColorTextView)); insertDoubleIntoEditText(solo, 100.0); solo.clickOnView(solo.getView(R.id.formula_editor_keyboard_ok)); solo.waitForView(phiroLedColorEditText); TextView textView = ((TextView) solo.getView(phiroLedColorEditText)); assertEquals("Text not updated", 100.0, Double.parseDouble(textView.getText().toString().replace(',', '.'))); }

Target:
private void testFormulaEditorInput(int phiroLedColorEditText, int phiroLedColorTextView) { solo.clickOnView(solo.getView(phiroLedColorEditText)); solo.clickOnView(solo.getView(phiroLedColorTextView)); UiTestUtils.insertDoubleIntoEditText(solo, 100.0); solo.clickOnView(solo.getView(R.id.formula_editor_keyboard_ok)); solo.waitForView(phiroLedColorEditText); TextView textView = ((TextView) solo.getView(phiroLedColorEditText)); assertEquals("Text not updated", 100.0, Double.parseDouble(textView.getText().toString().replace(',', '.'))); }
Source:
public void writeTo(StreamOutput out) throws IOException { writeNullable(bucket, out); writeNullable(records, out); writeNullable(influencers, out); writeNullable(quantiles, out); writeNullable(modelSnapshot, out); writeNullable(modelSizeStats, out); writeNullable(modelPlot, out); if (out.getVersion().onOrAfter(Version.V_7_9_0)) { writeNullable(annotation, out); } writeNullable(categoryDefinition, out); writeNullable(flushAcknowledgement, out); writeNullable(forecast, out); writeNullable(forecastRequestStats, out); }

Target:
public void writeTo(StreamOutput out) throws IOException { writeNullable(bucket, out); writeNullable(records, out); writeNullable(influencers, out); writeNullable(quantiles, out); writeNullable(modelSnapshot, out); writeNullable(modelSizeStats, out); writeNullable(modelPlot, out); writeNullable(annotation, out); writeNullable(categoryDefinition, out); writeNullable(flushAcknowledgement, out); writeNullable(forecast, out); writeNullable(forecastRequestStats, out); }
Source:
public ASBSound parseSound(String text, String key){ String[] split = text.split(";"); Sound sound; float pitch; float volume; if(Sound.valueOf(split[0]) != null) sound = Sound.valueOf(split[0]); else { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Sound does not exist."); return null; } try{ pitch = Float.valueOf(split[1]); if(pitch <= 0){ plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Pitch must be higher than 0. Setting it to 1."); pitch = 1.0F; } } catch(NumberFormatException e) { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Pitch invalid."); return null; } try{ volume = Float.valueOf(split[2]); if(volume <= 0){ plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Volume must be higher than 0. Setting it to 1."); volume = 1.0F; } } catch(NumberFormatException e) { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Volume invalid."); return null; } return new ASBSound(sound, pitch, volume); }

Target:
public ASBSound parseSound(String text, String key){ text = text.toUpperCase(); String[] split = text.split(";"); if(split.length != 3){ plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Invalid format. Must be \"SOUND_ID;PITCH;VOLUME\""); return null; } Sound sound; float pitch; float volume; if(plugin.getServer().getVersion().contains("(MC: 1.8")){ text = text.replace("BLOCK_", "").replace("ENTITY_", ""); } if(Sound.valueOf(split[0]) != null) sound = Sound.valueOf(split[0]); else { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Sound does not exist."); plugin.getLogger().info("Here is a list of available sounds:"); for(Sound s : Sound.values()) System.out.print(s + ", "); return null; } try{ pitch = Float.valueOf(split[1]); if(pitch <= 0){ plugin.getLogger().warning("Error while parsing \"" + text + "\" in \"" + key + "\" : Pitch must be higher than 0. Setting it to 1."); pitch = 1.0F; } } catch(NumberFormatException e) { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Invalid pitch."); return null; } try{ volume = Float.valueOf(split[2]); if(volume <= 0){ plugin.getLogger().warning("Error while parsing \"" + text + "\" in \"" + key + "\" : Volume must be higher than 0. Setting it to 1."); volume = 1.0F; } } catch(NumberFormatException e) { plugin.getLogger().warning("Could not parse \"" + text + "\" in \"" + key + "\" : Invalid volume."); return null; } return new ASBSound(sound, pitch, volume); }
Source:
public void testUpdateAndGetPageStructure() throws Exception { List<UUID> ids = pageStructureService.selectAllPageStructureIds(); UUID page = ids.get(0); Response updatePageStructureResponse = translationResource.updatePageStructure("en", "kgp", page ,"draft-access", null); Assert.assertEquals(updatePageStructureResponse.getStatus(), 201); Response getPageStructureResponse = translationResource.getPageStructure("en", "kgp", page, "draft-access", null); Assert.assertEquals(getPageStructureResponse.getStatus(), 200); }

Target:
public void testUpdateAndGetPageStructure() throws Exception { List<UUID> ids = pageStructureService.selectAllPageStructureIds(); UUID page = ids.get(0); Document testDoc = createXMLDocument(); Response updatePageStructureResponse = translationResource.updatePageStructure(testDoc, "en", "kgp", page ,"draft-access", null); Assert.assertEquals(updatePageStructureResponse.getStatus(), 204); Response getPageStructureResponse = translationResource.getPageStructure("en", "kgp", page, "draft-access", null); Assert.assertEquals(getPageStructureResponse.getStatus(), 200); }
Source:
public void start() { logger.info("Starting river {}", riverName.getName()); Status status = MongoDBRiverHelper.getRiverStatus(esClient, riverName.getName()); if (status == Status.IMPORT_FAILED || status == Status.INITIAL_IMPORT_FAILED || status == Status.SCRIPT_IMPORT_FAILED || status == Status.START_FAILED) { logger.error("Cannot start river {}. Current status is {}", riverName.getName(), status); return; } logger.info("{} - {}", DESCRIPTION, MongoDBHelper.getRiverVersion()); logger.info( "starting mongodb stream. options: secondaryreadpreference [{}], drop_collection [{}], include_collection [{}], throttlesize [{}], gridfs [{}], filter [{}], db [{}], collection [{}], script [{}], indexing to [{}]/[{}]", definition.isMongoSecondaryReadPreference(), definition.isDropCollection(), definition.getIncludeCollection(), definition.getThrottleSize(), definition.isMongoGridFS(), definition.getMongoOplogFilter(), definition.getMongoDb(), definition.getMongoCollection(), definition.getScript(), definition.getIndexName(), definition.getTypeName()); for (ServerAddress server : definition.getMongoServers()) { logger.debug("Using mongodb server(s): host [{}], port [{}]", server.getHost(), server.getPort()); } if (status == Status.STOPPED) { context.setStatus(Status.STOPPED); logger.info("River is currently disabled", riverName.getName()); } else { context.setStatus(Status.STARTING); MongoDBRiverHelper.setRiverStatus(esClient, riverName.getName(), Status.RUNNING); } statusThread = EsExecutors.daemonThreadFactory(settings.globalSettings(), "mongodb_river_status:" + definition.getIndexName()).newThread( new StatusChecker(this, definition, context)); statusThread.start(); }

Target:
public void start() { logger.info("{} - {}", DESCRIPTION, MongoDBHelper.getRiverVersion()); Status status = MongoDBRiverHelper.getRiverStatus(esClient, riverName.getName()); if (status == Status.IMPORT_FAILED || status == Status.INITIAL_IMPORT_FAILED || status == Status.SCRIPT_IMPORT_FAILED || status == Status.START_FAILED) { logger.error("Cannot start river {}. Current status is {}", riverName.getName(), status); return; } if (status == Status.STOPPED) { context.setStatus(Status.STOPPED); logger.info("River is currently disabled and will not be started", riverName.getName()); } else { context.setStatus(Status.START_PENDING); MongoDBRiverHelper.setRiverStatus(esClient, riverName.getName(), Status.RUNNING); logger.info("River startup pending", riverName.getName()); } statusThread = EsExecutors.daemonThreadFactory(settings.globalSettings(), "mongodb_river_status:" + definition.getIndexName()).newThread( new StatusChecker(this, definition, context)); statusThread.start(); }
Source:
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) { switch (viewType) { case VIEWTYPE_MESSAGE_HEADER: MessageHeaderParent.MessageHeaderHolder holder = new MessageHeaderParent.MessageHeaderHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.message_header, parent, false)); holder.streamTV.setText(privateHuddleText); holder.streamTV.setTextColor(Color.WHITE); return holder; case VIEWTYPE_MESSAGE: View messageView = LayoutInflater.from(parent.getContext()).inflate(R.layout.message_tile, parent, false); MessageHolder messageHolder = new MessageHolder(messageView); return messageHolder; case VIEWTYPE_FOOTER: footerView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_loading, parent, false); return new LoadingHolder(footerView); case VIEWTYPE_HEADER: headerView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_loading, parent, false); LoadingHolder headerLoadingHolder = new LoadingHolder(headerView); isHeaderShowing(false); return headerLoadingHolder; } return null; }

Target:
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) { switch (viewType) { case VIEWTYPE_MESSAGE_HEADER: MessageHeaderParent.MessageHeaderHolder holder = new MessageHeaderParent.MessageHeaderHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.message_header, parent, false)); holder.streamTextView.setText(privateHuddleText); holder.streamTextView.setTextColor(Color.WHITE); holder.setOnItemClickListener(onItemClickListener); return holder; case VIEWTYPE_MESSAGE: View messageView = LayoutInflater.from(parent.getContext()).inflate(R.layout.message_tile, parent, false); MessageHolder messageHolder = new MessageHolder(messageView); messageHolder.setItemClickListener(onItemClickListener); return messageHolder; case VIEWTYPE_FOOTER: footerView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_loading, parent, false); return new LoadingHolder(footerView); case VIEWTYPE_HEADER: headerView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_loading, parent, false); LoadingHolder headerLoadingHolder = new LoadingHolder(headerView); setHeaderShowing(false); return headerLoadingHolder; } return null; }
Source:
public ContextMenuItem createItem() { return new ContextMenuItem(mTitleId, mTitle, mIcon, mColorRes, mSecondaryIcon, mSelected, mProgress, mLayout, mLoading, mIsCategory, mIsClickable, mSkipPaintingWithoutColor, mPosition, mOrder, mDescription, mItemClickListener, mIntegerListener, mProgressListener, mItemDeleteAction, mHideDivider, mHideCompoundButton, mMinHeight, mTag, mId); }

Target:
public ContextMenuItem createItem() { return new ContextMenuItem(mTitleId, mTitle, mIcon, mColorRes, mSecondaryIcon, mSelected, mProgress, mLayout, mLoading, mIsCategory, mIsClickable, mSkipPaintingWithoutColor, mOrder, mDescription, mItemClickListener, mIntegerListener, mProgressListener, mItemDeleteAction, mHideDivider, mHideCompoundButton, mMinHeight, mTag, mId); }
Source:
static KeyStore createTrustStoreFromCertificates(Path path) { KeyStore keyStore; try { keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(null, null); } catch (IOException | GeneralSecurityException e) { throw Throwables.propagate(e); } for (File currFile : getFilesForPath(path)) { try (InputStream in = Files.newInputStream(currFile.toPath())) { keyStore.setCertificateEntry(currFile.getName(), readX509Certificate(in)); } catch (IOException e) { throw new RuntimeException(String.format( "IOException encountered when opening '%s'", currFile.toPath()), e); } catch (CertificateException | KeyStoreException e) { throw new RuntimeException(String.format( "Could not read file at \"%s\" as an X.509 certificate", currFile.toPath()), e); } } return keyStore; }

Target:
static KeyStore createTrustStoreFromCertificates(Path path) { KeyStore keyStore; keyStore = createKeyStore(); for (File currFile : getFilesForPath(path)) { try (InputStream in = Files.newInputStream(currFile.toPath())) { keyStore.setCertificateEntry(currFile.getName(), readX509Certificate(in)); } catch (IOException e) { throw new RuntimeException(String.format( "IOException encountered when opening '%s'", currFile.toPath()), e); } catch (CertificateException | KeyStoreException e) { throw new RuntimeException(String.format( "Could not read file at \"%s\" as an X.509 certificate", currFile.toPath()), e); } } return keyStore; }
Source:
public boolean isAscending(Integer keyColumnPosition) { int i = keyColumnPosition - 1; return !(i < 0 || i >= baseColumnPositions.length) && isAscending[i]; }

Target:
public boolean isAscending(Integer keyColumnPosition) { int i = keyColumnPosition.intValue() - 1; if (i < 0 || i >= baseColumnPositions.length) return false; return isAscending[i]; }
Source:
private OAuthRequest(URL authUrl, UserNamespace namespace, String token, String secret) { this.authUrl = authUrl; this.namespace = namespace; this.token = token; this.secret = secret; }

Target:
private OAuthRequest(URL authUrl, UserNamespace namespace, String token, String secret) { Preconditions.checkNotNull(authUrl); Preconditions.checkNotNull(namespace); Preconditions.checkNotNull(token); Preconditions.checkNotNull(secret); this.authUrl = authUrl; this.namespace = namespace; this.token = token; this.secret = secret; }
Source:
public static String printXpathBranch(String xpath, File file) throws CheckstyleException, IOException { final XPathEvaluator xpathEvaluator = new XPathEvaluator(); try { final RootNode rootNode = new RootNode(JavaParser.parseFile(file, JavaParser.Options.WITHOUT_COMMENTS)); final XPathExpression xpathExpression = xpathEvaluator.createExpression(xpath); final XPathDynamicContext xpathDynamicContext = xpathExpression.createDynamicContext(rootNode); final List<Item<?>> evaluate = xpathExpression.evaluate(xpathDynamicContext); return evaluate.stream() .map(item -> ((AbstractNode) item).getUnderlyingNode()) .map(AstTreeStringPrinter::printBranch) .collect(Collectors.joining(DELIMITER)); } catch (XPathException ex) { throw new CheckstyleException("Error during xpath evaluation", ex); } }

Target:
public static String printXpathBranch(String xpath, File file) throws CheckstyleException, IOException { final XPathEvaluator xpathEvaluator = new XPathEvaluator(); try { final RootNode rootNode = new RootNode(JavaParser.parseFile(file, JavaParser.Options.WITH_COMMENTS)); final XPathExpression xpathExpression = xpathEvaluator.createExpression(xpath); final XPathDynamicContext xpathDynamicContext = xpathExpression.createDynamicContext(rootNode); final List<Item<?>> matchingItems = xpathExpression.evaluate(xpathDynamicContext); return matchingItems.stream() .map(item -> ((AbstractNode) item).getUnderlyingNode()) .map(AstTreeStringPrinter::printBranch) .collect(Collectors.joining(DELIMITER)); } catch (XPathException ex) { final String errMsg = String.format(Locale.ROOT, "Error during evaluation for xpath: %s, file: %s", xpath, file.getCanonicalPath()); throw new CheckstyleException(errMsg, ex); } }
Source:
public void triggerSchemaUpdateOnFirstSave() { ManagedProduct p = new ManagedProduct(); p.setId("p-1"); repo.save(p); Iterator<ManagedProduct> iterator = repo.findAll().iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); } }

Target:
public void triggerSchemaUpdateOnFirstSave() { ManagedProduct p = new ManagedProduct(); p.setId("p-1"); repo.save(p); Iterable<ManagedProduct> all = repo.findAll(); for (ManagedProduct product : all) { System.out.println(product); } }
Source:
public Response processEvent(String event) { AlertAlarmNotifier aaNotifier = AlertAlarmNotifier.getInstance(); try { List<Map<String, Object>> eventMapList = Helper.toMapList(event); if (eventMapList != null) { aaNotifier = AlertAlarmNotifier.getInstance(); for ( Map<String, Object> eventMap : eventMapList) { log.handle(Priority.INFO, "event Map = " + eventMap.toString()); if (aaNotifier != null) { aaNotifier.notifyOmsUser(eventMap); } else { log.handle(Priority.INFO, "AlertAlarmNotifier instance is null"); } } } else { log.handle(Priority.INFO, "OMS Event List is null"); } } catch (IOException e) { log.error("process OMS event IO Exception", e); } return Response.status(Status.ACCEPTED).build(); }

Target:
public Response processEvent(String event) { AlertAlarmNotifier aaNotifier = AlertAlarmNotifier.getInstance(); try { List<Map<String, Object>> eventMapList = Helper.toMapList(event); if (eventMapList != null) { aaNotifier = AlertAlarmNotifier.getInstance(); for ( Map<String, Object> eventMap : eventMapList) { log.handle(Priority.DEBUG, "event Map = " + eventMap.toString()); aaNotifier.notifyOmsUser(eventMap); } } else { log.handle(Priority.ERROR, "Expected OMS Events JSON dictionary list as input to process event: " + event); } } catch (IOException e) { log.error("Error processing OMS Events", e); } return Response.status(Status.ACCEPTED).build(); }