auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void runSequencerTrim(Duration interval) { log.trace("Trim sequencer address space at round"); CorfuRuntime rt = getCorfuRuntime(); if (!rt.getLayoutView().getLayout().getPrimarySequencer() .equals(serverContext.getLocalEndpoint())) { return; } List<UUID> streamIds = rt.getSequencerView().getStreamsId(); <START> List<List<UUID>> batches = Lists.partition(streamIds, BATCH_SIZE); <END> if (batches.isEmpty()) return; int batchNum = batches.size(); long batchIntervalInMillis = interval.toMillis() / batchNum; for (int i = 0; i < batchNum; ++i) { List<UUID> batch = batches.get(i); sequencerBatchTrimScheduler .schedule(() -> getCorfuRuntime().getSequencerView().addressSpaceTrimInBatch(batch), i * batchIntervalInMillis, TimeUnit.MILLISECONDS); } }</code><technical_language>need update layout check primary sequencer, this: java getCorfuRuntime() .invalidateLayout() .thenApply(serverContext::saveManagementLayout) .join();</technical_language>

Target:
public void runSequencerTrim(Duration interval) { log.trace("Trim sequencer address space at round"); CorfuRuntime rt = getCorfuRuntime(); getCorfuRuntime() .invalidateLayout() .thenApply(serverContext::saveManagementLayout) .join(); if (!rt.getLayoutView().getLayout().getPrimarySequencer() .equals(serverContext.getLocalEndpoint())) { return; } List<UUID> streamIds = rt.getSequencerView().getStreamsId(); List<List<UUID>> batches = Lists.partition(streamIds, BATCH_SIZE); if (batches.isEmpty()) { return; } int batchNum = batches.size(); long batchIntervalInMillis = interval.toMillis() / batchNum; for (int i = 0; i < batchNum; ++i) { List<UUID> batch = batches.get(i); sequencerBatchTrimScheduler .schedule(() -> getCorfuRuntime().getSequencerView().addressSpaceTrimInBatch(batch), i * batchIntervalInMillis, TimeUnit.MILLISECONDS); } }
Source:
<code>private String parseTestName(JsonElement test) { String testName = test.getAsJsonObject().get("className").toString(); <START> testName = testName.substring(1, testName.length() - 1); <END> return testName + " " + test.getAsJsonObject().get("methodName").getAsString(); }</code><technical_language>Ah, this fixed changing toString getAsString</technical_language>

Target:
private String parseTestName(JsonElement test) { String testName = test.getAsJsonObject().get("className").getAsString(); return testName + " " + test.getAsJsonObject().get("methodName").getAsString(); }
Source:
<code>public void setOS(String os) { incrementSequenceNumber(); fOS = os; if (fRoot != null && os != null && <START> os.length() > 0) { <END> Element nlNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.OS); nlNode.setTextContent(os); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.OS); } }</code><technical_language>Please !string.isEmpty()</technical_language>

Target:
public void setOS(String os) { incrementSequenceNumber(); fOS = os; if (fRoot != null && os != null && !os.isEmpty()) { Element nlNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.OS); nlNode.setTextContent(os); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.OS); } }
Source:
<code>public void handleFailureMessage( String code, String message ) { log.debug( "S: FAILURE %s \"%s\"", code, message ); currentError = ErrorUtil.newNeo4jError( code, message ); if ( ErrorUtil.isFatal( currentError ) ) { channel.pipeline().fireExceptionCaught( currentError ); return; } <START> queue( new ResetResponseHandler( this, null ) ); <END> channel.writeAndFlush( RESET, channel.voidPromise() ); ResponseHandler handler = handlers.remove(); handler.onFailure( currentError ); }</code><technical_language>create a constructor takes InboundMessageDispatcher null ResetResponseHandler. pass null explicitly parameter</technical_language>

Target:
public void handleFailureMessage( String code, String message ) { log.debug( "S: FAILURE %s \"%s\"", code, message ); currentError = ErrorUtil.newNeo4jError( code, message ); if ( ErrorUtil.isFatal( currentError ) ) { channel.pipeline().fireExceptionCaught( currentError ); return; } queue( new ResetResponseHandler( this ) ); channel.writeAndFlush( RESET, channel.voidPromise() ); ResponseHandler handler = handlers.remove(); handler.onFailure( currentError ); }
Source:
<code><START> private <T extends AbstractController> void assertUniqueMethodMapping(T c) { <END> Set<RequestMappingInfo> requestMappingInfoSet = requestMappingHandlerMapping.getHandlerMethods().keySet(); for(RequestMappingInfo requestMappingInfo : requestMappingInfoSet){ Set<String> patterns = requestMappingInfo.getPatternsCondition().getPatterns(); for(String pattern: patterns){ if(c.getUri() != null && c.getUri().equals(pattern)){ HandlerMethod handlerMethod = requestMappingHandlerMapping.getHandlerMethods().get(requestMappingInfo); throw new IllegalStateException("Mapping conflict. Stormpath cannot map '" + c.getUri() + "'. " + "There is already '" + handlerMethod.getBean() + "' bean method\n" + handlerMethod + " mapped."); } } } }</code><technical_language>Please reformat IntelliJ's default settings (e.g. space for, space if, brace, etc). Thanks</technical_language>

