auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int hashCode() { <START> int hash = 7; <END> hash = 31 * hash + Objects.hashCode(podSpec); hash = 31 * hash + Objects.hashCode(podMeta); return hash; }</code><technical_language>simpler: return Objects.hash(podSpec, podMeta); not, involves instantiation of array hood. other hand, leaves room for error. :smile:</technical_language>

Target:
public int hashCode() { return Objects.hash(podSpec, podMeta); }
Source:
<code>private static String getPushServiceClassName( Context appContext ) { if( BackendlessPushService.pushServiceClassName != null ) return BackendlessPushService.pushServiceClassName; ClassLoader clsLoader = appContext.getClassLoader(); PackageManager packageManager = appContext.getPackageManager(); PackageInfo packageInfo; try { packageInfo = packageManager.getPackageInfo( appContext.getPackageName(), PackageManager.GET_SERVICES ); ServiceInfo[] services = packageInfo.services; for( ServiceInfo srvInfo : services ) { try { if( BackendlessPushService.class.isAssignableFrom( clsLoader.loadClass( srvInfo.name ) ) ) { BackendlessPushService.pushServiceClassName = srvInfo.name; break; } } catch( ClassNotFoundException e ) { <START> Log.e( TAG, "Can not load declared service class.", e ); <END> } } } catch( PackageManager.NameNotFoundException e ) { Log.e( TAG, "Can not load current app package." ); throw new IllegalStateException( "Can not load current app package." ); } if( BackendlessPushService.pushServiceClassName == null ) throw new IllegalStateException( "Can not find 'com.backendless.push.BackendlessPushService' or it inheritor in AndroidManifest.xml." ); else return BackendlessPushService.pushServiceClassName; }</code><technical_language>this exception occurs ignore it? if ignore log level info warning</technical_language>

Target:
private static String getPushServiceClassName( Context appContext ) { if( BackendlessPushService.pushServiceClassName != null ) return BackendlessPushService.pushServiceClassName; ClassLoader clsLoader = appContext.getClassLoader(); PackageManager packageManager = appContext.getPackageManager(); PackageInfo packageInfo; try { packageInfo = packageManager.getPackageInfo( appContext.getPackageName(), PackageManager.GET_SERVICES ); ServiceInfo[] services = packageInfo.services; for( ServiceInfo srvInfo : services ) { try { if( BackendlessPushService.class.isAssignableFrom( clsLoader.loadClass( srvInfo.name ) ) ) { BackendlessPushService.pushServiceClassName = srvInfo.name; break; } } catch( ClassNotFoundException e ) { Log.w( TAG, "You have declared class in AndroidManifest.xml that is not present in your app.", e ); } } } catch( PackageManager.NameNotFoundException e ) { Log.e( TAG, "Can not load current app package." ); throw new IllegalStateException( "Can not load current app package.", e ); } if( BackendlessPushService.pushServiceClassName == null ) { throw new IllegalStateException( "A reference to BackendlessPushService is missing in AndroidManifest.xml. Make sure to add" + "<service android:name=\"com.backendless.push.BackendlessPushService\" /> to the manifest file." + "Alternatively, if you have a custom push service implementation, make sure your class inherits from" + "\"com.backendless.push.BackendlessPushService\" and is registered in the manifest file" + "as <service android:name=\"your push service fully qualified class name\" />" ); } else return BackendlessPushService.pushServiceClassName; }
Source:
<code>protected UsageAwareDatastoreConnection<UpdateableDataContext> createDatastoreConnection() { <START> Object client = null; <END> switch (_clientType) { case NODE: client = getClientForJoingClusterAsNode(); break; case TRANSPORT: client = getClientForTransportProtocol(); break; case REST: client = getClientForRestProtocol(); default: } final DataContext dataContext; if (_tableDefs == null || _tableDefs.length == 0) { if (_clientType == ClientType.NODE || _clientType == ClientType.TRANSPORT) { dataContext = new ElasticSearchDataContext((Client) client, _indexName); } else { dataContext = new ElasticSearchRestDataContext((JestClient) client, _indexName); } } else { if (_clientType == ClientType.NODE || _clientType == ClientType.TRANSPORT) { dataContext = new ElasticSearchDataContext((Client) client, _indexName, _tableDefs); } else { dataContext = new ElasticSearchRestDataContext((JestClient) client, _indexName, _tableDefs); } } switch (_clientType) { case NODE: case TRANSPORT: return new UpdateableDatastoreConnectionImpl<UpdateableDataContext>((ElasticSearchDataContext) dataContext, this, (Client) client); case REST: return new UpdateableDatastoreConnectionImpl<UpdateableDataContext>( (ElasticSearchRestDataContext) dataContext, this); } return null; }</code><technical_language>Client Object is a bit dirty means need type-cast in method. do common for NODE TRANSPORT a completely code block for REST. ES Client type a JestClient type for other scenario</technical_language>

Target:
protected UsageAwareDatastoreConnection<UpdateableDataContext> createDatastoreConnection() { final DataContext dataContext; if (_tableDefs == null || _tableDefs.length == 0) { if (_clientType.equals(ClientType.NODE) || _clientType.equals(ClientType.TRANSPORT)) { final Client client = getClientForNodeAndTransportProtocol(); dataContext = new ElasticSearchDataContext(client, _indexName); return createConnection(dataContext, client); } else { dataContext = new ElasticSearchRestDataContext(getClientForRestProtocol(), _indexName); return createConnection(dataContext, null); } } else { if (_clientType.equals(ClientType.NODE) || _clientType.equals(ClientType.TRANSPORT)) { final Client client = getClientForNodeAndTransportProtocol(); dataContext = new ElasticSearchDataContext(client, _indexName, _tableDefs); return createConnection(dataContext, client); } else { dataContext = new ElasticSearchRestDataContext(getClientForRestProtocol(), _indexName, _tableDefs); return createConnection(dataContext, null); } } }
Source:
<code><START> static String buildDeadlockInfo() { <END> ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long[] threadIds = threadBean.findMonitorDeadlockedThreads(); if (threadIds != null && threadIds.length > 0) { StringWriter stringWriter = new StringWriter(); PrintWriter out = new PrintWriter(stringWriter); ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true); for (ThreadInfo ti : infos) { printThreadInfo(ti, out); printLockInfo(ti.getLockedSynchronizers(), out); out.println(); } out.close(); return stringWriter.toString(); } else { return null; } }</code><technical_language>Idem modifier</technical_language>

