auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void activate() { <START> logger.info("LgTv servlet activate called"); <END> try { bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); if (bundleContext != null) { ServiceReference<?> serviceReference1 = bundleContext .getServiceReference(LgtvBindingProvider.class.getName()); if (serviceReference1 != null) { bindingprovider = (LgtvBindingProvider) bundleContext.getService(serviceReference1); } else { logger.warn("Unable to get service reference from LgTv binding provider class"); } ServiceReference<?> serviceReference2 = bundleContext.getServiceReference(ItemRegistry.class.getName()); if (serviceReference2 != null) { itemregistry = (ItemRegistry) bundleContext.getService(serviceReference2); } else { logger.warn("Unable to get service reference from ItemRegistry class"); } } else { logger.warn("bundleContext is null. Unable to get binding provider or item registry."); } Hashtable<String, String> props = new Hashtable<String, String>(); httpService.registerServlet(WEBAPP_ALIAS + SERVLET_NAME, this, props, createHttpContext()); logger.info("Started LgTv Servlet at {}", WEBAPP_ALIAS, SERVLET_NAME); } catch (NamespaceException e) { logger.warn("NamespaceException occurred during servlet startup", e); } catch (ServletException e) { logger.warn("ServletException occurred during servlet startup", e); } catch (Exception e) { logger.warn("Unexpected exception occurred during servlet startup", e); } }</code><technical_language>debug</technical_language>

Target:
public void activate() { logger.debug("LgTv servlet activate called"); try { bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); if (bundleContext != null) { ServiceReference<?> serviceReference1 = bundleContext .getServiceReference(LgtvBindingProvider.class.getName()); if (serviceReference1 != null) { bindingprovider = (LgtvBindingProvider) bundleContext.getService(serviceReference1); } else { logger.warn("Unable to get service reference from LgTv binding provider class"); } ServiceReference<?> serviceReference2 = bundleContext.getServiceReference(ItemRegistry.class.getName()); if (serviceReference2 != null) { itemregistry = (ItemRegistry) bundleContext.getService(serviceReference2); } else { logger.warn("Unable to get service reference from ItemRegistry class"); } } else { logger.warn("bundleContext is null. Unable to get binding provider or item registry."); } Hashtable<String, String> props = new Hashtable<String, String>(); httpService.registerServlet(WEBAPP_ALIAS + SERVLET_NAME, this, props, createHttpContext()); logger.info("Started LgTv Servlet at {}{}", WEBAPP_ALIAS, SERVLET_NAME); } catch (NamespaceException e) { logger.warn("NamespaceException occurred during servlet startup", e); } catch (ServletException e) { logger.warn("ServletException occurred during servlet startup", e); } catch (Exception e) { logger.warn("Unexpected exception occurred during servlet startup", e); } }
Source:
<code>public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); cookieName = filterConfig.getInitParameter(SSO_COOKIE_NAME); if (cookieName == null) { cookieName = DEFAULT_SSO_COOKIE_NAME; } String expectedAudiences = filterConfig.getInitParameter(SSO_EXPECTED_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } authenticationProviderUrl = filterConfig.getInitParameter(SSO_AUTHENTICATION_PROVIDER_URL); if (authenticationProviderUrl == null) { LOGGER.missingAuthenticationProviderUrlConfiguration(); } String verificationPEM = filterConfig.getInitParameter(SSO_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String unAuthPathString = filterConfig.getInitParameter(SSO_UNAUTHENTICATED_PATHS_PARAM); if (StringUtils.isBlank(unAuthPathString)) { unAuthPathString = DEFAULT_SSO_UNAUTHENTICATED_PATHS_PARAM; } <START> final StringTokenizer st = new StringTokenizer(unAuthPathString, ";"); <END> while (st.hasMoreTokens()) { unAuthenticatedPaths.add(st.nextToken()); } setGatewayPath(filterConfig); configureExpectedParameters(filterConfig); }</code><technical_language>support ',' in addition ';' a delimiter here? personally burned incorrect delimiter in some provide config property values</technical_language>

Target:
public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); cookieName = filterConfig.getInitParameter(SSO_COOKIE_NAME); if (cookieName == null) { cookieName = DEFAULT_SSO_COOKIE_NAME; } String expectedAudiences = filterConfig.getInitParameter(SSO_EXPECTED_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } authenticationProviderUrl = filterConfig.getInitParameter(SSO_AUTHENTICATION_PROVIDER_URL); if (authenticationProviderUrl == null) { LOGGER.missingAuthenticationProviderUrlConfiguration(); } String verificationPEM = filterConfig.getInitParameter(SSO_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String unAuthPathString = filterConfig.getInitParameter(SSO_UNAUTHENTICATED_PATHS_PARAM); if (StringUtils.isBlank(unAuthPathString)) { unAuthPathString = DEFAULT_SSO_UNAUTHENTICATED_PATHS_PARAM; } final StringTokenizer st = new StringTokenizer(unAuthPathString, ";,"); while (st.hasMoreTokens()) { unAuthenticatedPaths.add(st.nextToken()); } setGatewayPath(filterConfig); configureExpectedParameters(filterConfig); }
Source:
<code>private static boolean isHidden(TagNode node) { String ariaHidden = node.getAttribute("ARIA-HIDDEN"); <START> return ariaHidden != null && "TRUE".equalsIgnoreCase(ariaHidden); <END> }</code><technical_language>unneeded null check</technical_language>

