auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static HandshakeCiphers create(String salt, String secret) { try { byte[] specKey = Jnlp3Util.generate128BitKey(salt + secret); IvParameterSpec spec = new IvParameterSpec(specKey); SecretKey secretKey = generateSecretKey(salt, secret); Cipher encryptCipher = Cipher.getInstance(CIPHER_TRANSFORMATION); encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey, spec); Cipher decryptCipher = Cipher.getInstance(CIPHER_TRANSFORMATION); decryptCipher.init(Cipher.DECRYPT_MODE, secretKey, spec); return new HandshakeCiphers(secretKey, spec, encryptCipher, decryptCipher); } catch (GeneralSecurityException e) { throw (AssertionError) new AssertionError("Failed to create handshake ciphers", e); } }

Target:
public static HandshakeCiphers create(String salt, String secret) { try { byte[] specKey = Jnlp3Util.generate128BitKey(salt + secret); IvParameterSpec spec = new IvParameterSpec(specKey); SecretKey secretKey = generateSecretKey(salt, secret); Cipher encryptCipher = Cipher.getInstance(CIPHER_TRANSFORMATION); encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey, spec); Cipher decryptCipher = Cipher.getInstance(CIPHER_TRANSFORMATION); decryptCipher.init(Cipher.DECRYPT_MODE, secretKey, spec); return new HandshakeCiphers(secretKey, spec, encryptCipher, decryptCipher); } catch (GeneralSecurityException e) { throw new AssertionError("Failed to create handshake ciphers", e); } }
Source:
Point getThickness (long widget) { if (OS.GTK3) { int xthickness = 0, ythickness = 0; GtkBorder tmp = new GtkBorder(); long context = OS.gtk_widget_get_style_context (widget); if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); } else { int styleState = OS.gtk_widget_get_state_flags(widget); OS.gtk_style_context_get_padding (context, styleState, tmp); } OS.gtk_style_context_save (context); OS.gtk_style_context_add_class (context, OS.GTK_STYLE_CLASS_FRAME); xthickness += tmp.left; ythickness += tmp.top; if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); } else { int styleState = OS.gtk_widget_get_state_flags(widget); OS.gtk_style_context_get_border (context, styleState, tmp); } xthickness += tmp.left; ythickness += tmp.top; OS.gtk_style_context_restore (context); return new Point (xthickness, ythickness); } long style = OS.gtk_widget_get_style (widget); return new Point (OS.gtk_style_get_xthickness (style), OS.gtk_style_get_ythickness (style)); }

Target:
Point getThickness (long widget) { if (OS.GTK3) { int xthickness = 0, ythickness = 0; GtkBorder tmp = new GtkBorder(); long context = OS.gtk_widget_get_style_context (widget); int styleState = OS.gtk_widget_get_state_flags(widget); OS.gtk_style_context_save (context); OS.gtk_style_context_add_class (context, OS.GTK_STYLE_CLASS_FRAME); OS.gtk_style_context_get_padding (context, styleState, tmp); xthickness += tmp.left; ythickness += tmp.top; OS.gtk_style_context_get_border (context, styleState, tmp); xthickness += tmp.left; ythickness += tmp.top; OS.gtk_style_context_restore (context); return new Point (xthickness, ythickness); } long style = OS.gtk_widget_get_style (widget); return new Point (OS.gtk_style_get_xthickness (style), OS.gtk_style_get_ythickness (style)); }
Source:
private void recursiveDelete(Path file) throws IOException { Files.walkFileTree(file, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { Files.delete(dir); return FileVisitResult.CONTINUE; } else { throw e; } } }); }

Target:
private void recursiveDelete(Path file) throws IOException { Files.walkFileTree(file, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e != null) { throw e; } Files.delete(dir); return FileVisitResult.CONTINUE; } }); }
Source:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.operationAbortCount.inc(); routerMetrics.putBlobErrorCount.inc(); routerMetrics.countError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }

Target:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobErrorCount.inc(); routerMetrics.countError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
private Collection<LockWatchEvent> getValuesBetweenInclusive(long endVersion, long startVersion) { if (endVersion < startVersion) { return ImmutableList.of(); } return eventMap.subMap(startVersion, INCLUSIVE, endVersion, INCLUSIVE).values(); }

Target:
private Collection<LockWatchEvent> getValuesBetweenInclusive(long endVersion, long startVersion) { return eventMap.subMap(startVersion, INCLUSIVE, endVersion, INCLUSIVE).values(); }
Source:
public void testEventTypesForDynamicAddPartitionByInsert() throws IOException { String name = testName.getMethodName(); final String dbName = createDB(name); String replDbName = dbName + "_dupe"; run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) STORED AS TEXTFILE"); Tuple bootstrap = bootstrapLoadAndVerify(dbName, replDbName); String[] ptn_data = new String[]{ "ten"}; run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + ptn_data[0] + "')"); run("DROP TABLE " + dbName + ".ptned"); BehaviourInjection<NotificationEventResponse,NotificationEventResponse> eventTypeValidator = new BehaviourInjection<NotificationEventResponse,NotificationEventResponse>(){ @Nullable @Override public NotificationEventResponse apply(@Nullable NotificationEventResponse eventsList) { if (null != eventsList) { List<NotificationEvent> events = eventsList.getEvents(); for (int i = 0; i < events.size(); i++) { NotificationEvent event = events.get(i); if (event.getDbName().equalsIgnoreCase(dbName)) { if (event.getEventType() == "INSERT") { LOG.error("Encountered INSERT event when it was not expected to"); return null; } } } injectionPathCalled = true; } return eventsList; } }; InjectableBehaviourObjectStore.setGetNextNotificationBehaviour(eventTypeValidator); incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName); eventTypeValidator.assertInjectionsPerformed(true,false); InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); verifyIfTableNotExist(replDbName , "ptned"); }

