auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BuildImageParams withFiles(@NotNull File... files) { requireNonNull(files); requireNonEmptyArray(files); if (remote != null) { throw new IllegalStateException("Remote parameter is already set. Remote and files parameters are mutually exclusive."); } this.files = new ArrayList<>(files.length + 1); return addFiles(files); }

Target:
public BuildImageParams withFiles(@NotNull File... files) { if (remote != null) { throw new IllegalStateException("Remote parameter is already set. Remote and files parameters are mutually exclusive."); } requireNonNull(files); requireNonEmptyArray(files); this.files = new ArrayList<>(files.length + 1); return addFiles(files); }
Source:
public Config buildCoordinatorStreamConfig(Config config) { JobConfig jobConfig = new JobConfig(config); String jobName = jobConfig.getName().toString(); String jobId = jobConfig.getJobId(); Map<String, String> map = config.subset(String.format(SystemConfig.SYSTEM_ID_PREFIX, jobConfig.getCoordinatorSystemName()), false); Map<String, String> addConfig = new HashMap<>(); addConfig.put(JobConfig.JOB_NAME, jobName); addConfig.put(jobConfig.JOB_ID, jobId); addConfig.put(JobConfig.JOB_COORDINATOR_SYSTEM, jobConfig.getCoordinatorSystemName()); addConfig.put(jobConfig.MONITOR_PARTITION_CHANGE_FREQUENCY_MS, String.valueOf(jobConfig.getMonitorPartitionChangeFrequency())); addConfig.putAll(map); return new MapConfig(addConfig); }

Target:
public Config buildCoordinatorStreamConfig(Config config) { JobConfig jobConfig = new JobConfig(config); String jobName = jobConfig.getName().orElseThrow(() -> new ConfigException("Missing required config: job.name")); String jobId = jobConfig.getJobId(); Map<String, String> map = config.subset(String.format(SystemConfig.SYSTEM_ID_PREFIX, jobConfig.getCoordinatorSystemName()), false); Map<String, String> addConfig = new HashMap<>(); addConfig.put(JobConfig.JOB_NAME, jobName); addConfig.put(JobConfig.JOB_ID, jobId); addConfig.put(JobConfig.JOB_COORDINATOR_SYSTEM, jobConfig.getCoordinatorSystemName()); addConfig.put(JobConfig.MONITOR_PARTITION_CHANGE_FREQUENCY_MS, String.valueOf(jobConfig.getMonitorPartitionChangeFrequency())); addConfig.putAll(map); return new MapConfig(addConfig); }
Source:
public void setup() throws Exception { HostIdGenerator.useTemporaryHostId(); hostId = HostIdGenerator.getHostId(); config = config.withValue("zookeeper.use_new_stack", ConfigValueFactory.fromAnyRef(backendEnabled)); injector = Guice.createInjector(new SerializationModule(), new TestModule()); zkManager = injector.getInstance(ZkManager.class); hostZkManager = injector.getInstance(HostZkManager.class); store = injector.getInstance(MidonetBackend.class).ownershipStore(); versionPath = injector.getInstance(PathBuilder.class) .getHostVersionPath(hostId, DataWriteVersion.CURRENT); alivePath = injector.getInstance(PathBuilder.class) .getHostPath(hostId) + "/alive"; hostName = InetAddress.getLocalHost().getHostName(); store.registerClass(Topology.Host.class, OwnershipType.Exclusive()); store.build(); }

Target:
public void setup() throws Exception { HostIdGenerator.useTemporaryHostId(); hostId = HostIdGenerator.getHostId(); injector = Guice.createInjector(new SerializationModule(), new TestModule()); zkManager = injector.getInstance(ZkManager.class); hostZkManager = injector.getInstance(HostZkManager.class); store = injector.getInstance(MidonetBackend.class).ownershipStore(); versionPath = injector.getInstance(PathBuilder.class) .getHostVersionPath(hostId, DataWriteVersion.CURRENT); alivePath = injector.getInstance(PathBuilder.class) .getHostPath(hostId) + "/alive"; hostName = InetAddress.getLocalHost().getHostName(); store.registerClass(Topology.Host.class, OwnershipType.Exclusive()); store.build(); }
Source:
CosmosAsyncContainer(String id, CosmosAsyncDatabase database) { this.id = id; this.database = database; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); this.replaceContainerSpanName = "replaceContainer." + this.id; this.deleteContainerSpanName = "deleteContainer." + this.id; this.replaceProvisionedThroughputSpanName = "replaceProvisionedThroughput." + this.id; this.readProvisionedThroughputSpanName = "readProvisionedThroughput." + this.id; this.replaceThroughputSpanName = "replaceThroughput." + this.id; this.readThroughputSpanName = "readThroughput." + this.id; this.readContainerSpanName = "readContainer." + this.id; this.upsertItemSpanName = "upsertItem." + this.id; this.deleteItemSpanName = "deleteItem." + this.id; this.replaceItemSpanName = "replaceItem." + this.id; this.createItemSpanName = "createItem." + this.id; this.readAllItemsSpanName = "readAllItems." + this.id; this.queryItemsSpanName = "queryItems." + this.id; this.readAllConflictsSpanName = "readAllConflicts." + this.id; this.queryConflictsSpanName = "queryConflicts." + this.id; }