Target:
private static String buildDeadlockInfo() { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long[] threadIds = threadBean.findMonitorDeadlockedThreads(); if (threadIds != null && threadIds.length > 0) { StringBuilder sb = new StringBuilder(); ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true); for (ThreadInfo ti : infos) { printThreadInfo(ti, sb); printLockInfo(ti.getLockedSynchronizers(), sb); sb.append(System.getProperty("line.separator")); } return sb.toString(); } else { return null; } }
Source:
<code>static void addJarToClassPath( File jarFile, Path distributedClassPath, Path intermediateClassPath, FileSystem fs, Job job ) throws IOException { fs.mkdirs(distributedClassPath); final Path hdfsPath = new Path(distributedClassPath, jarFile.getName()); if (!fs.exists(hdfsPath)) { final Path intermediateHdfsPath = new Path(intermediateClassPath, jarFile.getName()); uploadJar(jarFile, intermediateHdfsPath, fs); IOException exception = null; try { log.info("Renaming jar to path[%s]", hdfsPath); fs.rename(intermediateHdfsPath, hdfsPath); if (!fs.exists(hdfsPath)) { throw new IOException( String.format( "File does not exist even after moving from[%s] to [%s]", intermediateHdfsPath, hdfsPath ) ); } } catch (IOException e) { try { if (!fs.exists(hdfsPath)) { log.error(e, "IOException while Renaming jar file"); exception = e; } } catch (IOException e1) { e.addSuppressed(e1); exception = e; } } finally { try { if (fs.exists(intermediateHdfsPath)) { fs.delete(intermediateHdfsPath, false); } } catch (IOException e) { if (exception != null) { exception.addSuppressed(e); } else { <START> exception = e; <END> } } if (exception != null) { throw exception; } } } job.addFileToClassPath(hdfsPath); }</code><technical_language>Is this making a jar left intermediateHdfsPath</technical_language>

Target:
static void addJarToClassPath( File jarFile, Path distributedClassPath, Path intermediateClassPath, FileSystem fs, Job job ) throws IOException { fs.mkdirs(distributedClassPath); final Path hdfsPath = new Path(distributedClassPath, jarFile.getName()); if (!fs.exists(hdfsPath)) { final Path intermediateHdfsPath = new Path(intermediateClassPath, jarFile.getName()); uploadJar(jarFile, intermediateHdfsPath, fs); IOException exception = null; try { log.info("Renaming jar to path[%s]", hdfsPath); fs.rename(intermediateHdfsPath, hdfsPath); if (!fs.exists(hdfsPath)) { throw new IOException( String.format( "File does not exist even after moving from[%s] to [%s]", intermediateHdfsPath, hdfsPath ) ); } } catch (IOException e) { try { if (!fs.exists(hdfsPath)) { log.error(e, "IOException while Renaming jar file"); exception = e; } } catch (IOException e1) { e.addSuppressed(e1); exception = e; } } finally { try { if (fs.exists(intermediateHdfsPath)) { fs.delete(intermediateHdfsPath, false); } } catch (IOException e) { if (exception == null) { exception = e; } else { exception.addSuppressed(e); } } if (exception != null) { throw exception; } } } job.addFileToClassPath(hdfsPath); }
Source:
<code><START> private <T extends EntityAttributes<?>> void sanitizeMapForSaving(Map<String, T> map) { <END> for (T attribute : map.values()) { attribute.sanitizeForSaving(); } }</code><technical_language><T extends EntityAttributes<? extends BaseEntity>></technical_language>

Target:
private <T extends EntityAttributes<? extends BaseEntity>> void sanitizeMapForSaving(Map<String, T> map) { for (T attribute : map.values()) { attribute.sanitizeForSaving(); } }
Source:
<code>private boolean <START> isHostSwapping(VDS <END> host, int allowedSwapUsage) { if (host.getSwapTotal() == null || host.getSwapFree() == null || host.getMemFree() == null || host.getMemAvailable() <= 0 || host.getPhysicalMemMb() == null || host.getPhysicalMemMb() <= 0) { return false; } long swapTotal = host.getSwapTotal(); long swapFree = host.getSwapFree(); long memFree = host.getMemFree(); long physicalMemMb = host.getPhysicalMemMb(); return ((swapTotal - swapFree - memFree) * 100 / physicalMemMb) > allowedSwapUsage; }</code><technical_language>change name "isHostSwappingMoreThanAllowed" more accurate</technical_language>

