auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PerunNotifReceiver call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); if (parms.contains("receiver")) { return ac.getNotificationManager().createPerunNotifReceiver(ac.getSession(), parms.read("receiver", PerunNotifReceiver.class)); } else if (parms.contains("target") && parms.contains("key") && parms.contains("templateId") && parms.contains("locale") ) { PerunNotifReceiver receiver = new PerunNotifReceiver(); receiver.setLocale(parms.read("locale", String.class)); receiver.setTarget(parms.read("target", String.class)); receiver.setTemplateId(parms.read("templateId", Integer.class)); PerunNotifTypeOfReceiver type = PerunNotifTypeOfReceiver.resolve(parms.read("key", String.class)); receiver.setTypeOfReceiver(type); return ac.getNotificationManager().createPerunNotifReceiver(ac.getSession(), receiver); } else { throw new RpcException("Parameters missing", "Parameter 'receiver' or parameters 'locale', 'target', 'key', 'templateId' not provided."); } }

Target:
public PerunNotifReceiver call(ApiCaller ac, Deserializer parms) throws PerunException { if (parms.contains("id")) { return ac.getNotificationManager().getPerunNotifReceiverById(ac.getSession(), parms.readInt("id")); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "id"); } }
Source:
public long rtcpTCCRemoteBitrateEstimator (Integer ssrc_, long sendTime, long receivedTime, int packetLength) { long nowMs = receivedTime; synchronized (critSect) { Detector it = overuseDetectors.get(ssrc_); if (it == null) { it = new Detector(nowMs, new OverUseDetectorOptions(), true); overuseDetectors.put(ssrc_, it); ssrcs = null; } Detector estimator = it; estimator.lastPacketTimeMs = nowMs; this.incomingBitrate.update(packetLength, nowMs); BandwidthUsage priorState = estimator.detector.getState(); long[] deltas = this.deltas; deltas[0] = 0; deltas[1] = 0; deltas[2] = 0; if (estimator.interArrival.computeDeltas( sendTime, receivedTime, packetLength, deltas)) { double timestampDeltaMs = deltas[0] * kTimestampToMs; estimator.estimator.update( deltas[1], timestampDeltaMs, (int) deltas[2], estimator.detector.getState()); estimator.detector.detect( estimator.estimator.getOffset(), timestampDeltaMs, estimator.estimator.getNumOfDeltas(), nowMs); } if (estimator.detector.getState() == BandwidthUsage.kBwOverusing) { long incomingBitrateBps = this.incomingBitrate.getRate(nowMs); if (priorState != BandwidthUsage.kBwOverusing || remoteRate.isTimeToReduceFurther( nowMs, incomingBitrateBps)) { updateEstimate(nowMs); } } } return this.incomingBitrate.getRate(receivedTime); }

Target:
public long rtcpTCCRemoteBitrateEstimator(Integer ssrc_, long sendTime, long receivedTime, int packetLength) { long interArrivalTime = getInterArrivalDelayVariation (ssrc_, sendTime, receivedTime, packetLength); return interArrivalTime; }
Source:
private void doCreateProject() { final String projectName = createProjectTxt.getText().trim(); if (projectName.contains(" ")) { return; } String parentName = null; if (showParentCandidates.getValue()) { parentName = suggestedParents.getItemText(suggestedParents.getSelectedIndex()); } else { parentName = parentTxt.getText(); } if (parentName.equals(NO_PARENT_SELECTED) && showParentCandidates.getValue()) { parentName = ""; } Util.PROJECT_SVC.createNewProject(projectName, parentName, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(projectName), ProjectScreen.INFO)); } @Override public void onFailure(Throwable caught) { super.onFailure(caught); } }); }

Target:
private void doCreateProject() { final String projectName = createProjectTxt.getText().trim(); if (projectName.contains(" ")) { return; } String parentName = null; if (showParentCandidates.getValue()) { parentName = suggestedParents.getItemText(suggestedParents.getSelectedIndex()); if (parentName.equals(NO_PARENT_SELECTED)) { parentName = ""; } } else { parentName = parentTxt.getText(); } Util.PROJECT_SVC.createNewProject(projectName, parentName, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(projectName), ProjectScreen.INFO)); } @Override public void onFailure(Throwable caught) { super.onFailure(caught); } }); }
Source:
public static PrintWriter getPrintWriter( File file ) { try { return new PrintWriter( file, Charsets.UTF_8.name() ) { @Override public void println() { write( "\n" ); } }; } catch( Exception e ) { throw Throwables.propagate( e ); } }