Target:
CosmosAsyncContainer(String id, CosmosAsyncDatabase database) { this.id = id; this.database = database; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); this.replaceContainerSpanName = "replaceContainer." + this.id; this.deleteContainerSpanName = "deleteContainer." + this.id; this.replaceThroughputSpanName = "replaceThroughput." + this.id; this.readThroughputSpanName = "readThroughput." + this.id; this.readContainerSpanName = "readContainer." + this.id; this.readItemSpanName = "readItem." + this.id; this.upsertItemSpanName = "upsertItem." + this.id; this.deleteItemSpanName = "deleteItem." + this.id; this.replaceItemSpanName = "replaceItem." + this.id; this.createItemSpanName = "createItem." + this.id; this.readAllItemsSpanName = "readAllItems." + this.id; this.queryItemsSpanName = "queryItems." + this.id; this.readAllConflictsSpanName = "readAllConflicts." + this.id; this.queryConflictsSpanName = "queryConflicts." + this.id; }
Source:
private void createCacheWithCacheConfiguration() { manager.administration().getOrCreateCache("CacheWithConfigurationTemplate", "MyDistCachecConfig"); System.out.println("Cache with template exists or is created"); manager.administration().withFlags(AdminFlag.VOLATILE).getOrCreateCache("TemporaryCacheWithConfigurationTemplate", "MyDistCachecConfig"); System.out.println("Temporary cache with template exists or is created"); }

Target:
private void createCacheWithCacheConfiguration() { manager.administration().getOrCreateCache("CacheWithConfigurationTemplate", "MyDistCachecConfig"); System.out.println("Cache with template exists or is created."); manager.administration().withFlags(AdminFlag.VOLATILE).getOrCreateCache("TemporaryCacheWithConfigurationTemplate", "org.infinispan.DIST_SYNC"); System.out.println("Temporary cache with template exists or is created."); }
Source:
private EntityRef addLog(Vector3i location, Block log, boolean force, EntityRef root) { EntityRef logEntity = addLog(location, log, force); if(logEntity != null && logEntity != EntityRef.NULL) { LogComponent logComponent = new LogComponent(); logComponent.location = location; if(root == EntityRef.NULL) { logComponent.root = logEntity; } else { logComponent.root = root; } logEntity.addOrSaveComponent(logComponent); } return logEntity; }

Target:
private EntityRef addLog(Vector3i location, Block log, boolean force, EntityRef root) { EntityRef logEntity = addLog(location, log, force); if(logEntity != EntityRef.NULL) { LogComponent logComponent = new LogComponent(); logComponent.location = location; if(root == EntityRef.NULL) { logComponent.root = logEntity; } else { logComponent.root = root; } logEntity.addOrSaveComponent(logComponent); } return logEntity; }
Source:
private void nonBlockingCheckAndRethrow() { if (this.currentTask != null && this.currentTask.isDone()) { this.checkAndRethrow(); } }

Target:
private void nonBlockingCheckAndRethrow() { if (this.currentTask != null && this.currentTask.isDone()) checkAndRethrow(); }
Source:
public static GameMap loadMap(String mapName, File mapDir) throws IOException { final GameMap result; if (mapName.endsWith(".xml")) { mapName = mapName.substring(0, mapName.indexOf('.')); } final File mapFile = new File(mapDir, mapName + ".xml"); if (mapFile.exists()) { result = loadMap(new FileInputStream(mapFile)); } else { final InputStream backupStream = BACKUP_LOADER.getResourceAsStream(DEFAULT_MAP_PACKAGE + mapName + ".xml"); if (backupStream == null) { throw new IOException("Can't load map: " + mapName + " from dir " + mapDir + " or default maps."); } result = loadMap(backupStream); } if (!result.getMapName().equals(mapName)) { throw new IOException("Invalid map: name (" + result.getMapName() + ") does not match filename (" + mapName + ".xml)" ); } return result; }

Target:
public static GameMap loadMap(String mapName, File mapDir) throws IOException { final GameMap result; if (mapName.endsWith(".xml")) { mapName = mapName.substring(0, mapName.lastIndexOf('.')); } final File mapFile = new File(mapDir, mapName + ".xml"); if (mapFile.exists()) { result = loadMap(new FileInputStream(mapFile)); } else { final InputStream backupStream = BACKUP_LOADER.getResourceAsStream(DEFAULT_MAP_PACKAGE + mapName + ".xml"); if (backupStream == null) { throw new IOException("Can't load map: " + mapName + " from dir " + mapDir + " or default maps."); } result = loadMap(backupStream); } if (!result.getMapName().equals(mapName)) { throw new IOException("Invalid map: name (" + result.getMapName() + ") does not match filename (" + mapName + ".xml)" ); } return result; }
Source:
public SlackSlashCommand() throws IOException, GeneralSecurityException { kgClient = new Kgsearch.Builder( GoogleNetHttpTransport.newTrustedTransport(), new JacksonFactory(), null).build(); Path configPath = Path.of(System.getProperty("user.dir"), "config.json"); JsonObject configJson = (new Gson()).fromJson(Files.readString(configPath), JsonObject.class); SLACK_SECRET = configJson.get("SLACK_SECRET").getAsString(); API_KEY = configJson.get("KG_API_KEY").getAsString(); verifier = new SlackSignature.Verifier(new SlackSignature.Generator(SLACK_SECRET)); }

Target:
public SlackSlashCommand() throws IOException, GeneralSecurityException { kgClient = new Kgsearch.Builder( GoogleNetHttpTransport.newTrustedTransport(), new JacksonFactory(), null).build(); verifier = new SlackSignature.Verifier(new SlackSignature.Generator(SLACK_SECRET)); }
Source:
public RsBuffered(final Response res) { super( new RsOf( res::head, () -> new BufferedInputStream(res.body()) ) ); }