Target:
private boolean isHostSwapping(VDS host, int allowedSwapUsage) { if (host.getSwapTotal() == null || host.getSwapFree() == null || host.getMemFree() == null || host.getMemFree() <= 0 || host.getPhysicalMemMb() == null || host.getPhysicalMemMb() <= 0) { return false; } long swapTotal = host.getSwapTotal(); long swapFree = host.getSwapFree(); long memFree = host.getMemFree(); long physicalMemMb = host.getPhysicalMemMb(); return ((swapTotal - swapFree - memFree) * 100 / physicalMemMb) > allowedSwapUsage; }
Source:
<code>private void logStart() { log(3, "Running test " + m_testName + " on " + m_classMap.size() + " " + " classes, " <START> + " included groups:[" + Strings.mapToString(m_xmlMethodSelector.getIncludedGroups()) <END> + "] excluded groups:[" + Strings.mapToString(m_xmlMethodSelector.getExcludedGroups()) + "]"); if (getVerbose() >= 3) { for (ITestClass tc : m_classMap.values()) { ((TestClass) tc).dump(); } } }</code><technical_language>valueOf more (like String#valueOf)</technical_language>

Target:
private void logStart() { log(3, "Running test " + m_testName + " on " + m_classMap.size() + " " + " classes, " + " included groups:[" + Strings.valueOf(m_xmlMethodSelector.getIncludedGroups()) + "] excluded groups:[" + Strings.valueOf(m_xmlMethodSelector.getExcludedGroups()) + "]"); if (getVerbose() >= 3) { for (ITestClass tc : m_classMap.values()) { ((TestClass) tc).dump(); } } }
Source:
<code><START> protected void validateMatchers(Invocation invocation, List<LocalizedMatcher> lastMatchers) { <END> if (!lastMatchers.isEmpty()) { int recordedMatchersSize = lastMatchers.size(); int expectedMatchersSize = invocation.getArguments().length; if (expectedMatchersSize != recordedMatchersSize) { throw invalidUseOfMatchers(expectedMatchersSize, lastMatchers); } } }</code><technical_language>is reasoning for making this protected? is internal class, subclassed</technical_language>

Target:
private void validateMatchers(Invocation invocation, List<LocalizedMatcher> lastMatchers) { if (!lastMatchers.isEmpty()) { int recordedMatchersSize = lastMatchers.size(); int expectedMatchersSize = invocation.getArguments().length; if (expectedMatchersSize != recordedMatchersSize) { throw invalidUseOfMatchers(expectedMatchersSize, lastMatchers); } } }
Source:
<code>default <R> IModel<R> flatMap(WicketFunction<? super T, IModel<R>> mapper) { return new IModel<R>() { @Override public R getObject() { T object = IModel.this.getObject(); if (object != null) { return mapper.apply(object).getObject(); } else { return null; } } @Override public void setObject(R object) { T modelObject = IModel.this.getObject(); if (modelObject != null) { mapper.apply(modelObject).setObject(object); } } @Override public void detach() { T object = IModel.this.getObject(); if (object != null) { <START> IModel<R> model = mapper.apply(object); <END> if (model != null) { model.detach(); } } } }; }</code><technical_language>result of mapper.apply() is checks in other methods. I too</technical_language>

Target:
default <R> IModel<R> flatMap(WicketFunction<? super T, IModel<R>> mapper) { return new IModel<R>() { @Override public R getObject() { T object = IModel.this.getObject(); if (object != null) { IModel<R> model = mapper.apply(object); if (model != null) { return model.getObject(); } else { return null; } } else { return null; } } @Override public void setObject(R object) { T modelObject = IModel.this.getObject(); if (modelObject != null) { IModel<R> model = mapper.apply(modelObject); if (model != null) { model.setObject(object); } } } @Override public void detach() { T object = IModel.this.getObject(); if (object != null) { IModel<R> model = mapper.apply(object); if (model != null) { model.detach(); } } } }; }
Source:
<code>public int getHttp2Port() { <START> return -1; <END> }</code><technical_language>a CloudDataNode support for http2 AmbryDataNode does, corresponds a VCR eventually support http2 transport</technical_language>

Target:
public int getHttp2Port() { if (hasHttp2Port()) { return http2Port.getPort(); } else { throw new IllegalStateException("No HTTP2 port exists for the Data Node " + hostName + ":" + plainTextPort); } }
Source:
<code>public int compare(Viewer viewer, Object e1, Object e2) { <START> MyModel location_1 = (MyModel) e1; <END> MyModel location_2 = (MyModel) e2; return Integer.compare(location_2.populationSize, location_1.populationSize); }</code><technical_language>"normal" Java names. match regular expression '^[a-z][a-zA-Z0-9]*$'</technical_language>

Target:
public int compare(Viewer viewer, Object e1, Object e2) { MyModel location1 = (MyModel) e1; MyModel location2 = (MyModel) e2; return Integer.compare(location2.getPopulationSize(), location1.getPopulationSize()); }
Source:
<code>private static String unwrap(final String stringToUnwrap, final Character wrappingCharacterStart, final Character wrappingCharacterEnd) { int start = stringToUnwrap.indexOf(wrappingCharacterStart); int end = stringToUnwrap.lastIndexOf(wrappingCharacterEnd); if (start < 0 || end < 0) { return stringToUnwrap; } return stringToUnwrap.substring(start + 1, <START> end).trim(); <END> }</code><technical_language>prefer add a parameter validation check start < end give illegal argument exception a meaningful message instead of StringIndexOutOfBoundsException. Another validation check suggestion: start char end char</technical_language>

Target:
private static String unwrap(final String stringToUnwrap, final Character wrappingCharacterStart, final Character wrappingCharacterEnd) { int start = stringToUnwrap.indexOf(wrappingCharacterStart); int end = stringToUnwrap.lastIndexOf(wrappingCharacterEnd); if (start < 0 && end < 0) { return stringToUnwrap; } if (start < 0 || end < 0 || end <= start) { final String message = String.format("\"%s\" had not characters '%c':%d and '%c':%d in appropriate order.", stringToUnwrap, wrappingCharacterStart, start, wrappingCharacterEnd, end); throw new IllegalArgumentException(message); } return stringToUnwrap.substring(start + 1, end).trim(); }
Source:
<code>public ImmutableBitmap getBitmapIndex(final BitmapIndexSelector selector) { final Context cx = Context.enter(); try { ImmutableBitmap bitmap; boolean hasEmptyDimension = false; Indexed<String> dimValuesList = new Indexed[dimension.length]; Iterator<String> dimValuesIterator = new Iterator[dimension.length]; String[] currentDim = new String[dimension.length]; for(int idx = 0; idx < dimension.length; idx++) { dimValuesList[idx] = selector.getDimensionValues(dimension[idx]); if (dimValuesList[idx].size() == 0) { hasEmptyDimension = true; break; } dimValuesIterator[idx] = dimValuesList[idx].iterator(); if (idx != 0) { currentDim[idx] = dimValuesIterator[idx].next(); } } bitmap = selector.getBitmapFactory().makeEmptyImmutableBitmap(); <START> if (!hasEmptyDimension) { <END> int iteratingIndex = 0; while(true) { Iterator<String> iterator = dimValuesIterator[iteratingIndex]; if (iterator.hasNext()) { currentDim[iteratingIndex] = iterator.next(); if (iteratingIndex > 0) { for (int idx = 0; idx < iteratingIndex; idx++) { dimValuesIterator[idx] = dimValuesList[idx].iterator(); currentDim[idx] = dimValuesIterator[idx].next(); } iteratingIndex = 0; } if (predicate.applyInContext(cx, currentDim)) { ImmutableBitmap overlap = null; for (int idx = 0; idx < dimension.length; idx++) { ImmutableBitmap dimBitMap = selector.getBitmapIndex(dimension[idx], currentDim[idx]); overlap = (overlap == null) ? dimBitMap : overlap.intersection(dimBitMap); } bitmap = bitmap.union(overlap); } } else { iteratingIndex++; if (iteratingIndex == dimension.length) break; } } } return bitmap; } finally { Context.exit(); } }</code><technical_language>this create empty bitmap if of dims values? condition instead dims values? e.g., if predicate is (dimA == null && dimB == 'X)</technical_language>

Target:
public ImmutableBitmap getBitmapIndex(final BitmapIndexSelector selector) { Iterable<String>[] dimValuesList = new Iterable[dimensions.length]; for (int idx = 0; idx < dimensions.length; idx++) { Indexed<String> dimValues = selector.getDimensionValues(dimensions[idx]); if (dimValues == null || dimValues.size() == 0) { dimValuesList[idx] = EMPTY_STR_DIM_VAL; } else { dimValuesList[idx] = dimValues; } } ImmutableBitmap bitmap = selector.getBitmapFactory().makeEmptyImmutableBitmap(); final Context cx = Context.enter(); try { for (String[] param : IterableUtils.cartesian(String.class, dimValuesList)) { if (predicate.applyInContext(cx, param)) { ImmutableBitmap overlap = null; for (int idx = 0; idx < dimensions.length; idx++) { ImmutableBitmap dimBitMap = selector.getBitmapIndex(dimensions[idx], param[idx]); overlap = overlap == null ? dimBitMap : overlap.intersection(dimBitMap); } bitmap = bitmap.union(overlap); } } return bitmap; } finally { Context.exit(); } }
Source:
<code>public void makeFeedInstanceAvailable(String feedName, String clusterName, Date nominalTime) { LOG.info("Removing feed's instance in cluster from pendingSLA", feedName, clusterName, nominalTime); <START> if (CollectionUtils.isEmpty(MONITORING_JDBC_STATE_STORE.getNominalInstances(feedName, clusterName))){ <END> MONITORING_JDBC_STATE_STORE.deletePendingNominalInstances(feedName, clusterName, nominalTime); } }</code><technical_language>for readability efficiency is store result in a local variable in test for if condition below</technical_language>

Target:
public void makeFeedInstanceAvailable(String feedName, String clusterName, Date nominalTime) throws FalconException { LOG.info("Removing feed's instance in cluster from pendingSLA", feedName, clusterName, nominalTime); List<Date> instances = (MONITORING_JDBC_STATE_STORE.getNominalInstances(feedName, clusterName)); if (CollectionUtils.isEmpty(instances)){ MONITORING_JDBC_STATE_STORE.deletePendingInstance(feedName, clusterName, nominalTime); } }
Source:
<code>public void connectionEvent(Connection connection, Events events) { switch (events) { case DISCONNECTED: isNatsRunning = false; LOGGER.error("Nats connection disconnected"); if (!context.getConfig().ignoreProducerError) { this.context.terminate(new RuntimeException("Nats Disconnected")); <START> return; <END> } break; case CLOSED: isNatsRunning = false; LOGGER.error("Nats connection closed"); break; case RECONNECTED: isNatsRunning = true; LOGGER.info("Nats connection reconnected"); break; } }</code><technical_language>this crashes maxwell? wait for a reconnect</technical_language>

Target:
public void connectionEvent(Connection connection, Events events) { switch (events) { case DISCONNECTED: isNatsRunning = false; LOGGER.error("Nats connection disconnected"); break; case CLOSED: isNatsRunning = false; LOGGER.error("Nats connection closed"); this.context.terminate(new RuntimeException("Nats Disconnected")); break; case RECONNECTED: isNatsRunning = true; LOGGER.info("Nats connection reconnected"); break; } }
Source:
<code>public void downloadRegister_shouldReturnAZipfile() throws IOException { Response response = getRequest("/download-register"); assertThat(response.getHeaderString("Content-Type"), equalTo(MediaType.APPLICATION_OCTET_STREAM)); assertThat(response.getHeaderString("Content-Disposition"), startsWith("attachment; filename=")); assertThat(response.getHeaderString("Content-Disposition"), endsWith(".zip")); InputStream is = response.readEntity(InputStream.class); <START> assertTrue(getEntries(is).contains("register.json")); <END> }</code><technical_language>stick hamcrest please? hamcrest time results in consistent test failure reporting. Also, a failure get more "wanted true, false" -- report list contained looked for. json assertThat(getEntries(is), hasItem("register.json"))</technical_language>

Target:
public void downloadRegister_shouldReturnAZipfile() throws IOException { Response response = getRequest("/download-register"); assertThat(response.getHeaderString("Content-Type"), equalTo(MediaType.APPLICATION_OCTET_STREAM)); assertThat(response.getHeaderString("Content-Disposition"), startsWith("attachment; filename=")); assertThat(response.getHeaderString("Content-Disposition"), endsWith(".zip")); InputStream is = response.readEntity(InputStream.class); assertThat(getEntries(is), hasItem("register.json")); }
Source:
<code>public static BufferedImage mergeLegends(Rule[] rules, GetLegendGraphicRequest req, MergeOptions mergeOptions) { List<RenderedImage> imageStack= mergeOptions.getImageStack(); final int imgCount = imageStack.size(); List<BufferedImage> nodes = new ArrayList<BufferedImage>(); if (imgCount == 1 && (!mergeOptions.isForceLabelsOn() || rules == null)) { return (BufferedImage) imageStack.get(0); } else { for (int i = 0; i < imgCount; i++) { BufferedImage img = (BufferedImage) imageStack.get(i); if (rules != null && rules[i] != null) { BufferedImage label = renderLabel(img, rules[i], req, mergeOptions); if (label != null) { img = joinBufferedImageHorizzontally(img, label, mergeOptions.getLabelFont(), mergeOptions.isAntialias(), mergeOptions.isTransparent(), mergeOptions.getBackgroundColor(), mergeOptions.getLabelMargin()); } nodes.add(img); } else { nodes.add(img); } } } LegendLayout layout = mergeOptions.getLayout(); BufferedImage finalLegend = null; if (layout == LegendLayout.HORIZONTAL) { Row[] rows = createRows(nodes, mergeOptions.getRowWidth(), mergeOptions.getRows()); finalLegend = buildFinalHLegend(rows, mergeOptions); } if (layout == LegendLayout.VERTICAL) { <START> Column[] columns = createNRColumns(nodes, mergeOptions.getColumnHeight(), mergeOptions.getColumns(), req); <END> finalLegend = buildFinalVLegend(columns, mergeOptions); } return finalLegend; }</code><technical_language>match pre-existing naming convention, this called createColumns, other method called createRasterColumns (since in mergeLegends method, other is called mergeRasterLegends)</technical_language>

Target:
public static BufferedImage mergeLegends(Rule[] rules, GetLegendGraphicRequest req, MergeOptions mergeOptions) { List<RenderedImage> imageStack= mergeOptions.getImageStack(); final int imgCount = imageStack.size(); List<BufferedImage> nodes = new ArrayList<BufferedImage>(); if (imgCount == 1 && (!mergeOptions.isForceLabelsOn() || rules == null)) { return (BufferedImage) imageStack.get(0); } else { for (int i = 0; i < imgCount; i++) { BufferedImage img = (BufferedImage) imageStack.get(i); if (rules != null && rules[i] != null) { BufferedImage label = renderLabel(img, rules[i], req, mergeOptions); if (label != null) { img = joinBufferedImageHorizzontally(img, label, mergeOptions.getLabelFont(), mergeOptions.isAntialias(), mergeOptions.isTransparent(), mergeOptions.getBackgroundColor(), mergeOptions.getLabelMargin()); } nodes.add(img); } else { nodes.add(img); } } } LegendLayout layout = mergeOptions.getLayout(); BufferedImage finalLegend = null; if (layout == LegendLayout.HORIZONTAL) { Row[] rows = createRows(nodes, mergeOptions.getRowWidth(), mergeOptions.getRows()); finalLegend = buildFinalHLegend(rows, mergeOptions); } if (layout == LegendLayout.VERTICAL) { Column[] columns = createColumns(nodes, mergeOptions.getColumnHeight(), mergeOptions.getColumns(), req, true); finalLegend = buildFinalVLegend(columns, mergeOptions); } return finalLegend; }
Source:
<code><START> public String sanitize(String title) { <END> return removeCommonPrefixes(titleTransform.apply(title) .replaceAll(" & ", " and ") .replaceAll("[^\\d\\w\\s]", "").toLowerCase()); }</code><technical_language>this need public</technical_language>

Target:
private String sanitize(String title) { return removeCommonPrefixes(titleTransform.apply(title) .replaceAll(" & ", " and ") .replaceAll("[^\\d\\w\\s]", "").toLowerCase()); }
Source:
<code>private boolean checkOvsNetwork(final String networkName) { s_logger.debug("Checking if network " + networkName + " exists as openvswitch bridge"); if (networkName == null) { return true; } <START> final Script command = new Script("/bin/sh", _timeout.getMillis()); <END> command.add("-c"); command.add("ovs-vsctl br-exists " + networkName); return "0".equals(command.execute(null)); }</code><technical_language>Please consider adding overridden version of Script(String, int) constructor accepts Duration encapsulate this type conversion</technical_language>

Target:
private boolean checkOvsNetwork(final String networkName) { s_logger.debug("Checking if network " + networkName + " exists as openvswitch bridge"); if (networkName == null) { return true; } final Script command = new Script("/bin/sh", _timeout); command.add("-c"); command.add("ovs-vsctl br-exists " + networkName); return "0".equals(command.execute(null)); }
Source:
<code>public void listenTo(final TextBoxBase tb) { strings.put(tb, tb.getText()); tb.addKeyPressHandler(this); tb.addMouseUpHandler(this); tb.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { strings.put(tb, tb.getText()); } }); tb.sinkEvents(Event.ONPASTE); Element el = tb.getElement(); tbis.put(el, new TBBInfo(tb, Event.getEventListener(el))); <START> Event.setEventListener(el, this); <END> }</code><technical_language>This kind of dangerous. In GWT careful creating a cycle Element Widget contains DOM is reference counted leak memory Widget falls page. GWT handles this making widget point event listener, cleaning reference element is removed DOM, setting element is added DOM. if widget attached DOM this runs, creating a cycle creating a memory leak. widget is attached, "correct" event listener involved in chain. Fortunately I of Gerrit's text boxes NpTextArea NpTextBox. add ONPASTE support classes NpTextArea NpTextBox overrides listenTo() instead of TextBoxBase</technical_language>

