auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void handleResponse(AbstractResponse response) { AddOffsetsToTxnResponse addOffsetsToTxnResponse = (AddOffsetsToTxnResponse) response; Errors error = Errors.forCode(addOffsetsToTxnResponse.data.errorCode()); if (error == Errors.NONE) { log.debug("Successfully added partition for consumer group to transaction", builder.data.groupId()); pendingRequests.add(txnOffsetCommitHandler(result, offsets, groupMetadata)); transactionStarted = true; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.CONCURRENT_TRANSACTIONS) { reenqueue(); } else if (error == Errors.UNKNOWN_PRODUCER_ID || error == Errors.INVALID_PRODUCER_ID_MAPPING) { abortableErrorIfPossible(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH) { fatalError(error.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { <START> abortableError(new GroupAuthorizationException(builder.data.groupId())); <END> } else { fatalError(new KafkaException("Unexpected error in AddOffsetsToTxnResponse: " + error.message())); } }</code><technical_language>changing this? constructor a single argument takes a message groupId</technical_language>

Target:
public void handleResponse(AbstractResponse response) { AddOffsetsToTxnResponse addOffsetsToTxnResponse = (AddOffsetsToTxnResponse) response; Errors error = Errors.forCode(addOffsetsToTxnResponse.data.errorCode()); if (error == Errors.NONE) { log.debug("Successfully added partition for consumer group to transaction", builder.data.groupId()); pendingRequests.add(txnOffsetCommitHandler(result, offsets, groupMetadata)); transactionStarted = true; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.CONCURRENT_TRANSACTIONS) { reenqueue(); } else if (error == Errors.UNKNOWN_PRODUCER_ID || error == Errors.INVALID_PRODUCER_ID_MAPPING) { abortableErrorIfPossible(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH) { fatalError(error.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(GroupAuthorizationException.forGroupId(builder.data.groupId())); } else { fatalError(new KafkaException("Unexpected error in AddOffsetsToTxnResponse: " + error.message())); } }
Source:
<code>public List<Tag> getTagsOnCommit(final String revName) throws GitException, IOException, InterruptedException { <START> return withRepository(new RepositoryCallback<List<Tag>>() { <END> @Override public List<Tag> invoke(Repository db, VirtualChannel channel) throws IOException, InterruptedException { try { final ObjectId commit = db.resolve(revName); final List<Tag> ret = new ArrayList<Tag>(); for (final Map.Entry<String, Ref> tag : db.getTags().entrySet()) { Ref value = tag.getValue(); if (value != null) { final ObjectId tagId = value.getObjectId(); if (commit != null && commit.equals(tagId)) ret.add(new Tag(tag.getKey(), tagId)); } } return ret; } finally { db.close(); } } }); }</code><technical_language>this needs a static clsas outer Object serialized. (not if this run a slave - smells might...)</technical_language>

Target:
public List<Tag> getTagsOnCommit(final String revName) throws GitException, IOException, InterruptedException { return withRepository(new ListTags(revName)); }
Source:
<code>public void testPostWithUnsupportedRetryAndFailureWhileBodyIsSent() throws IOException { AtomicInteger count = new AtomicInteger(1); HttpRequestFactory reqFactory = m_client.getHttpRequestFactory(); HttpRequest req = reqFactory.buildPostRequest(new GenericUrl(m_server.getContextUrl() + "retry"), new HttpContent() { @Override public void writeTo(OutputStream out) throws IOException { System.out.println("POST write body " + count); if (count.getAndIncrement() < 2) { out.write("ba".getBytes()); throw new SocketException("TEST:cannot write"); } out.write("bar".getBytes()); } @Override public boolean retrySupported() { return false; } @Override public String getType() { return "text/plain;charset=UTF-8"; } @Override public long getLength() throws IOException { return 3; } }); req.setThrowExceptionOnExecuteError(false); <START> req.execute(); <END> }</code><technical_language>If expecting retry is performed - add assertion server side arrives</technical_language>

Target:
public void testPostWithUnsupportedRetryAndFailureWhileBodyIsSent() throws IOException { AtomicInteger count = new AtomicInteger(1); HttpRequestFactory reqFactory = m_client.getHttpRequestFactory(); HttpRequest req = reqFactory.buildPostRequest(new GenericUrl(m_server.getContextUrl() + "retry"), new HttpContent() { @Override public void writeTo(OutputStream out) throws IOException { if (count.getAndIncrement() < 2) { out.write("ba".getBytes()); throw new SocketException("TEST:cannot write"); } out.write("bar".getBytes()); } @Override public boolean retrySupported() { return false; } @Override public String getType() { return "text/plain;charset=UTF-8"; } @Override public long getLength() throws IOException { return 3; } }); req.getHeaders().set(CORRELATION_ID, "03"); try { req.execute(); } catch (org.apache.http.client.ClientProtocolException e) { for (int i = 0; i < 100 && Servlet.doPostError == null; i++) { SleepUtil.sleepSafe(100, TimeUnit.MILLISECONDS); } assertEquals(Arrays.asList("03"), Servlet.doPostLog); assertNotNull(Servlet.doPostError); assertEquals(ProcessingException.class, Servlet.doPostError.getClass()); assertEquals(org.eclipse.jetty.io.EofException.class, Servlet.doPostError.getCause().getClass()); return; } fail("Expected to fail"); }
Source:
<code>public Deferred<List<TSMeta>> getTSMetas() { if (metric == null || metric.length < 0) { throw new IllegalArgumentException("Missing metric UID"); } if (tags == null) { throw new IllegalArgumentException("Tag map was null"); } final Scanner scanner = getScanner(); scanner.setQualifier(TSMeta.COUNTER_QUALIFIER()); final Deferred<List<TSMeta>> results = new Deferred<List<TSMeta>>(); final List<TSMeta> tsmetas = new ArrayList<TSMeta>(); final List<Deferred<TSMeta>> tsmeta_group = new ArrayList<Deferred<TSMeta>>(); final class TSMetaGroupCB implements Callback<Object, ArrayList<TSMeta>> { @Override public List<TSMeta> call(ArrayList<TSMeta> ts) throws Exception { for (TSMeta tsm: ts) { if (tsm != null) { tsmetas.add(tsm); } } results.callback(tsmetas); return null; } } final class ScannerCB implements Callback<Object, ArrayList<ArrayList<KeyValue>>> { public Object scan() { return scanner.nextRows().addCallback(this); } @Override public Object call(final ArrayList<ArrayList<KeyValue>> rows) throws Exception { try { if (rows == null) { Deferred.group(tsmeta_group).addCallback(new TSMetaGroupCB()); return null; } for (final ArrayList<KeyValue> row : rows) { final byte[] tsuid = row.get(0).key(); <START> tsmeta_group.add(TSMeta.getTSMeta(tsdb, UniqueId.uidToString(tsuid))); <END> } return scan(); } catch (Exception e) { results.callback(e); return null; } } } new ScannerCB().scan(); return results; }</code><technical_language>2 seconds :) in getTSMeta is issue another GetRequest for row. Instead, for this method, want override scanner fetch META_QUALIFIER column instead of COUNTER_QUALIFIER scanner return meta data column. call TSMeta.parseFromColumn() parse out row.get(0).value(); return TSMeta object. This closer 60ms for</technical_language>

Target:
public Deferred<List<TSMeta>> getTSMetas() { if (metric == null || metric.length < 0) { throw new IllegalArgumentException("Missing metric UID"); } if (tags == null) { throw new IllegalArgumentException("Tag map was null"); } final Scanner scanner = getScanner(); scanner.setQualifier(TSMeta.META_QUALIFIER()); final Deferred<List<TSMeta>> results = new Deferred<List<TSMeta>>(); final List<TSMeta> tsmetas = new ArrayList<TSMeta>(); final List<Deferred<TSMeta>> tsmeta_group = new ArrayList<Deferred<TSMeta>>(); final class TSMetaGroupCB implements Callback<Object, ArrayList<TSMeta>> { @Override public List<TSMeta> call(ArrayList<TSMeta> ts) throws Exception { for (TSMeta tsm: ts) { if (tsm != null) { tsmetas.add(tsm); } } results.callback(tsmetas); return null; } } final class ScannerCB implements Callback<Object, ArrayList<ArrayList<KeyValue>>> { public Object scan() { return scanner.nextRows().addCallback(this); } @Override public Object call(final ArrayList<ArrayList<KeyValue>> rows) throws Exception { try { if (rows == null) { Deferred.group(tsmeta_group).addCallback(new TSMetaGroupCB()); return null; } for (final ArrayList<KeyValue> row : rows) { tsmeta_group.add(TSMeta.parseFromColumn(tsdb, row.get(0), true)); } return scan(); } catch (Exception e) { results.callback(e); return null; } } } new ScannerCB().scan(); return results; }
Source:
<code>if (t == null) { <START> try { <END> Class<?> clazz = Class.forName("androidx.test.InstrumentationRegistry"); Object context = clazz.getDeclaredMethod("getTargetContext").invoke(clazz); t = (File) context.getClass().getMethod("getCacheDir").invoke(context); } catch (Throwable ignored) { } }</code><technical_language>refactor common part a method String is different? maintaining this piece of code a bit easier</technical_language>

Target:
if (t == null) { t = getCacheDirFromInstrumentationRegistry("android.support.test.InstrumentationRegistry"); }
Source:
<code>public XmlConfigBuilder(XmlConfigLocator locator) { <START> if (locator == null) { <END> locator = new XmlConfigLocator(); locator.locateEveryWhere(); } this.in = locator.getIn(); this.configurationFile = locator.getConfigurationFile(); this.configurationUrl = locator.getConfigurationUrl(); }</code><technical_language>is expected scenario, locator provided created in standard flow? If user, create constructors: XmlConfigBuilder(XmlConfigLocator locator) XmlConfigBuilder()</technical_language>

Target:
public XmlConfigBuilder(XmlConfigLocator locator) { if (locator == null) { locator = new XmlConfigLocator(); locator.locateEverywhere(); } this.in = locator.getIn(); this.configurationFile = locator.getConfigurationFile(); this.configurationUrl = locator.getConfigurationUrl(); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); <START> builder.append("{ \"event\" : "); <END> if (event != null) { builder.append("\""); } builder.append(event); if (event != null) { builder.append("\""); } builder.append(", "); builder.append("\"id\" : "); if (id != null) { builder.append("\""); } builder.append(id); if (id != null) { builder.append("\""); } builder.append(", \"data\" : "); builder.append(data); builder.append("}"); return builder.toString(); }</code><technical_language>building JSON hand</technical_language>

Target:
public String toString() { return this.specName; }
Source:
<code>public void testParseXmlWithNonBMPCharacters() { FormInstance model = null; try { model = FormLoadingUtils.loadFormInstance(formPath); IDataPayload payload = new XFormSerializingVisitor().createSerializedPayload(model); assertTrue(payload instanceof ByteArrayPayload); assertTrue(payload.getPayloadType() == IDataPayload.PAYLOAD_TYPE_XML); ByteArrayInputStream is = (ByteArrayInputStream)payload.getPayloadStream(); try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); dBuilder.parse(is); } catch (Exception e) { <START> fail(e.getMessage()); <END> } } catch (IOException e) { fail("Unable to load form at " + formPath); } catch (InvalidStructureException e) { fail("Form at " + formPath + " has an invalid structure."); } }</code><technical_language>small nitpick: e.getMessage() in this context stack trace, kind of exception is, helpful trace itself. dump trace this call and/or a failure mode dumped</technical_language>

Target:
public void testParseXmlWithNonBMPCharacters() { FormInstance model = null; try { model = FormLoadingUtils.loadFormInstance(formPath); IDataPayload payload = new XFormSerializingVisitor().createSerializedPayload(model); assertTrue(payload instanceof ByteArrayPayload); assertTrue(payload.getPayloadType() == IDataPayload.PAYLOAD_TYPE_XML); ByteArrayInputStream is = (ByteArrayInputStream)payload.getPayloadStream(); try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); dBuilder.parse(is); } catch (Exception e) { e.printStackTrace(); fail("Xml parsing failed with exception: " + e.getMessage()); } } catch (IOException e) { fail("Unable to load form at " + formPath); } catch (InvalidStructureException e) { fail("Form at " + formPath + " has an invalid structure."); } }
Source:
<code>public String getValue(String key) { if (key.equals("compression.s2c") || key.equals("compression.c2s")) { String foo = findValue(key); <START> if (foo == null || foo.equals("no")) END> return "none,zlib@openssh.com,zlib"; return "zlib@openssh.com,zlib,none"; } return findValue(key); }</code><technical_language>style nit: missing braces</technical_language>