Target:
public RsBuffered(final Response res) { super( new ResponseOf( res::head, () -> new BufferedInputStream(res.body()) ) ); }
Source:
static public void main(String[] args) throws IOException { if (args.length < 3) { System.err.println("This executable requires four arguments:\n" + " OntonotesTreebankReader <OntoNotes Directory> <language> <output_directory>"); System.exit(-1); } String topdir = args[0]; OntonotesTreebankReader otr = new OntonotesTreebankReader(topdir, args[1]); int count = 0; while (otr.hasNext()) { TextAnnotation ta = otr.next(); String json = SerializationHelper.serializeToJson(ta); String outfile = otr.currentfile.replace(topdir, args[2]); File outputfile = new File(outfile); outputfile.getParentFile().mkdirs(); try (PrintWriter out = new PrintWriter(outputfile)) { out.print(json); } count++; if ((count % 10) == 0) System.out.println("Completed "+count+" of "+otr.filelist.size()); } System.out.println("Processed a total of "+count+" of "+otr.filelist.size()+" treebanks."); }

Target:
static public void main(String[] args) throws IOException { if (args.length < 3) { System.err.println("This executable requires four arguments:\n" + " OntonotesTreebankReader <OntoNotes Directory> <language> <output_directory>"); System.exit(-1); } String topdir = args[0]; OntonotesTreebankReader otr = new OntonotesTreebankReader(topdir, args[1]); int count = 0; while (otr.hasNext()) { TextAnnotation ta = otr.next(); String json = SerializationHelper.serializeToJson(ta); String outfile = otr.currentfile.replace(topdir, args[2]); File outputfile = new File(outfile); outputfile.getParentFile().mkdirs(); try (PrintWriter out = new PrintWriter(outputfile)) { out.print(json); } count++; if ((count % 100) == 0) System.out.println("Completed "+count+" of "+otr.filelist.size()); } System.out.println(otr.generateReport()); }
Source:
protected ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager == null) { ReactiveJwtDecoder jwtDecoder = getJwtDecoder(); ReactiveAuthenticationManager authenticationManager = new JwtReactiveAuthenticationManager(jwtDecoder); return authenticationManager; } return this.authenticationManager; }

Target:
private ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager != null) { return this.authenticationManager; } ReactiveJwtDecoder jwtDecoder = getJwtDecoder(); ReactiveAuthenticationManager authenticationManager = new JwtReactiveAuthenticationManager(jwtDecoder); return authenticationManager; }
Source:
private void format(FIXMessage message) { message.addField(BeginString); message.addField(BodyLength).setInt(74); message.addField(MsgType).setChar(OrderSingle); message.addField(SenderCompID).setString("initiator"); message.addField(TargetCompID).setString("acceptor"); message.addField(MsgSeqNum).setInt(2); message.addField(ClOrdID).setString("123"); message.addField(HandlInst).setChar(FIX42Enumerations.HandlInstValues.AutomatedExecutionNoIntervention); message.addField(Symbol).setString("FOO"); message.addField(Side).setChar(FIX42Enumerations.SideValues.Buy); message.addField(OrdType).setChar(FIX42Enumerations.OrdTypeValues.Limit); message.addField(Price).setFloat(150.25, 2); message.addField(CheckSum).setCheckSum(162); }

Target:
private void format(FIXMessage message) { message.addField(BeginString).setString("FIX.4.2"); message.addField(BodyLength).setInt(74); message.addField(MsgType).setChar(OrderSingle); message.addField(SenderCompID).setString("initiator"); message.addField(TargetCompID).setString("acceptor"); message.addField(MsgSeqNum).setInt(2); message.addField(ClOrdID).setString("123"); message.addField(HandlInst).setChar(HandlInstValues.AutomatedExecutionNoIntervention); message.addField(Symbol).setString("FOO"); message.addField(Side).setChar(SideValues.Buy); message.addField(OrdType).setChar(OrdTypeValues.Limit); message.addField(Price).setFloat(150.25, 2); message.addField(CheckSum).setCheckSum(75); }
Source:
public void abort(Throwable e) { List<Entry<?>> values; synchronized (this) { values = new ArrayList<Entry<?>>(table.values()); } for (Entry<?> v : values) { if (v.object instanceof ErrorPropagatingOutputStream) { try { ((ErrorPropagatingOutputStream)v.object).error(e); } catch (IOException x) { LOGGER.log(INFO, "Failed to propagate a channel termination error",x); } } } synchronized (this) { table.clear(); reverse.clear(); } }

Target:
void abort(Throwable e) { List<Entry<?>> values; synchronized (this) { values = new ArrayList<Entry<?>>(table.values()); } for (Entry<?> v : values) { if (v.object instanceof ErrorPropagatingOutputStream) { try { ((ErrorPropagatingOutputStream)v.object).error(e); } catch (Throwable x) { LOGGER.log(INFO, "Failed to propagate a channel termination error",x); } } } synchronized (this) { table.clear(); reverse.clear(); } }
Source:
public void start() { super.onInitialized(); liteNodeNetworkService.start(); if (walletsSetup.isDownloadComplete()) { setupWalletBestBlockListener(); } else { if (blockDownloadListener == null) { blockDownloadListener = (observable, oldValue, newValue) -> { if ((double) newValue == 1) { setupWalletBestBlockListener(); UserThread.execute(() -> walletsSetup.downloadPercentageProperty().removeListener(blockDownloadListener)); } }; walletsSetup.downloadPercentageProperty().addListener(blockDownloadListener); } } }

Target:
public void start() { super.onInitialized(); liteNodeNetworkService.start(); if (walletsSetup.isDownloadComplete()) { setupWalletBestBlockListener(); } else { walletsSetup.downloadPercentageProperty().addListener(blockDownloadListener); } }
Source:
public List<CaptureConfig> onDisableSession() { return new ArrayList<>(); }

Target:
public CaptureConfig onDisableSession() { return null; }
Source:
static public <A, B> F<A, P1<B>> lazy(final F<A, B> f) { return a -> new P1<B>(){ public B _1() { return f.f(a); } }; }