Target:
private static boolean isHidden(TagNode node) { return "TRUE".equalsIgnoreCase(node.getAttribute("ARIA-HIDDEN")); }
Source:
<code>private boolean queryHasDoNotSet(ExecutableElement v, boolean explicitSet) { <START> Query annotation = v.getAnnotation(Query.class); <END> if (annotation != null) { if (explicitSet) { return annotation.nullSavingStrategy() == NullSavingStrategy.DO_NOT_SET && nullSavingStrategyExplicitlySet(v, Query.class); } else { return annotation.nullSavingStrategy() == NullSavingStrategy.DO_NOT_SET; } } return false; }</code><technical_language>is a lot of boilerplate queryHasDoNotSet, setEntityHasDoNotSet, insertHasDoNotSet updateHasDoNotSet factored a common method, for example do this: java private <A extends Annotation> boolean hasDoNotSet(Class<A> clazz, Function<A, NullSavingStrategy> extractor, ExecutableElement v, boolean explicitSet) { A annotation = v.getAnnotation(clazz); if (annotation != null) { NullSavingStrategy strategy = extractor.apply(annotation); if (explicitSet) { return strategy == NullSavingStrategy.DO_NOT_SET && nullSavingStrategyExplicitlySet(v, clazz); } else { return strategy == NullSavingStrategy.DO_NOT_SET; } } return false; } private boolean queryHasDoNotSet(ExecutableElement v, boolean explicitSet) { return hasDoNotSet(Query.class, Query::nullSavingStrategy, v, explicitSet); }</technical_language>

Target:
private boolean queryHasDoNotSet(ExecutableElement v, boolean explicitSet) { return hasDoNotSet(Query.class, Query::nullSavingStrategy, v, explicitSet); }
Source:
<code>private Instant retrieveDeadlineTimestamp(JobDataMap jobDataMap) { Object timestamp = jobDataMap.get(MESSAGE_TIMESTAMP); <START> if (timestamp instanceof String) return Instant.parse(timestamp.toString()); <END> return Instant.ofEpochMilli((long) timestamp); }</code><technical_language>argument DeadlineJob</technical_language>

Target:
private Instant retrieveDeadlineTimestamp(JobDataMap jobDataMap) { Object timestamp = jobDataMap.get(MESSAGE_TIMESTAMP); if (timestamp instanceof String) { return Instant.parse(timestamp.toString()); } return Instant.ofEpochMilli((long) timestamp); }
Source:
<code>public JUnitRule(MockitoLogger logger, Strictness strictness) { this.logger = logger; if (strictness == Strictness.SILENT) { listeners.add(new SilentTestListener()); } else if (strictness == Strictness.WARN) { listeners.add(new WarningTestListener(logger)); } else if (strictness == Strictness.STRICT_STUBS) { <START> listeners.add(new StrictStubsTestListener()); <END> } }</code><technical_language>Strictness is internal enum, do of declaring listener in enum, this simplify constructor : java public JUnitRule(MockitoLogger logger, Strictness strictness) { this.logger = logger; this.listeners.add(strictness.listener()); }</technical_language>

Target:
public JUnitRule(MockitoLogger logger, Strictness strictness) { this.logger = logger; switch (strictness) { case LENIENT: listener = new NoOpTestListener(); break; case WARN: listener = new WarningTestListener(logger); break; case STRICT_STUBS: listener = new StrictStubsTestListener(); break; default: throw new IllegalArgumentException("Illegal argument: " + strictness); } }
Source:
<code>private void putHintsInExtensionsMap(Map<Object, Object> extensions) { <START> List<Map<String, Object>> recordedHints = hints.stream() <END> .map(Hint::toMap) .collect(toList()); Map<String, Object> cacheControl = new LinkedHashMap<>(); cacheControl.put("version", 1); cacheControl.put("hints", recordedHints); extensions.put("cacheControl", cacheControl); }</code><technical_language>is a FpKit.map function :-)</technical_language>

Target:
private void putHintsInExtensionsMap(Map<Object, Object> extensions) { List<Map<String, Object>> recordedHints = map(hints, Hint::toMap); Map<String, Object> cacheControl = new LinkedHashMap<>(); cacheControl.put("version", 1); cacheControl.put("hints", recordedHints); extensions.put("cacheControl", cacheControl); }
Source:
<code><START> public boolean hasValidKey(HttpRequestHeader reqHeader, JSONObject params) { <END> String apiPath; try { apiPath = reqHeader.getURI().getPath(); } catch (URIException e) { logger.error(e.getMessage(), e); return false; } String nonceParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_NONCE); if (nonceParam == null && params.has(API_NONCE_PARAM)) { nonceParam = params.getString(API_NONCE_PARAM); } if (nonceParam != null) { Nonce nonce = nonces.get(nonceParam); if (nonce == null) { logger.warn("API nonce " + nonceParam + " non found"); return false; } else if (nonce.isOneTime()) { nonces.remove(nonceParam); } if (! nonce.isValid()) { logger.warn("API nonce " + nonce.getNonceKey() + " expired at " + nonce.getExpires().toString()); return false; } if (! apiPath.equals(nonce.getApiPath())) { logger.warn("API nonce path was " + nonce.getApiPath() + " but call was for " + apiPath); return false; } } else { String keyParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_KEY); if (keyParam == null && params.has(API_KEY_PARAM)) { keyParam = params.getString(API_KEY_PARAM); } if (!getOptionsParamApi().getKey().equals(keyParam)) { logger.warn("API key incorect or not supplied: " + keyParam); return false; } } return true; }</code><technical_language>evict expired nonces. - added tag</technical_language>

