auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean ensure(int readSize) throws IOException { requireBuffer(); if(reachedEOF) { return false; } if(position + readSize < buffer.limit()) return true; else { int remaining = buffer.limit() - position; int bufferTotal = remaining; ArrayList<MessageBuffer> bufferList = new ArrayList<MessageBuffer>(); while(bufferTotal < readSize) { MessageBuffer next = in.next(); if(next == null) throw new EOFException(); bufferTotal += next.limit(); bufferList.add(next); } <START> MessageBuffer newBuffer = MessageBuffer.newBuffer(bufferTotal); <END> int p = 0; buffer.copyTo(position, newBuffer, p, remaining); p += remaining; for(MessageBuffer m : bufferList) { m.copyTo(0, newBuffer, p, m.limit()); p += m.limit(); } buffer = newBuffer; position = 0; return true; } }</code><technical_language>If ensure(int) unpackString, maximum necessary length of this buffer is 8 bytes. pre-allocate this buffer extraBuffer field. suggestion is pre-allocate 8-byte extraBuffer string decoding buffer separatelly. String decoding buffer StringBuilder (full string builder) + CharBuffer (temp buffer) + CharsetDecoder (fills CharBuffer append StringBuffer)</technical_language>

Target:
private boolean ensure(int readSize) throws IOException { requireBuffer(); if(reachedEOF) { return false; } if(position + readSize < buffer.limit()) return true; else { int remaining = buffer.limit() - position; int bufferTotal = remaining; ArrayList<MessageBuffer> bufferList = new ArrayList<MessageBuffer>(); while(bufferTotal < readSize) { MessageBuffer next = in.next(); if(next == null) { reachedEOF = true; throw new EOFException(); } bufferTotal += next.limit(); bufferList.add(next); } MessageBuffer newBuffer = MessageBuffer.newBuffer(bufferTotal); int p = 0; buffer.copyTo(position, newBuffer, p, remaining); p += remaining; for(MessageBuffer m : bufferList) { m.copyTo(0, newBuffer, p, m.limit()); p += m.limit(); } buffer = newBuffer; position = 0; return true; } }
Source:
<code><START> private void refillCache() { <END> logger.info("Starting filling Owner Id to Topic Name cache"); long start = System.currentTimeMillis(); Multimap<OwnerId, TopicName> cache = ArrayListMultimap.create(); groupService.listGroupNames().stream() .flatMap(groupName -> topicRepository.listTopics(groupName).stream()) .forEach(topic -> cache.put(topic.getOwner(), topic.getName())); this.cache = Multimaps.synchronizedMultimap(cache); long end = System.currentTimeMillis(); logger.info("Cache filled. Took {}ms", end - start); }</code><technical_language>try-catch a good idea. refresh cache based entities zookeeper throw unexpected exception executor stop job</technical_language>

Target:
private void refillCache() { try { logger.info("Starting filling Owner Id to Topic Name cache"); long start = System.currentTimeMillis(); Multimap<OwnerId, TopicName> cache = ArrayListMultimap.create(); groupService.listGroupNames().stream() .flatMap(groupName -> topicRepository.listTopics(groupName).stream()) .forEach(topic -> cache.put(topic.getOwner(), topic.getName())); this.cache = Multimaps.synchronizedMultimap(cache); long end = System.currentTimeMillis(); logger.info("Cache filled. Took {}ms", end - start); } catch (Exception e) { logger.error("Error while filling cache", e); } }
Source:
<code><START> public FireHydrant getCurrHydrant() <END> { synchronized (hydrantLock) { return currHydrant; } }</code><technical_language>@VisibleForTesting, package-private</technical_language>

Target:
FireHydrant getCurrHydrant() { synchronized (hydrantLock) { return currHydrant; } }
Source:
<code>public void disableAutoSetHostname() { <START> canAutoSetHostname = disableOnHostnameChanged ? canAutoSetHostname : false; <END> }</code><technical_language>is correct unusual... Please change to: if (!disableOnHostChanged) { canAutoSetHostname = false; }</technical_language>

Target:
public void disableAutoSetHostname() { if (!disableOnHostnameChanged) { canAutoSetHostname = false; } }
Source:
<code>public NinjaFileItemStreamConverter(NinjaProperties properties) { inMemory = properties.getBooleanWithDefault( NinjaConstant.FILE_UPLOADS_IN_MEMORY, false); String dir = properties.getWithDefault( NinjaConstant.FILE_UPLOADS_DIRECTORY, System.getProperty("java.io.tmpdir")); uploadDirectory = new File(dir); if (uploadDirectory.exists()) { if (!uploadDirectory.isDirectory()) { throw new ProvisionException("Specified target for upload files in not a directory"); } } else { <START> uploadDirectory.mkdirs(); <END> } }</code><technical_language>directory created if I set inMemory true..</technical_language>

Target:
NinjaFileItemStreamConverter(NinjaProperties properties) { Boolean b = properties.getBoolean(NinjaConstant.FILE_UPLOADS_IN_MEMORY); inMemory = b != null ? b.booleanValue() : false; }
Source:
<code><START> public static EmbeddedDatastreamCluster initializeTestDatastreamServer(Properties override) throws Exception { <END> DatastreamServer.INSTANCE.shutdown(); Map<String, Properties> connectorProperties = new HashMap<>(); connectorProperties.put(DUMMY_CONNECTOR, getDummyConnectorProperties(false)); EmbeddedDatastreamCluster datastreamKafkaCluster = EmbeddedDatastreamCluster.newTestDatastreamKafkaCluster(connectorProperties, -1); return datastreamKafkaCluster; }</code><technical_language>Is override used</technical_language>

