auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static PriceIndexCurveSimple fromStartOfMonth(final double[] nodeTimeKnown, final double[] indexKnown, final double[] nodeTimeOther, final double[] rate) { <END> final int nbNode = nodeTimeKnown.length + nodeTimeOther.length; final double[] nodeTime = new double[nbNode]; System.arraycopy(nodeTimeKnown, 0, nodeTime, 0, nodeTimeKnown.length); System.arraycopy(nodeTimeOther, 0, nodeTime, nodeTimeKnown.length, nodeTimeOther.length); final double[] indexValue = new double[nbNode]; System.arraycopy(indexKnown, 0, indexValue, 0, nodeTimeKnown.length); final double[] nbYear = new double[nodeTimeOther.length]; for (int loopperiod = 0; loopperiod < nodeTimeOther.length; loopperiod++) { nbYear[loopperiod] = Math.round(nodeTimeOther[loopperiod] - nodeTimeKnown[0]); indexValue[nodeTimeKnown.length + loopperiod] = indexKnown[0] * Math.pow(1 + rate[loopperiod], nbYear[loopperiod]); } final InterpolatedDoublesCurve curve = InterpolatedDoublesCurve.from(nodeTime, indexValue, new LinearInterpolator1D()); return new PriceIndexCurveSimple(curve); }</code><technical_language>ArgumentChecker arrays null</technical_language>

Target:
public static PriceIndexCurveSimple fromStartOfMonth(final double[] nodeTimeKnown, final double[] indexKnown, final double[] nodeTimeOther, final double[] rate) { ArgumentChecker.notNull(nodeTimeKnown, "node times already fixed"); ArgumentChecker.notNull(indexKnown, "index values"); ArgumentChecker.notNull(nodeTimeOther, "node times"); final int nbNode = nodeTimeKnown.length + nodeTimeOther.length; final double[] nodeTime = new double[nbNode]; System.arraycopy(nodeTimeKnown, 0, nodeTime, 0, nodeTimeKnown.length); System.arraycopy(nodeTimeOther, 0, nodeTime, nodeTimeKnown.length, nodeTimeOther.length); final double[] indexValue = new double[nbNode]; System.arraycopy(indexKnown, 0, indexValue, 0, nodeTimeKnown.length); final double[] nbYear = new double[nodeTimeOther.length]; for (int loopperiod = 0; loopperiod < nodeTimeOther.length; loopperiod++) { nbYear[loopperiod] = Math.round(nodeTimeOther[loopperiod] - nodeTimeKnown[0]); indexValue[nodeTimeKnown.length + loopperiod] = indexKnown[0] * Math.pow(1 + rate[loopperiod], nbYear[loopperiod]); } final InterpolatedDoublesCurve curve = InterpolatedDoublesCurve.from(nodeTime, indexValue, new LinearInterpolator1D()); return new PriceIndexCurveSimple(curve); }
Source:
<code>public void testRetrieveOfPreviousMultiPreparedPrimes() { MultiPrimeRequest pr = MultiPrimeRequest.request() .withWhen(when() .withQuery("select * from person where name = ?")) .withThen(then() .withVariableTypes(TEXT) .withOutcomes(outcome(match().withVariableMatchers(exactMatch().withMatcher("Chris").build()), action())) ) .build(); <START> stubFor(get(urlEqualTo(PRIME_PREPARED_MULTI_PATH)).willReturn(aResponse().withStatus(200).withBody( <END> "[{\"when\":{\"query\":\"select * from person where name \\u003d ?\"}," + "\"then\":{\"variable_types\":[\"text\"],\"outcomes\":[{\"criteria\":" + "{\"variable_matcher\":[{\"matcher\":\"Chris\",\"type\":\"exact\"}]},\"action\":{}}]}}]" ))); List<MultiPrimeRequest> primingRequests = underTest.retrievePreparedMultiPrimes(); assertEquals(1, primingRequests.size()); assertEquals(pr, primingRequests.get(0)); }</code><technical_language>test some other variable types</technical_language>

Target:
public void testRetrieveOfPreviousMultiPreparedPrimes() { MultiPrimeRequest pr = MultiPrimeRequest.request() .withWhen(when() .withQuery("select * from person where name = ?")) .withThen(then() .withVariableTypes(TEXT, TIMESTAMP, TIMEUUID) .withOutcomes(outcome(match().withVariableMatchers(exactMatch().withMatcher("Chris").build(), anyMatch()), action())) ) .build(); stubFor(get(urlEqualTo(PRIME_PREPARED_MULTI_PATH)).willReturn(aResponse().withStatus(200).withBody( "[{\"when\":{\"query\":\"select * from person where name \\u003d ?\"}," + "\"then\":{\"variable_types\":[\"text\", \"timestamp\", \"timeuuid\"],\"outcomes\":[{\"criteria\":" + "{\"variable_matcher\":[{\"matcher\":\"Chris\",\"type\":\"exact\"}, {\"type\":\"any\"}]},\"action\":{}}]}}]" ))); List<MultiPrimeRequest> primingRequests = underTest.retrievePreparedMultiPrimes(); assertEquals(1, primingRequests.size()); assertEquals(pr, primingRequests.get(0)); }
Source:
<code>public void applyWayTags( OSMWay way, EdgeIteratorState edge ) { double speed = this.getSpeed(edge.getFlags()); double roadDistance = edge.getDistance(); double beelineDistance = getBeelineDistance(edge); <START> PointList pointList = edge.fetchWayGeometry(3); <END> if (beelineDistance < 50 || roadDistance < 100 || pointList.size() <= 2) { setBendiness(edge, 1); return; } double bendiness = beelineDistance / roadDistance; bendiness = discriminateSlowStreets(bendiness, speed); bendiness = preferSlopes(bendiness, edge); bendiness = increaseBendinessImpact(bendiness); bendiness = influenceBendinessByTags(bendiness, way); bendiness = correctErrors(bendiness); setBendiness(edge, bendiness); }</code><technical_language>I reduce number of calling relative expensive fetchWayGeometry. E.g. pass pointList getBeelineDistance preferSlopes methods</technical_language>