Target:
public void listenTo(final TextBoxBase tb) { strings.put(tb, tb.getText()); tb.addKeyPressHandler(this); tb.addMouseUpHandler(this); tb.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { strings.put(tb, tb.getText()); } }); tb.addKeyDownHandler(this); }
Source:
<code><START> public final MultipartPart call() { <END> return uploadMultipartPart(mpu, partNumber, payload); }</code><technical_language>Remove final here, add class fields</technical_language>

Target:
public MultipartPart call() { return uploadMultipartPart(mpu, partNumber, payload); }
Source:
<code>public void exerciseAvailable() { Exercise exercise = adaptiveParser.parseFromJson("{ available: true, zip_url: someUrl }"); <START> assertEquals(URI.create("http://someUrl"), exercise.getZipUrl()); <END> }</code><technical_language>Nitpick: I prefer [www.]example.com for situations this</technical_language>

Target:
public void exerciseAvailable() { Exercise exercise = adaptiveParser.parseFromJson("{ available: true, zip_url: example.com }"); assertEquals(URI.create("<LINK_0>"), exercise.getZipUrl()); }
Source:
<code>protected void doDestroy() { session.ifPresent(s -> { final CanvasHandler canvasHandler = s.getCanvasHandler(); if (canvasHandler instanceof AbstractCanvasHandler) { final AbstractCanvasHandler abstractCanvasHandler = (AbstractCanvasHandler) canvasHandler; abstractCanvasHandler.removeRegistrationListener(redrawElementListener); abstractCanvasHandler.removeDomainObjectListener(redrawDomainObjectListener); } }); <START> session = Optional.empty(); <END> gridLayer = null; }</code><technical_language>I avoid some duplication refactoring methods this: java @Override protected void doInit() { withCanvasHandler(abstractCanvasHandler -> { abstractCanvasHandler.addRegistrationListener(redrawElementListener); abstractCanvasHandler.addDomainObjectListener(redrawDomainObjectListener); }); } @Override protected void doDestroy() { withCanvasHandler(abstractCanvasHandler -> { abstractCanvasHandler.removeRegistrationListener(redrawElementListener); abstractCanvasHandler.removeDomainObjectListener(redrawDomainObjectListener); }); session = Optional.empty(); gridLayer = null; } private void withCanvasHandler(final Consumer<AbstractCanvasHandler> consumer) { session.ifPresent(s -> { final CanvasHandler canvasHandler = s.getCanvasHandler(); if (canvasHandler instanceof AbstractCanvasHandler) { final AbstractCanvasHandler abstractCanvasHandler = (AbstractCanvasHandler) canvasHandler; consumer.accept(abstractCanvasHandler); } }); } ..but feel free is. a local logic ;-)</technical_language>