Target:
public static EmbeddedDatastreamCluster initializeTestDatastreamServer(Properties override) throws Exception { DatastreamServer.INSTANCE.shutdown(); Map<String, Properties> connectorProperties = new HashMap<>(); connectorProperties.put(DUMMY_CONNECTOR, getDummyConnectorProperties(false)); EmbeddedDatastreamCluster datastreamKafkaCluster = EmbeddedDatastreamCluster.newTestDatastreamKafkaCluster(connectorProperties, override, -1); return datastreamKafkaCluster; }
Source:
<code>private void checkSizeEstimatesTableExist() { try { session.getTable(new SchemaTableName(SYSTEM, SIZE_ESTIMATES)); } <START> catch (NotFoundException e) { <END> throw new PrestoException(NOT_SUPPORTED, "Cassandra versions prior to 2.1.5 are not supported"); } }</code><technical_language>TableNotFoundException</technical_language>

Target:
private void checkSizeEstimatesTableExist() { try { session.getTable(new SchemaTableName(SYSTEM, SIZE_ESTIMATES)); } catch (TableNotFoundException e) { throw new PrestoException(NOT_SUPPORTED, "Cassandra versions prior to 2.1.5 are not supported"); } }
Source:
<code>private void downgradeToVersion5(SQLiteDatabase db) { Cursor cursor = db.query(INSTANCES_TABLE_NAME, null, null, null, null, null, null); if (cursor != null && cursor.moveToFirst()) { List<Instance> instances = new InstancesDao().getInstancesFromCursor(cursor); for (Instance instance : instances) { if (instance.getInstanceFilePath().startsWith("../")) { String where = INSTANCE_FILE_PATH + "=?"; <START> String[] whereArgs = {instance.getInstanceFilePath()}; <END> ContentValues values = new ContentValues(); values.put(INSTANCE_FILE_PATH, Collect.ODK_ROOT + instance.getInstanceFilePath().substring(2)); db.update(INSTANCES_TABLE_NAME, values, where, whereArgs); } } } if (cursor != null) { cursor.close(); } }</code><technical_language>instance ID index it? I index for it</technical_language>

