auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testGetVerifiedNegotiatedProposalWithMismatchedTransform() throws Exception { byte[] inputPacket = TestUtils.hexStringToByteArray(PROPOSAL_RAW_PACKET); mValidNegotiatedTransformSet[0] = mEncrAesGcm8Key128Transform; <START> Proposal.sTransformDecoder = new TransformDecoder() { @Override public Transform[] decodeTransforms(int count, ByteBuffer inputBuffer) throws IkeException { byte[] temp = new byte[inputBuffer.remaining()]; inputBuffer.get(temp); return mValidNegotiatedTransformSet; } }; IkeSaPayload respPayload = new IkeSaPayload(false, true, inputPacket); IkeSaPayload reqPayload = makeSaRequestPayload(); try { respPayload.getVerifiedNegotiatedProposal(reqPayload); <END> fail("Expected to fail due to mismatched Transform."); } catch (NoValidProposalChosenException expected) { } }</code><technical_language>significant, reduce duplication too: public void buildAndVerifyProposal(byte[] inputPacket, Transform[] decodeResult) do a try/catch thing</technical_language>

Target:
public void testGetVerifiedNegotiatedProposalWithMismatchedTransform() throws Exception { byte[] inputPacket = TestUtils.hexStringToByteArray(PROPOSAL_RAW_PACKET); Transform[] negotiatedTransformSet = Arrays.copyOfRange( mValidNegotiatedTransformSet, 0, mValidNegotiatedTransformSet.length); negotiatedTransformSet[0] = mEncrAesGcm8Key128Transform; Proposal.sTransformDecoder = getDummyTransformDecoder(negotiatedTransformSet); IkeSaPayload respPayload = new IkeSaPayload(false, true, inputPacket); IkeSaPayload reqPayload = makeSaRequestPayload(); try { respPayload.getVerifiedNegotiatedProposal(reqPayload); fail("Expected to fail due to mismatched Transform."); } catch (NoValidProposalChosenException expected) { } }
Source:
<code><START> protected static Cache<Object, Object> buildCache() { <END> Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder(); cacheBuilder.maximumSize(100); return cacheBuilder.build(); }</code><technical_language>this typesafe returning Cache<String, DateTimeFormatter>. generics inferred build() step construction, caused confusion</technical_language>

Target:
protected static Cache<String, DateTimeFormatter> buildCache() { Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder(); cacheBuilder.maximumSize(100); return cacheBuilder.build(); }
Source:
<code>static brave.http.HttpServerRequest toBrave(HttpServerRequest request) { if (request == null) { return null; } if (request instanceof BraveHttpServerRequest) { return ((BraveHttpServerRequest) request).delegate; } return new brave.http.HttpServerRequest() { @Override public Object unwrap() { return request.unwrap(); } @Override public String method() { return request.method(); } @Override public String path() { return request.path(); } @Override public String url() { return request.url(); } @Override public String header(String name) { return request.header(name); } @Override public boolean parseClientIpAndPort(brave.Span span) { boolean clientIpAndPortParsed = super.parseClientIpAndPort(span); if (clientIpAndPortParsed) { return true; } return resolveFromInetAddress(span); } private boolean resolveFromInetAddress(brave.Span span) { Object delegate = request.unwrap(); if (delegate instanceof ServerHttpRequest) { InetSocketAddress addr = ((ServerHttpRequest) delegate).getRemoteAddress(); if (addr == null) { return false; } return span.remoteIpAndPort(addr.getAddress().getHostAddress(), addr.getPort()); } <START> else if (delegate instanceof HttpServletRequest) { <END> HttpServletRequest servletRequest = (HttpServletRequest) delegate; return span.remoteIpAndPort(servletRequest.getRemoteAddr(), servletRequest.getRemotePort()); } return false; } }; }</code><technical_language>thinking this ServletRequest</technical_language>

Target:
static brave.http.HttpServerRequest toBrave(HttpServerRequest request) { if (request == null) { return null; } if (request instanceof BraveHttpServerRequest) { return ((BraveHttpServerRequest) request).delegate; } return new brave.http.HttpServerRequest() { @Override public Object unwrap() { return request.unwrap(); } @Override public String method() { return request.method(); } @Override public String path() { return request.path(); } @Override public String url() { return request.url(); } @Override public String header(String name) { return request.header(name); } @Override public boolean parseClientIpAndPort(brave.Span span) { boolean clientIpAndPortParsed = super.parseClientIpAndPort(span); if (clientIpAndPortParsed) { return true; } return resolveFromInetAddress(span); } private boolean resolveFromInetAddress(brave.Span span) { Object delegate = request.unwrap(); if (delegate instanceof ServerHttpRequest) { InetSocketAddress addr = ((ServerHttpRequest) delegate).getRemoteAddress(); if (addr == null) { return false; } return span.remoteIpAndPort(addr.getAddress().getHostAddress(), addr.getPort()); } else if (delegate instanceof ServletRequest) { ServletRequest servletRequest = (ServletRequest) delegate; String addr = servletRequest.getRemoteAddr(); if (addr == null) { return false; } return span.remoteIpAndPort(addr, servletRequest.getRemotePort()); } return false; } }; }
Source:
<code>private static void testSerialization(String wkt) { OGCGeometry geometry = OGCGeometry.fromText(wkt); <START> geometry.setSpatialReference(null); <END> OGCGeometry deserializedGeometry = deserialize(serialize(geometry)); assertEquals(geometry.asText(), deserializedGeometry.asText()); }</code><technical_language>this code unnecessary</technical_language>