Target:
static public <A, B> F<A, P1<B>> lazy(final F<A, B> f) { return a -> P.lazy(u -> f.f(a)); }
Source:
private TreeMap<Event, List<EntryDTO>> buildEventEntryDTOMap(List<EntryDTO> entryDTOS) { return entryDTOS.stream().collect(Collectors.groupingBy(EntryDTO::getEvent, () -> new TreeMap<>(Comparator.comparing(Event::getExternalId).thenComparing(Event::getWhenOccured)), Collectors.toList())); }

Target:
private TreeMap<Event, List<EntryDTO>> buildEventEntryDTOMap(List<EntryDTO> entryDTOS) { return entryDTOS.stream().collect(Collectors.groupingBy(EntryDTO::getEvent, () -> new TreeMap<>(Comparator.comparing(Event::getWhenOccured).thenComparing(Event::getExternalId)), Collectors.toList())); }
Source:
public void test_canBeOrExtend() { assertThat(or(a, b).canBeOrExtend("a")).isTrue(); ClassSymbolImpl x1 = new ClassSymbolImpl("x1", "x1"); ClassSymbolImpl x2 = new ClassSymbolImpl("x2", "x2"); x2.addSuperClass(x1); assertThat(or(a, new RuntimeType(x2)).canBeOrExtend("x1")).isTrue(); }

Target:
public void test_canBeOrExtend() { assertThat(or(a, b).canBeOrExtend("a")).isTrue(); assertThat(or(a, b).canBeOrExtend("c")).isFalse(); ClassSymbolImpl x1 = new ClassSymbolImpl("x1", "x1"); ClassSymbolImpl x2 = new ClassSymbolImpl("x2", "x2"); x2.addSuperClass(x1); assertThat(or(a, new RuntimeType(x2)).canBeOrExtend("x1")).isTrue(); }
Source:
public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } for (int i = size; i < returnArray.length; i++) { returnArray[i] = null; } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } if (next != null) { Class<? extends @NonNull Object> elementClass = next.getClass(); if (!Objects.equals(elementClass, componentType) && !elementClass.isInstance(componentType)) { throw new ArrayStoreException("Cannot convert from (" + elementClass + " to " + newArray.getClass().getComponentType()); } } returnArray[i] = (T) next; } return returnArray; }

Target:
public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } returnArray[i] = (T) next; } return returnArray; }
Source:
public void testConvertToLambdaInFieldInitializerWithFinalFieldReference() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); StringBuilder buf= new StringBuilder(); buf.append("package test;\n"); buf.append("public class C1 {\n"); buf.append(" final String s;\n"); buf.append(" Runnable run1 = new Runnable() {\n"); buf.append(" @Override\n"); buf.append(" public void run() {\n"); buf.append(" System.out.println(s);\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" public C1() {\n"); buf.append(" s = \"abc\";\n"); buf.append(" };\n"); buf.append("}\n"); String original= buf.toString(); ICompilationUnit cu= pack1.createCompilationUnit("C1.java", original, false, null); enable(CleanUpConstants.CONVERT_FUNCTIONAL_INTERFACES); enable(CleanUpConstants.USE_LAMBDA); assertRefactoringHasNoChange(new ICompilationUnit[] { cu }); }

Target:
public void testConvertToLambdaInFieldInitializerWithFinalFieldReference() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); String buf= "" + "package test;\n" + "public class C1 {\n" + " final String s;\n" + " Runnable run1 = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(s\n" + " }\n" + " };\n" + " public C1() {\n" + " s = \"abc\";\n" + " };\n" + "}\n"; ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf, false, null); enable(CleanUpConstants.CONVERT_FUNCTIONAL_INTERFACES); enable(CleanUpConstants.USE_LAMBDA); assertRefactoringHasNoChange(new ICompilationUnit[] { cu }); }
Source:
public AuditEvent(long start, AuditEventType auditEventType, boolean isTrackingChangesEnabled, FormIndex formIndex, String oldValue) { this.start = start; this.auditEventType = auditEventType; this.isTrackingChangesEnabled = isTrackingChangesEnabled; this.formIndex = formIndex; this.oldValue = oldValue == null ? "" : oldValue; this.node = formIndex == null || formIndex.getReference() == null ? "" : formIndex.getReference().toString(); }