Target:
private void downgradeToVersion5(SQLiteDatabase db) { Cursor cursor = db.query(INSTANCES_TABLE_NAME, null, null, null, null, null, null); if (cursor != null && cursor.moveToFirst()) { List<Instance> instances = new InstancesDao().getInstancesFromCursor(cursor); for (Instance instance : instances) { File instanceFile = new File(instance.getInstanceFilePath()); if (!instanceFile.isAbsolute()) { String where = _ID + "=?"; String[] whereArgs = {String.valueOf(instance.getDatabaseId())}; ContentValues values = new ContentValues(); values.put(INSTANCE_FILE_PATH, Collect.ODK_ROOT + FileUtils.getCanonicalPath(instanceFile)); db.update(INSTANCES_TABLE_NAME, values, where, whereArgs); } } } if (cursor != null) { cursor.close(); } }
Source:
<code>public void truncFailTest() throws Exception { final boolean[] exitProcCalled = {false}; ServiceUtils.setSystemExitProcedure(new Consumer<Integer>() { @Override public void accept(Integer exitCode) { exitProcCalled[0] = true; <START> assertThat(exitCode, equalTo(ExitCode.QUORUM_PACKET_ERROR.getValue())); <END> } }); File tmpFile = File.createTempFile("test", ".dir", testData); tmpFile.delete(); try { FileTxnSnapLog txnSnapLog = new FileTxnSnapLog(tmpFile, tmpFile); SimpleLearner sl = new SimpleLearner(txnSnapLog); long startZxid = sl.zk.getLastProcessedZxid(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputArchive oa = BinaryOutputArchive.getArchive(baos); sl.leaderOs = BinaryOutputArchive.getArchive(new ByteArrayOutputStream()); sl.bufferedOutput = new BufferedOutputStream(System.out); sl.sock = new Socket(); QuorumPacket qp = new QuorumPacket(Leader.TRUNC, 0, null, null); oa.writeRecord(qp, null); sl.leaderIs = BinaryInputArchive.getArchive(new ByteArrayInputStream(baos.toByteArray())); try { sl.syncWithLeader(3); } catch (EOFException e) { } sl.zk.shutdown(); assertThat(startZxid, equalTo(0L)); assertThat(exitProcCalled[0], is(true)); } finally { TestUtils.deleteFileRecursively(tmpFile); } }</code><technical_language>This assertion happen in main junit thread, if asserts false, behaviour unpredictable (the test ignore it). Instead of this, replace exitProcCalled a CompletableFuture<Integer> end of test method do assertThat(exitCode.get(10, TimeUnit.SECONDS), equalTo(ExitCode.QUORUM_PACKET_ERROR.getValue()));</technical_language>

Target:
public void truncFailTest() throws Exception { final boolean[] exitProcCalled = {false}; ServiceUtils.setSystemExitProcedure(new Consumer<Integer>() { @Override public void accept(Integer exitCode) { exitProcCalled[0] = true; assertThat("System.exit() was called with invalid exit code", exitCode, equalTo(ExitCode.QUORUM_PACKET_ERROR.getValue())); } }); File tmpFile = File.createTempFile("test", ".dir", testData); tmpFile.delete(); try { FileTxnSnapLog txnSnapLog = new FileTxnSnapLog(tmpFile, tmpFile); SimpleLearner sl = new SimpleLearner(txnSnapLog); long startZxid = sl.zk.getLastProcessedZxid(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputArchive oa = BinaryOutputArchive.getArchive(baos); sl.leaderOs = BinaryOutputArchive.getArchive(new ByteArrayOutputStream()); sl.bufferedOutput = new BufferedOutputStream(System.out); sl.sock = new Socket(); QuorumPacket qp = new QuorumPacket(Leader.TRUNC, 0, null, null); oa.writeRecord(qp, null); sl.leaderIs = BinaryInputArchive.getArchive(new ByteArrayInputStream(baos.toByteArray())); try { sl.syncWithLeader(3); } catch (EOFException e) { } sl.zk.shutdown(); assertThat("System.exit() should have been called", exitProcCalled[0], is(true)); } finally { TestUtils.deleteFileRecursively(tmpFile); } }
Source:
<code>private void refreshRating() { if (getCampaign().getCampaignOptions().useDragoonRating()) { getCampaign().getUnitRating().reInitialize(); String text = "<html><b>Dragoons Rating:</b> " + getCampaign().getUnitRatingText() + "</html>"; lblRating.setText(text); } else { <START> lblRating.setText(""); <END> } }</code><technical_language>I this method written, FMMr options for a unit rating, is rating label a is selected. that, COR alternative, put in _else if_ condition populate label unitRatingText value</technical_language>

Target:
private void refreshRating() { if (getCampaign().getCampaignOptions().useDragoonRating()) { getCampaign().getUnitRating().reInitialize(); String text; if (UnitRatingMethod.FLD_MAN_MERCS_REV.equals(getCampaign().getCampaignOptions().getUnitRatingMethod())) { text = String.format(resourceMap.getString("bottomRating.DragoonsRating"), getCampaign().getUnitRatingText()); } else { text = String.format(resourceMap.getString("bottomRating.CampaignOpsRating"), getCampaign().getUnitRatingText()); } lblRating.setText(text); } else { lblRating.setText(""); } }
Source:
<code>public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; try { final ReviewDb db = schema.open(); try { p.parentsRevision = <START> patchSetInfoFactory.get(db, patchSet.getId()).getParentRevisons(); <END> } finally { db.close(); } } catch (PatchSetInfoNotAvailableException e) { log.error(e); e.printStackTrace(); } catch (OrmException e) { log.error(e); e.printStackTrace(); } return p; }</code><technical_language>need patchSetInfoFactory here. pulled database db.patchSetAncestors() table</technical_language>

Target:
public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; try { final ReviewDb db = schema.open(); try { p.parentsRevision = new ArrayList<String>(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( patchSet.getId())) { p.parentsRevision.add(a.getAncestorRevision().get()); } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot load patch set data for " + patchSet.getId(), e); } return p; }
Source:
<code>private Optional<JavaFileScannerContext.Location> flowFromThrownException(ExplodedGraph.Edge edge) { if (isMethodInvocationNode(edge.parent)) { SymbolicValue peekValue = edge.child.programState.peekValue(); if (peekValue instanceof SymbolicValue.ExceptionalSymbolicValue) { Type type = ((SymbolicValue.ExceptionalSymbolicValue) peekValue).exceptionType(); <START> String msg = type == null ? "Exception is thrown." : ("'" + type.name() + "' is thrown."); <END> return Optional.of(location(edge.parent, msg)); } } return Optional.empty(); }</code><technical_language>More a question of style, I I prefer as: String msg = String.format("%s is thrown.", (type == null ? "Exception" : "'" + type.name() + "'"));</technical_language>

Target:
private Optional<JavaFileScannerContext.Location> flowFromThrownException(ExplodedGraph.Edge edge) { if (isMethodInvocationNode(edge.parent)) { SymbolicValue peekValue = edge.child.programState.peekValue(); if (peekValue instanceof SymbolicValue.ExceptionalSymbolicValue) { Type type = ((SymbolicValue.ExceptionalSymbolicValue) peekValue).exceptionType(); String msg = String.format("%s is thrown.", type == null ? "Exception" : ("'" + type.name() + "'")); return Optional.of(location(edge.parent, msg)); } } return Optional.empty(); }
Source:
<code><START> public int indexOf(Object o) { <END> for (Entry<Integer, E> entry : fInnerElements.entrySet()) { if (Objects.equals(entry.getValue(), o)) { return entry.getKey(); } } return -1; }</code><technical_language>Special case for null</technical_language>

Target:
public int indexOf(Object o) { if (o == null && contains(null)) { for (int i = 0; i < size(); i++) { if (!fInnerElements.containsKey(i)) { return i; } } } for (Entry<Integer, E> entry : fInnerElements.entrySet()) { if (Objects.equals(entry.getValue(), o)) { return entry.getKey(); } } return -1; }
Source:
<code>public void loseQuorum() { LeadershipToken token = state.gainLeadership(0); for (int i = 1; i < NUM_POTENTIAL_LEADERS - QUORUM_SIZE + 2; i++) { state.goDown(i); } <START> assertNotSame("leader cannot maintain leadership withou quorum", <END> state.leader(0).isStillLeading(token), StillLeadingStatus.LEADING); state.comeUp(1); state.gainLeadership(0); assertNotSame("leader can confirm leadership with quorum", state.leader(0).isStillLeading(token), StillLeadingStatus.NOT_LEADING); }</code><technical_language>'withou' -> 'without'</technical_language>

Target:
public void loseQuorum() { LeadershipToken token = state.gainLeadership(0); for (int i = 1; i < NUM_POTENTIAL_LEADERS - QUORUM_SIZE + 2; i++) { state.goDown(i); } assertNotSame("leader cannot maintain leadership without quorum", state.leader(0).isStillLeading(token), StillLeadingStatus.LEADING); state.comeUp(1); state.gainLeadership(0); assertNotSame("leader can confirm leadership with quorum", state.leader(0).isStillLeading(token), StillLeadingStatus.NOT_LEADING); }
Source:
<code>public void fetchesRawRepresentation() throws Exception { final Contents contents = MkContentTest.repo().contents(); <START> final String raw = "raw test"; <END> final InputStream stream = contents.create( jsonContent("raw.txt", "for raw", raw) ).raw(); try { MatcherAssert.assertThat( IOUtils.toString(stream), Matchers.is(raw) ); } finally { stream.close(); } }</code><technical_language>some Unicode chars in it, for testing. for example "raw test \u20ac\u0000"</technical_language>

Target:
public void fetchesRawRepresentation() throws Exception { final Contents contents = MkContentTest.repo().contents(); final String raw = "raw test \u20ac\u0000"; final InputStream stream = contents.create( jsonContent("raw.txt", "for raw", raw) ).raw(); try { MatcherAssert.assertThat( IOUtils.toString(stream), Matchers.is(raw) ); } finally { stream.close(); } }
Source:
<code>protected boolean validateResource(ScriptRequest request, BinaryResource responseCandidate) { String requestedFingerprint = request.fingerprint(); if (!StringUtility.hasText(requestedFingerprint)) { return true; } String responseFingerprint = HtmlDocumentParser.createFingerprintFor(responseCandidate); if (requestedFingerprint.equals(responseFingerprint)) { return true; } <START> LOG.debug("Resource '{}' having fingerprint '{}' could not be found. A resource was found but would have different fingerprint '{}'.", request, requestedFingerprint, responseFingerprint); <END> return false; }</code><technical_language>Is level DEBUG sufficient</technical_language>

Target:
protected boolean validateResource(ScriptRequest request, BinaryResource responseCandidate) { String requestedFingerprint = request.fingerprint(); if (!StringUtility.hasText(requestedFingerprint)) { return true; } String responseFingerprint = responseCandidate.getFingerprintAsHexString(); if (requestedFingerprint.equals(responseFingerprint)) { return true; } LOG.debug("Resource '{}' having fingerprint '{}' could not be found. A resource was found but would have a different fingerprint '{}'.", request, requestedFingerprint, responseFingerprint); return false; }
Source:
<code>private File createMockPropertiesFile() throws IOException { File <START> pFile = <END> new File(mTestDir, PackageFiles.PAYLOAD_PROPERTIES_FILE_NAME); try (BufferedWriter w = new BufferedWriter(new FileWriter(pFile))) { w.write(PROPERTIES_CONTENTS); } return pFile; }</code><technical_language>bad naming. spell out full name</technical_language>

Target:
private File createMockPropertiesFile() throws IOException { File propertiesFile = new File(mTestDir, PackageFiles.PAYLOAD_PROPERTIES_FILE_NAME); Files.asCharSink(propertiesFile, Charsets.UTF_8).write(PROPERTIES_CONTENTS); return propertiesFile; }
Source:
<code>public Result[] search(String q, int k) throws IOException { IndexSearcher searcher = new IndexSearcher(reader); searcher.setSimilarity(similarity); Query query = AnalyzerUtils.buildBagOfWordsQuery(LuceneDocumentGenerator.FIELD_BODY, analyzer, q); TopDocs rs = searcher.search(query, k); ScoreDoc[] hits = rs.scoreDocs; Result[] results = new Result[hits.length]; for (int i = 0; i < hits.length; i++) { Document doc = searcher.doc(hits[i].doc); String docid = doc.getField(LuceneDocumentGenerator.FIELD_ID).stringValue(); IndexableField field = doc.getField(LuceneDocumentGenerator.FIELD_RAW); <START> String content = doc == null ? null : field.stringValue(); <END> results[i] = new Result(docid, hits[i].doc, hits[i].score, content); } return results; }</code><technical_language>doc null this point if null lines earlier doc.getField throw NullPointerException? meant field</technical_language>

Target:
public Result[] search(String q, int k) throws IOException { IndexSearcher searcher = new IndexSearcher(reader); searcher.setSimilarity(similarity); Query query = AnalyzerUtils.buildBagOfWordsQuery(LuceneDocumentGenerator.FIELD_BODY, analyzer, q); TopDocs rs = searcher.search(query, k); ScoreDoc[] hits = rs.scoreDocs; Result[] results = new Result[hits.length]; for (int i = 0; i < hits.length; i++) { Document doc = searcher.doc(hits[i].doc); String docid = doc.getField(LuceneDocumentGenerator.FIELD_ID).stringValue(); IndexableField field = doc.getField(LuceneDocumentGenerator.FIELD_RAW); String content = field == null ? null : field.stringValue(); results[i] = new Result(docid, hits[i].doc, hits[i].score, content); } return results; }
Source:
<code>public void setSize(final int width, final int height) { <START> this.syncExec(() -> browser.setSize(width, height)); <END> }</code><technical_language>coding convention like: omit "this" is needed</technical_language>

Target:
public void setSize(final int width, final int height) { syncExec(() -> browser.setSize(width, height)); }
Source:
<code>private void sendBatchMetrics(final MiniBatchResult miniBatchResult, final int epochIdx, final int miniBatchIdx, final int processedDataItemCount, final double miniBatchElapsedTime) { final double batchComputeTime = miniBatchResult.getComputeTime(); final double batchPullTime = miniBatchResult.getTotalPullTime(); final double batchPushTime = miniBatchResult.getTotalPushTime(); <START> epochTime.addRecord(batchComputeTime, batchPullTime, batchPushTime); <END> final DolphinWorkerMetrics batchMetric = DolphinWorkerMetrics.newBuilder() .setType(WorkerMetricsType.BatchMetrics) .setBatchMetrics( BatchMetrics.newBuilder() .setBatchTimeSec(miniBatchElapsedTime) .setBatchCustomMetrics( Metrics.newBuilder() .setData(miniBatchResult.getAppMetrics()) .build()) .setNumBatchDataInstances(processedDataItemCount) .setBatchIdx(miniBatchIdx) .setEpochIdx(epochIdx) .setBatchPushTimeSec(batchPushTime) .setBatchPullTimeSec(batchPullTime) .setBatchCompTimeSec(batchComputeTime) .build() ) .build(); metricCollector.addCustomMetric(batchMetric); metricCollector.flush(); LOG.log(Level.INFO, "MiniBatchMetrics {0}", batchMetric); }</code><technical_language>This line match method name</technical_language>

Target:
private void sendBatchMetrics(final MiniBatchResult miniBatchResult, final int epochIdx, final int miniBatchIdx, final int processedDataItemCount, final double miniBatchElapsedTime) { final BatchMetrics batchMetrics = BatchMetrics.newBuilder() .setBatchTimeSec(miniBatchElapsedTime) .setBatchCustomMetrics( Metrics.newBuilder() .setData(miniBatchResult.getAppMetrics()) .build()) .setNumBatchDataInstances(processedDataItemCount) .setBatchIdx(miniBatchIdx) .setEpochIdx(epochIdx) .setBatchPushTimeSec(miniBatchResult.getTotalPushTime()) .setBatchPullTimeSec(miniBatchResult.getTotalPullTime()) .setBatchCompTimeSec(miniBatchResult.getComputeTime()) .build(); final DolphinWorkerMetrics encapsulatedMetrics = DolphinWorkerMetrics.newBuilder() .setType(WorkerMetricsType.BatchMetrics) .setBatchMetrics(batchMetrics) .build(); metricCollector.addCustomMetric(encapsulatedMetrics); metricCollector.flush(); LOG.log(Level.INFO, "MiniBatchMetrics {0}", batchMetrics); }
Source:
<code>private boolean openConfirmationDialog(ExecutionEvent event, String question) throws ExecutionException { MessageDialog dlg = new MessageDialog(getShell(event), UIText.DiscardChangesAction_confirmActionTitle, null, question, MessageDialog.CONFIRM, 0, UIText.DiscardChangesAction_discardChangesButtonText, IDialogConstants.CANCEL_LABEL); return dlg.open() == <START> 0; <END> }</code><technical_language>This Window.OK</technical_language>

Target:
private boolean openConfirmationDialog(ExecutionEvent event, String question) throws ExecutionException { MessageDialog dlg = new MessageDialog(getShell(event), UIText.DiscardChangesAction_confirmActionTitle, null, question, MessageDialog.CONFIRM, 0, UIText.DiscardChangesAction_discardChangesButtonText, IDialogConstants.CANCEL_LABEL); return dlg.open() == Window.OK; }
Source:
<code>private void assertGeometryToBingTiles(String wkt, int zoomLevel, List<String> expectedQuadKeys) { <START> assertFunction("transform(geometry_to_bing_tiles(ST_GeometryFromText('" + wkt +"'), " + zoomLevel + "), x -> bing_tile_quadkey(x))", new ArrayType(VARCHAR), expectedQuadKeys); <END> }</code><technical_language>String.format() for readability</technical_language>

Target:
private void assertGeometryToBingTiles(String wkt, int zoomLevel, List<String> expectedQuadKeys) { assertFunction(format("transform(geometry_to_bing_tiles(ST_GeometryFromText('%s'), %s), x -> bing_tile_quadkey(x))", wkt, zoomLevel), new ArrayType(VARCHAR), expectedQuadKeys); }
Source:
<code>public IBuildElement getBuildElementFromUrl(IBuildServer server, String url) { if (url.startsWith(server.getUrl())) { String path = url.substring(server.getUrl().length()); Pattern p = Pattern.compile(".*/job/(.*)/(\\d+)"); Matcher matcher = p.matcher(url); if (matcher.find()) { IBuildPlan plan = IBuildFactory.INSTANCE.createBuildPlan(); plan.setServer(server); plan.setName(matcher.group(1)); plan.setId(matcher.group(1)); plan.setUrl(url); IBuild build = IBuildFactory.INSTANCE.createBuild(); build.setId(matcher.group(2)); build.setLabel(matcher.group(2)); <START> build.setPlan(plan); <END> return build; } } return null; }</code><technical_language>nice set build URL well</technical_language>

Target:
public IBuildElement getBuildElementFromUrl(IBuildServer server, String url) { if (url.startsWith(server.getUrl())) { String path = url.substring(server.getUrl().length()); Pattern p = Pattern.compile("(.*/job/(.*)/)(\\d+)"); Matcher matcher = p.matcher(url); if (matcher.find()) { IBuildPlan plan = IBuildFactory.INSTANCE.createBuildPlan(); plan.setServer(server); plan.setName(matcher.group(2)); plan.setId(matcher.group(2)); plan.setUrl(matcher.group(1)); IBuild build = IBuildFactory.INSTANCE.createBuild(); build.setId(matcher.group(3)); build.setLabel(matcher.group(3)); build.setPlan(plan); build.setUrl(url); return build; } } return null; }
Source:
<code><START> public CustomizeActionBars(IWorkbenchWindowConfigurer configurer, IEclipseContext context) { <END> this.configurer = configurer; workbenchTrimElements = new ArrayList<MTrimElement>(); statusLineManager = new StatusLineManager(); menuManager = new MenuManager("MenuBar", ActionSet.MAIN_MENU); this.configurer = configurer; IRendererFactory rendererFactory = context.get(IRendererFactory.class); EModelService modelService = context.get(EModelService.class); windowModel = modelService.createModelElement(MTrimmedWindow.class); app = context.get(MApplication.class); IEclipseContext eclipseContext = app.getContext().createChild("window - CustomizeActionBars"); windowModel.setContext(eclipseContext); eclipseContext.set(MWindow.class.getName(), windowModel); Shell shell = new Shell(); windowModel.setWidget(shell); windowModel.setToBeRendered(false); app.getChildren().add(windowModel); shell.setData(org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.OWNING_ME, windowModel); mainMenu = modelService.createModelElement(MMenu.class); mainMenu.setElementId(ActionSet.MAIN_MENU); menuRenderer = (MenuManagerRenderer) rendererFactory.getRenderer(mainMenu, null); menuRenderer.linkModelToManager(mainMenu, menuManager); windowModel.setMainMenu(mainMenu); coolBarManager = new CoolBarToTrimManager(app, windowModel, workbenchTrimElements, rendererFactory); }</code><technical_language>default access modifier, in other classes, e.g., FilterModelCheckListener</technical_language>

Target:
public CustomizeActionBars(IWorkbenchWindowConfigurer configurer, IEclipseContext context) { this.configurer = configurer; statusLineManager = new StatusLineManager(); menuManager = new MenuManager("MenuBar", ActionSet.MAIN_MENU); IRendererFactory rendererFactory = context.get(IRendererFactory.class); EModelService modelService = context.get(EModelService.class); windowModel = modelService.createModelElement(MTrimmedWindow.class); app = context.get(MApplication.class); IEclipseContext eclipseContext = app.getContext().createChild("window - CustomizeActionBars"); windowModel.setContext(eclipseContext); eclipseContext.set(MWindow.class, windowModel); Shell shell = new Shell(); windowModel.setWidget(shell); windowModel.setToBeRendered(false); app.getChildren().add(windowModel); shell.setData(org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.OWNING_ME, windowModel); mainMenu = modelService.createModelElement(MMenu.class); mainMenu.setElementId(ActionSet.MAIN_MENU); menuRenderer = (MenuManagerRenderer) rendererFactory.getRenderer(mainMenu, null); menuRenderer.linkModelToManager(mainMenu, menuManager); windowModel.setMainMenu(mainMenu); coolBarManager = new CoolBarToTrimManager(app, windowModel, new ArrayList<MTrimElement>(), rendererFactory); }
Source:
<code>public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<RegistrationContext> context) throws IOException { final byte status = input.readByte(); <START> final RegistrationContext registration = context.getAttachment(); <END> registration.completeRegistration(context, status == DomainControllerProtocol.PARAM_OK); }</code><technical_language>1. This means input get read</technical_language>

Target:
public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<RegistrationContext> context) throws IOException { final byte status = input.readByte(); final String message = input.readUTF(); final RegistrationContext registration = context.getAttachment(); registration.completeRegistration(context, status == DomainControllerProtocol.PARAM_OK); }
Source:
<code>public void registerPatient() { new PatientService().registerPatient(mPatient); <START> mLastViewedPatientsView.finishRegisterActivity(); <END> }</code><technical_language>@tmarzeion start PatientDashbordActivity created patient :)</technical_language>

