auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ByteStream hex(String s) { int len = s.length(); for (int i = 0; i < len; i += 2) { byte value = (byte)((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); stream = Stream.concat(stream, Stream.of(value)); } this.empty = false; return this; }

Target:
public ByteStream hex(String s) { int len = s.length(); for (int i = 0; i < len; i += 2) { byte value = (byte)((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); stream.add(value); } this.empty = false; return this; }
Source:
public List<Group> getGroups() { return new ArrayList<Group>(); }

Target:
public List<Group> getGroups() { return this.groups; }
Source:
protected HashMap<String, Object> buildGitEnv(String url, String username, String password, boolean mirror) { return new HashMap<String, Object>() {{ put("origin", url); put(SCHEME, GitRepository.SCHEME.toString()); put("replaceIfExists", true); put("username", username); put("password", password); put(MIRROR, mirror); }}; }

Target:
protected Map<String, Object> buildGitEnv(String url, String username, String password, boolean mirror) { return new HashMap<String, Object>() {{ put("origin", url); put(SCHEME, GitRepository.SCHEME.toString()); put("replaceIfExists", true); put("username", username); put("password", password); put(MIRROR, mirror); }}; }
Source:
public static void wipeDB(Settings settings) { DaoSession daoSession = DbConnection.getSession(); daoSession.getArticleContentDao().deleteAll(); daoSession.getArticleDao().deleteAll(); daoSession.getTagDao().deleteAll(); daoSession.getArticleTagsJoinDao().deleteAll(); daoSession.getQueueItemDao().deleteAll(); settings.setLatestUpdatedItemTimestamp(0); settings.setLatestUpdateRunTimestamp(0); settings.setFirstSyncDone(false); EventHelper.notifyEverythingRemoved(); }

Target:
public static void wipeDB(Settings settings) { DaoSession daoSession = getDaoSession(); FtsDao.deleteAllArticles(daoSession.getDatabase()); daoSession.getArticleContentDao().deleteAll(); daoSession.getArticleDao().deleteAll(); daoSession.getTagDao().deleteAll(); daoSession.getArticleTagsJoinDao().deleteAll(); daoSession.getQueueItemDao().deleteAll(); settings.setLatestUpdatedItemTimestamp(0); settings.setLatestUpdateRunTimestamp(0); settings.setFirstSyncDone(false); EventHelper.notifyEverythingRemoved(); }
Source:
protected void customPaintBackground(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { AntialiasingManager.activateAntialiasing(g2); super.customPaintBackground(g2); JTextComponent c = this.getComponent(); int dy = c.getHeight() / 2 - searchIcon.getIconHeight()/2; g2.drawImage(searchIcon.getImage(), 3, dy, null); String str = c.getText(); boolean containsLetter = false; for (int i = 0; i < str.length(); i++) { if (Character.isLetter(str.charAt(i))) { containsLetter = true; break; } } if (c.getText() != null && c.getText().length() > 0 && !containsLetter && isSMSButtonEnabled) { Rectangle smsRect = getSMSButtonRect(); int dx = smsRect.x; dy = smsRect.y; if (isSMSMousePressed) g2.drawImage(smsPressedIcon, dx, dy, null); else if (isSMSMouseOver) { g2.drawImage(smsRolloverIcon, dx, dy, null); } else g2.drawImage(smsIcon, dx, dy, null); isSMSIconVisible = true; } else isSMSIconVisible = false; if (c.getText() != null && c.getText().length() > 0 && isCallButtonEnabled) { Rectangle callRect = getCallButtonRect(); int dx = callRect.x; dy = callRect.y; if (isCallMousePressed) g2.drawImage(callPressedIcon, dx, dy, null); else if (isCallMouseOver) g2.drawImage(callRolloverIcon, dx, dy, null); else g2.drawImage(callIcon, dx, dy, null); g2.drawImage( separatorIcon, dx + callRect.width + 3, dy + (callRect.height - separatorIcon.getHeight(null))/2, null); isCallIconVisible = true; } else isCallIconVisible = false; } finally { g2.dispose(); } }

Target:
protected void customPaintBackground(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { AntialiasingManager.activateAntialiasing(g2); super.customPaintBackground(g2); JTextComponent c = this.getComponent(); int dy = c.getHeight() / 2 - searchIcon.getIconHeight()/2; g2.drawImage(searchIcon.getImage(), 3, dy, null); String str = c.getText(); if (c.getText() != null && c.getText().length() > 0 && (str != null && StringUtils.isNotEmpty(str) && !StringUtils.isAlpha(str)) && isSMSButtonEnabled) { Rectangle smsRect = getSMSButtonRect(); int dx = smsRect.x; dy = smsRect.y; if (isSMSMousePressed) g2.drawImage(smsPressedIcon, dx, dy, null); else if (isSMSMouseOver) { g2.drawImage(smsRolloverIcon, dx, dy, null); } else g2.drawImage(smsIcon, dx, dy, null); isSMSIconVisible = true; } else isSMSIconVisible = false; if (c.getText() != null && c.getText().length() > 0 && isCallButtonEnabled) { Rectangle callRect = getCallButtonRect(); int dx = callRect.x; dy = callRect.y; if (isCallMousePressed) g2.drawImage(callPressedIcon, dx, dy, null); else if (isCallMouseOver) g2.drawImage(callRolloverIcon, dx, dy, null); else g2.drawImage(callIcon, dx, dy, null); g2.drawImage( separatorIcon, dx + callRect.width + 3, dy + (callRect.height - separatorIcon.getHeight(null))/2, null); isCallIconVisible = true; } else isCallIconVisible = false; } finally { g2.dispose(); } }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); if (permanent == null) { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (controller != null && permanent != null) { new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true).apply(game, source); Cost cost = new GenericManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE)); if (!cost.pay(source, game, controller.getId(), controller.getId(), false)) { new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source); Target target = new TargetOpponent(true); target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), game); Player opponent = game.getPlayer(target.getFirstTarget()); if (opponent != null) { permanent.changeControllerId(controller.getId(), game); } } return true; } return false; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null) { new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true).apply(game, source); Cost cost = new GenericManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE)); if (!cost.pay(source, game, controller.getId(), controller.getId(), false)) { new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source); Player opponent; Set<UUID> opponents = game.getOpponents(controller.getId()); if (opponents.size() == 1) { opponent = game.getPlayer(opponents.iterator().next()); } else { Target target = new TargetOpponent(true); target.setNotTarget(true); target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), game); opponent = game.getPlayer(target.getFirstTarget()); } if (opponent != null) { permanent.changeControllerId(opponent.getId(), game); } } return true; } return false; }
Source:
public ClassGenerator(final String url, final String path) throws IOException { download(url, path + "/source.zip"); unzip(path + "/source.zip", path + "/doc-sources"); final Path sourceDir = Paths.get(path + "/doc-sources"); Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { if (attrs.isRegularFile()) { final String content = new Scanner(file.toFile()).useDelimiter("\\Z").next(); final String name = file.getName(file.getNameCount() - 2).toString(); final List<String> l; if (sections.containsKey(name)) { l = sections.get(name); } else { l = new ArrayList<>(); } l.add(content); sections.put(name, l); } return FileVisitResult.CONTINUE; } }); }

