auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private <A> void setPrimitiveArray(int parameterIndex, A in) throws SQLException { final PrimitiveArraySupport.ArrayToString<A> arrayToString = PrimitiveArraySupport.getArrayToString(in); final int oid = arrayToString.getDefaultArrayTypeOid(); if (arrayToString.supportBinaryRepresentation() && connection.getPreferQueryMode() != PreferQueryMode.SIMPLE) { <START> bindBytes(parameterIndex, arrayToString.toBinaryRepresentation(in), oid); <END> } else { final char delim = connection.getTypeInfo().getArrayDelimiter(oid); setString(parameterIndex, arrayToString.toArrayString(delim, in), oid); } }</code><technical_language>arrayToString.toBinaryRepresentation sound weird</technical_language>

Target:
private <A> void setPrimitiveArray(int parameterIndex, A in) throws SQLException { final PrimitiveArraySupport<A> arrayToString = PrimitiveArraySupport.getArraySupport(in); final TypeInfo typeInfo = connection.getTypeInfo(); final int oid = arrayToString.getDefaultArrayTypeOid(typeInfo); if (arrayToString.supportBinaryRepresentation() && connection.getPreferQueryMode() != PreferQueryMode.SIMPLE) { bindBytes(parameterIndex, arrayToString.toBinaryRepresentation(connection, in), oid); } else { final char delim = typeInfo.getArrayDelimiter(oid); setString(parameterIndex, arrayToString.toArrayString(delim, in), oid); } }
Source:
<code><START> private void fillResetPasswordForm(final RecoverPasswordPageContent viewModel, final Void input, final Form<? extends RecoverPasswordFormData> form) { <END> viewModel.setPasswordRecoveryForm(form); }</code><technical_language>Is private for some reason</technical_language>

Target:
protected void fillResetPasswordForm(final RecoverPasswordPageContent viewModel, final Void input, final Form<? extends RecoverPasswordFormData> form) { viewModel.setPasswordRecoveryForm(form); }
Source:
<code>public final void endRecord() { getReceiver().process(builder.toString()); <START> builder = new StringBuilder(); <END> }</code><technical_language>is times faster builder.setLength(0) compared allocating a new builder. Addtionally, builder reset start record event. reason is endRecord() event is if error occurs whil processing record. In cases encoder simple receive a new startRecord() event discard remaining data previous record</technical_language>

Target:
public void endRecord() { getReceiver().process(builder.toString()); this.entityOpen = false; }
Source:
<code>void setHttpPath(final URL httpPath) { final String authority = httpPath.getAuthority(); final Discovery discovery = new Discovery(); if (!discovery.getValidHosts().contains(authority)) { return; } final String[] splitArray = httpPath.getPath().split("/"); <START> final StringBuilder logPath = new StringBuilder(); <END> logPath.append(httpPath.getProtocol()); logPath.append("://"); logPath.append(authority); logPath.append("/"); for (int i = 2; i < splitArray.length; i++) { logPath.append(splitArray[i]); logPath.append("/"); } setEvent(EventStrings.HTTP_PATH, logPath.toString()); }</code><technical_language>Please URL builder instead in here. #WontFix</technical_language>

Target:
void setHttpPath(final URL httpPath) { final String authority = httpPath.getAuthority(); final Discovery discovery = new Discovery(); if (!discovery.getValidHosts().contains(authority)) { return; } final String[] splitArray = httpPath.getPath().split("/"); final StringBuilder logPath = new StringBuilder(); logPath.append(httpPath.getProtocol()); logPath.append("://"); logPath.append(authority); logPath.append("/"); for (int i = 2; i < splitArray.length; i++) { logPath.append(splitArray[i]); logPath.append("/"); } setProperty(EventStrings.HTTP_PATH, logPath.toString()); }
Source:
<code>public void testGetCompletionTimesSingleFragment() throws Exception { Trace trace1 = new Trace(); trace1.setId("1"); <START> trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - 4000); END> Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(1234); trace1.getNodes().add(c1); tracePublisher.publish(null, Collections.singletonList(trace1)); Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 1); Wait.until(() -> analyticsService.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analyticsService.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(1234, times.get(0).getDuration()); }</code><technical_language>in previous file (and other places in this file. If fix applied in previous file, apply here</technical_language>

Target:
public void testGetCompletionTimesSingleFragment() throws Exception { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - FOUR_MS_IN_MICRO_SEC); Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(1234); trace1.getNodes().add(c1); tracePublisher.publish(null, Collections.singletonList(trace1)); Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 1); Wait.until(() -> analyticsService.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analyticsService.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(1234, times.get(0).getDuration()); }
Source:
<code>private String readStringFromExtendedJson() { <START> JsonToken patternToken = popToken(); <END> if (patternToken.getType() != JsonTokenType.STRING && patternToken.getType() != JsonTokenType.UNQUOTED_STRING) { throw new JsonParseException("JSON reader expected a string but found '%s'.", patternToken.getValue()); } return patternToken.getValue(String.class); }</code><technical_language>This change casts wide a net, this method is called methods implementing "Extended JSON" for methods implementing "Shell" mode, e.g. JsonReader#visitObjectIdConstructor, correct in shell do like: { _id : ObjectId(5aaff8caa33024673db4cddf) } called read values in some places, keys. address this, I need leave current method add a new method is read extended JSON keys, e.g. in JsonReader#visitTimestampExtendedJson</technical_language>