Target:
public boolean hasValidKey(HttpRequestHeader reqHeader, JSONObject params) { try { String apiPath; try { apiPath = reqHeader.getURI().getPath(); } catch (URIException e) { logger.error(e.getMessage(), e); return false; } String nonceParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_NONCE); if (nonceParam == null && params.has(API_NONCE_PARAM)) { nonceParam = params.getString(API_NONCE_PARAM); } if (nonceParam != null) { Nonce nonce = nonces.get(nonceParam); if (nonce == null) { logger.warn("API nonce " + nonceParam + " not found in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } else if (nonce.isOneTime()) { nonces.remove(nonceParam); } if (! nonce.isValid()) { logger.warn("API nonce " + nonce.getNonceKey() + " expired at " + nonce.getExpires().toString() + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } if (! apiPath.equals(nonce.getApiPath())) { logger.warn("API nonce path was " + nonce.getApiPath() + " but call was for " + apiPath + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } } else { String keyParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_KEY); if (keyParam == null && params.has(API_KEY_PARAM)) { keyParam = params.getString(API_KEY_PARAM); } if (!getOptionsParamApi().getKey().equals(keyParam)) { logger.warn("API key incorrect or not supplied: " + keyParam + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } } return true; } finally { for (Entry<String, Nonce> entry : nonces.entrySet()) { if (! entry.getValue().isValid()) { nonces.remove(entry.getKey()); } } } }
Source:
<code>public Block remove( @OperatorDependency(operator = EQUAL, returnType = StandardTypes.BOOLEAN, argumentTypes = {"E", "E"}) MethodHandle equalsFunction, @TypeParameter("E") Type type, @SqlType("array(E)") Block array, @SqlType("E") Object value) { List<Integer> positions = new ArrayList<>(); for (int i = 0; i < array.getPositionCount(); i++) { Object element = readNativeValue(type, array, i); try { if (element == null) { positions.add(i); continue; } Boolean result = (Boolean) equalsFunction.invoke(element, value); if (result == null) { <START> throw new PrestoException(NOT_SUPPORTED, "array_remove does not support indeterminate comparison results"); <END> } if (!result) { positions.add(i); } } catch (Throwable t) { throw internalError(t); } } if (array.getPositionCount() == positions.size()) { return array; } if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); for (int position : positions) { type.appendTo(array, position, blockBuilder); } pageBuilder.declarePositions(positions.size()); return blockBuilder.getRegion(blockBuilder.getPositionCount() - positions.size(), positions.size()); }</code><technical_language>ditto "indeterminate" in error messages</technical_language>

Target:
public Block remove( @OperatorDependency(operator = EQUAL, returnType = StandardTypes.BOOLEAN, argumentTypes = {"E", "E"}) MethodHandle equalsFunction, @TypeParameter("E") Type type, @SqlType("array(E)") Block array, @SqlType("E") Object value) { List<Integer> positions = new ArrayList<>(); for (int i = 0; i < array.getPositionCount(); i++) { Object element = readNativeValue(type, array, i); try { if (element == null) { positions.add(i); continue; } Boolean result = (Boolean) equalsFunction.invoke(element, value); if (result == null) { throw new PrestoException(NOT_SUPPORTED, "array_remove does not support arrays with elements that are null or contain null"); } if (!result) { positions.add(i); } } catch (Throwable t) { throw internalError(t); } } if (array.getPositionCount() == positions.size()) { return array; } if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); for (int position : positions) { type.appendTo(array, position, blockBuilder); } pageBuilder.declarePositions(positions.size()); return blockBuilder.getRegion(blockBuilder.getPositionCount() - positions.size(), positions.size()); }
Source:
<code>public BouncyCastleGpgKey findSecretKey() throws IOException, NoSuchAlgorithmException, NoSuchProviderException, PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException { Exception t = null; boolean haveKeybox = exists(USER_KEYBOX_PATH); if (haveKeybox) { PGPPublicKey publicKey = null; try { publicKey = findPublicKeyInKeyBox(USER_KEYBOX_PATH); } catch (IOException e) { t = e; } if (publicKey != null) { return findSecretKeyForKeyBoxPublicKey(publicKey, USER_KEYBOX_PATH); } } boolean haveSecring = exists(USER_PGP_LEGACY_SECRING_FILE); if (haveSecring) { PGPSecretKey secretKey = findSecretKeyInLegacySecring(signingKey, USER_PGP_LEGACY_SECRING_FILE); if (secretKey != null) { if (!secretKey.isSigningKey()) { throw new PGPException(MessageFormat.format( JGitText.get().gpgNotASigningKey, signingKey)); } return new BouncyCastleGpgKey(secretKey, USER_PGP_LEGACY_SECRING_FILE); } } if (haveKeybox) { throw new PGPException(MessageFormat .format(JGitText.get().gpgNoPublicKeyFound, signingKey), t); } else if (haveSecring) { throw new PGPException(MessageFormat.format( JGitText.get().gpgNoKeyInLegacySecring, signingKey), t); } <START> throw new PGPException(JGitText.get().gpgNoKeyring, t); <END> }</code><technical_language>This exception is invalid. keyring is - corrupt</technical_language>

Target:
public BouncyCastleGpgKey findSecretKey() throws IOException, NoSuchAlgorithmException, NoSuchProviderException, PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException { BouncyCastleGpgKey key; if (exists(USER_KEYBOX_PATH)) { try { key = loadKeyFromKeybox(USER_KEYBOX_PATH); if (key != null) { return key; } throw new PGPException(MessageFormat.format( JGitText.get().gpgNoPublicKeyFound, signingKey)); } catch (NoOpenPgpKeyException e) { if (log.isDebugEnabled()) { log.debug("{} does not contain any OpenPGP keys", USER_KEYBOX_PATH); } } } if (exists(USER_PGP_LEGACY_SECRING_FILE)) { key = loadKeyFromSecring(USER_PGP_LEGACY_SECRING_FILE); if (key != null) { return key; } throw new PGPException(MessageFormat.format( JGitText.get().gpgNoKeyInLegacySecring, signingKey)); } throw new PGPException(JGitText.get().gpgNoKeyring); }
Source:
<code>public static List<ShortcutInfoCompat> getDynamicShortcuts(@NonNull Context context) { <START> if (Build.VERSION.SDK_INT >= 23) { try { return ShortcutInfoCompatSaver.getInstance(context).getShortcuts(); } catch (Exception e) { } } <END> return new ArrayList<>(); }</code><technical_language>for API 25+, get system server</technical_language>

Target:
public static List<ShortcutInfoCompat> getDynamicShortcuts(@NonNull Context context) { if (Build.VERSION.SDK_INT >= 25) { List<ShortcutInfo> shortcuts = context.getSystemService( ShortcutManager.class).getDynamicShortcuts(); List<ShortcutInfoCompat> compats = new ArrayList<>(shortcuts.size()); for (ShortcutInfo item : shortcuts) { compats.add(new ShortcutInfoCompat.Builder(context, item).build()); } return compats; } if (Build.VERSION.SDK_INT >= 23) { try { return ShortcutInfoCompatSaver.getInstance(context).getShortcuts(); } catch (Exception e) { } } return new ArrayList<>(); }
Source:
<code><START> private IllegalStateException unableToLoadEvents(I id) { <END> final String errMsg = format( "Unable to load events for the aggregate with ID: %s", Stringifiers.idToString(id) ); throw new IllegalStateException(errMsg); }</code><technical_language>static</technical_language>

Target:
private static <I> IllegalStateException unableToLoadEvents(I id) { final String errMsg = format( "Unable to load events for the aggregate with ID: %s", idToString(id) ); throw new IllegalStateException(errMsg); }
Source:
<code>public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Target target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); <START> target.choose(Outcome.BoostCreature, controller.getId(), source.getSourceId(), game); <END> int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); if (numDiscarded > 0) { game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); } return true; }</code><technical_language>AIDontUseIt (otherwise AI discard hand). for effect's constructor (AI card all)</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Target target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); target.choose(outcome, controller.getId(), source.getSourceId(), game); int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); if (numDiscarded > 0) { game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); } return true; }
Source:
<code>private boolean checkAndDisableCLIScheduler() { GlusterVolumeEntity metaVolume = getGlusterVolumeDao().getByName(getVdsGroupId(), Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); VDSGroup cluster = getVdsGroup(); if (metaVolume != null && cluster.isGlusterCliBasedSchedulingOn()) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.DisableGlusterCliSnapshotScheduleInternal, new GlusterVolumeActionParameters(getGlusterVolumeId(), true)); return <START> returnValue.getSucceeded(); <END> } return true; }</code><technical_language>if disable cli snapshot schedule failed. returning error msg UI</technical_language>

