auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean validateFilesystemLocation() { final String pathString = fsPathText.getText().trim(); if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemError); return false; } final File file = new File(pathString); if (!file.isAbsolute()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemInvalidError); return false; } if (file.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryError); return false; } if (pathString.endsWith("/") || pathString.endsWith("\\")) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } final File parent = file.getParentFile(); <START> if (!parent.exists() || !parent.isDirectory()) { <END> setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } return true; }</code><technical_language>isDirectory() => exists(), if (!parent.isDirectory()) { good enough</technical_language>

Target:
private boolean validateFilesystemLocation() { final String pathString = fsPathText.getText().trim(); if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemError); return false; } final File file = new File(pathString); if (!file.isAbsolute()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemInvalidError); return false; } if (file.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryError); return false; } if (pathString.endsWith("/") || pathString.endsWith("\\")) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } final File parent = file.getParentFile(); if (!parent.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } return true; }
Source:
<code>public boolean matches(RelOptRuleCall call) { FlinkLogicalAggregate agg = call.rel(0); if (agg.getGroupType() != Aggregate.Group.SIMPLE || agg.indicator) { throw new TableException("GROUPING SETS are currently not supported."); } List<AggregateCall> aggCalls = agg.getAggCallList(); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); <START> boolean existUserDefinedJavaFunction = <END> aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null) && !PythonUtil.isBuiltInAggregate(x)); if (existPandasFunction || existGeneralPythonFunction) { if (existPandasFunction) { throw new TableException("Pandas UDAFs are not supported in streaming mode currently."); } if (existUserDefinedJavaFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }</code><technical_language>suggestion boolean existJavaUserDefinedFunction =</technical_language>

Target:
public boolean matches(RelOptRuleCall call) { FlinkLogicalAggregate agg = call.rel(0); if (agg.getGroupType() != Aggregate.Group.SIMPLE || agg.indicator) { throw new TableException("GROUPING SETS are currently not supported."); } List<AggregateCall> aggCalls = agg.getAggCallList(); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); boolean existJavaUserDefinedFunction = aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null) && !PythonUtil.isBuiltInAggregate(x)); if (existPandasFunction || existGeneralPythonFunction) { if (existPandasFunction) { throw new TableException("Pandas UDAFs are not supported in streaming mode currently."); } if (existJavaUserDefinedFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }
Source:
<code>private WorkerMetrics buildMetricsMsg(final int numDataBlocks, final double elapsedTime) { return WorkerMetrics.newBuilder() .setNumDataBlocks(numDataBlocks) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) <START> .setTotalPushTime(pushTracer.totalElapsedTime()) <END> .setTotalTime(elapsedTime) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) .setAvgPullTime(pullTracer.avgTimePerRecord()) .setTotalPushTime(pushTracer.totalElapsedTime()) .setAvgPushTime(pushTracer.avgTimePerRecord()) .build(); }</code><technical_language>lines duplicated</technical_language>

Target:
private WorkerMetrics buildMetricsMsg(final int numDataBlocks, final double elapsedTime) { return WorkerMetrics.newBuilder() .setItrIdx(iteration) .setNumMiniBatchPerItr(numMiniBatchesPerItr) .setProcessedDataItemCount(NUM_DATA_ITEMS_TO_PROCESS) .setNumDataBlocks(numDataBlocks) .setTotalTime(elapsedTime) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) .setAvgPullTime(pullTracer.avgTimePerRecord()) .setTotalPushTime(pushTracer.totalElapsedTime()) .setAvgPushTime(pushTracer.avgTimePerRecord()) .build(); }
Source:
<code>private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.BYTES; } if (obj instanceof Character) { return Character.BYTES; } if (obj instanceof Float) { return Float.BYTES; } if (obj instanceof Double) { return Double.BYTES; } <START> throw new IllegalArgumentException(String.format("Encoding Type: %s is not supported", <END> obj.getClass())); }</code><technical_language>this in messages.properties</technical_language>

Target:
private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.BYTES; } if (obj instanceof Character) { return Character.BYTES; } if (obj instanceof Float) { return Float.BYTES; } if (obj instanceof Double) { return Double.BYTES; } throw new IllegalArgumentException(String.format(Messages.ENCODING_TYPE_NOT_SUPPORTED, obj.getClass())); }
Source:
<code>public void executePostLoad(Set<Long> nodeIds, Set<Long> edgeIds) { <START> Set<Long> seenIds = new HashSet<>(); <END> for (Long id : nodeIds) { Object o = mappingContext.getNodeEntity(id); if (!seenIds.contains(id)) { executePostLoad(o); seenIds.add(id); } } seenIds.clear(); for (Long id : edgeIds) { Object o = mappingContext.getRelationshipEntity(id); if (!seenIds.contains(id)) { if (o != null) { executePostLoad(o); } seenIds.add(id); } } }</code><technical_language>late I purpose of seenIds method parameters Sets. Some code remaining</technical_language>

Target:
public void executePostLoad(Set<Long> nodeIds, Set<Long> edgeIds) { for (Long id : nodeIds) { Object o = mappingContext.getNodeEntity(id); executePostLoad(o); } for (Long id : edgeIds) { Object o = mappingContext.getRelationshipEntity(id); if (o != null) { executePostLoad(o); } } }
Source:
<code>private void onSyncthingStarted() { onApiChange(State.ACTIVE); Log.i(TAG, "onSyncthingStarted(): State.ACTIVE reached."); boolean prefUseFolderObserver = mPreferences.getBoolean(Constants.PREF_USE_FOLDER_OBSERVER, false); if (prefUseFolderObserver) { Log.i(TAG, "onSyncthingStarted(): Enumerating folders to create FolderObserver instances."); Handler handler = new Handler(); new Thread(() -> { for (Folder r : mApi.getFolders()) { try { <START> mObservers.add(new FolderObserver(mApi, r, handler)); <END> } catch (FolderObserver.FolderNotExistingException e) { Log.w(TAG, "Failed to add observer for folder", e); } catch (StackOverflowError e) { Log.w(TAG, "Failed to add folder observer", e); Toast.makeText(SyncthingService.this, R.string.toast_folder_observer_stack_overflow, Toast.LENGTH_LONG) .show(); } } }).start(); } else { Log.i(TAG, "onSyncthingStarted(): FolderObserver instances were disabled by experimental preference."); } }</code><technical_language>out of curiosity, in case know, do threads get cleaned up</technical_language>