Target:
public ClassGenerator(final String url, final String path) throws IOException { download(url, path + "/source.zip"); unzip(path + "/source.zip", path + "/doc-sources"); final Path sourceDir = Paths.get(path + "/doc-sources"); Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { if (attrs.isRegularFile()) { final String content = new String(Files.readAllBytes(file), StandardCharsets.UTF_8); final String name = file.getName(file.getNameCount() - 2).toString(); final List<String> l; if (sections.containsKey(name)) { l = sections.get(name); } else { l = new ArrayList<>(); } l.add(content); sections.put(name, l); } return FileVisitResult.CONTINUE; } }); }
Source:
public void tearDown() throws Exception { if (this.fileWatcher != null) { this.fileWatcher.close(); } final Path workDir = PATH.getParent(); if (Files.exists(workDir)) { Files.deleteIfExists(PATH); Files.delete(workDir); } }

Target:
public void tearDown() throws Exception { if (this.fileWatcher != null) { this.fileWatcher.close(); } }
Source:
public void createNodePrintAcl(ZooKeeper zk, String path, String testName) { try { LOG.debug("KeyAuthenticationProvider Creating Test Node:"+path+".\n"); zk.create(path, null, Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT); List<ACL> acls = zk.getACL(path, null); LOG.debug("Node: "+path+" Test:"+testName+" ACLs:"); for (ACL acl : acls) { LOG.debug(" "+acl.toString()); } } catch (Exception e) { LOG.debug(" EXCEPTION THROWN"); } }

Target:
public void createNodePrintAcl(ZooKeeper zk, String path, String testName) { try { LOG.debug("KeyAuthenticationProvider Creating Test Node:" + path + ".\n"); zk.create(path, null, Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT); List<ACL> acls = zk.getACL(path, null); LOG.debug("Node: " + path + " Test:" + testName + " ACLs:"); for (ACL acl : acls) { LOG.debug(" " + acl.toString()); } } catch (Exception e) { LOG.debug(" EXCEPTION THROWN", e); } }
Source:
protected Serializable handleMessage(final DlmsDevice device, final Serializable requestObject) throws OsgpException, ProtocolAdapterException { final SmartMeteringDeviceDto smartMeteringDevice = (SmartMeteringDeviceDto) requestObject; this.installationService.addMeter(smartMeteringDevice); return null; }

Target:
protected Serializable handleMessage(final DlmsDevice device, final Serializable requestObject) throws OsgpException, ProtocolAdapterException { this.assertRequestObjectType(SmartMeteringDeviceDto.class, requestObject); final SmartMeteringDeviceDto smartMeteringDevice = (SmartMeteringDeviceDto) requestObject; this.installationService.addMeter(smartMeteringDevice); return null; }
Source:
protected void onInit() throws Exception { super.onInit(); if (!this.autoStartupSetExplicitly) { String[] endpointNamePatterns = getIntegrationProperty(IntegrationProperties.ENDPOINTS_NO_AUTO_STARTUP, String[].class); for (String pattern : endpointNamePatterns) { if (PatternMatchUtils.simpleMatch(pattern, getComponentName())) { this.autoStartup = false; break; } } } if (StringUtils.hasText(this.role)) { this.roleController = getBeanFactory() .getBean(IntegrationContextUtils.INTEGRATION_LIFECYCLE_ROLE_CONTROLLER, SmartLifecycleRoleController.class); this.roleController.addLifecycleToRole(this.role, this); } }

Target:
protected void onInit() throws Exception { super.onInit(); if (!this.autoStartupSetExplicitly) { String[] endpointNamePatterns = getIntegrationProperty(IntegrationProperties.ENDPOINTS_NO_AUTO_STARTUP, String[].class); for (String pattern : endpointNamePatterns) { if (PatternMatchUtils.simpleMatch(pattern, getComponentName())) { this.autoStartup = false; break; } } } if (StringUtils.hasText(this.role)) { try { this.roleController = getBeanFactory() .getBean(IntegrationContextUtils.INTEGRATION_LIFECYCLE_ROLE_CONTROLLER, SmartLifecycleRoleController.class); this.roleController.addLifecycleToRole(this.role, this); } catch (NoSuchBeanDefinitionException e) { this.logger.trace("No LifecycleRoleController in the context"); } } }
Source:
public void setTags(String tags) { this.tags = tags; if (tags != null) { this.tags = this.tags.replaceAll("<", "&lt;"); Pair<String, int[]> normalized = StringNormalizer.normalizeWithMap(this.tags); this.tagsNormalized = normalized.first; this.tagsPositionMap = normalized.second; } }