Target:
private boolean checkAndDisableCLIScheduler() { GlusterVolumeEntity metaVolume = getGlusterVolumeDao().getByName(getVdsGroupId(), Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); VDSGroup cluster = getVdsGroup(); if (metaVolume != null && cluster.isGlusterCliBasedSchedulingOn()) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.DisableGlusterCliSnapshotScheduleInternal, new GlusterVolumeActionParameters(getGlusterVolumeId(), true)); handleVdsErrors(AuditLogType.GLUSTER_CLI_SNAPSHOT_SCHEDULE_DISABLE_FAILED, returnValue.getExecuteFailedMessages()); return returnValue.getSucceeded(); } return true; }
Source:
<code>protected void appendRespondant() { try { logic.addInstructorRespondant(getUserEmailForCourse(), feedbackSessionName, courseId); } catch (InvalidParametersException | EntityDoesNotExistException e) { <START> log.severe("Fail to append instructor respondant"); <END> } }</code><technical_language>Failed* Need add more details log. e.g. course, fs, stacktrace..</technical_language>

Target:
protected void appendRespondant() { try { logic.addInstructorRespondant(getUserEmailForCourse(), feedbackSessionName, courseId); } catch (InvalidParametersException | EntityDoesNotExistException e) { log.severe("Failed to append instructor respondant. " + "Feedback Session [" + feedbackSessionName + "] of Course ID [" + courseId + "]"); } }
Source:
<code>public Tag create(final JsonObject params) throws IOException { final Tag created = this.get( this.request.method(Request.POST) .body().set(params).back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getString("sha") ); final References refs = new RtReferences(this.refsEntry, this.owner); <START> refs.create( <END> new StringBuilder().append("refs/tags/").append( params.getString("tag") ).toString(), created.key() ); return created; }</code><technical_language>refs is a one-time variable</technical_language>

Target:
public Tag create(final JsonObject params) throws IOException { final Tag created = this.get( this.request.method(Request.POST) .body().set(params).back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getString("sha") ); new RtReferences(this.entry, this.owner).create( new StringBuilder().append("refs/tags/").append( params.getString("tag") ).toString(), created.key() ); return created; }
Source:
<code>public String getTechnologyLink() { String linkTechnology; String queryString = "?id=" + technology.getId(); String environment = System.getProperty(Constants.RUNTIME_ENVIRONMENT_PROPERTY); <START> if (StringUtils.equals(Constants.PRODUCTION_PROPERTY, environment)) { <END> String applicationId = System.getProperty(Constants.APPLICATION_ID_PROPERTY); String version = System.getProperty(Constants.APPLICATION_VERSION_PROPERTY); String versionName = version.split("\\.")[0]; linkTechnology = "https://" + versionName + "-dot-" + applicationId + ".appspot.com/"; } else { linkTechnology = Constants.LINK_LOCALHOST; } return linkTechnology + Constants.PATH_VIEW_TECH_HTML + queryString; }</code><technical_language>@brunoliberal a class do that. a TechGalleryUtil</technical_language>

Target:
public String getTechnologyLink() { String linkTechnology; String queryString = "?id=" + technology.getId(); String environment = System.getProperty(Constants.RUNTIME_ENVIRONMENT_PROPERTY); if (StringUtils.equals(Constants.PRODUCTION_PROPERTY, environment)) { String applicationId = System.getProperty(Constants.APPLICATION_ID_PROPERTY); linkTechnology = "https://" + TechGalleryUtil.getApplicationVersion() + "-dot-" + applicationId + ".appspot.com/"; } else { linkTechnology = Constants.LINK_LOCALHOST; } return linkTechnology + Constants.PATH_VIEW_TECH_HTML + queryString; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(); mMapView.setMap(map); WmtsService wmtsService = new WmtsService(getString(R.string.wmts_url)); wmtsService.addDoneLoadingListener(() -> { if (wmtsService.getLoadStatus() == LoadStatus.LOADED) { WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo(); List<WmtsLayerInfo> layerInfoList = wmtsServiceInfo.getLayerInfos(); WmtsLayer wmtsLayer = new WmtsLayer(layerInfoList.get(0)); map.setBasemap(new Basemap(wmtsLayer)); } else { String error = "Error loading WMTS Service: " + wmtsService.getLoadError(); Log.e(TAG, error); <START> Toast.makeText(this, error, Toast.LENGTH_LONG); <END> } }); wmtsService.loadAsync(); }</code><technical_language>needs .show() end</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(); mMapView.setMap(map); WmtsService wmtsService = new WmtsService(getString(R.string.wmts_url)); wmtsService.addDoneLoadingListener(() -> { if (wmtsService.getLoadStatus() == LoadStatus.LOADED) { WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo(); List<WmtsLayerInfo> layerInfoList = wmtsServiceInfo.getLayerInfos(); WmtsLayer wmtsLayer = new WmtsLayer(layerInfoList.get(0)); map.setBasemap(new Basemap(wmtsLayer)); } else { String error = "Error loading WMTS Service: " + wmtsService.getLoadError(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); } }); wmtsService.loadAsync(); }
Source:
<code><START> public boolean markBackedUp() { <END> try { processEvent(Event.OperationNotPerformed); } catch (NoTransitionException ex) { s_logger.error("no transition error: ", ex); return false; } return true; }</code><technical_language>returning a boolean here? I mean, capture a checked exception here, return false. Then, in method this markBackedUp, check if return is false, throw a runtime exception. capture checked exception throw runtime here? Also, unit test cases</technical_language>

Target:
public void markBackedUp() throws CloudRuntimeException{ try { processEvent(Event.OperationNotPerformed); } catch (NoTransitionException ex) { s_logger.error("no transition error: ", ex); throw new CloudRuntimeException("Error marking snapshot backed up: " + this.snapshot.getId() + " " + ex.getMessage()); } }
Source:
<code>public void shouldRemoveCompactionFromConfigTopicSettings() { Map<String, String> expectedTopicSettings = new HashMap<>(); expectedTopicSettings.put("foo", "foo value"); expectedTopicSettings.put("bar", "bar value"); expectedTopicSettings.put("baz.bim", "100"); Map<String, String> topicSettings = new HashMap<>(expectedTopicSettings); topicSettings.put("cleanup.policy", "something-else"); topicSettings.put("partitions", "3"); Map<String, String> settings = configs(); <START> topicSettings.entrySet().forEach(e -> { <END> settings.put(DistributedConfig.CONFIG_STORAGE_PREFIX + e.getKey(), e.getValue()); }); DistributedConfig config = new DistributedConfig(settings); Map<String, Object> actual = config.configStorageTopicSettings(); assertEquals(expectedTopicSettings, actual); assertNotEquals(topicSettings, actual); }</code><technical_language>topicSettings.forEach((k, v) -> {...}); is a shorthand in cases need pass entry stream stages</technical_language>

Target:
public void shouldRemoveCompactionFromConfigTopicSettings() { Map<String, String> expectedTopicSettings = new HashMap<>(); expectedTopicSettings.put("foo", "foo value"); expectedTopicSettings.put("bar", "bar value"); expectedTopicSettings.put("baz.bim", "100"); Map<String, String> topicSettings = new HashMap<>(expectedTopicSettings); topicSettings.put("cleanup.policy", "something-else"); topicSettings.put("partitions", "3"); Map<String, String> settings = configs(); topicSettings.forEach((k, v) -> { settings.put(DistributedConfig.CONFIG_STORAGE_PREFIX + k, v); }); DistributedConfig config = new DistributedConfig(settings); Map<String, Object> actual = config.configStorageTopicSettings(); assertEquals(expectedTopicSettings, actual); assertNotEquals(topicSettings, actual); }
Source:
<code>public ChannelState(ChannelConfig config, ChannelUID channelUID, Value value, @Nullable ChannelStateUpdateListener channelStateUpdateListener) { this.config = config; this.channelStateUpdateListener = channelStateUpdateListener; this.channelUID = channelUID; this.value = value; this.readOnly = StringUtils.isBlank(config.commandTopic); <START> this.trigger = config.trigger; <END> }</code><technical_language>Please remove trigger field completely config.trigger</technical_language>

Target:
public ChannelState(ChannelConfig config, ChannelUID channelUID, Value value, @Nullable ChannelStateUpdateListener channelStateUpdateListener) { this.config = config; this.channelStateUpdateListener = channelStateUpdateListener; this.channelUID = channelUID; this.value = value; this.readOnly = StringUtils.isBlank(config.commandTopic); }
Source:
<code>protected String convertToString(Locale locale, Object value) { if (Number.class.isInstance(value)) { NumberFormat format = NumberFormat.getNumberInstance(locale); format.setGroupingUsed(false); if (BigDecimal.class.isInstance(value) || Double.class.isInstance(value) || Float.class.isInstance(value)) { format.setMinimumFractionDigits(1); <START> if (BigDecimal.class.isInstance(value)) <END> format.setMaximumFractionDigits(Integer.MAX_VALUE); else if (Double.class.isInstance(value)) format.setMaximumFractionDigits(15); else if (Float.class.isInstance(value)) format.setMaximumFractionDigits(7); } return format.format(value); } else { return Objects.toString(value, null); } }</code><technical_language>Please { } if is line</technical_language>

Target:
protected String convertToString(Locale locale, Object value) { if (Number.class.isInstance(value)) { NumberFormat format = NumberFormat.getNumberInstance(locale); format.setGroupingUsed(false); Object fixedValue = value; if (BigDecimal.class.isInstance(value) || Double.class.isInstance(value) || Float.class.isInstance(value)) { format.setMaximumFractionDigits(Integer.MAX_VALUE); if (Float.class.isInstance(value)) { fixedValue = Double.valueOf(value.toString()); } } return format.format(fixedValue); } else { return Objects.toString(value, null); } }
Source:
<code>private static String computeNewName(String str) { <START> String fileExtension = ""; END> String fileNameNoExtension = str; Pattern p = Pattern.compile("[0-9]+$"); Matcher m = p.matcher(fileNameNoExtension); if (m.find()) { int newNumber = Integer.parseInt(m.group()) + 1; String numberStr = m.replaceFirst(Integer.toString(newNumber)); return numberStr + fileExtension; } return fileNameNoExtension + "2" + fileExtension; }</code><technical_language>fileExtension used</technical_language>

Target:
private static String computeNewName(String str) { String fileNameNoExtension = str; Pattern p = Pattern.compile("[0-9]+$"); Matcher m = p.matcher(fileNameNoExtension); if (m.find()) { int newNumber = Integer.parseInt(m.group()) + 1; return m.replaceFirst(Integer.toString(newNumber)); } return fileNameNoExtension + "2"; }
Source:
<code>public LockResponse lock(LockRequest request) { if (request.getLockDescriptors().size() <= LOCK_BATCH_THRESHOLD) { return timelockService.lock(request); } Instant startTime = clock.instant(); Duration initialAcquireTimeout = Duration.ofMillis(request.getAcquireTimeoutMs()); List<LockDescriptor> sortedLockDescriptors = Ordering.natural().immutableSortedCopy(request.getLockDescriptors()); BatchedLockDescriptors descriptors = new BatchedLockDescriptors(); try { for (List<LockDescriptor> batch : Iterables.partition(sortedLockDescriptors, LOCK_BATCH_THRESHOLD)) { Optional<Duration> acquireTimeout = acquireTimeout(startTime, initialAcquireTimeout); if (!acquireTimeout.isPresent()) { return descriptors.failure(); } LockRequest batchedRequest = ImmutableLockRequest.builder() .from(request) .acquireTimeoutMs(acquireTimeout.get().toMillis()) .lockDescriptors(batch) .build(); LockResponse response = timelockService.lock(batchedRequest); if (!response.wasSuccessful()) { <START> return descriptors.failure(); <END> } descriptors.add(response.getToken()); } } catch (RuntimeException e) { throw descriptors.failure(e); } return descriptors.success(); }</code><technical_language>copy failure mode</technical_language>

Target:
public LockResponse lock(LockRequest request) { if (request.getLockDescriptors().size() <= lockBatchThreshold) { return timelockService.lock(request); } Instant startTime = clock.instant(); Duration initialAcquireTimeout = Duration.ofMillis(request.getAcquireTimeoutMs()); List<LockDescriptor> sortedLockDescriptors = Ordering.natural().immutableSortedCopy(request.getLockDescriptors()); BatchedLockDescriptors descriptors = new BatchedLockDescriptors(); try { for (List<LockDescriptor> batch : Iterables.partition(sortedLockDescriptors, lockBatchThreshold)) { Optional<Duration> acquireTimeout = acquireTimeout(startTime, initialAcquireTimeout); if (!acquireTimeout.isPresent()) { return descriptors.failure(LockResponse.timedOut()); } LockRequest batchedRequest = ImmutableLockRequest.builder() .requestId(requestIdSupplier.get()) .acquireTimeoutMs(acquireTimeout.get().toMillis()) .lockDescriptors(batch) .build(); LockResponse response = timelockService.lock(batchedRequest); if (!response.wasSuccessful()) { return descriptors.failure(response); } descriptors.add(response.getToken()); } } catch (RuntimeException e) { throw descriptors.failure(e); } return descriptors.success(); }
Source:
<code>public void processLeftCheckpoint(final MistCheckpointEvent input) { <START> outputEmitter.emitCheckpoint(input); <END> }</code><technical_language>checkpoint states of union operator</technical_language>

Target:
public void processLeftCheckpoint(final MistCheckpointEvent input) { leftUpstreamQueue.add(input); drainUntilMinimumWatermark(); }
Source:
<code>private static Type targetType(TypeCastTree typeCastTree) { Tree parent = skipParentheses(typeCastTree.parent()); switch (parent.kind()) { case RETURN_STATEMENT: Tree method = parent; while (!method.is(Tree.Kind.METHOD, Tree.Kind.LAMBDA_EXPRESSION)) { method = method.parent(); } if (method.is(Tree.Kind.METHOD)) { MethodTree methodTree = (MethodTree) method; Type type = methodTree.symbol().type(); if (type instanceof MethodJavaType) { return ((MethodJavaType) type).resultType(); } return methodTree.symbol().returnType().type(); } return null; case VARIABLE: <START> return ((VariableTree) parent).symbol().type(); <END> case ARGUMENTS: Arguments arguments = (Arguments)parent; int castArgIndex = arguments.indexOf(typeCastTree); return arguments.get(castArgIndex).symbolType(); case MEMBER_SELECT: case CONDITIONAL_EXPRESSION: return typeCastTree.type().symbolType(); case ARRAY_ACCESS_EXPRESSION: return ((ArrayAccessExpressionTree) parent).expression().symbolType(); default: if (parent instanceof ExpressionTree) { return ((ExpressionTree) parent).symbolType(); } return null; } }</code><technical_language>nice move, I thought this creating ticket! :+1:</technical_language>

Target:
private static Type targetType(TypeCastTree typeCastTree) { Tree parent = skipParentheses(typeCastTree.parent()); switch (parent.kind()) { case RETURN_STATEMENT: Tree method = parent; while (!method.is(Tree.Kind.METHOD, Tree.Kind.LAMBDA_EXPRESSION)) { method = method.parent(); } if (method.is(Tree.Kind.METHOD)) { MethodTree methodTree = (MethodTree) method; Type type = methodTree.symbol().type(); if (type instanceof MethodJavaType) { return ((MethodJavaType) type).resultType(); } return methodTree.symbol().returnType().type(); } return null; case VARIABLE: return ((VariableTree) parent).symbol().type(); case ARGUMENTS: Arguments arguments = (Arguments) parent; Tree invocation = arguments.parent(); if (invocation.is(Tree.Kind.METHOD_INVOCATION)) { return targetTypeFromMethodSymbol(((MethodInvocationTree) invocation).symbol(), arguments, typeCastTree); } if (invocation.is(Tree.Kind.NEW_CLASS)) { return targetTypeFromMethodSymbol(((NewClassTree) invocation).constructorSymbol(), arguments, typeCastTree); } return null; case MEMBER_SELECT: case CONDITIONAL_EXPRESSION: return typeCastTree.type().symbolType(); case ARRAY_ACCESS_EXPRESSION: return ((ArrayAccessExpressionTree) parent).expression().symbolType(); default: if (parent instanceof ExpressionTree) { return ((ExpressionTree) parent).symbolType(); } return null; } }
Source:
<code>private Query rewriteDataSources(Query query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof RegexDataSource) { Set<String> found = Sets.newLinkedHashSet(); Iterable<DruidServer> inventory = serverInventoryView.getInventory(); <START> for (String pattern : dataSource.getNames()) { <END> Matcher matcher = Pattern.compile(pattern).matcher(""); for (DruidServer server : inventory) { for (DruidDataSource source : server.getDataSources()) { if (matcher.reset(source.getName()).matches()) { found.add(source.getName()); } } } } if (found.size() == 1) { query = query.withDataSource(new TableDataSource(Iterables.getOnlyElement(found))); } else { query = query.withDataSource(new UnionDataSource(TableDataSource.of(found))); } } else if (dataSource instanceof QueryDataSource) { Query subQuery = rewriteDataSources(((QueryDataSource) query).getQuery()); query = query.withDataSource(new QueryDataSource(subQuery)); } return query; }</code><technical_language>more efficient iterate server/datasources in outer loops check regex matches inside, skipping regex checks for a datasource if matches already</technical_language>

Target:
private Query rewriteDataSources(Query query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof RegexDataSource) { List<Matcher> matchers = Lists.newArrayList(); for (String pattern : dataSource.getNames()) { matchers.add(Pattern.compile(pattern).matcher("")); } Set<String> found = Sets.newLinkedHashSet(); for (DruidServer server : serverInventoryView.getInventory()) { for (DruidDataSource source : server.getDataSources()) { if (!found.contains(source.getName())) { for (Matcher matcher : matchers) { if (matcher.reset(source.getName()).matches()){ found.add(source.getName()); break; } } } } } if (found.size() == 1) { query = query.withDataSource(new TableDataSource(Iterables.getOnlyElement(found))); } else { query = query.withDataSource(new UnionDataSource(TableDataSource.of(found))); } } else if (dataSource instanceof QueryDataSource) { Query subQuery = rewriteDataSources(((QueryDataSource) query).getQuery()); query = query.withDataSource(new QueryDataSource(subQuery)); } return query; }
Source:
<code>public WorkspaceImpl createWorkspace( <START> Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) <END> throws ServerException, DevfileFormatException, ConflictException, NotFoundException, ValidationException, DevfileRecipeFormatException { WorkspaceConfigImpl workspaceConfig = createWorkspaceConfig(devfile, recipeFileContentProvider); final String namespace = EnvironmentContext.getCurrent().getSubject().getUserName(); return workspaceManager.createWorkspace( findAvailableName(workspaceConfig), namespace, emptyMap()); }</code><technical_language>recipeFileContentProvider param is missing in java doc. DevfileRecipeFormatException is desribed in @throws section</technical_language>

Target:
public WorkspaceImpl createWorkspace( Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) throws ServerException, ConflictException, NotFoundException, ValidationException, DevfileException { WorkspaceConfigImpl workspaceConfig = createWorkspaceConfig(devfile, recipeFileContentProvider); final String namespace = EnvironmentContext.getCurrent().getSubject().getUserName(); return workspaceManager.createWorkspace( findAvailableName(workspaceConfig), namespace, emptyMap()); }
Source:
<code>public Boolean call() { try { query(sql); return false; } <START> catch (QueryExecutionException ExceptionDueToQueryCancellation) { <END> return true; } }</code><technical_language>catch (QueryExecutionException exception) {</technical_language>

Target:
public Void call() { assertThat(() -> query(sql)).failsWithMessage("Query was canceled"); return null; }
Source:
<code>public void testShowHideExperimentalPerspectiveMenus() { testAddMenusWithExperimentalPerspective(); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false)); <START> verify(view, times(1)).setMenuItemVisible(PERSPECTIVE_ID, false); <END> presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true)); verify(view, times(1)).setMenuItemVisible(SECOND_PERSPECTIVE_ID, true); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false)); verify(view, times(1)).setMenuItemVisible(THIRD_PERSPECTIVE_ID, false); }</code><technical_language>more times(1)</technical_language>

Target:
public void testShowHideExperimentalPerspectiveMenus() { testAddMenusWithExperimentalPerspective(); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false)); verify(view).setMenuItemVisible(PERSPECTIVE_ID, false); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true)); verify(view).setMenuItemVisible(SECOND_PERSPECTIVE_ID, true); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false)); verify(view).setMenuItemVisible(THIRD_PERSPECTIVE_ID, false); }
Source:
<code>public void testDebugContextRsAllocationCopy2D_Short_BadYCount() { setupAllocationCopyTests AC = new setupAllocationCopyTests(this, 2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs))); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); <START> END> X count Soob.set_yCount(AC.Height - yOff + 1); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); assertTrue(mRanErrorHandler); RenderScript.releaseAllContexts(); }</code><technical_language>Nit: precede end-of-line "//" 2 spaces</technical_language>

Target:
public void testDebugContextRsAllocationCopy2D_Short_BadYCount() { SetupAllocationCopyTests AC = new SetupAllocationCopyTests(2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)), 0x172d8ac0); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(AC.Height - yOff + 1); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); assertTrue(mRanErrorHandler); RenderScript.releaseAllContexts(); }
Source:
<code>public static void <START> registerClass(Event event) { <END> typesByString.put(event.getType(), event.getClass()); }</code><technical_language>this accept a Class? caller instantiate instance call getClass() discarded</technical_language>

Target:
public static void registerClass(Event event) { String type = event.getType(); if (typesByString.containsKey(type)) { throw new IllegalArgumentException( "Event type already registered: " + type); } typesByString.put(type, event.getClass()); }
Source:
<code>private boolean isCheckStatusSupported() { <START> VDS vds = getDbFacade().getVdsDao().get(getParameters().getVdsId()); <END> return FeatureSupported.getDeviceListWithoutStatusSupported( vds.getVdsGroupCompatibilityVersion()); }</code><technical_language>a getVds() method</technical_language>

Target:
private boolean isCheckStatusSupported() { return FeatureSupported.getDeviceListWithoutStatusSupported( getVds().getVdsGroupCompatibilityVersion()); }
Source:
<code>public static void main(String[] args) throws Exception { final String FROZEN_MLP = new ClassPathResource(BASE_DIR + "/frozen_model.pb").getFile().getPath(); Map<String, INDArray> inputsPredictions = readPlaceholdersAndPredictions(); val graph = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graph.associateArrayWithVariable(inputsPredictions.get("input_a"), graph.variableMap().get("input")); val executioner = new NativeGraphExecutioner(); val results = executioner.executeGraph(graph); INDArray libnd4jPred = ((INDArray[]) results)[0]; System.out.println("LIBND4J exec prediction for input_a:\n"+libnd4jPred); <START> if (libnd4jPred.equals(inputsPredictions.get("prediction_a"))) { <END> System.out.println("Predictions are equal to tensorflow"); } val graphSD = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graphSD.associateArrayWithVariable(inputsPredictions.get("input_b"), graph.variableMap().get("input")); INDArray samediffPred = graphSD.execAndEndResult(); System.out.println("SameDiff exec prediction for input_b:\n"+samediffPred); if(samediffPred.equals(inputsPredictions.get("prediction_b"))) { System.out.println("Predictions are equal to tensorflow"); } System.out.println("Adding new op to graph.."); SDVariable linspaceConstant = graphSD.var("linspace", Nd4j.linspace(1, 10, 10)); SDVariable totalOutput = graphSD.getVariable("output").add(linspaceConstant); INDArray totalOutputArr = totalOutput.eval(); System.out.println(totalOutputArr); }</code><technical_language>Nitpick: throw error if outputs do match</technical_language>

Target:
public static void main(String[] args) throws Exception { final String FROZEN_MLP = new ClassPathResource(BASE_DIR + "/frozen_model.pb").getFile().getPath(); Map<String, INDArray> inputsPredictions = readPlaceholdersAndPredictions(); val graph = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graph.associateArrayWithVariable(inputsPredictions.get("input_a"), graph.variableMap().get("input")); val executioner = new NativeGraphExecutioner(); val results = executioner.executeGraph(graph); INDArray libnd4jPred = ((INDArray[]) results)[0]; System.out.println("LIBND4J exec prediction for input_a:\n" + libnd4jPred); if (libnd4jPred.equals(inputsPredictions.get("prediction_a"))) { System.out.println("Predictions are equal to tensorflow"); } else { throw new RuntimeException("Predictions don't match!"); } val graphSD = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graphSD.associateArrayWithVariable(inputsPredictions.get("input_b"), graph.variableMap().get("input")); INDArray samediffPred = graphSD.execAndEndResult(); System.out.println("SameDiff exec prediction for input_b:\n" + samediffPred); if (samediffPred.equals(inputsPredictions.get("prediction_b"))) { System.out.println("Predictions are equal to tensorflow"); } System.out.println("Adding new op to graph.."); SDVariable linspaceConstant = graphSD.var("linspace", Nd4j.linspace(1, 10, 10)); SDVariable totalOutput = graphSD.getVariable("output").add(linspaceConstant); INDArray totalOutputArr = totalOutput.eval(); System.out.println(totalOutputArr); }
Source:
<code><START> PercentEscaper(String safeCharacters, boolean usePlusForSpace) { <END> this.usePlusForSpace = usePlusForSpace; this.safeCharacterPoints = new HashSet<>(); SAFE_CHARACTERS.codePoints().forEach(safeCharacterPoints::add); if (!CoreUtils.isNullOrEmpty(safeCharacters)) { safeCharacters.codePoints().forEach(safeCharacterPoints::add); } }</code><technical_language>verify space is in safeCharacters if usePlusForSpace is true</technical_language>

Target:
PercentEscaper(String safeCharacters, boolean usePlusForSpace) { this.usePlusForSpace = usePlusForSpace; if (usePlusForSpace && safeCharacters != null && safeCharacters.contains(" ")) { throw logger.logExceptionAsError(new IllegalArgumentException( "' ' as a safe character with 'usePlusForSpace = true' is an invalid configuration.")); } this.safeCharacterPoints = new HashSet<>(); SAFE_CHARACTERS.codePoints().forEach(safeCharacterPoints::add); if (!CoreUtils.isNullOrEmpty(safeCharacters)) { safeCharacters.codePoints().forEach(safeCharacterPoints::add); } }