Target:
public void applyWayTags( OSMWay way, EdgeIteratorState edge ) { double speed = this.getSpeed(edge.getFlags()); double roadDistance = edge.getDistance(); double beelineDistance = getBeelineDistance(way); double bendiness = beelineDistance / roadDistance; bendiness = discriminateSlowStreets(bendiness, speed); bendiness = increaseBendinessImpact(bendiness); bendiness = correctErrors(bendiness); edge.setFlags(this.curvatureEncoder.setValue(edge.getFlags(), convertToInt(bendiness))); }
Source:
<code>public String get() { if (SystemInfo.isWindows()) { if (volumeOptions == null) { <START> volumeOptions="ro,Z"; <END> } try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path path = Files.copy(Paths.get(wsAgentArchivePath), cheHome.resolve(WS_AGENT), REPLACE_EXISTING); return path.toString() + CONTAINER_TARGET + ":" + volumeOptions; } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return wsAgentArchivePath + CONTAINER_TARGET + ":" + volumeOptions; } }</code><technical_language>constants default properties</technical_language>

Target:
public String get() { if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path path = Files.copy(Paths.get(wsAgentArchivePath), cheHome.resolve(WS_AGENT), REPLACE_EXISTING); return getTargetOptions(path.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(wsAgentArchivePath); } }
Source:
<code>private String getDescription(long masterKeyId) { CachedPublicKeyRing cachedPublicKeyRing = mKeyRepository.getCachedPublicKeyRing(masterKeyId); String description = ""; long authSubKeyId = Constants.key.none; try { authSubKeyId = cachedPublicKeyRing.getSecretAuthenticationId(); description += cachedPublicKeyRing.getPrimaryUserId(); } catch (PgpKeyNotFoundException e) { <START> e.printStackTrace(); <END> } description += " ("+ Long.toHexString(authSubKeyId) +")"; return description; }</code><technical_language>Log.e throw a AssertionError if this happen</technical_language>

Target:
private String getDescription(long masterKeyId) throws PgpKeyNotFoundException { CachedPublicKeyRing cachedPublicKeyRing = mKeyRepository.getCachedPublicKeyRing(masterKeyId); String description = ""; long authSubKeyId = cachedPublicKeyRing.getSecretAuthenticationId(); description += cachedPublicKeyRing.getPrimaryUserId(); description += " (" + Long.toHexString(authSubKeyId) + ")"; return description; }
Source:
<code>OrderedJsonObject toJson() { OrderedJsonObject debugState = new OrderedJsonObject(); debugState.put("packets_received", packetsReceived); debugState.put("receive_packet_rate_pps", receivePacketRate.getRate()); debugState.put("bytes_received", bytesReceived); debugState.put("receive_bitrate_bps", receiveBitRate.getRate()); debugState.put("incoming_packets_dropped", incomingPacketsDropped); debugState.put("packets_sent", packetsSent.sum()); debugState.put("send_packet_rate_pps", sendPacketRate.getRate()); <START> debugState.put("bytes_sent", bytesSent); <END> debugState.put("send_bitrate_bps", sendBitRate.getRate()); return debugState; }</code><technical_language>bytesSent.sum()</technical_language>

Target:
OrderedJsonObject toJson() { OrderedJsonObject debugState = new OrderedJsonObject(); debugState.put("packets_received", packetsReceived); debugState.put("receive_packet_rate_pps", receivePacketRate.getRate()); debugState.put("bytes_received", bytesReceived); debugState.put("receive_bitrate_bps", receiveBitRate.getRate()); debugState.put("incoming_packets_dropped", incomingPacketsDropped); debugState.put("packets_sent", packetsSent.sum()); debugState.put("send_packet_rate_pps", sendPacketRate.getRate()); debugState.put("bytes_sent", bytesSent.sum()); debugState.put("send_bitrate_bps", sendBitRate.getRate()); return debugState; }
Source:
<code>private void interpretBsh(final ReilInstruction instruction) { final Pair<Boolean, BigInteger> firstValue = loadLongValue(instruction.getFirstOperand()); final Pair<Boolean, BigInteger> secondValue = loadLongValue(instruction.getSecondOperand()); if (firstValue.first() && secondValue.first()) { final boolean isMsbSet = <START> !(secondValue.second().and(BigInteger.valueOf(1 ).shiftLeft(instruction.getSecondOperand().getSize() <END> .getBitSize()-1)).equals(BigInteger.ZERO)); BigInteger result = BigInteger.ZERO; if (secondValue.second().compareTo(BigInteger.ZERO) < 0) { result = firstValue.second().shiftRight(secondValue.second().negate().intValue()); } else if (isMsbSet) { result = firstValue.second().shiftRight( BigInteger.ZERO.subtract(secondValue.second()).and(BigInteger.valueOf(0xFF)) .intValue()); } else { result = firstValue.second().shiftLeft(secondValue.second().intValue()); } final String targetRegister = instruction.getThirdOperand().getValue(); final OperandSize targetSize = instruction.getThirdOperand().getSize(); setRegister(targetRegister, result, targetSize, ReilRegisterStatus.DEFINED); } else { assert false; } }</code><technical_language>NitPick: extra space</technical_language>