Target:
public void setTags(String tags) { this.tags = tags; if (this.tags != null) { this.tags = this.tags.replaceAll("<", "&lt;"); Pair<String, int[]> normalized = StringNormalizer.normalizeWithMap(this.tags); this.tagsNormalized = normalized.first; this.tagsPositionMap = normalized.second; } }
Source:
public void sparseTrim(@NonNull IToken token, @NonNull LogData garbageEntry) { log.info("sparse trim[{}]", token.getSequence()); garbageEntry.useToken(token); layoutHelper(e -> { List<String> servers = e.getLayout().getStripe(token.getSequence()).getLogServers(); int numUnits = servers.size(); for (int i = numUnits - 1; i >= 0; --i) { log.trace("Propagate[{}]: chain {}/{}", Token.of(e.getLayout().getEpoch(), token.getSequence()), i + 1, numUnits); String server = servers.get(i); writeGarbageToLogUnit(e, server, token, garbageEntry); } return null; }, true); }

Target:
public void sparseTrim(@NonNull IToken token, @NonNull LogData garbageEntry) { log.info("sparseTrim[{}]", token.getSequence()); garbageEntry.useToken(token); layoutHelper(e -> { List<String> servers = e.getLayout().getStripe(token.getSequence()).getLogServers(); int numUnits = servers.size(); for (int i = numUnits - 1; i >= 0; --i) { log.trace("sparseTrim ChainReplication[{}]: {}/{}", Token.of(e.getLayout().getEpoch(), token.getSequence()), i + 1, numUnits); String server = servers.get(i); writeGarbageToLogUnit(e, server, token, garbageEntry); } return null; }, true); }
Source:
private void createAutoCompleteData() { if (redisPool == null || redis_properties_key == null || redis_properties_key.equals("")) { return; } try { LOG.info("Creating auto complete data for front end"); Map<String, Map<String, Set<Object>>> typeMap = new HashMap<>(); for (Entity e : unfilteredEntities.values()) { String type = (String) e.getFilterProperties().get("type"); if (null != type) { Map<String, Set<Object>> typeData = typeMap.get(type); if (null == typeData) { typeData = new HashMap<>(); typeMap.put(type, typeData); } for (String k : e.getFilterProperties().keySet()) { Set<Object> values = typeData.get(k); if (null == values) { values = new HashSet<>(); typeData.put(k, values); } values.add(e.getFilterProperties().get(k)); } } } typeMap.remove("GLOBAL"); ObjectMapper mapper = new ObjectMapper(); String v = mapper.writeValueAsString(typeMap); Jedis jedis = redisPool.getResource(); try { jedis.set(redis_properties_key.getBytes(), Snappy.compress(v.getBytes("UTF-8"))); } finally { jedis.close(); } LOG.info("Done writing auto complete data for front end"); } catch (Exception ex) { LOG.error("Error during generating auto complete data"); } }

Target:
private void createAutoCompleteData() { if (redisPool == null || redis_properties_key == null || redis_properties_key.equals("")) { return; } try { LOG.info("Creating auto complete data for front end"); Map<String, Map<String, Set<Object>>> typeMap = new HashMap<>(); for (Entity e : unfilteredEntities.values()) { String type = (String) e.getFilterProperties().get("type"); if (null != type) { Map<String, Set<Object>> typeData = typeMap.get(type); if (null == typeData) { typeData = new HashMap<>(); typeMap.put(type, typeData); } for (String k : e.getFilterProperties().keySet()) { Set<Object> values = typeData.get(k); if (null == values) { values = new HashSet<>(); typeData.put(k, values); } values.add(e.getFilterProperties().get(k)); } } } typeMap.remove("GLOBAL"); ObjectMapper mapper = new ObjectMapper(); String v = mapper.writeValueAsString(typeMap); try (Jedis jedis = redisPool.getResource()) { jedis.set(redis_properties_key.getBytes(), Snappy.compress(v.getBytes("UTF-8"))); } LOG.info("Done writing auto complete data for front end"); } catch (Exception ex) { LOG.error("Error during generating auto complete data"); } }
Source:
public void annotationToFieldsReturnsValuesInTheMapThatAreUnmodifiable() { exception.expect(UnsupportedOperationException.class); TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); List<FrameworkField> fields = annotationToFields.get(Rule.class); fields.add(null); }

Target:
public void annotationToFieldsReturnsValuesInTheMapThatAreUnmodifiable() { TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); List<FrameworkField> fields = annotationToFields.get(Rule.class); exception.expect(UnsupportedOperationException.class); fields.add(null); }
Source:
public final int read(final String table, final String key, final Set<String> fields, final HashMap<String, ByteIterator> result) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = DOCUMENT_BUILDER.get().reset().add("_id", key); Document queryResult = null; if (fields != null) { final DocumentBuilder fieldsToReturn = BuilderFactory.start(); final Iterator<String> iter = fields.iterator(); while (iter.hasNext()) { fieldsToReturn.add(iter.next(), 1); } final Find.Builder fb = new Find.Builder(query); fb.projection(fieldsToReturn); fb.setLimit(1); fb.setBatchSize(1); fb.readPreference(readPreference); final MongoIterator<Document> ci = collection.find(fb.build()); if (ci.hasNext()) { queryResult = ci.next(); ci.close(); } } else { queryResult = collection.findOne(query); } if (queryResult != null) { fillMap(result, queryResult); } return queryResult != null ? StatusCode.OK : StatusCode.ERROR; } catch (final Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }

Target:
public final Status read(final String table, final String key, final Set<String> fields, final HashMap<String, ByteIterator> result) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = DOCUMENT_BUILDER.get().reset().add("_id", key); Document queryResult = null; if (fields != null) { final DocumentBuilder fieldsToReturn = BuilderFactory.start(); final Iterator<String> iter = fields.iterator(); while (iter.hasNext()) { fieldsToReturn.add(iter.next(), 1); } final Find.Builder fb = new Find.Builder(query); fb.projection(fieldsToReturn); fb.setLimit(1); fb.setBatchSize(1); fb.readPreference(readPreference); final MongoIterator<Document> ci = collection.find(fb.build()); if (ci.hasNext()) { queryResult = ci.next(); ci.close(); } } else { queryResult = collection.findOne(query); } if (queryResult != null) { fillMap(result, queryResult); } return queryResult != null ? Status.OK : Status.NOT_FOUND; } catch (final Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
PgPool sqlClient(int size) { PoolOptions options = new PoolOptions(); PgConnectOptions connectOptions = new PgConnectOptions(); Matcher matcher = Pattern.compile("vertx-reactive:postgresql://([-a-zA-Z]+):([0-9]+)/(.*)").matcher(url); matcher.matches(); connectOptions.setDatabase(matcher.group(3)); connectOptions.setHost(matcher.group(1)); connectOptions.setPort(Integer.parseInt(matcher.group(2))); connectOptions.setUser(user); connectOptions.setPassword(pass); connectOptions.setCachePreparedStatements(true); options.setMaxSize(size); return PgPool.pool(vertx, connectOptions, options); }

Target:
PgPool sqlClient(int size) { PoolOptions options = new PoolOptions(); PgConnectOptions connectOptions = new PgConnectOptions(); Matcher matcher = Pattern.compile(PG_URI_MATCHER).matcher(url); matcher.matches(); connectOptions.setDatabase(matcher.group(3)); connectOptions.setHost(matcher.group(1)); connectOptions.setPort(Integer.parseInt(matcher.group(2))); connectOptions.setUser(user); connectOptions.setPassword(pass); connectOptions.setCachePreparedStatements(true); options.setMaxSize(size); return PgPool.pool(vertx, connectOptions, options); }
Source:
private static String escapeName(String name) { if (JavaSyntaxUtils.isReserved(name)) { name = name + "$"; } if (!Character.isJavaIdentifierStart(name.charAt(0))) { name = "_" + name; } return name; }

Target:
private static String escapeName(String name) { if (JavaSyntaxUtils.isReserved(name)) { name = name + "$"; } else if (!Character.isJavaIdentifierStart(name.charAt(0))) { name = "_" + name; } return name; }
Source:
public String docs() { return "{type: <macro> The entity type of the entity | id <macro> The entity id of the entity | player: <macro> The player triggering the event}" + " This event is called when an entity toggles it's gliding state (Using Elytra)." + " {id: The entityID of the entity | type: The entity type of the entity |" + " gliding: true if the entity is entering gliding mode, false if the entity is leaving it |" + " player: If the entity is a player, this will contain their name, otherwise null}" + " {}" + " {}"; }

Target:
public String docs() { return "{type: <macro> The entity type of the entity | id: <macro> The entity id of the entity | player: <macro> The player triggering the event}" + " This event is called when an entity toggles it's gliding state (Using Elytra)." + " {id: The entityID of the entity | type: The entity type of the entity |" + " gliding: true if the entity is entering gliding mode, false if the entity is leaving it |" + " player: If the entity is a player, this will contain their name, otherwise null}" + " {}" + " {}"; }
Source:
protected void addPages() { try { IEditorInput editorInput = this.getEditorInput(); if (editorInput instanceof FileEditorInput) { addPage(0, new DefaultSessionEditorPage(this, session)); } } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), "Error creating nested session editor", null, e.getStatus()); } }

Target:
protected void addPages() { try { IEditorInput editorInput = this.getEditorInput(); if (editorInput instanceof FileEditorInput) { addPage(0, new DefaultSessionEditorPage(this, session)); } } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_page_loading_error_message, new Object[0]), e.getMessage(), e.getStatus()); } }
Source:
private String formatMessage(Object[] outputData) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < splitTemplateArray.length; i++) { if (i % 2 == 0) { stringBuilder.append(splitTemplateArray[i]); } else { stringBuilder.append(outputData[Integer.parseInt(splitTemplateArray[i])]); } } return stringBuilder.toString(); }

Target:
private String formatMessage(Object[] outputData) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < splitTemplateArray.length; i++) { if (i % 2 == 0) { stringBuilder.append(splitTemplateArray[i]); } else { stringBuilder.append(outputData[positionArray[i / 2]]); } } return stringBuilder.toString(); }
Source:
public void fireFilterChanged() { for (ITimeGraphViewerFilterListener listener : fViewerFilterListeners) { listener.filterChanged(); } }

Target:
private void fireFilterChanged() { for (ITimeGraphViewerFilterListener listener : fViewerFilterListeners) { listener.filterChanged(); } }
Source:
InstantiatorProvider2 getInstantiatorProvider() { if (defaultInstantiatorProvider == null) { defaultInstantiatorProvider = (new DefaultMockitoPlugins()).getDefaultPlugin(InstantiatorProvider.class); } if (instantiatorProvider.getClass() != defaultInstantiatorProvider.getClass()) { return new InstantiatorProvider2() { @Override public Instantiator getInstantiator(final MockCreationSettings<?> settings) { return new Instantiator() { @Override public <T> T newInstance(Class<T> cls) throws InstantiationException { try { return instantiatorProvider.getInstantiator(settings).newInstance(cls); } catch (org.mockito.internal.creation.instance.InstantiationException e) { throw new InstantiationException(e.getMessage(), e.getCause()); } } }; } }; } return instantiatorProvider2; }