Target:
public void registerPatient() { new PatientService().registerPatient(mPatient); mRegisterPatientView.startPatientDashbordActivity(mPatient); mRegisterPatientView.finishRegisterActivity(); }
Source:
<code>private void verifyChannelActive() throws RestServiceException { if (channelClosed.get() || !(ctx.channel().isActive())) { logger.trace("Channel is closed. No more interaction possible", ctx.channel()); <START> nettyMetrics.channelWriteAfterClose.inc(); <END> throw new RestServiceException("Channel " + ctx.channel() + " has already been closed before write", RestServiceErrorCode.ChannelAlreadyClosed); } }</code><technical_language>this metric sense incremented caller's place. Bcz, method is verify if channel is active not. call this method check for activeness</technical_language>

Target:
private void verifyChannelActive() throws RestServiceException { if (channelClosed.get() || !(ctx.channel().isActive())) { throw new RestServiceException("Channel is closed and cannot accept operations", RestServiceErrorCode.ChannelAlreadyClosed); } }
Source:
<code>protected void checkThread(IThread thread, boolean checked) { fThreadViewer.setChecked(thread, checked); IDebugTarget target= (thread).getDebugTarget(); if (checked) { if (!fThreadViewer.getChecked(target)) { fThreadViewer.setChecked(target, true); } IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread <START> thread2 : <END> threads) { if (thread2 != thread) { fThreadViewer.setChecked(thread2, false); } } } else { fThreadViewer.setChecked(target, false); } }</code><technical_language>rename targetThread</technical_language>