Target:
private String readStringFromExtendedJson() { JsonToken patternToken = popToken(); if (patternToken.getType() != JsonTokenType.STRING) { throw new JsonParseException("JSON reader expected a string but found '%s'.", patternToken.getValue()); } return patternToken.getValue(String.class); }
Source:
<code>private Map<Class<? extends Event>, Map<String, RegisteredListener>> getListenersByEvent() { if (this.listenersByEvent == null) { initializeListeners(); } <START> synchronized (this.listenersByEvent) { <END> return this.listenersByEvent; } }</code><technical_language>This is great for performance adds locking read (notify). If need this a ReadWriteLock instead. this lock impact removeListener getListenersByName(), enough</technical_language>

Target:
private Map<Class<? extends Event>, Map<String, RegisteredListener>> getListenersByEvent() { if (this.listenersByEvent == null) { initializeListeners(); } return this.listenersByEvent; }
Source:
<code>private static SubclassLoader tryLookup() { try { Class<?> methodHandles = Class.forName("java.lang.invoke.MethodHandles"); Object lookup = methodHandles.getMethod("lookup").invoke(null); Method privateLookupIn = methodHandles.getMethod("privateLookupIn", Class.class, Class.forName("java.lang.invoke.MethodHandles$Lookup")); Object codegenLookup = privateLookupIn.invoke(null, InjectionBase.class, lookup); return new WithLookup(lookup, codegenLookup, privateLookupIn); } catch (Exception ignored) { <START> throw mockingImpossible(); <END> } }</code><technical_language>Lets add exception in trace here. understand root</technical_language>

Target:
private static SubclassLoader tryLookup() { try { Class<?> methodHandles = Class.forName("java.lang.invoke.MethodHandles"); Object lookup = methodHandles.getMethod("lookup").invoke(null); Method privateLookupIn = methodHandles.getMethod("privateLookupIn", Class.class, Class.forName("java.lang.invoke.MethodHandles$Lookup")); Object codegenLookup = privateLookupIn.invoke(null, InjectionBase.class, lookup); return new WithLookup(lookup, codegenLookup, privateLookupIn); } catch (Exception exception) { throw new MockitoException(join(ERROR_MESSAGE, "", Platform.describe()), exception); } }
Source:
<code>public void testLiteralElse() throws Exception { final DefaultConfiguration configurationTestLiteralElse = createCheckConfig(WhitespaceAfterCheck.class); configurationTestLiteralElse.addAttribute("tokens", "LITERAL_ELSE"); final String[] expected = { "27:15: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "else"), }; <START> verify(configurationTestLiteralElse, getPath("InputWhitespaceAfterConditions.java"), <END> expected); }</code><technical_language>Please separate input file for test</technical_language>

Target:
public void testLiteralElse() throws Exception { final DefaultConfiguration configurationTestLiteralElse = createCheckConfig(WhitespaceAfterCheck.class); configurationTestLiteralElse.addAttribute("tokens", "LITERAL_ELSE"); final String[] expected = { "27:15: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "else"), }; verify(configurationTestLiteralElse, getPath("InputWhitespaceAfterLiteralElse.java"), expected); }
Source:
<code>private void fireAddParameterEvents(ITestResult iTestResult) { Object[] parameters = iTestResult.getParameters(); Method nativeMethod = iTestResult.getMethod().getConstructorOrMethod().getMethod(); Annotation[][] parametersAnnotations = nativeMethod.getParameterAnnotations(); List<String> methodParameterNames = getMethodParameterNamesIfAvailable(nativeMethod); for (int i = 0; i < parameters.length; i++) { Parameter parameter = getParameterAnnotation(parametersAnnotations[i]); if (parameter == null) { continue; } String name = getNameForParameter(parameter.value(), methodParameterNames, i); <START> String value = parameters[i] != null ? parameters[i].toString() : "null"; <END> getLifecycle().fire(new AddParameterEvent(name, value, ParameterKind.ARGUMENT)); } }</code><technical_language>Objects.toString(parameters[i]) instead</technical_language>

Target:
private void fireAddParameterEvents(ITestResult iTestResult) { Object[] parameters = iTestResult.getParameters(); Method nativeMethod = iTestResult.getMethod().getConstructorOrMethod().getMethod(); Annotation[][] parametersAnnotations = nativeMethod.getParameterAnnotations(); List<String> methodParameterNames = getMethodParameterNamesIfAvailable(nativeMethod); for (int i = 0; i < parameters.length; i++) { Parameter parameter = getParameterAnnotation(parametersAnnotations[i]); if (parameter == null) { continue; } String name = getNameForParameter(parameter.value(), methodParameterNames, i); String value = Objects.toString(parameters[i]); getLifecycle().fire(new AddParameterEvent(name, value, ParameterKind.ARGUMENT)); } }
Source:
<code>public Set<Long> getAvailableIps(Network network, String requestedIp) { if (network.getCidr() == null) { <START> return null; <END> } String[] cidr = network.getCidr().split("/"); List<String> ips = getUsedIpsInNetwork(network); Set<Long> usedIps = new TreeSet<Long>(); for (String ip : ips) { if (requestedIp != null && requestedIp.equals(ip)) { s_logger.warn("Requested ip address " + requestedIp + " is already in use in network" + network); return null; } usedIps.add(NetUtils.ip2Long(ip)); } Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]), usedIps); String gateway = network.getGateway(); if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway)))) allPossibleIps.remove(NetUtils.ip2Long(gateway)); return allPossibleIps; }</code><technical_language>Instead of null, empty set here</technical_language>