Target:
protected void doDestroy() { withCanvasHandler(abstractCanvasHandler -> { abstractCanvasHandler.removeRegistrationListener(redrawElementListener); abstractCanvasHandler.removeDomainObjectListener(redrawDomainObjectListener); }); session = Optional.empty(); gridLayer = null; }
Source:
<code>public static int sample_value(double lambda) { if (lambda < 15) return sampleSmall(lambda); double alpha = 7.0 / 8.0; int m = (int) Math.floor(alpha * lambda); double x = Gamma.sampleVal(m, 1); int r; if (x < lambda) { r = m + Poisson.sample_value(lambda - x); } else { <START> r = Binomial.sampleVal(m - 1, lambda / x); <END> } return r; }</code><technical_language>Binomial.sample_value()..</technical_language>

Target:
public static int sample_value(double lambda) { if (lambda < 15) return sampleSmall(lambda); double alpha = 7.0 / 8.0; int m = (int) Math.floor(alpha * lambda); double x = Gamma.sampleVal(m, 1); int r; if (x < lambda) { r = m + Poisson.sample_value(lambda - x); } else { r = Binomial.sample_value(m - 1, lambda / x); } return r; }
Source:
<code>public void copyObject(String bucketName, String objectName, Map<String,String> headerMap, ServerSideEncryption sse, String srcBucketName, String srcObjectName, ServerSideEncryption srcSse, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException, InvalidResponseException { if ((bucketName == null) || (bucketName.isEmpty())) { throw new InvalidArgumentException("bucket name cannot be empty"); } checkObjectName(objectName); checkWriteRequestSse(sse); if ((srcBucketName == null) || (srcBucketName.isEmpty())) { throw new InvalidArgumentException("Source bucket name cannot be empty"); } if (srcObjectName == null) { srcObjectName = objectName; } checkReadRequestSse(srcSse); if (headerMap == null) { headerMap = new HashMap<>(); } headerMap.put("x-amz-copy-source", S3Escaper.encodePath(srcBucketName + "/" + srcObjectName)); if (sse != null) { headerMap.putAll(sse.headers()); } if (srcSse != null) { headerMap.putAll(srcSse.copySourceHeaders()); } if (copyConditions != null) { headerMap.putAll(copyConditions.getConditions()); } <START> HttpResponse response = executePut(bucketName, objectName, headerMap, null, "", 0, false); <END> CopyObjectResult result = new CopyObjectResult(); try (ResponseBody body = response.body()) { result.parseXml(body.charStream()); } }</code><technical_language>overloaded executePut()/executePost() accepting md5Required argument avoid unnecessary diffs</technical_language>

Target:
public void copyObject(String bucketName, String objectName, Map<String,String> headerMap, ServerSideEncryption sse, String srcBucketName, String srcObjectName, ServerSideEncryption srcSse, CopyConditions copyConditions) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException, InvalidResponseException { if ((bucketName == null) || (bucketName.isEmpty())) { throw new InvalidArgumentException("bucket name cannot be empty"); } checkObjectName(objectName); checkWriteRequestSse(sse); if ((srcBucketName == null) || (srcBucketName.isEmpty())) { throw new InvalidArgumentException("Source bucket name cannot be empty"); } if (srcObjectName == null) { srcObjectName = objectName; } checkReadRequestSse(srcSse); if (headerMap == null) { headerMap = new HashMap<>(); } headerMap.put("x-amz-copy-source", S3Escaper.encodePath(srcBucketName + "/" + srcObjectName)); if (sse != null) { headerMap.putAll(sse.headers()); } if (srcSse != null) { headerMap.putAll(srcSse.copySourceHeaders()); } if (copyConditions != null) { headerMap.putAll(copyConditions.getConditions()); } HttpResponse response = executePut(bucketName, objectName, headerMap, null, "", 0); CopyObjectResult result = new CopyObjectResult(); try (ResponseBody body = response.body()) { result.parseXml(body.charStream()); } }
Source:
<code>private HibernateOrmSearchManagerBuilder createSearchManagerBuilder(EntityManager entityManager) { SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class ); SessionFactoryImplementor givenSessionFactory = sessionImplementor.getSessionFactory(); <START> if ( !givenSessionFactory.getUuid().equals( sessionFactoryImplementor.getUuid() ) ) { <END> throw log.usingDifferentSessionFactories( sessionFactoryImplementor, givenSessionFactory ); } return new HibernateOrmSearchManagerImpl.Builder( getDelegate(), sessionImplementor ); }</code><technical_language>I .equals SessionFactoryImplementor instead. If instances of SessionFactoryImplementor UUID, is terribly wrong, this code fail..</technical_language>