Target:
private void onSyncthingStarted() { onApiChange(State.ACTIVE); Log.i(TAG, "onSyncthingStarted(): State.ACTIVE reached."); }
Source:
<code>public static VariantContext swapAlleles(final VariantContext originalVc, final Allele oldAllele, final Allele newAllele) { <START> if (!originalVc.getAlleles().contains(oldAllele)) return originalVc; <END> final LinkedList<Allele> alleles = new LinkedList<>(originalVc.getAlleles()); alleles.set(alleles.indexOf(oldAllele), newAllele); VariantContextBuilder vcBuilder = new VariantContextBuilder(originalVc).alleles(alleles); GenotypesContext newGTs = GenotypesContext.create(originalVc.getGenotypes().size()); for (final Genotype g : originalVc.getGenotypes()) { if (!g.getAlleles().contains(oldAllele)) { newGTs.add(g); } else { final GenotypeBuilder gb = new GenotypeBuilder(g); final LinkedList<Allele> genotypeAlleles = new LinkedList<>(g.getAlleles()); genotypeAlleles.set(genotypeAlleles.indexOf(oldAllele), newAllele); gb.alleles(genotypeAlleles); newGTs.add(gb.make()); } } vcBuilder.genotypes(newGTs); return vcBuilder.make(); }</code><technical_language>this check a warning error? additional check newAllele is there</technical_language>

Target:
public static VariantContext swapAlleles(final VariantContext originalVc, final Allele oldAllele, final Allele newAllele) throws IllegalArgumentException{ if (!originalVc.getAlleles().contains(oldAllele)) throw new IllegalArgumentException("Couldn't find allele " + oldAllele + " in VariantContext " + originalVc); final List<Allele> alleles = new ArrayList<>(originalVc.getAlleles()); alleles.set(alleles.indexOf(oldAllele), newAllele); VariantContextBuilder vcBuilder = new VariantContextBuilder(originalVc).alleles(alleles); GenotypesContext newGTs = GenotypesContext.create(originalVc.getGenotypes().size()); for (final Genotype g : originalVc.getGenotypes()) { if (!g.getAlleles().contains(oldAllele)) { newGTs.add(g); } else { final GenotypeBuilder gb = new GenotypeBuilder(g); gb.alleles(g.getAlleles().stream().map(a -> a.equals(oldAllele) ? newAllele : a).collect(Collectors.toList())); newGTs.add(gb.make()); } } vcBuilder.genotypes(newGTs); return vcBuilder.make(); }
Source:
<code>public static Matrix4 createRotationMatrix(double x, double y, double z, double angle) { Matrix4 ret = new Matrix4(); <START> return ret.setToRotation(x, y, z, angle); <END> }</code><technical_language>return new Matrix4().setToRotation(x, y, z, angle);</technical_language>

Target:
public static Matrix4 createRotationMatrix(double x, double y, double z, double angle) { return new Matrix4().setToRotation(x, y, z, angle); }
Source:
<code>@Deprecated protected byte[] getWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } byte[] data = writeBuffer.toByteArray(); <START> writeBuffer.reset(); <END> return data; }</code><technical_language>safer a separate method explicitly clear buffer? intuitive calling getWriteBytes() clear buffer</technical_language>

Target:
protected byte[] getWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } return writeBuffer.toByteArray(); }
Source:
<code>public void close() throws ZkInterruptedException { int retryCount = 0; <START> do { <END> try { zkClient.close(); return; } catch (ZkInterruptedException e) { Thread.interrupted(); retryCount += 1; LOG.warn("Interrupted when closing zkClient. Clearing the interrupted status and retrying.", e); } } while (retryCount < MAX_RETRY_COUNT); }</code><technical_language>do need a retry here? Suggest nuke retry-logic rewrite preserving interruption status try { Thread.interrupted(); zkClient.close(); } catch (ZkInterruptedException e) { Thread.currentThread().interrupt(); } try { zkClient.close(); } catch (ZkInterruptedException e) { Thread.interrupted(); zkClient.close(); Thread.currentThread().interrupt(); }</technical_language>

Target:
public void close() throws ZkInterruptedException { try { zkClient.close(); } catch (ZkInterruptedException e) { LOG.warn("Interrupted when closing zkClient. Clearing the interrupted status and retrying.", e); Thread.interrupted(); zkClient.close(); Thread.currentThread().interrupt(); } }
Source:
<code>protected GetStoreFileRequest unmarshal0( ReadableChannel channel ) throws IOException, EndOfStreamException { StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal( channel ); long requiredTransactionId = channel.getLong(); int fileNameLength = channel.getInt(); byte[] fileNameBytes = new byte[fileNameLength]; channel.get( fileNameBytes, fileNameLength ); <START> return new GetStoreFileRequest( storeId, new File( new String( fileNameBytes ) ), requiredTransactionId ); <END> }</code><technical_language>fileNameBytes is interpreted platform encoding. Give a StandardCharsets.UTF_8 pin down</technical_language>

