auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void activate() { Image mapImage = new Image("images/map_field.png"); animationTimer = new AnimationTimer() { int frames = 0; public void handle(long currentNanoTime) { gc.drawImage(mapImage, 0, 0, mapWidth, mapHeight); for (GameObject go : gameObjects.values()) { if (go != clientChar) { go.update(gc); } } if (!clientChar.isDestroyed()) { clientChar.updateWithCollision(gc, gameObjects); } if (timer.getDuration() > 250) { fpsLabel.setText("fps: " + frames * 4); scoreLabel.setText("Score: " + (int)clientChar.getScore()); if(!clientChar.isDestroyed()) { healthLabel.setText("Health: " + (int)clientChar.getHealth().getValue()); } else { healthLabel.setText("Health: DEAD"); } timer.reset(); frames = 0; } else { frames++; } } }; animationTimer.start(); updateThread = new Thread(() -> { while (mapActive) { sendUpdate(); } }); updateThread.start(); }

Target:
public void activate() { Image mapImage = new Image("images/map_field.png"); animationTimer = new AnimationTimer() { int frames = 0; public void handle(long currentNanoTime) { gc.drawImage(mapImage, 0, 0, mapWidth, mapHeight); for (GameObject go : gameObjects.values()) { if (go != clientChar) { go.update(gc); } } if (!clientChar.isDestroyed()) { clientChar.updateWithCollision(gc, gameObjects); } if (timer.getDuration() > 250) { fpsLabel.setText("fps: " + frames * 4); scoreLabel.setText("Score: " + (int)clientChar.getScore()); if (!clientChar.isDestroyed()) { healthLabel.setText("Health: " +clientChar.getHealth().getValue()); } else { healthLabel.setText("Health: DEAD"); } timer.reset(); frames = 0; } else { frames++; } } }; animationTimer.start(); updateThread = new Thread(() -> { while (mapActive) { sendUpdate(); } }); updateThread.start(); }
Source:
private static void main(InetSocketAddress address, int packets, int packetsPerSecond) throws IOException { try (final Client client = Client.connect(address)) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); System.out.println("Warming up..."); for (long sendAt = System.nanoTime(); client.receiveCount() < packets; client.receive()) { if (System.nanoTime() >= sendAt) { buffer.asLongBuffer().put(sendAt); client.send(buffer); buffer.flip(); sendAt += 1_000_000_000 / packetsPerSecond; } } client.resetMeasurements(); System.out.println("Benchmarking..."); for (long sendAt = System.nanoTime(); client.receiveCount() < packets; client.receive()) { if (System.nanoTime() >= sendAt) { buffer.asLongBuffer().put(sendAt); client.send(buffer); buffer.flip(); sendAt += 1_000_000_000 / packetsPerSecond; } } System.out.printf("Results (n = %d)\n", packets); System.out.printf("\n"); System.out.printf( " Min: %10.2f µs\n", client.getHistogram().getMinValue() / 1000.0); System.out.printf(" 50.00%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(50.00) / 1000.0); System.out.printf(" 90.00%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(90.00) / 1000.0); System.out.printf(" 99.00%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(99.00) / 1000.0); System.out.printf(" 99.90%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(99.90) / 1000.0); System.out.printf(" 99.99%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(99.99) / 1000.0); System.out.printf(" 100.00%%: %10.2f µs\n", client.getHistogram().getValueAtPercentile(100.00) / 1000.0); System.out.printf("\n"); } }

Target:
private static void main(InetSocketAddress address, int packets, int packetsPerSecond) throws IOException { try (final TestClient client = TestClient.connect(address)) { long intervalNanos = 1_000_000_000 / packetsPerSecond; ByteBuffer buffer = ByteBuffer.allocateDirect(Long.BYTES); System.out.println("Warming up..."); client.sendAndReceive(buffer, packets, intervalNanos); client.reset(); System.out.println("Benchmarking..."); client.sendAndReceive(buffer, packets, intervalNanos); System.out.printf("Results (n = %d)\n", packets); System.out.printf("\n"); System.out.printf( " Min: %10.2f µs\n", client.histogram.getMinValue() / 1000.0); System.out.printf(" 50.00%%: %10.2f µs\n", client.histogram.getValueAtPercentile(50.00) / 1000.0); System.out.printf(" 90.00%%: %10.2f µs\n", client.histogram.getValueAtPercentile(90.00) / 1000.0); System.out.printf(" 99.00%%: %10.2f µs\n", client.histogram.getValueAtPercentile(99.00) / 1000.0); System.out.printf(" 99.90%%: %10.2f µs\n", client.histogram.getValueAtPercentile(99.90) / 1000.0); System.out.printf(" 99.99%%: %10.2f µs\n", client.histogram.getValueAtPercentile(99.99) / 1000.0); System.out.printf(" 100.00%%: %10.2f µs\n", client.histogram.getValueAtPercentile(100.00) / 1000.0); System.out.printf("\n"); } }
Source:
public void addString(String string, float x, float y, Font font) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); FontData fd = font.getFontData()[0]; Font scaledFont = new Font(font.getDevice(), fd.getName(), DPIUtil.autoScaleUp(fd.getHeight()), fd.getStyle()); addStringInPixels(string, x, y, scaledFont); }

Target:
public void addString(String string, float x, float y, Font font) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); FontData fd = font.getFontData()[0]; Font scaledFont = new Font(font.getDevice(), fd.getName(), DPIUtil.autoScaleUp(fd.getHeight()), fd.getStyle()); addStringInPixels(string, x, y, scaledFont); scaledFont.dispose(); }
Source:
public Optional<UsernamePasswordCredentials> extract(WebContext context) { final Optional<TokenCredentials> credentials = this.extractor.extract(context); return credentials.map(c -> { final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ); }); }

Target:
public Optional<UsernamePasswordCredentials> extract(WebContext context) { return this.extractor.extract(context).map(c -> { final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ); }); }
Source:
public void handleMessage(Message msg) { thiz.client = msg.replyTo; if (thiz.client == null) { throw new RuntimeException("Message with an empty client."); } Step step = stepMap.get(msg.what); Throwable throwable = null; if (step != null) { try { step.run(); } catch (Throwable t) { throwable = t; } finally { if (throwable != null) { StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); step.response(throwable.getMessage() + "\n" + exceptionAsString); } else { step.response(null); } } } else { throw new RuntimeException("Cannot find corresponding step to message " + msg.what + "."); } }