Target:
public void testEventTypesForDynamicAddPartitionByInsert() throws IOException { String name = testName.getMethodName(); final String dbName = createDB(name, driver); String replDbName = dbName + "_dupe"; run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) STORED AS TEXTFILE", driver); Tuple bootstrap = bootstrapLoadAndVerify(dbName, replDbName); String[] ptn_data = new String[]{ "ten"}; run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + ptn_data[0] + "')", driver); run("DROP TABLE " + dbName + ".ptned", driver); BehaviourInjection<NotificationEventResponse,NotificationEventResponse> eventTypeValidator = new BehaviourInjection<NotificationEventResponse,NotificationEventResponse>(){ @Nullable @Override public NotificationEventResponse apply(@Nullable NotificationEventResponse eventsList) { if (null != eventsList) { List<NotificationEvent> events = eventsList.getEvents(); for (int i = 0; i < events.size(); i++) { NotificationEvent event = events.get(i); if (event.getDbName().equalsIgnoreCase(dbName)) { if (event.getEventType() == "INSERT") { LOG.error("Encountered INSERT event when it was not expected to"); return null; } } } injectionPathCalled = true; } return eventsList; } }; InjectableBehaviourObjectStore.setGetNextNotificationBehaviour(eventTypeValidator); incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName); eventTypeValidator.assertInjectionsPerformed(true,false); InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); verifyIfTableNotExist(replDbName , "ptned", metaStoreClientMirror); }
Source:
void peekOneMessage() { final int numberOfEvents = 1; when(managementNode.peek()) .thenReturn(Mono.just(mock(ServiceBusReceivedMessage.class))); StepVerifier.create(consumer.peek()) .expectNextCount(numberOfEvents) .verifyComplete(); }

Target:
void peekOneMessage() { final int numberOfEvents = 1; when(managementNode.peek()) .thenReturn(just(mock(ServiceBusReceivedMessage.class))); StepVerifier.create(consumer.peek()) .expectNextCount(numberOfEvents) .verifyComplete(); }
Source:
SqlOperator toOp(Map<String, Object> map) { String name = map.get("name").toString(); String kind = map.get("kind").toString(); String syntax = map.get("syntax").toString(); SqlKind sqlKind = SqlKind.valueOf(kind); SqlSyntax sqlSyntax = SqlSyntax.valueOf(syntax); List<SqlOperator> operators = new ArrayList<>(); SqlStdOperatorTable.instance().lookupOperatorOverloads( new SqlIdentifier(name, new SqlParserPos(0, 0)), null, sqlSyntax, operators, SqlNameMatchers.liberal()); for (SqlOperator operator: operators) { if (operator.kind == sqlKind) { return operator; } } String class_ = (String) map.get("class"); if (class_ != null) { return AvaticaUtils.instantiatePlugin(SqlOperator.class, class_); } throw new RuntimeException("No operator for " + name + " with kind: " + kind + ", and syntax: " + syntax); }

Target:
SqlOperator toOp(Map<String, Object> map) { String name = map.get("name").toString(); String kind = map.get("kind").toString(); String syntax = map.get("syntax").toString(); SqlKind sqlKind = SqlKind.valueOf(kind); SqlSyntax sqlSyntax = SqlSyntax.valueOf(syntax); List<SqlOperator> operators = new ArrayList<>(); SqlStdOperatorTable.instance().lookupOperatorOverloads( new SqlIdentifier(name, new SqlParserPos(0, 0)), null, sqlSyntax, operators, SqlNameMatchers.liberal()); for (SqlOperator operator: operators) { if (operator.kind == sqlKind) { return operator; } } String class_ = (String) map.get("class"); if (class_ != null) { return AvaticaUtils.instantiatePlugin(SqlOperator.class, class_); } throw RESOURCE.noOperator(name, kind, syntax).ex(); }
Source:
public void testCloudHubDeploy() throws VerificationException, InterruptedException, TimeoutException { verifier.setEnvironmentVariable("MAVEN_OPTS", "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y"); log.info("Executing mule:deploy goal..."); verifier.executeGoal(MULE_DEPLOY); cloudHubDeploymentVerifier.verifyIsDeployed(APPLICATION_NAME); log.info("Application " + APPLICATION_NAME + " successfully deployed to CloudHub."); verifier.verifyErrorFreeLog(); }

Target:
public void testCloudHubDeploy() throws VerificationException, InterruptedException, TimeoutException { log.info("Executing mule:deploy goal..."); verifier.executeGoal(MULE_DEPLOY); cloudHubDeploymentVerifier.verifyIsDeployed(APPLICATION_NAME); log.info("Application " + APPLICATION_NAME + " successfully deployed to CloudHub."); verifier.verifyErrorFreeLog(); }
Source:
Int2IntListLookupTable(int maxSize, IntFunction<IntList> loader) { this.loader = loader; this.lookup = new IntList[maxSize]; Arrays.fill(lookup, null); }

Target:
Int2IntListLookupTable(int maxSize, IntFunction<IntList> loader) { this.loader = loader; this.lookup = new IntList[maxSize]; }
Source:
protected int removeStorageDomainLuns(storage_domain_static storageDomain) { final List<LUNs> lunsList = DbFacade.getInstance().getLunDao().getAllForVolumeGroup(storageDomain.getstorage()); int numOfRemovedLuns = 0; for (LUNs lun : lunsList) { if (DbFacade.getInstance().getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) == null) { DbFacade.getInstance().getLunDao().remove(lun.getLUN_id()); numOfRemovedLuns++; } else { DbFacade.getInstance().getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), ""); } } return numOfRemovedLuns; }

Target:
protected int removeStorageDomainLuns(storage_domain_static storageDomain) { final List<LUNs> lunsList = getLunDao().getAllForVolumeGroup(storageDomain.getstorage()); int numOfRemovedLuns = 0; for (LUNs lun : lunsList) { if (DbFacade.getInstance().getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) == null) { getLunDao().remove(lun.getLUN_id()); numOfRemovedLuns++; } else { getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), ""); } } return numOfRemovedLuns; }
Source:
private static IASTNode getFirstNode(IASTTranslationUnit ast) { IASTDeclaration[] declarations = ast.getDeclarations(); return (declarations.length > 0) ? declarations[0] : null; }