Target:
public static PrintWriter getPrintWriter( File file ) { try { return new PrintWriter( file, Charsets.UTF_8.name() ); } catch( Exception e ) { throw Throwables.propagate( e ); } }
Source:
private void readNext(boolean initialSeek) throws IOException { boolean yielded = (yield.isPresent() && yield.get().hasYielded()); boolean seekNeeded = yielded || (!onlySwitchAfterRow && switchSource()) || initialSeek; if (seekNeeded) if (initialSeek) iter.seek(range, columnFamilies, inclusive); else if (yielded) { Key yieldPosition = yield.get().getPositionAndReset(); if (!range.contains(yieldPosition)) { throw new IOException("Underlying iterator yielded to a position outside of its range: " + yieldPosition + " not in " + range); } iter.seek(new Range(yieldPosition, false, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } else iter.seek(new Range(key, false, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); else { iter.next(); if (onlySwitchAfterRow && iter.hasTop() && !source.isCurrent() && !key.getRowData().equals(iter.getTopKey().getRowData())) { switchSource(); iter.seek(new Range(key.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } } if (yield.isPresent() && yield.get().hasYielded()) { key = null; val = null; } else if (iter.hasTop()) { Key nextKey = iter.getTopKey(); Value nextVal = iter.getTopValue(); try { key = (Key) nextKey.clone(); } catch (CloneNotSupportedException e) { throw new IOException(e); } val = nextVal; } else { key = null; val = null; } }

Target:
private void readNext(boolean initialSeek) throws IOException { boolean yielded = (yield.isPresent() && yield.get().hasYielded()); boolean seekNeeded = yielded || (!onlySwitchAfterRow && switchSource()) || initialSeek; if (seekNeeded) if (initialSeek) iter.seek(range, columnFamilies, inclusive); else if (yielded) { Key yieldPosition = yield.get().getPositionAndReset(); if (!range.contains(yieldPosition)) { throw new IOException("Underlying iterator yielded to a position outside of its range: " + yieldPosition + " not in " + range); } iter.seek(new Range(yieldPosition, false, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } else iter.seek(new Range(key, false, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); else { iter.next(); if (onlySwitchAfterRow && iter.hasTop() && !source.isCurrent() && !key.getRowData().equals(iter.getTopKey().getRowData())) { switchSource(); iter.seek(new Range(key.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } } if (iter.hasTop()) { if (yield.isPresent() && yield.get().hasYielded()) { throw new IOException("Coding error: hasTop returned true but has yielded at " + yield.get().getPositionAndReset()); } Key nextKey = iter.getTopKey(); Value nextVal = iter.getTopValue(); try { key = (Key) nextKey.clone(); } catch (CloneNotSupportedException e) { throw new IOException(e); } val = nextVal; } else { key = null; val = null; } }
Source:
public static CalligraphyActivityFactory2 get(Activity activity) { if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) { throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)"); } return (CalligraphyActivityFactory2) activity.getLayoutInflater(); }

Target:
static CalligraphyActivityFactory get(Activity activity) { if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) { throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)"); } return (CalligraphyActivityFactory) activity.getLayoutInflater(); }
Source:
protected void setConfiguredEventListener(String name, Map<String, String> properties) throws Exception { requireNonNull(name, "name is null"); requireNonNull(properties, "properties is null"); log.info("-- Loading event listener --"); EventListenerFactory eventListenerFactory = eventListenerFactories.get(name); checkState(eventListenerFactory != null, "Event listener %s is not registered", name); EventListener eventListener = eventListenerFactory.create(ImmutableMap.copyOf(properties), new EventListenerContext() { private final MBeanServer mBeanServer = namespaceManager.createMBeanServer(name + "EventListener"); @Override public MBeanServer getMBeanServer() { return mBeanServer; } }); this.configuredEventListener.set(Optional.of(eventListener)); log.info("-- Loaded event listener %s --", name); }

Target:
protected void setConfiguredEventListener(String name, Map<String, String> properties) { requireNonNull(name, "name is null"); requireNonNull(properties, "properties is null"); log.info("-- Loading event listener --"); EventListenerFactory eventListenerFactory = eventListenerFactories.get(name); checkState(eventListenerFactory != null, "Event listener %s is not registered", name); final MBeanServer mBeanServer = namespaceManager.createMBeanServer(name + "EventListener"); EventListener eventListener = eventListenerFactory.create(ImmutableMap.copyOf(properties), new EventListenerContext() { @Override public MBeanServer getMBeanServer() { return mBeanServer; } }); this.configuredEventListener.set(Optional.of(eventListener)); log.info("-- Loaded event listener %s --", name); }
Source:
public void visitFieldAnnotation(TempDir annotation, FieldInfo field) { Class<?> fieldType = field.getType(); if (!File.class.equals(fieldType) && !Path.class.equals(fieldType)) { throw new InvalidSpecException("@TempDir can only be used on File field or Path field"); } DirInterceptor interceptor = field.isShared()? new SharedInterceptor(fieldType, field.getReflection()): new FeatureInterceptor(fieldType, field.getReflection()); interceptor.install(field.getParent()); }

Target:
public void visitFieldAnnotation(TempDir annotation, FieldInfo field) { Class<?> fieldType = field.getType(); if (!fieldType.isAssignableFrom(File.class) && !fieldType.isAssignableFrom(Path.class)) { throw new InvalidSpecException("@TempDir can only be used on File, Path or untyped field"); } TempDirInterceptor interceptor = new TempDirInterceptor(fieldType, field, configuration.baseDir, configuration.keep); SpecInfo specInfo = field.getParent(); if (field.isShared()) { specInfo.addInterceptor(interceptor); } else { for (FeatureInfo featureInfo : specInfo.getAllFeatures()) { featureInfo.addIterationInterceptor(interceptor); } } }
Source:
public void hitAllEndpoints() throws Exception { String rootResponse = given().get("/") .then() .statusCode(200) .log().body() .extract().body().asString(); Json.jq(rootResponse, "._links[].href | capture(\"https://[^/]*(?<url>[^{]*)\") | .url").stream() .map(JsonNode::asText) .forEach(url -> { System.out.println("~~~~~~~~~~~ URL=" + url); given().get(url).then().statusCode(200); }); }

Target:
public void hitAllEndpoints() throws Exception { String rootResponse = given().get("/") .then() .statusCode(200) .log().body() .extract().body().asString(); Json.jq(rootResponse, "._links[].href | capture(\"https://[^/]*(?<url>[^{]*)\") | .url").stream() .map(JsonNode::asText) .forEach(url -> given().get(url).then().statusCode(200)); }
Source:
public static EmailMessage fromJsonObject(JSONObject emailObject) { EmailMessage email = new EmailMessage(); try { emailObject = emailObject.getJSONObject("email_message"); String id = emailObject.getString("id"); String contactId = emailObject.getString("contact_id"); String sendTime = emailObject.getString("send_time"); String sender = emailObject.getString("sender"); String subject = emailObject.getString("subject"); String plainContent = emailObject.getString("plain_content"); EmailRecipients recipients = new EmailRecipients(); JSONObject recipientsObject = emailObject.getJSONObject("recipients"); List<String> to = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray("to")); List<String> bcc = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray("bcc")); List<String> cc = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray("cc")); recipients.setTo(to) .setBcc(bcc) .setCc(cc); email.setRecipients(recipients); return email .setId(id) .setContactId(contactId) .setSendTime(sendTime) .setSender(sender) .setSubject(subject) .setPlainContent(plainContent); } catch (JSONException e) { LOG.severe("Error parsing email object"); LOG.severe(e.toString()); } return email; }

Target:
public static EmailMessage fromJsonObject(JSONObject emailObject) { EmailMessage email = new EmailMessage(); try { emailObject = emailObject.optJSONObject(EMAIL_MESSAGE_TAG); String id = emailObject.optString(ID_TAG); String contactId = emailObject.optString(CONTACT_ID_TAG); String sendTime = emailObject.optString(SEND_TIME_TAG); String sender = emailObject.optString(SENDER_TAG); String subject = emailObject.optString(SUBJECT_TAG); String plainContent = emailObject.optString(PLAIN_CONTENT_TAG); EmailRecipients recipients = new EmailRecipients(); JSONObject recipientsObject = emailObject.optJSONObject(RECIPIENTS_TAG); List<String> to = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray(TO_TAG)); List<String> bcc = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray(BCC_TAG)); List<String> cc = BaseSerializer.toListOfStrings(recipientsObject.getJSONArray(CC_TAG)); recipients.setTo(to) .setBcc(bcc) .setCc(cc); email.setRecipients(recipients); return email .setId(id) .setContactId(contactId) .setSendTime(sendTime) .setSender(sender) .setSubject(subject) .setPlainContent(plainContent); } catch (JSONException e) { LOG.severe("Error parsing email object"); LOG.severe(e.toString()); } return email; }
Source:
public List<String> getSchemas(Connection connection) throws SQLException { List<String> schemas = new ArrayList<String>(); Statement statemnt = null; String sql = "select schema_name from information_schema.schemata;"; ResultSet rs; try { statemnt = connection.createStatement(); rs = statemnt.executeQuery(sql); while (rs.next()) { schemas.add(rs.getString("schema_name")); } return schemas; } finally { if (statemnt != null) { try { statemnt.close(); } catch (SQLException e) { log.error(e.getMessage(), e); } } if (connection != null) { try { connection.close(); } catch (SQLException e) { log.error(e.getMessage(), e); } } } }

Target:
public List<String> getSchemas(Connection connection) throws SQLException { List<String> schemas = new ArrayList<String>(); Statement statemnt = null; String sql = "select schema_name from information_schema.schemata;"; ResultSet rs; try { statemnt = connection.createStatement(); rs = statemnt.executeQuery(sql); while (rs.next()) { schemas.add(rs.getString("schema_name")); } return applyFilter(schemas); } finally { if (statemnt != null) { try { statemnt.close(); } catch (SQLException e) { log.error(e.getMessage(), e); } } if (connection != null) { try { connection.close(); } catch (SQLException e) { log.error(e.getMessage(), e); } } } }
Source:
private void tryRegisterMBean(MBeanServer mBeanServer, ObjectName objectName) { try { mBeanServer.registerMBean(this, objectName); LOGGER.debug("Registered Geocoding Configuration MBean under object name: {}", objectName); } catch (InstanceAlreadyExistsException e) { LOGGER.error("Re-registered Geocoding Configuration MBean"); } catch (MBeanRegistrationException | NotCompliantMBeanException e) { LOGGER.error("Could not register MBean [{}].", objectName); } }

Target:
private void tryRegisterMBean(MBeanServer mBeanServer, ObjectName objectName) throws InstanceAlreadyExistsException, MBeanRegistrationException, InstanceNotFoundException, NotCompliantMBeanException { try { mBeanServer.registerMBean(this, objectName); LOGGER.debug("Registered Geocoding Configuration MBean under object name: {}", objectName); } catch (InstanceAlreadyExistsException e) { mBeanServer.unregisterMBean(objectName); mBeanServer.registerMBean(this, objectName); LOGGER.debug("Re-registered Geocoding Configuration MBean"); } catch (MBeanRegistrationException | NotCompliantMBeanException e) { LOGGER.info("Could not register MBean [{}].", objectName); } }
Source:
public boolean isAppPageview( String uriPath, String uriQuery, String contentType, String userAgent, String rawXAnalyticsHeader ) { final String appContentType = "application/json"; final String appUserAgent = "WikipediaApp"; final String appPageURIQuery = "sections=0"; final String iosAppPageURIQuery = "sections=all"; final String iosUserAgent = "iPhone"; Webrequest wr = Webrequest.getInstance(); if (wr.getXAnalyticsValue(rawXAnalyticsHeader,"preview").trim().equalsIgnoreCase("1")) return false; boolean isTaggedPageview = (wr.getXAnalyticsValue(rawXAnalyticsHeader,"pageview").trim().equalsIgnoreCase("1")); return ( isTaggedPageview || ( Utilities.stringContains(uriPath, uriPathAPI) && (Utilities.stringContains(uriQuery, appPageURIQuery) || (Utilities.stringContains(uriQuery, iosAppPageURIQuery) && Utilities.stringContains(userAgent, iosUserAgent)) ) ) && Utilities.stringContains(contentType, appContentType) && Utilities.stringContains(userAgent, appUserAgent) ); }

Target:
public boolean isAppPageview( String uriPath, String uriQuery, String contentType, String userAgent, String rawXAnalyticsHeader ) { final String appContentType = "application/json"; final String appUserAgent = "WikipediaApp"; final String appPageURIQuery = "sections=0"; final String iosAppPageURIQuery = "sections=all"; final String iosUserAgent = "iPhone"; Webrequest wr = Webrequest.getInstance(); if (wr.getXAnalyticsValue(rawXAnalyticsHeader,"preview").trim().equalsIgnoreCase("1")) return false; boolean isTaggedPageview = (wr.getXAnalyticsValue(rawXAnalyticsHeader,"pageview").trim().equalsIgnoreCase("1")); return (Utilities.stringContains(contentType, appContentType) && Utilities.stringContains(userAgent, appUserAgent) && (isTaggedPageview || ( Utilities.stringContains(uriPath, uriPathAPI) && (Utilities.stringContains(uriQuery, appPageURIQuery) || (Utilities.stringContains(uriQuery, iosAppPageURIQuery) && Utilities.stringContains(userAgent, iosUserAgent)) ) ) )); }
Source:
private Comparator<TrialSummary> getComparatorProgramName(){ return new Comparator<TrialSummary>() { @Override public int compare(final TrialSummary trialSummary1, final TrialSummary trialSummary2) { return trialSummary1.getProgramName().compareTo(trialSummary2.getProgramName()); } }; }

Target:
private static Comparator<TrialSummary> getComparatorProgramName() { return new Comparator<TrialSummary>() { @Override public int compare(final TrialSummary trialSummary1, final TrialSummary trialSummary2) { return trialSummary1.getProgramName().compareTo(trialSummary2.getProgramName()); } }; }
Source:
public void saveSettings() { super.saveSettings(); final Map<String, String> params = serializeSelfHostedParams(); if (params == null || params.isEmpty()) return; XMLRPCCallback callback = new XMLRPCCallback() { @Override public void onSuccess(long id, final Object result) { notifySavedOnUiThread(null); mRemoteSettings.copyFrom(mSettings); if (result != null) { HashMap<String, Object> properties = new HashMap<>(); if (result instanceof Map) { Map<String, Object> resultMap = (Map) result; Set<String> keys = resultMap.keySet(); for (String key : keys) { Object currentValue = resultMap.get(key); if (currentValue != null) { properties.put("item_saved_" + key, currentValue); } } } AnalyticsUtils.trackWithCurrentBlogDetails( AnalyticsTracker.Stat.SITE_SETTINGS_SAVED_REMOTELY, properties); } } @Override public void onFailure(long id, final Exception error) { notifySavedOnUiThread(error); } }; final Object[] callParams = { mBlog.getRemoteBlogId(), mSettings.username, mSettings.password, params }; XMLRPCClientInterface xmlrpcInterface = instantiateInterface(); if (xmlrpcInterface == null) return; xmlrpcInterface.callAsync(callback, ApiHelper.Methods.SET_OPTIONS, callParams); }

Target:
public void saveSettings() { super.saveSettings(); final Map<String, String> params = serializeSelfHostedParams(); if (params == null || params.isEmpty()) return; XMLRPCCallback callback = new XMLRPCCallback() { @Override public void onSuccess(long id, final Object result) { notifySavedOnUiThread(null); mRemoteSettings.copyFrom(mSettings); if (result != null) { HashMap<String, Object> properties = new HashMap<>(); if (result instanceof Map) { Map<String, Object> resultMap = (Map) result; Set<String> keys = resultMap.keySet(); for (String key : keys) { Object currentValue = resultMap.get(key); if (currentValue != null) { properties.put(SAVED_ITEM_PREFIX + key, currentValue); } } } AnalyticsUtils.trackWithCurrentBlogDetails( AnalyticsTracker.Stat.SITE_SETTINGS_SAVED_REMOTELY, properties); } } @Override public void onFailure(long id, final Exception error) { notifySavedOnUiThread(error); } }; final Object[] callParams = { mBlog.getRemoteBlogId(), mSettings.username, mSettings.password, params }; XMLRPCClientInterface xmlrpcInterface = instantiateInterface(); if (xmlrpcInterface == null) return; xmlrpcInterface.callAsync(callback, ApiHelper.Methods.SET_OPTIONS, callParams); }
Source:
MathUtils.round(value, 0) : value >= 0.1 ? MathUtils.round(value, 1) : MathUtils.round(value, MIN_PRECISION); private static final String EXPERIMENTS_PATH = "$.facets.experimentType.buckets..experimentAccession.buckets[*]"; static final String FACET_TREE_PATH = "$.facets.experimentType.buckets.species.buckets[*]"; private final AnalyticsQueryClient analyticsQueryClient; public BaselineAnalyticsSearchDao(AnalyticsQueryClient analyticsQueryClient) { this.analyticsQueryClient = analyticsQueryClient; }

Target:
MathUtils.round(value, 0) : value >= 0.1 ? MathUtils.round(value, 1) : MathUtils.round(value, MIN_PRECISION); private static final String EXPERIMENTS_PATH = "$.facets.experimentType.buckets..experimentAccession.buckets[*]"; static final String FACET_TREE_PATH = "$.facets.experimentType.buckets[*].species.buckets[*]"; private final AnalyticsQueryClient analyticsQueryClient; public BaselineAnalyticsSearchDao(AnalyticsQueryClient analyticsQueryClient) { this.analyticsQueryClient = analyticsQueryClient; }
Source:
public void testExtensionMatch() throws Exception { Position[] basic = { new Position(8, 3) }; compareStyleRanges(basic, getStyleRanges(".MF", "MANIFEST.MF"), "MANIFEST.MF", "/folder"); Position[] withSubstring = { new Position(0, 1), new Position(8, 3) }; compareStyleRanges(withSubstring, getStyleRanges("M.MF", "MANIFEST.MF"), "MANIFEST.MF", "/folder"); Position[] withCamelCase = { new Position(4, 3), new Position(8, 1) }; compareStyleRanges(withCamelCase, getStyleRanges(".TxT", "test.TxxT"), "test.TxxT", "/folder"); Position[] withPattern = { new Position(4, 2), new Position(8, 1) }; compareStyleRanges(withPattern, getStyleRanges(".t*t", "test.txxt"), "test.txxt", "/folder"); Position[] withDigits = { new Position(4, 2), new Position(8, 1) }; compareStyleRanges(withDigits, getStyleRanges(".3*3", "test.3xx3"), "test.3xx3", "/folder"); }

Target:
public void testExtensionMatch() throws Exception { Position[] basic = { new Position(8, 3) }; compareStyleRanges(basic, getStyleRanges(".MF", "MANIFEST.MF"), "MANIFEST.MF", ""); Position[] withSubstring = { new Position(0, 1), new Position(8, 3) }; compareStyleRanges(withSubstring, getStyleRanges("M.MF", "MANIFEST.MF"), "MANIFEST.MF", ""); Position[] withCamelCase = { new Position(4, 3), new Position(8, 1) }; compareStyleRanges(withCamelCase, getStyleRanges(".TxT", "test.TxxT"), "test.TxxT", ""); Position[] withPattern = { new Position(4, 2), new Position(8, 1) }; compareStyleRanges(withPattern, getStyleRanges(".t*t", "test.txxt"), "test.txxt", ""); Position[] withDigits = { new Position(4, 2), new Position(8, 1) }; compareStyleRanges(withDigits, getStyleRanges(".3*3", "test.3xx3"), "test.3xx3", ""); }
Source:
private static byte[] consume(final InputStream input) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buf = new byte[4096]; while (true) { final int actual = input.read(buf); if (actual < 0) { break; } baos.write(buf, 0, actual); } return baos.toByteArray(); }

Target:
private static byte[] consume(final InputStream input) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buf = new byte[4096]; while (true) { final int bytes = input.read(buf); if (bytes < 0) { break; } baos.write(buf, 0, bytes); } return baos.toByteArray(); }
Source:
public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { ConnectionEntry conn = connections.get(connectionID); if (conn != null) { try { conn.connection.bufferReceived(connectionID, buffer); } catch (RuntimeException e) { ActiveMQServerLogger.LOGGER.warn("Failed to decode buffer, disconnect immediately.", e); conn.connection.fail(new ActiveMQException(e.getMessage())); } } else { if (logger.isTraceEnabled()) { logger.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); } } }

Target:
public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { ConnectionEntry conn = connections.get(connectionID); if (conn != null) { try { conn.connection.bufferReceived(connectionID, buffer); } catch (RuntimeException e) { ActiveMQServerLogger.LOGGER.disconnectCritical("Error decoding buffer", e); conn.connection.fail(new ActiveMQException(e.getMessage())); } } else { if (logger.isTraceEnabled()) { logger.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); } } }
Source:
public void VisualEditorEntryTest_001_Category(boolean isRTEext, boolean isVEext, EditorPref editorPref, Editor expectedEditor ) { wikiURL = urlBuilder.getUrlForWiki(VisualEditorDataProvider.getTestWiki(isRTEext, isVEext)); WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.getUserBaseOnEditorPref(editorPref), credentials.getPassBaseOnEditorPref(editorPref), wikiURL); article = base.openArticleByName(wikiURL, URLsContent.categoryPage); verifyMainEditEditor(expectedEditor); }