Target:
public AuditEvent(long start, AuditEventType auditEventType, boolean isTrackingChangesEnabled, FormIndex formIndex, String oldValue) { this.start = start; this.auditEventType = auditEventType; this.isTrackingChangesEnabled = isTrackingChangesEnabled; this.formIndex = formIndex; this.oldValue = oldValue == null ? "" : oldValue; }
Source:
public CompletionStage<Boolean> commit(LocalTransaction localTransaction, boolean isOnePhase) { if (trace) log.tracef("Committing transaction %s", localTransaction.getGlobalTransaction()); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); if (isOnePhaseCommit(localTransaction) || isOnePhase) { CompletionStage<Boolean> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain"); List<WriteCommand> modifications = localTransaction.getModifications(); PrepareCommand command = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), modifications, true); try { return CompletionStages.handleAndCompose(invoker.running().invokeAsync(ctx, command), (ignore, t) -> { if (t != null) { return handleCommitFailure(t, true, ctx); } return CompletableFutures.completedTrue(); }); } catch (Throwable e) { return handleCommitFailure(e, true, ctx); } } else if (!localTransaction.isReadOnly()) { return commitInternal(ctx); } return CompletableFutures.completedFalse(); }

Target:
public CompletionStage<Boolean> commit(LocalTransaction localTransaction, boolean isOnePhase) { if (trace) log.tracef("Committing transaction %s", localTransaction.getGlobalTransaction()); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); if (isOnePhaseCommit(localTransaction) || isOnePhase) { CompletionStage<Boolean> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain"); List<WriteCommand> modifications = localTransaction.getModifications(); PrepareCommand command = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), modifications, true); return CompletionStages.handleAndCompose(invoker.running().invokeAsync(ctx, command), (ignore, t) -> { if (t != null) { return handleCommitFailure(t, true, ctx); } return CompletableFutures.completedTrue(); }); } else if (!localTransaction.isReadOnly()) { return commitInternal(ctx); } return CompletableFutures.completedFalse(); }
Source:
public static Link getPostOpenAppEventLink(UUID userId, UUID deviceId) { try { ControllerLinkBuilder linkBuilder = linkTo( methodOn(DeviceController.class).postOpenAppEvent(Optional.empty(), userId, deviceId, null)); return linkBuilder.withRel("postOpenAppEvent"); } catch (SecurityException e) { throw YonaException.unexpected(e); } }

Target:
public static Link getPostOpenAppEventLink(UUID userId, UUID deviceId) { ControllerLinkBuilder linkBuilder = linkTo( methodOn(DeviceController.class).postOpenAppEvent(Optional.empty(), userId, deviceId, null)); return linkBuilder.withRel("postOpenAppEvent"); }
Source:
protected void prepareBuffer() { bufferToSend = PooledByteBufAllocator.DEFAULT.heapBuffer(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.writerIndex(); bufferToSend.writeBytes(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.writeInt(usermetadata.capacity()); bufferToSend.writeBytes(usermetadata); bufferToSend.writeShort((short) blobType.ordinal()); short keyLength = blobEncryptionKey == null ? 0 : (short) blobEncryptionKey.remaining(); bufferToSend.writeShort(keyLength); if (keyLength > 0) { bufferToSend.writeBytes(blobEncryptionKey); } bufferToSend.writeLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.writerIndex() - crcStart); for (ByteBuffer bb : blob.nioBuffers()) { crc.update(bb); bb.position(0); } crcByteBuf.writeLong(crc.getValue()); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(2 + blob.nioBufferCount()); compositeByteBuf.addComponent(true, bufferToSend); if (blob instanceof CompositeByteBuf) { Iterator<ByteBuf> iter = ((CompositeByteBuf) blob).iterator(); while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, blob); } compositeByteBuf.addComponent(true, crcByteBuf); blob = null; crcByteBuf = null; bufferToSend = compositeByteBuf; }

Target:
protected void prepareBuffer() { bufferToSend = PooledByteBufAllocator.DEFAULT.ioBuffer(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.writerIndex(); bufferToSend.writeBytes(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.writeInt(usermetadata.capacity()); bufferToSend.writeBytes(usermetadata); bufferToSend.writeShort((short) blobType.ordinal()); short keyLength = blobEncryptionKey == null ? 0 : (short) blobEncryptionKey.remaining(); bufferToSend.writeShort(keyLength); if (keyLength > 0) { bufferToSend.writeBytes(blobEncryptionKey); } bufferToSend.writeLong(blobSize); crc.update(bufferToSend.nioBuffer(crcStart, bufferToSend.writerIndex() - crcStart)); for (ByteBuffer bb : blob.nioBuffers()) { crc.update(bb); bb.position(0); } crcByteBuf.writeLong(crc.getValue()); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(2 + blob.nioBufferCount()); compositeByteBuf.addComponent(true, bufferToSend); if (blob instanceof CompositeByteBuf) { Iterator<ByteBuf> iter = ((CompositeByteBuf) blob).iterator(); while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, blob); } compositeByteBuf.addComponent(true, crcByteBuf); blob = null; crcByteBuf = null; bufferToSend = compositeByteBuf; }
Source:
@Override public void onGoogleSignupError(String msg) { BasicFragmentDialog dialog = new BasicFragmentDialog(); dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error), msg, getString(org.wordpress.android.login.R.string.login_error_button), null, null); dialog.show(this.getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG); }

Target:
public void onGoogleSignupError(String msg) { BasicFragmentDialog dialog = new BasicFragmentDialog(); dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error), msg, getString(org.wordpress.android.login.R.string.login_error_button), null, null); dialog.show(this.getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG); }
Source:
public void setGenerateDroolsTestOnError(Boolean generateDroolsTestOnError) { if (BooleanUtils.isTrue(generateDroolsTestOnError)) { System.setProperty(GENERATE_DROOLS_TEST_ON_ERROR_PROPERTY_NAME, "true"); } else { System.clearProperty(GENERATE_DROOLS_TEST_ON_ERROR_PROPERTY_NAME); } this.generateDroolsTestOnError = generateDroolsTestOnError; }

Target:
public void setGenerateDroolsTestOnError(Boolean generateDroolsTestOnError) { this.generateDroolsTestOnError = generateDroolsTestOnError; }
Source:
SearchResults search(final SearchRequest searchRequest) { SearchResponse searchResponse; try { searchResponse = executeSearch(searchRequest); } catch (Exception e) { LOGGER.error("Search failed", e); return SearchResults.noHits(); } if (searchResponse.getHits().getHits().length == 0) { LOGGER.debug("No results found for " + searchRequest); return SearchResults.noHits(); } SearchHit[] hits = searchResponse.getHits().getHits(); List<SearchableObject> results = new ArrayList<>(); for (SearchHit searchHit : hits) { try { String stringRepresentation = searchHit.toString(); if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.SCENARIO + "\"")) { results.add(parseScenario(searchHit)); } else if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.USECASE + "\"")) { results.add(parseUseCase(searchHit)); } else if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.STEP + "\"")) { results.add(parseStep(searchHit)); } else { LOGGER.error("No type mapping for " + stringRepresentation + " known."); } } catch (IOException e) { LOGGER.error("Could not parse entry " + searchHit.getSourceAsString(), e); } } return new SearchResults(results, hits.length, searchResponse.getHits().getTotalHits().value); }