Target:
public String getValue(String key) { if (key.equals("compression.s2c") || key.equals("compression.c2s")) { String foo = findValue(key); if (foo == null || foo.equals("no")) { return "none,zlib@openssh.com,zlib"; } return "zlib@openssh.com,zlib,none"; } return findValue(key); }
Source:
<code><START> public void shouldGenerateRepartitionTopicWhenNameIsNotSpecified() throws ExecutionException, InterruptedException { <END> final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString()) .repartition(Repartitioned.with(Serdes.String(), Serdes.String())) .to(outputTopic); startStreams(builder); validateReceivedMessages( new StringDeserializer(), new StringDeserializer(), Arrays.asList( new KeyValue<>("1", "A"), new KeyValue<>("2", "B") ) ); final String topology = builder.build().describe().toString(); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*-repartition")); }</code><technical_language>unit-test able Topology#describe()</technical_language>

Target:
public void shouldGenerateRepartitionTopicWhenNameIsNotSpecified() throws Exception { final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString()) .repartition(Repartitioned.with(Serdes.String(), Serdes.String())) .to(outputTopic); startStreams(builder); validateReceivedMessages( new StringDeserializer(), new StringDeserializer(), Arrays.asList( new KeyValue<>("1", "A"), new KeyValue<>("2", "B") ) ); final String topology = builder.build().describe().toString(); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*-repartition")); }
Source:
<code>public Vector shuffle(Factory factory) { <START> double[] vector = new double[length]; <END> for (int i = 0; i < length; i++) { vector[i] = get(i); } Random rnd = new Random(); for (int i = vector.length - 1; i >= 0; i--) { int index = rnd.nextInt(i + 1); double a = vector[index]; vector[index] = vector[i]; vector[i] = a; } return factory().createVector(vector); }</code><technical_language>Well, do allowed convert a vector double array. techinque AbstractMatrix class</technical_language>