Target:
public void handleMessage(Message msg) { thiz.client = msg.replyTo; if (thiz.client == null) { throw new RuntimeException("Message with an empty client."); } Step step = stepMap.get(msg.what); Throwable throwable = null; if (step != null) { try { step.run(); } catch (Throwable t) { throwable = t; } finally { if (throwable != null) { step.response(throwable.getMessage() + "\n" + Util.getStackTrace(throwable)); } else { step.response(null); } } } else { throw new RuntimeException("Cannot find corresponding step to message " + msg.what + "."); } }
Source:
public static BondMode getBondMode(String bondOptions){ if(bondOptions == null){ return null; } String bondModeValue = findMode(bondOptions); if (bondModeValue == null){ return null; } for (BondMode bondMode : BondMode.values()){ if (bondMode.getValue().equals(bondModeValue)){ return bondMode; } } return null; }

Target:
static BondMode getBondMode(String bondOptions){ if(bondOptions == null){ return null; } String bondModeValue = findMode(bondOptions); if (bondModeValue == null){ return null; } for (BondMode bondMode : BondMode.values()){ if (bondMode.getValue().equals(bondModeValue)){ return bondMode; } } return null; }
Source:
public static PlayerChatEvent createPlayerChat(Game game, Player player, CommandSource source, Text message) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("user", player); values.put("entity", player); values.put("user", player); values.put("source", source); values.put("message", message); return createEvent(PlayerChatEvent.class, values); }

Target:
public static PlayerChatEvent createPlayerChat(Game game, Player player, CommandSource source, Text message) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("entity", player); values.put("source", source); values.put("message", message); values.put("user", player); return createEvent(PlayerChatEvent.class, values); }
Source:
protected ConvertingVisitor() { super(false); }

Target:
ConvertingVisitor() { super(false); }
Source:
public void testNoHorizontalRuleTextBefore() { String text = "x '''"; String html = parseToHtml(text); assertFalse("HTML contains <hr/>", html.contains("<hr/>")); }

Target:
public void testNoHorizontalRuleTextBefore() { String text = "x '''"; String html = parseToHtml(text); assertEquals("<p>x '''</p>\n", html); }
Source:
synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } try { return cachedInstance = getConnector().getInstance(); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } try { return cachedInstance = getConnector().getInstance(); } catch (AccumuloSecurityException | AccumuloException e) { throw new IllegalStateException(e); } }
Source:
public @NonNull String getHelpText() { return "Performance counter for " + getName(); }

Target:
public @NonNull String getHelpText() { return "Counter for " + getName(); }
Source:
public static QueryResult convertPbListKeysResp(List<RiakTsPB.TsListKeysResp> responseChunks) { if (responseChunks == null) { return QueryResult.EMPTY; } int size = 0; for (RiakTsPB.TsListKeysResp resp : responseChunks) { size += resp.getKeysCount(); } final ArrayList<RiakTsPB.TsRow> pbRows = new ArrayList<RiakTsPB.TsRow>(size); for (RiakTsPB.TsListKeysResp resp : responseChunks) { pbRows.addAll(resp.getKeysList()); } return new QueryResult(pbRows); }

Target:
public static QueryResult convertPbListKeysResp(List<RiakTsPB.TsListKeysResp> responseChunks) { if (responseChunks == null) { return QueryResult.EMPTY; } int totalKeyCount = 0; for (RiakTsPB.TsListKeysResp responseChunk : responseChunks) { totalKeyCount += responseChunk.getKeysCount(); } FlatteningIterable<RiakTsPB.TsListKeysResp, RiakTsPB.TsRow> flatIterable = new FlatteningIterable<RiakTsPB.TsListKeysResp, RiakTsPB.TsRow>(responseChunks, new FlatteningIterable.InnerIterableProvider<RiakTsPB.TsListKeysResp, RiakTsPB.TsRow>() { @Override public Iterator<RiakTsPB.TsRow> getInnerIterator(RiakTsPB.TsListKeysResp provider) { return provider.getKeysList().iterator(); } }); return new QueryResult(flatIterable, totalKeyCount); }
Source:
public void dataCenterWithClusterSelectedItemChanged() { super.dataCenterWithClusterSelectedItemChanged(); if (snapshotId != null) { AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(asyncQuery( vm -> { List<Disk> snapshotDisks = vm.getStaticData() .getDiskList() .stream() .map(diskImage -> (Disk) diskImage) .collect(Collectors.toList()); InitDisksAndStorageDomains(snapshotDisks); }), snapshotId); } else { AsyncDataProvider.getInstance().getVmDiskList(asyncQuery( vmDisks -> InitDisksAndStorageDomains(vmDisks)), vm.getId(), true); } }

Target:
public void dataCenterWithClusterSelectedItemChanged() { super.dataCenterWithClusterSelectedItemChanged(); if (snapshotId != null) { AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(asyncQuery( vm -> initDisksAndStorageDomains(new ArrayList<>(vm.getDiskMap().values()))), snapshotId); } else { AsyncDataProvider.getInstance().getVmDiskList(asyncQuery( this::initDisksAndStorageDomains), vm.getId(), true); } }
Source:
public HtmlMetacardUtility(List<HtmlExportCategory> categoryList) { this(HTML_TEMPLATE); this.categoryList = categoryList; sortCategoryList(); }

Target:
public HtmlMetacardUtility(List<HtmlExportCategory> categoryList) { this(HTML_TEMPLATE); this.categoryList = categoryList; }
Source:
public List<DSpaceObject> getdSpaceObjectsFromRequest(HttpServletRequest request) throws IOException { return constructDSpaceObjectList(ContextUtil.obtainContext(request), request); }