Target:
private static IASTNode getFirstNode(IASTTranslationUnit ast) { IASTDeclaration[] declarations = ast.getDeclarations(); return Arrays.stream(declarations).filter(decl -> decl.isPartOfTranslationUnitFile()).findFirst().orElse(null); }
Source:
public synchronized void init() { new Thread(new Runnable() { @Override public void run() { FrameworkInfo framework = FrameworkInfo.newBuilder() .setUser("") .setName(mesosCloud.getFrameworkName()) .setCheckpoint(mesosCloud.isCheckpoint()).build(); LOGGER.info("Initializing the Mesos driver with options" + "\n" + "User: " + framework.getUser() + "\n" + "Framework Name: " + framework.getName() + "\n" + "Checkpointing: " + framework.getCheckpoint() ); driver = new MesosSchedulerDriver(JenkinsScheduler.this, framework, mesosCloud.getMaster()); Status runStatus = driver.run(); if (runStatus != Status.DRIVER_STOPPED) { LOGGER.severe("The Mesos driver was aborted! Status number: " + runStatus.getNumber()); } driver = null; } }).start(); }

Target:
public synchronized void init() { new Thread(new Runnable() { @Override public void run() { FrameworkInfo framework = FrameworkInfo.newBuilder() .setUser("") .setName(mesosCloud.getFrameworkName()) .setCheckpoint(mesosCloud.isCheckpoint()).build(); LOGGER.info("Initializing the Mesos driver with options" + "\n" + "User: " + framework.getUser() + "\n" + "Framework Name: " + framework.getName() + "\n" + "Checkpointing: " + framework.getCheckpoint() ); driver = new MesosSchedulerDriver(JenkinsScheduler.this, framework, mesosCloud.getMaster()); Status runStatus = driver.run(); if (runStatus != Status.DRIVER_STOPPED) { LOGGER.severe("The Mesos driver was aborted! Status code: " + runStatus.getNumber()); } driver = null; } }).start(); }
Source:
private void assertArticleExistence(ArticleIdentity id, boolean expectedToExist) { boolean received404 = false; try { articleCrudService.readXml(id); } catch (InMemoryContentRepoService.InMemoryContentRepoServiceException me) { received404 = true; } catch(NotFoundException nfe) { received404 = true; } catch (RestClientException e) { throw e; } assertEquals(received404, !expectedToExist, (expectedToExist ? "Article expected to exist but doesn't" : "Article expected not to exist but does")); }

Target:
private void assertArticleExistence(ArticleIdentity id, boolean expectedToExist) { boolean received404 = false; try { articleCrudService.readXml(id); } catch (InMemoryContentRepoService.InMemoryContentRepoServiceException|NotFoundException nfe) { received404 = true; } catch (RestClientException e) { throw e; } assertEquals(received404, !expectedToExist, (expectedToExist ? "Article expected to exist but doesn't" : "Article expected not to exist but does")); }
Source:
public String getExtendedLabelForVSM(String providedShapeURI) { for (IConfigurationElement configurationElement : extensions) { String identifier = ((ExtensionHandle) configurationElement.getParent()).getSimpleIdentifier(); if (identifier != null && identifier.equals(providedShapeURI)) { return configurationElement.getAttribute(LABEL_ATTRIBUTE) + " - " + configurationElement.getNamespaceIdentifier(); } } return "Unknown URI"; }

Target:
public String getExtendedLabelForVSM(String providedShapeURI) { for (IConfigurationElement configurationElement : extensions) { String identifier = ((ExtensionHandle) configurationElement.getParent()).getSimpleIdentifier(); if (identifier != null && identifier.equals(providedShapeURI)) { return getExtendedLabelForVSM(configurationElement); } } return "Unknown URI"; }
Source:
public static void checkSchema(StructType tableSchema, StructType dataSchema, int[] partitionColumnMap, String location) throws StandardException{ StructField[] tableFields = tableSchema.fields(); StructField[] dataFields = dataSchema.fields(); if (tableFields.length != dataFields.length) { throw StandardException.newException(SQLState.INCONSISTENT_NUMBER_OF_ATTRIBUTE, tableFields.length, dataFields.length, location); } StructField[] partitionedTableFields = new StructField[tableSchema.fields().length]; Set<Integer> partitionColumns = new HashSet<>(); for (int pos : partitionColumnMap) { partitionColumns.add(pos); } int index = 0; for (int i = 0; i < tableFields.length; ++i) { if (!partitionColumns.contains(i)) { partitionedTableFields[index++] = tableFields[i]; } } for (int pos:partitionColumnMap) { partitionedTableFields[index++] = tableFields[pos]; } for (int i = 0; i < tableFields.length - partitionColumnMap.length; ++i) { String tableFiledTypeName = partitionedTableFields[i].dataType().typeName(); String dataFieldTypeName = dataFields[i].dataType().typeName(); if (!tableFiledTypeName.equals(dataFieldTypeName)){ throw StandardException.newException(SQLState.INCONSISTENT_DATATYPE_ATTRIBUTES, tableFields[i].name(), tableFields[i].dataType().toString(), dataFields[i].name(), dataFields[i].dataType().toString(),location); } } }

Target:
public static void checkSchema(StructType tableSchema, StructType dataSchema, int[] partitionColumnMap, String location) throws StandardException{ StructField[] tableFields = tableSchema.fields(); StructField[] dataFields = dataSchema.fields(); if (tableFields.length != dataFields.length) { throw StandardException.newException(SQLState.INCONSISTENT_NUMBER_OF_ATTRIBUTE, tableFields.length, dataFields.length, location); } StructField[] partitionedTableFields = new StructField[tableSchema.fields().length]; Set<Integer> partitionColumns = new HashSet<>(); for (int pos : partitionColumnMap) { partitionColumns.add(pos); } int index = 0; for (int i = 0; i < tableFields.length; ++i) { if (!partitionColumns.contains(i)) { partitionedTableFields[index++] = tableFields[i]; } } for (int i = 0; i < tableFields.length - partitionColumnMap.length; ++i) { String tableFiledTypeName = partitionedTableFields[i].dataType().typeName(); String dataFieldTypeName = dataFields[i].dataType().typeName(); if (!tableFiledTypeName.equals(dataFieldTypeName)){ throw StandardException.newException(SQLState.INCONSISTENT_DATATYPE_ATTRIBUTES, tableFields[i].name(), tableFields[i].dataType().toString(), dataFields[i].name(), dataFields[i].dataType().toString(),location); } } }
Source:
public <T> T getAdapter(Class<T> adapter) { return (T) (adapter.isAssignableFrom(walk.getRepository().getClass()) ? walk.getRepository() : null); }

