auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static PrintWriter getPrintWriter( File file ) { try { return new PrintWriter( file, Charsets.UTF_8.name() ) { @Override public void println() { <START> write( "\n" ); <END> } }; } catch( Exception e ) { throw Throwables.propagate( e ); } }</code><technical_language>is code of standard PrintWriter class? Also, if is a reason circumvent double checked locking in there, want this.lineSeparator instead of a hardcoded \n</technical_language>

Target:
public static PrintWriter getPrintWriter( File file ) { try { return new PrintWriter( file, Charsets.UTF_8.name() ); } catch( Exception e ) { throw Throwables.propagate( e ); } }
Source:
<code>private void readNext(boolean initialSeek) throws IOException { <START> boolean yielded = (yield.isPresent() && yield.get().hasYielded()); <END> 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; } }</code><technical_language>nit: parens unnecessary</technical_language>

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:
<code><START> public static CalligraphyActivityFactory2 get(Activity activity) { <END> if (!(activity.getLayoutInflater() instanceof CalligraphyLayoutInflater)) { throw new RuntimeException("This activity does not wrap the Base Context! See CalligraphyContextWrapper.wrap(Context)"); } return (CalligraphyActivityFactory2) activity.getLayoutInflater(); }</code><technical_language>I this needs public</technical_language>

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:
<code>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() { <START> private final MBeanServer mBeanServer = namespaceManager.createMBeanServer(name + "EventListener"); <END> @Override public MBeanServer getMBeanServer() { return mBeanServer; } }); this.configuredEventListener.set(Optional.of(eventListener)); log.info("-- Loaded event listener %s --", name); }</code><technical_language>Create this variable anonymous class</technical_language>

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:
<code>public void visitFieldAnnotation(TempDir annotation, FieldInfo field) { Class<?> fieldType = field.getType(); <START> if (!File.class.equals(fieldType) && !Path.class.equals(fieldType)) { <END> 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()); }</code><technical_language>Class#isAssignableFrom(Class) is instanceof</technical_language>

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:
<code>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 -> { <START> System.out.println("~~~~~~~~~~~ URL=" + url); <END> given().get(url).then().statusCode(200); }); }</code><technical_language>debugging code</technical_language>

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:
<code>public static EmailMessage fromJsonObject(JSONObject emailObject) { EmailMessage email = new EmailMessage(); try { emailObject = emailObject.getJSONObject("email_message"); <START> String id = emailObject.getString("id"); <END> 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; }</code><technical_language>Of course, rushed check works. Planned refac, thanks ;)</technical_language>

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:
<code>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")); } <START> return schemas; <END> } 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); } } } }</code><technical_language>intention exclude information_schemas pg_* schemas result? I in this class place filter returned list</technical_language>

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:
<code>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) { <START> LOGGER.error("Re-registered Geocoding Configuration MBean"); <END> } catch (MBeanRegistrationException | NotCompliantMBeanException e) { LOGGER.error("Could not register MBean [{}].", objectName); } }</code><technical_language>missing // Try remove re-register mBeanServer.unregisterMBean(objectName); mBeanServer.registerMBean(this, objectName); LOGGER.debug("Re-registered Geocoding Configuration MBean"); catch (InstanceAlreadyExistsException e). leave a debug instead of error re-registering mbean. I suggest surrounding method call outer try-catch try { tryRegisterMBean(objectName, mBeanServer); } catch (Exception e) { LOGGER.info("Could register MBean [{}].", objectName); } catch is catching exceptions thrown re-registering mbean</technical_language>

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:
<code>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)) ) ) <START> && Utilities.stringContains(contentType, appContentType) <END> && Utilities.stringContains(userAgent, appUserAgent) ); }</code><technical_language>checks (contentType UserAgent) big</technical_language>

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:
<code><START> private Comparator<TrialSummary> getComparatorProgramName(){ <END> return new Comparator<TrialSummary>() { @Override public int compare(final TrialSummary trialSummary1, final TrialSummary trialSummary2) { return trialSummary1.getProgramName().compareTo(trialSummary2.getProgramName()); } }; }</code><technical_language>This a static member</technical_language>

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:
<code>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) { <START> properties.put("item_saved_" + key, currentValue); <END> } } } 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); }</code><technical_language>hard-coded string</technical_language>

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:
<code>MathUtils.round(value, 0) : value >= 0.1 ? MathUtils.round(value, 1) : MathUtils.round(value, MIN_PRECISION); <START> private static final String EXPERIMENTS_PATH = "$.facets.experimentType.buckets..experimentAccession.buckets[*]"; <END> static final String FACET_TREE_PATH = "$.facets.experimentType.buckets.species.buckets[*]"; private final AnalyticsQueryClient analyticsQueryClient; public BaselineAnalyticsSearchDao(AnalyticsQueryClient analyticsQueryClient) { this.analyticsQueryClient = analyticsQueryClient; }</code><technical_language>try this facet retrieving/parsing code a bit more consistent. I a approach I implemented GeneSearchDao</technical_language>

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:
<code>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", <START> "test.3xx3"), "test.3xx3", "/folder"); <END> }</code><technical_language>If wished avoided type file name twice, a helper function (Position[] expected, String searchTerm, String fileName) contain: compareStyleRanges(expected, getStyleRanges(searchTerm, fileName), fileName, ""); texts excluding testBug531610() is style discussion</technical_language>

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:
<code>private static byte[] consume(final InputStream input) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buf = new byte[4096]; while (true) { <START> final int actual = input.read(buf); <END> if (actual < 0) { break; } baos.write(buf, 0, actual); } return baos.toByteArray(); }</code><technical_language>@dmzaytsev call bytes for clarity</technical_language>

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:
<code>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) { <START> ActiveMQServerLogger.LOGGER.warn("Failed to decode buffer, disconnect immediately.", e); <END> conn.connection.fail(new ActiveMQException(e.getMessage())); } } else { if (logger.isTraceEnabled()) { logger.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); } } }</code><technical_language>This done a custom method ActiveMQServerLogger.LOGGER generic warn() method</technical_language>

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:
<code>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); <START> article = base.openArticleByName(wikiURL, URLsContent.categoryPage); <END> verifyMainEditEditor(expectedEditor); }</code><technical_language>openArticleByName is accesible article object</technical_language>

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:
<code><START> private static <T, SpecT> SpecT createEntitySpec(String symbolicName, CampPlatform camp, <END> 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); } }</code><technical_language>need for generics, return EntitySpec<? extends Application></technical_language>

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:
<code>private boolean isExistingLogSegmented() throws IOException { <START> File[] segmentFiles = new File(dataDir).listFiles(LogSegmentNameHelper.LOG_FILE_FILTER); <END> if (segmentFiles == null) { throw new IOException("Could not read from directory: " + dataDir); } return !(segmentFiles.length == 1 && LogSegmentNameHelper.nameFromFilename(segmentFiles[0].getName()).isEmpty()); }</code><technical_language>instead of read disk, do of this implementation (since this is called init): return !segmentsByName.firstKey().isEmpty()</technical_language>