Target:
public List<DSpaceObject> getdSpaceObjectsFromRequest(HttpServletRequest request) { return constructDSpaceObjectList(ContextUtil.obtainContext(request), request); }
Source:
public void assignOperators() throws Exception { final List<Object> dto = Lists.<Object>newArrayList(1, 2); final List<ID> ids = Lists.newArrayList(new ID(1), new ID(2)); context.checking(new Expectations() {{ oneOf(repository).assignOperators(with(matching(new ID("roamingGroupID"))), with(matching(ids))); }}); Request request = makeRequestThatContains(dto); Reply<?> reply = service.assignOperators("roamingGroupID", request); assertThat(reply, isOk()); }

Target:
public void assignOperators() throws Exception { final List<Object> dto = Lists.<Object>newArrayList(1, 2); final List<ID> ids = Lists.newArrayList(new ID(1), new ID(2)); final ID groupID = new ID("groupID"); context.checking(new Expectations() {{ oneOf(repository).assignOperators(with(matching(groupID)), with(matching(ids))); }}); Request request = makeRequestThatContains(dto); Reply<?> reply = service.assignOperators("groupID", request); assertThat(reply, isOk()); }
Source:
private FileIndex(boolean fake, final IOnResult<FileIndex> callback) { EncryptedPreferences.get( fake ? PREFERENCES_KEY_FAKE : PREFERENCES_KEY_REAL, new IOnResult<EncryptedPreferences>() { @Override public void onResult(EncryptedPreferences result) { Utils.toast("Created the EncryptedPreferences"); mPreferences = result; mIndex = result.getJson(); try { if (mIndex.has(JSON_FILES) && mIndex.has(JSON_FOLDERS)) { Utils.toast("Index exists.. let's read and parse"); mFilesArray = new JSONArrayUnsorted(mIndex.getJSONArray(JSON_FILES)); mFoldersArray = new JSONArrayUnsorted(mIndex.getJSONArray(JSON_FOLDERS)); parseJSON(); } else { Utils.toast("Index does not exist.. let's create, parse and make the root"); mFilesArray = new JSONArrayUnsorted(new JSONArray()); mFoldersArray = new JSONArrayUnsorted(new JSONArray()); mIndex.put(JSON_FILES, mFilesArray.getManagedArray()); mIndex.put(JSON_FOLDERS, mFoldersArray.getManagedArray()); parseJSON(); mRoot = new IndexedFolder(null, "root"); addFolder(mRoot); } } catch (JSONException e) { Log.e(Utils.tag(), "Oh hey, not workin something", e); } callback.onResult(FileIndex.this); } }); }

Target:
private FileIndex(boolean fake, final IOnResult<FileIndex> callback) { IOnResult<EncryptedPreferences> onResult = new IOnResult<EncryptedPreferences>() { @Override public void onResult(EncryptedPreferences result) { Utils.d("Created the EncryptedPreferences"); mPreferences = result; mIndex = result.getJson(); try { if (mIndex.has(JSON_FILES) && mIndex.has(JSON_FOLDERS)) { Utils.d("Index exists.. let's read and parse"); mFilesArray = new JSONArrayUnsorted(mIndex.getJSONArray(JSON_FILES)); mFoldersArray = new JSONArrayUnsorted(mIndex.getJSONArray(JSON_FOLDERS)); parseJSON(); } else { Utils.d("Index does not exist.. let's create, parse and make the root"); mFilesArray = new JSONArrayUnsorted(new JSONArray()); mFoldersArray = new JSONArrayUnsorted(new JSONArray()); mIndex.put(JSON_FILES, mFilesArray.getManagedArray()); mIndex.put(JSON_FOLDERS, mFoldersArray.getManagedArray()); parseJSON(); mRoot = new IndexedFolder(null, "root"); addFolder(mRoot); } } catch (JSONException e) { Log.e(Utils.tag(this), "Oh hey, not workin something", e); } callback.onResult(FileIndex.this); } }; EncryptedPreferences.get(fake ? PREFERENCES_KEY_FAKE : PREFERENCES_KEY_REAL, onResult); }
Source:
public ResponseEntity<ResourceSupport> startProcess(@PathVariable(name = "name") String scriptName) throws Exception { if (log.isTraceEnabled()) { log.trace("Starting Process for Script with name: " + scriptName); } Context context = ContextUtil.obtainContext(requestService.getCurrentRequest().getServletRequest()); ProcessRest processRest = scriptRestRepository.startProcess(context, scriptName); ProcessResource processResource = converter.toResource(processRest); context.complete(); return ControllerUtils.toResponseEntity(HttpStatus.ACCEPTED, new HttpHeaders(), processResource); }

Target:
public ResponseEntity<RepresentationModel<?>> startProcess(@PathVariable(name = "name") String scriptName) throws Exception { if (log.isTraceEnabled()) { log.trace("Starting Process for Script with name: " + scriptName); } Context context = ContextUtil.obtainContext(requestService.getCurrentRequest().getServletRequest()); ProcessRest processRest = scriptRestRepository.startProcess(context, scriptName); ProcessResource processResource = converter.toResource(processRest); context.complete(); return ControllerUtils.toResponseEntity(HttpStatus.ACCEPTED, new HttpHeaders(), processResource); }
Source:
public void success() { boolean success = false; while (!success) { RetryState rs = state.get(); success = state.compareAndSet(rs, new RetryState(rs.count + 1, true)); } }

Target:
public void success() { boolean success = false; RetryState rs; while (!success) { rs = state.get(); success = state.compareAndSet(rs, new RetryState(rs.count + 1, true)); } }
Source:
public Object adapt(Object object) { if (object instanceof CDOID) { CDOID id = (CDOID)object; if (id instanceof CDOIDExternal) { CDOIDExternal idExternal = (CDOIDExternal)id; Resource resource = notifier.eResource(); if (resource != null) { String uriString = idExternal.getURI(); URI uri = URI.createURI(uriString); object = resource.getResourceSet().getEObject(uri, false); } } else { try { InternalCDOView view = getCDOObject().cdoView(); object = view.getObject(id, true); } catch (ObjectNotFoundException ex) { object = null; } } } if (object instanceof CDOObject) { object = CDOUtil.getEObject((EObject)object); } if (feature instanceof EAttribute) { if (object == null) { object = feature.getDefaultValue(); } else { EDataType eAttributeType = ((EAttribute)feature).getEAttributeType(); String literalValue; if (eAttributeType instanceof EEnum && object instanceof Integer) { EEnumLiteral literal = ((EEnum)eAttributeType).getEEnumLiteral((Integer)object); literalValue = literal.getLiteral(); } else { literalValue = String.valueOf(object); } if (eAttributeType != null) { object = eAttributeType.getEPackage().getEFactoryInstance().createFromString(eAttributeType, literalValue); } } } return object; }