Target:
protected void checkThread(IThread thread, boolean checked) { fThreadViewer.setChecked(thread, checked); IDebugTarget target= (thread).getDebugTarget(); if (checked) { if (!fThreadViewer.getChecked(target)) { fThreadViewer.setChecked(target, true); } IThread[] threads; try { threads= target.getThreads(); } catch (DebugException exception) { JDIDebugUIPlugin.log(exception); return; } for (IThread targetThread : threads) { if (targetThread != thread) { fThreadViewer.setChecked(targetThread, false); } } } else { fThreadViewer.setChecked(target, false); } }
Source:
<code>public void nextValueThrowsExceptionOnEmptyList() { <START> final List<String> EMPTY_LIST = Arrays.asList(); <END> final String NO_NEXT_VALUE_ERROR = "Empty Error Message"; new VerboseIterable<String>( EMPTY_LIST, NO_NEXT_VALUE_ERROR). iterator().next(); }</code><technical_language>@m4solutions unnecessery variable - Collections.emptyList()</technical_language>

Target:
public final void nextValueThrowsExceptionOnEmptyList() { new VerboseIterable<String>( Collections.<String>emptyList(), "Expected Error Message" ).iterator().next(); }
Source:
<code>private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments( renditionRefsToDelete.stream() .map(IdRef::new) .collect(Collectors.toList()) <START> .toArray(new DocumentRef[renditionRefsToDelete.size()])); <END> } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }</code><technical_language>This is existing code, formatted, not</technical_language>