Target:
public <T> T getAdapter(Class<T> adapter) { if (adapter != Repository.class) { return null; } return adapter.cast(walk.getRepository()); }
Source:
protected WebTarget newRequest(String uriString) { ResteasyClient httpClient = new ResteasyClientBuilder() .establishConnectionTimeout(10, TimeUnit.SECONDS) .socketTimeout(10, TimeUnit.SECONDS) .build(); WebTarget webTarget = httpClient.target(uriString); webTarget.register(new BasicAuthentication(TestConfig.getUsername(), TestConfig.getPassword())); return webTarget; }

Target:
protected WebTarget newRequest(String uriString) { ResteasyClient httpClient = new ResteasyClientBuilder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(10, TimeUnit.SECONDS) .build(); WebTarget webTarget = httpClient.target(uriString); webTarget.register(new BasicAuthentication(TestConfig.getUsername(), TestConfig.getPassword())); return webTarget; }
Source:
private void parseAndBuildConfig(ClientConfig config) throws Exception { YamlMapping yamlRootNode; try { yamlRootNode = ((YamlMapping) YamlLoader.load(in)); } catch (Exception ex) { throw new InvalidConfigurationException("Invalid YAML configuration", ex); } YamlNode clientRoot = yamlRootNode.childAsMapping(ClientConfigSections.HAZELCAST_CLIENT.name.toLowerCase()); if (clientRoot == null) { throw new InvalidConfigurationException("No mapping with hazelcast-client key is found in the provided " + "configuration"); } Node w3cRootNode = asW3cNode(clientRoot); replaceVariables(w3cRootNode); importDocuments(clientRoot); new YamlClientDomConfigProcessor(true, config).buildConfig(w3cRootNode); }

Target:
private void parseAndBuildConfig(ClientConfig config) throws Exception { YamlMapping yamlRootNode; try { yamlRootNode = ((YamlMapping) YamlLoader.load(in)); } catch (Exception ex) { throw new InvalidConfigurationException("Invalid YAML configuration", ex); } YamlNode clientRoot = yamlRootNode.childAsMapping(ClientConfigSections.HAZELCAST_CLIENT.name); if (clientRoot == null) { throw new InvalidConfigurationException("No mapping with hazelcast-client key is found in the provided " + "configuration"); } Node w3cRootNode = asW3cNode(clientRoot); replaceVariables(w3cRootNode); importDocuments(clientRoot); new YamlClientDomConfigProcessor(true, config).buildConfig(w3cRootNode); }
Source:
public void setup() { Type elementType; switch (valueTypeName) { case "BIGINT": elementType = BIGINT; break; case "DOUBLE": elementType = DOUBLE; break; case "VARCHAR": elementType = VARCHAR; break; default: throw new UnsupportedOperationException(); } Signature signature = new Signature("$operator$CAST", FunctionKind.SCALAR, new ArrayType(elementType).getTypeSignature(), JSON.getTypeSignature()); List<RowExpression> projections = ImmutableList.of( new CallExpression(signature, new ArrayType(elementType), ImmutableList.of( field(0, JSON)))); pageProcessor = new ExpressionCompiler(MetadataManager.createTestMetadataManager()) .compilePageProcessor(Optional.empty(), projections) .get(); page = new Page(createChannel(POSITIONS, ARRAY_SIZE, valueBound)); }

Target:
public void setup() { Type elementType; switch (valueTypeName) { case "BIGINT": elementType = BIGINT; break; case "DOUBLE": elementType = DOUBLE; break; case "VARCHAR": elementType = VARCHAR; break; default: throw new UnsupportedOperationException(); } Signature signature = new Signature("$operator$CAST", FunctionKind.SCALAR, new ArrayType(elementType).getTypeSignature(), JSON.getTypeSignature()); List<RowExpression> projections = ImmutableList.of( new CallExpression(signature, new ArrayType(elementType), ImmutableList.of(field(0, JSON)))); pageProcessor = new ExpressionCompiler(MetadataManager.createTestMetadataManager()) .compilePageProcessor(Optional.empty(), projections) .get(); page = new Page(createChannel(POSITION_COUNT, ARRAY_SIZE, elementType)); }
Source:
public void write(Content entity, FieldWriter writer, OutputContext ctxt) throws IOException { if (entity instanceof Container) { Integer offset = 0; Integer limit = Integer.MAX_VALUE; if (!Strings.isNullOrEmpty(ctxt.getRequest().getParameter("sub_item.offset"))) { offset = Integer.valueOf(ctxt.getRequest().getParameter("sub_item.offset")); } if (!Strings.isNullOrEmpty(ctxt.getRequest().getParameter("sub_item.limit"))) { limit = Integer.valueOf(ctxt.getRequest().getParameter("sub_item.limit")); } Container container = (Container) entity; ImmutableList<ItemRef> orderedRefs = Ordering.natural() .onResultOf(ItemRef::getSortKey) .reverse() .nullsLast() .immutableSortedCopy(container.getItemRefs()); orderedRefs = orderedRefs.stream().skip(offset).limit(limit).collect(ImmutableCollectors.toList()); writer.writeList(childRefWriter, orderedRefs, ctxt); } }