Target:
protected GetStoreFileRequest unmarshal0( ReadableChannel channel ) throws IOException, EndOfStreamException { StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal( channel ); long requiredTransactionId = channel.getLong(); int fileNameLength = channel.getInt(); byte[] fileNameBytes = new byte[fileNameLength]; channel.get( fileNameBytes, fileNameLength ); return new GetStoreFileRequest( storeId, new File( UTF8.decode( fileNameBytes ) ), requiredTransactionId ); }
Source:
<code>public List<Object> executeHqlQuery(String hqlQuery, Map<String, Object> parameterValues) { <START> Query q = sessionFactory.getHibernateSessionFactory().getCurrentSession().createQuery(hqlQuery); <END> for (Map.Entry<String, Object> e : parameterValues.entrySet()) { if (e.getValue() instanceof Collection) { q.setParameterList(e.getKey(), (Collection)e.getValue()); } else if (e.getValue() instanceof Object[]) { q.setParameterList(e.getKey(), (Object[])e.getValue()); } else if (e.getValue() instanceof Cohort) { q.setParameterList(e.getKey(), ((Cohort)e.getValue()).getMemberIds()); } else if (e.getValue() instanceof IdSet) { q.setParameterList(e.getKey(), ((IdSet)e.getValue()).getMemberIds()); } else { q.setParameter(e.getKey(), e.getValue()); } } return q.list(); }</code><technical_language>Please revert seesionFactory.getCurrentSession()</technical_language>

Target:
public List<Object> executeHqlQuery(String hqlQuery, Map<String, Object> parameterValues) { Query q = sessionFactory.getCurrentSession().createQuery(hqlQuery); for (Map.Entry<String, Object> e : parameterValues.entrySet()) { if (e.getValue() instanceof Collection) { q.setParameterList(e.getKey(), (Collection)e.getValue()); } else if (e.getValue() instanceof Object[]) { q.setParameterList(e.getKey(), (Object[])e.getValue()); } else if (e.getValue() instanceof Cohort) { q.setParameterList(e.getKey(), ((Cohort)e.getValue()).getMemberIds()); } else if (e.getValue() instanceof IdSet) { q.setParameterList(e.getKey(), ((IdSet)e.getValue()).getMemberIds()); } else { q.setParameter(e.getKey(), e.getValue()); } } return q.list(); }
Source:
<code>@Override public boolean handle(Ignite ignite, FailureContext failureCtx) { if (!testIsRunning.getAndSet(false)) { ignite.log().info("Critical issue detected after test finished. Test failure handler ignore it."); return true; } boolean nodeStopped = super.handle(ignite, failureCtx); <START> TestCase.fail(failureCtx.toString()); <END> test.handleFailure(failureCtx.error()); return nodeStopped; }</code><technical_language>this line is needed here? This result in Assertion failed error handling performed later</technical_language>

Target:
@Override public boolean handle(Ignite ignite, FailureContext failureCtx) { String debug = " asd123 handle error="+failureCtx.error().getClass()+", msg="+failureCtx.error().getMessage()+", cause="+(failureCtx.error().getCause()==null?"null":failureCtx.error().getCause().getClass().getSimpleName()); if (ignite != null && ignite.log() != null) ignite.log().info("ignite.log" + debug); else System.out.println("sout" + debug); if (isFailureExpected(ignite, failureCtx)) return false; if (!testIsRunning.getAndSet(false)) { ignite.log().info("Critical issue detected after test finished. Test failure handler ignore it."); return true; } boolean nodeStopped = super.handle(ignite, failureCtx); test.handleFailure(failureCtx.error()); return nodeStopped; }
Source:
<code>RollingHistogram(int size) { current = new Histogram(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); list = new ArrayList<>(); recorder = new Recorder(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); <START> this.size = size; <END> }</code><technical_language>assert size > 0, rotate fail if size is 0</technical_language>

Target:
RollingHistogram(int size) { current = new Histogram(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); list = new ArrayList<>(); recorder = new Recorder(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); assert size > 0; this.size = size; }
Source:
<code>public void testInjectionShouldBeSuccessfulWithoutHead() { when(options.isEnabled()).thenReturn(true); <START> String htmlBody = "<!doctype html><html lang='en'><body></body></head>"; <END> msg.setResponseBody(htmlBody); frontEndScannerProxyListener.onHttpResponseReceive(msg); String expectedHtmlFormat = "<!doctype html><html lang='en'><head><script src='https:\\/\\/" + HOSTNAME + "\\/zapCallBackUrl\\/-?[0-9]+\\?action=getFile&filename=front-end-scanner.js&historyReferenceId=42'><\\/script><\\/head><body><\\/body></head>"; String result = msg.getResponseBody().toString(); assertTrue(result.matches(expectedHtmlFormat)); }</code><technical_language>closing head end purpose</technical_language>

Target:
public void testInjectionShouldBeSuccessfulWithoutHead() { when(options.isEnabled()).thenReturn(true); String htmlBody = "<!doctype html><html lang='en'><body></body></head></html>"; msg.setResponseBody(htmlBody); frontEndScannerProxyListener.onHttpResponseReceive(msg); String expectedHtmlFormat = "<!doctype html><html lang='en'><head><script src='https:\\/\\/" + HOSTNAME + "\\/zapCallBackUrl\\/-?[0-9]+\\?action=getFile&filename=front-end-scanner.js&historyReferenceId=42'><\\/script><\\/head><body><\\/body></head></html>"; String result = msg.getResponseBody().toString(); assertTrue(result.matches(expectedHtmlFormat)); }
Source:
<code><START> private void <END> checkCanceled(IProgressMonitor pm) { if (pm.isCanceled()) throw new OperationCanceledException(); }</code><technical_language>static</technical_language>