Target:
InstantiatorProvider2 getInstantiatorProvider() { return instantiatorProvider; }
Source:
public void addItem(final ShoppingCartItem item) { ShoppingCartItem cartItem = getItemFromCart(item); ShoppingCartItem sessionItem = getItemFromSession(item); if (sessionItem != null && cartItem == null) { addItemToCart(item); } else if (cartItem == null) { addItemToCart(item); addItemToSession(item); } }

Target:
public void addItem(final ShoppingCartItem item) { ShoppingCartItem existingItemOfSameType = getItemFromCart(item); if (existingItemOfSameType != null) { existingItemOfSameType.addMore(item.getQuantity()); ShoppingCartQuantityChangeEvent.fire(this, existingItemOfSameType, existingItemOfSameType.getQuantity()); } else { items.add(item); ShoppingCartChangedEvent.fire(item, this); } shoppingCartLocalStorage.update(items); }
Source:
private String sha256(byte[] unhashedBytes) { return Hashing.sha256().hashBytes(unhashedBytes).toString(); }

Target:
private static String sha256(byte[] unhashedBytes) { return Hashing.sha256().hashBytes(unhashedBytes).toString(); }
Source:
public SQLMetadataStorageActionHandler( final SQLMetadataConnector connector, final ObjectMapper jsonMapper, final MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types, final String entryTypeName, final String entryTable, final String logTable, final String lockTable ) { this.connector = connector; this.jsonMapper = new DefaultObjectMapper((DefaultObjectMapper) jsonMapper).addMixIn(org.apache.druid.metadata.PasswordProvider.class, org.apache.druid.metadata.PasswordProviderRedactionMixIn.class); this.entryType = types.getEntryType(); this.statusType = types.getStatusType(); this.logType = types.getLogType(); this.lockType = types.getLockType(); this.entryTypeName = entryTypeName; this.entryTable = entryTable; this.logTable = logTable; this.lockTable = lockTable; this.taskInfoMapper = new TaskInfoMapper<>(jsonMapper, entryType, statusType); }

Target:
public SQLMetadataStorageActionHandler( final SQLMetadataConnector connector, final ObjectMapper jsonMapper, final MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types, final String entryTypeName, final String entryTable, final String logTable, final String lockTable ) { this.connector = connector; this.jsonMapper = jsonMapper.copy().addMixIn(org.apache.druid.metadata.PasswordProvider.class, org.apache.druid.metadata.PasswordProviderRedactionMixIn.class); this.entryType = types.getEntryType(); this.statusType = types.getStatusType(); this.logType = types.getLogType(); this.lockType = types.getLockType(); this.entryTypeName = entryTypeName; this.entryTable = entryTable; this.logTable = logTable; this.lockTable = lockTable; this.taskInfoMapper = new TaskInfoMapper<>(jsonMapper, entryType, statusType); }
Source:
public void emptySentence() { Pangram pangram = new Pangram(""); assertFalse(pangram.isPangram()); }

Target:
public void emptySentence() { assertFalse(Pangrams.isPangram("")); }
Source:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select kee from permission_templates where " + lengthFunction + "(kee) > " + VarcharColumnDef.UUID_SIZE); massUpdate.update("update permission_templates set kee=? where kee=?"); massUpdate.rowPluralName("permission templates"); massUpdate.execute((row, update) -> { String oldKey = row.getString(1); String newKey = uuidFactory.create(); update.setString(1, newKey); update.setString(2, oldKey); return true; }); }

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select kee from permission_templates where " + lengthFunction + "(kee) > ?").setInt(1, VarcharColumnDef.UUID_SIZE); massUpdate.update("update permission_templates set kee=? where kee=?"); massUpdate.rowPluralName("permission templates"); massUpdate.execute((row, update) -> { String oldKey = row.getString(1); String newKey = uuidFactory.create(); update.setString(1, newKey); update.setString(2, oldKey); return true; }); }
Source:
protected Collection<String> defaultSuppressionAnnotations() { Collection defaultValues = new ArrayList<String>(); defaultValues.addAll(super.defaultSuppressionAnnotations()); defaultValues.add("java.lang.Deprecated"); defaultValues.add("javafx.fxml.FXML"); return defaultValues; }

Target:
protected Collection<String> defaultSuppressionAnnotations() { Collection<String> defaultValues = new ArrayList<>(); defaultValues.addAll(super.defaultSuppressionAnnotations()); defaultValues.add("java.lang.Deprecated"); defaultValues.add("javafx.fxml.FXML"); return defaultValues; }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getCreateBrickCommand())) { showCreateBrickDialog(); } else if (command.getName().equals("OnCreateBrick")) { createBrick(); } else if (command.getName().equals("Cancel")) { setWindow(null); } else if (command.equals(getSyncStorageDevicesCommand())) { syncStorageDevices(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getCreateBrickCommand())) { showCreateBrickDialog(); } else if (command.getName().equals("onCreateBrick")) { createBrick(); } else if (command.getName().equals("closeWindow")) { setWindow(null); } else if (command.equals(getSyncStorageDevicesCommand())) { syncStorageDevices(); } }
Source:
public EquivalentHashMap( int initialCapacity, float loadFactor, Equivalence<K> keyEq, Equivalence<V> valueEq) { int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * DEFAULT_LOAD_FACTOR); table = new Node[capacity]; this.keyEq = keyEq; this.valueEq = valueEq; }

Target:
public EquivalentHashMap( int initialCapacity, float loadFactor, Equivalence<K> keyEq, Equivalence<V> valueEq) { int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Node[capacity]; this.keyEq = keyEq; this.valueEq = valueEq; }
Source:
public AppendTask( @JsonProperty("id") String id, @JsonProperty("dataSource") String dataSource, @JsonProperty("segments") List<DataSegment> segments, @JsonProperty("aggregations") List<AggregatorFactory> aggregators, @JsonProperty("indexSpec") IndexSpec indexSpec, @JsonProperty("context") Map<String, Object> context ) { super(id, dataSource, segments, context); this.indexSpec = indexSpec == null ? new IndexSpec() : indexSpec; this.aggregators = aggregators == null ? null : aggregators.toArray(new AggregatorFactory[aggregators.size()]); }