Target:
public void VisualEditorEntryTest_001_Category( boolean isRTEext, boolean isVEext, EditorPref editorPref, Editor expectedEditor ) { wikiURL = urlBuilder.getUrlForWiki(VisualEditorDataProvider.getTestWiki(isRTEext, isVEext)); ArticlePageObject article = new ArticlePageObject(driver); article.logInCookie(credentials.getUserBaseOnEditorPref(editorPref), credentials.getPassBaseOnEditorPref(editorPref), wikiURL); article.openArticleByName(wikiURL, URLsContent.categoryPage); article.verifyMainEditEditor(expectedEditor); }
Source:
private static <T, SpecT> SpecT createEntitySpec(String symbolicName, CampPlatform camp, DeploymentPlan plan, BrooklynClassLoadingContext loader) { AssemblyTemplate at = registerDeploymentPlan(camp, plan, loader); AssemblyTemplateInstantiator instantiator = newInstantiator(at); if (instantiator instanceof AssemblyTemplateSpecInstantiator) { return (SpecT) ((AssemblyTemplateSpecInstantiator)instantiator).createNestedSpec(at, camp, loader, MutableSet.of(symbolicName)); } else { throw new IllegalStateException("Unable to instantiate YAML; incompatible instantiator " + instantiator + " for " + at); } }