Target:
public Vector shuffle(Factory factory) { ensureFactoryIsNotNull(factory); Vector vector = copy(factory); Random rnd = new Random(); for (int i = 0; i < length; i++) { int rand = rnd.nextInt(length - i) + i; double a = vector.get(rand); vector.set(rand, vector.get(i)); vector.set(i, a); } return vector; }
Source:
<code>private void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { <START> LoggerUtils.logErrorWithStackTrace(IsisLog.getLogger(getClass()), e.getMessage(), e); <END> } }</code><technical_language>LoggerUtils.logErrorWithStackTrace(LOG, e.getMessage(), e)</technical_language>

Target:
private void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { LoggerUtils.logErrorWithStackTrace(LOG, e.getMessage(), e); } }
Source:
<code>public List<Class> getSupportedTypes() { <START> return new ArrayList<>(Arrays.asList(byte.class, Byte.class)); <END> }</code><technical_language>return Arrays.asList(....)</technical_language>

Target:
public List<Class> getSupportedTypes() { return Arrays.asList(byte.class, Byte.class); }
Source:
<code>private boolean isNullOrEmpty(CharSequence actual) { <START> return (actual == null || actual.length() == 0); <END> }</code><technical_language>remove unnecessary parenthesis</technical_language>

Target:
private boolean isNullOrEmpty(CharSequence actual) { return actual == null || actual.length() == 0; }
Source:
<code>protected void processListener(MethodRabbitListenerEndpoint endpoint, RabbitListener rabbitListener, Object bean, Object adminTarget, String beanName) { String id = rabbitListener.id(); if (StringUtils.hasText(id)) { if (this.attributes.getBoolean("spy")) { Object spy = Mockito.spy(bean); this.listeners.put(id, spy); super.processListener(endpoint, rabbitListener, spy, adminTarget, beanName); return; } <START> else { <END> try { ProxyFactoryBean pfb = new ProxyFactoryBean(); pfb.setProxyTargetClass(true); pfb.setTarget(bean); CaptureAdvice advice = new CaptureAdvice(); pfb.addAdvice(advice); Object advised = pfb.getObject(); this.listenerCapture.put(id, advice); super.processListener(endpoint, rabbitListener, advised, adminTarget, beanName); return; } catch (Exception e) { logger.error("Failed to proxy @RabbitListener with id: " + id); } } } else { logger.info("The test harness can only proxy @RabbitListeners with an 'id' attribute"); } super.processListener(endpoint, rabbitListener, bean, adminTarget, beanName); }</code><technical_language>I together, if...else. spy option assumes add .spy() listeners. Right ProxyFactoryBean InvocationData achieved Spy (somehow) well, expose is right wrap spy if that</technical_language>

Target:
protected void processListener(MethodRabbitListenerEndpoint endpoint, RabbitListener rabbitListener, Object bean, Object adminTarget, String beanName) { Object proxy = bean; String id = rabbitListener.id(); if (StringUtils.hasText(id)) { if (this.attributes.getBoolean("spy")) { proxy = Mockito.spy(proxy); this.listeners.put(id, proxy); } if (this.attributes.getBoolean("capture")) { try { ProxyFactoryBean pfb = new ProxyFactoryBean(); pfb.setProxyTargetClass(true); pfb.setTarget(proxy); CaptureAdvice advice = new CaptureAdvice(); pfb.addAdvice(advice); proxy = pfb.getObject(); this.listenerCapture.put(id, advice); } catch (Exception e) { logger.error("Failed to proxy @RabbitListener with id: " + id); } } } else { logger.info("The test harness can only proxy @RabbitListeners with an 'id' attribute"); } super.processListener(endpoint, rabbitListener, proxy, adminTarget, beanName); }
Source:
<code>public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { <START> final AccountManager am = AccountManager.get(mContext); <END> String authToken = am.peekAuthToken(account, authTokenType); if (TextUtils.isEmpty(authToken)) { return getLoginBundledIntent(response, account.type, authTokenType, false); } final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; }</code><technical_language>mark local variables (and parameters too, it) final needed, adds noise</technical_language>

