auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean execute() throws BuildException { if (getJavac().isForkedJavac()) { attributes.log("Using external error-prone compiler", Project.MSG_VERBOSE); Commandline cmd = new Commandline(); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("java")); if (memoryStackSize != null) { cmd.createArgument().setValue("-Xss" + memoryStackSize); } String memoryParameterPrefix = "-X"; if (memoryInitialSize != null) { cmd.createArgument().setValue(memoryParameterPrefix + "ms" + this.memoryInitialSize); memoryInitialSize = null; } if (memoryMaximumSize != null) { cmd.createArgument().setValue(memoryParameterPrefix + "mx" + this.memoryMaximumSize); memoryMaximumSize = null; } for (Argument arg : jvmArgs) { for (String part : arg.getParts()) { cmd.createArgument().setValue(part); } } cmd.createArgument().setValue("-classpath"); if (classpath == null) { classpath = new Path(getProject()); } addResourceSource(classpath, "com/google/errorprone/ErrorProneExternalCompilerAdapter.class"); addResourceSource(classpath, "com/google/errorprone/ErrorProneCompiler.class"); addResourceSource(classpath, "com/sun/tools/javac/Main.class"); cmd.createArgument().setPath(classpath); cmd.createArgument().setValue(ErrorProneCompiler.class.getName()); if (suggestFixes) { cmd.createArgument().setValue("-Xjcov"); } setupModernJavacCommandlineSwitches(cmd); logAndAddFilesToCompile(cmd); return executeExternalCompile(cmd.getCommandline(), cmd.size(), true) == 0; } else { attributes.log("You must set fork=\"yes\" to use the external error-prone compiler", Project.MSG_ERR); return false; } }

Target:
public boolean execute() throws BuildException { if (getJavac().isForkedJavac()) { attributes.log("Using external error-prone compiler", Project.MSG_VERBOSE); Commandline cmd = new Commandline(); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("java")); if (memoryStackSize != null) { cmd.createArgument().setValue("-Xss" + memoryStackSize); } String memoryParameterPrefix = "-X"; if (memoryInitialSize != null) { cmd.createArgument().setValue(memoryParameterPrefix + "ms" + this.memoryInitialSize); memoryInitialSize = null; } if (memoryMaximumSize != null) { cmd.createArgument().setValue(memoryParameterPrefix + "mx" + this.memoryMaximumSize); memoryMaximumSize = null; } for (Argument arg : jvmArgs) { for (String part : arg.getParts()) { cmd.createArgument().setValue(part); } } cmd.createArgument().setValue("-classpath"); if (classpath == null) { classpath = new Path(getProject()); } addResourceSource(classpath, "com/google/errorprone/ErrorProneExternalCompilerAdapter.class"); addResourceSource(classpath, "com/google/errorprone/ErrorProneCompiler.class"); addResourceSource(classpath, "com/sun/tools/javac/Main.class"); cmd.createArgument().setPath(classpath); cmd.createArgument().setValue(ErrorProneCompiler.class.getName()); setupModernJavacCommandlineSwitches(cmd); logAndAddFilesToCompile(cmd); return executeExternalCompile(cmd.getCommandline(), cmd.size(), true) == 0; } else { attributes.log("You must set fork=\"yes\" to use the external error-prone compiler", Project.MSG_ERR); return false; } }
Source:
public void setLaunchType(ServletRequest request, HttpSession session) { if ( BASIC_LTI_LAUNCH_REQUEST.equals(request.getParameter(LTI_MESSAGE_TYPE)) && session.getAttribute(LAUNCH_TYPE) == null) { session.setAttribute(LAUNCH_TYPE, "lti"); } else if (session.getAttribute(LAUNCH_TYPE) == null){ session.setAttribute(LAUNCH_TYPE, "sc"); } }

Target:
public void setLaunchType(ServletRequest request, HttpSession session) { if ( BASIC_LTI_LAUNCH_REQUEST.equals(request.getParameter(LTI_MESSAGE_TYPE)) && session.getAttribute(LAUNCH_TYPE) == null) { session.setAttribute(LAUNCH_TYPE, "lti"); } if (session.getAttribute(LAUNCH_TYPE) == null){ session.setAttribute(LAUNCH_TYPE, "sc"); } }
Source:
public AnalyzedStatement analyze(DropView dropView, CoordinatorTxnCtx txnCtx) { ArrayList<RelationName> views = new ArrayList<>(dropView.names().size()); ArrayList<RelationName> missing = new ArrayList<>(); for (QualifiedName qualifiedName : dropView.names()) { try { views.add(schemas.resolveView(qualifiedName, txnCtx.sessionContext().searchPath()).v2()); } catch (RelationUnknown e) { if (!dropView.ifExists()) { missing.add(RelationName.of(qualifiedName, txnCtx.sessionContext().searchPath().currentSchema())); } } } if (!missing.isEmpty()) { throw new RelationsUnknown(missing); } return new AnalyzedDropView(views, dropView.ifExists()); }

Target:
public AnalyzedDropView analyze(DropView dropView, CoordinatorTxnCtx txnCtx) { ArrayList<RelationName> views = new ArrayList<>(dropView.names().size()); ArrayList<RelationName> missing = new ArrayList<>(); for (QualifiedName qualifiedName : dropView.names()) { try { views.add(schemas.resolveView(qualifiedName, txnCtx.sessionContext().searchPath()).v2()); } catch (RelationUnknown e) { if (!dropView.ifExists()) { missing.add(RelationName.of(qualifiedName, txnCtx.sessionContext().searchPath().currentSchema())); } } } if (!missing.isEmpty()) { throw new RelationsUnknown(missing); } return new AnalyzedDropView(views, dropView.ifExists()); }
Source:
public List<String> getDependencies() { List<String> dependencies = new ArrayList<>(); dependencies.add(A_G_unixGID_namespace + ":*"); dependencies.add(A_R_unixGID_namespace + ":*"); return dependencies; }

Target:
public List<String> getDependencies() { List<String> dependencies = new ArrayList<>(); return dependencies; }
Source:
public void createNonValidSupportLevel() throws Exception { ObjectMapper mapper = new ObjectMapper(); BitstreamFormatRest bitstreamFormatRest = this.createRandomMockBitstreamRest(false); bitstreamFormatRest.setSupportLevel("NONVALID SUPPORT LVL"); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/bitstreamformats/") .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isBadRequest()); }

Target:
public void createNonValidSupportLevel() throws Exception { ObjectMapper mapper = new ObjectMapper(); BitstreamFormatRest bitstreamFormatRest = this.createRandomMockBitstreamRest(false); bitstreamFormatRest.setSupportLevel("NONVALID SUPPORT LVL"); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/bitstreamformats/") .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isBadRequest()); getClient().perform(get("/api/core/bitstreamformats/")) .andExpect(status().isOk()) .andExpect(jsonPath("$.page.totalElements", is(DEFAULT_AMOUNT_FORMATS))); }
Source:
public String getTableVersion(Table table, Transaction transaction) { SqlTransaction sqlTransaction = (SqlTransaction) transaction; String tableVersion = null; Class<?> tableClass = getMetadataDictionary().getEntityClass(table.getName(), table.getVersion()); VersionQuery versionAnnotation = tableClass.getAnnotation(VersionQuery.class); if (versionAnnotation != null) { String versionQueryString = versionAnnotation.sql(); NamedParamPreparedStatement stmt = sqlTransaction.initializeStatement(versionQueryString); tableVersion = new TimedFunction<>(() -> { try { ResultSet rs = stmt.executeQuery(); if (rs.next()) { return rs.getString(1); } else { return null; } } catch (SQLException e) { throw new IllegalStateException(e); } }, "Running Query: " + versionQueryString ).get(); } return tableVersion; }

Target:
public String getTableVersion(Table table, Transaction transaction) { String tableVersion = null; Class<?> tableClass = getMetadataDictionary().getEntityClass(table.getName(), table.getVersion()); VersionQuery versionAnnotation = tableClass.getAnnotation(VersionQuery.class); if (versionAnnotation != null) { String versionQueryString = versionAnnotation.sql(); SqlTransaction sqlTransaction = (SqlTransaction) transaction; ConnectionDetails details = getConnectionDetails(table.getDbConnectionName()); DataSource dataSource = details.getDataSource(); NamedParamPreparedStatement stmt = sqlTransaction.initializeStatement(versionQueryString, dataSource); tableVersion = CoerceUtil.coerce(runQuery(stmt, versionQueryString, SINGLE_RESULT_MAPPER), String.class); } return tableVersion; }
Source:
private int index(Iterator<Item> iterator) throws DSpaceSolrIndexerException { try { int i = 0; SolrServer server = solrServerResolver.getServer(); ArrayList<SolrInputDocument> list = new ArrayList<>(); while (iterator.hasNext()) { try { Item item = iterator.next(); if (item.getHandle() == null) { log.warn("Skipped item without handle: " + item.getID()); } else { list.add(this.index(item)); } context.uncacheEntity(item); } catch (SQLException | MetadataBindException | ParseException | XMLStreamException | WritingXmlException ex) { log.error(ex.getMessage(), ex); } i++; if (i % 1000 == 0) { System.out.println(i + " items prepared so far..."); } if (i % 10000 == 0) { System.out.println(i + " items imported so far..."); server.add(list); server.commit(true, true); list.clear(); } } System.out.println("Total: " + i + " items"); server.add(list); server.commit(true, true); list.clear(); return i; } catch (SolrServerException | IOException ex) { throw new DSpaceSolrIndexerException(ex.getMessage(), ex); } }

Target:
private int index(Iterator<Item> iterator) throws DSpaceSolrIndexerException { try { int i = 0; int batchSize = configurationService.getIntProperty("oai.import.batch.size", 1000); SolrServer server = solrServerResolver.getServer(); ArrayList<SolrInputDocument> list = new ArrayList<>(); while (iterator.hasNext()) { try { Item item = iterator.next(); if (item.getHandle() == null) { log.warn("Skipped item without handle: " + item.getID()); } else { list.add(this.index(item)); } context.uncacheEntity(item); } catch (SQLException | MetadataBindException | ParseException | XMLStreamException | WritingXmlException ex) { log.error(ex.getMessage(), ex); } i++; if (i % 1000 == 0) { System.out.println(i + " items prepared so far..."); } if (i % batchSize == 0) { System.out.println(i + " items imported so far..."); server.add(list); server.commit(); list.clear(); } } System.out.println("Total: " + i + " items"); server.add(list); server.commit(true, true); list.clear(); return i; } catch (SolrServerException | IOException ex) { throw new DSpaceSolrIndexerException(ex.getMessage(), ex); } }
Source:
public static long hexToId(String hexString) { Assert.hasText(hexString, "Can't convert empty hex string to long"); try { return new BigInteger(hexString, 16).longValue(); } catch (NumberFormatException e) { throw new IllegalArgumentException("Malformed id", e); } }

Target:
public static long hexToId(String hexString) { Assert.hasText(hexString, "Can't convert empty hex string to long"); try { return new BigInteger(hexString, 16).longValue(); } catch (NumberFormatException e) { throw new IllegalArgumentException("Malformed id [" + hexString + "]", e); } }
Source:
public Promise<Multimap<String, Integer>> resolveToConceptsWithGroups(final BranchContext context) { if (conceptsWithGroups == null) { conceptsWithGroups = SnomedRequests.prepareSearchRelationship() .all() .filterByActive(true) .filterByCharacteristicTypes(SnomedEclRefinementEvaluator.ALLOWED_CHARACTERISTIC_TYPES) .filterBySource(ecl) .filterByGroup(1, Integer.MAX_VALUE) .setFields(SnomedRelationshipIndexEntry.Fields.ID, SnomedRelationshipIndexEntry.Fields.SOURCE_ID, SnomedRelationshipIndexEntry.Fields.GROUP) .build(context.id(), context.branchPath()) .execute(context.service(IEventBus.class)) .then(new Function<SnomedRelationships, Multimap<String, Integer>>() { @Override public Multimap<String, Integer> apply(SnomedRelationships input) { final Multimap<String, SnomedRelationship> relationshipsBySource = Multimaps.index(input, SnomedRelationship::getSourceId); return Multimaps.transformValues(relationshipsBySource, SnomedRelationship::getGroup); } }); } return conceptsWithGroups; }

Target:
public Promise<Multimap<String, Integer>> resolveToConceptsWithGroups(final BranchContext context) { if (conceptsWithGroups == null) { conceptsWithGroups = SnomedRequests.prepareSearchRelationship() .all() .filterByActive(true) .filterByCharacteristicTypes(SnomedEclRefinementEvaluator.ALLOWED_CHARACTERISTIC_TYPES) .filterBySource(ecl) .filterByGroup(1, Integer.MAX_VALUE) .setFields(SnomedRelationshipIndexEntry.Fields.ID, SnomedRelationshipIndexEntry.Fields.SOURCE_ID, SnomedRelationshipIndexEntry.Fields.GROUP) .build(context.id(), context.branchPath()) .execute(context.service(IEventBus.class)) .then(new Function<SnomedRelationships, Multimap<String, Integer>>() { @Override public Multimap<String, Integer> apply(SnomedRelationships input) { final Multimap<String, SnomedRelationship> relationshipsBySource = Multimaps.index(input, SnomedRelationship::getSourceId); final Multimap<String, Integer> groupsByRelationshipId = Multimaps.transformValues(relationshipsBySource, SnomedRelationship::getGroup); return ImmutableSetMultimap.copyOf(groupsByRelationshipId); } }); } return conceptsWithGroups; }
Source:
private static File getVersionFile(URL workspaceUrl, boolean create) { if (workspaceUrl == null) { return null; } try { File metaDir = new File(workspaceUrl.getPath(), METADATA_FOLDER); if (!metaDir.exists() && (!create || !metaDir.mkdir())) { return null; } File versionFile = new File(metaDir, VERSION_FILENAME); if (!versionFile.exists() && (!create || !versionFile.createNewFile())) { return null; } return versionFile; } catch (IOException e) { return null; } }

Target:
protected static File getVersionFile(URL workspaceUrl, boolean create) { if (workspaceUrl == null) { return null; } try { File metaDir = new File(workspaceUrl.getPath(), METADATA_FOLDER); if (!metaDir.exists() && (!create || !metaDir.mkdir())) { return null; } File versionFile = new File(metaDir, VERSION_FILENAME); if (!versionFile.exists() && (!create || !versionFile.createNewFile())) { return null; } return versionFile; } catch (IOException e) { return null; } }
Source:
private static Pair<File, Integer> findValueInXml(ResourceType type, String name, File file) { if (AdtPlugin.fileContains(file, name)) { String xml = AdtPlugin.readFile(file); if (xml == null) { return null; } InputSource is = new InputSource(new StringReader(xml)); try { OffsetTrackingParser parser = new OffsetTrackingParser(); parser.parse(is); Document document = parser.getDocument(); return findValueInDocument(type, name, file, parser, document); } catch (SAXException e) { } catch (IOException e) { } } return null; }

Target:
private static Pair<File, Integer> findValueInXml(ResourceType type, String name, File file) { if (AdtPlugin.fileContains(file, name)) { try { InputSource is = new InputSource(new FileInputStream(file)); OffsetTrackingParser parser = new OffsetTrackingParser(); parser.parse(is); Document document = parser.getDocument(); return findValueInDocument(type, name, file, parser, document); } catch (SAXException e) { } catch (IOException e) { } } return null; }
Source:
boolean isLegacyTaskApplication() { return ApplicationUtil.isLegacyTaskApplication(appDesc); }

Target:
boolean isLegacyTaskApplication() { return LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass()); }
Source:
public PoolDTO createPool(@PathParam("owner_key") @Verify(Owner.class) String ownerKey, @ApiParam(name = "pool", required = true) PoolDTO inputPoolDTO) { log.info("Creating custom pool for owner {}: {}" + ownerKey, inputPoolDTO); Pool pool = new Pool(); Owner owner = findOwnerByKey(ownerKey); pool.setOwner(owner); this.populateEntityOnCreate(pool, inputPoolDTO); pool = poolManager.createAndEnrichPools(pool); return this.translator.translate(pool, PoolDTO.class); }

Target:
public PoolDTO createPool(@PathParam("owner_key") @Verify(Owner.class) String ownerKey, @ApiParam(name = "pool", required = true) PoolDTO inputPoolDTO) { log.info("Creating custom pool for owner {}: {}", ownerKey, inputPoolDTO); Pool pool = new Pool(); Owner owner = findOwnerByKey(ownerKey); pool.setOwner(owner); this.populateEntity(pool, inputPoolDTO); pool.setContractNumber(inputPoolDTO.getContractNumber()); pool.setOrderNumber(inputPoolDTO.getOrderNumber()); pool.setAccountNumber(inputPoolDTO.getAccountNumber()); pool.setUpstreamPoolId(inputPoolDTO.getUpstreamPoolId()); pool.setSubscriptionSubKey(inputPoolDTO.getSubscriptionSubKey()); pool.setSubscriptionId(inputPoolDTO.getSubscriptionId()); if (inputPoolDTO.getProductId() != null) { pool.setProduct(findProduct(pool.getOwner(), inputPoolDTO.getProductId())); } if (inputPoolDTO.getDerivedProductId() != null) { pool.setDerivedProduct(findProduct(pool.getOwner(), inputPoolDTO.getDerivedProductId())); } if (inputPoolDTO.getSourceEntitlement() != null) { pool.setSourceEntitlement(findEntitlement(inputPoolDTO.getSourceEntitlement().getId())); } pool = poolManager.createAndEnrichPools(pool); return this.translator.translate(pool, PoolDTO.class); }
Source:
public GroupsAddedToContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; this.message = formatMessage("Groups (%s) successfully added from contact groups %s.", groupsId, contactGroup); }

Target:
public GroupsAddedToContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; this.message = formatMessage("Groups (%s) successfully added to contact group %s.", groupsId, contactGroup); }
Source:
public void launchTask(ExecutorDriver driver, TaskInfo taskInfo) { currentTaskId = taskInfo.getTaskId(); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(currentTaskId) .setState(TaskState.TASK_STARTING) .build()); CrateExecutableInfo crateTask = null; try { crateTask = CrateExecutableInfo.fromStream(taskInfo.getData().toByteArray()); } catch (IOException e) { LOGGER.debug("Could not de-serialize TaskInfo", e); e.printStackTrace(); } if (crateTask != null) { LOGGER.debug("Prepare crateTask: {}", crateTask); boolean prepared = prepare(driver, crateTask); if (prepared) { task = new Task(crateTask); startProcess(driver, task); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(currentTaskId) .setState(TaskState.TASK_RUNNING) .build()); return; } } fail(driver); }

Target:
public void launchTask(ExecutorDriver driver, TaskInfo taskInfo) { currentTaskId = taskInfo.getTaskId(); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(currentTaskId) .setState(TaskState.TASK_STARTING) .build()); CrateExecutableInfo crateTask = null; try { crateTask = CrateExecutableInfo.fromStream(taskInfo.getData().toByteArray()); } catch (IOException e) { LOGGER.error("Could not de-serialize TaskInfo", e); } if (crateTask != null) { LOGGER.debug("Prepare crateTask: {}", crateTask); boolean prepared = prepare(driver, crateTask); if (prepared) { task = new Task(crateTask); startProcess(driver, task); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(currentTaskId) .setState(TaskState.TASK_RUNNING) .build()); return; } } fail(driver); }
Source:
private void runTest(Configuration conf ) throws Exception { conf.set(EncryptionPropertiesFactory.CRYPTO_FACTORY_CLASS_PROPERTY_NAME, "org.apache.parquet.crypto.propertiesfactory.SchemaCryptoPropertiesFactory"); String file = createTempFile("test"); markEncryptColumns(); encryptParquetFile(file, conf); decryptParquetFileAndValid(file, conf); }

Target:
private void runTest(Configuration conf ) throws Exception { conf.set(EncryptionPropertiesFactory.CRYPTO_FACTORY_CLASS_PROPERTY_NAME, SchemaCryptoPropertiesFactory.class.getName()); String file = createTempFile("test"); markEncryptColumns(); encryptParquetFile(file, conf); decryptParquetFileAndValid(file, conf); }
Source:
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("DeviceStateMonitor:"); ipw.increaseIndent(); ipw.println("mIsTetheringOn=" + mIsTetheringOn); ipw.println("mIsInteractive=" + mIsInteractive); ipw.println("mIsCharging=" + mIsCharging); ipw.println("mIsPowerSaveOn=" + mIsPowerSaveOn); ipw.println("mLegacyScreenState=" + mLegacyScreenState); ipw.println("mIsLowDataExpected=" + mIsLowDataExpected); ipw.println("mUnsolicitedResponseFilter=" + mUnsolicitedResponseFilter); ipw.println("++++++++++++++++++++++++++++++++"); ipw.println("Local logs:"); ipw.increaseIndent(); mLocalLog.dump(fd, ipw, args); ipw.decreaseIndent(); ipw.decreaseIndent(); ipw.println("++++++++++++++++++++++++++++++++"); ipw.flush(); }

Target:
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("DeviceStateMonitor:"); ipw.increaseIndent(); ipw.println("mIsTetheringOn=" + mIsTetheringOn); ipw.println("mIsInteractive=" + mIsInteractive); ipw.println("mIsCharging=" + mIsCharging); ipw.println("mIsPowerSaveOn=" + mIsPowerSaveOn); ipw.println("mLegacyScreenState=" + mLegacyScreenState); ipw.println("mIsLowDataExpected=" + mIsLowDataExpected); ipw.println("mUnsolicitedResponseFilter=" + mUnsolicitedResponseFilter); ipw.println("Local logs:"); ipw.increaseIndent(); mLocalLog.dump(fd, ipw, args); ipw.decreaseIndent(); ipw.decreaseIndent(); ipw.println("++++++++++++++++++++++++++++++++"); ipw.flush(); }
Source:
PercentType getColorTemperature() { JsonElement colorX = attributes.get(COLOR_X); if (colorX != null) { double x = attributes.get(COLOR_X).getAsInt(); double value = 0.0; if (x > X[1]) { value = (x - X[0]) / (X[1] - X[0]) / 2.0; } else { value = (x - X[1]) / (X[2] - X[1]) / 2.0 + 0.5; } return new PercentType((int) Math.round(value * 100.0)); } else { return null; } }

Target:
PercentType getColorTemperature() { JsonElement colorX = attributes.get(COLOR_X); if (colorX != null) { double x = attributes.get(COLOR_X).getAsInt(); double value = 0.0; if (x > X[1]) { value = (x - X[1]) / (X[2] - X[1]) / 2.0 + 0.5; } else { value = (x - X[0]) / (X[1] - X[0]) / 2.0; } return new PercentType((int) Math.round(value * 100.0)); } else { return null; } }
Source:
public String getName() { return "OPEN_TRANSACTION"; }

Target:
public String getName() { return "REPL_TRANSACTION"; }
Source:
protected void run(Date lastRun) { String responseJSON; try { HttpRequest request = HttpRequest.get("<LINK_0>"); responseJSON = request.body(); } catch (HttpRequest.HttpRequestException e) { return; } JSONObject meta; try { meta = new JSONObject(responseJSON); } catch (JSONException e) { throw new RuntimeException(e); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); if (prefs.contains(PREFERENCE_KEY_ALPHA_COMMIT)) { if (!prefs.getString(PREFERENCE_KEY_ALPHA_COMMIT, "").equals(meta.optString("commit_hash", ""))) { showNotification(); } } prefs.edit().putString(PREFERENCE_KEY_ALPHA_COMMIT, meta.optString("commit_hash")).apply(); }

Target:
protected void run(Date lastRun) { String responseJSON; try { HttpRequest request = HttpRequest.get("<LINK_0>"); responseJSON = request.body(); } catch (HttpRequest.HttpRequestException | SecurityException e) { return; } JSONObject meta; try { meta = new JSONObject(responseJSON); } catch (JSONException e) { throw new RuntimeException(e); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); if (prefs.contains(PREFERENCE_KEY_ALPHA_COMMIT)) { if (!prefs.getString(PREFERENCE_KEY_ALPHA_COMMIT, "").equals(meta.optString("commit_hash", ""))) { showNotification(); } } prefs.edit().putString(PREFERENCE_KEY_ALPHA_COMMIT, meta.optString("commit_hash")).apply(); }
Source:
public static String getMessage(AuditLogType logType) { final String result = getMessageOrNull(logType); return result == null ? "" : result; }

Target:
public static String getMessage(AuditLogType logType) { return StringUtils.defaultString(getMessageOrNull(logType)); }
Source:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); for (Integer quark : fQuarks) { try { double[] steps = new double[xAxis.length]; ITmfStateValue prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getStateValue(); for (int i = 0; i < xAxis.length; i++) { ITmfStateValue next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getStateValue(); long stateValue = prev.isNull() ? next.unboxLong() : next.unboxLong() - prev.unboxLong(); steps[i] = next.isNull() ? 0 : stateValue; prev = next; } setSeries(createSeriesName(ss, quark), steps); } catch (StateSystemDisposedException e) { } } updateDisplay(); }

Target:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); for (Integer quark : fQuarks) { try { double[] steps = new double[xAxis.length]; Object prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getValue(); for (int i = 0; i < xAxis.length; i++) { Object next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getValue(); long prevValue = prev instanceof Long ? (long) prev : 0; long nextValue = next instanceof Long ? (long) next : 0; long stateValue = (prev == null) ? nextValue : nextValue - prevValue; steps[i] = (next == null) ? 0 : stateValue; prev = next; } setSeries(ss.getFullAttributePath(quark), steps); } catch (StateSystemDisposedException e) { return; } } updateDisplay(); }
Source:
public void deserialize(TBase base, byte[] bytes, int offset, int len) throws TException { TMemoryInputTransport trans = new TMemoryInputTransport(); TBinaryProtocol protocol = new ThriftBinaryProtocol(trans, bytes.length, bytes.length); resetAndInitialize(protocol, len); trans.reset(bytes, offset, len); base.read(protocol); }

Target:
public void deserialize(TBase base, byte[] bytes, int offset, int len) throws TException { if (len > lengthLimit) { lengthLimit = len + Double.valueOf(0.1 * len).longValue(); protocol = new ThriftBinaryProtocol(trans, lengthLimit, lengthLimit); } resetAndInitialize(protocol, len); trans.reset(bytes, offset, len); base.read(protocol); }
Source:
public void shiftColumns(int startColumn, int endColumn, int n){ FormulaShifter shifter = FormulaShifter.createForItemShift(this, false, startColumn, endColumn, n); HSSFColumnShifter columnShifter = new HSSFColumnShifter(this, shifter); columnShifter.shiftColumns(startColumn, endColumn, n); shiftFormulas(startColumn, endColumn, n, false); }

Target:
public void shiftColumns(int startColumn, int endColumn, int n){ HSSFColumnShifter columnShifter = new HSSFColumnShifter(this); columnShifter.shiftColumns(startColumn, endColumn, n); int sheetIndex = _workbook.getSheetIndex(this); short externSheetIndex = _book.checkExternSheet(sheetIndex); String sheetName = _workbook.getSheetName(sheetIndex); FormulaShifter formulaShifter = FormulaShifter.createForColumnShift( externSheetIndex, sheetName, startColumn, endColumn, n, SpreadsheetVersion.EXCEL97); updateFormulasForShift(formulaShifter); }
Source:
public CompletableFuture<DetectorResponseDTO> execute( DetectorRequestDTO request) { String serviceName = request.getServiceName(); String address = request.getAddress(); List<String> properties = request.getProperties(); Map<String, String> attributes = parse(properties); ServiceDetector detector = serviceDetectorRegistry.getDetectorByServiceName(serviceName, attributes); InetAddress ipAddress = null; try { ipAddress = InetAddress.getByName(address); } catch (UnknownHostException e1) { e1.printStackTrace(); } boolean isServiceDetected = false; System.out.println("Trying to get detector with service name: " + serviceName + " at " + ipAddress.toString()); final CompletableFuture<Boolean> future = detectService(detector, ipAddress); while (true) { try { isServiceDetected = future.get(1, TimeUnit.SECONDS); System.out.printf("\nThe '%s' service %s detected on %s\n", serviceName, isServiceDetected ? "WAS" : "WAS NOT", address); break; } catch (TimeoutException | InterruptedException | ExecutionException e) { future.completeExceptionally(e); } System.out.print("."); System.out.flush(); } DetectorResponseDTO response = new DetectorResponseDTO(); response.setDetected(isServiceDetected); final CompletableFuture<DetectorResponseDTO> output = new CompletableFuture<DetectorResponseDTO>(); output.complete(response); return output; }

Target:
public CompletableFuture<DetectorResponseDTO> execute( DetectorRequestDTO request) { String serviceName = request.getServiceName(); String address = request.getAddress(); Map<String, String> attributes = request.getAttributes(); ServiceDetector detector = serviceDetectorRegistry.getDetectorByServiceName(serviceName, attributes); DetectorHandler detectorHandler = new DetectorHandler(); final CompletableFuture<DetectorResponseDTO> output = detectorHandler.execute(detector, address); return output; }
Source:
public ChoreService getChoreService() { return this.choreService; }

Target:
synchronized ChoreService getChoreService() { if (choreService == null) { choreService = new ChoreService("AsyncConn Chore Service"); } return choreService; }
Source:
public Config<T> withStrictProjectionString(String p) { return new Config<T>(this.klass, this.filterPredicate, this.deprecatedProjectionString, Objects.requireNonNull(p, "projectionString")); }

Target:
public Config<T> withStrictProjectionString(String p) { return new Config<T>(this.klass, this.filterPredicate, this.deprecatedProjectionString, Objects.requireNonNull(p, "projectionString cannot be null")); }
Source:
private void rememberBestCost(CostEstimate currentCost,int planType) throws StandardException{ foundABestPlan=true; OptimizerTrace tracer = tracer(); if(optimizerTrace){ tracer.trace(OptimizerFlag.CHEAPEST_PLAN_SO_FAR,0,0,0.0); tracer.trace(OptimizerFlag.PLAN_TYPE,planType,0,0.0); tracer.trace(OptimizerFlag.COST_OF_CHEAPEST_PLAN_SO_FAR,0,0,0.0); } bestCost.setCost(currentCost); if((bestCost.getEstimatedCost()/NANOS_TO_MILLIS)<timeLimit) { timeLimit=bestCost.getEstimatedCost()/NANOS_TO_MILLIS; if (timeLimit < 2000 && isPreparedStatement()) timeLimit = 2000; } bestJoinOrderUsedPredsFromAbove=usingPredsPushedFromAbove; System.arraycopy(proposedJoinOrder,0,bestJoinOrder,0,numOptimizables); for(int i=0;i<numOptimizables;i++){ optimizableList.getOptimizable(bestJoinOrder[i]). rememberAsBest(planType,this); } if(requiredRowOrdering!=null){ if(planType==Optimizer.SORT_AVOIDANCE_PLAN) requiredRowOrdering.sortNotNeeded(); else requiredRowOrdering.sortNeeded(); } if(optimizerTrace){ if(requiredRowOrdering!=null){ tracer.trace(OptimizerFlag.SORT_NEEDED_FOR_ORDERING,planType,0,0.0); } tracer.trace(OptimizerFlag.REMEMBERING_BEST_JOIN_ORDER,0,0,0.0); } }

Target:
private void rememberBestCost(CostEstimate currentCost,int planType) throws StandardException{ foundABestPlan=true; OptimizerTrace tracer = tracer(); if(optimizerTrace){ tracer.trace(OptimizerFlag.CHEAPEST_PLAN_SO_FAR,0,0,0.0); tracer.trace(OptimizerFlag.PLAN_TYPE,planType,0,0.0); tracer.trace(OptimizerFlag.COST_OF_CHEAPEST_PLAN_SO_FAR,0,0,0.0); } bestCost.setCost(currentCost); if((bestCost.getEstimatedCost()/NANOS_TO_MILLIS)<timeLimit) { timeLimit=bestCost.getEstimatedCost()/NANOS_TO_MILLIS; if (timeLimit < PREPARED_STATEMENT_TIME_LIMIT_LOWER_BOUND && isPreparedStatement()) timeLimit = PREPARED_STATEMENT_TIME_LIMIT_LOWER_BOUND; } bestJoinOrderUsedPredsFromAbove=usingPredsPushedFromAbove; System.arraycopy(proposedJoinOrder,0,bestJoinOrder,0,numOptimizables); for(int i=0;i<numOptimizables;i++){ optimizableList.getOptimizable(bestJoinOrder[i]). rememberAsBest(planType,this); } if(requiredRowOrdering!=null){ if(planType==Optimizer.SORT_AVOIDANCE_PLAN) requiredRowOrdering.sortNotNeeded(); else requiredRowOrdering.sortNeeded(); } if(optimizerTrace){ if(requiredRowOrdering!=null){ tracer.trace(OptimizerFlag.SORT_NEEDED_FOR_ORDERING,planType,0,0.0); } tracer.trace(OptimizerFlag.REMEMBERING_BEST_JOIN_ORDER,0,0,0.0); } }
Source:
public void setup() throws InjectionException { final Configuration layerConf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(LayerIndex.class, String.valueOf(0)) .bindNamedParameter(LayerInputShape.class, "4,2") .build(); final DropoutLayerConfigurationBuilder builder = DropoutLayerConfigurationBuilder .newConfigurationBuilder() .setDropoutRatio(0.5f); final Injector injector = Tang.Factory.getTang().newInjector(MATRIX_CONF); this.dropoutLayer = injector.forkInjector(layerConf, builder.build()) .getInstance(LayerBase.class); }

Target:
public void setup() throws InjectionException { final Configuration layerConf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(LayerIndex.class, String.valueOf(0)) .bindNamedParameter(LayerInputShape.class, "4,2") .build(); final DropoutLayerConfigurationBuilder builder = DropoutLayerConfigurationBuilder .newConfigurationBuilder() .setDropoutRatio(0.5f); final Injector injector = Tang.Factory.getTang().newInjector(MATRIX_CONF); final MatrixFactory matrixFactoryForLayer = injector.getInstance(MatrixFactory.class); matrixFactoryForLayer.setRandomSeed(10); this.dropoutLayer = injector.forkInjector(layerConf, builder.build()) .getInstance(LayerBase.class); }
Source:
public static void main(String[] args) { ServiceDiscoveryService sd = serviceDiscovery(); Chapter service = sd.findAny(); Saga goodOrderSaga = service.execute(newSaga("good_order")); Saga badOrderSaga = service.execute(newSaga("bad_order")); logger.info("orders: goodOrder is {}, badOrder is {}", goodOrderSaga.getResult(), badOrderSaga.getResult()); }

Target:
public static void main(String[] args) { ServiceDiscoveryService sd = serviceDiscovery(); ChoreographyChapter service = sd.findAny(); Saga goodOrderSaga = service.execute(newSaga("good_order")); Saga badOrderSaga = service.execute(newSaga("bad_order")); LOGGER.info("orders: goodOrder is {}, badOrder is {}", goodOrderSaga.getResult(), badOrderSaga.getResult()); }
Source:
public void testGetTempaltesForStorageDomain() { dao = dbFacade.getUnregisteredOVFDataDao(); List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomain(FixturesTool.STORAGE_DOAMIN_NFS2_1, "Template"); assertTrue("a Tempalte should not be fetched for the specified storage domain", ovfEntityDataList.isEmpty()); }

Target:
public void testGetTempaltesForStorageDomain() { dao = dbFacade.getUnregisteredOVFDataDao(); List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomainByEntityType(FixturesTool.STORAGE_DOAMIN_NFS2_1, "Template"); assertTrue("A Tempalte should not be fetched for the specified storage domain", ovfEntityDataList.isEmpty()); }
Source:
public synchronized PhysicalPlan get() { TopologyMaster.TMasterLocation tMasterLocation = stateManagerAdaptor.getTMasterLocation(topologyName); String host = tMasterLocation.getHost(); int port = tMasterLocation.getControllerPort(); String url = "http://" + host + ":" + port + "/get_current_physical_plan"; LOG.fine("tmaster physical plan query endpoint: " + url); HttpURLConnection con = NetworkUtils.getHttpConnection(url); NetworkUtils.sendHttpGetRequest(con); byte[] responseData = NetworkUtils.readHttpResponse(con); String encodedString = new String(responseData); LOG.fine("tmaster returns physical plan in base64 str: " + encodedString); byte[] decodedBytes = Base64.getDecoder().decode(encodedString); PhysicalPlan physicalPlan = null; try { physicalPlan = PhysicalPlan.parseFrom(decodedBytes); } catch (Exception e) { throw new InvalidStateException(topologyName, "Failed to fetch the physical plan"); } cachedPhysicalPlan = physicalPlan; return physicalPlan; }

Target:
public synchronized PhysicalPlan get() { TopologyMaster.TMasterLocation tMasterLocation = stateManagerAdaptor.getTMasterLocation(topologyName); String host = tMasterLocation.getHost(); int port = tMasterLocation.getControllerPort(); String url = "http://" + host + ":" + port + "/get_current_physical_plan"; LOG.fine("tmaster physical plan query endpoint: " + url); HttpURLConnection con = NetworkUtils.getHttpConnection(url); NetworkUtils.sendHttpGetRequest(con); byte[] responseData = NetworkUtils.readHttpResponse(con); physicalPlan = ParseResponseToPhysicalPlan(responseData); return physicalPlan; }
Source:
public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) { double cost = partialQuery.estimateCost(); if (joinRel.getCondition().isA(SqlKind.LITERAL) && !joinRel.getCondition().isAlwaysFalse()) { cost += CostEstimates.COST_JOIN_CROSS; } double multiplier = DruidRels.isScanOrMapping(this, true) ? 1 : 1 / CostEstimates.MULTIPLIER_FILTER; return planner.getCostFactory().makeCost(cost, 0, 0).multiplyBy(multiplier); }

Target:
public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) { double cost; if (computeLeftRequiresSubquery(getSomeDruidChild(left))) { cost = CostEstimates.COST_JOIN_SUBQUERY; } else { cost = partialQuery.estimateCost(); } if (computeRightRequiresSubquery(getSomeDruidChild(right))) { cost += CostEstimates.COST_JOIN_SUBQUERY; } if (joinRel.getCondition().isA(SqlKind.LITERAL) && !joinRel.getCondition().isAlwaysFalse()) { cost += CostEstimates.COST_JOIN_CROSS; } return planner.getCostFactory().makeCost(cost, 0, 0); }
Source:
public boolean equals(Object o) { if (o instanceof HashSet) { final HashSet<?> that = (HashSet<?>) o; return this.tree.equals(that.tree); } else { return super.equals(o); } }

Target:
public boolean equals(Object o) { return Sets.equals(this, o); }
Source:
public VersionInfo(Class<?> classInJar, String groupId, String artifactId, String gitPropertiesResource) { try { URL res = VersionInfo.class.getResource(VersionInfo.class.getSimpleName() + ".class"); URLConnection conn = res.openConnection(); if (conn instanceof JarURLConnection) { Manifest mf = ((JarURLConnection) conn).getManifest(); Attributes mainAttribs = mf.getMainAttributes(); String builtBy = mainAttribs.getValue("Built-By"); if(builtBy != null) { this.user = builtBy; } } Enumeration<URL> resources = VersionInfo.class.getClassLoader().getResources("META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties"); while (resources.hasMoreElements()) { Properties pomInfo = new Properties(); pomInfo.load(resources.nextElement().openStream()); String v = pomInfo.getProperty("version", "unknown"); this.version = v; } resources = VersionInfo.class.getClassLoader().getResources("dt-git.properties"); while (resources.hasMoreElements()) { Properties gitInfo = new Properties(); gitInfo.load(resources.nextElement().openStream()); String commitAbbrev = gitInfo.getProperty("git.commit.id.abbrev", "unknown"); String branch = gitInfo.getProperty("git.branch", "unknown"); this.revision = "rev: " + commitAbbrev + " branch: " + branch; this.date = gitInfo.getProperty("git.build.time", this.date); this.user = gitInfo.getProperty("git.build.user.name", this.user); break; } } catch (IOException e) { org.slf4j.LoggerFactory.getLogger(VersionInfo.class).error("Failed to read version info", e); } }

Target:
public VersionInfo(Class<?> classInJar, String groupId, String artifactId, String gitPropertiesResource) { try { URL res = classInJar.getResource(classInJar.getSimpleName() + ".class"); URLConnection conn = res.openConnection(); if (conn instanceof JarURLConnection) { Manifest mf = ((JarURLConnection) conn).getManifest(); Attributes mainAttribs = mf.getMainAttributes(); String builtBy = mainAttribs.getValue("Built-By"); if(builtBy != null) { this.user = builtBy; } } Enumeration<URL> resources = classInJar.getClassLoader().getResources("META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties"); while (resources.hasMoreElements()) { Properties pomInfo = new Properties(); pomInfo.load(resources.nextElement().openStream()); String v = pomInfo.getProperty("version", "unknown"); this.version = v; } resources = VersionInfo.class.getClassLoader().getResources(gitPropertiesResource); while (resources.hasMoreElements()) { Properties gitInfo = new Properties(); gitInfo.load(resources.nextElement().openStream()); String commitAbbrev = gitInfo.getProperty("git.commit.id.abbrev", "unknown"); String branch = gitInfo.getProperty("git.branch", "unknown"); this.revision = "rev: " + commitAbbrev + " branch: " + branch; this.date = gitInfo.getProperty("git.build.time", this.date); this.user = gitInfo.getProperty("git.build.user.name", this.user); break; } } catch (IOException e) { org.slf4j.LoggerFactory.getLogger(VersionInfo.class).error("Failed to read version info", e); } }
Source:
private void updateDatasetInCollection(Collection collection, String datasetID, HttpServletRequest request, String user) throws ZebedeeException, IOException, DatasetAPIException { logInfo("PUT called on /collections/{}/datasets/{} endpoint") .addParameter("collectionID", collection.getId()) .addParameter("datasetID", datasetID) .log(); try (InputStream body = request.getInputStream()) { CollectionDataset dataset = ContentUtil.deserialise(body, CollectionDataset.class); datasetService.updateDatasetInCollection(collection, datasetID, dataset, user); } catch (JsonSyntaxException ex) { throw new BadRequestException(ex.getMessage()); } }

Target:
private void updateDatasetInCollection(Collection collection, String datasetID, HttpServletRequest request, String user) throws ZebedeeException, IOException, DatasetAPIException { logInfo("PUT called on /collections/{}/datasets/{} endpoint") .addParameter("collectionID", collection.getId()) .addParameter("datasetID", datasetID) .user(user) .log(); try (InputStream body = request.getInputStream()) { CollectionDataset dataset = ContentUtil.deserialise(body, CollectionDataset.class); datasetService.updateDatasetInCollection(collection, datasetID, dataset, user); } catch (JsonSyntaxException ex) { throw new BadRequestException(ex.getMessage()); } }
Source:
testResolvingServersWhenThereIsNoTheCorrespondingServiceAndIngressForTheSpecifiedMachine() { Service nonMatchedByPodService = createService("nonMatched", "foreignMachine", CONTAINER_PORT, null); Ingress ingress = createIngress( "nonMatched", "foreignMachine", Pair.of("http-server", new ServerConfigImpl("3054", "http", "/api", ATTRIBUTES_MAP))); KubernetesServerResolver serverResolver = new KubernetesServerResolver( new NoopPathDemangler(), singletonList(nonMatchedByPodService), singletonList(ingress)); Map<String, ServerImpl> resolved = serverResolver.resolve("machine"); assertTrue(resolved.isEmpty()); }

Target:
testResolvingServersWhenThereIsNoTheCorrespondingServiceAndIngressForTheSpecifiedMachine() { Service nonMatchedByPodService = createService("nonMatched", "foreignMachine", CONTAINER_PORT, null); Ingress ingress = createIngress( "nonMatched", "foreignMachine", Pair.of("http-server", new ServerConfigImpl("3054", "http", "/api", ATTRIBUTES_MAP))); KubernetesServerResolver serverResolver = new KubernetesServerResolver( new NoopPathTransformInverter(), singletonList(nonMatchedByPodService), singletonList(ingress)); Map<String, ServerImpl> resolved = serverResolver.resolve("machine"); assertTrue(resolved.isEmpty()); }
Source:
private InfinispanRequest(FullHttpRequest request, ChannelHandlerContext ctx) { this.request = request; queryStringDecoder = new QueryStringDecoder(request.uri()); streamId = Optional.ofNullable(request.headers().get(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text())); this.nettyChannelContext = ctx; String[] pathParams = queryStringDecoder.path().split("/"); switch (pathParams.length) { case 4: context = pathParams[1]; cacheName = Optional.of(pathParams[2]); key = Optional.of(pathParams[3]); break; case 3: context = pathParams[1]; cacheName = Optional.of(pathParams[2]); key = Optional.empty(); break; case 2: context = pathParams[1]; cacheName = Optional.empty(); key = Optional.empty(); break; default: throw new IllegalArgumentException("Wrong number of Path Parameters"); } }

Target:
private InfinispanRequest(FullHttpRequest request, ChannelHandlerContext ctx) { this.request = request; queryStringDecoder = new QueryStringDecoder(request.uri()); streamId = Optional.ofNullable(request.headers().get(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text())); this.nettyChannelContext = ctx; StringTokenizer pathTokenizer = new StringTokenizer(queryStringDecoder.path(), "/"); context = pathTokenizer.nextToken(); if (pathTokenizer.hasMoreTokens()) { cacheName = Optional.of(pathTokenizer.nextToken()); } else { cacheName = Optional.empty(); } if (pathTokenizer.hasMoreTokens()) { key = Optional.of(pathTokenizer.nextToken()); } else { key = Optional.empty(); } }
Source:
public static List<Person> getPeople(int localTableBlogId) { List<Person> people = new ArrayList<>(); String[] args = { Integer.toString(localTableBlogId) }; Cursor c = getReadableDb().rawQuery("SELECT * FROM " + PEOPLE_TABLE + " WHERE local_blog_id=? ORDER BY display_name, user_name", args); try { while (c.moveToNext()) { Person person = getPersonFromCursor(c, localTableBlogId); people.add(person); } return people; } finally { SqlUtils.closeCursor(c); } }

Target:
public static List<Person> getPeople(int localTableBlogId) { List<Person> people = new ArrayList<>(); String[] args = { Integer.toString(localTableBlogId) }; Cursor c = getReadableDb().rawQuery("SELECT * FROM " + PEOPLE_TABLE + " WHERE local_blog_id=? ORDER BY lower(display_name), lower(user_name)", args); try { while (c.moveToNext()) { Person person = getPersonFromCursor(c, localTableBlogId); people.add(person); } return people; } finally { SqlUtils.closeCursor(c); } }
Source:
static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.v1_1.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final org.kie.dmn.model.api.DMNExternalLink el : source.getExtensionElements().getExternalLinks()) { final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getLinkDescription()); external.setUrl(el.getURL()); target.getLinksHolder().getValue().addLink(external); } } }

Target:
static void loadExternalLinksFromExtensionElements(final org.kie.dmn.model.api.DRGElement source, final org.kie.workbench.common.dmn.api.definition.v1_1.DRGElement target) { if (!Objects.isNull(source.getExtensionElements())) { for (final Object obj : source.getExtensionElements().getAny()) { if (obj instanceof ExternalLink) { final ExternalLink el = (ExternalLink) obj; final DMNExternalLink external = new DMNExternalLink(); external.setDescription(el.getName()); external.setUrl(el.getUrl()); target.getLinksHolder().getValue().addLink(external); } } } }
Source:
public MemoryDataFragment( @JsonProperty("hostAddress") HostAddress hostAddress, @JsonProperty("rows") long rows) { this.hostAddress = requireNonNull(hostAddress, "hostAddress is null"); this.rows = rows; }

Target:
public MemoryDataFragment( @JsonProperty("hostAddress") HostAddress hostAddress, @JsonProperty("rows") long rows) { this.hostAddress = requireNonNull(hostAddress, "hostAddress is null"); checkArgument(rows >= 0, "Rows number can not be negative"); this.rows = rows; }
Source:
private static String getUrl(Class<?> idc, ImageDescriptor imageDescriptor) { try { if (urlField == null) { urlField = idc.getDeclaredField("url"); urlField.setAccessible(true); } return (String) urlField.get(imageDescriptor); } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } return null; }

Target:
private static String getUrl(Class<?> idc, ImageDescriptor imageDescriptor) { try { if (urlField == null) { urlField = idc.getDeclaredField("url"); urlField.setAccessible(true); } Object value = urlField.get(imageDescriptor); if (value instanceof URL) { return ((URL) value).toExternalForm(); } return value.toString(); } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } return null; }