Target:
public Object adapt(Object object) { if (object instanceof CDOID) { CDOID id = (CDOID)object; if (id instanceof CDOIDExternal) { CDOIDExternal idExternal = (CDOIDExternal)id; Resource resource = notifier.eResource(); if (resource != null) { String uriString = idExternal.getURI(); URI uri = URI.createURI(uriString); object = resource.getResourceSet().getEObject(uri, false); } } else { try { InternalCDOView view = getCDOObject().cdoView(); object = view.getObject(id, true); } catch (ObjectNotFoundException ex) { object = null; } } } if (object instanceof CDOObject) { object = CDOUtil.getEObject((EObject)object); } if (feature instanceof EAttribute) { if (object == null) { object = feature.getDefaultValue(); } else { EDataType eAttributeType = ((EAttribute)feature).getEAttributeType(); if (eAttributeType != null) { String stringValue; if (eAttributeType instanceof EEnum && object instanceof Integer) { EEnumLiteral literal = ((EEnum)eAttributeType).getEEnumLiteral((Integer)object); stringValue = literal.getLiteral(); } else { stringValue = String.valueOf(object); } object = eAttributeType.getEPackage().getEFactoryInstance().createFromString(eAttributeType, stringValue); } } } return object; }
Source:
public void setResponseAddress(String defaultReplyTo) { if (defaultReplyTo.startsWith("SpEL:")) { this.responseExpression = PARSER.parseExpression(defaultReplyTo.substring(5)); } else { this.responseAddress = new Address(defaultReplyTo); } }

Target:
public void setResponseAddress(String defaultReplyTo) { if (defaultReplyTo.startsWith(PARSER_CONTEXT.getExpressionPrefix())) { this.responseExpression = PARSER.parseExpression(defaultReplyTo, PARSER_CONTEXT); } else { this.responseAddress = new Address(defaultReplyTo); } }
Source:
public BasicKeyChain toEncrypted(KeyCrypter keyCrypter, KeyParameter aesKey) { lock.lock(); try { checkNotNull(keyCrypter); checkState(this.keyCrypter == null, "Key chain is already encrypted"); BasicKeyChain encrypted = new BasicKeyChain(keyCrypter); for (ECKey key : hashToKeys.values()) { ECKey encryptedKey = key.encrypt(keyCrypter, aesKey); if (!ECKey.encryptionIsReversible(key, encryptedKey, keyCrypter, aesKey)) throw new KeyCrypterException("The key " + key.toString() + " cannot be successfully decrypted after encryption so aborting wallet encryption."); encrypted.importKeyLocked(encryptedKey); } for (ListenerRegistration<KeyChainEventListener> listener : listeners) { encrypted.listeners.add(listener); } return encrypted; } finally { lock.unlock(); } }

Target:
public BasicKeyChain toEncrypted(KeyCrypter keyCrypter, KeyParameter aesKey) { lock.lock(); try { checkNotNull(keyCrypter); checkState(this.keyCrypter == null, "Key chain is already encrypted"); BasicKeyChain encrypted = new BasicKeyChain(keyCrypter); for (ECKey key : hashToKeys.values()) { ECKey encryptedKey = key.encrypt(keyCrypter, aesKey); if (!ECKey.encryptionIsReversible(key, encryptedKey, keyCrypter, aesKey)) throw new KeyCrypterException("The key " + key.toString() + " cannot be successfully decrypted after encryption so aborting wallet encryption."); encrypted.importKeyLocked(encryptedKey); } for (ListenerRegistration<KeyChainEventListener> listener : listeners) { encrypted.addEventListener(listener); } return encrypted; } finally { lock.unlock(); } }
Source:
private void updateList() { log.error("updateList"); List<StatefulAsset> statefulAssets = assetService.getStatefulAssets(); ObservableList<StatefulAsset> nonRemovedStatefulAssets = FXCollections.observableArrayList(statefulAssets.stream() .filter(e -> !e.wasRemovedByVoting()) .collect(Collectors.toList())); assetComboBox.setItems(nonRemovedStatefulAssets); observableList.setAll(statefulAssets.stream() .map(statefulAsset -> new AssetListItem(statefulAsset, bsqFormatter)) .collect(Collectors.toList())); GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 100); }

Target:
private void updateList() { List<StatefulAsset> statefulAssets = assetService.getStatefulAssets(); ObservableList<StatefulAsset> nonRemovedStatefulAssets = FXCollections.observableArrayList(statefulAssets.stream() .filter(e -> !e.wasRemovedByVoting()) .collect(Collectors.toList())); assetComboBox.setItems(nonRemovedStatefulAssets); observableList.setAll(statefulAssets.stream() .map(statefulAsset -> new AssetListItem(statefulAsset, bsqFormatter)) .collect(Collectors.toList())); GUIUtil.setFitToRowsForTableView(tableView, 41, 28, 2, 100); }
Source:
private String getJarsFromClasspath() { StringBuilder jars = new StringBuilder(); ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader) cl).getURLs(); for (URL url : urls) { String jarName = new File(url.getFile()).getName(); if (jarName.startsWith("fluo-api-") || jarName.startsWith("fluo-accumulo-")) { if (jars.length() != 0) { jars.append(","); } jars.append(url.getFile()); } } return jars.toString(); }