Target:
private static void testSerialization(String wkt) { OGCGeometry geometry = OGCGeometry.fromText(wkt); OGCGeometry deserializedGeometry = deserialize(serialize(geometry)); if (geometry.isEmpty()) { assertTrue(deserializedGeometry.isEmpty()); } else { assertEquals(geometry.asText(), deserializedGeometry.asText()); } }
Source:
<code>public static MessageType convert(StructType struct, FieldProjectionFilter filter) { State state = new State(new FieldsPath(), REPEATED, "ParquetSchema"); <START> ConvertedField conv = struct.accept(new ThriftSchemaConvertVisitor(filter, true), state); <END> MessageType messageType; if (!conv.isKeep()) { messageType = new MessageType(state.name, new ArrayList<Type>()); } else { messageType = new MessageType(state.name, conv.asKeep().getType().asGroupType().getFields()); } return messageType; }</code><technical_language>need save typing here. conv converter other things. convertedField is fine</technical_language>

Target:
public static MessageType convert(StructType struct, FieldProjectionFilter filter) { State state = new State(new FieldsPath(), REPEATED, "ParquetSchema"); ConvertedField converted = struct.accept(new ThriftSchemaConvertVisitor(filter, true), state); if (!converted.isKeep()) { throw new ThriftProjectionException("No columns have been selected"); } return new MessageType(state.name, converted.asKeep().getType().asGroupType().getFields()); }
Source:
<code>private boolean updateVmLease() { if (Objects.equals(oldVm.getLeaseStorageDomainId(), newVmStatic.getLeaseStorageDomainId())) { <START> if (!Objects.equals(oldVm.isAutoStartup(), newVmStatic.isAutoStartup()) && newVmStatic.isAutoStartup() && newVmStatic.getLeaseStorageDomainId() == null && !addDefaultVmLease(newVmStatic)) { return false; } <END> return true; } throwIfCompensationEnabled(); if (getVm().isNotRunning()) { if (!addDefaultVmLease(newVmStatic)) { return false; } } else if (isHotSetEnabled()) { if (oldVm.getLeaseStorageDomainId() == null) { return addDefaultVmLease(newVmStatic); } boolean hotUnplugSucceeded = false; try { hotUnplugSucceeded = runVdsCommand(VDSCommandType.HotUnplugLease, new LeaseVDSParameters(getVm().getRunOnVds(), oldVm.getId(), oldVm.getLeaseStorageDomainId())).getSucceeded(); } catch (EngineException e) { log.error("Failure in hot unplugging a lease to VM {}, message: {}", oldVm.getId(), e.getMessage()); } if (!hotUnplugSucceeded) { auditLog(this, AuditLogType.HOT_UNPLUG_LEASE_FAILED); } } if (oldVm.getLeaseStorageDomainId() != null && newVmStatic.getLeaseStorageDomainId() == null) { vmDynamicDao.updateVmLeaseInfo(getVmId(), null); } removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); return true; }</code><technical_language>This is true. skip cases need give specific handling for creating/removing lease (for e.g VM is running lease hot-plugged etc..)</technical_language>

Target:
private boolean updateVmLease() { if (Objects.equals(oldVm.getLeaseStorageDomainId(), newVmStatic.getLeaseStorageDomainId()) && Objects.equals(oldVm.isAutoStartup(), newVmStatic.isAutoStartup())) { return true; } throwIfCompensationEnabled(); newVmStatic.setLeaseStorageDomainId(getDefaultVmLease(newVmStatic)); if (getVm().isNotRunning()) { if (!addVmLease(newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId(), false)) { return false; } } else if (isHotSetEnabled()) { if (oldVm.getLeaseStorageDomainId() == null) { return addVmLease(newVmStatic.getLeaseStorageDomainId(), newVmStatic.getId(), true); } boolean hotUnplugSucceeded = false; try { hotUnplugSucceeded = runVdsCommand(VDSCommandType.HotUnplugLease, new LeaseVDSParameters(getVm().getRunOnVds(), oldVm.getId(), oldVm.getLeaseStorageDomainId())).getSucceeded(); } catch (EngineException e) { log.error("Failure in hot unplugging a lease to VM {}, message: {}", oldVm.getId(), e.getMessage()); } if (!hotUnplugSucceeded) { auditLog(this, AuditLogType.HOT_UNPLUG_LEASE_FAILED); } } if (oldVm.getLeaseStorageDomainId() != null && newVmStatic.getLeaseStorageDomainId() == null) { vmDynamicDao.updateVmLeaseInfo(getVmId(), null); } removeVmLease(oldVm.getLeaseStorageDomainId(), oldVm.getId()); return true; }
Source:
<code>public void testPushNotificationScheduler() { try { <START> log.debug("Attempting to execute push notification task scheduler"); <END> Mockito.doReturn(new TestNotificationStrategy()).when(this.deviceMgtProviderService) .getNotificationStrategyByDeviceType(Mockito.anyString()); Mockito.doReturn(new org.wso2.carbon.device.mgt.common.operation.mgt.Operation()) .when(this.deviceMgtProviderService).getOperation(Mockito.anyString(), Mockito.anyInt()); this.pushNotificationSchedulerTask.run(); OperationManagementDAOFactory.openConnection(); Map<Integer, List<OperationMapping>> operationMappingsTenantMap = operationDAO .getOperationMappingsByStatus(Operation.Status.PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance().getDeviceManagementConfig() .getPushNotificationConfiguration().getSchedulerBatchSize()); Assert.assertEquals(operationMappingsTenantMap.size(), 0); log.debug("Push notification task execution complete."); } catch (DeviceManagementException e) { Assert.fail("Unexpected exception occurred when getting the push notification strategy.", e); } catch (SQLException | OperationManagementDAOException e) { Assert.fail("Unexpected exception occurred retrieving the operation mapping list.", e); } catch (OperationManagementException e) { Assert.fail("Unexpected exception occurred when retrieving an operation.", e); } finally { OperationManagementDAOFactory.closeConnection(); } }</code><technical_language>Do need debug logs in test case? this is a test case, info logs</technical_language>