Target:
public Set<Long> getAvailableIps(Network network, String requestedIp) { if (network.getCidr() == null) { return Collections.emptySet(); } String[] cidr = network.getCidr().split("/"); List<String> ips = getUsedIpsInNetwork(network); Set<Long> usedIps = new TreeSet<Long>(); for (String ip : ips) { if (requestedIp != null && requestedIp.equals(ip)) { s_logger.warn("Requested ip address " + requestedIp + " is already in use in network" + network); return null; } usedIps.add(NetUtils.ip2Long(ip)); } Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]), usedIps); String gateway = network.getGateway(); if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway)))) allPossibleIps.remove(NetUtils.ip2Long(gateway)); return allPossibleIps; }
Source:
<code>public static void main(String[] args) throws Exception { Properties serverProperties = getServerProperties(args); DatastreamServer server = new DatastreamServer(serverProperties); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { server.shutdown(); } }); server.startup(); while(true) { <START> Thread.sleep(100); <END> } }</code><technical_language>wait()</technical_language>

Target:
public static void main(String[] args) throws Exception { Properties serverProperties = getServerProperties(args); DatastreamServer server = new DatastreamServer(serverProperties); Thread mainThread = Thread.currentThread(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { server.shutdown(); mainThread.notifyAll(); } }); server.startup(); mainThread.wait(); }
Source:
<code>private static String urlDecode(String input) { <START> if (input.contains("%")) { <END> try { return URLDecoder.decode(input, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new SafeRuntimeException("Failed to decode path segment", e); } } return input; }</code><technical_language>I string foo+bar urldecoded foo bar. URLDecoder.decode preserves input in case + % chars, safe delete this if condition</technical_language>

Target:
private static String urlDecode(String input) { try { return URLDecoder.decode(input, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new SafeRuntimeException("Failed to decode path segment", e, UnsafeArg.of("encoded", input)); } }
Source:
<code>public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { <START> String msg = String.format("Failed to run command %s. Domain is %s. User is %s.", <END> getClass().getSimpleName(), getDomain(), getLoginName()); log.errorFormat(msg); _ldapReturnValue.setExceptionString(msg); } return _ldapReturnValue; }</code><technical_language>localized</technical_language>

Target:
public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { log.errorFormat(String.format("Failed to run command %s. Domain is %s. User is %s.", getClass().getSimpleName(), getDomain(), getLoginName())); _ldapReturnValue.setExceptionString(VdcBllMessages.FAILED_TO_RUN_LDAP_QUERY.name()); } return _ldapReturnValue; }
Source:
<code>public String getPathForHadoop() { <START> String hadoopPath = String.format( <END> Locale.ENGLISH, "%s://%s@%s.blob.core.windows.net/", "wasb", config.getContainer(), config.getAccount() ); log.info("Using Azure blob storage Hadoop path: " + hadoopPath); return hadoopPath; }</code><technical_language>StringUtils.format()</technical_language>

Target:
public String getPathForHadoop() { String hadoopPath = StringUtils.format( "%s://%s@%s.%s/", AzureDataSegmentPuller.AZURE_STORAGE_HADOOP_PROTOCOL, config.getContainer(), config.getAccount(), AzureDataSegmentPuller.AZURE_STORAGE_HOST_ADDRESS ); log.info("Using Azure blob storage Hadoop path: %s", hadoopPath); return hadoopPath; }
Source:
<code>protected void setRuleSettings(SimulationDescriptor simulationDescriptor) { view.getDmnSettings().getStyle().setDisplay(Style.Display.NONE); view.getRuleSettings().getStyle().setDisplay(Style.Display.INLINE); <START> view.getKieSession().setValue(Optional.ofNullable(simulationDescriptor.getDmoSession()).orElse("")); <END> view.getRuleFlowGroup().setValue(Optional.ofNullable(simulationDescriptor.getRuleFlowGroup()).orElse("")); }</code><technical_language>@danielezonca Please model name view' in synchro: if property se/get in model is "dmoSession", element in view name</technical_language>

Target:
protected void setRuleSettings(SimulationDescriptor simulationDescriptor) { view.getDmnSettings().getStyle().setDisplay(Style.Display.NONE); view.getRuleSettings().getStyle().setDisplay(Style.Display.INLINE); view.getDmoSession().setValue(Optional.ofNullable(simulationDescriptor.getDmoSession()).orElse("")); view.getRuleFlowGroup().setValue(Optional.ofNullable(simulationDescriptor.getRuleFlowGroup()).orElse("")); }
Source:
<code>private String readInputFromStdIn() { Scanner in = new Scanner(System.in).useDelimiter("\\A"); <START> String content = in.next(); <END> in.close(); return content; }</code><technical_language>I see, this code correct read line of input stdin (if called, yet) please call IOUtils.readFull() instead of copying implementation here? (I happy Scanner for this replace I it. Scanner right for reading a file fully memory)</technical_language>

Target:
private String readInputFromStdIn() { String content = IOUtils.readFull(System.in); try { System.in.close(); } catch (IOException e) { } return content; }
Source:
<code>public void testHAProxyProtocolIdleTimeout() throws Exception { HAProxy proxy = new HAProxy(DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT, Buffer.buffer()); proxy.start(vertx); server.close(); server = vertx.createHttpServer(createBaseServerOptions(). setIdleTimeout(2). <START> setSslHandshakeTimeout(2). <END> setUseProxyProtocol(true)); server.requestHandler(req -> fail("Should not be called")); startServer(); vertx.createNetClient().connect(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, res -> { res.result().closeHandler(event -> testComplete()); }); try { await(); } finally { proxy.stop(); } }</code><technical_language>do need setSslHandshakeTimeout ? need for this test</technical_language>