Target:
private String getJarsFromClasspath() { StringBuilder jars = new StringBuilder(); ClassLoader cl = FluoAdminImpl.class.getClassLoader(); URL[] urls = ((URLClassLoader) cl).getURLs(); String regex = config.getString(FluoConfigurationImpl.ACCUMULO_JARS_REGEX_PROP, FluoConfigurationImpl.ACCUMULO_JARS_REGEX_DEFAULT); Pattern pattern = Pattern.compile(regex); for (URL url : urls) { String jarName = new File(url.getFile()).getName(); if (pattern.matcher(jarName).matches()) { if (jars.length() != 0) { jars.append(","); } jars.append(url.getFile()); } } return jars.toString(); }
Source:
protected double getSpeed(ReaderWay way) { String highwayValue = way.getTag("highway"); if (way.hasTag("motorroad", "yes")) { highwayValue = "motorroad"; } Integer speed = defaultSpeedMap.get(highwayValue); if (speed == null) throw new IllegalStateException(toString() + ", no speed found for: " + highwayValue + ", tags: " + way); if (highwayValue.equals("track")) { String tt = way.getTag("tracktype"); if (!Helper.isEmpty(tt)) { Integer tInt = trackTypeSpeedMap.get(tt); if (tInt != null) speed = tInt; } } return speed; }

Target:
protected double getSpeed(ReaderWay way) { String highwayValue = way.getTag("highway"); if (!Helper.isEmpty(highwayValue) && way.hasTag("motorroad", "yes") && highwayValue != "motorway" && highwayValue != "motorway_link") { highwayValue = "motorroad"; } Integer speed = defaultSpeedMap.get(highwayValue); if (speed == null) throw new IllegalStateException(toString() + ", no speed found for: " + highwayValue + ", tags: " + way); if (highwayValue.equals("track")) { String tt = way.getTag("tracktype"); if (!Helper.isEmpty(tt)) { Integer tInt = trackTypeSpeedMap.get(tt); if (tInt != null) speed = tInt; } } return speed; }
Source:
public void onMessageBatch(List<org.springframework.amqp.core.Message> messages, Channel channel) { Message<?> converted; if (this.converterAdapter.isAmqpMessageList()) { converted = new GenericMessage<>(messages); } else { List<Message<?>> messagingMessages = messages.stream() .map(message -> toMessagingMessage(message)) .collect(Collectors.toList()); if (this.converterAdapter.isMessageList()) { converted = new GenericMessage<>(messagingMessages); } else { converted = new GenericMessage<>(messagingMessages .stream() .map(msg -> msg.getPayload()) .collect(Collectors.toList())); } } try { invokeHandlerAndProcessResult(null, channel, converted); } catch (Exception e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }

Target:
public void onMessageBatch(List<org.springframework.amqp.core.Message> messages, Channel channel) { Message<?> converted; if (this.converterAdapter.isAmqpMessageList()) { converted = new GenericMessage<>(messages); } else { List<Message<?>> messagingMessages = new ArrayList<>(); for (org.springframework.amqp.core.Message message : messages) { messagingMessages.add(toMessagingMessage(message)); } if (this.converterAdapter.isMessageList()) { converted = new GenericMessage<>(messagingMessages); } else { List<Object> payloads = new ArrayList<>(); for (Message<?> message : messagingMessages) { payloads.add(message.getPayload()); } converted = new GenericMessage<>(payloads); } } try { invokeHandlerAndProcessResult(null, channel, converted); } catch (Exception e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }
Source:
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) { final JdbcRowDataInputFormat.Builder builder = JdbcRowDataInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)) .setAutoCommit(readOptions.getAutoCommit()); if (readOptions.getFetchSize() != 0 || this.limit >= 0) { int fetchsize = readOptions.getFetchSize(); if (fetchsize == 0) { fetchsize = limit; } else if (limit != -1) { fetchsize = Integer.min(fetchsize, limit); } builder.setFetchSize(fetchsize); } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), physicalSchema.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } builder.setQuery(query); final RowType rowType = (RowType) physicalSchema.toRowDataType().getLogicalType(); builder.setRowConverter(dialect.getRowConverter(rowType)); builder.setRowDataTypeInfo( runtimeProviderContext.createTypeInformation(physicalSchema.toRowDataType())); return InputFormatProvider.of(builder.build()); }

Target:
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) { final JdbcRowDataInputFormat.Builder builder = JdbcRowDataInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)) .setAutoCommit(readOptions.getAutoCommit()); if (readOptions.getFetchSize() != 0) { builder.setFetchSize(readOptions.getFetchSize()); } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), physicalSchema.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } if (limit >= 0) { query = String.format("%s %s", query, dialect.getLimitClause(limit)); } builder.setQuery(query); final RowType rowType = (RowType) physicalSchema.toRowDataType().getLogicalType(); builder.setRowConverter(dialect.getRowConverter(rowType)); builder.setRowDataTypeInfo( runtimeProviderContext.createTypeInformation(physicalSchema.toRowDataType())); return InputFormatProvider.of(builder.build()); }
Source:
private static boolean test_setup() { boolean setupOk = false; try { System.out.println("Here"); InetAddress localHost = InetAddress.getLocalHost(); System.out.println("Here2"); String host = localHost.getHostAddress(); System.out.println("Here3" + host); _test_service_socket = new ServerSocket(_port); _test_socket = new Socket(host, _port); _from_test_service = new BufferedReader(new InputStreamReader (_test_socket.getInputStream())); _to_test_service = new PrintWriter(new OutputStreamWriter (_test_socket.getOutputStream())); _to_test_service.write(Utility.getProcessUid().stringForm()+"\n"); _to_test_service.write(Utility.intToHexString(Utility.getpid())+"\n"); for (int i = 0; i < _number; i++) { _tx[i] = new AtomicAction(); _tx[i].begin(); AtomicAction.suspend(); _to_test_service.write(_tx[i].type()+"\n"); _to_test_service.write(_tx[i].get_uid().stringForm()+"\n"); } terminateTx(_tx[0], false); terminateTx(_tx[2], true); terminateTx(_tx[3], false); terminateTx(_tx[5], false); terminateTx(_tx[6], false); terminateTx(_tx[8], false); _to_test_service.flush(); setupOk = true; } catch (Exception ex) { System.err.println("test_setup: Failed " + ex); ex.printStackTrace(); } return setupOk; }