Target:
private <T extends AbstractController> void assertUniqueMethodMapping(T c) { Set<RequestMappingInfo> requestMappingInfoSet = requestMappingHandlerMapping.getHandlerMethods().keySet(); for (RequestMappingInfo requestMappingInfo : requestMappingInfoSet) { Set<String> patterns = requestMappingInfo.getPatternsCondition().getPatterns(); for (String pattern: patterns) { if (c.getUri() != null && c.getUri().equals(pattern)) { HandlerMethod handlerMethod = requestMappingHandlerMapping.getHandlerMethods().get(requestMappingInfo); throw new IllegalStateException("Mapping conflict: Stormpath cannot map '" + c.getUri() + "'. " + handlerMethod.getBean() + "#" + handlerMethod + " is already mapped to this URI."); } } } }
Source:
<code>public void updateLoanRepayment(LoanRepaymentRequest loanRepaymentRequest) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerLoan.updateLoanRepaymentTransaction(loanRepaymentRequest) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<LoanRepaymentRequest>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); <START> getMvpView().showError("Failed to Update LoanRepayment"); <END> } @Override public void onNext(LoanRepaymentRequest loanRepaymentRequest) { getMvpView().showProgressbar(false); getMvpView().showLoanRepaymentUpdated(loanRepaymentRequest); } }) ); }</code><technical_language>hardcoded strings</technical_language>

Target:
public void updateLoanRepayment(LoanRepaymentRequest loanRepaymentRequest) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerLoan.updateLoanRepaymentTransaction(loanRepaymentRequest) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<LoanRepaymentRequest>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_load_loanrepayment); } @Override public void onNext(LoanRepaymentRequest loanRepaymentRequest) { getMvpView().showProgressbar(false); getMvpView().showLoanRepaymentUpdated(loanRepaymentRequest); } }) ); }
Source:
<code>public List<Object> getChartSamplePoints(int tenantId, String user, long versionsetId, String featureListString) throws DatabaseHandlerException { List<Object> points = new ArrayList<Object>(); SamplePoints sample = getVersionsetSample(tenantId, user, versionsetId); List<List<String>> columnData = sample.getSamplePoints(); Map<String, Integer> dataHeaders = sample.getHeader(); if (featureListString == null || featureListString.isEmpty()) { return points; } String[] featureList = featureListString.split(","); for(int i=0; i<featureList.length; i++){ <START> if(!dataHeaders.containsKey(featureList[i])) <END> throw new DatabaseHandlerException(String.format("%s is not a feature of version set Id: %s", featureList[i], versionsetId)); } for (int row = 0; row < columnData.get(dataHeaders.get(featureList[0])).size(); row++) { Map<String, Object> data = new HashMap<String, Object>(); for (int featureCount = 0; featureCount < featureList.length; featureCount++) { data.put(featureList[featureCount], columnData.get(dataHeaders.get(featureList[featureCount])) .get(row)); } points.add(data); } return points; }</code><technical_language>Braces missing. Please format code added (only diff)</technical_language>

Target:
public List<Object> getChartSamplePoints(int tenantId, String user, long versionsetId, String featureListString) throws DatabaseHandlerException { List<Object> points = new ArrayList<Object>(); SamplePoints sample = getVersionsetSample(tenantId, user, versionsetId); List<List<String>> columnData = sample.getSamplePoints(); Map<String, Integer> dataHeaders = sample.getHeader(); if (featureListString == null || featureListString.isEmpty()) { return points; } String[] featureList = featureListString.split(","); for (String feature: featureList) { if (!dataHeaders.containsKey(feature)) { throw new DatabaseHandlerException(String.format("%s is not a feature of version set Id: %s", feature, versionsetId)); } } for (int row = 0; row < columnData.get(dataHeaders.get(featureList[0])).size(); row++) { Map<String, Object> data = new HashMap<String, Object>(); for (int featureCount = 0; featureCount < featureList.length; featureCount++) { data.put(featureList[featureCount], columnData.get(dataHeaders.get(featureList[featureCount])) .get(row)); } points.add(data); } return points; }
Source:
<code>public void addAll(final List<T> objects, final List<? extends Locatable> intervals) { <START> invalidateAllObjectsCache(); <END> if (objects == null) { throw new IllegalArgumentException("null objects"); } if (intervals == null) { throw new IllegalArgumentException("null intervals"); } if (objects.size() != intervals.size()) { throw new IllegalArgumentException("Objects and intervals must be the same size but were " + objects.size() + " and " + intervals.size()); } for (int i=0; i<objects.size(); ++i) { addLhs(objects.get(i), intervals.get(i)); } }</code><technical_language>This is unnecessary this method calls addLhs() invalidates cache</technical_language>

Target:
public void addAll(final List<T> objects, final List<? extends Locatable> intervals) { if (objects == null) { throw new IllegalArgumentException("null objects"); } if (intervals == null) { throw new IllegalArgumentException("null intervals"); } if (objects.size() != intervals.size()) { throw new IllegalArgumentException("Objects and intervals must be the same size but were " + objects.size() + " and " + intervals.size()); } for (int i=0; i<objects.size(); ++i) { addLhs(objects.get(i), intervals.get(i)); } }
Source:
<code><START> protected static String parseRole(List<Descriptor> roleDescriptors) { <END> for (int i = 0; i < roleDescriptors.size(); i++) { Descriptor descriptor = roleDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equals(descriptor.schemeIdUri) && descriptor.value != null) { return descriptor.value; } } return null; }</code><technical_language>Making non-static allow overriding fine me. move grouped other protected non-static methods. Note suggestions I issue, methods return @Role @Accessibility integers respectively</technical_language>

Target:
protected @C.RoleFlags int parseRole(List<Descriptor> roleDescriptors) { @C.RoleFlags int result = 0; for (int i = 0; i < roleDescriptors.size(); i++) { Descriptor descriptor = roleDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseRoleSchemeValue(descriptor.value); } } return result; }
Source:
<code>public PlanCostEstimate visitSort(SortNode node, Void context) { <START> LocalCostEstimate localCost = LocalCostEstimate.ofCpu(getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types)); <END> return costForStreaming(node, localCost); }</code><technical_language>a memory cost equal getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types)</technical_language>