Target:
private static EntitySpec<? extends Application> createEntitySpec(String symbolicName, CampPlatform camp, DeploymentPlan plan, BrooklynClassLoadingContext loader) { AssemblyTemplate at = registerDeploymentPlan(camp, plan, loader); AssemblyTemplateInstantiator instantiator = newInstantiator(at); if (instantiator instanceof AssemblyTemplateSpecInstantiator) { return (EntitySpec<? extends Application>) ((AssemblyTemplateSpecInstantiator)instantiator).createNestedSpec(at, camp, loader, MutableSet.of(symbolicName)); } else { throw new IllegalStateException("Unable to instantiate YAML; incompatible instantiator " + instantiator + " for " + at); } }
Source:
private boolean isExistingLogSegmented() throws IOException { File[] segmentFiles = new File(dataDir).listFiles(LogSegmentNameHelper.LOG_FILE_FILTER); if (segmentFiles == null) { throw new IOException("Could not read from directory: " + dataDir); } return !(segmentFiles.length == 1 && LogSegmentNameHelper.nameFromFilename(segmentFiles[0].getName()).isEmpty()); }

Target:
private boolean isExistingLogSegmented() { return !segmentsByName.firstKey().isEmpty(); }
Source:
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { if ((position < 0) || (count < 0)) { throw new IllegalArgumentException("transferTo(" + getRemotePath() + ") illegal position (" + position + ") or count (" + count + ")"); } ensureOpen(READ_MODES); synchronized (lock) { boolean completed = false; boolean eof = false; long curPos = position; try { beginBlocking(); int bufSize = (int) Math.min(count, Short.MAX_VALUE + 1); byte[] buffer = new byte[bufSize]; long totalRead = 0L; while (totalRead < count) { int read = sftp.read(handle, curPos, buffer, 0, buffer.length); if (read > 0) { ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, (int) Math.min(count - totalRead, buffer.length)); while (wrap.remaining() > 0) { target.write(wrap); } curPos += read; totalRead += read; } else { eof = read == -1; } } completed = true; return totalRead > 0 ? totalRead : eof ? -1 : 0; } finally { endBlocking(completed); } } }