Target:
private static boolean test_setup() { boolean setupOk = false; try { String host = InetAddress.getLocalHost().getHostAddress(); _test_service_socket = new ServerSocket(_port); _test_socket = new Socket(host, _port); _from_test_service = new BufferedReader(new InputStreamReader (_test_socket.getInputStream())); _to_test_service = new PrintWriter(new OutputStreamWriter (_test_socket.getOutputStream())); _to_test_service.write(Utility.getProcessUid().stringForm()+"\n"); _to_test_service.write(Utility.intToHexString(Utility.getpid())+"\n"); for (int i = 0; i < _number; i++) { _tx[i] = new AtomicAction(); _tx[i].begin(); AtomicAction.suspend(); _to_test_service.write(_tx[i].type()+"\n"); _to_test_service.write(_tx[i].get_uid().stringForm()+"\n"); } terminateTx(_tx[0], false); terminateTx(_tx[2], true); terminateTx(_tx[3], false); terminateTx(_tx[5], false); terminateTx(_tx[6], false); terminateTx(_tx[8], false); _to_test_service.flush(); setupOk = true; } catch (Exception ex) { System.err.println("test_setup: Failed " + ex); ex.printStackTrace(); } return setupOk; }
Source:
public ITopic[] getSubtopics() { return subTopics.toArray(new ITopic[subTopics.size()]); }

Target:
public ITopic[] getSubtopics() { return subTopics.toArray(new ITopic[0]); }
Source:
public void testParseHandlesMultipleSheets() throws IOException, InvalidFormatException, DataParserException { InputStream file = getFile("/TestFileMultipleSheets.xlsx"); Workbook workbook = WorkbookFactory.create(file); WorkbookParserSettings settings = WorkbookParserSettings.builder() .withHeader(ExcelHeader.WITH_HEADER) .build(); WorkbookParser parser = new WorkbookParser(settings, getContext(), workbook, "Sheet1::1"); Record firstSheetFirstRow = parser.parse(); Record firstSheetSecondRow = parser.parse(); Record secondSheetFirstRow = parser.parse(); Record secondSheetSecondRow = parser.parse(); LinkedHashMap<String, Field> firstContentMap = new LinkedHashMap<>(); for (int i = 1; i <= 5; i++) { firstContentMap.put("column" + i, Field.create((double) i)); } Field expectedFirstRow = Field.createListMap(firstContentMap); LinkedHashMap<String, Field> secondContentMap = new LinkedHashMap<>(); for (int i = 1; i <= 5; i++) { secondContentMap.put("column" + i, Field.create((double) i)); } Field expectedSecondRow = Field.createListMap(secondContentMap); LinkedHashMap<String, Field> thirdContentMap = new LinkedHashMap<>(); for (int i = 1; i <= 5; i++) { thirdContentMap.put("header" + i, Field.create((double) i*10)); } Field expectedThirdRow = Field.createListMap(thirdContentMap); LinkedHashMap<String, Field> fourthContentMap = new LinkedHashMap<>(); for (int i = 1; i <= 5; i++) { fourthContentMap.put("header" + i, Field.create((double) i*10)); } Field expectedFourthRow = Field.createListMap(fourthContentMap); assertEquals(expectedFirstRow, firstSheetFirstRow.get()); assertEquals(expectedSecondRow, firstSheetSecondRow.get()); assertEquals(expectedThirdRow, secondSheetFirstRow.get()); assertEquals(expectedFourthRow, secondSheetSecondRow.get()); }

Target:
public void testParseHandlesMultipleSheets() throws IOException, InvalidFormatException, DataParserException { Workbook workbook = createWorkbook("/excel/TestMultipleSheets.xlsx"); WorkbookParser parser = new WorkbookParser(settingsWithHeader, getContext(), workbook, "Sheet1::1"); List<Pair<String, Integer>> sheetParameters = Arrays.asList( Pair.of("column", 1), Pair.of("header", 10) ); for (int sheet = 1; sheet <= sheetParameters.size(); sheet++) { for (int row = 1; row <= 2; row++) { Record parsedRow = parser.parse(); LinkedHashMap<String, Field> contentMap = new LinkedHashMap<>(); String columnPrefix = sheetParameters.get(sheet - 1).getLeft(); Integer valueMultiplier = sheetParameters.get(sheet - 1).getRight(); for (int column = 1; column <= 5; column++) { contentMap.put(columnPrefix + column, Field.create(BigDecimal.valueOf(column * valueMultiplier))); } Field expectedRow = Field.createListMap(contentMap); assertEquals(String.format("Parsed value for sheet %1d, row %2d did not match expected value", sheet, row), expectedRow, parsedRow.get()); } } }
Source:
public Collection<Binding<MessageChannel>> bindConsumer(MessageChannel inputChannel, String inputChannelName) { String channelBindingTarget = this.channelBindingServiceProperties.getBindingDestination(inputChannelName); String[] channelBindingTargets = StringUtils.commaDelimitedListToStringArray(channelBindingTarget); List<Binding<MessageChannel>> bindings = new ArrayList<>(); for (String target : channelBindingTargets) { Binder<MessageChannel> binder = getBinderForChannel(inputChannelName); Binding<MessageChannel> binding = binder.bindConsumer(target, consumerGroup(inputChannelName), inputChannel, this.channelBindingServiceProperties.getConsumerProperties(inputChannelName)); bindings.add(binding); } this.consumerBindings.put(inputChannelName, bindings); return bindings; }