Target:
public PlanCostEstimate visitSort(SortNode node, Void context) { double cpuCost = getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types); double memoryCost = getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types); LocalCostEstimate localCost = LocalCostEstimate.of(cpuCost, memoryCost, 0); return costForAccumulation(node, localCost); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_users); UsersDisplayer usersDisplayer = (UsersDisplayer) findViewById(R.id.usersView); <START> Channel channel = (Channel) getIntent().getSerializableExtra(CHANNEL_EXTRA); <END> presenter = new UsersPresenter( Dependencies.INSTANCE.getUserService(), Dependencies.INSTANCE.getChannelService(), usersDisplayer, channel, new AndroidNavigator(this) ); }</code><technical_language>x: I pass channel extra, name (identifier) a String. This is a good practice</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_users); UsersDisplayer usersDisplayer = (UsersDisplayer) findViewById(R.id.usersView); Channel channel = new Channel( getIntent().getStringExtra(NAME_EXTRA), Channel.Access.valueOf(getIntent().getStringExtra(ACCESS_EXTRA)) ); presenter = new UsersPresenter( Dependencies.INSTANCE.getUserService(), Dependencies.INSTANCE.getChannelService(), usersDisplayer, channel, new AndroidNavigator(this) ); }
Source:
<code>public void testDropNonOutputSymbols() { Symbol a = new Symbol("a"); Symbol b = new Symbol("b"); Symbol c = new Symbol("c"); PlanNodeStatsEstimate estimate = PlanNodeStatsEstimate.builder() .addSymbolStatistics(a, SymbolStatsEstimate.builder().setDistinctValuesCount(20).build()) .addSymbolStatistics(b, SymbolStatsEstimate.builder().setDistinctValuesCount(30).build()) <START> .addSymbolStatistics(c, SymbolStatsEstimate.buildFrom(SymbolStatsEstimate.unknown()).build()) <END> .build(); PlanNodeStatsAssertion.assertThat(normalizer.normalize(estimate, ImmutableList.of(b, c), TypeProvider.copyOf(ImmutableMap.of(b, BIGINT, c, BIGINT)))) .symbolsWithKnownStats(b) .symbolStats(b, symbolAssert -> symbolAssert.distinctValuesCount(30)); }</code><technical_language>SymbolStatsEstimate.buildFrom(SymbolStatsEstimate.unknown()).build() equivalent SymbolStatsEstimate.unknown(). Please simplify</technical_language>

Target:
public void testDropNonOutputSymbols() { Symbol a = new Symbol("a"); Symbol b = new Symbol("b"); Symbol c = new Symbol("c"); PlanNodeStatsEstimate estimate = PlanNodeStatsEstimate.builder() .addSymbolStatistics(a, SymbolStatsEstimate.builder().setDistinctValuesCount(20).build()) .addSymbolStatistics(b, SymbolStatsEstimate.builder().setDistinctValuesCount(30).build()) .addSymbolStatistics(c, SymbolStatsEstimate.unknown()) .build(); PlanNodeStatsAssertion.assertThat(normalizer.normalize(estimate, ImmutableList.of(b, c), TypeProvider.copyOf(ImmutableMap.of(b, BIGINT, c, BIGINT)))) .symbolsWithKnownStats(b) .symbolStats(b, symbolAssert -> symbolAssert.distinctValuesCount(30)); }
Source:
<code>public void reportsRequestResult() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); <START> final Talk talk = ReportsTest.example(repo, issue); <END> final Agent agent = new Reports(repo.github()); agent.execute(talk); MatcherAssert.assertThat( talk.read(), XhtmlMatchers.hasXPath(XPATH) ); }</code><technical_language>@xupyprmv inline this</technical_language>

Target:
public void reportsRequestResult() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Talk talk = ReportsTest.example( repo, repo.issues().create("", "") ); final Agent agent = new Reports(repo.github()); agent.execute(talk); MatcherAssert.assertThat( talk.read(), XhtmlMatchers.hasXPath(XPATH) ); }
Source:
<code>public boolean tryAdvance(Consumer<? super DocumentWriteOperation> action) { try { FormatEntry nextEntry = getNextEntry(); if (nextEntry == null) { return false; } splitter.count++; BytesHandle nextBytesHandle = readEntry(nextEntry); String name = nextEntry.getZipEntry().getName(); String uri = name; if (splitter.getUriTransformer() == null && splitter.getUriMaker() == null) { ZipSplitter.UriMakerImpl uriMaker = new ZipSplitter.UriMakerImpl(); uriMaker.setInputName(splitter.inputName); splitter.setUriMaker(uriMaker); } if (splitter.getUriMaker() != null) { if (splitter.inputName != null) { splitter.getUriMaker().setInputName(splitter.inputName); } uri = splitter.getUriMaker().makeUri(splitter.count, name, nextBytesHandle); } <START> if (splitter.getUriTransformer() != null) { <END> uri = splitter.uriTransformer.apply(name); } DocumentWriteOperationImpl documentWriteOperation = new DocumentWriteOperationImpl( DocumentWriteOperation.OperationType.DOCUMENT_WRITE, uri, null, nextBytesHandle ); action.accept(documentWriteOperation); } catch (IOException e) { throw new RuntimeException("Could not read ZipEntry", e); } return true; }</code><technical_language>For greater clarity, this else if execution skips this branch if getUriMaker() is null</technical_language>