Target:
public Bundle getAuthToken( AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { AccountManager am = AccountManager.get(context); String authToken = am.peekAuthToken(account, authTokenType); if (TextUtils.isEmpty(authToken)) { return getLoginBundledIntent(response, account.type, authTokenType, false); } final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; }
Source:
<code>public static void addLocationExtension(Activity activity, MediaFeedData item) { Map<String, Object> extensions = ensureExtensions(activity); if(item.getLocation() != null) { Map<String, Object> coordinates = new HashMap<String, Object>(); coordinates.put("type", "Point"); <START> coordinates.put("coordinates", "[" + item.getLocation().getLatitude() + "," + item.getLocation().getLongitude() + "]"); <END> extensions.put("coordinates", coordinates); } }</code><technical_language>GeoJSON is long, lat <LINK_0></technical_language>

Target:
public static void addLocationExtension(Activity activity, MediaFeedData item) { Map<String, Object> extensions = ensureExtensions(activity); if(item.getLocation() != null) { Map<String, Object> coordinates = new HashMap<String, Object>(); coordinates.put("type", "Point"); coordinates.put("coordinates", "[" + item.getLocation().getLongitude() + "," + item.getLocation().getLatitude() + "]"); extensions.put("coordinates", coordinates); } }
Source:
<code>private static void validatePath(String path) { CommonHelper.assertNotBlank("path", path); if (!path.startsWith("/")) { final String msg = "Excluded path must begin with a /"; <START> logger.error(msg); <END> throw new TechnicalException(msg); } }</code><technical_language>log throw: simply put error message exception message</technical_language>

Target:
private static void validatePath(String path) { CommonHelper.assertNotBlank("path", path); if (!path.startsWith("/")) { throw new TechnicalException("Excluded path must begin with a /"); } }
Source:
<code>void setActive(boolean isActive) { CallbackToFutureAdapter.Completer<Void> completerToSetException = null; boolean shouldResetDefault = false; synchronized (mActiveLock) { if (mIsActive == isActive) { return; } mIsActive = isActive; if (!mIsActive) { synchronized (mCompleterLock) { if (mPendingZoomRatioCompleter != null) { completerToSetException = mPendingZoomRatioCompleter; mPendingZoomRatioCompleter = null; } } shouldResetDefault = true; } } if (shouldResetDefault) { <START> setZoomRatioInternal(DEFAULT_ZOOM_RATIO, true); <END> } if (completerToSetException != null) { completerToSetException .setException(new OperationCanceledException("Camera is not active.")); } }</code><technical_language>reset related variables including - Cancel previous mPendingZoomRationCompleter set null - mCamera2CameraControl.setCropRegion(null) - Set mPendingZoomCropRegion null setZoomRationInternal function here, question is create a new completer object. new CaptureResult coming camera is inactive. completer hold camera is active receiving new CaptureResult. setZoomRationInternal set mPendingZoomRationCompleter null</technical_language>

Target:
void setActive(boolean isActive) { CallbackToFutureAdapter.Completer<Void> completerToSetException = null; boolean shouldResetDefault = false; synchronized (mActiveLock) { if (mIsActive == isActive) { return; } mIsActive = isActive; if (!mIsActive) { synchronized (mCompleterLock) { if (mPendingZoomRatioCompleter != null) { completerToSetException = mPendingZoomRatioCompleter; mPendingZoomRatioCompleter = null; mPendingZoomCropRegion = null; } } shouldResetDefault = true; } } if (shouldResetDefault) { setLiveDataValue(mZoomRatioLiveData, DEFAULT_ZOOM_RATIO); setLiveDataValue(mZoomPercentageLiveData, 0f); mCamera2CameraControl.setCropRegion(null); } if (completerToSetException != null) { completerToSetException .setException(new OperationCanceledException("Camera is not active.")); } }
Source:
<code>private void loadScript(ScriptWrapper scriptW, boolean adaptOldValues) { SessionScript script = getScriptInterface(scriptW); if (script == null) { <START> log.warn( "The script " + scriptW.getName() + " does not properly implement the Session Script interface."); warnAndResetPanel( Constant.messages.getString( "session.method.script.dialog.error.text.interface", scriptW.getName())); return; } try { String[] requiredParams = script.getRequiredParamsNames(); String[] optionalParams = script.getOptionalParamsNames(); Map<String, String> oldValues = null; if (adaptOldValues && dynamicFieldsPanel != null) { oldValues = dynamicFieldsPanel.getFieldValues(); if (log.isDebugEnabled()) log.debug("Trying to adapt old values: " + oldValues); <END> } this.dynamicFieldsPanel = new DynamicFieldsPanel(requiredParams, optionalParams); this.loadedScript = scriptW; if (adaptOldValues && oldValues != null) this.dynamicFieldsPanel.bindFieldValues(oldValues); this.dynamicContentPanel.removeAll(); this.dynamicContentPanel.add(dynamicFieldsPanel, BorderLayout.CENTER); this.dynamicContentPanel.revalidate(); } catch (Exception e) { getScriptsExtension().handleScriptException(scriptW, e); log.error("Error while calling session management script", e); warnAndResetPanel( Constant.messages.getString( "session.method.script.dialog.error.text.loading", ExceptionUtils.getRootCauseMessage(e))); } }</code><technical_language>Build a single i18n string for both? I in general i18n log messages hurt</technical_language>

Target:
private void loadScript(ScriptWrapper scriptW, boolean adaptOldValues) { SessionScript script = getScriptInterface(scriptW); if (script == null) { LOG.warn( "The script " + scriptW.getName() + " does not properly implement the Session Script interface."); warnAndResetPanel( Constant.messages.getString( "session.method.script.dialog.error.text.interface", scriptW.getName())); return; } try { String[] requiredParams = script.getRequiredParamsNames(); String[] optionalParams = script.getOptionalParamsNames(); Map<String, String> oldValues = null; if (adaptOldValues && dynamicFieldsPanel != null) { oldValues = dynamicFieldsPanel.getFieldValues(); if (LOG.isDebugEnabled()) { LOG.debug("Trying to adapt old values: " + oldValues); } } this.dynamicFieldsPanel = new DynamicFieldsPanel(requiredParams, optionalParams); this.loadedScript = scriptW; if (adaptOldValues && oldValues != null) { this.dynamicFieldsPanel.bindFieldValues(oldValues); } this.dynamicContentPanel.removeAll(); this.dynamicContentPanel.add(dynamicFieldsPanel, BorderLayout.CENTER); this.dynamicContentPanel.revalidate(); } catch (Exception e) { getScriptsExtension().handleScriptException(scriptW, e); LOG.error("Error while calling session management script", e); warnAndResetPanel( Constant.messages.getString( "session.method.script.dialog.error.text.loading", ExceptionUtils.getRootCauseMessage(e))); } }
Source:
<code><START> public Set<Territory> getNeighborsByMovementCost( <END> final Territory territory, final Unit unit, final BigDecimal movementLeft, final Predicate<Territory> cond) { Preconditions.checkArgument( movementLeft.compareTo(BigDecimal.ZERO) >= 0, "MovementLeft must be non-negative: " + movementLeft); if (movementLeft.compareTo(BigDecimal.ZERO) == 0) { return Collections.emptySet(); } final Set<Territory> start = getNeighbors(territory, cond); if (movementLeft.compareTo(BigDecimal.ONE) <= 0) { return start; } final Set<Territory> neighbors = getNeighbors(start, new HashSet<>(start), movementLeft.intValue() - 1, cond); neighbors.remove(territory); return neighbors; }</code><technical_language>This method identical above. method call this method? like: getNeighborsByMovementCost(territory, unit, movementleft, () -> true);</technical_language>

Target:
public Set<Territory> getNeighborsByMovementCost( final Territory territory, final Unit unit, final BigDecimal movementLeft, final Predicate<Territory> cond) { Preconditions.checkNotNull(unit); Preconditions.checkArgument( movementLeft.compareTo(BigDecimal.ZERO) >= 0, "MovementLeft must be non-negative: " + movementLeft); if (movementLeft.compareTo(BigDecimal.ZERO) == 0) { return Collections.emptySet(); } final Set<Territory> neighbors = getNeighbors(territory, cond); if (movementLeft.compareTo(BigDecimal.ONE) <= 0) { return neighbors; } final Set<Territory> result = getNeighbors(neighbors, new HashSet<>(neighbors), movementLeft.intValue() - 1, cond); result.remove(territory); return result; }
Source:
<code><START> private CPMProducer getProducer() throws CPMException { <END> if (this.cpmProducer == null || this.cpmProducer.isClosed()) { log.debug("Creating new CPM producer for job message dispatch..."); CPMSession session = this.getSession(); CPMProducerConfig config = session.createProducerConfig(); this.cpmProducer = session.createProducer(config); log.debug("Created new CPM producer: {}", this.cpmProducer); } return this.cpmProducer; }</code><technical_language>Lots of other methods in this class synchronized. this method need too</technical_language>

Target:
private synchronized CPMProducer getProducer() throws CPMException { if (this.cpmProducer == null || this.cpmProducer.isClosed()) { log.debug("Creating new CPM producer for job message dispatch..."); CPMSession session = this.getSession(); CPMProducerConfig config = session.createProducerConfig(); this.cpmProducer = session.createProducer(config); log.debug("Created new CPM producer: {}", this.cpmProducer); } return this.cpmProducer; }
Source:
<code>private void doDefinition(WebService.NewAction action) { action.setDescription("Search for a collection of relevant rules matching a specified query.<br/>" + "Since 5.5, following fields in the response have been deprecated :" + "<ul>" + "<li>\"effortToFixDescription\" becomes \"gapDescription\"</li>" + "<li>\"debtRemFnCoeff\" becomes \"remFnGapMultiplier\"</li>" + "<li>\"defaultDebtRemFnCoeff\" becomes \"defaultRemFnGapMultiplier\"</li>" + "<li>\"debtRemFnOffset\" becomes \"remFnBaseEffort\"</li>" + "<li>\"defaultDebtRemFnOffset\" becomes \"defaultRemFnBaseEffort\"</li>" + "<li>\"debtOverloaded\" becomes \"remFnOverloaded\"</li>" + "</ul>" + <START> "In 7.1, a new field 'scope' has been added to the response.") <END> .setResponseExample(getClass().getResource("search-example.json")) .setSince("4.4") .setHandler(this); defineRuleSearchParameters(action); }</code><technical_language>Please move this line changelog of action : action.setDescription("Search for a collection...") .setChangelog(new Change("7.1", "new field 'scope' added response") .setChangelog(new Change("7.1", "field 'scope' added 'f' parameter")</technical_language>

Target:
private void doDefinition(WebService.NewAction action) { action.setDescription("Search for a collection of relevant rules matching a specified query.<br/>" + "Since 5.5, following fields in the response have been deprecated :" + "<ul>" + "<li>\"effortToFixDescription\" becomes \"gapDescription\"</li>" + "<li>\"debtRemFnCoeff\" becomes \"remFnGapMultiplier\"</li>" + "<li>\"defaultDebtRemFnCoeff\" becomes \"defaultRemFnGapMultiplier\"</li>" + "<li>\"debtRemFnOffset\" becomes \"remFnBaseEffort\"</li>" + "<li>\"defaultDebtRemFnOffset\" becomes \"defaultRemFnBaseEffort\"</li>" + "<li>\"debtOverloaded\" becomes \"remFnOverloaded\"</li>" + "</ul>") .setResponseExample(getClass().getResource("search-example.json")) .setSince("4.4") .setHandler(this); defineRuleSearchParameters(action); }
Source:
<code>public void watch(PodActionHandler handler) throws InfrastructureException { <START> handlers.add(handler); <END> if (watch == null) { try (OpenShiftClient client = clientFactory.create()) { final Watcher<Pod> watcher = new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod pod) { handlers.forEach(h -> h.handle(action, pod)); } @Override public void onClose(KubernetesClientException ignored) }; watch = client.pods().inNamespace(namespace).watch(watcher); } catch (KubernetesClientException ex) { throw new InfrastructureException(ex.getMessage()); } } }</code><technical_language>handler registered exception occurs while watching start? mb registered watcher successfully created? I prefer</technical_language>

Target:
public void watch(PodActionHandler handler) throws InfrastructureException { if (watch == null) { final Watcher<Pod> watcher = new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod pod) { handlers.forEach(h -> h.handle(action, pod)); } @Override public void onClose(KubernetesClientException ignored) }; try (OpenShiftClient client = clientFactory.create()) { watch = client.pods().inNamespace(namespace).watch(watcher); } catch (KubernetesClientException ex) { throw new InfrastructureException(ex.getMessage()); } } handlers.add(handler); }
Source:
<code>protected static VariantContext flipIndel(final VariantContext source, final LiftOver liftOver, final ReferenceSequence referenceSequence) { <START> if (!source.isBiallelic()) return null; END> final Locatable target = getFlippedLocation(source, liftOver); if (target == null) return null; final Map<Allele, Allele> reverseComplementAlleleMap = new HashMap<>(10); reverseComplementAlleleMap.clear(); final List<Allele> alleles = new ArrayList<>(); for (final Allele oldAllele : source.getAlleles()) { final String alleleWithoutHead = oldAllele.getBaseString().substring(1, oldAllele.length()); final char refBase = (char) referenceSequence.getBases()[target.getStart() - 1]; final Allele fixedAllele = Allele.create(refBase + SequenceUtil.reverseComplement(alleleWithoutHead), oldAllele.isReference()); alleles.add(fixedAllele); reverseComplementAlleleMap.put(oldAllele, fixedAllele); } VariantContextBuilder builder = new VariantContextBuilder(source.getSource(), target.getContig(), target.getStart(), target.getEnd(), alleles); builder.id(source.getID()); builder.attributes(source.getAttributes()); builder.genotypes(fixGenotypes(source.getGenotypes(), reverseComplementAlleleMap)); builder.filters(source.getFilters()); builder.log10PError(source.getLog10PError()); return leftAlignVariant(builder.make(), referenceSequence); }</code><technical_language>(forever!)</technical_language>