Target:
private boolean isExistingLogSegmented() { return !segmentsByName.firstKey().isEmpty(); }
Source:
<code>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) { <START> ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, (int) Math.min(count - totalRead, buffer.length)); <END> 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); } } }</code><technical_language>this ? java ByteBuffer wrap = ByteBuffer.wrap(buffer, 0, read);</technical_language>

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:
<code><START> public void reindexObjectAndChildren(AgentPrincipals agent, PID objectPid, Boolean inplace) { <END> 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); } }</code><technical_language>able safely inplace a boolean object in this case, save null check below</technical_language>

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:
<code>public void draw (Batch spriteBatch) { spriteBatch.setShader(shader); shader.setUniformf("u_smoothing", getFont().getDistanceFieldSmoothing() * getFont().getScaleX()); super.draw(spriteBatch); <START> spriteBatch.setShader(null); <END> }</code><technical_language>if user called setShader other default? This blow away. add a getShader method Batch set previously set shader</technical_language>

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:
<code>protected void executeQueryCommand() { getQueryReturnValue().setReturnValue( getDbFacade().getStorageServerConnectionDao() <START> .getStorageConnectionsByStorageTypeAndStatus(getParameters().getId(), <END> getParameters().getStorageType(), EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Inactive, StorageDomainStatus.Unknown, StorageDomainStatus.Maintenance, StorageDomainStatus.PreparingForMaintenance ))); }</code><technical_language>getStorageConnectionsByStorageType is a horrible method contains business logic in DAO layer. that, fix frontend backend aligned. (Or yet, remove altogether)</technical_language>

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue( getDbFacade().getStorageServerConnectionDao() .getStorageConnectionsByStorageTypeAndStatus(getParameters().getId(), getParameters().getStorageType(), EnumSet.allOf(StorageDomainStatus.class))); }
Source:
<code>protected void onMention(ChatMessage chatMessage) { <START> if (preferencesService.getPreferences().getNotification().isNotifyOnAtMentionEnabled() <END> && !chatMessage.getMessage().contains("@" + this.userService.getUsername())) { return; } if (!hasFocus()) { audioService.playChatMentionSound(); showNotificationIfNecessary(chatMessage); incrementUnreadMessagesCount(1); setUnread(true); } }</code><technical_language>Ok I hear NotifyOnAtMention I notified if mentions @ sign all. name NotifyOnAtMentioningOnly. purpose clear. In Intelij refactor name selecting name pressing (Umschalten+F6)</technical_language>

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:
<code>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; <START> if (firstFinding.getType() == TokenTypes.TEXT_BLOCK_CONTENT) { <END> recurringString = ALL_NEW_LINES.matcher( stringListEntry.getKey()).replaceAll("\\\\n"); } else { recurringString = stringListEntry.getKey(); } log(firstFinding, MSG_KEY, recurringString, hits.size()); } } }</code><technical_language>I this replacement done for types of strings. turns out if occurrence is a text block, ends of lines replaced. if is another occurrence of ordinary string, result is</technical_language>

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:
<code>private static File getKarafLock(File lock,Properties props) { <START> return validateDirectoryExists(lock.getPath(), "Invalid" + PROPERTY_LOCK_DIR + " system property"); <END> }</code><technical_language>I code behaves differently if {{PROPERTY_LOCK_DIR}} is set. Previously, default {{KARAF_BASE}}, returns null a NPE in constructor</technical_language>

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:
<code>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); <START> } else { <END> 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; }</code><technical_language>If prop file path is absolute, confirming is beneath $ddf.home read it</technical_language>

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:
<code>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); <START> v.findViewById(R.id.update_youtube_button).setOnClickListener(new View.OnClickListener() { <END> @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; }</code><technical_language>set visibility of update_youtube_button View.VISIBLE</technical_language>

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:
<code>public static Object InferType(String attrValue) { Double d = mDoubleParseCache.retrieve(attrValue); if(d != null) { if(d.isNaN()) { return attrValue; } else { return d; } } try { <START> Double ret = MathUtils.parseDoubleSafe(attrValue); <END> mDoubleParseCache.register(attrValue, ret); return ret; } catch (NumberFormatException ife) { mDoubleParseCache.register(attrValue, new Double(Double.NaN)); } return attrValue; }</code><technical_language>performance implications of this? wondering if custom conditionally android version something</technical_language>

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:
<code>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 = { <START> "2:16: Name 'I' must match pattern '^[a-z][a-zA-Z0-9]*$'.", <END> "8:16: Name 'P' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verify(checker, file.getPath(), expected); }</code><technical_language>getCheckMessage, do hardcode violation message in test</technical_language>

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:
<code>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) { <START> nc.setName(userName); <END> } if (pc != null) { pc.setPassword(userPassword); } if (rc != null) { rc.setText(rc.getDefaultText()); } }</code><technical_language>put this line line 119 -- nc = (NameCallback) callback; ? remove this if statement. remove line 115 117 I think. if (callback instanceof RealmChoiceCallback) { continue; }</technical_language>

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:
<code>public ApplicationPageDataStore create(final APISession session) { ApplicationAPI applicationAPI; <START> PageAPI pageAPI; <END> 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); } }</code><technical_language>declaring data out of try block</technical_language>

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:
<code>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); <START> _propertyStore.remove(jobPropertyPath, AccessOption.PERSISTENT); <END> }</code><technical_language>removeJobContext() in taskUtil</technical_language>

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:
<code>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); <START> } catch (MalformedURLException e) <END> if (!trustedHostName) { trustedUrl = webBrowserConfig.isUrlTrusted(url); } } if (trustedHostName || trustedUrl) { confirmed.set(true); } else { confirmed.set(false); } this.url = url; return this; }</code><technical_language>I catch silently ignore? nice if alert is a malformed URL</technical_language>

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; }