Target:
public void testHAProxyProtocolIdleTimeout() throws Exception { HAProxy proxy = new HAProxy(DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT, Buffer.buffer()); proxy.start(vertx); server.close(); server = vertx.createHttpServer(createBaseServerOptions(). setProxyProtocolTimeout(2). setUseProxyProtocol(true)); server.requestHandler(req -> fail("Should not be called")); startServer(); vertx.createNetClient().connect(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, res -> { res.result().closeHandler(event -> testComplete()); }); try { await(); } finally { proxy.stop(); } }
Source:
<code>public static double calculateSuppressionFactorFromPreAdapterQ(final double preAdapterQ, final double biasQP1, final double biasQP2) { <START> ParamUtils.isPositive(preAdapterQ, "preAdatper Q score must be positive and not zero."); <END> ParamUtils.isPositiveOrZero(biasQP1, "bias Q shape parameters must be positive."); ParamUtils.isPositiveOrZero(biasQP2, "bias Q shape parameters must be positive."); if ((biasQP2==0) && (preAdapterQ > biasQP1)) { return 0.0; } else if (biasQP2 == 0) { return 1.0; } return 1.0/(1.0 + Math.exp(biasQP2*(preAdapterQ-biasQP1))); }</code><technical_language>Typo: Adatper</technical_language>

Target:
public static double calculateSuppressionFactorFromPreAdapterQ(final double preAdapterQ, final double biasQP1, final double biasQP2) { ParamUtils.isPositive(preAdapterQ, "preAdapter Q score must be positive and not zero."); ParamUtils.isPositiveOrZero(biasQP1, "bias Q shape parameters must be positive."); ParamUtils.isPositiveOrZero(biasQP2, "bias Q shape parameters must be positive."); if (biasQP2 == 0) { return preAdapterQ > biasQP1 ? 0.0 : 1.0; } else { return 1.0/(1.0 + Math.exp(biasQP2*(preAdapterQ-biasQP1))); } }
Source:
<code>public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } <START> if(obs.getPerson()!=obs.getEncounter().getPatient().getPerson()) { <END> throw new ValidationException("obs person not matching with encounter person"); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }</code><technical_language>!= simply compare hashcode of objects, compare values. In order get desired result, .equals() method</technical_language>

Target:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }
Source:
<code>private void logLoop() { <START> if (!RuntimeEnvironment.getInstance().isPrintProgress()) { <END> return; } while (true) { long currentCount = this.currentCount.get(); Level currentLevel; if (currentCount <= 1 || currentCount >= totalCount || currentCount % 100 == 0) { currentLevel = Level.INFO; } else if (currentCount % 50 == 0) { currentLevel = Level.FINE; } else if (currentCount % 10 == 0) { currentLevel = Level.FINER; } else { currentLevel = Level.FINEST; } if (logger.isLoggable(currentLevel)) { logger.log(currentLevel, "Progress: {0} ({1}%) for {2}", new Object[]{currentCount, currentCount * 100.0f / totalCount, prefix}); } try { synchronized (sync) { sync.wait(); } } catch (InterruptedException e) { logger.log(Level.WARNING, "logger thread interrupted"); } if (!run.get()) { return; } } }</code><technical_language>move this check some factory return DummyProgress a thread overhead</technical_language>

Target:
private void logLoop() { long cachedCount = 0; while (true) { long currentCount = this.currentCount.get(); Level currentLevel; if (cachedCount < currentCount) { if (currentCount <= 1 || currentCount % 100 == 0) { currentLevel = Level.INFO; } else if (currentCount % 50 == 0) { currentLevel = Level.FINE; } else if (currentCount % 10 == 0) { currentLevel = Level.FINER; } else { currentLevel = Level.FINEST; } if (logger.isLoggable(currentLevel)) { logger.log(currentLevel, "Progress: {0} ({1}%) for {2}", new Object[]{currentCount, currentCount * 100.0f / totalCount, suffix}); } } if (!run) { return; } cachedCount = currentCount; try { synchronized (sync) { if (!run) { continue; } sync.wait(); } } catch (InterruptedException e) { logger.log(Level.WARNING, "logger thread interrupted"); } } }
Source:
<code>public void update(QcType qcType) throws IOException { authorizationManager.throwIfNonAdmin(); QcType updatedQcType = get(qcType.getId()); updatedQcType.setName(qcType.getName()); <START> updatedQcType.setDescription(qcType.getDescription() == null ? "" : qcType.getDescription()); <END> updatedQcType.setQcTarget(qcType.getQcTarget()); updatedQcType.setUnits(qcType.getUnits() == null ? "" : qcType.getUnits()); updatedQcType.setPrecisionAfterDecimal(qcType.getPrecisionAfterDecimal()); qcTypeStore.update(updatedQcType); }</code><technical_language>some methods in LimsUtils handle blank/null strings</technical_language>

Target:
public void update(QcType qcType) throws IOException { authorizationManager.throwIfNonAdmin(); QcType updatedQcType = get(qcType.getId()); updatedQcType.setName(qcType.getName()); updatedQcType.setDescription(LimsUtils.isStringBlankOrNull(qcType.getDescription()) ? "" : qcType.getDescription()); updatedQcType.setQcTarget(qcType.getQcTarget()); updatedQcType.setUnits(LimsUtils.isStringBlankOrNull(qcType.getUnits()) ? "" : qcType.getUnits()); updatedQcType.setPrecisionAfterDecimal(qcType.getPrecisionAfterDecimal()); qcTypeStore.update(updatedQcType); }
Source:
<code>public void init() { if (hasBeenInitialized) { throw new IllegalStateException("This map has already been initialized."); } List<Binding<?>> rootResourceBindings = new ArrayList<>(); for (final Binding<?> binding : injector.getBindings().values()) { final Type type = binding.getKey().getTypeLiteral().getType(); if (type instanceof Class) { <START> final Class<?> beanClass = (Class) type; <END> if (GetRestful.isRootResource(beanClass)) { rootResourceBindings.add(binding); } } } for (Binding<?> binding : rootResourceBindings) { Class<?> clazz = (Class) binding.getKey().getTypeLiteral().getType(); if (Proxy.isProxyClass(clazz)) { for (Class<?> intf : clazz.getInterfaces()) { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(intf); registerConcreteMethods(resourceClass, clazz); } } else { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(clazz); registerConcreteMethods(resourceClass, clazz); } } lock(); }</code><technical_language>final? Is a lambda overlooking some such</technical_language>