Target:
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { if ((position < 0) || (count < 0)) { throw new IllegalArgumentException("transferTo(" + getRemotePath() + ") illegal position (" + position + ") or count (" + count + ")"); } ensureOpen(READ_MODES); synchronized (lock) { boolean completed = false; boolean eof = false; long curPos = position; try { beginBlocking(); int bufSize = (int) Math.min(count, Short.MAX_VALUE + 1); byte[] buffer = new byte[bufSize]; long totalRead = 0L; while (totalRead < count) { int read = sftp.read(handle, curPos, buffer, 0, buffer.length); if (read > 0) { ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, read); while (wrap.remaining() > 0) { target.write(wrap); } curPos += read; totalRead += read; } else { eof = read == -1; } } completed = true; return totalRead > 0 ? totalRead : eof ? -1 : 0; } finally { endBlocking(completed); } } }
Source:
public void reindexObjectAndChildren(AgentPrincipals agent, PID objectPid, Boolean inplace) { aclService.assertHasAccess("User does not have permission to reindex", objectPid, agent.getPrincipals(), Permission.reindex); if (inplace == null || inplace) { indexingMessageSender.sendIndexingOperation(objectPid, null, IndexingActionType.RECURSIVE_REINDEX); } else { indexingMessageSender.sendIndexingOperation(objectPid, null, IndexingActionType.CLEAN_REINDEX); } }