Target:
private void removeStoredRenditions(Map<String, List<String>> liveDocumentRefsToRenditionRefs) { List<String> liveDocumentRefs = new ArrayList<>(liveDocumentRefsToRenditionRefs.keySet()); if (liveDocumentRefs.isEmpty()) { return; } int processedSourceIds = 0; while (processedSourceIds < liveDocumentRefs.size()) { int limit = processedSourceIds + BATCH_SIZE > liveDocumentRefs.size() ? liveDocumentRefs.size() : processedSourceIds + BATCH_SIZE; List<String> batchSourceIds = liveDocumentRefs.subList(processedSourceIds, limit); List<String> existingSourceIds = new ArrayList<>(); String query = NXQLQueryBuilder.getQuery("SELECT ecm:uuid FROM Document WHERE ecm:uuid IN ?", new Object[] { batchSourceIds }, true, true, null); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { result.forEach(res -> existingSourceIds.add(res.get(NXQL.ECM_UUID).toString())); } batchSourceIds.removeAll(existingSourceIds); List<String> renditionRefsToDelete = batchSourceIds.stream() .map(liveDocumentRefsToRenditionRefs::get) .reduce(new ArrayList<>(), (allRefs, refs) -> { allRefs.addAll(refs); return allRefs; }); if (!renditionRefsToDelete.isEmpty()) { session.removeDocuments(renditionRefsToDelete.stream().map(IdRef::new).toArray(DocumentRef[]::new)); } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } processedSourceIds += BATCH_SIZE; } }
Source:
<code>private long getBackoffTimeWhenSweepHasNotRun() { <START> return 20 * (1000 + sweepPauseMillis.get()); END> }</code><technical_language>slightly confused this - is this for pause start sweep? If so, defined backoff time adding completely separately definition here, 5x this one</technical_language>