Target:
public synchronized void init() { if (hasBeenInitialized) { throw new IllegalStateException("This map has already been initialized."); } List<Binding<?>> rootResourceBindings = new ArrayList<>(); for (Binding<?> binding : injector.getBindings().values()) { Type type = binding.getKey().getTypeLiteral().getType(); if (type instanceof Class) { Class<?> beanClass = (Class) type; if (GetRestful.isRootResource(beanClass)) { rootResourceBindings.add(binding); } } } for (Binding<?> binding : rootResourceBindings) { Class<?> clazz = (Class) binding.getKey().getTypeLiteral().getType(); if (Proxy.isProxyClass(clazz)) { for (Class<?> intf : clazz.getInterfaces()) { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(intf); registerConcreteMethods(resourceClass, clazz); } } else { ResourceClass resourceClass = ResourceBuilder.rootResourceFromAnnotations(clazz); registerConcreteMethods(resourceClass, clazz); } } lock(); }
Source:
<code>public void when_no_read_timeout_override_then_client_request_times_out() { thrown.expect(ProcessingException.class); thrown.expectCause(any(SocketTimeoutException.class)); <START> Client client = createStandardClient(); <END> client.target(TEST_URI + "/long_running") .request() .get(); }</code><technical_language>making Client a field of test move this call setup method</technical_language>

Target:
public void when_no_read_timeout_override_then_client_request_times_out() { thrown.expect(ProcessingException.class); thrown.expectCause(any(SocketTimeoutException.class)); client.target(testUri + "/long_running") .request() .get(); }
Source:
<code>private void processUpdateForBlockLocation(Vector3i blockLocation) { for (Side side : Side.values()) { Vector3i neighborLocation = new Vector3i(blockLocation); neighborLocation.add(side.getVector3i()); if (worldProvider.isBlockRelevant(neighborLocation)) { Block neighborBlock = worldProvider.getBlock(neighborLocation); final BlockFamily blockFamily = neighborBlock.getBlockFamily(); if (blockFamily instanceof BlockNeighborUpdateFamily) { <START> BlockNeighborUpdateFamily neighboursFamily = (BlockNeighborUpdateFamily) blockFamily; <END> Block neighborBlockAfterUpdate = neighboursFamily.getBlockForNeighborUpdate(neighborLocation, neighborBlock); if (neighborBlock != neighborBlockAfterUpdate) { worldProvider.setBlock(neighborLocation, neighborBlockAfterUpdate); } } } } }</code><technical_language>I type name UpdatesWithNeighborsFamily is more expressive. UpdateNeighborsFamily</technical_language>

Target:
private void processUpdateForBlockLocation(Vector3i blockLocation) { for (Side side : Side.values()) { Vector3i neighborLocation = new Vector3i(blockLocation); neighborLocation.add(side.getVector3i()); if (worldProvider.isBlockRelevant(neighborLocation)) { Block neighborBlock = worldProvider.getBlock(neighborLocation); final BlockFamily blockFamily = neighborBlock.getBlockFamily(); if (blockFamily instanceof UpdatesWithNeighboursFamily) { UpdatesWithNeighboursFamily neighboursFamily = (UpdatesWithNeighboursFamily) blockFamily; Block neighborBlockAfterUpdate = neighboursFamily.getBlockForNeighborUpdate(neighborLocation, neighborBlock); if (neighborBlock != neighborBlockAfterUpdate) { worldProvider.setBlock(neighborLocation, neighborBlockAfterUpdate); } } } } }
Source:
<code>public List<OzoneAcl> getAcl(OzoneObj obj) throws IOException { if(isAclEnabled) { <START> checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, <END> obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } if(obj.getResourceType().equals(ResourceType.VOLUME)) { return volumeManager.getAcl(obj); } return Collections.emptyList(); }</code><technical_language>This ACLType.READ_ACL</technical_language>

Target:
public List<OzoneAcl> getAcl(OzoneObj obj) throws IOException { if(isAclEnabled) { checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.READ_ACL, obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } if(obj.getResourceType().equals(ResourceType.VOLUME)) { return volumeManager.getAcl(obj); } return Collections.emptyList(); }
Source:
<code>public void connect(SocketAddress endpoint, int timeout) throws IOException { <START> if (endpoint == null) { <END> throw new NullPointerException(); } if (timeout < 0) { throw new IllegalArgumentException("Timeout may not be negative: " + timeout); } if (!(endpoint instanceof NpipeSocketAddress)) { throw new IllegalArgumentException("Unsupported address type: " + endpoint.getClass().getName()); } this.socketAddress = endpoint; this.socketPath = ((NpipeSocketAddress) endpoint).path(); synchronized (connectLock) { this.namedPipe = new RandomAccessFile(socketPath, "rw"); this.channel = this.namedPipe.getChannel(); } }</code><technical_language>need a nullpointer check here. IDE null (don't this ;-) more important throw a NPE 10 lines (if so)</technical_language>

Target:
public void connect(SocketAddress endpoint, int timeout) throws IOException { if (timeout < 0) { throw new IllegalArgumentException("Timeout may not be negative: " + timeout); } if (!(endpoint instanceof NpipeSocketAddress)) { throw new IllegalArgumentException("Unsupported address type: " + endpoint.getClass().getName()); } this.socketAddress = endpoint; this.socketPath = ((NpipeSocketAddress) endpoint).path(); synchronized (connectLock) { this.namedPipe = new RandomAccessFile(socketPath, "rw"); this.channel = this.namedPipe.getChannel(); } }
Source:
<code>protected void blockDrawerFromOpening(){ <START> DrawerLayout mDrawerLayout = (DrawerLayout) <END> findViewById(R.id.drawer_layout); if (mDrawerLayout != null) { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } }</code><technical_language>need m prefix variables if instance variables</technical_language>

Target:
protected void blockDrawerFromOpening(){ DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawerLayout != null) { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } }
Source:
<code>public static boolean isSolaris() { <START> String osName = System.getProperty("os.name"); <END> if (osName == null) { return false; } return (osName.indexOf("Solaris") > -1) || (osName.indexOf("solaris") > -1) || (osName.indexOf("SunOS") > -1); }</code><technical_language>WildFlySecurityManager.getPropertyPrivileged isWindows() others do</technical_language>