Target:
SearchResults search(final SearchRequest searchRequest) { SearchResponse searchResponse; try { searchResponse = executeSearch(searchRequest); } catch (Exception e) { LOGGER.error("Search failed", e); return SearchResults.noHits(); } if (searchResponse.getHits().getHits().length == 0) { LOGGER.debug("No results found for " + searchRequest); return SearchResults.noHits(); } SearchHit[] hits = searchResponse.getHits().getHits(); List<SearchableObject> results = new ArrayList<>(); for (SearchHit searchHit : hits) { try { SearchableObjectType type = getType(searchHit); switch (type) { case SCENARIO: results.add(parseScenario(searchHit)); break; case USECASE: results.add(parseUseCase(searchHit)); break; case STEP: results.add(parseStep(searchHit)); break; default: LOGGER.error("No type mapping for " + type + " known."); } } catch (IOException e) { LOGGER.error("Could not parse entry " + searchHit.getSourceAsString(), e); } } return new SearchResults(results, hits.length, searchResponse.getHits().getTotalHits().value); }
Source:
public void configure(Binder binder) { if (isEnabled()) { Calcites.setSystemProperties(); binder.bind(ViewManager.class).to(NoopViewManager.class).in(LazySingleton.class); binder.install(new DruidCalciteSchemaModule()); binder.install(new DruidSqlCalcitePlannerModule()); binder.install(new AggregationModule()); SqlBindings.addOperatorConversion(binder, QueryLookupOperatorConversion.class); if (isJsonOverHttpEnabled()) { binder.install(new SqlHttpModule()); } if (isAvaticaEnabled()) { binder.install(new AvaticaModule()); } } }

Target:
public void configure(Binder binder) { if (isEnabled()) { Calcites.setSystemProperties(); binder.bind(ViewManager.class).to(NoopViewManager.class).in(LazySingleton.class); binder.install(new DruidCalciteSchemaModule()); binder.install(new CalcitePlannerModule()); binder.install(new SqlAggregationModule()); binder.install(new DruidViewModule()); SqlBindings.addOperatorConversion(binder, QueryLookupOperatorConversion.class); if (isJsonOverHttpEnabled()) { binder.install(new SqlHttpModule()); } if (isAvaticaEnabled()) { binder.install(new AvaticaModule()); } } }
Source:
public void configure() { super.configure(); HTTPConduit conduit = getHttpConduit(); TLSClientParameters tlsCP = tlsClientFactory.getTLSClientParameters(); conduit.setTlsClientParameters(tlsCP); }

Target:
public void configure() { super.configure(); getHttpConduit().setTlsClientParameters(tlsClientFactory.getTLSClientParameters()); }
Source:
public static Node createInvalidMinLength(int minLength, Node node) { if (node.getParent() == null) return new ErrorNode("Expected min length " + minLength + " for value \"" + node.toString() + "\""); Node field = node.getParent().getChildren().get(0); return new ErrorNode("Expected min length " + minLength + " for field \"" + field.toString() + "\", but got \"" + node.toString() + "\""); }