Target:
public void write(Content entity, FieldWriter writer, OutputContext ctxt) throws IOException { if (entity instanceof Container) { Integer offset = 0; Integer limit = Integer.MAX_VALUE; String offsetStr = ctxt.getRequest().getParameter(SUB_ITEM_OFFSET); if (!Strings.isNullOrEmpty(offsetStr)) { offset = Integer.valueOf(offsetStr); } String limitStr = ctxt.getRequest().getParameter(SUB_ITEM_LIMIT); if (!Strings.isNullOrEmpty(limitStr)) { limit = Integer.valueOf(limitStr); } Container container = (Container) entity; ImmutableList<ItemRef> orderedRefs = Ordering.natural() .onResultOf(ItemRef::getSortKey) .reverse() .nullsLast() .immutableSortedCopy(container.getItemRefs()); orderedRefs = orderedRefs.stream() .skip(offset) .limit(limit) .collect(ImmutableCollectors.toList()); writer.writeList(childRefWriter, orderedRefs, ctxt); } }
Source:
protected void doRemove(String owner, String service, String name) throws NotFoundException { EntityManager manager = managerProvider.get(); SshPairImpl entity = manager.find(SshPairImpl.class, new SshPairPrimaryKey(owner, service, name)); if (entity != null) { manager.remove(entity); } else { throw new NotFoundException(String.format("Ssh pair with service '%s' and name '%s' was not found.", service, name)); } }

Target:
protected void doRemove(String owner, String service, String name) throws NotFoundException { EntityManager manager = managerProvider.get(); SshPairImpl entity = manager.find(SshPairImpl.class, new SshPairPrimaryKey(owner, service, name)); if (entity == null) { throw new NotFoundException(String.format("Ssh pair with service '%s' and name '%s' was not found.", service, name)); } manager.remove(entity); }
Source:
public ModuleOptionsMetadata resolve(ModuleDefinition moduleDefinition) { List<ModuleOptionsMetadata> moms = new ArrayList<ModuleOptionsMetadata>(); ModuleType type = moduleDefinition.getType(); if (type == source || type == processor) { moms.add(new PojoModuleOptionsMetadata(Output.class, null, null, conversionService)); } if (type == sink || type == processor) { moms.add(new PojoModuleOptionsMetadata(Input.class, null, null, conversionService)); } switch (moms.size()) { case 2: return new FlattenedCompositeModuleOptionsMetadata(moms); case 1: return moms.iterator().next(); case 0: return null; default: throw new IllegalStateException("Should never happen: " + moms); } }

Target:
public ModuleOptionsMetadata resolve(ModuleDefinition moduleDefinition) { List<ModuleOptionsMetadata> moms = new ArrayList<ModuleOptionsMetadata>(); ModuleType type = moduleDefinition.getType(); if (type == source || type == processor) { moms.add(new PojoModuleOptionsMetadata(OutputOptionsMetadata.class, null, null, conversionService)); } if (type == sink || type == processor) { moms.add(new PojoModuleOptionsMetadata(InputOptionsMetadata.class, null, null, conversionService)); } switch (moms.size()) { case 0: return null; case 1: return moms.iterator().next(); default: return new FlattenedCompositeModuleOptionsMetadata(moms); } }
Source:
public synchronized boolean seek(CtfLocationInfo ctfLocationData) { boolean ret = false; if (ctfLocationData.equals(CtfLocation.INVALID_LOCATION)) { fCurLocation = NULL_LOCATION; return false; } if (fCurLocation.getLocationInfo().equals(ctfLocationData)) { return super.hasMoreEvents(); } fCurLocation = new CtfLocation(ctfLocationData); final long seekToTimestamp = ctfLocationData.getTimestamp(); final long offsetTimestamp = this.getCtfTmfTrace().timestampNanoToCycles(seekToTimestamp); try { if (offsetTimestamp < 0) { ret = super.seek(0L); } else { ret = super.seek(offsetTimestamp); } } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); return false; } long index = 0; ITmfEvent currentEvent = getCurrentEvent(); ret &= (currentEvent != null); ITmfEvent previousEvent = currentEvent; for (long i = 0; ret && i < ctfLocationData.getIndex(); i++) { if (seekToTimestamp >= Objects.requireNonNull(currentEvent).getTimestamp().getValue()) { index++; } else { break; } ret = advance(); previousEvent = currentEvent; currentEvent = getCurrentEvent(); } if (ret) { fCurLocation = new CtfLocation(new CtfLocationInfo(Objects.requireNonNull(previousEvent).getTimestamp().getValue(), index)); } else { fCurLocation = NULL_LOCATION; } return ret; }

Target:
public synchronized boolean seek(CtfLocationInfo ctfLocationData) { boolean ret = false; if (ctfLocationData.equals(CtfLocation.INVALID_LOCATION)) { fCurLocation = NULL_LOCATION; return false; } if (fCurLocation.getLocationInfo().equals(ctfLocationData)) { return super.hasMoreEvents(); } fCurLocation = new CtfLocation(ctfLocationData); final long seekToTimestamp = ctfLocationData.getTimestamp(); final long offsetTimestamp = this.getCtfTmfTrace().timestampNanoToCycles(seekToTimestamp); try { if (offsetTimestamp < 0) { ret = super.seek(0L); } else { ret = super.seek(offsetTimestamp); } } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); return false; } long index = 0; ITmfEvent currentEvent = getCurrentEvent(); ret &= (currentEvent != null); ITmfEvent previousEvent = currentEvent; for (long i = 0; ret && i < ctfLocationData.getIndex(); i++) { if (seekToTimestamp >= Objects.requireNonNull(currentEvent).getTimestamp().getValue()) { index++; } else { index = 0; break; } ret = advance(); previousEvent = currentEvent; currentEvent = getCurrentEvent(); } if (ret) { fCurLocation = new CtfLocation(new CtfLocationInfo(Objects.requireNonNull(previousEvent).getTimestamp().getValue(), index)); } else { fCurLocation = NULL_LOCATION; } return ret; }
Source:
public String getRunningFlowIds() { List<Integer> allIds = new ArrayList<Integer>(); getRunningFlowsIdsHelper(allIds, queuedFlowMap.values()); getRunningFlowsIdsHelper(allIds, runningFlows.values()); Collections.sort(allIds); return allIds.toString(); }

Target:
public String getRunningFlowIds() { List<Integer> allIds = new ArrayList<Integer>(); getRunningFlowsIdsHelper(allIds, queuedFlows.getAllEntries()); getRunningFlowsIdsHelper(allIds, runningFlows.values()); Collections.sort(allIds); return allIds.toString(); }
Source:
public boolean isNextStepCurrentStep() { return null == this.getNextStep() || CURRENT_STEP.equalsIgnoreCase(this.getNextStep()); }