Target:
private void interpretBsh(final ReilInstruction instruction) { final Pair<Boolean, BigInteger> firstValue = loadLongValue(instruction.getFirstOperand()); final Pair<Boolean, BigInteger> secondValue = loadLongValue(instruction.getSecondOperand()); if (firstValue.first() && secondValue.first()) { final boolean isMsbSet = !(secondValue.second() .and(BigInteger.ONE .shiftLeft(instruction.getSecondOperand().getSize().getBitSize() - 1)) .equals(BigInteger.ZERO)); BigInteger result = BigInteger.ZERO; if (secondValue.second().compareTo(BigInteger.ZERO) < 0) { result = firstValue.second().shiftRight(secondValue.second().negate().intValue()); } else if (isMsbSet) { result = firstValue.second().shiftRight(BigInteger.ZERO.subtract(secondValue.second()) .and(BigInteger.valueOf(0xFF)).intValue()); } else { result = firstValue.second().shiftLeft(secondValue.second().intValue()); } final String targetRegister = instruction.getThirdOperand().getValue(); final OperandSize targetSize = instruction.getThirdOperand().getSize(); setRegister(targetRegister, result, targetSize, ReilRegisterStatus.DEFINED); } else { assert false; } }
Source:
<code>private List<FileRef> convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { List<FileRef> fileRefs = new ArrayList<>(); if (response.value().segment() != null) { response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); } <START> fileRefs.sort(Comparator.comparing(FileRef::name)); <END> return fileRefs; }</code><technical_language>adding this sort? This is a segment of a paged response, point of spending cycles sorting 1000 file subset of a larger list</technical_language>