Target:
protected static VariantContext flipIndel(final VariantContext source, final LiftOver liftOver, final ReferenceSequence referenceSequence) { if (!source.isBiallelic()) return null; final Interval originalLocus = new Interval(source.getContig(), source.getStart(), source.getEnd()); final Locatable target = liftOver.liftOver(originalLocus); if (target == null) return null; final boolean addToStart = target.getStart() > 1; final Map<Allele, Allele> reverseComplementAlleleMap = new HashMap<>(2); reverseComplementAlleleMap.clear(); final List<Allele> alleles = new ArrayList<>(); for (final Allele oldAllele : source.getAlleles()) { final StringBuilder alleleBuilder = new StringBuilder(target.getEnd() - target.getStart() + 1); if (addToStart) alleleBuilder.append((char) referenceSequence.getBases()[target.getStart() - 2]); alleleBuilder.append(SequenceUtil.reverseComplement(oldAllele.getBaseString().substring(1, oldAllele.length()))); if (!addToStart) alleleBuilder.append((char) referenceSequence.getBases()[target.getEnd() - 1]); final Allele fixedAllele = Allele.create(alleleBuilder.toString(), oldAllele.isReference()); alleles.add(fixedAllele); reverseComplementAlleleMap.put(oldAllele, fixedAllele); } final VariantContextBuilder builder = new VariantContextBuilder(source.getSource(), target.getContig(), target.getStart() - (addToStart ? 1 : 0), target.getEnd() - (addToStart ? 1 : 0), alleles); builder.id(source.getID()); builder.attributes(source.getAttributes()); builder.genotypes(fixGenotypes(source.getGenotypes(), reverseComplementAlleleMap)); builder.filters(source.getFilters()); builder.log10PError(source.getLog10PError()); return leftAlignVariant(builder.make(), referenceSequence); }
Source:
<code>Promise<List<JSITDefinitions>> loadDMNDefinitions() { final List<JSITDefinitions> otherDefinitions = new Vector<>(); return contentService.getFilteredItems(DMN_FILES_PATTERN).then(list -> { final List<Promise<JSITDefinitions>> fileLoadPromises = new ArrayList<>(); for (final String file : list) { final Promise<JSITDefinitions> promise = loadDefinitionFromFile(file, otherDefinitions); fileLoadPromises.add(promise); } return promises.all(fileLoadPromises.toArray(new Promise[]{})).then(v -> promises.resolve(otherDefinitions)); <START> }); <END> }</code><technical_language>array size it? java return promises .all(fileLoadPromises.toArray(new Promise[fileLoadPromises.size()])) .then(v -> promises.resolve(otherDefinitions));</technical_language>