Target:
public Collection<Binding<MessageChannel>> bindConsumer(MessageChannel inputChannel, String inputChannelName) { String channelBindingTarget = this.channelBindingServiceProperties.getBindingDestination(inputChannelName); String[] channelBindingTargets = StringUtils.commaDelimitedListToStringArray(channelBindingTarget); List<Binding<MessageChannel>> bindings = new ArrayList<>(); Binder<MessageChannel> binder = getBinderForChannel(inputChannelName); String consumerGroup = consumerGroup(inputChannelName); Properties consumerProperties = this.channelBindingServiceProperties.getConsumerProperties(inputChannelName); for (String target : channelBindingTargets) { Binding<MessageChannel> binding = binder.bindConsumer(target, consumerGroup, inputChannel, consumerProperties); bindings.add(binding); } this.consumerBindings.put(inputChannelName, bindings); return bindings; }
Source:
public ServerVariables getServerVariable(ObjectNode obj, String location, ParseResult result){ if(obj == null){ return null; } final ServerVariables serverVariables = new ServerVariables(); ServerVariable serverVariable = null; Set<String> variableKeys = getKeys(obj); for (String variableName : variableKeys) { JsonNode variableValue = obj.get(variableName); if (!variableValue.getNodeType().equals(JsonNodeType.OBJECT)) { result.invalidType(location, variableName, "object", variableValue); } else { serverVariable = new ServerVariable(); ObjectNode objNode = getObject(variableName, obj, false, location, result); ArrayNode an = getArray("enum",objNode,false,location,result); if (an != null) { List<String> _enum = new ArrayList<>(); for(JsonNode n : an) { if(n.isValueNode()) { _enum.add(n.asText()); serverVariable.setEnum(_enum); } else { result.invalidType(location, "enum", "value", n); } } } String value = getString("default", objNode, true, String.format("%s.%s'", location, variableName), result); serverVariable.setDefault(value); value = getString("description", objNode, false, String.format("%s.%s'", location, variableName), result); serverVariable.setDescription(value); serverVariable.setExtensions(new LinkedHashMap<>()); Set<String> keys = getKeys(objNode); for(String key : keys) { if(key.startsWith("x-")) { serverVariable.getExtensions().put(key, Json.mapper().convertValue(objNode.get(key), Object.class)); } } serverVariables.addServerVariable(variableName,serverVariable); } } return serverVariables; }

Target:
public ServerVariables getServerVariable(ObjectNode obj, String location, ParseResult result){ if(obj == null){ return null; } final ServerVariables serverVariables = new ServerVariables(); ServerVariable serverVariable = null; Set<String> variableKeys = getKeys(obj); for (String variableName : variableKeys) { JsonNode variableValue = obj.get(variableName); if (!variableValue.getNodeType().equals(JsonNodeType.OBJECT)) { result.invalidType(location, variableName, "object", variableValue); } else { serverVariable = new ServerVariable(); ObjectNode objNode = getObject(variableName, obj, false, location, result); ArrayNode arrayNode = getArray("enum",objNode,false,location,result); if (arrayNode != null) { List<String> _enum = new ArrayList<>(); for(JsonNode n : arrayNode) { if(n.isValueNode()) { _enum.add(n.asText()); serverVariable.setEnum(_enum); } else { result.invalidType(location, "enum", "value", n); } } } String value = getString("default", objNode, true, String.format("%s.%s'", location, variableName), result); if(StringUtils.isNotBlank(value)) { serverVariable.setDefault(value); } value = getString("description", objNode, false, String.format("%s.%s'", location, variableName), result); if(StringUtils.isNotBlank(value)) { serverVariable.setDescription(value); } Map <String,Object> extensions = getExtensions(objNode,location,result); if(extensions != null && extensions.size() > 0) { serverVariable.setExtensions(extensions); } serverVariables.addServerVariable(variableName,serverVariable); } } return serverVariables; }
Source:
void createSSBonds() { List<SSBond> bonds = structure.getSSBonds(); if (bonds == null) bonds = new ArrayList<SSBond>(); int internalId = 0; for (StructConn conn : structConn) { String ptnr1_chainId = conn.getPtnr1_auth_asym_id(); String ptnr1_seqId = conn.getPtnr1_auth_seq_id(); String ptnr2_chainId = conn.getPtnr2_auth_asym_id(); String ptnr2_seqId = conn.getPtnr2_auth_seq_id(); Group s1 = lookupResidue(ptnr1_chainId, ptnr1_seqId); Group s2 = lookupResidue(ptnr2_chainId, ptnr2_seqId); if (null != s1 && null != s2) { if ("CYS".equals(s1.getPDBName()) && "CYS".equals(s2.getPDBName())) { SSBondImpl bond = new SSBondImpl(); bond.setSerNum(internalId++); bond.setChainID1(ptnr1_chainId); bond.setResnum1(ptnr1_seqId); if ("?".equals(conn.getPdbx_ptnr1_PDB_ins_code())) { conn.setPdbx_ptnr1_PDB_ins_code(null); } bond.setInsCode1(conn.getPdbx_ptnr1_PDB_ins_code()); bond.setChainID2(ptnr2_chainId); bond.setResnum2(ptnr2_seqId); if ("?".equals(conn.getPdbx_ptnr2_PDB_ins_code())) { conn.setPdbx_ptnr2_PDB_ins_code(null); } bond.setInsCode2(conn.getPdbx_ptnr2_PDB_ins_code()); bonds.add(bond); } } } structure.setSSBonds(bonds); }