Target:
public static boolean isSolaris() { String osName = WildFlySecurityManager.getPropertyPrivileged("os.name", null); if (osName == null) { return false; } return (osName.indexOf("Solaris") > -1) || (osName.indexOf("solaris") > -1) || (osName.indexOf("SunOS") > -1); }
Source:
<code>public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option) throws IOException, InterruptedException { createRootDir(option.isCreateRootDir()); if (option.isCreateWALDir()) { createWALRootDir(); } setHBaseFsTmpDir(); if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, -1) == -1) { conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, option.getNumRegionServers()); } if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, -1) == -1) { conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers()); } Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO"); Configuration c = new Configuration(this.conf); TraceUtil.initTracer(c); this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(), option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(), option.getMasterClass(), option.getRsClass()); conf.set(HConstants.MASTER_ADDRS_KEY, MasterRegistry.getMasterAddr(c)); try (Table t = getConnection().getTable(TableName.META_TABLE_NAME); ResultScanner s = t.getScanner(new Scan())) { while (s.next() != null) { <START> continue; <END> } } getAdmin(); LOG.info("Minicluster is up; activeMaster={}", getHBaseCluster().getMaster()); return (MiniHBaseCluster) hbaseCluster; }</code><technical_language>I 'continue' instead of empty loop</technical_language>

Target:
public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option) throws IOException, InterruptedException { createRootDir(option.isCreateRootDir()); if (option.isCreateWALDir()) { createWALRootDir(); } setHBaseFsTmpDir(); if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, -1) == -1) { conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, option.getNumRegionServers()); } if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, -1) == -1) { conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers()); } Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO"); Configuration c = new Configuration(this.conf); TraceUtil.initTracer(c); this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(), option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(), option.getMasterClass(), option.getRsClass()); conf.set(HConstants.MASTER_ADDRS_KEY, MasterRegistry.getMasterAddr(c)); try (Table t = getConnection().getTable(TableName.META_TABLE_NAME); ResultScanner s = t.getScanner(new Scan())) { for (;;) { if (s.next() == null) { break; } } } getAdmin(); LOG.info("Minicluster is up; activeMaster={}", getHBaseCluster().getMaster()); return (MiniHBaseCluster) hbaseCluster; }
Source:
<code>private static boolean hasMoreThanOneStatement(ForEachStatementTree forEach) { if (forEach.statements().size() > 1) { return true; } <START> StatementTree body = forEach.statements().get(0); <END> if (body.is(Tree.Kind.BLOCK)) { return ((BlockTree) body).statements().size() > 1; } return false; }</code><technical_language>if alternative syntax 0 statements</technical_language>

Target:
private static boolean hasMoreThanOneStatement(ForEachStatementTree forEach) { if (forEach.statements().size() > 1) { return true; } if (forEach.statements().isEmpty()) { return false; } StatementTree body = forEach.statements().get(0); if (body.is(Tree.Kind.BLOCK)) { return ((BlockTree) body).statements().size() > 1; } return false; }
Source:
<code>private List<CourseAttributes> getAllCoursesWithoutTimeZone() { <START> List<CourseAttributes> courseAttributes = new ArrayList<CourseAttributes>(); <END> List<Course> courseEntities = getAllCourseEntities(); for (Course course : courseEntities) { if (course.getTimeZone() == null && !JDOHelper.isDeleted(course)) { courseAttributes.add(new CourseAttributes(course)); } } return courseAttributes; }</code><technical_language>name this courses courseAttributes refer a single instance of CourseAttributes Edit: coursesWithoutTimeZone for clarity</technical_language>

Target:
private List<CourseAttributes> getAllCoursesWithoutTimeZone() { List<CourseAttributes> coursesWithoutTimeZone = new ArrayList<CourseAttributes>(); List<Course> courseEntities = getAllCourseEntities(); for (Course courseEntity : courseEntities) { if (courseEntity.getTimeZone() == null && !JDOHelper.isDeleted(courseEntity)) { coursesWithoutTimeZone.add(new CourseAttributes(courseEntity)); } } return coursesWithoutTimeZone; }
Source:
<code>private void injectErrorPage(ServletContext context, Bundle refBundle) { Field field = null; try { field = context.getClass().getDeclaredField("this$0"); field.setAccessible(true); } catch (NoSuchFieldException e) { LOGGER.warn( "Unable to find enclosing class of ServletContext for delegating the error page. The default jetty errors will display in the browser", e); return; } ServletHandler handler; ServletContextHandler httpServiceContext; try { httpServiceContext = (ServletContextHandler) field.get(context); } catch (IllegalAccessException e) { LOGGER.warn( "Unable to get the ServletContextHandler for {}. Jetty's default error page will be used for this context", refBundle.getSymbolicName(), e); return; } handler = httpServiceContext.getServletHandler(); ServletHolder errorServletHolder = new ServletHolder(new ErrorServlet()); errorServletHolder.setServletHandler(handler); try { errorServletHolder.start(); errorServletHolder.initialize(); } catch (Exception e) { LOGGER.warn( "Unable to initialize an errorServletHolder for {}", refBundle.getSymbolicName(), e); } handler.addServletWithMapping(errorServletHolder, errorPagePath); ErrorPageErrorHandler errorPageErrorHandler = new ErrorPageErrorHandler(); <START> errorPageErrorHandler.setErrorPages(errorCodesMap); <END> httpServiceContext.setErrorHandler(errorPageErrorHandler); }</code><technical_language>add this mapping if holder started initialized? add a similar message in warning Jetty's default error page used</technical_language>