Target:
public void testPushNotificationScheduler() throws DeviceManagementException, OperationManagementException, SQLException, OperationManagementDAOException { try { log.info("Attempting to execute push notification task scheduler"); Mockito.doReturn(new TestNotificationStrategy()).when(this.deviceMgtProviderService) .getNotificationStrategyByDeviceType(Mockito.anyString()); Mockito.doReturn(new org.wso2.carbon.device.mgt.common.operation.mgt.Operation()) .when(this.deviceMgtProviderService).getOperation(Mockito.anyString(), Mockito.anyInt()); this.pushNotificationSchedulerTask.run(); OperationManagementDAOFactory.openConnection(); Map<Integer, List<OperationMapping>> operationMappingsTenantMap = operationDAO .getOperationMappingsByStatus(Operation.Status.PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance().getDeviceManagementConfig() .getPushNotificationConfiguration().getSchedulerBatchSize()); Assert.assertEquals(operationMappingsTenantMap.size(), 0); log.info("Push notification task execution complete."); } finally { OperationManagementDAOFactory.closeConnection(); } }
Source:
<code>public FormIndex deleteRepeat(FormIndex index) { Vector indexes = new Vector(); Vector multiplicities = new Vector(); Vector elements = new Vector(); collapseIndex(index, indexes, multiplicities, elements); for (int i = elements.size() - 1; i >= 0; i--) { IFormElement e = (IFormElement)elements.elementAt(i); if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) { break; } else { indexes.removeElementAt(i); multiplicities.removeElementAt(i); elements.removeElementAt(i); } } FormIndex newIndex = buildIndex(indexes, multiplicities, elements); TreeReference deleteRef = getChildInstanceRef(newIndex); TreeElement deleteElement = mainInstance.resolveReference(deleteRef); TreeReference parentRef = deleteRef.getParentRef(); TreeElement parentElement = mainInstance.resolveReference(parentRef); int childMult = deleteElement.getMult(); parentElement.removeChild(deleteElement); for (int i = 0; i < parentElement.getNumChildren(); i++) { TreeElement child = parentElement.getChildAt(i); <START> if (child.doFieldsMatch(deleteElement) && child.getMult() > childMult) { <END> child.setMult(child.getMult() - 1); } } this.getMainInstance().cleanCache(); triggerTriggerables(deleteRef); return newIndex; }</code><technical_language>a bit understand child.doFieldsMatch(deleteElement) is filtering in/out. mention repeat entry 'siblings'. is this clause selects siblings of deleted repeat entry ignores other child of parent element. lifting this for-loop a helper called reduceMultiplicityOfSiblingRepeatEntries (or shorter )</technical_language>

Target:
public FormIndex deleteRepeat(FormIndex index) { Vector indexes = new Vector(); Vector multiplicities = new Vector(); Vector elements = new Vector(); collapseIndex(index, indexes, multiplicities, elements); for (int i = elements.size() - 1; i >= 0; i--) { IFormElement e = (IFormElement)elements.elementAt(i); if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) { break; } else { indexes.removeElementAt(i); multiplicities.removeElementAt(i); elements.removeElementAt(i); } } FormIndex newIndex = buildIndex(indexes, multiplicities, elements); TreeReference deleteRef = getChildInstanceRef(newIndex); TreeElement deleteElement = mainInstance.resolveReference(deleteRef); TreeReference parentRef = deleteRef.getParentRef(); TreeElement parentElement = mainInstance.resolveReference(parentRef); parentElement.removeChild(deleteElement); reduceTreeSiblingMultiplicities(parentElement, deleteElement); this.getMainInstance().cleanCache(); triggerTriggerables(deleteRef); return newIndex; }
Source:
<code>public Future<?> submit(Runnable task) { if (task == null) { <START> throw new NullPointerException(); <END> } PicassoFutureTask ftask = new PicassoFutureTask((BitmapHunter) task); execute(ftask); return ftask; }</code><technical_language>AssertionError instead? this happen</technical_language>

Target:
public Future<?> submit(Runnable task) { PicassoFutureTask ftask = new PicassoFutureTask((BitmapHunter) task); execute(ftask); return ftask; }
Source:
<code>private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } <START> Optional<Ref> match = matchingTags.sorted(TAG_TIE_BREAKER) .findFirst(); <END> if (match.isPresent()) { return match; } return Optional.empty(); } }</code><technical_language>Is this line wrap necessary</technical_language>