Target:
Promise<Map<String, JSITDefinitions>> loadDMNDefinitions() { return contentService.getFilteredItems(DMN_FILES_PATTERN, ResourceListOptions.assetFolder()) .then(list -> { if (list.length == 0) { return promises.resolve(Collections.emptyMap()); } else { final Map<String, JSITDefinitions> otherDefinitions = new ConcurrentHashMap<>(); return promises.all(Arrays.asList(list), (String file) -> loadDefinitionFromFile(file, otherDefinitions)) .then(v -> promises.resolve(otherDefinitions)); } }); }
Source:
<code>public long getRetainedBytes() { <START> return INSTANCE_SIZE + pageDataSink.getRetainedSizeInBytes(); <END> }</code><technical_language>This method is unused</technical_language>

Target:
public long getRetainedBytes() { return INSTANCE_SIZE + retainedBytes + dataSink.getRetainedSizeInBytes(); }
Source:
<code><START> private void startCleanup() throws DotHibernateException { <END> try { HibernateUtil.startTransaction(); cleanUpOrphanRelationships(); HibernateUtil.commitTransaction(); FixAssetsProcessStatus.setErrorsFixed(modifiedData.size()); } catch (DotHibernateException e1) { Logger.error(this, "Unable to clean orphaned relationships.", e1); HibernateUtil.rollbackTransaction(); modifiedData.clear(); } catch (SQLException e2) { Logger.error(this, "There was an unexpected problem with cleaning up relationship in Database.", e2); HibernateUtil.rollbackTransaction(); modifiedData.clear(); } finally { flushCacheRegions(); } }</code><technical_language>new annotation instead? @jdotcms @jgambarios thoughts</technical_language>