Target:
public boolean tryAdvance(Consumer<? super DocumentWriteOperation> action) { try { FormatEntry nextEntry = getNextEntry(); if (nextEntry == null) { return false; } splitter.count++; BytesHandle nextBytesHandle = readEntry(nextEntry); String name = nextEntry.getZipEntry().getName(); String uri = name; if (splitter.getUriTransformer() == null && splitter.getUriMaker() == null) { ZipSplitter.UriMakerImpl uriMaker = new ZipSplitter.UriMakerImpl(); uriMaker.setInputName(splitter.inputName); splitter.setUriMaker(uriMaker); } if (splitter.getUriMaker() != null) { if (splitter.inputName != null) { splitter.getUriMaker().setInputName(splitter.inputName); } uri = splitter.getUriMaker().makeUri(splitter.count, name, nextBytesHandle); } else { uri = splitter.uriTransformer.apply(name); } DocumentWriteOperationImpl documentWriteOperation = new DocumentWriteOperationImpl( DocumentWriteOperation.OperationType.DOCUMENT_WRITE, uri, null, nextBytesHandle ); action.accept(documentWriteOperation); } catch (IOException e) { throw new RuntimeException("Could not read ZipEntry", e); } return true; }
Source:
<code>public static CategoryController get() { <START> if (mOne == null) { <END> mOne = new CategoryController(); } return mOne; }</code><technical_language>mOne</technical_language>

Target:
public static CategoryController get() { if (one == null) { one = new CategoryController(); } return one; }
Source:
<code>public boolean isWebviewCourseDiscoveryEnabled() { if (mCourseEnrollmentType != null) { <START> if (mCourseEnrollmentType.equalsIgnoreCase(EnrollmentType.WEBVIEW.name())) { <END> return true; } else if (!mCourseEnrollmentType.equalsIgnoreCase(EnrollmentType.NATIVE.name())) { return false; } } return false; }</code><technical_language>nit: switch (EnrollmentType.valueOf(mCourseEnrollmentType.toUpperCase(Locale.US))) {}</technical_language>

Target:
public boolean isWebviewCourseDiscoveryEnabled() { if (mCourseEnrollmentType == null) { return false; } switch (mCourseEnrollmentType.toUpperCase(Locale.US)) { case "WEBVIEW": return true; case "NATIVE": return false; default: logger.debug("No match in config for COURSE_ENROLLMENT.TYPE:" + mCourseEnrollmentType + ". Defaulting to Native"); return false; } }
Source:
<code>public <T> Serializer<T> createKeySerializer(Class<T> clazz, ClassLoader classLoader, ServiceConfiguration<?>... configs) throws UnsupportedTypeException { DefaultSerializerConfiguration<T> conf = find(SerializerConfiguration.Type.KEY, configs); <START> if(conf != null) { <END> if(conf.getInstance() != null) { return conf.getInstance(); } } return createSerializer("-Key", clazz, classLoader, conf, configs); }</code><technical_language>3 is option, want configuration immutable</technical_language>

Target:
public <T> Serializer<T> createKeySerializer(Class<T> clazz, ClassLoader classLoader, ServiceConfiguration<?>... configs) throws UnsupportedTypeException { DefaultSerializerConfiguration<T> conf = find(SerializerConfiguration.Type.KEY, configs); Serializer<T> instance = getUserProvidedSerializer(conf); if(instance != null) { return instance; } return createSerializer("-Key", clazz, classLoader, conf, configs); }
Source:
<code>public void perform( List<Pair<VM, VdsmVm>> monitoredVms, long fetchTime, VdsManager vdsManager, boolean updateStatistics) { if (monitoredVms.isEmpty()) { return; } <START> ArrayList<VmAnalyzer> <END> vmAnalyzers = new ArrayList<>(); try { analyzeVms(monitoredVms, fetchTime, vdsManager, updateStatistics, vmAnalyzers); addUnmanagedVms(vmAnalyzers, vdsManager.getVdsId()); flush(vmAnalyzers); postFlush(vmAnalyzers, vdsManager); vdsManager.vmsMonitoringInitFinished(); } catch (RuntimeException ex) { log.error("Failed during vms monitoring on host error is: {}", vdsManager.getVdsName(), ex); log.error("Exception:", ex); } finally { unlockVms(vmAnalyzers); } }</code><technical_language>this ArrayList explicitly? code more flexible leave a List</technical_language>

Target:
public void perform( List<Pair<VM, VdsmVm>> monitoredVms, long fetchTime, VdsManager vdsManager, boolean updateStatistics) { if (monitoredVms.isEmpty()) { return; } List<VmAnalyzer> vmAnalyzers = new ArrayList<>(); try { analyzeVms(monitoredVms, fetchTime, vdsManager, updateStatistics, vmAnalyzers); addUnmanagedVms(vmAnalyzers, vdsManager.getVdsId()); flush(vmAnalyzers); postFlush(vmAnalyzers, vdsManager); vdsManager.vmsMonitoringInitFinished(); } catch (RuntimeException ex) { log.error("Failed during vms monitoring on host error is: {}", vdsManager.getVdsName(), ex); log.error("Exception:", ex); } finally { unlockVms(vmAnalyzers); } }
Source:
<code>private void configureScalingPolicy(DiagramEditPartService tool, ExportFormat.ScalingPolicy policy, Integer scalingLevel) { Integer workspaceLevelDefault = null; switch (policy) { case AUTO_SCALING: tool.setAutoScalingEnabled(true); if (scalingLevel == null) { workspaceLevelDefault = <START> DiagramUIPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()) <END> * 10; tool.setDiagramScaleLevel(workspaceLevelDefault); } else { tool.setDiagramScaleLevel(scalingLevel); } break; case NO_SCALING: tool.setAutoScalingEnabled(false); tool.setDiagramScaleLevel(0); break; case WORKSPACE_DEFAULT: boolean workspaceDefault = DiagramUIPlugin.getPlugin().getPreferenceStore().getBoolean(SiriusDiagramUiPreferencesKeys.PREF_SCALE_DIAGRAMS_ON_EXPORT.name()); tool.setAutoScalingEnabled(workspaceDefault); if (workspaceDefault) { workspaceLevelDefault = DiagramUIPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()) * 10; tool.setDiagramScaleLevel(workspaceLevelDefault); } break; case AUTO_SCALING_IF_LARGER: tool.setAutoScalingEnabled(true); if (scalingLevel == null) { workspaceLevelDefault = DiagramUIPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()); tool.setDiagramScaleLevel(workspaceLevelDefault); } else { tool.setDiagramScaleLevel(scalingLevel); } tool.setAllowDownScaling(false); break; default: throw new UnsupportedOperationException(); } }</code><technical_language>SiriusEditPlugin</technical_language>