Target:
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } return matchingTags.sorted(TAG_TIE_BREAKER).findFirst(); } }
Source:
<code>private boolean isCurrentNetworkSufficient(WifiInfo wifiInfo, boolean is5GHzAvailable) { WifiConfiguration network = mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); if (network == null) { localLog("No current connected network."); return false; } else { localLog("Current connected network: " + network.SSID + " , ID: " + network.networkId); } if (network.ephemeral) { localLog("Current network is an ephemeral one."); return false; } if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { localLog("Current network is a open one."); return false; } int currentRssi = wifiInfo.getRssi(); if (wifiInfo.is24GHz()) { if (is5GHzAvailable) { localLog("Current network is 2.4GHz. <START> No 5GHz networks available."); <END> return false; } if (currentRssi < mThresholdQualifiedRssi24) { localLog("Current network band=2.4GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else if (wifiInfo.is5GHz()) { if (currentRssi < mThresholdQualifiedRssi5) { localLog("Current network band=5GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else { Log.wtf(TAG, "We're on a wifi network that's neither 2.4 or 5GHz... aliens!"); } return true; }</code><technical_language>wanted 5GHz is available</technical_language>

Target:
private boolean isCurrentNetworkSufficient(WifiInfo wifiInfo, boolean is5GHzAvailable) { WifiConfiguration network = mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); if (network == null) { localLog("No current connected network."); return false; } else { localLog("Current connected network: " + network.SSID + " , ID: " + network.networkId); } if (network.ephemeral) { localLog("Current network is an ephemeral one."); return false; } if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { localLog("Current network is a open one."); return false; } int currentRssi = wifiInfo.getRssi(); if (wifiInfo.is24GHz()) { if (is5GHzAvailable) { localLog("Current network is 2.4GHz. 5GHz networks available."); return false; } if (currentRssi < mThresholdQualifiedRssi24) { localLog("Current network band=2.4GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else if (wifiInfo.is5GHz()) { if (currentRssi < mThresholdQualifiedRssi5) { localLog("Current network band=5GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else { Log.e(TAG, "We're on a wifi network that's neither 2.4 or 5GHz... aliens!"); } return true; }
Source:
<code>public FeedbackResponseCommentRow(FeedbackResponseCommentAttributes frc, String giverDisplay, <START> Map<String, String> instructorEmailNameTable) { <END> this.instructorEmailNameTable = instructorEmailNameTable; this.commentId = frc.getId(); this.giverDisplay = giverDisplay; this.createdAt = TimeHelper.formatDateTimeForComments(frc.createdAt); this.commentText = frc.commentText.getValue(); setCommentGiverName(giverDisplay); setCommentLastEditorName(frc.lastEditorEmail); this.questionId = frc.feedbackQuestionId; this.editedAt = setEditedAtText(frc.createdAt, frc.lastEditedAt); }</code><technical_language>8 spaces instead of custom indentation here</technical_language>

Target:
public FeedbackResponseCommentRow(FeedbackResponseCommentAttributes frc, String giverDisplay, Map<String, String> instructorEmailNameTable) { this.instructorEmailNameTable = instructorEmailNameTable; this.commentId = frc.getId(); this.giverDisplay = giverDisplay; this.createdAt = TimeHelper.formatDateTimeForComments(frc.createdAt); this.commentText = frc.commentText.getValue(); this.commentGiverName = getCommentGiverNameFromEmail(giverDisplay); this.editedAt = getEditedAtText(frc.lastEditorEmail, frc.createdAt, frc.lastEditedAt); }
Source:
<code>public Value valueOf(@Nullable String string) { if(string == null) { return nullValue(); } List<Coordinate> line; Coordinate coordinate; try { JSONArray array = new JSONArray(string.trim()); line = new ArrayList<Coordinate>(array.length()); for(int i = 0; i < array.length(); i++) { coordinate = Coordinate.valueOf(array.getString(i)); line.add(coordinate); } } catch(JSONException e) { <START> throw new MagmaRuntimeException("Invalid Polygon format", e); <END> } if(line.isEmpty()) { throw new MagmaRuntimeException("The polygon can't be empty"); } return Factory.newValue(this, (Serializable) line); }</code><technical_language>"Invalid Line format"</technical_language>

Target:
public Value valueOf(@Nullable String string) { if(string == null) { return nullValue(); } try { JSONArray array = new JSONArray(string.trim()); return valueOf(array); } catch(JSONException e) { throw new MagmaRuntimeException("Invalid Line format", e); } }
Source:
<code>public void setup() { mockRunLoop = mock(RunLoop.class); mockOnSignal = mock(Runnable.class); <START> container = StreamProcessorTestUtils.getDummyContainer(mockRunLoop, Mockito.mock(StreamTask.class)); <END> processorLifecycleListener = mock(ProcessorLifecycleListener.class); clusterBasedProcessorLifecycleListener = spy(new ClusterBasedProcessorLifecycleListener(new MapConfig(ImmutableMap.of(TaskConfig.TASK_SHUTDOWN_MS, "1")), processorLifecycleListener, mockOnSignal)); container.setContainerListener(clusterBasedProcessorLifecycleListener); doNothing().when(clusterBasedProcessorLifecycleListener).addJVMShutdownHook(); doNothing().when(clusterBasedProcessorLifecycleListener).removeJVMShutdownHook(); }</code><technical_language>A unit test for ClusterBasedProcessorLifecycleListener require setting a SamzaContainer. need call methods of listener directly. If test listener lifecycle methods properly called, tests belong in test for SamzaContainer</technical_language>

Target:
public void setup() { mockShutdownHookCallback = mock(Runnable.class); processorLifecycleListener = mock(ProcessorLifecycleListener.class); clusterBasedProcessorLifecycleListener = spy(new ClusterBasedProcessorLifecycleListener(new MapConfig(ImmutableMap.of(TaskConfig.TASK_SHUTDOWN_MS, "1")), processorLifecycleListener, mockShutdownHookCallback)); doNothing().when(clusterBasedProcessorLifecycleListener).addJVMShutdownHook(any(Thread.class)); doNothing().when(clusterBasedProcessorLifecycleListener).removeJVMShutdownHook(any(Thread.class)); }
Source:
<code>public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { ErlangFunctionCallExpression callExpr = PsiTreeUtil.getParentOfType( descriptor.getPsiElement(), ErlangFunctionCallExpression.class); if (callExpr == null) return; <START> callExpr.replace(ErlangElementFactory.createFunctionWithModuleCallExpression(project, myModuleName, callExpr.getText())); <END> }</code><technical_language>Invert if statement please</technical_language>

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { ErlangFunctionCallExpression callExpr = PsiTreeUtil.getParentOfType( descriptor.getPsiElement(), ErlangFunctionCallExpression.class); if (callExpr != null) { callExpr.replace(ErlangElementFactory.createFunctionWithModuleCallExpression(project, myModuleName, callExpr.getText())); } }
Source:
<code>public PatchSetInserter setValidatePolicy(ValidatePolicy validate) { <START> this.validatePolicy = validate; <END> return this; }</code><technical_language>checkNotNull</technical_language>

Target:
public PatchSetInserter setValidatePolicy(ValidatePolicy validate) { this.validatePolicy = checkNotNull(validate); return this; }
Source:
<code>public void use_statements() throws Exception { SymbolTableImpl symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A as Alias;\n" + "$a = new Alias();"); <START> assertSymbolUsages(symbolTable, "\\N1\\A", 4); <END> }</code><technical_language>a test a alias</technical_language>

Target:
public void use_statements() throws Exception { SymbolTableImpl symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A as Alias;\n" + "$a = new Alias();"); assertSymbolUsages(symbolTable, "\\n1\\a", 4); symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A;\n" + "$a = new A();"); assertSymbolUsages(symbolTable, "\\n1\\a", 4); }
Source:
<code>private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name, <START> String userName) { <END> Preconditions.checkNotNull(noteId, "noteId should be not null"); Preconditions.checkNotNull(setting, "setting should be not null"); Preconditions.checkNotNull(name, "name should be not null"); String className; if (null != (className = getInterpreterClassFromInterpreterSetting(setting, name))) { List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId + userName, setting); for (Interpreter interpreter : interpreterGroup) { if (className.equals(interpreter.getClassName())) { return interpreter; } } } return null; }</code><technical_language>a nitpick, horizontal alignment is controversial idea generally [is discouraged styleguide](<LINK_0> creates a "blast radius" of re-formatting in case of future changes i.e renaming a function</technical_language>

Target:
private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name, String userName) { Preconditions.checkNotNull(noteId, "noteId should be not null"); Preconditions.checkNotNull(setting, "setting should be not null"); Preconditions.checkNotNull(name, "name should be not null"); String className; if (null != (className = getInterpreterClassFromInterpreterSetting(setting, name))) { List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId, setting, userName); for (Interpreter interpreter : interpreterGroup) { if (className.equals(interpreter.getClassName())) { return interpreter; } } } return null; }
Source:
<code>public Object[][] validValues() { return new Object[][] { {"2048", 2048L}, <START> {"1gb", 1073741824L}, <END> {"2g", 2147483648L}, {"1073741824", 1073741824L}, {"8m", 8388608L}, {"200mb", 209715200L}, {"5k", 5120L}, {"10kb", 10240L}, }; }</code><technical_language>replace magic constants evaluated constants? E.g. private static final long = 1024; ... private static final long G = 1024 * M; {"1gb", 1 * G},</technical_language>

Target:
public Object[][] validValues() { return new Object[][] { {"2048", 2048L}, {"1gb", 1 * G}, {"2g", 2 * G}, {"1073741824", 1 * G}, {"8m", 8 * M}, {"200mb", 200 * M}, {"5k", 5 * K}, {"10kb", 10 * K}, }; }
Source:
<code><START> private void addToLog(final String logItem) { argumentLog.append(" | " + logItem) ; } <END></code><technical_language>append instead of +</technical_language>

Target:
private void addToLog(final String logItem) { argumentLog.append(" | " ).append(logItem) ; }
Source:
<code>public <E extends SQLEntity> void computeBatches(Class<E> type, @Nullable Consumer<SmartQuery<E>> queryExtender, int batchSize, Consumer<JSONObject> batchConsumer) { TaskContext taskContext = TaskContext.get(); ValueHolder<Long> lastLimit = ValueHolder.of(0L); while (taskContext.isActive()) { ValueHolder<Long> nextLimit = ValueHolder.of(lastLimit.get()); SmartQuery<E> query = oma.selectFromSecondary(type) .fields(SQLEntity.ID) .where(OMA.FILTERS.gt(SQLEntity.ID, lastLimit.get())); if (queryExtender != null) { queryExtender.accept(query); } query.orderAsc(SQLEntity.ID).limit(batchSize).iterateAll(e -> { nextLimit.set(e.getId()); }); <START> JSONObject batch = new JSONObject(); <END> batch.put(START_ID, lastLimit.get()); batch.put(END_ID, nextLimit.get()); batchConsumer.accept(batch); if (lastLimit.get().equals(nextLimit.get())) { return; } lastLimit.set(nextLimit.get()); } }</code><technical_language>Missing TYPE</technical_language>

Target:
public <E extends SQLEntity> void computeBatches(Class<E> type, @Nullable Consumer<SmartQuery<E>> queryExtender, int batchSize, Consumer<JSONObject> batchConsumer) { TaskContext taskContext = TaskContext.get(); ValueHolder<Long> lastLimit = ValueHolder.of(0L); while (taskContext.isActive()) { ValueHolder<Long> nextLimit = ValueHolder.of(lastLimit.get()); SmartQuery<E> query = oma.selectFromSecondary(type) .fields(SQLEntity.ID) .where(OMA.FILTERS.gt(SQLEntity.ID, lastLimit.get())); if (queryExtender != null) { queryExtender.accept(query); } query.orderAsc(SQLEntity.ID).limit(batchSize).iterateAll(e -> { nextLimit.set(e.getId()); }); JSONObject batch = new JSONObject(); batch.put(TYPE, Mixing.getNameForType(type)); batch.put(START_ID, lastLimit.get()); batch.put(END_ID, nextLimit.get()); batchConsumer.accept(batch); if (lastLimit.get().equals(nextLimit.get())) { return; } lastLimit.set(nextLimit.get()); } }
Source:
<code>public void testGetEventType() { <START> Set<ITmfEventType> result = fixture.getEventTypes(); <END> assertNotNull(result); }</code><technical_language>getEventType() getEventTypes() method!!!! Means this naming is confusing then</technical_language>

Target:
public void testGetEventType() { Class<?> result = fixture.getEventType(); assertNotNull(result); assertEquals(CtfTmfEvent.class, result); }
Source:
<code>public void copyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() throws IOException { <START> File srcDir = temporaryFolder.newFile("notadirectory"); <END> File destDir = temporaryFolder.newFolder("destinationDirectory"); String expectedMessage = String.format("Source '%s' is not a directory", srcDir); assertExceptionTypeAndMessage(srcDir, destDir, IllegalArgumentException.class, expectedMessage); }</code><technical_language>final possible</technical_language>

Target:
public void copyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() throws IOException { final File srcDir = temporaryFolder.newFile("notadirectory"); final File destDir = temporaryFolder.newFolder("destinationDirectory"); final String expectedMessage = String.format("Source '%s' is not a directory", srcDir); assertExceptionTypeAndMessage(srcDir, destDir, IllegalArgumentException.class, expectedMessage); }
Source:
<code>public List<String> getMoreStable(String branch) { int i = order.indexOf(fullName(branch)); if (0 <= i) { <START> return order.subList(i + 1, order.size()); <END> } else { return Collections.emptyList(); } }</code><technical_language>This subList mutable caller</technical_language>

Target:
public List<String> getMoreStable(String branch) { int i = order.indexOf(fullName(branch)); if (0 <= i) { return order.subList(i + 1, order.size()); } else { return ImmutableList.of(); } }
Source:
<code>public void removeUserTuneListener(UserTuneListener listener) { <START> synchronized (listener) { <END> userTuneListeners.remove(listener); } }</code><technical_language>need synchronize userTuneListeners, listener</technical_language>

Target:
public void removeUserTuneListener(UserTuneListener listener) { synchronized (userTuneListeners) { userTuneListeners.remove(listener); } }
Source:
<code>private static void runPrepareSandboxTask() { Path exercisePath = getExercisePathFromArgs(); Path submissionPath = getSubmissionPathFromArgs(); Path outputPath = getOutputPathFromArgs(); Path tmcRunPath = getTmcRunPathFromArgs(); Path tmcLangsPath = getTmcLangsPathFromArgs(); try { executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); } catch (NoLanguagePluginFoundException ex) { logger.error( "No suitable language plugin for project at {}", exercisePath, ex); printErrAndExit( "ERROR: Could not find suitable language plugin for the given " + "exercise path."); } catch (IOException e) { logger.error( "An error occurred while preparing task.", e); printErrAndExit( <START> "ERROR: Could not prepare task." <END> ); } }</code><technical_language>of logger.error() printErrAndExit() calls in this chunk of changes fit single lines</technical_language>