Target:
private Duration getBackoffTimeWhenSweepHasNotRun() { return Duration.ofMillis(sweepPauseMillis.get()).plusSeconds(1).multipliedBy(20); }
Source:
<code>public void setLastSeenQuorumVerifier(QuorumVerifier qv, boolean writeToDisk){ QuorumCnxManager qcm = qcmRef.get(); <START> Object outerLockObject = (qcm != null) ? qcm : QV_LOCK; <END> synchronized (outerLockObject) { synchronized (QV_LOCK) { if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() > qv.getVersion()) { LOG.error("setLastSeenQuorumVerifier called with stale config " + qv.getVersion() + ". Current version: " + quorumVerifier.getVersion()); } if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() == qv.getVersion()) { return; } lastSeenQuorumVerifier = qv; if (qcm != null && quorumVerifier != null && lastSeenQuorumVerifier != null) { Map<Long, QuorumServer> committedView = quorumVerifier.getAllMembers(); for (Entry<Long, QuorumServer> e : lastSeenQuorumVerifier.getAllMembers().entrySet()) { if (e.getKey() != getId() && !committedView.containsKey(e.getKey())) qcm.connectOne(e.getKey()); } } if (writeToDisk) { try { String fileName = getNextDynamicConfigFilename(); if (fileName != null) { QuorumPeerConfig.writeDynamicConfig(fileName, qv, true); } } catch (IOException e) { LOG.error("Error writing next dynamic config file to disk: ", e.getMessage()); } } } } }</code><technical_language>nest synchronized merits careful consideration</technical_language>

Target:
public void setLastSeenQuorumVerifier(QuorumVerifier qv, boolean writeToDisk){ QuorumCnxManager qcm = qcmRef.get(); Object outerLockObject = (qcm != null) ? qcm : QV_LOCK; synchronized (outerLockObject) { synchronized (QV_LOCK) { if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() > qv.getVersion()) { LOG.error("setLastSeenQuorumVerifier called with stale config " + qv.getVersion() + ". Current version: " + quorumVerifier.getVersion()); } if (lastSeenQuorumVerifier != null && lastSeenQuorumVerifier.getVersion() == qv.getVersion()) { return; } lastSeenQuorumVerifier = qv; if (qcm != null) { connectNewPeers(qcm); } if (writeToDisk) { try { String fileName = getNextDynamicConfigFilename(); if (fileName != null) { QuorumPeerConfig.writeDynamicConfig(fileName, qv, true); } } catch (IOException e) { LOG.error("Error writing next dynamic config file to disk: ", e.getMessage()); } } } } }
Source:
<code>public static String sanitizeSecondCachedKey(final Contentlet vanityUrl) <START> throws DotDataException, DotRuntimeException, DotSecurityException { <END> Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeSecondCacheKey(host.getIdentifier(), vanityUrl.getLanguageId()); }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove redundant '!unknownSymbol!' thrown exception declaration(s). [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public static String sanitizeSecondCachedKey(final Contentlet vanityUrl) throws DotDataException, DotSecurityException { Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeSecondCacheKey(host.getIdentifier(), vanityUrl.getLanguageId()); }
Source:
<code>public void deleteDataSource(Long dataSourceId) throws KeywordSearchServiceException { try { KeywordSearch.getServer().deleteDataSource(dataSourceId); } catch (NoOpenCoreException ex) { logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore")); throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore")); <START> } <END> }</code><technical_language>localize exception messages. reason, for worse, is ultimately ends reading is of us... need log exception get end of propagation. confusing duplicate log entries for error</technical_language>

Target:
public void deleteDataSource(Long dataSourceId) throws KeywordSearchServiceException { try { Server ddsServer = KeywordSearch.getServer(); ddsServer.deleteDataSource(dataSourceId); } catch (IOException | KeywordSearchModuleException | NoOpenCoreException | SolrServerException ex) { logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.DeleteDataSource.msg", dataSourceId), ex); throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class, "SolrSearchService.DeleteDataSource.msg", dataSourceId), ex); } }
Source:
<code>public void storeAuthenticationConfigurationResource(Resource resource, InputStream is) throws IOException { if (!(resource instanceof WritableResource)) { <START> logger.warn(String.format("Skip store of readonly resource [%s].", resource)); <END> return; } WritableResource writableResource = (WritableResource) resource; OutputStream os = writableResource.getOutputStream(); IOUtils.copy(is, os); }</code><technical_language>Cosmetic: store read-only resource [%s]</technical_language>

Target:
public void storeAuthenticationConfigurationResource(Resource resource, InputStream is) throws IOException { if (!(resource instanceof WritableResource)) { logger.warn(String.format("Could not store read-only resource [%s].", resource)); return; } WritableResource writableResource = (WritableResource) resource; OutputStream os = writableResource.getOutputStream(); IOUtils.copy(is, os); }
Source:
<code>public GdbFullCliConsolePage(GdbFullCliConsole gdbConsole, IDebuggerConsoleView view) { fConsole = gdbConsole; fView = view; fLaunch = gdbConsole.getLaunch(); if (fLaunch instanceof GdbLaunch) { fSession = ((GdbLaunch)fLaunch).getSession(); } else { fSession = null; assert false; } fConsolePropertyChangeListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB)) { String terminateStr = event.getNewValue().toString(); <START> Boolean terminate = terminateStr.equals(Boolean.FALSE.toString()) ? Boolean.FALSE : Boolean.TRUE; <END> fAtutoTerminateAction.setChecked(terminate); } } }; GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fConsolePropertyChangeListener); }</code><technical_language>I boolean instead of Boolean avoid unecessary auto-boxing</technical_language>