Target:
private void configureScalingPolicy(DiagramEditPartService tool, ExportFormat.ScalingPolicy policy, Integer scalingLevel) { Integer workspaceLevelDefault = null; switch (policy) { case AUTO_SCALING: tool.setAutoScalingEnabled(true); if (scalingLevel == null) { workspaceLevelDefault = SiriusEditPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()) * 10; tool.setDiagramScaleLevel(workspaceLevelDefault); } else { tool.setDiagramScaleLevel(scalingLevel); } break; case NO_SCALING: tool.setAutoScalingEnabled(false); tool.setDiagramScaleLevel(0); break; case WORKSPACE_DEFAULT: boolean workspaceDefault = DiagramUIPlugin.getPlugin().getPreferenceStore().getBoolean(SiriusDiagramUiPreferencesKeys.PREF_SCALE_DIAGRAMS_ON_EXPORT.name()); tool.setAutoScalingEnabled(workspaceDefault); if (workspaceDefault) { workspaceLevelDefault = SiriusEditPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()) * 10; tool.setDiagramScaleLevel(workspaceLevelDefault); } break; case AUTO_SCALING_IF_LARGER: tool.setAutoScalingEnabled(true); if (scalingLevel == null) { workspaceLevelDefault = SiriusEditPlugin.getPlugin().getPreferenceStore().getInt(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name()); tool.setDiagramScaleLevel(workspaceLevelDefault); } else { tool.setDiagramScaleLevel(scalingLevel); } tool.setAllowDownScaling(false); break; default: throw new UnsupportedOperationException(); } }
Source:
<code>public JsonObjectBuilder toJson(ServerConsumer consumer) { ServerSession session = server.getSessionByID(consumer.getSessionID()); <START> JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(consumer.sequentialID())).add("session", (session == null ? "" : toString(session.getName()))).add("clientID", (session == null ? "" : toString(session.getRemotingConnection().getClientID()))).add("user", (session == null ? "" : toString(session.getUsername()))).add("protocol", (session == null ? "" : toString(session.getRemotingConnection().getProtocolName()))).add("queue", toString(consumer.getQueue().getName())).add("queueType", toString(consumer.getQueue().getRoutingType()).toLowerCase()).add("address", toString(consumer.getQueue().getAddress().toString())).add("localAddress", (session == null ? "" : toString(session.getRemotingConnection().getTransportConnection().getLocalAddress()))).add("remoteAddress", (session == null ? "" : toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress()))).add("creationTime", new Date(consumer.getCreationTime()).toString()); <END> return obj; }</code><technical_language>Instead of protecting single attribute session == null? simply do if (session == null) continue? big line... bigger</technical_language>

Target:
public JsonObjectBuilder toJson(ServerConsumer consumer) { ServerSession session = server.getSessionByID(consumer.getSessionID()); if (session == null) { return null; } JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("sequentialID", toString(consumer.getSequentialID())) .add("sessionName", toString(consumer.getSessionName())) .add("connectionClientID", toString(consumer.getConnectionClientID())) .add("user", toString(session.getUsername())) .add("connectionProtocolName", toString(consumer.getConnectionProtocolName())) .add("queueName", toString(consumer.getQueueName())) .add("queueType", toString(consumer.getQueueType()).toLowerCase()) .add("queueAddress", toString(consumer.getQueueAddress().toString())) .add("connectionLocalAddress", toString(consumer.getConnectionLocalAddress())) .add("connectionRemoteAddress", toString(consumer.getConnectionRemoteAddress())) .add("creationTime", new Date(consumer.getCreationTime()).toString()); return obj; }
Source:
<code>VertxHttpServerResponse(HttpServerResponse httpServerResponse) { this.httpServerResponse = httpServerResponse; <START> httpServerResponse.setWriteQueueMaxSize(16384); <END> }</code><technical_language>a constant for this</technical_language>