Target:
private static void runPrepareSandboxTask() { Path exercisePath = getExercisePathFromArgs(); Path submissionPath = getSubmissionPathFromArgs(); Path outputPath = getOutputPathFromArgs(); Path tmcRunPath = getTmcRunPathFromArgs(); Path tmcLangsPath = getTmcLangsPathFromArgs(); try { executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); } catch (NoLanguagePluginFoundException ex) { logger.error("No suitable language plugin for project at {}", exercisePath, ex); printErrAndExit("ERROR: Could not find suitable language plugin for the given exercise path."); } catch (IOException e) { logger.error("An error occurred while preparing task.", e); printErrAndExit("ERROR: Could not prepare task."); } }
Source:
<code>protected String buildURI() { try { return super.buildURI() + "/_scripts/" + scriptLanguage.pathParameterName + "/" + URLEncoder.encode(scriptName, CHARSET); } catch (UnsupportedEncodingException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>behaviour super.buildURI (and places UnsupportedEncodingException is thrown)... Please consistent - change this other ones. this expected if class is extended charset is overridden</technical_language>

Target:
protected String buildURI() { String finalUri = super.buildURI() + "/_scripts/" + scriptLanguage.pathParameterName + "/"; try { finalUri += encode(scriptName, CHARSET); } catch (UnsupportedEncodingException e) { log.error("Error occurred while adding parameters to uri.", e); } return finalUri; }
Source:
<code>public void registerIdentityChangeListener(Consumer<Principal> listener) { DirContext dirContext = null; try { dirContext = obtainContext(); <START> registerIdentityChangeListener(dirContext,listener); <END> } catch (Exception cause) { synchronized (this.listenersPendingRegistration) { listenersPendingRegistration.add(listener); } log.ldapRealmDeferRegistration(); if(log.isDebugEnabled()){ log.debug("Listener registration failure: ", cause); } } finally { if (dirContext != null) { closeContext(dirContext); } } }</code><technical_language>a potential race this: Thread 1 | Thread 2 ------|------ registerIdentityChangeListener fails| -|connection succeeds -|listeners pending registration added (empty) listener added pending registration list| listener is called</technical_language>

Target:
public void registerIdentityChangeListener(Consumer<Principal> listener) { synchronized (this.listenersPendingRegistration) { DirContext dirContext = null; try { dirContext = obtainContext(); registerIdentityChangeListener(dirContext, listener); } catch (Exception cause) { listenersPendingRegistration.add(listener); log.ldapRealmDeferRegistration(); if (log.isDebugEnabled()) { log.debug("Listener registration failure: ", cause); } } finally { if (dirContext != null) { closeContext(dirContext); } } } }
Source:
<code>private void createRemoteDirectory(FTPClient ftpClient, String remoteDirPath) throws IOException { <START> ArrayList folderList = new ArrayList<>(Arrays.asList(ftpClient.listDirectories())); <END> ArrayList<String> folderNames = new ArrayList(); for (int i = 0; i < folderList.size(); i++) { folderNames.add(((FTPFile) (folderList.get(i))).getName()); } if (!folderNames.contains(remoteDirPath)) { if (ftpClient.makeDirectory(remoteDirPath)) { getOut().println("CREATED the directory: " + remoteDirPath); } else { throw new IOException("Error: COULD NOT create the directory: " + remoteDirPath); } } else { throw new IOException("Error: COULD NOT create an existing directory: " + remoteDirPath); } }</code><technical_language>Is type ArrayList generics here</technical_language>

Target:
private void createRemoteDirectory(FTPClient ftpClient, String remoteDirPath) throws IOException { ArrayList<FTPFile> folderList = new ArrayList(Arrays.asList(ftpClient.listDirectories())); ArrayList<String> folderNames = new ArrayList(); for (int i = 0; i < folderList.size(); i++) { folderNames.add(folderList.get(i).getName()); } if (!folderNames.contains(remoteDirPath)) { if (ftpClient.makeDirectory(remoteDirPath)) { getOut().println("CREATED the directory: " + remoteDirPath); } else { throw new IOException("Error: COULD NOT create the directory: " + remoteDirPath); } } else { throw new IOException("Error: COULD NOT create an existing directory: " + remoteDirPath); } }
Source:
<code>private NumericExprEval(@Nullable Number value) { <START> super(value == null ? NullHandling.defaultDoubleValue() : value); <END> }</code><technical_language>I specific for Double/Long</technical_language>

Target:
private NumericExprEval(@Nullable Number value) { super(value); }
Source:
<code>protected void setUploadSizeMax(final ServletFileUpload serviceFileUpload, final HttpServletRequest request) { <START> serviceFileUpload.setFileSizeMax(getConsoleProperties(getAPISession(request).getTenantId()).getMaxSize() * 1048576); <END> }</code><technical_language>1048576: this number from? shoudl a constant explained</technical_language>

Target:
protected void setUploadSizeMax(final ServletFileUpload serviceFileUpload, final HttpServletRequest request) { serviceFileUpload.setFileSizeMax(getConsoleProperties(getAPISession(request).getTenantId()).getMaxSize() * MEGABYTE); }
Source:
<code>public void groupBy(StructuredRecord record, Emitter<String> emitter) throws Exception { if (record.get(keyField) == null) { if (record.getSchema().getField(keyField) == null) { throw new IllegalArgumentException( String.format("Keyfield '%s' does not exist in input schema %s", keyField, record.getSchema())); } <START> StructuredRecord.Builder droppedRecordBuilder = StructuredRecord.builder(errorRecordSchema); <END> droppedRecordBuilder.set(KEY, recordCounter++); droppedRecordBuilder.set(RECORD, StructuredRecordStringConverter.toJsonString(record)); Table errorTable = batchRuntimeContext.getDataset(conf.getErrorDataset()); errorTable.write(droppedRecordBuilder.build()); return; } if (record.get(nameField) == null && record.getSchema().getField(nameField) == null) { throw new IllegalArgumentException( String.format("Namefield '%s' does not exist in input schema %s", nameField, record.getSchema())); } if (record.get(valueField) == null && record.getSchema().getField(valueField) == null) { throw new IllegalArgumentException( String.format("Valuefield '%s' does not exist in input schema %s", valueField, record.getSchema())); } emitter.emit((String) record.get(keyField)); }</code><technical_language>recordCounter key? is unique reducer right? number of reducers for RowDenormalizer plugin? If is case, values overridden, it</technical_language>

Target:
public void groupBy(StructuredRecord record, Emitter<String> emitter) throws Exception { if (record.get(keyField) == null) { if (record.getSchema().getField(keyField) == null) { throw new IllegalArgumentException( String.format("Keyfield '%s' does not exist in input schema %s", keyField, record.getSchema())); } StructuredRecord.Builder droppedRecordBuilder = StructuredRecord.builder(errorRecordSchema); droppedRecordBuilder.set(TS, System.currentTimeMillis()); droppedRecordBuilder.set(RECORD, StructuredRecordStringConverter.toJsonString(record)); Table errorTable = batchRuntimeContext.getDataset(conf.getErrorDataset()); errorTable.write(droppedRecordBuilder.build()); return; } if (record.get(nameField) == null && record.getSchema().getField(nameField) == null) { throw new IllegalArgumentException( String.format("Namefield '%s' does not exist in input schema %s", nameField, record.getSchema())); } if (record.get(valueField) == null && record.getSchema().getField(valueField) == null) { throw new IllegalArgumentException( String.format("Valuefield '%s' does not exist in input schema %s", valueField, record.getSchema())); } emitter.emit((String) record.get(keyField)); }
Source:
<code>static Throwable getExceptionDetails(ITestContext context, Object instance) { Set<ITestResult> configResults = context.getFailedConfigurations().getAllResults(); if (configResults.isEmpty()) { <START> configResults = context.getSkippedConfigurations().getAllResults(); <END> } for (ITestResult configResult : configResults) { if (sameInstance(configResult, instance)) { return configResult.getThrowable(); } } if (configResults.isEmpty()) { return getConfigFailureException(context); } else { return configResults.iterator().next().getThrowable(); } }</code><technical_language>add skipped in cases</technical_language>

Target:
static Throwable getExceptionDetails(ITestContext context, Object instance) { Set<ITestResult> configResults = context.getFailedConfigurations().getAllResults(); if (configResults.isEmpty()) { configResults = context.getSkippedConfigurations().getAllResults(); } if (configResults.isEmpty()) { return getConfigFailureException(context); } for (ITestResult configResult : configResults) { if (sameInstance(configResult, instance)) { return configResult.getThrowable(); } } return configResults.iterator().next().getThrowable(); }
Source:
<code>public void changeDiscoveryMode(){ prepareBeanXml("all", true); <START> setBeansXmlTags(Arrays.asList("alternatives", "decorators", "interceptors","scan")); <END> }</code><technical_language>O noticed new tag in beans.xml file. <LINK_0> check this tag here</technical_language>

Target:
public void changeDiscoveryMode(){ prepareBeanXml("all", true); setBeansXmlTags(Arrays.asList("alternatives", "decorators", "interceptors","scan", "trim")); }
Source:
<code>public void applyTransformer(CompoundTransformer transformer) { <START> if (transformer!=null) <END> transformers.add(transformer); }</code><technical_language>I a general preference for ignore nulls this. a serious risk of ignoring problems surprising behaviour, convenience of caller check for null. time I lean accepting nulls is if in a fluent API</technical_language>

Target:
public void applyTransformer(CompoundTransformer transformer) { transformers.add(Preconditions.checkNotNull(transformer, "transformer")); }
Source:
<code>public ResponseEntity<Object> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); SyndicationTarget syndicationTarget = getSyndicationTarget(input); String queue = input.getQueue(); if (Strings.isNullOrEmpty(queue)) { <START> queue = "activemq:plos." + syndicationTarget.getLabel().toLowerCase(); <END> } Syndication created = syndicationCrudService.syndicate(versionId, syndicationTarget, queue); return reportOk(created.toString()); }</code><technical_language>significance of "plos" here? configuration? EDIT: client input, if possible</technical_language>