Target:
private void createSSBonds() { List<SSBond> bonds = structure.getSSBonds(); if (bonds == null) bonds = new ArrayList<SSBond>(); final String symop = "1_555"; int internalId = 0; for (StructConn conn : structConn) { String ptnr1_chainId = conn.getPtnr1_auth_asym_id(); String ptnr1_seqId = conn.getPtnr1_auth_seq_id(); String ptnr2_chainId = conn.getPtnr2_auth_asym_id(); String ptnr2_seqId = conn.getPtnr2_auth_seq_id(); Group s1 = lookupResidue(ptnr1_chainId, ptnr1_seqId); Group s2 = lookupResidue(ptnr2_chainId, ptnr2_seqId); if (null != s1 && null != s2) { if ("CYS".equals(s1.getPDBName()) && symop.equals(conn.getPtnr1_symmetry()) && "CYS".equals(s2.getPDBName()) && symop.equals(conn.getPtnr2_symmetry())) { SSBondImpl bond = new SSBondImpl(); bond.setSerNum(internalId++); bond.setChainID1(ptnr1_chainId); bond.setResnum1(ptnr1_seqId); if ("?".equals(conn.getPdbx_ptnr1_PDB_ins_code())) { conn.setPdbx_ptnr1_PDB_ins_code(null); } bond.setInsCode1(conn.getPdbx_ptnr1_PDB_ins_code()); bond.setChainID2(ptnr2_chainId); bond.setResnum2(ptnr2_seqId); if ("?".equals(conn.getPdbx_ptnr2_PDB_ins_code())) { conn.setPdbx_ptnr2_PDB_ins_code(null); } bond.setInsCode2(conn.getPdbx_ptnr2_PDB_ins_code()); bonds.add(bond); } } } structure.setSSBonds(bonds); }
Source:
public void update(StyleRange[] ranges) { updateStyles = true; int oldRise = rise; int oldFontHeight = fontHeight; int oldMetricsWidth = metricsWidth; rise = 0; metricsWidth = 0; fontHeight = 0; if (ranges != null) { for (int i = 0; i < ranges.length; i++) { StyleRange style = ranges[i]; if (style.isVariableHeight()) { if (style.font != null) { Integer height = getMaxFontHeight(style.font); if (height != null && height > fontHeight) { fontHeight = height; } } if (style.metrics != null) { int width = style.metrics.width; if (width > metricsWidth) { metricsWidth = width; } } if (style.rise > rise) { rise = style.rise; } } } } if (oldRise != rise || oldFontHeight != fontHeight) { height = -1; } if (oldMetricsWidth != metricsWidth) { width = -1; } }

Target:
public void update(StyleRange[] ranges) { updateStyles = true; int oldMaxRise = maxRise; int oldMaxFontHeight = maxFontHeight; int oldMaxMetricsWidth = maxMetricsWidth; maxRise = 0; maxMetricsWidth = 0; maxFontHeight = defaultFontHeight; if (ranges != null) { for (int i = 0; i < ranges.length; i++) { StyleRange style = ranges[i]; if (style.isVariableHeight()) { if (style.font != null) { Integer height = getMaxFontHeight(style.font); if (height != null && height > maxFontHeight) { maxFontHeight = height; } } if (style.metrics != null) { int width = style.metrics.width; if (width > maxMetricsWidth) { maxMetricsWidth = width; } } if (style.rise > maxRise) { maxRise = style.rise; } } } } if (oldMaxRise != maxRise || (oldMaxFontHeight != maxFontHeight)) { height = -1; } if (oldMaxMetricsWidth != maxMetricsWidth) { width = -1; } }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle args = getArguments(); final WhatsNewModel model = args.getParcelable(ARG_MODEL); binding.title.setText(escapePlatformName(model.getTitle())); binding.message.setText(escapePlatformName(model.getMessage())); @DrawableRes int imageDrawable = getResources().getIdentifier(model.getImage(), "drawable", getContext().getPackageName()); binding.image.setImageResource(imageDrawable); }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle args = getArguments(); final WhatsNewModel model = args.getParcelable(ARG_MODEL); binding.title.setText(escapePlatformName(model.getTitle())); binding.message.setText(escapePlatformName(model.getMessage())); @DrawableRes final int imageRes = UiUtil.getDrawable(getContext(), model.getImage()); binding.image.setImageResource(imageRes); final Drawable drawable = UiUtil.getDrawable(getContext(), imageRes); if (drawable != null) { if (drawable.getIntrinsicHeight() > drawable.getIntrinsicWidth()) { binding.image.setScaleType(ImageView.ScaleType.FIT_END); } else { binding.image.setScaleType(ImageView.ScaleType.FIT_CENTER); } } }
Source:
private Provider getDeletedProvider() { if (deletedProvider == null) { deletedProvider = getDbFacade().getProviderDao().get(getParameters().getProvider().getId()); } return deletedProvider; }

Target:
private Provider getDeletedProvider() { if (deletedProvider == null) { deletedProvider = getProviderDao().get(getParameters().getProvider().getId()); } return deletedProvider; }
Source:
private boolean upgradeTwentyFiveTwentySix(SQLiteDatabase db) { db.beginTransaction(); try { db.execSQL(DbUtil.addColumnToTable( INDEXED_FIXTURE_PATHS_TABLE, INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES, "TEXT")); db.setTransactionSuccessful(); return true; } finally { db.endTransaction(); } }

Target:
private boolean upgradeTwentyFiveTwentySix(SQLiteDatabase db) { db.beginTransaction(); try { db.execSQL(DbUtil.addColumnToTable( INDEXED_FIXTURE_PATHS_TABLE, INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES, "BLOB")); db.setTransactionSuccessful(); return true; } finally { db.endTransaction(); } }
Source:
private String resolveUserPropertiesFilePath() { String userPropertiesPath = System.getProperty("connectionProperties"); if (userPropertiesPath == null) { return DEFAULT_USER_PROPERTIES_PATH; } return userPropertiesPath; }

Target:
private String resolveUserPropertiesFilePath() { String userPropertiesPath = System.getProperty("iisConnectionProperties"); if (userPropertiesPath == null) { return DEFAULT_USER_PROPERTIES_PATH; } return userPropertiesPath; }
Source:
public LeaderElectionHealthReport leaderElectionRateHealthReport() { double leaderElectionRateForAllClients = getLeaderElectionRateForAllClients(); return isHealthy(leaderElectionRateForAllClients) ? LeaderElectionHealthReport.builder() .status(LeaderElectionHealthStatus.HEALTHY) .leaderElectionRate(leaderElectionRateForAllClients) .build() : LeaderElectionHealthReport.builder() .status(LeaderElectionHealthStatus.UNHEALTHY) .leaderElectionRate(leaderElectionRateForAllClients) .build(); }

Target:
public LeaderElectionHealthReport leaderElectionRateHealthReport() { double leaderElectionRateForAllClients = getLeaderElectionRateForAllClients(); LeaderElectionHealthStatus status = isHealthy(leaderElectionRateForAllClients) ? LeaderElectionHealthStatus.HEALTHY : LeaderElectionHealthStatus.UNHEALTHY; return LeaderElectionHealthReport.builder() .status(status) .leaderElectionRate(leaderElectionRateForAllClients) .build(); }