Target:
private HibernateOrmSearchManagerBuilder createSearchManagerBuilder(EntityManager entityManager) { SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class ); SessionFactoryImplementor givenSessionFactory = sessionImplementor.getSessionFactory(); if ( !givenSessionFactory.equals( sessionFactoryImplementor ) ) { throw log.usingDifferentSessionFactories( sessionFactoryImplementor, givenSessionFactory ); } return new HibernateOrmSearchManagerImpl.Builder( getDelegate(), sessionImplementor ); }
Source:
<code>public void apply() { if (!ItemMorb.validMobs.contains(entityId)) { CraftTweakerAPI.logError("Not a valid morb entity: " + entityId); return; } <START> if (energy==null) { this.energy=CentrifugeManager.DEFAULT_ENERGY*2; } <END> if (fluid==null) { this.fluid=new FluidStack(TFFluids.fluidExperience, xp * CoreProps.MB_PER_XP); ArrayList<ItemStack> outputStandard = new ArrayList<ItemStack>(Arrays.asList(outputs)); ArrayList<ItemStack> outputReusable = new ArrayList<ItemStack>(Arrays.asList(outputs)); ArrayList<Integer> chanceStandard = new ArrayList<Integer>(Arrays.asList(chances)); ArrayList<Integer> chanceReusable = new ArrayList<Integer>(Arrays.asList(chances)); outputStandard.add(ItemHelper.cloneStack(ItemMorb.morbStandard)); outputReusable.add(ItemHelper.cloneStack(ItemMorb.morbReusable)); chanceStandard.add(ItemMorb.REUSE_CHANCE); chanceReusable.add(100); CentrifugeManager.addRecipeMob(energy, ItemMorb.setTag(ItemHelper.cloneStack(ItemMorb.morbStandard), this.entityId, false), outputStandard, chanceStandard, fluid); CentrifugeManager.addRecipeMob(energy, ItemMorb.setTag(ItemHelper.cloneStack(ItemMorb.morbReusable), this.entityId, false), outputReusable, chanceReusable, fluid); } @Override protected String getRecipeInfo() { return entityId; } }</code><technical_language>false time create assign this energy field is construction. place construct objects is in addRecipeMob. addRecipeMob accepts primitives (ints) for parameters, null</technical_language>