Target:
public AppendTask( @JsonProperty("id") String id, @JsonProperty("dataSource") String dataSource, @JsonProperty("segments") List<DataSegment> segments, @JsonProperty("aggregations") List<AggregatorFactory> aggregators, @JsonProperty("indexSpec") IndexSpec indexSpec, @JsonProperty("context") Map<String, Object> context ) { super(id, dataSource, segments, context); this.indexSpec = indexSpec == null ? new IndexSpec() : indexSpec; this.aggregators = aggregators; }
Source:
public void waitForLayoutNotification(String layoutId) { synchronized (mLock) { while (!Objects.equal(getCurrentLayoutId(), layoutId)) { LOG.info("Waiting for layout notification with ID {}, current layout ID is {}.", layoutId, mCurrentLayoutId); try { mLock.wait(); } catch (InterruptedException ie) { throw new RuntimeInterruptedException(ie); } } } }

Target:
public void waitForLayoutNotification(String layoutId) { synchronized (mLock) { while (!Objects.equal(getCurrentLayoutId(), layoutId)) { LOG.info("Waiting for layout notification with ID {}, current layout ID is {}.", layoutId, mCurrentLayoutId); try { mLock.wait(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } } }
Source:
private void setRowsCount(TableName tableName, TableStatistics tableStatistics, Table table) throws TException { Map<String, String> tableParameters = table.getParameters(); tableParameters.put("numRows", Long.toString(tableStatistics.getRowCount())); String dataSize = Long.toString(tableStatistics.getRowCount() * table.getSd().getCols().size() * 42); tableParameters.put("rawDataSize", dataSize); tableParameters.put("totalSize", dataSize); tableParameters.put("numFiles", "3"); tableParameters.put("STATS_GENERATED_VIA_STATS_TASK", "true"); client.alter_table(getSchema(tableName), tableName.getSchemalessNameInDatabase(), table); }

Target:
private void setRowsCount(TableName tableName, TableStatistics tableStatistics, Table table) throws TException { Map<String, String> tableParameters = table.getParameters(); tableParameters.put("numRows", Long.toString(tableStatistics.getRowCount())); String dataSize = Long.toString(tableStatistics.getRowCount() * table.getSd().getCols().size() * 42); tableParameters.put("rawDataSize", dataSize); tableParameters.put("totalSize", dataSize); tableParameters.put("numFiles", "1"); tableParameters.put("STATS_GENERATED_VIA_STATS_TASK", "true"); client.alter_table(getSchema(tableName), tableName.getSchemalessNameInDatabase(), table); }
Source:
public void testRequestInAreaWithNoGranulesBecomesTransparent() throws Exception { final AbstractGridFormat format = TestUtils.getFormat(rgbURL); final ImageMosaicReader reader = TestUtils.getReader(rgbURL, format); assertNotNull(reader); final ParameterValue<GridGeometry2D> ggp = AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); Envelope2D env = new Envelope2D(reader.getCoordinateReferenceSystem(), 19, 45, 1, 1); GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 50, 50), (Envelope) env); ggp.setValue(gg); final ParameterValue<Color> transparent = ImageMosaicFormat.INPUT_TRANSPARENT_COLOR.createValue(); transparent.setValue(new Color(0, 0, 0)); GridCoverage2D coverage = reader.read(new GeneralParameterValue[] {ggp, transparent}); assertNotNull(coverage); new GeoTiffWriter(TestData.temp(this, "test.tiff")).write(coverage, null); assertTrue(coverage.getEnvelope2D().contains((Rectangle2D) env)); int[] pixel = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE }; coverage.evaluate(new Point2D.Double(20, 45), pixel); assertEquals(0, pixel[0]); assertEquals(0, pixel[1]); assertEquals(0, pixel[2]); assertEquals(0, pixel[3]); }

Target:
public void testRequestInAreaWithNoGranulesBecomesTransparent() throws Exception { final AbstractGridFormat format = TestUtils.getFormat(rgbURL); final ImageMosaicReader reader = TestUtils.getReader(rgbURL, format); try { assertNotNull(reader); final ParameterValue<GridGeometry2D> ggp = AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); Envelope2D env = new Envelope2D(reader.getCoordinateReferenceSystem(), 19, 45, 1, 1); GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 50, 50), (Envelope) env); ggp.setValue(gg); final ParameterValue<Color> transparent = ImageMosaicFormat.INPUT_TRANSPARENT_COLOR.createValue(); transparent.setValue(new Color(0, 0, 0)); GridCoverage2D coverage = reader.read(new GeneralParameterValue[] {ggp, transparent}); assertNotNull(coverage); assertTrue(coverage.getEnvelope2D().contains((Rectangle2D) env)); int[] pixel = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE }; coverage.evaluate(new Point2D.Double(20, 45), pixel); assertEquals(0, pixel[0]); assertEquals(0, pixel[1]); assertEquals(0, pixel[2]); assertEquals(0, pixel[3]); } finally { reader.dispose(); } }
Source:
Get(L row, boolean findLast) { if (!findLast) assert row != null; this.row = row; this.findLast = findLast; }

Target:
Get(L row, boolean findLast) { assert findLast ^ row != null; this.row = row; this.findLast = findLast; }
Source:
public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) { return 0; } int bsIndex = 0; for (; bsIndex < len;) { final int readNow = is.read(BUFFER, 0, Math.min(len - bsIndex, BUFFER.length)); if (readNow == -1) { break; } for (int bufIndex = 0; bufIndex < readNow; bufIndex++) { byte b = BUFFER[bufIndex]; if (b == '\r') { if (bufIndex < readNow - 1) { final byte future = BUFFER[bufIndex + 1]; if (future == '\n') { continue; } } else { final int future = is.read(); is.unread(future); if (future == '\n') { continue; } } } bs[off + bsIndex++] = b; } } return bsIndex == 0 ? -1 : bsIndex; }