Target:
public static Node createInvalidMinLength(int minLength, Node node) { if (node.getParent() == null) return new ErrorNode("Expected min length " + minLength + " for value \"" + node.toString() + "\""); KeyValueNode parent = (KeyValueNode) node.getParent(); Node field = parent.getKey(); return new ErrorNode("Expected min length " + minLength + " for field \"" + field.toString() + "\", but got \"" + node.toString() + "\""); }
Source:
public void shouldEmphasisText() { assertThat(Markdown.convertToHtml("This is *Sparta !!!*")).isEqualTo("This is <strong>Sparta !!!</strong>"); assertThat(Markdown.convertToHtml("This is *A*")).isEqualTo("This is <strong>A</strong>"); assertThat(Markdown.convertToHtml("This should not be * \n emphasised")).isEqualTo("This should not be * <br/> emphasised"); assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <strong>very</strong> very <strong>important</strong>"); assertThat(Markdown.convertToHtml("Not * emphasised * because of whitespaces")).isEqualTo("Not * emphasised * because of whitespaces"); assertThat(Markdown.convertToHtml("Not *emphasised * because of whitespace")).isEqualTo("Not *emphasised * because of whitespace"); assertThat(Markdown.convertToHtml("Not * emphasised* because of whitespace")).isEqualTo("Not * emphasised* because of whitespace"); assertThat(Markdown.convertToHtml("emphasised*inside*word")).isEqualTo("emphasised<strong>inside</strong>word"); assertThat(Markdown.convertToHtml("*Emphasise many words*")).isEqualTo("<strong>Emphasise many words</strong>"); }

Target:
public void shouldEmphasisText() { assertThat(Markdown.convertToHtml("This is *Sparta !!!*")).isEqualTo("This is <strong>Sparta !!!</strong>"); assertThat(Markdown.convertToHtml("This is *A*")).isEqualTo("This is <strong>A</strong>"); assertThat(Markdown.convertToHtml("This should not be * \n emphasized")).isEqualTo("This should not be * <br/> emphasized"); assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <strong>very</strong> very <strong>important</strong>"); assertThat(Markdown.convertToHtml("Not * emphasized * because of whitespaces")).isEqualTo("Not * emphasized * because of whitespaces"); assertThat(Markdown.convertToHtml("Not *emphasized * because of whitespace")).isEqualTo("Not *emphasized * because of whitespace"); assertThat(Markdown.convertToHtml("Not * emphasized* because of whitespace")).isEqualTo("Not * emphasized* because of whitespace"); assertThat(Markdown.convertToHtml("emphasized*inside*word")).isEqualTo("emphasized<strong>inside</strong>word"); assertThat(Markdown.convertToHtml("*Emphasize many words*")).isEqualTo("<strong>Emphasize many words</strong>"); }
Source:
public String getText() { if ("textarea".equals(getWrappedElement().getTagName())) { return getWrappedElement().getText(); } Optional<String> enteredText = Optional.of(getWrappedElement().getAttribute("value")); return enteredText.orElse(""); }

Target:
public String getText() { if ("textarea".equals(getWrappedElement().getTagName())) { return getWrappedElement().getText(); } return Optional.of(getWrappedElement().getAttribute("value")).orElse(""); }
Source:
public void setPatientProgram(PatientProgram patientProgram) { setOwner(new PatientProgram()); }

Target:
public void setPatientProgram(PatientProgram patientProgram) { setOwner(patientProgram); }
Source:
public void testSetUser() { Configuration configuration = generateConfiguration(); configuration.setUser("24601", "m@rp.fr", "MM"); assertEquals(User.class, configuration.getUser().getClass()); assertEquals("24601", configuration.getUser().getId()); assertEquals("m@rp.fr", configuration.getUser().getEmail()); assertEquals("MM", configuration.getUser().getName()); }

Target:
public void testSetUser() { Configuration configuration = generateConfiguration(); configuration.setUser("24601", "m@rp.fr", "MM"); assertEquals("24601", configuration.getUser().getId()); assertEquals("m@rp.fr", configuration.getUser().getEmail()); assertEquals("MM", configuration.getUser().getName()); }
Source:
public void save() throws IOException { final byte[] out = Constants.encode(toText()); final LockFile lf = new LockFile(getFile()); if (!lf.lock()) throw new IOException("Cannot lock " + getFile()); try { lf.write(out); if (!lf.commit()) throw new IOException("Cannot commit write to " + getFile()); } finally { lf.unlock(); } lastModified = getFile().lastModified(); }

Target:
public void save() throws IOException { final byte[] out = Constants.encode(toText()); final LockFile lf = new LockFile(getFile()); if (!lf.lock()) throw new IOException("Cannot lock " + getFile()); try { lf.setNeedStatInformation(true); lf.write(out); if (!lf.commit()) throw new IOException("Cannot commit write to " + getFile()); } finally { lf.unlock(); } lastModified = lf.getCommitLastModified(); }
Source:
public String toString() { StringBuffer labelList = new StringBuffer(); if (labels != null) { for (Label label : labels) { if (labelList.length() != 0) { labelList.append(", "); } labelList.append(label.toString()); } } return status + "[" + labelList + "]"; }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(status); if (status == Status.RULE_ERROR && errorMessage != null) { sb.append('(').append(errorMessage).append(')'); } sb.append('['); if (labels != null) { String delimiter = ""; for (Label label : labels) { sb.append(delimiter).append(label); delimiter = ", "; } } sb.append(']'); return sb.toString(); }
Source:
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) { Fragment fragment = (Fragment)object; if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); if (mResumeOnlyCurrentFragment) { mCurTransaction = mFragmentManager.beginTransaction(); mCurTransaction.setMaxLifecycle(mCurrentPrimaryItem, Lifecycle.State.STARTED); } else { fragment.setUserVisibleHint(false); } } fragment.setMenuVisibility(true); if (mResumeOnlyCurrentFragment) { mCurTransaction.setMaxLifecycle(fragment, Lifecycle.State.RESUMED); } else { fragment.setUserVisibleHint(true); } mCurrentPrimaryItem = fragment; } }

Target:
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) { Fragment fragment = (Fragment)object; if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); if (mResumeOnlyCurrentFragment) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } mCurTransaction.setMaxLifecycle(mCurrentPrimaryItem, Lifecycle.State.STARTED); } else { fragment.setUserVisibleHint(false); } } fragment.setMenuVisibility(true); if (mCurTransaction != null && mResumeOnlyCurrentFragment) { mCurTransaction.setMaxLifecycle(fragment, Lifecycle.State.RESUMED); } else { fragment.setUserVisibleHint(true); } mCurrentPrimaryItem = fragment; } }
Source:
public static void validateFields(Iterable<String> fieldNames) throws FormattedException { Set<String> duplicates = findDuplicates(fieldNames); if (!duplicates.isEmpty()) { throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withDetails( new SubErrorHolder( FormattedException.SubErrorCode.DUPLICATE_KEY, fieldNames, duplicates ).get() ) .withMessage(String.format("Duplicate entries founds: %s", duplicates.toString())) .build(); } }