Target:
public boolean isNextStepCurrentStep() { return CURRENT_STEP.equalsIgnoreCase(this.getNextStep()); }
Source:
protected ReadableBuffer createDeliveryCopy(int deliveryCount, DeliveryAnnotations deliveryAnnotations) { ReadableBuffer duplicate = getData().duplicate(); final int amqpDeliveryCount = deliveryCount - 1; final ByteBuf result = PooledByteBufAllocator.DEFAULT.heapBuffer(getEncodeSize()); Header localHeader = this.header; if (localHeader == null) { localHeader = new Header(); } else { localHeader = new Header(header); } localHeader.setDeliveryCount(UnsignedInteger.valueOf(amqpDeliveryCount)); TLSEncode.getEncoder().setByteBuffer(new NettyWritable(result)); TLSEncode.getEncoder().writeObject(localHeader); TLSEncode.getEncoder().setByteBuffer((WritableBuffer) null); writeDeliveryAnnotationsForSendBuffer(result, deliveryAnnotations); duplicate.position(encodedHeaderSize + encodedDeliveryAnnotationsSize); result.writeBytes(duplicate.byteBuffer()); return new NettyReadable(result); }

Target:
protected ReadableBuffer createDeliveryCopy(int deliveryCount, DeliveryAnnotations deliveryAnnotations) { ReadableBuffer duplicate = getData().duplicate(); final int amqpDeliveryCount = deliveryCount - 1; final ByteBuf result = PooledByteBufAllocator.DEFAULT.heapBuffer(getEncodeSize()); Header localHeader = this.header; if (localHeader == null) { if (deliveryCount > 1) { localHeader = new Header(); } } else { localHeader = new Header(header); } if (localHeader != null) { localHeader.setDeliveryCount(UnsignedInteger.valueOf(amqpDeliveryCount)); TLSEncode.getEncoder().setByteBuffer(new NettyWritable(result)); TLSEncode.getEncoder().writeObject(localHeader); TLSEncode.getEncoder().setByteBuffer((WritableBuffer) null); } writeDeliveryAnnotationsForSendBuffer(result, deliveryAnnotations); duplicate.position(encodedHeaderSize + encodedDeliveryAnnotationsSize); result.writeBytes(duplicate.byteBuffer()); return new NettyReadable(result); }
Source:
private static IEditorPart findEditor(Object inputElement, boolean activate) { if (inputElement instanceof IJavaElement) { ICompilationUnit cu= (ICompilationUnit)((IJavaElement)inputElement).getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { IWorkbenchPage page= JavaPlugin.getActivePage(); IEditorPart editor= page != null ? editor= page.getActiveEditor() : null; if (editor != null) { boolean isCompareEditorInput= isCompareEditorInput(editor.getEditorInput()); if (isCompareEditorInput || !JavaModelUtil.isPrimary(cu)) { if (isCompareEditorInput) { return editor; } IEditorInput editorInput = editor.getEditorInput(); IJavaElement editorCU= getEditorInputJavaElement(editorInput, false); if (cu.equals(editorCU)) { if (activate && page.getActivePart() != editor) { page.activate(editor); } return editor; } } } } } return null; }

Target:
private static IEditorPart findEditor(Object inputElement, boolean activate) { if (inputElement instanceof IJavaElement) { ICompilationUnit cu= (ICompilationUnit)((IJavaElement)inputElement).getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { IWorkbenchPage page= JavaPlugin.getActivePage(); IEditorPart editor= page != null ? editor= page.getActiveEditor() : null; if (editor != null) { boolean isCompareEditorInput= isCompareEditorInput(editor.getEditorInput()); if (isCompareEditorInput) { return editor; } if (!JavaModelUtil.isPrimary(cu)) { IEditorInput editorInput = editor.getEditorInput(); IJavaElement editorCU= getEditorInputJavaElement(editorInput, false); if (cu.equals(editorCU)) { if (activate && page.getActivePart() != editor) { page.activate(editor); } return editor; } } } } } return null; }
Source:
private Operator getWindowOperator(final String queryId, final WindowOperatorInfo wOpInfo, final ClassLoader classLoader) throws IllegalArgumentException, IOException, ClassNotFoundException { final String operatorId = operatorIdGenerator.generate(); final Operator operator; switch (wOpInfo.getWindowOperatorType()) { case TIME: operator = new TimeWindowOperator<>( queryId, operatorId, wOpInfo.getWindowSize(), wOpInfo.getWindowInterval()); break; case COUNT: operator = new CountWindowOperator<>( queryId, operatorId, wOpInfo.getWindowSize(), wOpInfo.getWindowInterval()); break; case SESSION: operator = new SessionWindowOperator<>( queryId, operatorId, wOpInfo.getWindowInterval()); break; case JOIN: final List<ByteBuffer> objectList = wOpInfo.getFunctions(); final BiPredicate joinPred = (BiPredicate) deserializeLambda(objectList.get(0), classLoader); operator = new JoinOperator<>(queryId, operatorId, joinPred); break; default: throw new IllegalArgumentException("MISTTask: Invalid window operator type " + wOpInfo.getWindowOperatorType().toString()); } return operator; }