Target:
VertxHttpServerResponse(HttpServerResponse httpServerResponse) { this.httpServerResponse = httpServerResponse; }
Source:
<code><START> @Test public void injectingView() { <END> final JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import android.view.View;", "import butterknife.InjectView;", "public class Test extends Activity {", " @InjectView(1) View thing;", "}")); ASSERT.about(javaSource()).that(source) .processedWith(butterknifeProcessors()) .compilesWithoutError(); }</code><technical_language>This file needs two-space indent</technical_language>

Target:
public void injectingView() { final JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import android.view.View;", "import butterknife.InjectView;", "public class Test extends Activity {", " @InjectView(1) View thing;", "}")); ASSERT.about(javaSource()).that(source) .processedWith(butterknifeProcessors()) .compilesWithoutError(); }
Source:
<code>private Deposit publishDepositOnZenodo(ActionsApi actionsApi, int depositionID) { Deposit publishedDeposit; try { publishedDeposit = actionsApi.publishDeposit(depositionID); } catch (ApiException e) { <START> LOG.error("Could not publish DOI on Zenodo. Error is " + e.getMessage()); <END> throw new CustomWebApplicationException("Could not publish DOI on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return publishedDeposit; }</code><technical_language>Please log exception</technical_language>

Target:
private Deposit publishDepositOnZenodo(ActionsApi actionsApi, int depositionID) { Deposit publishedDeposit; try { publishedDeposit = actionsApi.publishDeposit(depositionID); } catch (ApiException e) { LOG.error("Could not publish DOI on Zenodo. Error is " + e.getMessage(), e); throw new CustomWebApplicationException("Could not publish DOI on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return publishedDeposit; }
Source:
<code>public void walk(Consumer<Node> consumer) { new TreeVisitor() { @Override public void process(Node node) { consumer.accept(node); } <START> }.visitPreOrder(this); <END> }</code><technical_language>order (preOrder/postOrder) a flag</technical_language>

Target:
public void walk(Consumer<Node> consumer) { walk(PREORDER, consumer); }
Source:
<code><START> private AccessibilityManager getAccessibilityManagerInstance() throws Exception { <END> return ReflectionHelpers.callStaticMethod(AccessibilityManager.class, "getInstance", ReflectionHelpers.ClassParameter.from(Context.class, RuntimeEnvironment.application)); }</code><technical_language>nit: this static</technical_language>

Target:
private static AccessibilityManager getAccessibilityManagerInstance() throws Exception { return ReflectionHelpers.callStaticMethod(AccessibilityManager.class, "getInstance", ReflectionHelpers.ClassParameter.from(Context.class, RuntimeEnvironment.application)); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; <START> result = prime * result + _data.hashCode(); <END> return result; }</code><technical_language>Equals hashcode generated Joda-beans</technical_language>

Target:
public int hashCode() { int hash = getClass().hashCode(); hash += hash * 31 + JodaBeanUtils.hashCode(getData()); return hash; }
Source:
<code><START> public <K, V, S extends Enum<S>, T extends Enum<T>> org.ehcache.core.statistics.OperationStatistic<T> registerStoreStatistics(Store<K, V> store, String targetName, int tierHeight, String tag, Map<T, Set<S>> translation, String statisticName) { <END> Class<S> outcomeType = getOutcomeType(translation); if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { MappedOperationStatistic<S, T> operationStatistic = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, tag); StatisticsManager.associate(operationStatistic).withParent(store); org.ehcache.core.statistics.OperationStatistic<T> stat = new DelegatedMappedOperationStatistics<>(operationStatistic); return stat; } return ZeroOperationStatistic.get(); }</code><technical_language>reason import here</technical_language>

Target:
public <K, V, S extends Enum<S>, T extends Enum<T>> OperationStatistic<T> registerStoreStatistics(Store<K, V> store, String targetName, int tierHeight, String tag, Map<T, Set<S>> translation, String statisticName) { Class<S> outcomeType = getOutcomeType(translation); if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { MappedOperationStatistic<S, T> operationStatistic = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, tag); StatisticsManager.associate(operationStatistic).withParent(store); return new DelegatedMappedOperationStatistics<>(operationStatistic); } else { return ZeroOperationStatistic.get(); } }
Source:
<code>private static Set<ArtifactRef> handleDependencies( MavenSessionHandler session, Project project, Profile profile, Type type ) throws ManipulationUncheckedException { try { switch (type) { case DEPENDENCIES: { return project.getResolvedDependencies( session ).keySet(); } case MANAGED_DEPENDENCIES: { return project.getResolvedManagedDependencies( session ).keySet(); } case PROFILE_DEPENDENCIES: { return project.getResolvedProfileDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case PROFILE_MANAGED_DEPENDENCIES: { return project.getResolvedProfileManagedDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedDependencies( session ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } case PROFILE_DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedProfileDependencies( session ). getOrDefault( profile, Collections.emptyMap() ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } default: { <START> throw new ManipulationException( "Invalid type {}", type.toString() ); <END> } } } catch ( ManipulationException e ) { throw new ManipulationUncheckedException( e ); } }</code><technical_language>references toString() in new code original. I want pass object defer call toString(). I disable messages a logger, I redundant</technical_language>

Target:
private static Set<ArtifactRef> handleDependencies( MavenSessionHandler session, Project project, Profile profile, Type type ) throws ManipulationUncheckedException { try { switch (type) { case DEPENDENCIES: { return project.getResolvedDependencies( session ).keySet(); } case MANAGED_DEPENDENCIES: { return project.getResolvedManagedDependencies( session ).keySet(); } case PROFILE_DEPENDENCIES: { return project.getResolvedProfileDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case PROFILE_MANAGED_DEPENDENCIES: { return project.getResolvedProfileManagedDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedDependencies( session ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } case PROFILE_DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedProfileDependencies( session ). getOrDefault( profile, Collections.emptyMap() ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } default: { throw new ManipulationException( "Invalid type {}", type ); } } } catch ( ManipulationException e ) { throw new ManipulationUncheckedException( e ); } }
Source:
<code>public String protocolId() { OLSyntaxNode p = this.protocol; if( p instanceof SumExpressionNode ) { OLSyntaxNode prodVal = ((SumExpressionNode) protocol).operands().iterator().next().value(); p = ((ProductExpressionNode) prodVal).operands().iterator().next().value(); } if( p instanceof InlineTreeExpressionNode ) { return ((InlineTreeExpressionNode) p) .rootExpression().toString(); } else { <START> return p.toString(); <END> } }</code><technical_language>this risk throwing a nullpointerexception</technical_language>

Target:
public String protocolId() { return PortInfo.extractProtocolId( this.protocol ); }
Source:
<code>public static Timestamp epoch() { <START> return new Timestamp(0); <END> }</code><technical_language>1. 0 (even sense) internally, Concourse a special code refer present state. suggest -1. 2. return Timestamp fromMicros instead of calling new Timestamp. now, in future do object pooling for Timestamp objects, funnel static factory in case changes. I realize I do for other static factories, bad programming part :(</technical_language>

Target:
public static Timestamp epoch() { return Timestamp.fromMicros(-1); }
Source:
<code>public MenuItem add(int groupId, int itemId, int order, int titleRes) { <START> return add(groupId, itemId, order, RuntimeEnvironment.application.getResources().getString(titleRes)); <END> }</code><technical_language>curious stick context passed in constructor, I this is approach resources get context dependent</technical_language>

Target:
public MenuItem add(int groupId, int itemId, int order, int titleRes) { return add(groupId, itemId, order, context.getResources().getString(titleRes)); }
Source:
<code>public void logging(IStatus status, String plugin) { Throwable statusException = status.getException(); if (statusException <START> instanceof AssertionFailedException) { <END> failedAssertions.add((AssertionFailedException) statusException); } }</code><technical_language>fail exception</technical_language>

Target:
public void logging(IStatus status, String plugin) { Throwable statusException = status.getException(); loggedExceptions.add(statusException); }
Source:
<code>public ViewEventRest createViewEvent() throws AuthorizeException, SQLException { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); ViewEventRest viewEventRest = null; try { ServletInputStream input = req.getInputStream(); viewEventRest = mapper.readValue(input, ViewEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } if (viewEventRest.getTargetId() == null || StringUtils.isBlank(viewEventRest.getTargetType()) || <START> !Arrays.asList(Constants.typeText).contains(viewEventRest.getTargetType().toUpperCase())) { <END> throw new DSpaceBadRequestException("The given ViewEvent was invalid, one or more properties are either" + "wrong or missing"); } DSpaceObjectService dSpaceObjectService = ContentServiceFactory.getInstance().getDSpaceObjectService( Constants.getTypeID(viewEventRest.getTargetType().toUpperCase(Locale.getDefault()))); DSpaceObject dSpaceObject = dSpaceObjectService.find(context, viewEventRest.getTargetId()); if (dSpaceObject == null) { throw new UnprocessableEntityException( "The given targetId does not resolve to a DSpaceObject: " + viewEventRest.getTargetId()); } UsageEvent usageEvent = new UsageEvent(UsageEvent.Action.VIEW, req, context, dSpaceObject); eventService.fireEvent(usageEvent); return viewEventRest; }</code><technical_language>creating this array often, constant input. done once, statically</technical_language>

Target:
public ViewEventRest createViewEvent() throws AuthorizeException, SQLException { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); ViewEventRest viewEventRest = null; try { ServletInputStream input = req.getInputStream(); viewEventRest = mapper.readValue(input, ViewEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } if (viewEventRest.getTargetId() == null || StringUtils.isBlank(viewEventRest.getTargetType()) || !typeList.contains(viewEventRest.getTargetType().toUpperCase())) { throw new DSpaceBadRequestException("The given ViewEvent was invalid, one or more properties are either" + "wrong or missing"); } DSpaceObjectService dSpaceObjectService = ContentServiceFactory.getInstance().getDSpaceObjectService( Constants.getTypeID(viewEventRest.getTargetType().toUpperCase(Locale.getDefault()))); DSpaceObject dSpaceObject = dSpaceObjectService.find(context, viewEventRest.getTargetId()); if (dSpaceObject == null) { throw new UnprocessableEntityException( "The given targetId does not resolve to a DSpaceObject: " + viewEventRest.getTargetId()); } UsageEvent usageEvent = new UsageEvent(UsageEvent.Action.VIEW, req, context, dSpaceObject); eventService.fireEvent(usageEvent); return viewEventRest; }
Source:
<code>private void reapFiles() { FileReader tmpFileReader = null; try { tmpFileReader = new FileReader(LAUNCHER_TMP_FILE_LIST); List fileList = IOUtils.readLines(tmpFileReader); Set<String> fileSet = new HashSet<>(fileList); for (String fileName : fileSet) { File file = new File(fileName); FileUtils.deleteQuietly(file); <START> File depsDir = new File("data", fileName); <END> FileUtils.deleteQuietly(depsDir); if (!file.exists() && !depsDir.exists()) { fileList.remove(fileName); } } writeToFile(fileList, false); } catch (Exception e) { } finally { IOUtils.closeQuietly(tmpFileReader); } }</code><technical_language>places data folder refer string. instead create a constant atleast agent side a part of this PR. difficult data folder. do is for string "data" results</technical_language>

Target:
private void reapFiles() { FileReader tmpFileReader = null; try { tmpFileReader = new FileReader(LAUNCHER_TMP_FILE_LIST); List fileList = IOUtils.readLines(tmpFileReader); Set<String> fileSet = new HashSet<>(fileList); for (String fileName : fileSet) { File file = new File(fileName); FileUtils.deleteQuietly(file); File depsDir = new File(FileUtil.TMP_PARENT_DIR, fileName); FileUtils.deleteQuietly(depsDir); if (!file.exists() && !depsDir.exists()) { fileList.remove(fileName); } } writeToFile(fileList, false); } catch (Exception e) { } finally { IOUtils.closeQuietly(tmpFileReader); } }
Source:
<code>private boolean sessionStateUnchangedSinceCallout(CommCareSession session, Intent intent) { boolean dataIdsEqual = session.getNeededData().equals( intent.getStringExtra(KEY_PENDING_SESSION_DATA)); String intentDatum = intent.getStringExtra(KEY_PENDING_SESSION_DATUM_ID); boolean datumIdsEqual = intentDatum == null ? true : intentDatum.equals(session.getNeededDatum().getDataId()); <START> return dataIdsEqual && datumIdsEqual; <END> }</code><technical_language>close, reads realize</technical_language>

Target:
private boolean sessionStateUnchangedSinceCallout(CommCareSession session, Intent intent) { boolean neededDataUnchanged = session.getNeededData().equals( intent.getStringExtra(KEY_PENDING_SESSION_DATA)); String intentDatum = intent.getStringExtra(KEY_PENDING_SESSION_DATUM_ID); boolean datumIdsUnchanged = intentDatum == null ? true : intentDatum.equals(session.getNeededDatum().getDataId()); return neededDataUnchanged && datumIdsUnchanged; }
Source:
<code><START> private static boolean isV45PlusInstalled(int minor, IJIWinReg registry, JIPolicyHandle hklm) throws JIException { <END> JIPolicyHandle key = null; try { key = registry.winreg_OpenKey(hklm, PATH4, IJIWinReg.KEY_READ); return RegistryKey.convertBufferToInt((byte[])registry.winreg_QueryValue(key, VALUE_RELEASE, 4)[1]) >= GetV45PlusMinRelease(minor); } finally { if (key != null) { registry.winreg_CloseKey(key); } } }</code><technical_language>is some duplication prevented IMHO. a blocker</technical_language>

Target:
private static boolean isV45PlusInstalled(int minor, IJIWinReg registry, JIPolicyHandle hklm) throws JIException { JIPolicyHandle key = null; try { key = registry.winreg_OpenKey(hklm, PATH4, IJIWinReg.KEY_READ); return GetIntValue(registry, key, VALUE_RELEASE) >= GetV45PlusMinRelease(minor); } finally { if (key != null) { registry.winreg_CloseKey(key); } } }
Source:
<code>public void serviceIsNewIfNoDataDirectoriesPresent() { ImmutablePaxosInstallConfiguration.Builder partialConfiguration = createPartialConfiguration( fileSubdirectory, sqliteSubdirectory); assertThatCode(() -> partialConfiguration.isNewService(true).build()).doesNotThrowAnyException(); assertThatThrownBy(() -> partialConfiguration.isNewService(false).build()) .isInstanceOf(IllegalArgumentException.class) <START> .hasMessageContaining("The timelock data directories do not appear to exist."); <END> }</code><technical_language>I't kinda funky this is IllegalStateException tbh</technical_language>

Target:
public void serviceIsNewIfNoDataDirectoriesPresent() { ImmutablePaxosInstallConfiguration.Builder partialConfiguration = createPartialConfiguration( nonexistentFileDirectory, nonexistentSqliteDirectory); assertIsNewService(partialConfiguration); }
Source:
<code>public void setMobileAnimation(boolean mobileAnimation) { <START> this.mobileAnimation = mobileAnimation; <END> }</code><technical_language>return this (ChosenOptions) builder pattern</technical_language>

Target:
public ChosenOptions setMobileAnimation(boolean mobileAnimation) { this.mobileAnimation = mobileAnimation; return this; }
Source:
<code>public void onAcknowledgement() { <START> removePendingRequest(registrationId, coapRequest); <END> }</code><technical_language>This "fix/bind" usage of piggybacked reponses. "separate responses" advantages, sure, if binding hard piggybacked is a good idea</technical_language>

Target:
public void onAcknowledgement() { removePendingRequest(requestKey, coapRequest); }
Source:
<code>public TcpSlaveAgentListener(int port) throws IOException { super("TCP agent listener port="+port); try { serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(new InetSocketAddress(port)); } catch (BindException e) { throw (BindException)new BindException("Failed to listen on port "+port+" because it's already in use.").initCause(e); } this.configuredPort = port; setUncaughtExceptionHandler((t, e) -> { LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + t, e); shutdown(); }); <START> LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort()); <END> start(); }</code><technical_language>So, stops Listener, recover Jenkins restart? I propose do following: * shutdown schedule a delayed async task (e.g. 5 seconds), starts a new thread. * Modify SEVERE message thread rescheduled * Print INFO message listener thread starts</technical_language>

Target:
public TcpSlaveAgentListener(int port) throws IOException { super("TCP agent listener port="+port); try { serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(new InetSocketAddress(port)); } catch (BindException e) { throw (BindException)new BindException("Failed to listen on port "+port+" because it's already in use.").initCause(e); } this.configuredPort = port; setUncaughtExceptionHandler((t, e) -> { LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + t + ", attempting to reschedule thread", e); shutdown(); TcpSlaveAgentListenerRescheduler.schedule(t, port, e); }); LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort()); start(); }
Source:
<code>protected void visit( final AttributeDescr descr ) { String attr = descr.getName(); switch(attr) { case "salience": case "dialect": return; } PartType type = PartType.getPartTypeFromAttribueDescrName(descr.getName()); switch(type) { case AGENDA_GROUP: case ACTIVATION_GROUP: case RULEFLOW_GROUP: case ENTRY_POINT: SharedPart sharedRef = new SharedPart(descr.getValue(), type); builder.addGenerator( sharedRef ); break; default: <START> throw new UnsupportedOperationException("Unsupported attribute encountered: " + descr.getName() ); <END> } }</code><technical_language>Really!?!? lots more attributes above; salience for example.. I ask, swallow throw exception</technical_language>

Target:
protected void visit( final AttributeDescr descr ) { String attr = descr.getName(); switch(attr) { case "no-loop": case "lock-on-active": case "salience": case "auto-focus": case "dialect": case "date-effective": case "date-expires": case "enabled": case "duration": case "timer": case "calendars": return; } PartType type = PartType.getPartTypeFromAttribueDescrName(descr.getName()); switch(type) { case AGENDA_GROUP: case ACTIVATION_GROUP: case RULEFLOW_GROUP: SharedPart sharedRef = new SharedPart(descr.getValue(), type); builder.addGenerator( sharedRef ); break; default: throw new UnsupportedOperationException("Unsupported attribute encountered: " + descr.getName() ); } }