Target:
public GdbFullCliConsolePage(GdbFullCliConsole gdbConsole, IDebuggerConsoleView view) { fConsole = gdbConsole; fView = view; fLaunch = gdbConsole.getLaunch(); if (fLaunch instanceof GdbLaunch) { fSession = ((GdbLaunch)fLaunch).getSession(); } else { fSession = null; assert false; } fConsolePropertyChangeListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB)) { String terminateStr = event.getNewValue().toString(); boolean terminate = terminateStr.equals(Boolean.FALSE.toString()) ? false : true; fAutoTerminateAction.setChecked(terminate); } } }; GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fConsolePropertyChangeListener); }
Source:
<code>public synchronized void close() { <START> _isClosed = true; <END> List<ServiceHandle<S>> oldInstancesServiceHandles = Lists.newArrayList(_instancesPerEndpoint.values()); _instancesPerEndpoint = Maps.newHashMap(); for(ServiceHandle<S> serviceHandle: oldInstancesServiceHandles) { try { destroyService(serviceHandle); } catch(Exception ignored) } }</code><technical_language>is a potential race condition close checkOut checkOut return a destroyed ServiceHandle. I if this is a real issue not, is consider</technical_language>

Target:
public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { putInDeletedList(serviceHandle); } _instancesPerEndpoint = Maps.newHashMap(); _mostRecentClientCreationTimePerEndpoint.clear(); _evictedList.invalidateAll(); _toBeDeletedList.invalidateAll(); _cleanupFuture.cancel(false); _metrics.close(); }
Source:
<code><START> private void updateTimeSinceLastTutorial() { <END> timeSinceLastTutorial = System.currentTimeMillis(); }</code><technical_language>mind if privates bottom? a class client (reader) of more code I author, means relevant source is public API. quicker get top codes read top bottom</technical_language>

Target:
private void updateTimeSinceLastTutorial() { millisSinceLastTutorial = System.currentTimeMillis(); }
Source:
<code>public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { kieView.getMultiPage().addPage(BACKGROUND_TAB_INDEX, new PageImpl(scenarioGridWidget, ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle()) { @Override public void onFocus() { super.onFocus(); <START> onBackGroundTabSelected(); <END> } }); }</code><technical_language>I this is part of this PR</technical_language>

Target:
public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { kieView.getMultiPage().addPage(BACKGROUND_TAB_INDEX, new PageImpl(scenarioGridWidget, ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle()) { @Override public void onFocus() { super.onFocus(); onBackgroundTabSelected(); } }); }
Source:
<code>public void processImage(int pageNum, PageFormat pageFormat) { printShields(); super.processImage(pageNum, pageFormat); for (int loc = 0; loc < mech.locations(); loc++) { Element critRect = getSVGDocument().getElementById(CRITS + mech.getLocationAbbr(loc)); if (critRect instanceof SVGRectElement) { writeLocationCriticals(loc, (SVGRectElement) critRect); } } hideElement(HEAVY_DUTY_GYRO_PIP, mech.getGyroType() != Mech.GYRO_HEAVY_DUTY); Element hsRect = getSVGDocument().getElementById(HEAT_SINK_PIPS); if (hsRect instanceof SVGRectElement) { drawHeatSinkPips((SVGRectElement) hsRect, mech.heatSinks()); } if (mech.hasETypeFlag(Entity.ETYPE_LAND_AIR_MECH)) { Element si = getSVGDocument().getElementById(SI_PIPS); if (si instanceof SVGRectElement) { drawSIPips((SVGRectElement) si); } else { <START> MegaMekLab.getLogger().error(getClass(), <END> "Region siPips does not exist in template or is not a <rect>"); } } }</code><technical_language>suggestion MegaMekLab.getLogger().error(this,</technical_language>

Target:
public void processImage(int pageNum, PageFormat pageFormat) { printShields(); super.processImage(pageNum, pageFormat); for (int loc = 0; loc < mech.locations(); loc++) { Element critRect = getSVGDocument().getElementById(CRITS + mech.getLocationAbbr(loc)); if (critRect instanceof SVGRectElement) { writeLocationCriticals(loc, (SVGRectElement) critRect); } } hideElement(HEAVY_DUTY_GYRO_PIP, mech.getGyroType() != Mech.GYRO_HEAVY_DUTY); Element hsRect = getSVGDocument().getElementById(HEAT_SINK_PIPS); if (hsRect instanceof SVGRectElement) { drawHeatSinkPips((SVGRectElement) hsRect, mech.heatSinks()); } if (mech.hasETypeFlag(Entity.ETYPE_LAND_AIR_MECH)) { Element si = getSVGDocument().getElementById(SI_PIPS); if (si instanceof SVGRectElement) { drawSIPips((SVGRectElement) si); } else { MegaMekLab.getLogger().error(this, "Region siPips does not exist in template or is not a <rect>"); } } }