Target:
public static void validateFields(Iterable<String> fieldNames) { Set<String> duplicates = findDuplicates(fieldNames); if (!duplicates.isEmpty()) { throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withDetails( new SubErrorHolder( FormattedException.SubErrorCode.DUPLICATE_KEY, fieldNames, duplicates ).get() ) .withMessage(String.format("Duplicate entries found: %s", duplicates.toString())) .build(); } }
Source:
public void subscribeServices() { Util.runInBackground(new Runnable() { @Override public void run() { String myIpAddress = null; try { myIpAddress = Util.getIpAddress(context).getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } HttpHost host = new HttpHost(serviceDescription.getIpAddress(), serviceDescription.getPort()); List<Service> serviceList = serviceDescription.getServiceList(); if (serviceList != null) { for (int i = 0; i < serviceList.size(); i++) { String eventSubURL = serviceList.get(i).eventSubURL; if(eventSubURL == null) return; BasicHttpRequest request = new BasicHttpRequest(SUBSCRIBE, eventSubURL); request.setHeader("CALLBACK", "<http://" + myIpAddress + ":" + httpServer.getPort() + eventSubURL + ">"); request.setHeader("NT", "upnp:event"); request.setHeader("TIMEOUT", "Second-" + TIMEOUT); request.setHeader("Connection", "close"); request.setHeader("Content-length", "0"); request.setHeader("USER-AGENT", "Android UPnp/1.1 ConnectSDK"); HttpResponse response = null; try { response = httpClient.execute(host, request); int code = response.getStatusLine().getStatusCode(); if (code == 200) { SIDList.put(serviceList.get(i).serviceType, response.getFirstHeader("SID").getValue()); } response.getEntity().consumeContent(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } }); resubscribeServices(); }

Target:
public void subscribeServices() { Util.runInBackground(new Runnable() { @Override public void run() { String myIpAddress = null; try { myIpAddress = Util.getIpAddress(context).getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } HttpHost host = new HttpHost(serviceDescription.getIpAddress(), serviceDescription.getPort()); List<Service> serviceList = serviceDescription.getServiceList(); if (serviceList != null) { for (int i = 0; i < serviceList.size(); i++) { String eventSubURL = serviceList.get(i).eventSubURL; if(eventSubURL == null) continue; BasicHttpRequest request = new BasicHttpRequest(SUBSCRIBE, eventSubURL); request.setHeader("CALLBACK", "<http://" + myIpAddress + ":" + httpServer.getPort() + eventSubURL + ">"); request.setHeader("NT", "upnp:event"); request.setHeader("TIMEOUT", "Second-" + TIMEOUT); request.setHeader("Connection", "close"); request.setHeader("Content-length", "0"); request.setHeader("USER-AGENT", "Android UPnp/1.1 ConnectSDK"); HttpResponse response = null; try { response = httpClient.execute(host, request); int code = response.getStatusLine().getStatusCode(); if (code == 200) { SIDList.put(serviceList.get(i).serviceType, response.getFirstHeader("SID").getValue()); } response.getEntity().consumeContent(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } }); resubscribeServices(); }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__USER_PROFILE); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_PROFILE_ALREADY_EXISTS); }

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__USER_PROFILE); }
Source:
void endSequence() throws IllegalStateException; void startSet(); void endSet() throws IllegalStateException; void startSetOf(); void endSetOf() throws IllegalStateException; void startExplicit(int number); void startExplicit(int clazz, int number); void endExplicit() throws IllegalStateException; void encodeOctetString(String str); void encodeOctetString(byte[] str); void encodeOctetString(ByteStringBuilder str); void encodeIA5String(String str); void encodeIA5String(byte[] str); void encodeIA5String(ByteStringBuilder str); void encodePrintableString(byte[] str); void encodePrintableString(String str); void encodeBitString(byte[] str); void encodeBitString(byte[] str, int numUnusedBits); void encodeBitString(String binaryStr); default void encodeBitString(BigInteger integer) { ByteStringBuilder target = new ByteStringBuilder(); new DEREncoder(target).encode(integer); encodeBitString(target.toArray()); }

Target:
void endSequence() throws IllegalStateException; void startSet(); void endSet() throws IllegalStateException; void startSetOf(); void endSetOf() throws IllegalStateException; void startExplicit(int number); void startExplicit(int clazz, int number); void endExplicit() throws IllegalStateException; void encodeOctetString(String str); void encodeOctetString(byte[] str); void encodeOctetString(ByteStringBuilder str); void encodeIA5String(String str); void encodeIA5String(byte[] str); void encodeIA5String(ByteStringBuilder str); void encodePrintableString(byte[] str); void encodePrintableString(String str); void encodeBitString(byte[] str); void encodeBitString(byte[] str, int numUnusedBits); void encodeBitString(String binaryStr); void encodeBitString(BigInteger integer); void encodeObjectIdentifier(String objectIdentifier) throws ASN1Exception; void encodeNull(); void encodeImplicit(int number); void encodeImplicit(int clazz, int number); default void encodeInteger(int integer) { encodeInteger(BigInteger.valueOf(integer)); }
Source:
private void onAppComesFromBackground() { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { NotificationsUpdateService.startService(getContext()); NotificationsPendingDraftsService.startService(getContext()); } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }

Target:
private void onAppComesFromBackground() { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { NotificationsUpdateService.startService(getContext()); NotificationsPendingDraftsService.checkPrefsAndStartService(getContext()); } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }
Source:
public void send(OpentsdbEvent event) { events.add(event); if (events.size() >= batchSize) { sendEvents(); } }

Target:
public void send(OpentsdbEvent event) { if (!events.offer(event)) { if (countLostEvents.getAndIncrement() % 1000 == 0) { log.error( "Lost total of [%s] events because of emitter queue is full. Please increase the capacity.", countLostEvents.get() ); } } if (events.size() >= batchSize) { sendEvents(); } }
Source:
TxBuilder update(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); validateNamespace(table); operations.add(() -> { CorfuRecord<V, M> previous = table.get(key); M previousMetadata = Optional.ofNullable(previous) .map(CorfuRecord::getMetadata) .orElseGet(() -> { if (table.getMetadataOptions().isMetadataEnabled()) { return (M) table.getMetadataOptions().getDefaultMetadataInstance(); } return null; }); M newMetadata = null; if (previousMetadata != null) { validateVersion(previousMetadata, metadata); newMetadata = getNewMetadata(previousMetadata, metadata); } table.update(key, value, newMetadata); }); return this; }

Target:
TxBuilder update(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); operations.add(() -> { table.update(key, value, metadata); }); return this; }
Source:
public void verifyInstructorPrivileges(AccountAttributes account){ if(isInstructor(account.googleId)) return; throw new UnauthorizedAccessException("User "+account.googleId+" does not have instrcutor privilleges"); }

Target:
public void verifyInstructorPrivileges(AccountAttributes account){ if(account.isInstructor) { return; } throw new UnauthorizedAccessException("User "+account.googleId+" does not have instructor privilleges"); }