Target:
private List<FileRef> convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { Set<FileRef> fileRefs = new TreeSet<>(Comparator.comparing(FileRef::name)); if (response.value().segment() != null) { response.value().segment().directoryItems() .forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); response.value().segment().fileItems() .forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); } return new ArrayList<>(fileRefs); }
Source:
<code>public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (login == null) { throw new HttpMessageNotReadableException("Missing login"); } <START> if (userIs2fa()) <END> { throw new BadCredentialsException( "two factor authentication is enabled, you cannot use /login via the RESTAPI anymore"); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new BadCredentialsException("Unknown username or password"); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "Rest api login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }</code><technical_language>userIs2fa --> isUser2fa</technical_language>

Target:
public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (login == null) { throw new HttpMessageNotReadableException("Missing login"); } if (isUser2fa()) { throw new BadCredentialsException( "Login using /api/v1/login is disabled, two factor authentication is enabled"); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new BadCredentialsException("Unknown username or password"); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "REST API login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }
Source:
<code>public AsyncFileAlterationObserver(File fileToObserve, ObjectPersistentStore serializer) { if (fileToObserve == null || serializer == null) { throw new IllegalArgumentException("Arguments can not be null"); } this.serializer = serializer; rootFile = new AsyncFileEntry(fileToObserve); if (LOGGER.isDebugEnabled()) { timer = new Timer(); <START> timer.scheduleAtFixedRate(new LogProcessing(), 500, 5000); <END> } }</code><technical_language>numbers constants</technical_language>

Target:
public AsyncFileAlterationObserver(File fileToObserve, ObjectPersistentStore serializer) { if (fileToObserve == null || serializer == null) { throw new IllegalArgumentException("Arguments can not be null"); } this.serializer = serializer; rootFile = new AsyncFileEntry(fileToObserve); }
Source:
<code>public boolean exists(K key) throws GoraException { <START> LOG.debug("exists("+key+")"); <END> try { return infinispanClient.containsKey(key); } catch (Exception e) { throw new GoraException(e); } }</code><technical_language>Please parameterized logging in cases, avoid String concatenation</technical_language>

Target:
public boolean exists(K key) throws GoraException { LOG.debug("exists({})", key); try { return infinispanClient.containsKey(key); } catch (Exception e) { throw new GoraException(e); } }
Source:
<code>public String getValidityInfoForSizeCappedAlphanumericNonEmptyString(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for "+fieldName, value != null); if (value.isEmpty()) { return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, fieldName, maxLength); } else if(value.length()>maxLength){ <START> return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_TOO_LONG, fieldName, maxLength); <END> } else if (StringHelper.isMatching(value, "^.*[^a-zA-Z0-9 ].*$")){ return String.format(ALPHANUMERIC_STRING_ERROR_MESSAGE, value, fieldName, fieldName); } return ""; }</code><technical_language>I relax validation checks trimmed in place</technical_language>

Target:
public String getValidityInfoForSizeCappedAlphanumericNonEmptyString(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for "+fieldName, value != null); if (value.isEmpty()) { return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, fieldName, maxLength); } else if (!isTrimmed(value)) { return String.format(WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE, fieldName); } else if(value.length()>maxLength){ return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_TOO_LONG, fieldName, maxLength); } else if (StringHelper.isMatching(value, "^.*[^a-zA-Z0-9 ].*$")){ return String.format(ALPHANUMERIC_STRING_ERROR_MESSAGE, value, fieldName, fieldName); } return ""; }
Source:
<code>public static boolean mktextfile(String data, String path, String fileName) { File f = new File(path + "/" + fileName + ".txt"); FileOutputStream out = null; OutputStreamWriter outputWriter = null; if (f.exists()) { f.delete(); } try { f.createNewFile(); <START> out = new FileOutputStream(f); <END> outputWriter = new OutputStreamWriter(out); outputWriter.write(data); return true; } catch (IOException io) { Log.e(FileUtil.LOG, io.getMessage()); return false; } finally { try { outputWriter.close(); out.flush(); out.close(); } catch (IOException e) { Log.e(FileUtil.LOG, e.getMessage()); } } }</code><technical_language>Pass a argument false FileOutputStream constructor, overwrite instead of appending. need delete file first</technical_language>

Target:
public static boolean mktextfile(String data, String path, String fileName) { File f = new File(path + "/" + fileName + ".txt"); FileOutputStream out = null; OutputStreamWriter outputWriter = null; try { f.createNewFile(); out = new FileOutputStream(f, false); outputWriter = new OutputStreamWriter(out); outputWriter.write(data); return true; } catch (IOException io) { Log.e(FileUtil.LOG, io.getMessage()); return false; } finally { try { outputWriter.close(); out.flush(); out.close(); } catch (IOException e) { Log.e(FileUtil.LOG, e.getMessage()); } } }
Source:
<code>private PreparedStatement insertSessionStatement(Session session) throws SQLException { <START> PreparedStatement insertStatement = connection.prepareStatement("insert into " + tableName + " values(?,?)"); <END> insertStatement.setString(1, sessionUri(session.getId()) + separator + session.getUri().toString()); insertStatement.setString(2, JSON.toJson(session.getCapabilities())); return insertStatement; }</code><technical_language>do tableName is not, itself, SQL injection attack</technical_language>

Target:
private PreparedStatement insertSessionStatement(Session session) throws SQLException { PreparedStatement insertStatement = connection.prepareStatement(String.format("insert into %1$s (%2$s, %3$s, %4$s) values (?, ?, ?)", TABLE_NAME, SESSION_ID_COL, SESSION_URI_COL, SESSION_CAPS_COL)); insertStatement.setString(1, session.getId().toString()); insertStatement.setString(2, session.getUri().toString()); insertStatement.setString(3, JSON.toJson(session.getCapabilities())); return insertStatement; }
Source:
<code>public int getWidth() { <START> return recipeWidth; <END> }</code><technical_language>this</technical_language>

Target:
public int getWidth() { return this.recipeWidth; }
Source:
<code><START> private boolean isSamePrefix(String a, String b) { <END> int as = a.lastIndexOf('/'); int bs = b.lastIndexOf('/'); return a.substring(0, as + 1).equals(b.substring(0, bs + 1)); }</code><technical_language>Style-nit: This method static</technical_language>

Target:
private static boolean isSamePrefix(String a, String b) { int as = a.lastIndexOf('/'); int bs = b.lastIndexOf('/'); return a.substring(0, as + 1).equals(b.substring(0, bs + 1)); }
Source:
<code>public void TestDate() { ColumnDef d = build("date", true); assertThat(d, instanceOf(DateColumnDef.class)); assertTrue(d.matchesMysqlType(MySQLConstants.TYPE_DATE)); Date date = new GregorianCalendar(1979, 10, 1).getTime(); <START> assertThat(d.toSQL(date), is("''1979-11-01''")); <END> }</code><technical_language>this is odd -- is toSQL returning a string single-quote characters</technical_language>

Target:
public void TestDate() { ColumnDef d = build("date", true); assertThat(d, instanceOf(DateColumnDef.class)); assertTrue(d.matchesMysqlType(MySQLConstants.TYPE_DATE)); Date date = new GregorianCalendar(1979, 10, 1).getTime(); assertThat(d.toSQL(date), is("'1979-11-01'")); }
Source:
<code>private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); <START> boolean enabled = <END> EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); entry.activated = true; activatedEntries.put(entry.getName(), entry); for (String provides : entry.getProvides()) { MultiValueMapUtils.addToMap(provides, entry, providesEntries); } } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }</code><technical_language>if added new flag this valid... I overriding entry.enabled localconfig, this is configuration</technical_language>

Target:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); boolean enabled = EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); entry.activated = true; for (String provides : entry.getProvides()) { MultiValueMapUtils.addToMap(provides, entry, providesEntries); } } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }
Source:
<code>public CommitCommand commit() { <START> return (new CommitCommand(this)); <END> }</code><technical_language>Style-nit: put parens return. Thus: return new CommitCommand(this);</technical_language>