Target:
private Operator getWindowOperator(final String queryId, final WindowOperatorInfo wOpInfo, final ClassLoader classLoader) throws IllegalArgumentException, IOException, ClassNotFoundException { final String operatorId = operatorIdGenerator.generate(); final Operator operator; switch (wOpInfo.getWindowOperatorType()) { case TIME: operator = new TimeWindowOperator<>( queryId, operatorId, wOpInfo.getWindowSize(), wOpInfo.getWindowInterval()); break; case COUNT: operator = new CountWindowOperator<>( queryId, operatorId, wOpInfo.getWindowSize(), wOpInfo.getWindowInterval()); break; case SESSION: operator = new SessionWindowOperator<>( queryId, operatorId, wOpInfo.getWindowInterval()); break; case JOIN: final List<ByteBuffer> functionList = wOpInfo.getFunctions(); final BiPredicate joinPred = (BiPredicate) deserializeLambda(functionList.get(0), classLoader); operator = new JoinOperator<>(queryId, operatorId, joinPred); break; default: throw new IllegalArgumentException("MISTTask: Invalid window operator type " + wOpInfo.getWindowOperatorType().toString()); } return operator; }
Source:
private void processRetryOps() { if (!retryQueue.isEmpty()) { boolean interrupted = false; retryQueue.drainTo(localRetryOps, drainSize); int i = 0; while (i < localRetryOps.size()) { try { localRetryOps.get(i).apply(); i++; } catch (final InterruptedException e) { interrupted = true; LOG.log(Level.FINE, "Op.apply() failed with InterruptedException, try again", e); } } if (interrupted) { interrupt(); } localRetryOps.clear(); } }

Target:
private void processRetryOps() { if (!retryQueue.isEmpty()) { retryQueue.drainTo(localRetryOps, drainSize); for (final Op retryOp : localRetryOps) { retryOp.retry(); } localRetryOps.clear(); } }
Source:
protected Step transform() { return generateStep(NORMALIZE_VARIANTS, new VariantsTransform(updateVariantOptionsWithJobSpecificValues(getVariantOptions()), getPipelineOptions())); }

Target:
protected Step transform() { return generateStep(NORMALIZE_VARIANTS, new VariantsTransform(getVariantOptions(), getPipelineOptions())); }
Source:
public Lock(LockDataTypes.LockId lockId, LockListener lockListener, LockClient.ClientContext clientContext, LockConfig lockConfig) { this.lockId = lockId; this.clientContext = clientContext; this.lockListener = lockListener; this.eventConsumer = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("lock-event-consumer").build()); this.lockConfig = lockConfig; initializeStates(); this.state = states.get(LockStateType.NO_LEASE); eventConsumer.submit(this::consume); }

Target:
public Lock(LockDataTypes.LockId lockId, LockListener lockListener, LockClient.ClientContext clientContext, LockConfig lockConfig) { this(lockId, lockListener, clientContext, lockConfig, LockStateType.NO_LEASE); }
Source:
private boolean handleSSLFailure(Certificate[] lastChain) throws CommandLineException { printLine("Unable to connect due to unrecognised server certificate"); for (Certificate current : lastChain) { if (current instanceof X509Certificate) { X509Certificate x509Current = (X509Certificate) current; Map<String, String> fingerprints = FingerprintGenerator.generateFingerprints(x509Current); printLine("Subject - " + x509Current.getSubjectX500Principal().getName()); printLine("Issuer - " + x509Current.getIssuerDN().getName()); printLine("Valid From - " + x509Current.getNotBefore()); printLine("Valid To - " + x509Current.getNotAfter()); for (String alg : fingerprints.keySet()) { printLine(alg + " : " + fingerprints.get(alg)); } printLine(""); } } for (;;) { String response; if (trustManager.isModifyTrustStore()) { response = readLine("Accept certificate? [N]o, [T]emporarily, [P]ermenantly : ", false, true); } else { response = readLine("Accept certificate? [N]o, [T]emporarily : ", false, true); } if (response == null) return false; if (response != null && response.length() == 1) { switch (response.toLowerCase(Locale.ENGLISH).charAt(0)) { case 'n': return false; case 't': trustManager.storeChainTemporarily(lastChain); return true; case 'p': if (trustManager.isModifyTrustStore()) { trustManager.storeChainPermenantly(lastChain); return true; } } } } }

Target:
private boolean handleSSLFailure(Certificate[] lastChain) throws CommandLineException { printLine("Unable to connect due to unrecognised server certificate"); for (Certificate current : lastChain) { if (current instanceof X509Certificate) { X509Certificate x509Current = (X509Certificate) current; Map<String, String> fingerprints = FingerprintGenerator.generateFingerprints(x509Current); printLine("Subject - " + x509Current.getSubjectX500Principal().getName()); printLine("Issuer - " + x509Current.getIssuerDN().getName()); printLine("Valid From - " + x509Current.getNotBefore()); printLine("Valid To - " + x509Current.getNotAfter()); for (String alg : fingerprints.keySet()) { printLine(alg + " : " + fingerprints.get(alg)); } printLine(""); } } for (;;) { String response; if (trustManager.isModifyTrustStore()) { response = readLine("Accept certificate? [N]o, [T]emporarily, [P]ermenantly : ", false, true); } else { response = readLine("Accept certificate? [N]o, [T]emporarily : ", false, true); } if (response == null) return false; else if (response.length() == 1) { switch (response.toLowerCase(Locale.ENGLISH).charAt(0)) { case 'n': return false; case 't': trustManager.storeChainTemporarily(lastChain); return true; case 'p': if (trustManager.isModifyTrustStore()) { trustManager.storeChainPermenantly(lastChain); return true; } } } } }
Source:
public void testCheckAccessThreadGroup() { carbonSecurityManager = mock(CarbonSecurityManager.class); ThreadGroup threadGroup = mock(ThreadGroup.class); carbonSecurityManager.checkAccess(threadGroup); }

Target:
public void testCheckAccessThreadGroup() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); ThreadGroup threadGroup = mock(ThreadGroup.class); carbonSecurityManager.checkAccess(threadGroup); }
Source:
public void emit(final Context context, final Event event) { checkNotNull(event); checkNotNull(context); final WebResource.Builder builder = client .resource(resolveEventPath(event.getClass())) .accept(MediaType.APPLICATION_JSON_TYPE) .type(MediaType.APPLICATION_JSON_TYPE); contextSerializer.serialize(context, builder); try { final ClientResponse response = builder.put(ClientResponse.class, event); final ClientResponse.Status status = response.getClientResponseStatus(); if ( ! ACCEPTED.equals(status)) { throw new KasperException("event submission failed with status <" + status.getReasonPhrase() + ">"); } } catch (final Exception e) { e.printStackTrace(); throw new KasperException("Unable to send event : " + event.getClass().getName(), e); } }