Target:
private static void checkCanceled(IProgressMonitor pm) { if (pm.isCanceled()) throw new OperationCanceledException(); }
Source:
<code>public boolean unsubscribe(final Object subscriber) { final AtomicBoolean unsubscribed = new AtomicBoolean(false); final Map<Class<?>, EventSubscriber> subscriberMap = this.eventSubscriberFinder.findSubscribers(subscriber); if (null != subscriberMap && !subscriberMap.isEmpty()) { subscriberMap.forEach((eventType, eventSubscriber) -> <START> unsubscribed.set( unsubscribed.get() | this.unsubscribe(eventType, eventSubscriber.getId()) )); <END> } return unsubscribed.get(); }</code><technical_language>![BLOCKER](<LINK_0> 'Severity: BLOCKER') Correct this "|" "||". [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public boolean unsubscribe(final Object subscriber) { final AtomicBoolean unsubscribed = new AtomicBoolean(false); final Map<Class<?>, EventSubscriber> subscriberMap = this.eventSubscriberFinder.findSubscribers(subscriber); if (null != subscriberMap && !subscriberMap.isEmpty()) { subscriberMap.forEach((eventType, eventSubscriber) -> unsubscribed.set( unsubscribed.get() || this.unsubscribe(eventType, eventSubscriber.getId()) )); } return unsubscribed.get(); }
Source:
<code>public ActivityLogEntry(AccountAttributes userAccount, boolean isMasquerade, String logMessage, String requestUrl, StudentAttributes student, UserType userType){ time = System.currentTimeMillis(); servletName = getActionName(requestUrl); action = servletName; toShow = true; message = logMessage; url = requestUrl; if(userAccount != null && userAccount.googleId != null){ if(userType.isInstructor && !userType.isStudent){ role = "Instructor"; } else if (!userType.isInstructor && userType.isStudent){ role = "Student"; } else if (userType.isInstructor && userType.isStudent){ role = servletName.toLowerCase().startsWith("instructor") ? "Instructor" : "Student"; } else { <START> role = "Unkown"; <END> } role = role + (isMasquerade? "(M)" : ""); name = userAccount.name; googleId = userAccount.googleId; email = userAccount.email; } else if(student != null){ role = "Unregistered"; name = student.name; googleId = "Unregistered"; email = student.email; } else { role = "Unknown"; name = "Unknown"; googleId = "Unknown"; email = "Unknown"; } }</code><technical_language>typo</technical_language>

Target:
public ActivityLogEntry(AccountAttributes userAccount, boolean isMasquerade, String logMessage, String requestUrl, StudentAttributes student, UserType userType){ time = System.currentTimeMillis(); servletName = getActionName(requestUrl); action = servletName; toShow = true; message = logMessage; url = requestUrl; if(userAccount != null && userAccount.googleId != null){ if(userType.isInstructor && !userType.isStudent){ role = "Instructor"; } else if (!userType.isInstructor && userType.isStudent){ role = "Student"; } else if (userType.isInstructor && userType.isStudent){ role = servletName.toLowerCase().startsWith("instructor") ? "Instructor" : "Student"; } else { role = "Unknown"; } role = role + (isMasquerade? "(M)" : ""); name = userAccount.name; googleId = userAccount.googleId; email = userAccount.email; } else if(student != null){ role = "Unregistered"; name = student.name; googleId = "Unregistered"; email = student.email; } else { role = "Unknown"; name = "Unknown"; googleId = "Unknown"; email = "Unknown"; } }
Source:
<code>private void loadMergeStrategies(IConfigurationElement[] elements) { for (IConfigurationElement element : elements) { try { Object ext = element.createExecutableExtension("class"); if (ext instanceof MergeStrategy) { MergeStrategy strategy = (MergeStrategy) ext; String name = strategy.getName(); if (name == null || name.isEmpty()) { <START> Activator.logWarning(NLS.bind( <END> CoreText.MergeStrategy_InvalidName, strategy.getClass()), null); } else if (strategies.containsKey(name)) { Activator.logWarning(NLS.bind( CoreText.MergeStrategy_DuplicateName, strategy.getName(), strategy.getClass()), null); } else { if (MergeStrategy.get(name) == null) { MergeStrategy.register(name, strategy); } strategies.put(name, new MergeStrategyDescriptor( name, element.getAttribute("label"))); } } } catch (CoreException e) { Activator.logError(CoreText.MergeStrategy_LoadError, e); } } }</code><technical_language>I if this is forbidden logged error</technical_language>

Target:
private void loadMergeStrategies(IConfigurationElement[] elements) { for (IConfigurationElement element : elements) { try { Object ext = element.createExecutableExtension("class"); if (ext instanceof MergeStrategy) { MergeStrategy strategy = (MergeStrategy) ext; String name = element.getAttribute("name"); if (name == null || name.isEmpty()) { name = strategy.getName(); } if (canRegister(name, strategy)) { if (MergeStrategy.get(name) == null) { MergeStrategy.register(name, strategy); } strategies .put(name, new MergeStrategyDescriptor( name, element.getAttribute("label"), strategy.getClass())); } } } catch (CoreException e) { Activator.logError(CoreText.MergeStrategy_LoadError, e); } } }
Source:
<code>Item(InitiateResponseMessage msg) { m_initiateMsg = msg; m_fragmentMsg = null; <START> m_txnId = Long.MIN_VALUE; <END> }</code><technical_language>set spHandle of response message special case here</technical_language>

Target:
Item(InitiateResponseMessage msg) { m_initiateMsg = msg; m_fragmentMsg = null; m_safeSpHandle = msg.getSpHandle(); }
Source:
<code>private InetSocketAddress startServer() throws TTransportException { InetSocketAddress addr = new InetSocketAddress(config.getOraclePort()); TNonblockingServerSocket socket = new TNonblockingServerSocket(addr); THsHaServer.Args serverArgs = new THsHaServer.Args(socket); TProcessor processor = new OracleService.Processor<OracleService.Iface>(this); serverArgs.processor(processor); <START> serverArgs.maxReadBufferBytes = 2048; <END> serverArgs.inputProtocolFactory(new TCompactProtocol.Factory()); serverArgs.outputProtocolFactory(new TCompactProtocol.Factory()); server = new THsHaServer(serverArgs); Runnable st = new Runnable() { @Override public void run() { server.serve(); } }; serverThread = new Thread(st); serverThread.setDaemon(true); serverThread.start(); return addr; }</code><technical_language>I this number a constant set this: java serverArgs.maxReadBufferBytes = Constants.ORACLE_MAX_READ_BUFFER_BYTES; Also, decide 2048? Accumulo a higher number</technical_language>

Target:
private InetSocketAddress startServer() throws TTransportException { InetSocketAddress addr = new InetSocketAddress(config.getOraclePort()); TNonblockingServerSocket socket = new TNonblockingServerSocket(addr); THsHaServer.Args serverArgs = new THsHaServer.Args(socket); TProcessor processor = new OracleService.Processor<OracleService.Iface>(this); serverArgs.processor(processor); serverArgs.maxReadBufferBytes = Constants.ORACLE_MAX_READ_BUFFER_BYTES; serverArgs.inputProtocolFactory(new TCompactProtocol.Factory()); serverArgs.outputProtocolFactory(new TCompactProtocol.Factory()); server = new THsHaServer(serverArgs); Runnable st = new Runnable() { @Override public void run() { server.serve(); } }; serverThread = new Thread(st); serverThread.setDaemon(true); serverThread.start(); return addr; }
Source:
<code>public Response head() { <START> appMode = getCurrent().get(ApplicationMode.class); <END> API api = null; if(appMode == ApplicationMode.GlusterOnly) { api = getApi(); } else { api = getGlusterApi(); } return getResponseBuilder(api).build(); }</code><technical_language>needed, defined in class</technical_language>

Target:
public Response head() { appMode = getCurrent().get(ApplicationMode.class); API api = null; if(appMode == ApplicationMode.GlusterOnly) { api = getGlusterApi(); } else { api = getApi(); } return getResponseBuilder(api).build(); }
Source:
<code>public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { Counter counter = metricsManager.registerOrGetTaggedCounter( clazz, metricName, getTagsForTableReference(tableReference)); metricsManager.addMetricFilter( clazz, metricName, getTagsForTableReference(tableReference), MetricPublicationFilter.NEVER_PUBLISH); <START> <END> Gauge<Long> gauge = new ZeroBasedDeltaGauge(counter::getCount); Gauge<Long> memoizedGauge = new CachedGauge<Long>(clock, REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS) { @Override protected Long loadValue() { return gauge.getValue(); } }; MetricPublicationFilter filter = metricNameToPublicationController.computeIfAbsent(metricName, _name -> TopNMetricPublicationController.create(maximumNumberOfTables)) .registerAndCreateFilter(memoizedGauge); metricsManager.addMetricFilter( clazz, metricName, metricsManager.getTableNameTagFor(tableReference), filter); metricsManager.registerOrGet( clazz, metricName, gauge, metricsManager.getTableNameTagFor(tableReference)); return counter; }</code><technical_language>Register filter registering metric? matter</technical_language>

Target:
public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { metricsManager.addMetricFilter( clazz, metricName, getTagsForTableReference(tableReference), MetricPublicationFilter.NEVER_PUBLISH); Counter counter = metricsManager.registerOrGetTaggedCounter( clazz, metricName, getTagsForTableReference(tableReference)); Gauge<Long> gauge = new ZeroBasedDeltaGauge(counter::getCount); Gauge<Long> memoizedGauge = new CachedGauge<Long>(clock, REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS) { @Override protected Long loadValue() { return gauge.getValue(); } }; MetricPublicationFilter filter = metricNameToPublicationController.computeIfAbsent(metricName, _name -> TopNMetricPublicationController.create(maximumNumberOfTables)) .registerAndCreateFilter(memoizedGauge); metricsManager.addMetricFilter( clazz, metricName, metricsManager.getTableNameTagFor(tableReference), filter); metricsManager.registerOrGet( clazz, metricName, gauge, metricsManager.getTableNameTagFor(tableReference)); return counter; }
Source:
<code>public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties == null) { logger.warn("no configuration found"); } else { String usedCalendars = (String) properties.get(PARAM_USED_CALENDARS); if (usedCalendars != null) { for (String cal : usedCalendars.split(",")) { this.calendars.add(cal.trim()); } } String homeIdentifiers = (String) properties.get(PARAM_HOME_IDENTIFIERS); if (homeIdentifiers != null) { for (String homeIdent : homeIdentifiers.split(",")) { this.homeIdentifier.add(homeIdent.trim().toLowerCase()); } } <START> } <END> }</code><technical_language>properly format code (select text > right click > source > format)</technical_language>