Target:
public CommitCommand commit() { return new CommitCommand(this); }
Source:
<code>public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlaced.size(); i++) { if (ordersPlaced.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } else { <START> Order tmpOrder = null; for (int i = 0; i < position.size(); i++) { if (position.get(i).getStockSymbol() == symbol){ tmpOrder = position.get(i); } } if (!OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("Cannot sell stock you do not own. Stock: " + symbol); } else if (tmpOrder.getSize() < volume) { throw new StockMarketExpection("Cannot sell more stock than you own. Stock: " + symbol + "Owned: " + volume); } else { SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } <END> } } }</code><technical_language>Refactor this function called placeNewSellOrder</technical_language>

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlaced.size(); i++) { if (ordersPlaced.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } else { Order tmpOrder = null; for (int i = 0; i < position.size(); i++) { if (position.get(i).getStockSymbol() == symbol){ tmpOrder = position.get(i); } } if (!OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("Cannot sell stock you do not own. Stock: " + symbol); } else if (tmpOrder.getSize() < volume) { throw new StockMarketExpection("Cannot sell more stock than you own. Stock: " + symbol + "Owned: " + volume); } else { SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } } } else { throw new StockMarketExpection("Invalid Stock: " + symbol); } }
Source:
<code>private boolean connectStorageServer(Map<StorageType, List<StorageServerConnections>> connectionsByType) { boolean connectSucceeded = true; for (Map.Entry<StorageType, List<StorageServerConnections>> connectionToType : connectionsByType.entrySet()) { StorageType connectionsType = connectionToType.getKey(); List<StorageServerConnections> connections = connectionToType.getValue(); <START> connectSucceeded = connectSucceeded && connectStorageServersByType(connectionsType, connections); <END> } log.infoFormat("Host {0} storage connection was {1} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed"); return connectSucceeded; }</code><technical_language>answer in patchset</technical_language>

Target:
private boolean connectStorageServer(Map<StorageType, List<StorageServerConnections>> connectionsByType) { boolean connectSucceeded = true; for (Map.Entry<StorageType, List<StorageServerConnections>> connectionToType : connectionsByType.entrySet()) { StorageType connectionsType = connectionToType.getKey(); List<StorageServerConnections> connections = connectionToType.getValue(); connectSucceeded = connectStorageServersByType(connectionsType, connections) && connectSucceeded; } log.infoFormat("Host {0} storage connection was {1} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed"); return connectSucceeded; }
Source:
<code>public static Color getPillColorByAccountRegistrationOrder(final int orderIndex){ final ArrayList<Color> pillColors = new ArrayList<>(); pillColors.add(new Color(0xFE, 0x00, 0x00)); <START> pillColors.add(new Color(0x00, 0x00, 0xFE)); <END> pillColors.add(new Color(0x00, 0xFE, 0xFE)); pillColors.add(new Color(0xFE, 0xFE, 0x00)); return pillColors.get(orderIndex % pillColors.size()); }</code><technical_language>Rob pill blue, swap values</technical_language>

Target:
public static Color getPillColorByAccountRegistrationOrder(final int orderIndex){ final ArrayList<Color> pillColors = new ArrayList<>(); pillColors.add(new Color(0x00, 0x00, 0xFE)); pillColors.add(new Color(0xFE, 0x00, 0x00)); pillColors.add(new Color(0x00, 0xFE, 0xFE)); pillColors.add(new Color(0xFE, 0xFE, 0x00)); return pillColors.get(orderIndex % pillColors.size()); }
Source:
<code>private Object serializeResultToString(final ResponseMessage msg) { if (msg.getResult() == null) return "null"; if (msg.getResult().getData() == null) return "null"; final Object o = msg.getResult().getData(); if (o instanceof Collection) { return ((Collection) o).stream().map(d -> null == d ? "null" : d.toString()).collect(Collectors.toList()); <START> } else if (o instanceof byte[]) { <END> return o; } else { return o.toString(); } }</code><technical_language>I undo this special handling - based explanation #533</technical_language>

Target:
private Object serializeResultToString(final ResponseMessage msg) { if (msg.getResult() == null) return "null"; if (msg.getResult().getData() == null) return "null"; final Object o = msg.getResult().getData(); if (o instanceof Collection) { return ((Collection) o).stream().map(d -> null == d ? "null" : d.toString()).collect(Collectors.toList()); } else { return o.toString(); } }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { <START> MenuGridEntryView tiav =(MenuGridEntryView)convertView; <END> if(tiav == null) { tiav = new MenuGridEntryView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ GridEntityView emv =(GridEntityView)convertView; if(emv == null) { emv = new GridEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller); } else{ emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); } return emv; } }</code><technical_language>wanted other class, right</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { if(actionEnabled && position == actionPosition) { HorizontalMediaView tiav =(HorizontalMediaView)convertView; if(tiav == null) { tiav = new HorizontalMediaView(context); } tiav.setDisplay(detail.getCustomAction().getDisplay()); tiav.setBackgroundResource(R.drawable.list_bottom_tab); int padding = (int) context.getResources().getDimension(R.dimen.entity_padding); tiav.setPadding(padding, padding, padding, padding); return tiav; } Entity<TreeReference> entity = current.get(position); if(usesGridView){ GridEntityView emv =(GridEntityView)convertView; if(emv == null) { emv = new GridEntityView(context, detail, entity, currentSearchTerms, mImageLoader, controller, mFuzzySearchEnabled); } else{ emv.setSearchTerms(currentSearchTerms); emv.setViews(context, detail, entity); } return emv; } else{ EntityView emv =(EntityView)convertView; if (emv == null) { emv = new EntityView(context, detail, entity, tts, currentSearchTerms, controller, position, mFuzzySearchEnabled); } else { emv.setSearchTerms(currentSearchTerms); emv.refreshViewsForNewEntity(entity, entity.getElement().equals(selected), position); } return emv; } }
Source:
<code>private static void cacheColors(Display display) { BG_COLOR_RGB= JFaceColors.getInformationViewerBackgroundColor(display).getRGB(); FG_COLOR_RGB= JFaceColors.getInformationViewerForegroundColor(display).getRGB(); Color hyperlinkText= JFaceColors.getHyperlinkText(display); <START> Color activeHyperlinkText= JFaceColors.getActiveHyperlinkText(display); <END> if (hyperlinkText != null) { LINK_COLOR_RGB= hyperlinkText.getRGB(); } if (activeHyperlinkText != null) { ACTIVE_LINK_COLOR_RGB= activeHyperlinkText.getRGB(); } }</code><technical_language>Minor: Move declaration if block is used</technical_language>