Target:
public ResponseEntity<Object> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); Syndication created = syndicationCrudService.syndicate(versionId, input.getTargetQueue()); return reportOk(created.toString()); }
Source:
<code>public Shard getShard(String docId) { assertNotEmpty(docId, "docId"); <START> return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards/") <END> .path(docId).build(), Shard.class); }</code><technical_language>Remove trailing "/"</technical_language>

Target:
public Shard getShard(String docId) { assertNotEmpty(docId, "docId"); return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards") .path(docId).build(), Shard.class); }
Source:
<code>public Response button() { final String build = RestTester.start( UriBuilder.fromUri("<LINK_0>").path(this.stand) .build() ) .header("Accept", MediaType.APPLICATION_XML_UTF_8.toString()) .get("retrieve stand") .getBody(); final SimpleXml xml = new SimpleXml(build); final String head = String.format( "/page/widgets/widget[@class='com.rultor.widget.BuildHealth']/builds/build[coordinates/rule='%s'][1]", this.rule ); final String code = xml .xpath(String.format("%s/code/text()", head)).get(0); final String duration = xml .xpath(String.format("%s/duration/text()", head)).get(0); final String health = xml .xpath(String.format("%s/health/text()", head)).get(0); final BufferedImage img; try { img = ImageIO .read(this.getClass().getResourceAsStream("/build_health.png")); } catch (IOException ex) { <START> throw new IllegalStateException(ex); <END> } final BufferedImage image = new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB ); final Graphics2D gfx = image.createGraphics(); gfx.drawImage(img, 0, 0, null); gfx.setFont(new Font("Serif", Font.PLAIN, 10)); drawString(gfx, Arrays.asList(code, duration, health)); gfx.dispose(); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", stream); } catch (IOException ex) { throw new IllegalStateException(ex); } return Response.ok(stream.toByteArray(), MediaType.PNG.toString()) .build(); }</code><technical_language>Runtime exception lead page 500 Internal Server Error. happen if this IOException bubble up. So, 1) declare this method throws Exception get rid of catch, 2) return a proper response some message (see done in StandRs#stand(): throw this.flash().redirect(this.uriInfo().getBaseUri(), ex);)</technical_language>

Target:
public Response button() throws Exception { final List<String> health = this.info( this.build.info( this.uriInfo().getBaseUri(), this.stand ) ); return Response.ok(draw(health), MediaType.PNG.toString()).build(); }
Source:
<code>private void setDefaultCategoryIcons(List<CategoryDTO> categoryDTOS) { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categoryDTOS) { <START> cssBuilder.append("#" + category.getName().toLowerCase() + "Button{\n"); <END> String categoryIcon = category.getIcon(); if (StringUtils.isEmpty(categoryIcon)) { cssBuilder.append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); this.view.getTabPane().getScene().getStylesheets().clear(); this.view.getTabPane().getScene().getStylesheets().addAll(defaultCategoryIconsCss, themeManager.getDefaultEngineIconsCss(), style.toExternalForm()); } catch (Exception e) { LOGGER.warn("Could not set default category icons.", e); } }</code><technical_language>need chain .append here</technical_language>

Target:
private void setDefaultCategoryIcons(List<CategoryDTO> categoryDTOS) { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categoryDTOS) { cssBuilder.append("#" + category.getName().toLowerCase() + "Button{\n"); String categoryIcon = category.getIcon(); if (StringUtils.isEmpty(categoryIcon)) { cssBuilder.append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); this.view.getTabPane().getScene().getStylesheets().clear(); this.view.getTabPane().getScene().getStylesheets().addAll(defaultCategoryIconsCss, themeManager.getDefaultEngineIconsCss(), style.toExternalForm()); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }