auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
synchronized void addNavigableObjects(Map<Integer, RegistryObject> associatedObjects) { Map<Integer, RegistryObject> result = new HashMap<>(); for (RegistryObject object : associatedObjects.values()) { if (object instanceof Extension) { ExtensionPoint extPoint = getExtensionPointObject(((Extension) object).getExtensionPointIdentifier()); if (extPoint == null) continue; Integer extPointIndex = Integer.valueOf(extPoint.getKeyHashCode()); if (!associatedObjects.containsKey(extPointIndex)) result.put(Integer.valueOf(extPoint.getKeyHashCode()), extPoint); for (int extension2 : extPoint.getRawChildren()) { Extension tmp = (Extension) basicGetObject(extension2, RegistryObjectManager.EXTENSION); if (tmp == null) continue; Integer extensionIndex = Integer.valueOf(extension2); if (!associatedObjects.containsKey(extensionIndex)) { result.put(extensionIndex, tmp); collectChildren(tmp, 0, result); } } } else if (object instanceof ExtensionPoint) { Map<String, int[]> orphans = getOrphans(); String name = ((ExtensionPoint) object).getUniqueIdentifier(); int[] extensions = orphans.get(name); if (extensions != null) { for (int extension2 : extensions) { Extension tmp = (Extension) basicGetObject(extension2, RegistryObjectManager.EXTENSION); if (tmp == null) continue; Integer extensionIndex = Integer.valueOf(extension2); if (!associatedObjects.containsKey(extensionIndex)) { result.put(extensionIndex, tmp); collectChildren(tmp, 0, result); } } } } } associatedObjects.putAll(result); }

Target:
synchronized void addNavigableObjects(Map<Integer, RegistryObject> associatedObjects) { Map<Integer, RegistryObject> result = new HashMap<>(); for (RegistryObject object : associatedObjects.values()) { if (object instanceof Extension) { ExtensionPoint extPoint = getExtensionPointObject(((Extension) object).getExtensionPointIdentifier()); if (extPoint == null) continue; Integer extPointIndex = Integer.valueOf(extPoint.getKeyHashCode()); if (!associatedObjects.containsKey(extPointIndex)) result.put(Integer.valueOf(extPoint.getKeyHashCode()), extPoint); for (int childId : extPoint.getRawChildren()) { Extension tmp = (Extension) basicGetObject(childId, RegistryObjectManager.EXTENSION); if (tmp == null) continue; Integer extensionIndex = Integer.valueOf(childId); if (!associatedObjects.containsKey(extensionIndex)) { result.put(extensionIndex, tmp); collectChildren(tmp, 0, result); } } } else if (object instanceof ExtensionPoint) { Map<String, int[]> orphans = getOrphans(); String name = ((ExtensionPoint) object).getUniqueIdentifier(); int[] extensions = orphans.get(name); if (extensions != null) { for (int orphanId : extensions) { Extension tmp = (Extension) basicGetObject(orphanId, RegistryObjectManager.EXTENSION); if (tmp == null) continue; Integer extensionIndex = Integer.valueOf(orphanId); if (!associatedObjects.containsKey(extensionIndex)) { result.put(extensionIndex, tmp); collectChildren(tmp, 0, result); } } } } } associatedObjects.putAll(result); }
Source:
public void setAttribute(Object entity, Attribute attribute, RequestScope scope) { DataStoreTransaction transaction = getTransaction(getType(entity.getClass())); transaction.setAttribute(entity, attribute, scope); }

Target:
public void setAttribute(Object entity, Attribute attribute, RequestScope scope) { DataStoreTransaction transaction = getTransaction(EntityDictionary.getType(entity)); transaction.setAttribute(entity, attribute, scope); }
Source:
public ModelProvider[] getEnabledModelProviders() { boolean addGitProvider = true; List<ModelProvider> providers = new ArrayList<ModelProvider>(); boolean includeResourceModel = includeResourceModelProvider(); ModelProvider[] enabledProviders = super.getEnabledModelProviders(); for (ModelProvider provider : enabledProviders) { String providerId = provider.getId(); if (!providerId.equals(WORKSPACE_MODEL_PROVIDER) || includeResourceModel) providers.add(provider); if (addGitProvider && providerId.equals(GitChangeSetModelProvider.ID)) addGitProvider = false; } if (addGitProvider) providers.add(GitChangeSetModelProvider.getProvider()); return providers.toArray(new ModelProvider[providers.size()]); }

Target:
public ModelProvider[] getEnabledModelProviders() { List<ModelProvider> providers = new ArrayList<ModelProvider>(); if (!includeResourceModelProvider()) providers.add(GitChangeSetModelProvider.getProvider()); else { boolean addGitProvider = true; ModelProvider[] enabledProviders = super.getEnabledModelProviders(); for (ModelProvider provider : enabledProviders) { String providerId = provider.getId(); providers.add(provider); if (addGitProvider && providerId.equals(GitChangeSetModelProvider.ID)) addGitProvider = false; } if (addGitProvider) providers.add(GitChangeSetModelProvider.getProvider()); } return providers.toArray(new ModelProvider[providers.size()]); }
Source:
private void read(final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) { this.findAssets(); JsonArray request; try { request = getRequestJsonArray(reqPayload); } catch (Exception e) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } ChannelOperationResponse response; if (request == null || request.size() == 0) { response = readAllAssets(respPayload); } else { List<ReadRequest> readRequests; try { readRequests = ReadRequest.parseAll(request); } catch (Exception e) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } response = new ChannelOperationResponse(); for (ReadRequest readRequest : readRequests) { readAsset(readRequest.getAssetName(), readRequest.getChannelNames(), response); } } respPayload.setBody(response.getSerialized().toString().getBytes(StandardCharsets.UTF_8)); respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK); }

Target:
private void read(final KuraRequestPayload reqPayload, final KuraResponsePayload respPayload) { this.findAssets(); JsonArray request; try { request = parseRequest(reqPayload); } catch (Exception e) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } ChannelOperationResponse response; if (request == null || request.isEmpty()) { response = readAllAssets(respPayload); } else { List<ReadRequest> readRequests; try { readRequests = ReadRequest.parseAll(request); } catch (Exception e) { respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_BAD_REQUEST); return; } response = new ChannelOperationResponse(); for (ReadRequest readRequest : readRequests) { readAsset(readRequest.getAssetName(), readRequest.getChannelNames(), response); } } respPayload.setBody(response.serialize()); respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK); }
Source:
public int getHeightInt() { try { return Integer.parseInt(mHeight); } catch (NumberFormatException ex) { return 0; } }

Target:
public int getHeightInt() { return StringUtils.stringToInt(mHeight); }
Source:
public void publish(Object event, Configuration conf) { for(int i=0; i<this.publishers.length; i++) { try{ this.publishers[i].publish(event, conf); }catch(Exception e){ LOG.warn("Could not post event to " + this.publishers[i].getClass().getName()); } } }

Target:
public void publish(Object event, Configuration conf) { for(int i=0; i<this.publishers.length; i++) { try{ this.publishers[i].publish(event, conf); }catch(Exception e){ LOG.warn("Could not post event to {}", this.publishers[i].getClass().getName()); } } }
Source:
public void populate(ContentValues contentValues, Column column, T value) { if (value != null) { ColumnDataType dataType = column.getSpec().getDataType(); String stringValue = String.valueOf(value.getMappedValue()); if (dataType == ColumnDataType.TEXT) { contentValues.put(column.getName(), stringValue); } else if (dataType == ColumnDataType.INTEGER) { contentValues.put(column.getName(), Integer.valueOf(stringValue)); } } else { contentValues.putNull(column.getName()); } }

Target:
public void populate(ContentValues contentValues, Column column, T value) { if (value != null) { ColumnDataType dataType = column.getSpec().getDataType(); String stringValue = String.valueOf(value.getMappedValue()); if (dataType == ColumnDataType.TEXT) { contentValues.put(column.getName(), stringValue); } else if (dataType == ColumnDataType.INTEGER) { contentValues.put(column.getName(), Integer.valueOf(stringValue)); } else { throw new IllegalStateException("Mapped Enum are only supported for INTEGER or TEXT columns. Cannot" + " populate Enum value " + value + " into column of type " + dataType); } } else { contentValues.putNull(column.getName()); } }
Source:
AdapterUnifiedNativeAdMapper(final Context context, @NonNull final NativeAd nativeAd) { this.context = context; verizonAd = nativeAd; JSONObject titleJSON = nativeAd.getJSON("title"); if (titleJSON != null) { setHeadline(titleJSON.optString("data")); } JSONObject bodyJSON = nativeAd.getJSON("body"); if (bodyJSON != null) { setBody(bodyJSON.optString("data")); } JSONObject callToActionJSON = nativeAd.getJSON("callToAction"); if (callToActionJSON != null) { setCallToAction(callToActionJSON.optString("data")); } JSONObject disclaimerJSON = nativeAd.getJSON("disclaimer"); if (disclaimerJSON != null) { setAdvertiser(disclaimerJSON.optString("data")); } JSONObject ratingJSON = nativeAd.getJSON("rating"); if (ratingJSON != null) { String ratingString = ratingJSON.optString("data"); if (ratingString != null) { String[] ratingArray = ratingString.trim().split("\\s+"); if (ratingArray.length >= 1) { try { Double rating = Double.parseDouble(ratingArray[0]); setStarRating(rating); } catch (NumberFormatException e) { } } } } JSONObject iconImageJSON = nativeAd.getJSON("iconImage"); if (iconImageJSON != null) { setIcon(mappedImageFromJSON(iconImageJSON)); } JSONObject mainImageJSON = nativeAd.getJSON("mainImage"); if (mainImageJSON != null) { List<com.google.android.gms.ads.formats.NativeAd.Image> imagesList = new ArrayList<>(); imagesList.add(mappedImageFromJSON(mainImageJSON)); setImages(imagesList); } }

Target:
AdapterUnifiedNativeAdMapper(final Context context, @NonNull final NativeAd nativeAd) { this.context = context; verizonAd = nativeAd; setHeadline(parseTextComponent("title", nativeAd)); setBody(parseTextComponent("body", nativeAd)); setCallToAction(parseTextComponent("callToAction", nativeAd)); setAdvertiser(parseTextComponent("disclaimer", nativeAd)); String ratingString = parseTextComponent("rating", nativeAd); if (!TextUtils.isEmpty(ratingString)) { String[] ratingArray = ratingString.trim().split("\\s+"); if (ratingArray.length >= 1) { try { Double rating = Double.parseDouble(ratingArray[0]); setStarRating(rating); } catch (NumberFormatException e) { } } } }
Source:
public void checkForRecursiveHTTPImports(String content, Set<String> currentFileImports) throws IOException { String[] lines = StringUtils.split(content, '\n'); for (String line : lines) { Matcher m = IMPORT_PATTERN.matcher(line); while (m.find()) { String match = m.group(1); if (match.startsWith("http://") || match.startsWith("https://")) { System.out.println("Found match: " + match); if (currentFileImports.contains(match)) { throw new CustomWebApplicationException("Error parsing workflow. You may have a recursive import.", HttpStatus.SC_BAD_REQUEST); } else { System.out.println("New match: " + match); currentFileImports.add(match); URL url = new URL(match); String s = IOUtils.toString(url, StandardCharsets.UTF_8); checkForRecursiveHTTPImports(s, currentFileImports); } currentFileImports.add(match.replaceFirst("file://", "")); } } } }

Target:
public void checkForRecursiveHTTPImports(String content, Set<String> currentFileImports) throws IOException { String[] lines = StringUtils.split(content, '\n'); for (String line : lines) { Matcher m = IMPORT_PATTERN.matcher(line); while (m.find()) { String match = m.group(1); if (match.startsWith("http://") || match.startsWith("https://")) { if (currentFileImports.contains(match)) { throw new CustomWebApplicationException("Error parsing workflow. You may have a recursive import.", HttpStatus.SC_BAD_REQUEST); } else { currentFileImports.add(match); URL url = new URL(match); try (InputStream is = url.openStream()) { BoundedInputStream boundedInputStream = new BoundedInputStream(is, FileUtils.ONE_MB); String fileContents = IOUtils.toString(boundedInputStream, StandardCharsets.UTF_8); checkForRecursiveHTTPImports(fileContents, currentFileImports); } } currentFileImports.add(match); } } } }
Source:
public Map<String, Map<String, String>> readContainerLocality() { Map<String, Map<String, String>> allMappings = new HashMap<>(); metadataStore.all().forEach((keyBytes, valueBytes) -> { if (valueBytes != null) { String locationId = valueSerde.fromBytes(valueBytes); allMappings.put(keySerde.fromBytes(keyBytes), ImmutableMap.of(SetContainerHostMapping.HOST_KEY, locationId, SetContainerHostMapping.JMX_TUNNELING_URL_KEY, "", SetContainerHostMapping.JMX_URL_KEY, "")); } }); containerToHostMapping = allMappings; if (LOG.isDebugEnabled()) { for (Map.Entry<String, Map<String, String>> entry : containerToHostMapping.entrySet()) { LOG.debug(String.format("Locality for container %s: %s", entry.getKey(), entry.getValue())); } } return Collections.unmodifiableMap(allMappings); }