Target:
private static void cacheColors(Display display) { BG_COLOR_RGB= JFaceColors.getInformationViewerBackgroundColor(display).getRGB(); FG_COLOR_RGB= JFaceColors.getInformationViewerForegroundColor(display).getRGB(); Color hyperlinkText= JFaceColors.getHyperlinkText(display); if (hyperlinkText != null) { LINK_COLOR_RGB= hyperlinkText.getRGB(); } Color activeHyperlinkText= JFaceColors.getActiveHyperlinkText(display); if (activeHyperlinkText != null) { ACTIVE_LINK_COLOR_RGB= activeHyperlinkText.getRGB(); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); IWorkbenchPage activePage = window.getActivePage(); <START> ISelection selection = activePage.getSelection(); <END> IFile iFile = getSysMLIFileFromWorkspace(selection); File baseSysMLModelFile = iFile.getRawLocation().makeAbsolute().toFile(); FileDialog dlg = new FileDialog(window.getShell(), SWT.SINGLE); dlg.setFilterExtensions(new String[] { "*.uml"}); IPath path = new Path(dlg.open()); File externalSysMLModelFile = path.toFile(); if (baseSysMLModelFile.canRead() && externalSysMLModelFile.canRead()) { PlasticReImport pri = new PlasticReImport(); boolean success = pri.reImport(externalSysMLModelFile, baseSysMLModelFile,window, I_RI.DELETE_FROM_BASE); if (success) {MessageDialog.openInformation(window.getShell(), I_RI.TOOL_TITLE, I_RI.TOOL_SUCCESS +externalSysMLModelFile+" in \n"+baseSysMLModelFile); } else {MessageDialog.openError(window.getShell(),I_RI.TOOL_TITLE, I_RI.TOOL_FAIL + externalSysMLModelFile+" in \n"+baseSysMLModelFile);} } else { MessageDialog.openError(window.getShell(), I_RI.TOOL_TITLE, "Not Readable files"); } return null; }</code><technical_language>HandlerUtil.getCurrentSelection() directly; need manually active window/page/other</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil .getActiveWorkbenchWindowChecked(event); ISelection selection = HandlerUtil.getCurrentSelection(event); IFile iFile = getSysMLIFileFromWorkspace(selection); File baseSysMLModelFile = iFile.getRawLocation().makeAbsolute() .toFile(); FileDialog dlg = new FileDialog(window.getShell(), SWT.SINGLE); dlg.setFilterExtensions(new String[] { "*.uml" }); dlg.setFilterPath(baseSysMLModelFile.getParent()); IPath path = new Path(dlg.open()); File externalSysMLModelFile = path.toFile(); if (baseSysMLModelFile.canRead() && externalSysMLModelFile.canRead()) { PlasticReImport pri = new PlasticReImport(); boolean reImportSuccess = pri.reImport(window, baseSysMLModelFile, externalSysMLModelFile, I_RI.REQ_ID_ATT, null, !I_RI.CHECK_PACKAGE_NAME, I_RI.COPY_All_PROPERTY_VALUES, I_RI.DELETE_FROM_BASE); if (reImportSuccess) { MessageDialog.openInformation(window.getShell(), I_RI.TOOL_TITLE, I_RI.TOOL_SUCCESS); } else { MessageDialog.openError(window.getShell(), I_RI.TOOL_TITLE, I_RI.TOOL_FAIL); } } else { MessageDialog.openError(window.getShell(), I_RI.TOOL_TITLE, I_RI.TOOL_ERR_FILE_READ); } return null; }
Source:
<code>private void dispatchAction(String action) { if(Intent.ACTION_CALL.equals(action) ) { tManager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE); Intent call = new Intent(Intent.ACTION_CALL); call.setData(Uri.parse("tel:" + number)); if(call.resolveActivity(getPackageManager()) != null){ startActivity(call); } else { <START> Toast.makeText(getApplicationContext(), Localization.get("callout.failure.dialer"), Toast.LENGTH_SHORT).show(); <END> } } else { Intent sms = new Intent(Intent.ACTION_SENDTO); sms.setData(Uri.parse("smsto:" + number)); if(sms.resolveActivity(getPackageManager()) != null){ startActivityForResult(sms, SMS_RESULT); } else { Toast.makeText(getApplicationContext(), Localization.get("callout.failure.sms"), Toast.LENGTH_SHORT).show(); } } }</code><technical_language>In general of Activity, current activity Context argument, details properly passed next layer</technical_language>