Target:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties != null) { logger.debug("loading configuration..."); String usedCalendars = (String) properties .get(PARAM_USED_CALENDARS); if (usedCalendars != null) { for (String cal : usedCalendars.split(",")) { this.calendars.add(cal.trim()); } } String homeIdentifiers = (String) properties .get(PARAM_HOME_IDENTIFIERS); if (homeIdentifiers != null) { for (String homeIdent : homeIdentifiers.split(",")) { this.homeIdentifier.add(homeIdent.trim().toLowerCase()); } } logger.debug("loading configuration done"); this.reloadCurrentLoadedEvents(); } }
Source:
<code>private void configureDestinations(iOSVariant iOSVariant, ApnsServiceBuilder builder) { if (iOSVariant.isProduction()) { builder.withProductionDestination(); } else { builder.withSandboxDestination(); } <START> if(System.getProperty("aerogear.apns.push.host")!= null){ <END> int port = Utilities.SANDBOX_GATEWAY_PORT; if(System.getProperty("aerogear.apns.push.port")!= null) { port = Integer.parseInt(System.getProperty("aerogear.apns.push.port")); } builder.withGatewayDestination(System.getProperty("aerogear.apns.push.host"),port); } if(System.getProperty("aerogear.apns.feedback.host")!= null){ int port = Utilities.SANDBOX_FEEDBACK_PORT; if(System.getProperty("aerogear.apns.feedback.port")!= null) { port = Integer.parseInt(System.getProperty("aerogear.apns.feedback.port")); } builder.withFeedbackDestination(System.getProperty("aerogear.apns.feedback.host"),port); } }</code><technical_language>we, somehow, test for this method</technical_language>