Target:
public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) return 0; if (cnt == -1) return -1; final int startOff = off; final int end = off + len; while (off < end) { if (ptr == cnt && !fillBuffer()) { break; } byte b = buf[ptr++]; if (b != '\r') { bs[off++] = b; continue; } if (ptr == cnt && !fillBuffer()) { bs[off++] = '\r'; break; } if (buf[ptr] == '\n') { bs[off++] = '\n'; ptr++; } else bs[off++] = '\r'; } return startOff == off ? -1 : off - startOff; }
Source:
private void switchTimelines(final Timeline activeTimeline, final Timeline nextTimeline) { LOG.info("Switching timelines from to {}", activeTimeline, nextTimeline); transactionTemplate.execute(status -> { try { timelineDbRepository.createTimeline(nextTimeline); timelineSync.startTimelineUpdate(activeTimeline.getEventType(), nakadiSettings.getTimelineWaitTimeoutMs()); nextTimeline.setSwitchedAt(new Date()); if (!activeTimeline.isFake()) { final Timeline.StoragePosition storagePosition = topicRepositoryHolder.createStoragePosition(activeTimeline); activeTimeline.setLatestPosition(storagePosition); timelineDbRepository.updateTimelime(activeTimeline); } timelineDbRepository.updateTimelime(nextTimeline); return null; } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Failed to switch timeline for:" + activeTimeline.getEventType()); } catch (final Exception ex) { LOG.error(ex.getMessage(), ex); throw new TimelineException("Failed to switch timeline for:" + activeTimeline.getEventType(), ex); } finally { finishTimelineUpdate(activeTimeline.getEventType()); } }); }

Target:
private void switchTimelines(final Timeline activeTimeline, final Timeline nextTimeline) { LOG.info("Switching timelines from to {}", activeTimeline, nextTimeline); try { timelineSync.startTimelineUpdate(activeTimeline.getEventType(), nakadiSettings.getTimelineWaitTimeoutMs()); } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Failed to switch timeline for: " + activeTimeline.getEventType()); } catch (final IllegalStateException ie) { throw new ConflictException("Timeline is already being created for: " + activeTimeline.getEventType(), ie); } try { transactionTemplate.execute(status -> { timelineDbRepository.createTimeline(nextTimeline); nextTimeline.setSwitchedAt(new Date()); if (!activeTimeline.isFake()) { final Timeline.StoragePosition storagePosition = topicRepositoryHolder.createStoragePosition(activeTimeline); activeTimeline.setLatestPosition(storagePosition); timelineDbRepository.updateTimelime(activeTimeline); } timelineDbRepository.updateTimelime(nextTimeline); return null; }); } catch (final TransactionException tx) { LOG.error(tx.getMessage(), tx); throw new TimelineException("Failed to create timeline in DB for: " + activeTimeline.getEventType(), tx); } finally { finishTimelineUpdate(activeTimeline.getEventType()); } }
Source:
public void configure() { setName(this.getClass().getSimpleName()); setDescription("Batch ETL Application"); addStream(new Stream(Constants.DEFAULT_INPUT_STREAM)); createDataset(Constants.DICTIONARY_DATASET, DictionaryDataSet.class); createDataset(Constants.ETL_META_DATASET, ETLMetaDataSet.class); Configurer configurer = new Configurer(); configure(configurer); ETLMapReduce mapReduce = new ETLMapReduce(configurer.source, configurer.transformation, configurer.sink, getDatasets()); addMapReduce(mapReduce); addWorkflow(new ETLMapReduceWorkflow(ETLMapReduce.NAME)); long intervalInMinutes = 10; String cronEntry = "0/" + intervalInMinutes + " * * * *"; scheduleWorkflow("FiveMinuteSchedule", cronEntry, ETLMapReduceWorkflow.NAME); }

Target:
public void configure() { setName(this.getClass().getSimpleName()); setDescription("Batch ETL Application"); addStream(new Stream(Constants.DEFAULT_INPUT_STREAM)); createDataset(Constants.DICTIONARY_DATASET, DictionaryDataSet.class); createDataset(Constants.ETL_META_DATASET, ETLMetaDataSet.class); Configurer configurer = new Configurer(); configure(configurer); ETLMapReduce mapReduce = new ETLMapReduce(configurer.source, configurer.transformation, configurer.sink, getDatasets()); addMapReduce(mapReduce); addWorkflow(new ETLMapReduceWorkflow(ETLMapReduce.NAME)); long intervalInMinutes = 10; String cronEntry = "0/" + intervalInMinutes + " * * * *"; scheduleWorkflow("TenMinuteSchedule", cronEntry, ETLMapReduceWorkflow.NAME); }
Source:
void nonSessionCancelScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(20); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber > 0); sender.cancelScheduledMessage(sequenceNumber); }

Target:
void nonSessionCancelScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(20); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber >= 0); sender.cancelScheduledMessage(sequenceNumber); messagesPending.incrementAndGet(); }
Source:
SynchronizationResult run(CancellationTokenSource tokenSource, IProgressMonitor monitor) { GradleMarkerManager.clear(this.gradleBuild); DefaultSynchronizationResult result; try { CorePlugin.operationManager().run(this, tokenSource, monitor); this.failures.forEach(f -> GradleErrorMarker.create(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0)); result = DefaultSynchronizationResult.from(getFailures()); } catch (CoreException e) { ToolingApiStatus status = ToolingApiStatus.from("Project synchronization" , e); if (status.severityMatches(IStatus.WARNING | IStatus.ERROR)) { GradleMarkerManager.addError(this.gradleBuild, status); } result = DefaultSynchronizationResult.from(e.getStatus()); } if (result.status.matches(IStatus.WARNING | IStatus.ERROR)) { CorePlugin.getInstance().getLog().log(result.status); } return result; }