Target:
private void startCleanup() throws DotDataException { try { cleanUpOrphanRelationships(); FixAssetsProcessStatus.setErrorsFixed(modifiedData.size()); } catch (SQLException | DotHibernateException e1) { Logger.error(this, "There was an unexpected problem with cleaning up relationship in Database.", e1); modifiedData.clear(); } }
Source:
<code>private void verifyPackChecksum(long position, MessageDigest md, DfsReader ctx) throws IOException { if (md != null) { byte[] buf = new byte[20]; byte[] actHash = md.digest(); if (ctx.copy(this, position, buf, 0, 20) != 20) { <START> setInvalid(); <END> throw new IOException(MessageFormat.format( JGitText.get().packfileIsTruncated, getPackName())); } if (!Arrays.equals(actHash, buf)) { setInvalid(); throw new IOException(MessageFormat.format( JGitText.get().packfileCorruptionDetected, getPackName())); } } }</code><technical_language>error handling is similar in 4 places extract a method</technical_language>

Target:
private void verifyPackChecksum(long position, MessageDigest md, DfsReader ctx) throws IOException { if (md != null) { byte[] buf = new byte[20]; byte[] actHash = md.digest(); if (ctx.copy(this, position, buf, 0, 20) != 20) throw packfileIsTruncated(); if (!Arrays.equals(actHash, buf)) { invalid = true; throw new IOException(MessageFormat.format( JGitText.get().packfileCorruptionDetected, getPackName())); } } }
Source:
<code>private void addEntriesToPane(FlowPane pane, Collection<? extends BibEntryType> entries) { for (BibEntryType entryType : entries) { Button entryButton = new Button(entryType.getType().getDisplayName()); entryButton.setUserData(entryType); entryButton.setOnAction(event -> setEntryTypeForReturnAndClose(Optional.of(entryType))); pane.getChildren().add(entryButton); String description = getDescription(entryType); if (StringUtil.isNotBlank(description)) { <START> Tooltip tooltip = new Tooltip(); <END> tooltip.setText(description); entryButton.setTooltip(tooltip); } } }</code><technical_language>I recommend refactoring tooltip creation following, prevents display issues, if some text exceeds screen width :smiley:: java Screen currentScreen = Screen.getPrimary(); double maxWidth = currentScreen.getBounds().getWidth(); Tooltip tooltip = new Tooltip(description); tooltip.setMaxWidth(maxWidth * 2 / 3); tooltip.setWrapText(true); entryButton.setTooltip(tooltip);</technical_language>

Target:
private void addEntriesToPane(FlowPane pane, Collection<? extends BibEntryType> entries) { for (BibEntryType entryType : entries) { Button entryButton = new Button(entryType.getType().getDisplayName()); entryButton.setUserData(entryType); entryButton.setOnAction(event -> setEntryTypeForReturnAndClose(Optional.of(entryType))); pane.getChildren().add(entryButton); EntryType selectedType = entryType.getType(); String description = getDescription(selectedType); if (StringUtil.isNotBlank(description)) { Screen currentScreen = Screen.getPrimary(); double maxWidth = currentScreen.getBounds().getWidth(); Tooltip tooltip = new Tooltip(description); tooltip.setMaxWidth((maxWidth * 2) / 3); tooltip.setWrapText(true); entryButton.setTooltip(tooltip); } } }
Source:
<code>private Trigger createTrigger(Server server) throws ParseException { int runPeriod = configuration.getRunPeriod(); Trigger trigger; if (server.getCronExpression() != null && CronExpression.isValidExpression(server.getCronExpression())) { CronTrigger cTrigger = new CronTrigger(); cTrigger.setCronExpression(server.getCronExpression()); trigger = cTrigger; } else { if (server.getRunPeriodSeconds() != null) { runPeriod = server.getRunPeriodSeconds(); } trigger = TriggerUtils.makeSecondlyTrigger(runPeriod); } <START> trigger.setName(server.getHost() + ":" + server.getPort() + "-" + Long.toString(System.nanoTime()) + "-" + UUID.randomUUID().toString().substring(0, 8)); <END> trigger.setStartTime(computeSpreadStartDate(runPeriod)); return trigger; }</code><technical_language>generate a short random String, Long.toHexString(random.nextLong()) simpler quicker</technical_language>