Target:
private void dispatchAction(String action) { if(Intent.ACTION_CALL.equals(action) ) { tManager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE); Intent call = new Intent(Intent.ACTION_CALL); call.setData(Uri.parse("tel:" + number)); if(call.resolveActivity(getPackageManager()) != null){ startActivity(call); } else { Toast.makeText(this, Localization.get("callout.failure.dialer"), Toast.LENGTH_SHORT).show(); finish(); } } else { Intent sms = new Intent(Intent.ACTION_SENDTO); sms.setData(Uri.parse("smsto:" + number)); if(sms.resolveActivity(getPackageManager()) != null){ startActivityForResult(sms, SMS_RESULT); } else { Toast.makeText(this, Localization.get("callout.failure.sms"), Toast.LENGTH_SHORT).show(); finish(); } } }
Source:
<code>private String getAwsRegion() throws IOException { String region = getEnv("AWS_REGION"); if (region != null) { return region; } AwsCredentialSource awsCredentialSource = (AwsCredentialSource) this.credentialSource; if (awsCredentialSource.regionUrl == null || awsCredentialSource.regionUrl.isEmpty()) { throw new IOException( <START> "Unable to determine the AWS region. The credential source does not contain the region url."); <END> } region = retrieveResource(awsCredentialSource.regionUrl, "region"); return region.substring(0, region.length() - 1); }</code><technical_language>URL</technical_language>

Target:
private String getAwsRegion() throws IOException { String region = getEnv("AWS_REGION"); if (region != null) { return region; } AwsCredentialSource awsCredentialSource = (AwsCredentialSource) this.credentialSource; if (awsCredentialSource.regionUrl == null || awsCredentialSource.regionUrl.isEmpty()) { throw new IOException( "Unable to determine the AWS region. The credential source does not contain the region URL."); } region = retrieveResource(awsCredentialSource.regionUrl, "region"); return region.substring(0, region.length() - 1); }
Source:
<code>public GanttDialogPerson(CustomPropertyManager customPropertyManager, TaskManager taskManager, UIFacade uiFacade, HumanResource person) { myCustomPropertyManager = customPropertyManager; myTaskManager = taskManager; myUIFacade = uiFacade; this.person = person; Role[] enabledRoles = RoleManager.Access.getInstance().getEnabledRoles(); String[] roleFieldValues = new String[enabledRoles.length]; for (int i = 0; i < enabledRoles.length; i++) { roleFieldValues[i] = enabledRoles[i].getName(); } myRoleField = new DefaultEnumerationOption<Object>("colRole", roleFieldValues); myGroup = new GPOptionGroup("", new GPOption[]{myNameField, myPhoneField, myMailField, myRoleField}); myGroup.setTitled(false); ((GPAbstractOption)myTotalCostField).setWritable(false); myRateGroup = new GPOptionGroup("resourceRate", new GPOption[] {myStandardRateField, myTotalCostField}); <START> myRate2Group = new GPOptionGroup("resourceRate", new GPOption[] {myStandardRate2Field, myTotalCost2Field}); <END> }</code><technical_language>applies option groups: ids for groups</technical_language>

Target:
public GanttDialogPerson(CustomPropertyManager customPropertyManager, TaskManager taskManager, UIFacade uiFacade, HumanResource person) { myCustomPropertyManager = customPropertyManager; myTaskManager = taskManager; myUIFacade = uiFacade; this.person = person; Role[] enabledRoles = RoleManager.Access.getInstance().getEnabledRoles(); String[] roleFieldValues = new String[enabledRoles.length]; for (int i = 0; i < enabledRoles.length; i++) { roleFieldValues[i] = enabledRoles[i].getName(); } myRoleField = new DefaultEnumerationOption<Object>("colRole", roleFieldValues); myGroup = new GPOptionGroup("", new GPOption[]{myNameField, myPhoneField, myMailField, myRoleField}); myGroup.setTitled(false); ((GPAbstractOption)myTotalCostField).setWritable(false); myRateGroup = new GPOptionGroup("resourceRate", new GPOption[] {myStandardRateField, myTotalCostField}); myRate2Group = new GPOptionGroup("resourceRate2", new GPOption[] {myStandardRate2Field, myTotalCost2Field}); }
Source:
<code>protected boolean canDoAction() { VDSGroup cluster = getVdsGroup(); if (!cluster.supportsGlusterService() || !GlusterFeatureSupported.glusterBrickProvisioning(cluster.getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_PROVISIONING_NOT_SUPPORTED_BY_CLUSTER); } VdsValidator validator = new VdsValidator(getVds()); if (!validate(validator.isUp())) { return false; } String deviceType; if <START> (getParameters().getDisks().size() == 0) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED); return false; } else { deviceType = getParameters().getDisks().get(0).getDevType(); } for (StorageDevice device : getParameters().getDisks()) { if (!ObjectUtils.objectsEqual(deviceType, device.getDevType())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED); return false; } if (!device.getCanCreateBrick()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE); addCanDoActionMessageVariable("storageDevice", device.getName()); return false; } } return true; }</code><technical_language>getParameters().getDisks().isEmpty()</technical_language>