Target:
public void apply() { if (!ItemMorb.validMobs.contains(entityId)) { CraftTweakerAPI.logError("Not a valid morb entity: " + entityId); return; } if (fluid==null) { this.fluid=new FluidStack(TFFluids.fluidExperience, xp * CoreProps.MB_PER_XP); } ArrayList<ItemStack> outputStandard = new ArrayList<ItemStack>(Arrays.asList(outputs)); ArrayList<ItemStack> outputReusable = new ArrayList<ItemStack>(Arrays.asList(outputs)); ArrayList<Integer> chanceStandard = new ArrayList<Integer>(Arrays.asList(chances)); ArrayList<Integer> chanceReusable = new ArrayList<Integer>(Arrays.asList(chances)); outputStandard.add(ItemHelper.cloneStack(ItemMorb.morbStandard)); outputReusable.add(ItemHelper.cloneStack(ItemMorb.morbReusable)); chanceStandard.add(ItemMorb.REUSE_CHANCE); chanceReusable.add(100); CentrifugeManager.addRecipeMob(energy, ItemMorb.setTag(ItemHelper.cloneStack(ItemMorb.morbStandard), this.entityId, false), outputStandard, chanceStandard, fluid); CentrifugeManager.addRecipeMob(energy, ItemMorb.setTag(ItemHelper.cloneStack(ItemMorb.morbReusable), this.entityId, false), outputReusable, chanceReusable, fluid); }
Source:
<code>public CopyRatioState.OutlierIndicators sample(final RandomGenerator rng, final CopyRatioState state, final CopyRatioData dataCollection) { final double outlierUnnormalizedLogProbability = Math.log(state.outlierProbability()) + outlierUniformLogLikelihood; final double notOutlierUnnormalizedLogProbabilityPrefactor = Math.log(1. - state.outlierProbability()) - 0.5 * Math.log(2 * Math.PI * state.variance()); final List<Boolean> indicators = new ArrayList<>(); for (int segment = 0; segment < dataCollection.getNumSegments(); segment++) { final List<CopyRatioData.IndexedCoverage> indexedCoveragesInSegment = dataCollection.getIndexedCoveragesInSegment(segment); for (final CopyRatioData.IndexedCoverage c : indexedCoveragesInSegment) { final double notOutlierUnnormalizedLogProbability = notOutlierUnnormalizedLogProbabilityPrefactor - normalTerm(c.getCoverage(), state.segmentMean(segment), state.variance()); final double conditionalProbability = MathUtils.normalizeFromLog10(new double[]{ <START> outlierUnnormalizedLogProbability / ln10, <END> notOutlierUnnormalizedLogProbability / ln10})[0]; indicators.add(rng.nextDouble() < conditionalProbability); } } return new CopyRatioState.OutlierIndicators(indicators); }</code><technical_language>MathUtils::logToLog10</technical_language>