Target:
SynchronizationResult run(CancellationTokenSource tokenSource, IProgressMonitor monitor) { GradleMarkerManager.clear(this.gradleBuild); DefaultSynchronizationResult result; try { CorePlugin.operationManager().run(this, tokenSource, monitor); for (SynchronizationProblem f : this.failures) { if (f.getSeverity() == IStatus.ERROR) { GradleErrorMarker.createError(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0); } else if (f.getSeverity() == IStatus.WARNING) { GradleErrorMarker.createWarning(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0); } } result = DefaultSynchronizationResult.from(getFailures()); } catch (CoreException e) { ToolingApiStatus status = ToolingApiStatus.from("Project synchronization" , e); if (status.severityMatches(IStatus.WARNING | IStatus.ERROR)) { GradleMarkerManager.addError(this.gradleBuild, status); } result = DefaultSynchronizationResult.from(e.getStatus()); } if (result.status.matches(IStatus.WARNING | IStatus.ERROR)) { CorePlugin.getInstance().getLog().log(result.status); } return result; }
Source:
private synchronized ListenableFuture<?> abortInternal() { Stream<ListenableFuture<?>> concat = Stream.concat( functionNamespaceTransactions.values().stream() .map(transactionMetadata -> finishingExecutor.submit(() -> safeAbort(transactionMetadata))), connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection)))); List<ListenableFuture<?>> collect = concat .collect(toList()); return nonCancellationPropagating(Futures.allAsList(collect)); }

Target:
private synchronized ListenableFuture<?> abortInternal() { return nonCancellationPropagating(Futures.allAsList(Stream.concat( functionNamespaceTransactions.values().stream() .map(transactionMetadata -> finishingExecutor.submit(() -> safeAbort(transactionMetadata))), connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection)))) .collect(toList()))); }
Source:
public Collection<ISymbolProvider> getSymbolProviders(ITmfTrace trace) { synchronized (fInstances) { Collection<ISymbolProvider> symbolProviders = new ArrayList<>(); Collection<WeakReference<ISymbolProvider>> references = fInstances.get(trace); if (!references.isEmpty()) { for (WeakReference<ISymbolProvider> reference : references) { ISymbolProvider provider = reference.get(); if (provider != null) { symbolProviders.add(provider); } } return symbolProviders; } for (SymbolProviderFactoryWrapper wrapper : fProviders) { ISymbolProviderFactory factory = wrapper.factory; ISymbolProvider provider = factory.createProvider(trace); if (provider != null) { symbolProviders.add(provider); fInstances.put(trace, new WeakReference<>(provider)); } } if (!symbolProviders.isEmpty()) { return symbolProviders; } return Collections.singleton(new DefaultSymbolProvider(trace)); } }

Target:
public Collection<ISymbolProvider> getSymbolProviders(ITmfTrace trace) { synchronized (fInstances) { Collection<ISymbolProvider> symbolProviders = new ArrayList<>(); for (WeakReference<ISymbolProvider> reference : fInstances.get(trace)) { ISymbolProvider provider = reference.get(); if (provider != null) { symbolProviders.add(provider); } } if (symbolProviders.isEmpty()) { for (SymbolProviderFactoryWrapper wrapper : fProviders) { ISymbolProviderFactory factory = wrapper.factory; ISymbolProvider provider = factory.createProvider(trace); if (provider != null) { symbolProviders.add(provider); fInstances.put(trace, new WeakReference<>(provider)); } } } return !symbolProviders.isEmpty() ? symbolProviders : Collections.singleton(new DefaultSymbolProvider(trace)); } }
Source:
protected void run(JsonNode jsonNode) { for (int i = 0; i < jsonNode.get("caches_number").asInt(); i++) { log.info("Creating cache" + i + "..."); IgniteCache<Integer, Integer> cache = ignite.createCache(jsonNode.get("cacheName").asText()); log.info("Destroying cache..."); ignite.destroyCache(jsonNode.get("cacheName").asText()); } markFinished(); }

Target:
@Override protected void run(JsonNode jsonNode) { markInitialized(); for (int i = 0; i < jsonNode.get("cacheNumber").asInt(); i++) { log.info("Creating cache " + i + "..."); ignite.createCache(jsonNode.get("cacheName").asText()); log.info("Destroying cache " + i + "..."); ignite.destroyCache(jsonNode.get("cacheName").asText()); } markFinished(); }
Source:
static String getFontSize(String inputStyle) { int theSize = 1; String theReturn; int thePointStart = inputStyle.indexOf(' '), thePointEnd = inputStyle.lastIndexOf("pt"); if (thePointStart == -1) { thePointStart = 0; } while ((inputStyle.charAt(thePointStart) == ' ') && (thePointStart < inputStyle.length())) { thePointStart++; } if (thePointStart > thePointEnd) { theReturn = MEDIUM_FONT; } else { theSize = Integer.valueOf(inputStyle.substring(thePointStart, thePointEnd)); theReturn = getFontSize(theSize, false); } return theReturn; }

Target:
private String getFontSize(String inputStyle) { int theSize = 1; String theReturn; int thePointStart = inputStyle.indexOf(' '), thePointEnd = inputStyle.lastIndexOf("pt"); if (thePointStart == -1) { thePointStart = 0; } while ((inputStyle.charAt(thePointStart) == ' ') && (thePointStart < inputStyle.length())) { thePointStart++; } if (thePointStart > thePointEnd) { theReturn = MEDIUM_FONT; } else { theSize = Integer.valueOf(inputStyle.substring(thePointStart, thePointEnd)); theReturn = getFontSize(theSize, false); } return theReturn; }