Target:
public void reindexObjectAndChildren(AgentPrincipals agent, PID objectPid, Boolean inplace) { aclService.assertHasAccess("User does not have permission to reindex", objectPid, agent.getPrincipals(), Permission.reindex); if (inplace == null || inplace) { indexingMessageSender.sendIndexingOperation(agent.getUsername(), objectPid, IndexingActionType.RECURSIVE_REINDEX); } else { indexingMessageSender.sendIndexingOperation(agent.getUsername(), objectPid, IndexingActionType.CLEAN_REINDEX); } }
Source:
public void draw (Batch spriteBatch) { spriteBatch.setShader(shader); shader.setUniformf("u_smoothing", getFont().getDistanceFieldSmoothing() * getFont().getScaleX()); super.draw(spriteBatch); spriteBatch.setShader(null); }

Target:
public void draw (Batch spriteBatch) { final ShaderProgram lastShader = spriteBatch.getShader(); if (lastShader != shader) { spriteBatch.setShader(shader); } shader.setUniformf("u_smoothing", getFont().getDistanceFieldSmoothing() * getFont().getScaleX()); super.draw(spriteBatch); if (lastShader != shader) { spriteBatch.setShader(lastShader); } }
Source:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue( getDbFacade().getStorageServerConnectionDao() .getStorageConnectionsByStorageTypeAndStatus(getParameters().getId(), getParameters().getStorageType(), EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Inactive, StorageDomainStatus.Unknown, StorageDomainStatus.Maintenance, StorageDomainStatus.PreparingForMaintenance ))); }

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue( getDbFacade().getStorageServerConnectionDao() .getStorageConnectionsByStorageTypeAndStatus(getParameters().getId(), getParameters().getStorageType(), EnumSet.allOf(StorageDomainStatus.class))); }
Source:
protected void onMention(ChatMessage chatMessage) { if (preferencesService.getPreferences().getNotification().isNotifyOnAtMentionEnabled() && !chatMessage.getMessage().contains("@" + this.userService.getUsername())) { return; } if (!hasFocus()) { audioService.playChatMentionSound(); showNotificationIfNecessary(chatMessage); incrementUnreadMessagesCount(1); setUnread(true); } }

Target:
protected void onMention(ChatMessage chatMessage) { if (preferencesService.getPreferences().getNotification().getNotifyOnAtMentionOnlyEnabled() && !chatMessage.getMessage().contains("@" + this.userService.getUsername())) { return; } if (!hasFocus()) { audioService.playChatMentionSound(); showNotificationIfNecessary(chatMessage); incrementUnreadMessagesCount(1); setUnread(true); } }
Source:
public void finishTree(DetailAST rootAST) { for (Map.Entry<String, List<DetailAST>> stringListEntry : stringMap.entrySet()) { final List<DetailAST> hits = stringListEntry.getValue(); if (hits.size() > allowedDuplicates) { final DetailAST firstFinding = hits.get(0); final String recurringString; if (firstFinding.getType() == TokenTypes.TEXT_BLOCK_CONTENT) { recurringString = ALL_NEW_LINES.matcher( stringListEntry.getKey()).replaceAll("\\\\n"); } else { recurringString = stringListEntry.getKey(); } log(firstFinding, MSG_KEY, recurringString, hits.size()); } } }

Target:
public void finishTree(DetailAST rootAST) { for (Map.Entry<String, List<DetailAST>> stringListEntry : stringMap.entrySet()) { final List<DetailAST> hits = stringListEntry.getValue(); if (hits.size() > allowedDuplicates) { final DetailAST firstFinding = hits.get(0); final String recurringString = ALL_NEW_LINES.matcher( stringListEntry.getKey()).replaceAll("\\\\n"); log(firstFinding, MSG_KEY, recurringString, hits.size()); } } }
Source:
private static File getKarafLock(File lock,Properties props) { return validateDirectoryExists(lock.getPath(), "Invalid" + PROPERTY_LOCK_DIR + " system property"); }

Target:
private static File getKarafLock(File lock,Properties props) { File rc = null; String path = lock.getPath(); if (path != null) { rc = validateDirectoryExists(path, "Invalid " + PROPERTY_LOCK_DIR + " system property"); } if (rc == null) { path = props.getProperty(PROP_KARAF_BASE); if (path != null) { rc = validateDirectoryExists(path, "Invalid " + PROP_KARAF_BASE + " property"); } } if (rc == null) { rc = lock; } return rc; }
Source:
static Properties attemptLoadWithFileSystem(String propertiesFile, ClassLoader classLoader) { LOGGER.debug("Attempting to load properties from file system: {}", propertiesFile); File propFile = new File(propertiesFile); Properties properties = new Properties(); if (propFile.isAbsolute()) { LOGGER.debug("propertiesFile is absolute", propertiesFile); propFile = new File(propertiesFile); } else { String rootDirectory = System.getProperty("karaf.home"); if (rootDirectory != null && !rootDirectory.isEmpty()) { propFile = new File(rootDirectory, propertiesFile); } else { rootDirectory = System.getProperty("ddf.home"); if (rootDirectory != null && !rootDirectory.isEmpty()) { propFile = new File(rootDirectory, propertiesFile); } else { propFile = new File(propertiesFile); } } } try (InputStreamReader reader = new InputStreamReader(new FileInputStream(propFile), StandardCharsets.UTF_8)) { properties.load(reader); } catch (FileNotFoundException e) { LOGGER.debug("Could not find properties file: {}", propFile.getAbsolutePath(), e); } catch (IOException e) { LOGGER.debug("Error reading properties file: {}", propFile.getAbsolutePath(), e); properties.clear(); } return properties; }