Target:
public CopyRatioState.OutlierIndicators sample(final RandomGenerator rng, final CopyRatioState state, final CopyRatioData dataCollection) { final double outlierUnnormalizedLogProbability = Math.log(state.outlierProbability()) + outlierUniformLogLikelihood; final double notOutlierUnnormalizedLogProbabilityPrefactor = Math.log(1. - state.outlierProbability()) - 0.5 * Math.log(2 * Math.PI * state.variance()); final List<Boolean> indicators = new ArrayList<>(); for (int segment = 0; segment < dataCollection.getNumSegments(); segment++) { final List<CopyRatioData.IndexedCoverage> indexedCoveragesInSegment = dataCollection.getIndexedCoveragesInSegment(segment); for (final CopyRatioData.IndexedCoverage c : indexedCoveragesInSegment) { final double notOutlierUnnormalizedLogProbability = notOutlierUnnormalizedLogProbabilityPrefactor - normalTerm(c.getCoverage(), state.segmentMean(segment), state.variance()); final double conditionalProbability = MathUtils.normalizeFromLog10(new double[]{ MathUtils.logToLog10(outlierUnnormalizedLogProbability), MathUtils.logToLog10(notOutlierUnnormalizedLogProbability)})[0]; indicators.add(rng.nextDouble() < conditionalProbability); } } return new CopyRatioState.OutlierIndicators(indicators); }
Source:
<code>protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; if (vdsGroup.supportsTrustedService()) { initSucceeded = initTrustedService(); } if (initSucceeded && vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); if (getSucceeded()) { AuditLogableBase logable = new AuditLogableBase(getVds().getId()); <START> logable.addCustomValue("VdsStatus", getVds().getStatus().toString()); <END> AuditLogDirector.log(logable, AuditLogType.VDS_DETECTED); } }</code><technical_language>this appears in audit log messages file , I prefer more accurate term : HostStatus</technical_language>

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; getVds().setPowerManagementControlledByPolicy(true); DbFacade.getInstance().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( getVds().getId(), getVds().isPowerManagementControlledByPolicy()); if (vdsGroup.supportsTrustedService()) { initSucceeded = initTrustedService(); } if (initSucceeded && vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); if (getSucceeded()) { AuditLogableBase logable = new AuditLogableBase(getVds().getId()); logable.addCustomValue("HostStatus", getVds().getStatus().toString()); AuditLogDirector.log(logable, AuditLogType.VDS_DETECTED); } }
Source:
<code>private void testGetSectionsNameForCourse() throws Exception { ______TS("Typical case: course with sections"); CourseAttributes typicalCourse1 = dataBundle.courses.get("typicalCourse1"); assertEquals(2, coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).size()); assertEquals("Section 1", coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).get(0)); assertEquals("Section 2", coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).get(1)); ______TS("Typical case: course without sections"); CourseAttributes typicalCourse2 = dataBundle.courses.get("typicalCourse2"); List<String> emptySectionNameList = new ArrayList<>(); <START> assertEquals(emptySectionNameList, coursesLogic.getSectionsNameForCourse(typicalCourse2.getId())); <END> ______TS("Failure case: course does not exists"); EntityDoesNotExistException ednee = assertThrows(EntityDoesNotExistException.class, () -> coursesLogic.getSectionsNameForCourse("non-existent-course")); AssertHelper.assertContains("does not exist", ednee.getMessage()); ______TS("Failure case: null parameter"); AssertionError ae = assertThrows(AssertionError.class, () -> coursesLogic.getSectionsNameForCourse(null)); assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage()); }</code><technical_language>assertTrue(list.isEmpty()) :)</technical_language>

Target:
private void testGetSectionsNameForCourse() throws Exception { ______TS("Typical case: course with sections"); CourseAttributes typicalCourse1 = dataBundle.courses.get("typicalCourse1"); assertEquals(2, coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).size()); assertEquals("Section 1", coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).get(0)); assertEquals("Section 2", coursesLogic.getSectionsNameForCourse(typicalCourse1.getId()).get(1)); ______TS("Typical case: course without sections"); CourseAttributes typicalCourse2 = dataBundle.courses.get("typicalCourse2"); assertTrue(coursesLogic.getSectionsNameForCourse(typicalCourse2.getId()).isEmpty()); ______TS("Failure case: course does not exists"); EntityDoesNotExistException ednee = assertThrows(EntityDoesNotExistException.class, () -> coursesLogic.getSectionsNameForCourse("non-existent-course")); AssertHelper.assertContains("does not exist", ednee.getMessage()); ______TS("Failure case: null parameter"); AssertionError ae = assertThrows(AssertionError.class, () -> coursesLogic.getSectionsNameForCourse(null)); assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage()); }
Source:
<code>void error(Throwable e) { <START> RxJavaPlugins.getInstance().getErrorHandler().handleError(e); <END> exceptions.add(e); complete(); }</code><technical_language>This eventually emit CompositeException. Is this consciously wanting handle error individually instead of composite</technical_language>

Target:
void error(Throwable e) { exceptions.add(e); complete(); }
Source:
<code><START> void setPattern(Session session, Object pattern) { <END> isNull = pattern == null; if (isNull) { return; } if (isIgnoreCase) { pattern = (String) ((CharacterType) dataType).upper(null, pattern); } iLen = 0; int l = getLength(session, pattern, ""); cLike = new char[l]; for (int i = 0; i < l; i++) { char c = getChar(pattern, i); cLike[iLen++] = c; } }</code><technical_language>I challenge @MarcxJin explain this is (and other functions; this one). If cannot, this here</technical_language>

Target:
void setPattern(Session session, Object pattern) { isNull = pattern == null; if (isNull) { return; } iLen = 0; int l = getLength(session, pattern, ""); cStartsWith = new char[l]; for (int i = 0; i < l; i++) { char c = getChar(pattern, i); cStartsWith[iLen++] = c; } }
Source:
<code>public AclClassIdUtils() { <START> this(null); <END> }</code><technical_language>This means conversion service null. means checks for hasConversionService longer necessary. mind creating a ticket improve (remove hasConversionService checks) remember for future</technical_language>

Target:
public AclClassIdUtils() { GenericConversionService genericConversionService = new GenericConversionService(); genericConversionService.addConverter(String.class, Long.class, new StringToLongConverter()); genericConversionService.addConverter(String.class, UUID.class, new StringToUUIDConverter()); this.conversionService = genericConversionService; }
Source:
<code>public void multiDimensionalArraysDifferentLengthMessage() { try { assertArrayEquals("message", new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {false}}); <START> fail(); <END> } catch (AssertionError exception) { assertEquals("message: arrays first differed at element [1]; array lengths differed, expected.length=2 actual.length=1", exception.getMessage()); } }</code><technical_language>Calling fail() throws AssertionError, get a confusing error message if get here. testing code throw AssertionError this pattern: try { callThatShouldThrowAssertionError(); } catch (AssertionError expected) { // optional: assertions expected return; } fail("Expected AssertionError thrown");</technical_language>

Target:
public void multiDimensionalArraysDifferentLengthMessage() { try { assertArrayEquals("message", new Object[][]{{true, true}, {false, false}}, new Object[][]{{true, true}, {false}}); } catch (AssertionError exception) { assertEquals("message: arrays first differed at element [1]; array lengths differed, expected.length=2 actual.length=1", exception.getMessage()); return; } fail("Expected AssertionError to be thrown"); }