Target:
private Trigger createTrigger(Server server) throws ParseException { int runPeriod = configuration.getRunPeriod(); Trigger trigger; if (server.getCronExpression() != null && CronExpression.isValidExpression(server.getCronExpression())) { CronTrigger cTrigger = new CronTrigger(); cTrigger.setCronExpression(server.getCronExpression()); trigger = cTrigger; } else { if (server.getRunPeriodSeconds() != null) { runPeriod = server.getRunPeriodSeconds(); } trigger = TriggerUtils.makeSecondlyTrigger(runPeriod); } trigger.setName(server.getHost() + ":" + server.getPort() + "-" + Long.toString(System.nanoTime()) + "-" + Long.toHexString(random.nextLong())); trigger.setStartTime(computeSpreadStartDate(runPeriod)); return trigger; }
Source:
<code>private int severityForElapsedTime(long nanoTime) { final int severity; if (job.isUser() && isCanceledHitCount == 0 && options.alwaysReportNonCancelableUserJobAsError()) { severity = IStatus.ERROR; } else if (nanoTime >= options.errorThreshold()) { severity = IStatus.ERROR; } else if (nanoTime >= options.warningThreshold()) { severity = IStatus.WARNING; } <START> else if (!job.isSystem() && options.doNotReportNonCancelableFastSystemJob()) <END> { severity = IStatus.INFO; } else { severity = IStatus.OK; } return severity; }</code><technical_language>I warning threshold logged all</technical_language>

Target:
private int severityForElapsedTime(long nanoTime) { final int severity; if (job.isUser() && isCanceledHitCount == 0 && options.alwaysReportNonCancelableUserJobAsError()) { severity = IStatus.ERROR; } else if (nanoTime >= options.errorThreshold()) { severity = IStatus.ERROR; } else if (nanoTime >= options.warningThreshold()) { severity = IStatus.WARNING; } else { severity = IStatus.OK; } return severity; }
Source:
<code>public void prepareToRead(RecordReader recordReader, PigSplit pigSplit) throws IOException { RecordReaderValueIterator<Key, EventWritable> rri = new RecordReaderValueIterator<Key, EventWritable>(recordReader); <START> Iterable<Event> xformed = Iterables.transform(ImmutableList.copyOf(rri), new GettableTransform<Event>()); <END> itr = new TupleStoreIterator<Event>(xformed); }</code><technical_language>iterator need copied here? If Iterators deal Iterables. Iterator<Event> xformed = Iterators.transform(ImmutableList.copyOf(rri).iterator(), new GettableTransform<Event>());</technical_language>

Target:
public void prepareToRead(RecordReader recordReader, PigSplit pigSplit) throws IOException { RecordReaderValueIterator<Key, EventWritable> rri = new RecordReaderValueIterator<Key, EventWritable>(recordReader); Iterator<Event> xformed = Iterators.transform(rri, new GettableTransform<Event>()); itr = new TupleStoreIterator<Event>(xformed); }
Source:
<code>private void setVdsmNamesInVdsInterfaces(Network network, List<VdsNetworkInterface> interfaces) { List<VdsNetworkInterface> interfacesToUpdate = new LinkedList<>(); interfaces.stream().filter(iface -> Objects.equals(iface.getNetworkName(), network.getName())).forEach(iface -> { iface.setNetworkName(network.getVdsmName()); interfacesToUpdate.add(iface); }); <START> for (VdsNetworkInterface iface : interfaces) { if (Objects.equals(iface.getNetworkName(), network.getName())) { iface.setNetworkName(network.getVdsmName()); interfacesToUpdate.add(iface); } } <END> interfaceDao.massUpdateInterfacesForVds(interfacesToUpdate); }</code><technical_language>line removed</technical_language>

Target:
private void setVdsmNamesInVdsInterfaces(Network network, List<VdsNetworkInterface> interfaces) { List<VdsNetworkInterface> interfacesToUpdate = new LinkedList<>(); interfaces.stream().filter(iface -> Objects.equals(iface.getNetworkName(), network.getName())).forEach(iface -> { iface.setNetworkName(network.getVdsmName()); interfacesToUpdate.add(iface); }); interfaceDao.massUpdateInterfacesForVds(interfacesToUpdate); }
Source:
<code>public void testListips() throws InterruptedException { List<ServerIp> ips = serverApi().listIps(currentServer.id()); currentIP = ips.get(0); assertNotNull(ips); assertFalse(ips.isEmpty()); <START> Assert.assertTrue(ips.size() > 0); <END> }</code><technical_language>Remove redundant assertions</technical_language>

Target:
public void testListips() throws InterruptedException { List<ServerIp> ips = serverApi().listIps(currentServer.id()); currentIP = ips.get(0); assertNotNull(ips); Assert.assertTrue(ips.size() > 0); }
Source:
<code>private JarEntry getRealFileEntry(JarFile jar, String file) { String realFile = file.replaceAll("\\.html$", ".md"); <START> JarEntry entry = jar.getJarEntry(realFile); <END> return entry; }</code><technical_language>inline locals, shorter code</technical_language>

Target:
private JarEntry getRealFileEntry(JarFile jar, String file) { return jar.getJarEntry(file.replaceAll("\\.html$", ".md")); }
Source:
<code>void onEditMode(@SuppressWarnings("unused") ClickEvent e) { fileTableMode = FileTable.Mode.EDIT; refreshFileTable(); editMode.setVisible(false); <START> reply.setVisible(false); <END> addFile.setVisible(true); reviewMode.setVisible(true); }</code><technical_language>Toggling edit mode in file table, imply a change edit yet: is post reviews</technical_language>

Target:
void onEditMode(@SuppressWarnings("unused") ClickEvent e) { fileTableMode = FileTable.Mode.EDIT; refreshFileTable(); editMode.setVisible(false); addFile.setVisible(true); reviewMode.setVisible(true); }
Source:
<code>public void test_of_CurrencyCurrencyDouble() { FxRate test = FxRate.of(GBP, USD, 1.5d); assertEquals(test.getPair(), CurrencyPair.of(GBP, USD)); <START> assertEquals(test.getRate(), 1.5d, TOLERANCE); <END> assertEquals(test.toString(), "GBP/USD 1.5"); }</code><technical_language>is tolerance needed here</technical_language>

Target:
public void test_of_CurrencyCurrencyDouble() { FxRate test = FxRate.of(GBP, USD, 1.5d); assertEquals(test.getPair(), CurrencyPair.of(GBP, USD)); assertEquals(test.getRate(), 1.5d, 0); assertEquals(test.toString(), "GBP/USD 1.5"); }