Target:
static Properties attemptLoadWithFileSystem(String propertiesFile, ClassLoader classLoader) { LOGGER.debug("Attempting to load properties from file system: {}", propertiesFile); Properties properties = new Properties(); String karafHome = System.getProperty("karaf.home"); String ddfHome = System.getProperty("ddf.home"); File propFile; AbsolutePathResolver absPath = new AbsolutePathResolver(propertiesFile); if (StringUtils.isNotBlank(karafHome)) { propFile = new File(absPath.getPath(karafHome)); } else if (StringUtils.isNotBlank(ddfHome)) { propFile = new File(absPath.getPath(ddfHome)); } else { propFile = new File(propertiesFile); } if (propFile.exists()) { try (InputStreamReader reader = new InputStreamReader(new FileInputStream(propFile), StandardCharsets.UTF_8)) { properties.load(reader); } catch (FileNotFoundException e) { LOGGER.debug("Could not find properties file: {}", propFile.getAbsolutePath(), e); } catch (IOException e) { LOGGER.debug("Error reading properties file: {}", propFile.getAbsolutePath(), e); properties.clear(); } } else { LOGGER.debug("Could not find properties file: {}", propFile.getAbsolutePath()); } return properties; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_course_unit_only_on_youtube, container, false); if (environment.getConfig().getEmbeddedYoutubeConfig().isYoutubeEnabled()) { ((TextView) v.findViewById(R.id.only_youtube_available_message)).setText(R.string.assessment_needed_updating_youtube); v.findViewById(R.id.update_youtube_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.google.android.youtube")); startActivity(i); } catch (android.content.ActivityNotFoundException e) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>")); startActivity(i); } } }); } else { ((TextView) v.findViewById(R.id.only_youtube_available_message)).setText(R.string.assessment_only_on_youtube); } v.findViewById(R.id.view_on_youtube_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(((VideoBlockModel) unit).getData().encodedVideos.youtube.url)); startActivity(i); } }); return v; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View courseUnitOnlyOnYoutubeView = inflater.inflate(R.layout.fragment_course_unit_only_on_youtube, container, false); if (environment.getConfig().getEmbeddedYoutubeConfig().isYoutubeEnabled()) { ((TextView) courseUnitOnlyOnYoutubeView.findViewById(R.id.only_youtube_available_message)).setText(R.string.assessment_needed_updating_youtube); courseUnitOnlyOnYoutubeView.findViewById(R.id.update_youtube_button).setVisibility(View.VISIBLE); courseUnitOnlyOnYoutubeView.findViewById(R.id.update_youtube_button).setOnClickListener(v -> { final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppConstants.BROWSER_PLAYSTORE_YOUTUBE_URI)); startActivity(intent); }); } courseUnitOnlyOnYoutubeView.findViewById(R.id.view_on_youtube_button).setOnClickListener(v -> { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(((VideoBlockModel) unit).getData().encodedVideos.youtube.url)); startActivity(i); }); return courseUnitOnlyOnYoutubeView; }
Source:
public static Object InferType(String attrValue) { Double d = mDoubleParseCache.retrieve(attrValue); if(d != null) { if(d.isNaN()) { return attrValue; } else { return d; } } try { Double ret = MathUtils.parseDoubleSafe(attrValue); mDoubleParseCache.register(attrValue, ret); return ret; } catch (NumberFormatException ife) { mDoubleParseCache.register(attrValue, new Double(Double.NaN)); } return attrValue; }

Target:
public static Object InferType(String attrValue) { Double d = mDoubleParseCache.retrieve(attrValue); if(d != null) { if(d.isNaN()) { return attrValue; } else { return d; } } try { if (checkForInvalidNumericOrDatestringCharacters(attrValue)) { mDoubleParseCache.register(attrValue, new Double(Double.NaN)); return attrValue; } Double ret = Double.parseDouble(attrValue); mDoubleParseCache.register(attrValue, ret); return ret; } catch (NumberFormatException ife) { mDoubleParseCache.register(attrValue, new Double(Double.NaN)); } return attrValue; }
Source:
public void testBehaviourWithChecksAndFilters() throws Exception { final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration"); final DefaultConfiguration treeWalkerConfig = createCheckConfig(TreeWalker.class); treeWalkerConfig.addChild(createCheckConfig(MemberNameCheck.class)); final DefaultConfiguration filterConfig = createCheckConfig(SuppressionCommentFilter.class); filterConfig.addAttribute("checkCPP", "false"); treeWalkerConfig.addChild(filterConfig); checkerConfig.addChild(treeWalkerConfig); final Checker checker = new Checker(); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.configure(checkerConfig); checker.addListener(getBriefUtLogger()); final File file = temporaryFolder.newFile("file.java"); try (Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) { final String content = "public class Main {\n" + " private int I;\n" + " \n" + " private int J;\n" + " \n\n" + " + " private int P;\n" + " + "}"; writer.write(content); } final String[] expected = { "2:16: Name 'I' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "8:16: Name 'P' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verify(checker, file.getPath(), expected); }

Target:
public void testBehaviourWithChecksAndFilters() throws Exception { final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration"); final DefaultConfiguration treeWalkerConfig = createCheckConfig(TreeWalker.class); treeWalkerConfig.addChild(createCheckConfig(MemberNameCheck.class)); final DefaultConfiguration filterConfig = createCheckConfig(SuppressionCommentFilter.class); filterConfig.addAttribute("checkCPP", "false"); treeWalkerConfig.addChild(filterConfig); checkerConfig.addChild(treeWalkerConfig); final Checker checker = new Checker(); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.configure(checkerConfig); checker.addListener(getBriefUtLogger()); final File file = new File(getPath("InputTreeWalkerSuppressionCommentFilter.java")); final String[] expected = { "9:17: " + getCheckMessage(MemberNameCheck.class, "name.invalidPattern", "P", "^[a-z][a-zA-Z0-9]*$"), "4:17: " + getCheckMessage(MemberNameCheck.class, "name.invalidPattern", "I", "^[a-z][a-zA-Z0-9]*$"), }; verify(checker, file.getPath(), expected); }
Source:
public void handle(Callback[] callbacks) throws UnsupportedCallbackException { NameCallback nc = null; PasswordCallback pc = null; RealmCallback rc = null; for (Callback callback : callbacks) { if (callback instanceof RealmChoiceCallback) { continue; } else if (callback instanceof NameCallback) { nc = (NameCallback) callback; } else if (callback instanceof PasswordCallback) { pc = (PasswordCallback) callback; } else if (callback instanceof RealmCallback) { rc = (RealmCallback) callback; } else { throw new UnsupportedCallbackException(callback, "Unrecognized SASL client callback"); } } if (nc != null) { nc.setName(userName); } if (pc != null) { pc.setPassword(userPassword); } if (rc != null) { rc.setText(rc.getDefaultText()); } }

Target:
public void handle(Callback[] callbacks) throws UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof RealmChoiceCallback) { continue; } else if (callback instanceof NameCallback) { NameCallback nameCallback = (NameCallback) callback; nameCallback.setName(userName); } else if (callback instanceof PasswordCallback) { PasswordCallback passwordCallback = (PasswordCallback) callback; passwordCallback.setPassword(userPassword); } else if (callback instanceof RealmCallback) { RealmCallback realmCallback = (RealmCallback) callback; realmCallback.setText(realmCallback.getDefaultText()); } else { throw new UnsupportedCallbackException(callback, "Unrecognized SASL client callback"); } } }
Source:
public ApplicationPageDataStore create(final APISession session) { ApplicationAPI applicationAPI; PageAPI pageAPI; try { applicationAPI = TenantAPIAccessor.getLivingApplicationAPI(session); pageAPI = TenantAPIAccessor.getCustomPageAPI(session); return new ApplicationPageDataStore(session, applicationAPI, pageAPI, new ApplicationPageItemConverter()); } catch (final Exception e) { throw new APIException(e); } }

Target:
public ApplicationPageDataStore create(final APISession session) { try { final ApplicationAPI applicationAPI = TenantAPIAccessor.getLivingApplicationAPI(session); final PageAPI pageAPI = TenantAPIAccessor.getCustomPageAPI(session); return new ApplicationPageDataStore(session, applicationAPI, pageAPI, new ApplicationPageItemConverter()); } catch (final Exception e) { throw new APIException(e); } }
Source:
private void removeJob(String queueName, String jobName) { removeJobFromDag(queueName, jobName); final String namespacedJobName = TaskUtil.getNamespacedJobName(queueName, jobName); _admin.dropResource(_clusterName, namespacedJobName); removeJobStateFromQueue(queueName, jobName); String jobPropertyPath = Joiner.on("/").join(TaskConstants.REBALANCER_CONTEXT_ROOT, namespacedJobName); _propertyStore.remove(jobPropertyPath, AccessOption.PERSISTENT); }

Target:
private void removeJob(String queueName, String jobName) { removeJobFromDag(queueName, jobName); final String namespacedJobName = TaskUtil.getNamespacedJobName(queueName, jobName); _admin.dropResource(_clusterName, namespacedJobName); removeJobStateFromQueue(queueName, jobName); TaskUtil.removeJobContext(_propertyStore, jobName); }
Source:
public UIButtonWebBrowser setUrl(String url) { boolean trustedHostName = false; boolean trustedUrl = false; if (webBrowserConfig != null) { try { String hostname = new URL(url).getHost(); trustedHostName = webBrowserConfig.isHostNameTrusted(hostname); } catch (MalformedURLException e) if (!trustedHostName) { trustedUrl = webBrowserConfig.isUrlTrusted(url); } } if (trustedHostName || trustedUrl) { confirmed.set(true); } else { confirmed.set(false); } this.url = url; return this; }

Target:
public UIButtonWebBrowser setUrl(String url) { boolean trustedHostName = false; boolean trustedUrl = false; if (webBrowserConfig != null) { try { String hostname = new URL(url).getHost(); trustedHostName = webBrowserConfig.isHostNameTrusted(hostname); } catch (MalformedURLException e) { logger.error(url + " is malformed", e); } if (!trustedHostName) { trustedUrl = webBrowserConfig.isUrlTrusted(url); } } if (trustedHostName || trustedUrl) { confirmed.set(true); } else { confirmed.set(false); } this.url = url; return this; }
Source:
public void setAccount_RealName(int accountIndex) { AccountObject userObject = mAccountList.get(accountIndex - 1); long id = userObject.getId(); String userNmae = userObject.getUsername(); String password = userObject.getPassword(); String mail = userObject.getEmail(); String nickName = Account_NAME + "NEW_" + id; AccountInfo user = new AccountInfo(); user.id = id; user.userName = userNmae; user.nickName = nickName; user.password = password; user.email = mail; user.enable = true; mAccountList.set(accountIndex - 1, mAccountHelper.updateAccount(user)); }

Target:
public void setAccount_RealName(int accountIndex) { AccountObject userObject = mAccountList.get(accountIndex - 1); long id = userObject.getId(); String username = userObject.getUsername(); String password = userObject.getPassword(); String mail = userObject.getEmail(); String nickname = Account_NAME + "NEW_" + id; AccountInfo user = new AccountInfo(); user.id = id; user.userName = username; user.nickName = nickname; user.password = password; user.email = mail; user.enable = true; mAccountList.set(accountIndex - 1, mAccountHelper.updateAccount(user)); }