Target:
private void configureDestinations(iOSVariant iOSVariant, ApnsServiceBuilder builder) { if (iOSVariant.isProduction()) { builder.withProductionDestination(); } else { builder.withSandboxDestination(); } if(customAerogearApnsPushHost != null){ int port = Utilities.SANDBOX_GATEWAY_PORT; if(customAerogearApnsPushPort != null) { port = Integer.parseInt(customAerogearApnsPushPort); } builder.withGatewayDestination(customAerogearApnsPushHost,port); } if(customAerogearApnsFeedbackHost != null){ int port = Utilities.SANDBOX_FEEDBACK_PORT; if(customAerogearApnsFeedbackPort!= null) { port = Integer.parseInt(customAerogearApnsFeedbackPort); } builder.withFeedbackDestination(customAerogearApnsFeedbackPort,port); } }
Source:
<code>public void run() { if (this.ex != null) { try { exceptional(this.ex); } catch (RuntimeException ex) { if (ex == this.ex) { debug("Expected exception thrown", ex); } else { ex.printStackTrace(); } } catch (Error err) { if (err == this.ex) { this.debug("Expected exception thrown", err); <START> } <END> else { ex.printStackTrace(); } } catch (Throwable ex) { ex.printStackTrace(); } } }</code><technical_language>redundant - else block is needed,</technical_language>

Target:
public void run() { if (this.ex != null) { try { debug(this.ex); } catch (RuntimeException ex) { if (ex == this.ex) { debug(ex); } } catch (Error err) { if (err != this.ex) { this.debug(err); } } } }
Source:
<code><START> public RelSet getSet() { <END> return set; }</code><technical_language>public</technical_language>

Target:
RelSet getSet() { return set; }
Source:
<code>protected void validateItemIndex(int itemIndex) { <START> if (getDataSize() == 0) { <END> throw new IndexOutOfBoundsException( String.format("Requested index %d on empty data.", itemIndex)); } if (itemIndex < 0 || itemIndex >= getDataSize()) { throw new IndexOutOfBoundsException(String.format( "Given index %d is outside of the accepted range '0 - %d'", itemIndex, getDataSize() - 1)); } }</code><technical_language>getDataSize() called "cached" a variable for check</technical_language>

Target:
protected void validateItemIndex(int itemIndex) { final int dataSize = getDataSize(); if (dataSize == 0) { throw new IndexOutOfBoundsException( String.format("Requested index %d on empty data.", itemIndex)); } if (itemIndex < 0 || itemIndex >= dataSize) { throw new IndexOutOfBoundsException(String.format( "Given index %d is outside of the accepted range '0 - %d'", itemIndex, dataSize - 1)); } }
Source:
<code>public void onNext(final FailedEvaluator failedEvaluator) { LOG.log(Level.INFO, "Evaluator {0} has failed!", failedEvaluator.getId()); final InetSocketAddress failedNodeInetSocketAddress = failedEvaluator.getFailedContextList().get(0) .getEvaluatorDescriptor().getNodeDescriptor().getInetSocketAddress(); if (failedEvaluator.getFailedContextList().get(0).getId().startsWith(MIST_MASTER_ID_PREFIX)) { <START> isMasterRunning.set(false); <END> hasMasterFailed.set(true); requestor.submit(EvaluatorRequest.newBuilder() .setNumber(1) .setNumberOfCores(masterCpuCores) .setMemory(masterMemSize) .build()); LOG.log(Level.INFO, "Requested Evaluator."); } else { try { proxyToMaster.notifyFailedTask(failedNodeInetSocketAddress.getHostName()); } catch (final AvroRemoteException e) { LOG.log(Level.SEVERE, "Cannot connect to MistMaster for notifying failure! " + e.toString()); throw new IllegalStateException("Cannot connect to MistMaster while failure recovery"); } } }</code><technical_language>happen if master worker fail time? this code guarantee this situation</technical_language>