Target:
public void emit(final Context context, final Event event) { checkNotNull(event); checkNotNull(context); final WebResource.Builder builder = client .resource(resolveEventPath(event.getClass())) .accept(MediaType.APPLICATION_JSON_TYPE) .type(MediaType.APPLICATION_JSON_TYPE); contextSerializer.serialize(context, builder); try { final ClientResponse response = builder.put(ClientResponse.class, event); final ClientResponse.Status status = response.getClientResponseStatus(); if ( ! ACCEPTED.equals(status)) { throw new KasperException("event submission failed with status <" + status.getReasonPhrase() + ">"); } } catch (final Exception e) { throw new KasperException("Unable to send event : " + event.getClass().getName(), e); } }
Source:
public Options(Dimension screenRes) { setInstance(this); this.dimension = screenRes; factoryRng = new Random(); spawnRng = factoryRng; this.setBackGround(DEFAULT_BACKGROUND_IMAGE); this.setMusicFileName(DEFAULT_MUSIC_FILENAME); this.setHitSoundFileName(DEFAULT_HIT_SOUND_FILENAME); this.setLaserSoundFileName(DEFAULT_LASER_SOUND_FILENAME); this.setAmmoPickupSoundFileName(DEFAULT_PICKUP_SOUND_FILENAME); playingMusic = false; mutedMusic = false; mutedSfx = false; musicVolume = 1.0f; sfxVolume = 1.0f; }

Target:
public Options(Dimension screenRes) { setInstance(this); this.dimension = screenRes; factoryRng = new Random(); spawnRng = factoryRng; this.setBackGround(DEFAULT_BACKGROUND_IMAGE); this.setMusicFileName(DEFAULT_MUSIC_FILENAME); this.setEatSoundFileName(DEFAULT_EAT_SOUND_FILENAME); this.setLaserSoundFileName(DEFAULT_LASER_SOUND_FILENAME); this.setPickupSoundFileName(DEFAULT_PICKUP_SOUND_FILENAME); playingMusic = false; mutedMusic = false; mutedSfx = false; musicVolume = 1.0f; sfxVolume = 1.0f; }
Source:
protected void createControls(Composite composite) { fAncestor = createMergeViewer(composite, MergeViewerSide.ANCESTOR); fAncestor.addSelectionChangedListener(this); fLeft = createMergeViewer(composite, MergeViewerSide.LEFT); fLeft.addSelectionChangedListener(this); fRight = createMergeViewer(composite, MergeViewerSide.RIGHT); fRight.addSelectionChangedListener(this); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme currentTheme = null; if (themeManager != null) { currentTheme = themeManager.getCurrentTheme(); } fColors = new EMFCompareColor(this, currentTheme, getCompareConfiguration()); composite.addControlListener(new ControlListener() { public void controlResized(ControlEvent e) { redrawCenterControl(); } public void controlMoved(ControlEvent e) { } }); }

Target:
protected void createControls(Composite composite) { fAncestor = createMergeViewer(composite, MergeViewerSide.ANCESTOR); fAncestor.addSelectionChangedListener(this); fLeft = createMergeViewer(composite, MergeViewerSide.LEFT); fLeft.addSelectionChangedListener(this); fRight = createMergeViewer(composite, MergeViewerSide.RIGHT); fRight.addSelectionChangedListener(this); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); final ITheme currentTheme; if (themeManager != null) { currentTheme = themeManager.getCurrentTheme(); } else { currentTheme = null; } fColors = new EMFCompareColor(this.getControl(), currentTheme, getCompareConfiguration()); composite.addControlListener(new ControlListener() { public void controlResized(ControlEvent e) { redrawCenterControl(); } public void controlMoved(ControlEvent e) { } }); }
Source:
public void push(RowMap r) throws Exception { try { PutRecordResult putResult = kinesis.putRecord( this.stream, ByteBuffer.wrap(r.toJSON().toString().getBytes()), r.getDatabase(), Long.toString(counter.getAndIncrement()) ); this.context.setPosition(r); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Success - put result in kinesis stream -> " + putResult.toString()); LOGGER.debug("Position -> " + r.getPosition()); } } catch (ResourceNotFoundException e) { e.printStackTrace(); } catch (InvalidArgumentException e) { e.printStackTrace(); } catch (ProvisionedThroughputExceededException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }

Target:
public void push(RowMap r) throws Exception { PutRecordResult putResult = kinesis.putRecord( this.stream, ByteBuffer.wrap(r.toJSON().toString().getBytes()), r.getDatabase(), Long.toString(counter.getAndIncrement()) ); this.context.setPosition(r); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Success - put result in kinesis stream -> " + putResult.toString()); LOGGER.debug("Position -> " + r.getPosition()); } }
Source:
public void handleEditPostResult(int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK || data == null || !isAdded()) { return; } int localId = data.getIntExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, 0); final PostModel post = mPostStore.getPostByLocalPostId(localId); if ((post == null) && !data.getBooleanExtra(EditPostActivity.EXTRA_IS_DISCARDABLE, false)) { ToastUtils.showToast(getActivity(), R.string.post_not_found, ToastUtils.Duration.LONG); return; } UploadUtils.handleEditPostResultSnackbars(getActivity(), getActivity().findViewById(R.id.coordinator), data, post, mSite, new View.OnClickListener() { @Override public void onClick(View v) { UploadUtils .publishPost(getActivity(), post, mSite, mDispatcher); } }); }

Target:
public void handleEditPostResult(int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK || data == null || !isAdded()) { return; } int localId = data.getIntExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, 0); final PostModel post = mPostStore.getPostByLocalPostId(localId); if (post == null) { if (!data.getBooleanExtra(EditPostActivity.EXTRA_IS_DISCARDABLE, false)) { ToastUtils.showToast(getActivity(), R.string.post_not_found, ToastUtils.Duration.LONG); } return; } UploadUtils.handleEditPostResultSnackbars(getActivity(), getActivity().findViewById(R.id.coordinator), data, post, mSite, new View.OnClickListener() { @Override public void onClick(View v) { UploadUtils .publishPost(getActivity(), post, mSite, mDispatcher); } }); }