Target:
protected boolean canDoAction() { VDSGroup cluster = getVdsGroup(); if (!cluster.supportsGlusterService() || !GlusterFeatureSupported.glusterBrickProvisioning(cluster.getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_PROVISIONING_NOT_SUPPORTED_BY_CLUSTER); } VdsValidator validator = new VdsValidator(getVds()); if (!validate(validator.isUp())) { return false; } String deviceType; if (getParameters().getDisks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED); return false; } else { deviceType = getParameters().getDisks().get(0).getDevType(); } for (StorageDevice device : getParameters().getDisks()) { if (!ObjectUtils.objectsEqual(deviceType, device.getDevType())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED); return false; } if (!device.getCanCreateBrick()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE); addCanDoActionMessageVariable("storageDevice", device.getName()); return false; } } return true; }
Source:
<code>public void deleteWorkspaceMaterialFileFieldAnswerFile(WorkspaceMaterialFileFieldAnswerFile fieldAnswerFile) { if (fileAnswerUtils.isFileSystemStorageEnabled()) { Long userEntityId = fieldAnswerFile.getFieldAnswer().getReply().getUserEntityId(); <START> fileAnswerUtils.removeFileFromFileSystem(userEntityId, fieldAnswerFile.getFileId()); <END> } workspaceMaterialFileFieldAnswerFileDAO.delete(fieldAnswerFile); }</code><technical_language>this check if file is expected there? (it silently skip if not)</technical_language>

Target:
public void deleteWorkspaceMaterialFileFieldAnswerFile(WorkspaceMaterialFileFieldAnswerFile fieldAnswerFile) throws IOException { if (fileAnswerUtils.isFileSystemStorageEnabled()) { Long userEntityId = fieldAnswerFile.getFieldAnswer().getReply().getUserEntityId(); if (fileAnswerUtils.isFileInFileSystem(userEntityId, fieldAnswerFile.getFileId())) { fileAnswerUtils.removeFileFromFileSystem(userEntityId, fieldAnswerFile.getFileId()); } } workspaceMaterialFileFieldAnswerFileDAO.delete(fieldAnswerFile); }
Source:
<code>public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { model = (JSLibModel)newInput; try { viewer.refresh(); <START> } catch (Exception e) <END> }</code><technical_language>more empty catch(){}</technical_language>

Target:
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { model = (JSLibModel)newInput; if(viewer != null && model != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) { viewer.refresh(); } }
Source:
<code>public void downloadFile(String uri, File target) { Matcher m = parseURI(uri); if (m.matches()) { try { <START> InputStream s = minioClient.getObject(m.group("bucket"), m.group("path")); <END> FileUtils.copyInputStreamToFile(s, target); } catch (Exception ex) { Exceptions.printStackTrace(ex); } } }</code><technical_language>Is this stream closed? Add try block in case: try(InputStream s = minioClient.getObject(m.group("bucket"), m.group("path"))) {</technical_language>

Target:
protected void downloadFile(String uri, File target) { Matcher m = parseURI(uri); if (m.matches()) { try (InputStream s = minioClient.getObject(m.group("bucket"), m.group("path"))) { FileUtils.copyInputStreamToFile(s, target); } catch (Exception ex) { Exceptions.printStackTrace(ex); } } }
Source:
<code>public static void getCPUList(AsyncQuery aQuery, Version version) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { return source != null ? (ArrayList<ServerCpu>) source : new ArrayList<ServerCpu>(); } }; VdcQueryParametersBase params = new VdcQueryParametersBase(); params.addParameter(GenericVdcParameter.Version, version); <START> Frontend.RunQuery(VdcQueryType.GetAllServerCpuList, params, aQuery); <END> }</code><technical_language>I suggest explore: Frontend.RunQuery( VdcQueryType.GetAllServerCpuList, new VdcQueryParameterBase().addParameter( GenericVdcParameter.Version, version ), aQuery ) I java people likes temp vars... unsure why... work mentioning... if multiple parameters... Frontend.RunQuery( VdcQueryType.GetAllServerCpuList, new VdcQueryParameterBase().addParameter( GenericVdcParameter.Version, version ).addParameter( xxx, xxx ).addParameter( xxx, xxx ).addParameter( xxx, xxx ).addParameter( xxx, xxx ).addParameter( xxx, xxx ), aQuery )</technical_language>

Target:
public static void getCPUList(AsyncQuery aQuery, Version version) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { return source != null ? (ArrayList<ServerCpu>) source : new ArrayList<ServerCpu>(); } }; Frontend.RunQuery(VdcQueryType.GetAllServerCpuList, new VdcQueryParametersBase().addParameter(GenericVdcParameter.Version, version), aQuery); }
Source:
<code>public static String capitalizeFirstLetter(String text) { <START> if(text == null) return null; <END> if(text.length() == 0) return ""; if(text.length() == 1) return text.toUpperCase(); return text.substring(0, 1).toUpperCase() + text.substring(1); }</code><technical_language>Neat violates coding style. standard brace style. standard android [coding style guide](<LINK_0></technical_language>

Target:
public static String capitalizeFirstLetter(String text) { if(text == null) { return null; } else if(text.length() == 0) { return ""; } else if(text.length() == 1) { return text.toUpperCase(); } return text.substring(0, 1).toUpperCase() + text.substring(1); }