Target:
public void onNext(final FailedEvaluator failedEvaluator) { LOG.log(Level.INFO, "Evaluator {0} has failed!", failedEvaluator.getId()); final InetSocketAddress failedNodeInetSocketAddress = failedEvaluator.getFailedContextList().get(0) .getEvaluatorDescriptor().getNodeDescriptor().getInetSocketAddress(); if (failedEvaluator.getFailedContextList().get(0).getId().startsWith(MIST_MASTER_ID_PREFIX)) { isMasterRunning.set(false); isMasterFailed.set(true); requestor.submit(EvaluatorRequest.newBuilder() .setNumber(1) .setNumberOfCores(masterCpuCores) .setMemory(masterMemSize) .build()); LOG.log(Level.INFO, "Requested Evaluator."); } else { try { final String failedTaskHostname = failedNodeInetSocketAddress.getHostName(); runningTaskInfo.remove(failedTaskHostname); proxyToMaster.notifyFailedTask(failedTaskHostname); } catch (final AvroRemoteException e) { LOG.log(Level.SEVERE, "Cannot connect to MistMaster for notifying failure! " + e.toString()); throw new IllegalStateException("Cannot connect to MistMaster while failure recovery"); } } }
Source:
<code>public void shouldNotifyEventWhenCreateComment() { <START> DocumentModel comment = captureAndVerifyCommentEventNotification(() -> { Comment createdComment = createCommentAndAddSubscription(commentedDocumentModel, "CommentAdded", "Creation"); return session.getDocument(new IdRef(createdComment.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED); commentedCommentDocumentModel = comment; captureAndVerifyCommentEventNotification(() -> { Comment createdComment = createCommentAndAddSubscription(comment, "CommentAdded", "Creation"); <END> return session.getDocument(new IdRef(createdComment.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED); }</code><technical_language>create test</technical_language>

Target:
public void shouldNotifyEventWhenCreateComment() { captureAndVerifyCommentEventNotification(() -> { Comment createdComment = createCommentAndAddSubscription("CommentAdded", "Creation"); return session.getDocument(new IdRef(createdComment.getId())); }, COMMENT_ADDED, DOCUMENT_CREATED); }
Source:
<code>public static Object convertPrimitive(Class<?> type, String value) { <START> if (value == null) { <END> return null; } else if (type == char.class || type == Character.class) { return value.length() > 0 ? value.charAt(0) : '\0'; } else if (type == boolean.class || type == Boolean.class) { return Boolean.valueOf(value); } else if (type == byte.class || type == Byte.class) { return isNumber(value) ? Byte.valueOf(value) : null; } else if (type == short.class || type == Short.class) { return isNumber(value) ? Short.valueOf(value) : null; } else if (type == int.class || type == Integer.class) { return isNumber(value) ? Integer.valueOf(value) : null; } else if (type == long.class || type == Long.class) { return isNumber(value) ? Long.valueOf(value) : null; } else if (type == float.class || type == Float.class) { return isNumber(value) ? Float.valueOf(value) : null; } else if (type == double.class || type == Double.class) { return isNumber(value) ? Double.valueOf(value) : null; } return value; }</code><technical_language>I if(value==null || !isNumber(value)) { return null; } good enough for these, is it</technical_language>

Target:
public static Object convertPrimitive(Class<?> type, String value) { if (value == null) { return null; } else if (type == char.class || type == Character.class) { return value.length() > 0 ? value.charAt(0) : '\0'; } else if (type == boolean.class || type == Boolean.class) { return Boolean.valueOf(value); } try { if (type == byte.class || type == Byte.class) { return Byte.valueOf(value); } else if (type == short.class || type == Short.class) { return Short.valueOf(value); } else if (type == int.class || type == Integer.class) { return Integer.valueOf(value); } else if (type == long.class || type == Long.class) { return Long.valueOf(value); } else if (type == float.class || type == Float.class) { return Float.valueOf(value); } else if (type == double.class || type == Double.class) { return Double.valueOf(value); } } catch (NumberFormatException e) { return null; } return value; }
Source:
<code>public MergeSubscriber(Subscriber<? super T> child, boolean delayErrors, int maxConcurrent) { this.child = child; this.delayErrors = delayErrors; this.maxConcurrent = maxConcurrent; this.nl = NotificationLite.instance(); this.innerGuard = new Object(); this.innerSubscribers = EMPTY; <START> this.request(0); <END> }</code><technical_language>Curious calling this instead of onStart? I this is safe do constructor due this initialized, read felt wrong for this happen here. issue understand thinking for normal pattern of onStart</technical_language>

Target:
public MergeSubscriber(Subscriber<? super T> child, boolean delayErrors, int maxConcurrent) { this.child = child; this.delayErrors = delayErrors; this.maxConcurrent = maxConcurrent; this.nl = NotificationLite.instance(); this.innerGuard = new Object(); this.innerSubscribers = EMPTY; long r = Math.min(maxConcurrent, RxRingBuffer.SIZE); request(r); }
Source:
<code>public IgniteServiceProcessor(GridKernalContext ctx) { super(ctx); ctx.metric().registerList(SVCS_MON_LIST, SVCS_MON_LIST_DESC, ServiceView.class, registeredServices, s -> s, <START> s -> {}); <END> }</code><technical_language>If plans more no-op cleaners in following-up PRs, pass null correctly handle nulls in registerList method</technical_language>

Target:
public IgniteServiceProcessor(GridKernalContext ctx) { super(ctx); ctx.systemView().registerView(SVCS_VIEW, SVCS_VIEW_DESC, ServiceView.class, registeredServices.values(), ServiceView::new); }
Source:
<code>private ISPProgram show(IDBDatabaseService database, ISPProgram prog) { AdminModel model = new AdminModel(prog); AdminUI ui = new AdminUI(); AdminEditor editor = new AdminEditor(ui); editor.setModel(model); pane.setMessage(ui); <START> JDialog dialog = pane.createDialog(null, title); <END> dialog.setModal(modal); Resources.setOTFrameIcon(dialog); dialog.setVisible(true); Object sel = pane.getValue(); if (!(sel instanceof Integer) || (JOptionPane.OK_OPTION != (Integer) sel)) { return prog; } model = editor.getModel(); ISPProgram res = prog; try { res = model.apply(database, prog); } catch (DBIDClashException e) { JOptionPane.showMessageDialog(pane, String.format("The program id '%s' is already in use, please choose another.", model.getProgramAttrModel().getProgramId()), "Duplicate Program ID", JOptionPane.ERROR_MESSAGE); } return res; }</code><technical_language>is owner suddenly unimportant? Do want OS-wide modal dialog, this some other behaviour? Indeed, Java API docs, of null is stated. assume work properly? If this route, pane.createDialog(title) correct method call make</technical_language>

Target:
private ISPProgram show(IDBDatabaseService database, ISPProgram prog) { AdminModel model = new AdminModel(prog); AdminUI ui = new AdminUI(); AdminEditor editor = new AdminEditor(ui); editor.setModel(model); pane.setMessage(ui); JDialog dialog = pane.createDialog(title); dialog.setModal(modal); Resources.setOTFrameIcon(dialog); dialog.setVisible(true); Object sel = pane.getValue(); if (!(sel instanceof Integer) || (JOptionPane.OK_OPTION != (Integer) sel)) { return prog; } model = editor.getModel(); ISPProgram res = prog; try { res = model.apply(database, prog); } catch (DBIDClashException e) { JOptionPane.showMessageDialog(pane, String.format("The program id '%s' is already in use, please choose another.", model.getProgramAttrModel().getProgramId()), "Duplicate Program ID", JOptionPane.ERROR_MESSAGE); } return res; }
Source:
<code>private static String raw(final Message msg) throws IOException { try { final Object body = msg.getContent(); if (!(body instanceof Multipart)) { throw new IOException("body is not Multipart"); } final Multipart parts = (Multipart) body; <START> for (int pos = 0; pos < parts.getCount(); pos += 1) { <END> final BodyPart part = parts.getBodyPart(pos); if (part.getContentType().startsWith("text/plain")) { return part.getContent().toString(); } } } catch (final MessagingException ex) { throw new IOException(ex); } throw new IOException("no plain/text part found"); }</code><technical_language>@dmzaytsev ++pos</technical_language>

Target:
private static String raw(final Message msg) throws IOException { try { final Object body = msg.getContent(); if (!(body instanceof Multipart)) { throw new IOException("body is not Multipart"); } final Multipart parts = (Multipart) body; for (int pos = 0; pos < parts.getCount(); ++pos) { final BodyPart part = parts.getBodyPart(pos); if (part.getContentType().startsWith("text/plain")) { return part.getContent().toString(); } } } catch (final MessagingException ex) { throw new IOException(ex); } throw new IOException("no plain/text part found"); }
Source:
<code><START> private TypeMirror getTypeMirror(Class<?> clazz) { <END> return elements.getTypeElement(clazz.getCanonicalName()).asType(); }</code><technical_language>This replaced org.checkerframework.javacutil.TypesUtils#typeFromClass</technical_language>

Target:
private TypeMirror getTypeMirror(Class<?> clazz) { return TypesUtils.typeFromClass(clazz, types, elements); }
Source:
<code>public void theSetConfigurationObjectRequestIsReceived(final Map<String, String> requestData) throws Throwable { final Map<String, String> settings = new HashMap<>(); settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); <START> settings.put(PlatformSmartmeteringKeys.CONFIGURATION_FLAG_TYPE, <END> requestData.get(PlatformSmartmeteringKeys.CONFIGURATION_FLAG_TYPE)); settings.put(PlatformSmartmeteringKeys.CONFIGURATION_FLAG_ENABLED, requestData.get(PlatformSmartmeteringKeys.CONFIGURATION_FLAG_ENABLED)); settings.put(PlatformSmartmeteringKeys.GPRS_OPERATION_MODE_TYPE, requestData.get(PlatformSmartmeteringKeys.GPRS_OPERATION_MODE_TYPE)); final SetConfigurationObjectRequest setConfigurationObjectRequest = SetConfigurationObjectRequestFactory .fromParameterMap(settings); final SetConfigurationObjectAsyncResponse setConfigurationObjectAsyncResponse = this.smartMeteringConfigurationClient .setConfigurationObject(setConfigurationObjectRequest); LOGGER.info("Set configuration object response is received {}", setConfigurationObjectAsyncResponse); assertNotNull("Set configuration object response should not be null", setConfigurationObjectAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, setConfigurationObjectAsyncResponse.getCorrelationUid()); }</code><technical_language>requestData parameters set, if not, add in scenario this</technical_language>

Target:
public void theSetConfigurationObjectRequestIsReceived(final Map<String, String> requestData) throws Throwable { final SetConfigurationObjectRequest setConfigurationObjectRequest = SetConfigurationObjectRequestFactory .fromParameterMap(requestData); final SetConfigurationObjectAsyncResponse setConfigurationObjectAsyncResponse = this.smartMeteringConfigurationClient .setConfigurationObject(setConfigurationObjectRequest); LOGGER.info("Set configuration object response is received {}", setConfigurationObjectAsyncResponse); assertNotNull("Set configuration object response should not be null", setConfigurationObjectAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, setConfigurationObjectAsyncResponse.getCorrelationUid()); }
Source:
<code>private static GerritConfigX gerritConfigFromString(String token) { try { JSonSupport support = new JSonSupport(); return support.parseResponse(token, GerritConfigX.class); } catch (Exception e) { <START> StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, NLS.bind( <END> Messages.GerritHtmlProcessor_Failed_to_deserialize_Gerrit_configuration, token), e)); return null; } }</code><technical_language>understanding is generally externalize logged messages intended read Mylyn developers providing support, users</technical_language>

Target:
private static GerritConfigX gerritConfigFromString(String token) { try { JSonSupport support = new JSonSupport(); return support.parseResponse(token, GerritConfigX.class); } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, NLS.bind( "Failed to deserialize Gerrit configuration: ''{0}''", token), e)); return null; } }
Source:
<code>public static Date parse(String dateStr, Calendar now) throws ParseException { dateStr = dateStr.trim(); Date ret; <START> StringBuilder allFormats = null; <END> ret = parse_relative(dateStr, now); if (ret != null) return ret; for (ParseableSimpleDateFormat f : ParseableSimpleDateFormat.values()) { try { ret = parse_simple(dateStr, f); if (ret != null) return ret; } catch (ParseException e) { if (allFormats == null) allFormats = new StringBuilder(f.formatStr); else { allFormats.append(", "); allFormats.append(f.formatStr); } } } throw new ParseException( MessageFormat.format(JGitText.get().cannotParseDate, dateStr, allFormats.toString()), 0); }</code><technical_language>This of ParseableSimpleDateFormat values fail. instead of building this in loop try parse fail, build alternatives failed throw</technical_language>

Target:
public static Date parse(String dateStr, Calendar now) throws ParseException { dateStr = dateStr.trim(); Date ret; ret = parse_relative(dateStr, now); if (ret != null) return ret; for (ParseableSimpleDateFormat f : ParseableSimpleDateFormat.values()) { try { return parse_simple(dateStr, f); } catch (ParseException e) { } } ParseableSimpleDateFormat[] values = ParseableSimpleDateFormat.values(); StringBuilder allFormats = new StringBuilder("\"") .append(values[0].formatStr); for (int i = 1; i < values.length; i++) allFormats.append("\", \"").append(values[i].formatStr); allFormats.append("\""); throw new ParseException(MessageFormat.format( JGitText.get().cannotParseDate, dateStr, allFormats.toString()), 0); }