Target:
private void injectErrorPage(ServletContext context, Bundle refBundle) { Optional<ServletContextHandler> optionalHttpServiceContext = getHTTPContext(context, refBundle); optionalHttpServiceContext.ifPresent(p -> createAndAddErrorPageHandler(p, refBundle)); }
Source:
<code>default void check() { <START> servers().check(); <END> double evictionCheckProportion = proportionConnectionsToCheckPerEvictionRun(); Preconditions.checkArgument(evictionCheckProportion > 0.01 && evictionCheckProportion <= 1, "'proportionConnectionsToCheckPerEvictionRun' must be between 0.01 and 1"); }</code><technical_language>If servers() Immutables, need this - check method called time servers objects created</technical_language>

Target:
default void check() { servers().visit((thriftServers, cqlServers) -> { Preconditions.checkState(!thriftServers.isEmpty(), "'thrift' must have at least one entry"); return null; }); double evictionCheckProportion = proportionConnectionsToCheckPerEvictionRun(); Preconditions.checkArgument(evictionCheckProportion > 0.01 && evictionCheckProportion <= 1, "'proportionConnectionsToCheckPerEvictionRun' must be between 0.01 and 1"); }
Source:
<code>public List<Node> getChildren() { List<Node> children = new ArrayList<Node>(); children.addAll(statements); <START> return children; <END> }</code><technical_language>return statements;</technical_language>

Target:
public List<Node> getChildren() { return new ArrayList<Node>(expressions); }
Source:
<code>public void testRetainedSize() <START> throws Exception <END> { SparseHll sparseHll = new SparseHll(10); int[] entries = new int[1]; long retainedSize = sizeOf(entries) + ClassLayout.parseClass(SparseHll.class).instanceSize(); for (int value = 0; value < 100; value++) { sparseHll.insertHash(Murmur3Hash128.hash64(value)); if (value % 10 == 1) { entries = new int[value + 10]; retainedSize = sizeOf(entries) + ClassLayout.parseClass(SparseHll.class).instanceSize(); } assertEquals(sparseHll.estimatedInMemorySize(), retainedSize); } }</code><technical_language>throws Exception is unnecessary I</technical_language>

Target:
public void testRetainedSize() { SparseHll sparseHll = new SparseHll(10); int[] entries = new int[1]; long retainedSize = sizeOf(entries) + SPARSE_HLL_INSTANCE_SIZE; for (int value = 0; value < 100; value++) { sparseHll.insertHash(Murmur3Hash128.hash64(value)); if (value % 10 == 1) { entries = new int[value + 10]; retainedSize = sizeOf(entries) + SPARSE_HLL_INSTANCE_SIZE; } assertEquals(sparseHll.estimatedInMemorySize(), retainedSize); } }
Source:
<code>public void postInvocationTearDown() { try { CLog.i("Shutting down GCE device %s", getSerialNumber()); if (!(getIDevice() instanceof StubDevice)) { try (InputStreamSource logcatSource = getLogcat()) { clearLogcat(); String name = "device_logcat_teardown_gce"; mTestLogger.testLog(name, LogDataType.LOGCAT, logcatSource); } } if (mGceAvd != null) { if (!GceStatus.SUCCESS.equals(mGceAvd.getStatus())) { getSshBugreport(); } getGceHandler().logSerialOutput(mGceAvd, mTestLogger); <START> getGceHandler().shutdownGce(); <END> } setFastbootEnabled(false); if (getGceHandler() != null) { getGceHandler().cleanUp(); } } finally { super.postInvocationTearDown(); } }</code><technical_language>this change, get wrong impression device shut down. rename function tryShutdownGce</technical_language>

Target:
public void postInvocationTearDown() { try { CLog.i("Shutting down GCE device %s", getSerialNumber()); if (!(getIDevice() instanceof StubDevice)) { try (InputStreamSource logcatSource = getLogcat()) { clearLogcat(); String name = "device_logcat_teardown_gce"; mTestLogger.testLog(name, LogDataType.LOGCAT, logcatSource); } } if (mGceAvd != null) { if (!GceStatus.SUCCESS.equals(mGceAvd.getStatus())) { getSshBugreport(); } getGceHandler().logSerialOutput(mGceAvd, mTestLogger); getGceHandler().attemptShutdownGce(); } setFastbootEnabled(false); if (getGceHandler() != null) { getGceHandler().cleanUp(); } } finally { super.postInvocationTearDown(); } }
Source:
<code>public boolean isModelClass() { String type = classType.toString(); <START> return !type.equals("io.realm.DynamicRealmObject") && (!type.endsWith(".RealmObject") && !type.endsWith("RealmProxy")); <END> }</code><technical_language>Bracers a bit funny here: !x && (!y && !z). !x && !y && !z</technical_language>