Target:
public Map<String, Map<String, String>> readContainerLocality() { Map<String, Map<String, String>> allMappings = new HashMap<>(); metadataStore.all().forEach((keyBytes, valueBytes) -> { if (valueBytes != null) { String locationId = valueSerde.fromBytes(valueBytes); allMappings.put(keySerde.fromBytes(keyBytes), ImmutableMap.of(SetContainerHostMapping.HOST_KEY, locationId)); } }); if (LOG.isDebugEnabled()) { for (Map.Entry<String, Map<String, String>> entry : allMappings.entrySet()) { LOG.debug(String.format("Locality for container %s: %s", entry.getKey(), entry.getValue())); } } return Collections.unmodifiableMap(allMappings); }
Source:
public Matrix rotate() { double[][] rotatedMatrix = new double[this.columns()][this.rows()]; for (int i = 0; i < this.rows(); i++) { for (int j = 0; j < this.columns(); j++) { rotatedMatrix[j][this.rows()-1-i] = this.get(i, j); } } return factory.createMatrix(rotatedMatrix); }

Target:
public Matrix rotate() { return self.rotate(factory); }
Source:
public List<DeprecatedRuleKeyDto> selectAllDeprecatedRuleKeys(DbSession session) { return mapper(session).selectAllDeprecatedRuleKeys(); }

Target:
public Set<DeprecatedRuleKeyDto> selectAllDeprecatedRuleKeys(DbSession session) { return mapper(session).selectAllDeprecatedRuleKeys(); }
Source:
public void flush() { BufferedReader in = new BufferedReader(new StringReader(getBuffer().toString())); while (true) { try { String line = in.readLine(); if (line == null) { break; } if (logger.isInfoEnabled()) { logger.info(line); } } catch (IOException e) { throw new Error(e); } } getBuffer().setLength(0); }

Target:
public void flush() { BufferedReader in = new BufferedReader(new StringReader(getBuffer().toString())); while (true) { try { String line = in.readLine(); if (line == null) { break; } logger.info(line); } catch (IOException e) { throw new Error(e); } } getBuffer().setLength(0); }
Source:
private void initializeLegendFields() { this.removeAll(); JPanel glob = new JPanel(); GridBagLayout grid = new GridBagLayout(); glob.setLayout(grid); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; JPanel p1 = getLineBlock(uniqueArea.getPenStroke(), "Line configuration"); glob.add(p1, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(5, 0, 5, 0); ConstantSolidFill leg = uniqueArea.getFillLegend(); JPanel p2 = getAreaBlock(leg, "Fill configuration"); setAreaFieldsState(leg instanceof ConstantSolidFillLegend); glob.add(p2, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; glob.add(getPreview(), gbc); this.add(glob); }

Target:
private void initializeLegendFields() { this.removeAll(); JPanel glob = new JPanel(); GridBagLayout grid = new GridBagLayout(); glob.setLayout(grid); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; JPanel p1 = getLineBlock(uniqueArea.getPenStroke(), I18N.tr("Line configuration")); glob.add(p1, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(5, 0, 5, 0); ConstantSolidFill leg = uniqueArea.getFillLegend(); JPanel p2 = getAreaBlock(leg, I18N.tr("Fill configuration")); setAreaFieldsState(leg instanceof ConstantSolidFillLegend); glob.add(p2, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; glob.add(getPreview(), gbc); this.add(glob); }
Source:
public void close(final long timeoutMs) throws InterruptedException, TimeoutException, ExecutionException { final Future result = Executors.newSingleThreadExecutor().submit(() -> { for (int i = 0; i < numThreads; i++) { threads[i].startClose(); } retryThread.startClose(); for (int i = 0; i < numThreads; i++) { threads[i].waitForClose(); } retryThread.waitForClose(); } ); result.get(timeoutMs, TimeUnit.MILLISECONDS); }

Target:
public void close(final long timeoutMs) throws InterruptedException, TimeoutException, ExecutionException { final Future result = Executors.newSingleThreadExecutor().submit(() -> { for (int i = 0; i < numWorkerThreads; i++) { workerThreads[i].startClose(); } retryThread.startClose(); for (int i = 0; i < numWorkerThreads; i++) { workerThreads[i].waitForClose(); } retryThread.waitForClose(); } ); result.get(timeoutMs, TimeUnit.MILLISECONDS); }
Source:
public Connector create(String connectorId, Map<String, String> requiredConfig, ConnectorContext context) { requireNonNull(requiredConfig, "requiredConfig is null"); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(this.classLoader)) { Bootstrap app = new Bootstrap(new SqlServerClientModule(connectorId)); Injector injector = app .strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(requiredConfig) .initialize(); return injector.getInstance(JdbcConnector.class); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public Connector create(String connectorId, Map<String, String> requiredConfig, ConnectorContext context) { checkArgument(!isNullOrEmpty(connectorId), "name is null or empty"); requireNonNull(requiredConfig, "requiredConfig is null"); requireNonNull(context, "context is null"); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { Bootstrap app = new Bootstrap(new SqlServerClientModule(connectorId)); Injector injector = app .strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(requiredConfig) .initialize(); return injector.getInstance(JdbcConnector.class); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public Map<String, Double> getAllSubjectCounts(String journalKey) throws IOException { String facet = "subject_facet"; List<NameValuePair> params = setCommonCategoryParams(journalKey, facet); Map<String, Double> categoryCountMap = new HashMap<>(); Map<?, ?> resultsMap = executeFacetedQuery(params, facet); for (Object o : resultsMap.keySet()) { categoryCountMap.put(o.toString(), (Double) resultsMap.get(o)); } return categoryCountMap; }

Target:
public Collection<SubjectCount> getAllSubjectCounts(String journalKey) throws IOException { String facet = "subject_facet"; List<NameValuePair> params = setCommonCategoryParams(journalKey, facet); Map<?, ?> resultsMap = executeFacetedQuery(params, facet); return resultsMap.entrySet().stream() .map((Map.Entry<?, ?> entry) -> new SubjectCount((String) entry.getKey(), ((Double) entry.getValue()).longValue())).collect(Collectors.toList()); }
Source:
public void testQueryExecutionTimeLimit() throws Exception { Session session = testSessionBuilder() .setCatalog("tpch") .setSchema("sf100000") .setSource("dashboard") .setSystemProperty(QUERY_MAX_EXECUTION_TIME, "1ms") .build(); QueryManager queryManager = queryRunner.getCoordinator().getQueryManager(); InternalResourceGroupManager manager = queryRunner.getCoordinator().getResourceGroupManager().get(); DbResourceGroupConfigurationManager dbConfigurationManager = (DbResourceGroupConfigurationManager) manager.getConfigurationManager(); QueryId query = createQuery(queryRunner, session, LONG_LASTING_QUERY); waitForQueryState(queryRunner, query, FAILED); assertEquals(queryManager.getQueryInfo(query).getErrorCode(), EXCEEDED_TIME_LIMIT.toErrorCode()); assertContains(queryManager.getQueryInfo(query).getFailureInfo().getMessage(), "Query exceeded the maximum execution time limit of 1.00ms"); dao.updateResourceGroup(5, "dashboard-${USER}", "1MB", 1, 0, null, null, null, null, null, null, null, 3L); dbConfigurationManager.load(); QueryId secondQuery = createQuery(queryRunner, session, LONG_LASTING_QUERY); waitForQueryState(queryRunner, secondQuery, QUEUED); Thread.sleep(5_000); assertEquals(queryManager.getQueryInfo(secondQuery).getState(), QUEUED); }

Target:
public void testQueryExecutionTimeLimit() throws Exception { Session session = testSessionBuilder() .setCatalog("tpch") .setSchema("sf100000") .setSource("dashboard") .setSystemProperty(QUERY_MAX_EXECUTION_TIME, "1ms") .build(); QueryManager queryManager = queryRunner.getCoordinator().getQueryManager(); InternalResourceGroupManager manager = queryRunner.getCoordinator().getResourceGroupManager().get(); DbResourceGroupConfigurationManager dbConfigurationManager = (DbResourceGroupConfigurationManager) manager.getConfigurationManager(); QueryId firstQuery = createQuery(queryRunner, session, LONG_LASTING_QUERY); waitForQueryState(queryRunner, firstQuery, FAILED); assertEquals(queryManager.getQueryInfo(firstQuery).getErrorCode(), EXCEEDED_TIME_LIMIT.toErrorCode()); assertContains(queryManager.getQueryInfo(firstQuery).getFailureInfo().getMessage(), "Query exceeded the maximum execution time limit of 1.00ms"); dao.updateResourceGroup(5, "dashboard-${USER}", "1MB", 1, 0, null, null, null, null, null, null, null, 3L); dbConfigurationManager.load(); QueryId secondQuery = createQuery(queryRunner, session, LONG_LASTING_QUERY); waitForQueryState(queryRunner, secondQuery, QUEUED); Thread.sleep(5_000); assertEquals(queryManager.getQueryInfo(secondQuery).getState(), QUEUED); dao.updateResourceGroup(5, "dashboard-${USER}", "1MB", 1, 1, null, null, null, null, null, null, null, 3L); dbConfigurationManager.load(); queryManager.cancelQuery(firstQuery); waitForQueryState(queryRunner, secondQuery, FAILED); }
Source:
public void decrementRemainFiles(FileRegion filePart, long fileStartTime) { long fileSendTime = System.currentTimeMillis() - fileStartTime; if (fileSendTime > maxTime) { maxTime = fileSendTime; } if (fileSendTime < minTime) { minTime = fileSendTime; } if (fileSendTime > 20 * 1000) { LOG.warn("PullServer send too long time: filePos:" + filePart.position() + ", fileLen:" + filePart.count() + ", URI:" + requestUri); SLOW_FILE_UPDATER.compareAndSet(this, numSlowFile, numSlowFile + 1); } REMAIN_FILE_UPDATER.compareAndSet(this, remainFiles, remainFiles - 1); if (REMAIN_FILE_UPDATER.get(this) <= 0) { processingStatusMap.remove(requestUri); if(LOG.isDebugEnabled()) { LOG.debug("PullServer processing status: totalTime=" + (System.currentTimeMillis() - startTime) + " ms, " + "makeFileListTime=" + makeFileListTime + " ms, minTime=" + minTime + " ms, maxTime=" + maxTime + " ms, " + "numFiles=" + numFiles + ", numSlowFile=" + numSlowFile); } } }

Target:
public void decrementRemainFiles(FileRegion filePart, long fileStartTime) { long fileSendTime = System.currentTimeMillis() - fileStartTime; if (fileSendTime > maxTime) { maxTime = fileSendTime; } if (fileSendTime < minTime) { minTime = fileSendTime; } if (fileSendTime > 20 * 1000) { LOG.warn("Sending data takes too long. " + fileSendTime + "ms elapsed, " + "length:" + (filePart.count() - filePart.position()) + ", URI:" + requestUri); SLOW_FILE_UPDATER.compareAndSet(this, numSlowFile, numSlowFile + 1); } REMAIN_FILE_UPDATER.compareAndSet(this, remainFiles, remainFiles - 1); if (REMAIN_FILE_UPDATER.get(this) <= 0) { processingStatusMap.remove(requestUri); if(LOG.isDebugEnabled()) { LOG.debug("PullServer processing status: totalTime=" + (System.currentTimeMillis() - startTime) + " ms, " + "makeFileListTime=" + makeFileListTime + " ms, minTime=" + minTime + " ms, maxTime=" + maxTime + " ms, " + "numFiles=" + numFiles + ", numSlowFile=" + numSlowFile); } } }
Source:
public void setErrorMessage(String text) { if (text.contains("http://")) { int urlIndex = text.indexOf(("http://")); String beforeURL = text.substring(0, urlIndex); String url = text.substring(urlIndex); StringBuilder htmlPart = new StringBuilder(); htmlPart.append(beforeURL).append("<a href=\"").append(url).append("\">").append(url).append("</a>"); errorMessage.getElement().setInnerHTML(htmlPart.toString()); } else { errorMessage.setText(text); } errorMessage.setVisible(text != null); if (errorMessage.isVisible()) { errorMessagePanel.setVisible(true); } }

Target:
public void setErrorMessage(String text) { setErrorMessageText(errorMessage, text); errorMessage.setVisible(text != null); if (errorMessage.isVisible()) { errorMessagePanel.setVisible(true); } }
Source:
public List<GwtModemPdpEntry> findPdpContextInfo(GwtXSRFToken xsrfToken, String interfaceName) throws GwtKuraException { checkXSRFToken(xsrfToken); List<GwtModemPdpEntry> gwtModemPdpEntries = new ArrayList<>(); ModemManagerService mms = ServiceLocator.getInstance().getService(ModemManagerService.class); CellularModem modem = getModemService(interfaceName, mms); if (modem == null) { return gwtModemPdpEntries; } try { List<ModemPdpContext> pdpContextInfo = modem.getPdpContextInfo(); GwtModemPdpEntry gwtModemPdpEntry; int contextNo = 1; for (ModemPdpContext pdpContextEntry : pdpContextInfo) { gwtModemPdpEntry = new GwtModemPdpEntry(); gwtModemPdpEntry.setContextNumber(pdpContextEntry.getNumber()); gwtModemPdpEntry.setPdpType(pdpContextEntry.getType().getValue()); gwtModemPdpEntry.setApn(pdpContextEntry.getApn()); gwtModemPdpEntries.add(gwtModemPdpEntry); contextNo++; } gwtModemPdpEntry = new GwtModemPdpEntry(); gwtModemPdpEntry.setContextNumber(contextNo); gwtModemPdpEntry.setPdpType(ModemPdpContextType.IP.getValue()); gwtModemPdpEntry.setApn("Enter your Access Point Name"); gwtModemPdpEntries.add(gwtModemPdpEntry); } catch (KuraException e) { throw new GwtKuraException(GwtKuraErrorCode.INTERNAL_ERROR, e); } return gwtModemPdpEntries; }

Target:
public List<GwtModemPdpEntry> findPdpContextInfo(GwtXSRFToken xsrfToken, String interfaceName) throws GwtKuraException { checkXSRFToken(xsrfToken); List<GwtModemPdpEntry> gwtModemPdpEntries = new ArrayList<>(); ModemManagerService mms = ServiceLocator.getInstance().getService(ModemManagerService.class); CellularModem modem = getModemService(interfaceName, mms); if (modem == null) { return gwtModemPdpEntries; } try { List<ModemPdpContext> pdpContextInfo = modem.getPdpContextInfo(); GwtModemPdpEntry gwtModemPdpEntry; int contextInd = 1; int firstAvailableContextNum = 0; for (ModemPdpContext pdpContextEntry : pdpContextInfo) { gwtModemPdpEntry = new GwtModemPdpEntry(); gwtModemPdpEntry.setContextNumber(pdpContextEntry.getNumber()); gwtModemPdpEntry.setPdpType(pdpContextEntry.getType().getValue()); gwtModemPdpEntry.setApn(pdpContextEntry.getApn()); gwtModemPdpEntries.add(gwtModemPdpEntry); if (firstAvailableContextNum == 0 && contextInd < pdpContextEntry.getNumber()) { firstAvailableContextNum = contextInd; } contextInd++; } if (firstAvailableContextNum == 0) { firstAvailableContextNum = contextInd; } gwtModemPdpEntry = new GwtModemPdpEntry(); gwtModemPdpEntry.setContextNumber(firstAvailableContextNum); gwtModemPdpEntry.setPdpType(ModemPdpContextType.IP.getValue()); gwtModemPdpEntry.setApn("Please provide APN for this new PDP context ..."); gwtModemPdpEntries.add(gwtModemPdpEntry); } catch (KuraException e) { throw new GwtKuraException(GwtKuraErrorCode.WARNING, e); } return gwtModemPdpEntries; }
Source:
public void testPutNodeReferenceString() { for (Storage storage : TestConfig.STORAGES_TO_TEST_AGAINST) { storage.createNode().put(Mods.NAME, "Wilhelm Busch"); } }

Target:
public void testPutNodeReferenceString() { for (Storage storage : TestConfig.STORAGES_TO_TEST_AGAINST) { storage.createNode().put(MODS_NAME, "Wilhelm Busch"); } }
Source:
Optional<MetricPusherCreator> create(Map<String, String> parameters) { Supplier<MetricPusherCreator> metricPusherCreatorSupplier = () -> { try { return (MetricPusherCreator) Class.forName(parameters.get(METRIC_PUSHER_CREATOR_CLASS_NAME)) .getConstructor().newInstance(); } catch (Exception e) { logger.error("MetricPusherCreator creation failed."); e.printStackTrace(); return null; } }; return create(metricPusherCreatorSupplier); }

Target:
Optional<MetricPusherCreator> create(Map<String, String> parameters) { Supplier<MetricPusherCreator> metricPusherCreatorSupplier = () -> { try { return (MetricPusherCreator) Class.forName(parameters.get(METRIC_PUSHER_CREATOR_CLASS_NAME)) .getConstructor().newInstance(); } catch (Exception e) { logger.error("MetricPusherCreator creation failed.", e); return null; } }; return create(metricPusherCreatorSupplier); }
Source:
public static String formatPocketQueryInfo(PocketQuery pocketQuery) { if (!pocketQuery.isDownloadable()) { return StringUtils.EMPTY; } final List<String> infos = new ArrayList<>(3); final int caches = pocketQuery.getCaches(); infos.add(caches >= 0 ? CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.cache_counts, caches, caches) : StringUtils.EMPTY); infos.add(pocketQuery.getLastGeneration() != null ? Formatter.formatShortDateVerbally(pocketQuery.getLastGeneration().getTime()) : StringUtils.EMPTY); final int daysRemaining = pocketQuery.getDaysRemaining(); if (daysRemaining == 0) { infos.add(CgeoApplication.getInstance().getString(R.string.last_day_available)); } else { infos.add(daysRemaining > 0 ? CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.days_remaining, daysRemaining, daysRemaining) : StringUtils.EMPTY); } return StringUtils.join(infos, SEPARATOR); }

Target:
public static String formatPocketQueryInfo(PocketQuery pocketQuery) { if (!pocketQuery.isDownloadable()) { return StringUtils.EMPTY; } final List<String> infos = new ArrayList<>(3); final int caches = pocketQuery.getCaches(); if (caches >= 0) { infos.add(CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.cache_counts, caches, caches)); } if (pocketQuery.getLastGeneration() != null) { infos.add(Formatter.formatShortDateVerbally(pocketQuery.getLastGeneration().getTime())); } final int daysRemaining = pocketQuery.getDaysRemaining(); if (daysRemaining == 0) { infos.add(CgeoApplication.getInstance().getString(R.string.last_day_available)); } else { infos.add(daysRemaining > 0 ? CgeoApplication.getInstance().getResources().getQuantityString(R.plurals.days_remaining, daysRemaining, daysRemaining) : StringUtils.EMPTY); } return StringUtils.join(infos, SEPARATOR); }
Source:
protected void firePropertyChangedEvent(final PropertyChangeEvent event) { Object[] allListeners; synchronized(listeners) { allListeners = listeners.getListeners(); } for (Object allListener : allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener) allListener; SafeRunner.run(new SafeRunnable() { @Override public void run() throws Exception { listener.propertyChange(event); } }); } }

Target:
protected void firePropertyChangedEvent(final PropertyChangeEvent event) { Object[] allListeners; synchronized(listeners) { allListeners = listeners.getListeners(); } for (Object l : allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener)l; SafeRunner.run(new SafeRunnable() { @Override public void run() throws Exception { listener.propertyChange(event); } }); } }
Source:
private int getLineOffset(int widgetLineIndex) throws BadLocationException { if (!isFixedWidth()) { return document.getLineOffset(widgetLineIndex); } else { if (widgetLineIndex < 0 || widgetLineIndex >= widgetLines) { throw new BadLocationException(); } return widgetLineOffsets[widgetLineIndex]; } }

Target:
private int getLineOffset(int widgetLineIndex) throws BadLocationException { if (!isFixedWidth()) { return document.getLineOffset(widgetLineIndex); } else { if (widgetLineIndex < 0 || widgetLineIndex >= widgetLines) { throw new BadLocationException(widgetLineIndex + " is not a valid line index."); } return widgetLineOffsets[widgetLineIndex]; } }
Source:
private CopyRatioDataCollection(final SegmentedModel segmentedModel) { if (segmentedModel.getGenome().getTargets().targetCount() == 0) { throw new IllegalArgumentException("Cannot construct CopyRatioDataCollection with no target-coverage data."); } final TargetCollection<ReadCountRecord.SingletonRecord> targetCoverages = segmentedModel.getGenome().getTargets(); final List<Double> coverages = segmentedModel.getSegments().stream() .flatMap(s -> targetCoverages.targets(s).stream()) .map(ReadCountRecord.SingletonRecord::getCount) .collect(Collectors.toList()); numTargetsPerSegment = segmentedModel.getSegments().stream() .map(s -> targetCoverages.targets(s).size()) .collect(Collectors.toList()); numSegments = numTargetsPerSegment.size(); numTargets = coverages.size(); coverageRange = Collections.max(coverages) - Collections.min(coverages); int startTarget = 0; for (int segment = 0; segment < numSegments; segment++) { startTargetsPerSegment.add(startTarget); final int numTargetsInSegment = numTargetsPerSegment.get(segment); coveragesPerSegment.add(coverages.subList(startTarget, startTarget + numTargetsInSegment)); startTarget += numTargetsInSegment; } }

Target:
private CopyRatioDataCollection(final SegmentedModel segmentedModel) { if (segmentedModel.getGenome().getTargets().targetCount() == 0) { throw new IllegalArgumentException("Cannot construct CopyRatioDataCollection with no target-coverage data."); } final TargetCollection<ReadCountRecord.SingleSampleRecord> targetCoverages = segmentedModel.getGenome().getTargets(); final List<Double> coverages = segmentedModel.getSegments().stream() .flatMap(s -> targetCoverages.targets(s).stream()) .map(ReadCountRecord.SingleSampleRecord::getCount) .collect(Collectors.toList()); numTargetsPerSegment = segmentedModel.getSegments().stream() .map(s -> targetCoverages.targets(s).size()) .collect(Collectors.toList()); numSegments = numTargetsPerSegment.size(); numTargets = coverages.size(); coverageRange = Collections.max(coverages) - Collections.min(coverages); int startTarget = 0; for (int segment = 0; segment < numSegments; segment++) { startTargetsPerSegment.add(startTarget); final int numTargetsInSegment = numTargetsPerSegment.get(segment); coveragesPerSegment.add(coverages.subList(startTarget, startTarget + numTargetsInSegment)); startTarget += numTargetsInSegment; } }
Source:
public void beforeExam() throws Exception { getCatalogBundle().setupMaxDownloadRetryAttempts(MAX_DOWNLOAD_RETRY_ATTEMPTS); setupOpenSearch(); setupCswServer(); setupGmd(); getCatalogBundle().waitForFederatedSource(OPENSEARCH_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_STUB_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_SOURCE_WITH_METACARD_XML_ID); getCatalogBundle().waitForFederatedSource(GMD_SOURCE_ID); getServiceManager() .waitForSourcesToBeAvailable( REST_PATH.getUrl(), OPENSEARCH_SOURCE_ID, CSW_STUB_SOURCE_ID, CSW_SOURCE_ID, CSW_SOURCE_WITH_METACARD_XML_ID, GMD_SOURCE_ID); LOGGER.info("Source status: \n{}", get(REST_PATH.getUrl() + "sources").body().prettyPrint()); }

Target:
public void beforeExam() throws Exception { getCatalogBundle().setupMaxDownloadRetryAttempts(MAX_DOWNLOAD_RETRY_ATTEMPTS); setupOpenSearch(); setupCswServer(); setupGmd(); getCatalogBundle().waitForFederatedSource(OPENSEARCH_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_STUB_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_SOURCE_ID); getCatalogBundle().waitForFederatedSource(CSW_SOURCE_WITH_METACARD_XML_ID); getCatalogBundle().waitForFederatedSource(GMD_SOURCE_ID); getServiceManager() .waitForSourcesToBeAvailable( REST_PATH.getUrl(), OPENSEARCH_SOURCE_ID, CSW_STUB_SOURCE_ID, CSW_SOURCE_ID, CSW_SOURCE_WITH_METACARD_XML_ID, GMD_SOURCE_ID); getCatalogBundle().setDownloadRetryDelayInSeconds(1); getCatalogBundle().setupCaching(false); LOGGER.info("Source status: \n{}", get(REST_PATH.getUrl() + "sources").body().prettyPrint()); }
Source:
public int compareTo(@Nullable ITmfStateValue other) { if (other == null) { throw new IllegalArgumentException(); } if (other.getType() != Type.BOOLEAN) { throw new StateValueTypeException("A boolean state value cannot be compared to the type " + other.getType()); } return Boolean.compare(value, ((BooleanStateValue) other).value); }

Target:
public int compareTo(@Nullable ITmfStateValue other) { if (other == null) { throw new IllegalArgumentException("Cannot compare against null reference."); } if (other.getType() == Type.NULL) { return 1; } else if (other.getType() == Type.BOOLEAN) { return Boolean.compare(value, ((BooleanStateValue) other).value); } else { throw new StateValueTypeException("A boolean state value cannot be compared to the type " + other.getType()); } }
Source:
protected void writeScoreView() { nextSheet("Score view", 1, 3, true); nextRow(); nextHeaderCell("Score"); nextCell().setCellValue(score == null ? "Not yet solved" : score.toShortString()); nextRow(); nextRow(); nextHeaderCell("Constraint match"); nextHeaderCell("Match score"); nextHeaderCell("Total score"); if (!score.isSolutionInitialized()) { nextRow(); nextHeaderCell("Unassigned variables"); nextCell(); nextCell().setCellValue(score.getInitScore()); } for (ConstraintMatchTotal constraintMatchTotal : constraintMatchTotalList) { nextRow(); nextHeaderCell(constraintMatchTotal.getConstraintName()); nextCell(); nextCell().setCellValue(constraintMatchTotal.getScore().toShortString()); List<ConstraintMatch> constraintMatchList = new ArrayList<>(constraintMatchTotal.getConstraintMatchSet()); constraintMatchList.sort(Comparator.comparing(ConstraintMatch::getScore)); for (ConstraintMatch constraintMatch : constraintMatchList) { nextRow(); nextCell().setCellValue(" " + constraintMatch.getJustificationList().stream() .filter(o -> o instanceof Talk).map(o -> ((Talk) o).getCode()) .collect(joining(", "))); nextCell().setCellValue(constraintMatch.getScore().toShortString()); nextCell(); nextCell(); } } autoSizeColumnsWithHeader(); }

Target:
protected void writeScoreView() { nextSheet("Score view", 1, 3, true); nextRow(); nextHeaderCell("Score"); nextCell().setCellValue(score.toShortString()); nextRow(); nextRow(); nextHeaderCell("Constraint match"); nextHeaderCell("Match score"); nextHeaderCell("Total score"); if (!score.isSolutionInitialized()) { nextRow(); nextHeaderCell("Unassigned variables"); nextCell(); nextCell().setCellValue(score.getInitScore()); } for (ConstraintMatchTotal constraintMatchTotal : constraintMatchTotalList) { nextRow(); nextHeaderCell(constraintMatchTotal.getConstraintName()); nextCell(); nextCell().setCellValue(constraintMatchTotal.getScore().toShortString()); List<ConstraintMatch> constraintMatchList = new ArrayList<>(constraintMatchTotal.getConstraintMatchSet()); constraintMatchList.sort(Comparator.comparing(ConstraintMatch::getScore)); for (ConstraintMatch constraintMatch : constraintMatchList) { nextRow(); nextCell().setCellValue(" " + constraintMatch.getJustificationList().stream() .filter(o -> o instanceof Talk).map(o -> ((Talk) o).getCode()) .collect(joining(", "))); nextCell().setCellValue(constraintMatch.getScore().toShortString()); nextCell(); nextCell(); } } autoSizeColumnsWithHeader(); }
Source:
public boolean isSupported(boolean slaveMode) { if (CommandMetaData.Mode.MASTER_OR_SLAVE == this) { return true; } boolean runsWithMasterOnly = this == CommandMetaData.Mode.MASTER ? true : false; if (slaveMode ^ runsWithMasterOnly) { return true; } return false; }

Target:
public boolean isSupported(boolean slaveMode) { return this == MASTER_OR_SLAVE || !slaveMode; }
Source:
private static String getFailMessage(ProcessStatus result) { if (result instanceof ProcessStatus) { ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) return result.getMessage() + ": " + getFailMessage(firstFail); } return result.getMessage(); }

Target:
private static String getFailMessage(ProcessStatus result) { ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) return result.getMessage() + ": " + getFailMessage(firstFail); return result.getMessage(); }
Source:
void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException { ResourceLocation nameToSubstitute = new ResourceLocation(name); FMLControlledNamespacedRegistry registry = null; switch (type) { case BLOCK: registry = iBlockRegistry; break; case ITEM: registry = iItemRegistry; break; case POTION: registry = iPotionRegistry; break; case POTION_TYPE: registry = iPotionTypeRegistry; break; case BIOME: registry = iBiomeRegistry; break; case ENCHANTMENT: registry = iEnchantmentRegistry; break; case SOUND_EVENT: registry = iSoundEventRegistry; break; } if (registry != null) { registry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (IForgeRegistryEntry) toReplace); registry.activateSubstitution(nameToSubstitute); } }

Target:
void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException { ResourceLocation nameToSubstitute = new ResourceLocation(name); FMLControlledNamespacedRegistry registry=registryTypeMap.get(type); if(registry==null){ FMLLog.getLogger().log(Level.WARN,"Cannot register substitution. Registry for type %s not found",type); } else{ registry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(),nameToSubstitute, (IForgeRegistryEntry) toReplace); registry.activateSubstitution(nameToSubstitute); } }
Source:
public void InteractiveMaps_036_VerifyEmbedMapContributeModals() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = new ArticlePageObject(driver); article.openArticleByName(wikiURL, InteractiveMapsContent.embedMapArticleName); EmbedMapComponentObject embedMapDialog = article.clickViewEmbedMap(); AddPinComponentObject addPinModal = embedMapDialog.placePinInMap(); addPinModal.verifyPinTitleFieldIsDisplayed(); addPinModal.verifyDescriptionFieldIsDisplayed(); addPinModal.clickCancelButton(); embedMapDialog.clickEditPinTypesButton(); CreatePinTypesComponentObject pinTypesDialog = new CreatePinTypesComponentObject(driver); pinTypesDialog.verifyPinTypesDialog(); }

Target:
public void InteractiveMaps_036_VerifyEmbedMapContributeModals() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = new ArticlePageObject(driver); article.openArticleByName(wikiURL, InteractiveMapsContent.embedMapArticleName); EmbedMapComponentObject embedMapDialog = article.clickViewEmbedMap(); AddPinComponentObject addPinModal = embedMapDialog.placePinInMap(); addPinModal.verifyPinTitleFieldIsDisplayed(); addPinModal.verifyDescriptionFieldIsDisplayed(); addPinModal.clickCancelButton(); CreatePinTypesComponentObject pinTypesDialog = embedMapDialog.clickEditPinTypesButton(); pinTypesDialog.verifyPinTypesDialog(); }
Source:
protected String getColumnDefinition() { StringBuilder toReturn = new StringBuilder(); String constraints = extras != null ? extras.constraints() : ColumnSpec.DEFAULT_NONE; if (!ColumnSpec.DEFAULT_NONE.equals(constraints)) { toReturn.append(constraints); } if (!ColumnSpec.DEFAULT_NONE.equals(getColumnDefault())) { String columnDefaultValue = getColumnDefinitionDefaultValue(); if (!toReturn.toString().toUpperCase().contains("DEFAULT")) { toReturn.append(" DEFAULT ").append(columnDefaultValue); } else { utils.getMessager().printMessage(Kind.WARNING, "Duplicate default value definitions", field); } } if (field != null && field.getAnnotation(PrimaryKey.class) != null) { PrimaryKey primaryKeyAnnotation = field.getAnnotation(PrimaryKey.class); if (!toReturn.toString().toUpperCase().contains("PRIMARY KEY")) { toReturn.append(" PRIMARY KEY "); if (TypeConstants.isIntegerType(getTypeForAccessors()) && primaryKeyAnnotation.autoincrement()) { toReturn.append("AUTOINCREMENT"); } } else { utils.getMessager().printMessage(Kind.WARNING, "Duplicate primary key definition in column constraints." + " Use the PrimaryKey annotation instead of declaring the constraint in ColumnSpec."); } } String toReturnString = toReturn.toString().trim(); if (!AptUtils.isEmpty(toReturnString)) { return "\"" + toReturnString + "\""; } return null; }

Target:
protected String getColumnDefinition() { StringBuilder toReturn = new StringBuilder(); String constraints = extras != null ? extras.constraints() : ColumnSpec.DEFAULT_NONE; if (!ColumnSpec.DEFAULT_NONE.equals(constraints)) { toReturn.append(constraints); } if (!ColumnSpec.DEFAULT_NONE.equals(getColumnDefault())) { String columnDefaultValue = getColumnDefinitionDefaultValue(); if (!toReturn.toString().toUpperCase().contains("DEFAULT")) { toReturn.append(" DEFAULT ").append(columnDefaultValue); } else { utils.getMessager().printMessage(Kind.WARNING, "Duplicate default value definitions", field); } } if (field != null && field.getAnnotation(PrimaryKey.class) != null) { PrimaryKey primaryKeyAnnotation = field.getAnnotation(PrimaryKey.class); if (!toReturn.toString().toUpperCase().contains("PRIMARY KEY")) { toReturn.append(" PRIMARY KEY "); if (TypeConstants.isIntegerType(getTypeForAccessors()) && primaryKeyAnnotation.autoincrement()) { toReturn.append("AUTOINCREMENT"); } } else { utils.getMessager().printMessage(Kind.WARNING, "Duplicate primary key definition in column constraints." + " Use the @PrimaryKey annotation instead of declaring the constraint in ColumnSpec."); } } String toReturnString = toReturn.toString().trim(); if (!AptUtils.isEmpty(toReturnString)) { return "\"" + toReturnString + "\""; } return null; }
Source:
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(KEY_IS_IN_VISUAL_PREVIEW, isInVisualPreview()); }

Target:
public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(KEY_IS_IN_VISUAL_PREVIEW, isInVisualPreview()); }
Source:
private static void setLevelUsingRegex(Level level, String regex) { if (regex.startsWith("^")) { regex = regex.substring(1); if (regex.endsWith("$") && !regex.endsWith("\\$")) { regex = regex.substring(0, regex.length() - 1); } } final RunAutomaton a = new RunAutomaton(new RegExp(regex).toAutomaton()); for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); logger.hasMoreElements();) { Logger log = logger.nextElement(); if (a.run(log.getName())) { log.setLevel(level); } } }

Target:
private static void setLevelUsingRegex(Level level, String regex) { if (regex.startsWith("^")) { regex = regex.substring(1); if (regex.endsWith("$") && !regex.endsWith("\\$")) { regex = regex.substring(0, regex.length() - 1); } } RunAutomaton a = new RunAutomaton(new RegExp(regex).toAutomaton()); for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); logger.hasMoreElements();) { Logger log = logger.nextElement(); if (a.run(log.getName())) { log.setLevel(level); } } }
Source:
private String getValuesAsString() { return targetValues.stream().map(Object::toString).collect(Collectors.joining(", ")); }

Target:
private String getValuesAsString() { return String.join(", ", targetValues); }
Source:
void cancel() { super.cancel(); if (callback != null) { callback = null; } }

Target:
@Override void cancel() { super.cancel(); callback = null; }