Target:
public boolean isModelClass() { String type = classType.toString(); return !type.equals("io.realm.DynamicRealmObject") && !type.endsWith(".RealmObject") && !type.endsWith("RealmProxy"); }
Source:
<code>default void setCharge(Location l, int charge) { int capacity = getCapacity(); <START> if (capacity > 0) { <END> charge = NumberUtils.clamp(0, charge, capacity); if (charge != getCharge(l)) { BlockStorage.addBlockInfo(l, "energy-charge", String.valueOf(charge), false); if (getEnergyComponentType() == EnergyNetComponentType.CAPACITOR) { SlimefunUtils.updateCapacitorTexture(l, charge, capacity); } } } }</code><technical_language>isChargeable</technical_language>

Target:
default void setCharge(Location l, int charge) { Validate.notNull(l, "Location was null!"); Validate.isTrue(charge >= 0, "You can only set a charge of zero or more!"); int capacity = getCapacity(); if (capacity > 0) { charge = NumberUtils.clamp(0, charge, capacity); if (charge != getCharge(l)) { BlockStorage.addBlockInfo(l, "energy-charge", String.valueOf(charge), false); if (getEnergyComponentType() == EnergyNetComponentType.CAPACITOR) { SlimefunUtils.updateCapacitorTexture(l, charge, capacity); } } } }
Source:
<code>private void startDiscoveryProcess(XBeeDevice device, IDiscoveryListener listener, String id, Set<DiscoveryOptions> options, long timeout) throws XBeeException { if (!device.isOpen()) throw new InterfaceNotOpenException(); finished = false; running = true; try { configureDiscoveryOptions(device, options, timeout, listener); if (timeout == USE_DEVICE_TIMEOUT) { timeout = DEFAULT_TIMEOUT; byte[] value = getParameter(device, NT_COMMAND, DEFAULT_TIMEOUT, "network timeout", listener); if (value != null) { timeout = ByteUtils.byteArrayToLong(value) * 100; logger.debug("{}Using NT value: ms.", toString(), timeout); } } discoverDevicesAPI(device, listener, id, timeout); logger.debug("{}Restoring discovery options.", toString()); <START> setDiscoveryOptions(device, oldNOValue, oldNTValue, listener); <END> } finally { finished = true; running = false; notifyDiscoveryFinished(listener, null); } }</code><technical_language>Restoring values done in } finally {</technical_language>

Target:
private void startDiscoveryProcess(XBeeDevice device, IDiscoveryListener listener, String id, Set<DiscoveryOptions> options, long timeout) throws XBeeException { if (!device.isOpen()) throw new InterfaceNotOpenException(); finished = false; running = true; try { configureDiscoveryOptions(device, options, timeout, listener); if (timeout == USE_DEVICE_TIMEOUT) { timeout = DEFAULT_TIMEOUT; byte[] value = getParameter(device, NT_COMMAND, DEFAULT_TIMEOUT, "network timeout", listener); if (value != null) { timeout = ByteUtils.byteArrayToLong(value) * 100; logger.debug("{}Using NT value: ms.", toString(), timeout); } } discoverDevicesAPI(device, listener, id, timeout); if (device.getXBeeProtocol() == XBeeProtocol.DIGI_MESH) { logger.debug("{}Waiting 3 seconds before restoring values (DigiMesh related issue).", toString()); try { Thread.sleep(3000); } catch (InterruptedException e) } } finally { finished = true; running = false; logger.debug("{}Restoring discovery options.", toString()); setDiscoveryOptions(device, oldNOValue, oldNTValue, listener); notifyDiscoveryFinished(listener, null); } }
Source:
<code>public LocalDate calculateFixingFromMaturity(LocalDate maturityDate) { ArgChecker.notNull(maturityDate, "maturityDate"); LocalDate effectiveBusinessDay = maturityDateCalendar().nextOrSame(maturityDate); LocalDate fixingDate = effectiveBusinessDay; <START> while (maturityDateOffset.adjust(fixingDate).isAfter(effectiveBusinessDay) || fixingCalendar.isHoliday(fixingDate)) { <END> fixingDate = fixingDate.minusDays(1); } return fixingDate; }</code><technical_language>line length touch</technical_language>

Target:
public LocalDate calculateFixingFromMaturity(LocalDate maturityDate) { ArgChecker.notNull(maturityDate, "maturityDate"); LocalDate maturityBusinessDay = maturityDateCalendar().nextOrSame(maturityDate); LocalDate fixingDate = maturityBusinessDay; while (calculateMaturityFromFixing(fixingDate).isAfter(maturityBusinessDay)) { fixingDate = fixingDate.minusDays(1); } return fixingDate; }
Source:
<code><START> String getNumberWithLeadingZeroesAsString(final Integer number, final GermplasmNameSetting setting) { <END> final StringBuilder sb = new StringBuilder(); final String numberString = number.toString(); final Integer numOfDigits = setting.getNumOfDigits(); if (numOfDigits != null && numOfDigits > 0) { final int numOfZerosNeeded = numOfDigits - numberString.length(); if (numOfZerosNeeded > 0) { for (int i = 0; i < numOfZerosNeeded; i++) { sb.append("0"); } } } sb.append(number); return sb.toString(); }</code><technical_language>replace java if (numOfDigits == null || numOfDigits <= 0) { return number.toString(); } return String.format("%0" + numOfDigits + "d", number);</technical_language>

Target:
String getNumberWithLeadingZeroesAsString(final Integer number, final GermplasmNameSetting setting) { final Integer numOfDigits = setting.getNumOfDigits(); if (numOfDigits == null || numOfDigits <= 0) { return number.toString(); } return String.format("%0" + numOfDigits + "d", number); }