auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMakeTimeZone_NoOffsets() throws <START> IOException { <END> int[][] times = {}; int[][] offsets = {}; try { createZoneInfo(times, offsets); fail("Did not detect no transitions"); } catch (IllegalStateException expected) { } }</code><technical_language>throw Exception tests</technical_language>

Target:
public void testMakeTimeZone_NoOffsets() throws Exception { int[][] times = {}; int[][] offsets = {}; try { createZoneInfo(times, offsets); fail("Did not detect no transitions"); } catch (IllegalStateException expected) { } }
Source:
<code>public void terminate(HazelcastInstance instance) { try { Address address = getNode(instance).address; terminateInstance(instance); if (isMockNetwork) { registry.removeInstance(address); } } finally { <START> TestJmxLeakHelper.checkJmxBeans(instance.getName()); <END> } }</code><technical_language>a large number of tests TestHazelcastInstanceFactory call Hazelcast.newHazelcastInstance() (in combination Hazelcast.shutdownAll() / HazelcastInstanceFactory.shutdownAll() / HazelcastInstanceFactory.terminateAll()). checked well, somehow</technical_language>

Target:
public void terminate(HazelcastInstance instance) { Address address = getNode(instance).address; terminateInstance(instance); if (isMockNetwork) { registry.removeInstance(address); } }
Source:
<code>public void extract(String filename, File archiveFile, @Nullable Predicate<String> filter, Processor<ExtractedFile, Boolean> extractedFileConsumer) { try { <START> if (isZIPFile(Files.getFileExtension(filename))) { <END> extractZIP(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } else { extract7z(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } } catch (Exception e) { throw Exceptions.handle() .error(e) .withSystemErrorMessage("An error occurred while unzipping an archive (%s): %s (%s)", filename) .handle(); } }</code><technical_language>suggestion if (isZipFile(Files.getFileExtension(filename))) {</technical_language>

Target:
public void extract(String filename, File archiveFile, @Nullable Predicate<String> filter, Processor<ExtractedFile, Boolean> extractedFileConsumer) { try { if (isZipFile(Files.getFileExtension(filename)) || !isSevenZipEnabled()) { extractZip(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } else { extract7z(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } } catch (Exception e) { throw Exceptions.handle() .error(e) .withSystemErrorMessage("An error occurred while unzipping an archive (%s): %s (%s)", filename) .handle(); } }
Source:
<code>public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); dynamicUrlContentProxyFactory.create(historyToken, contentUrl); if (defaultPlace && <START> placeManager instanceof WebAdminPlaceManager) { <END> ((WebAdminPlaceManager) placeManager).setDefaultPlace(historyToken); } }</code><technical_language>UI plugin infra is WebAdmin-specific, need for this instanceof check, true. typecast do below. Or, if prefer, inject WebAdminPlaceManager instead of PlaceManager interface. you</technical_language>

Target:
public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); dynamicUrlContentProxyFactory.create(historyToken, contentUrl); placeManager.setDefaultPlace(historyToken); }
Source:
<code>public String getString(ByteBuffer byteBuffer) { <START> return BytesType.instance.getString(byteBuffer); <END> }</code><technical_language>missing .duplicate</technical_language>

Target:
public String getString(ByteBuffer byteBuffer) { if (byteBuffer == null) return null; return BytesType.instance.getString(byteBuffer.duplicate()); }
Source:
<code>private ModuleOptionsMetadata inferModuleOptionsMetadata(ModuleDefinition definition, ClassLoader classLoaderToUse) { final SimpleModuleOptionsMetadata result = new SimpleModuleOptionsMetadata(); final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); reader.setResourceLoader(new PathMatchingResourcePatternResolver(classLoaderToUse)); reader.loadBeanDefinitions(definition.getResource()); final PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}"); final PlaceholderResolver placeholderResolver = new PlaceholderResolver() { @Override public String resolvePlaceholder(String placeholderName) { int colon = placeholderName.indexOf(':'); String optionName = colon >= 0 ? placeholderName.substring(0, colon) : placeholderName; if (optionName.indexOf('.') == -1) { ModuleOption option = new ModuleOption(optionName, "unknwown").withType(String.class); <START> result.add(option); <END> } return placeholderName; } }; final StringValueResolver resolver = new StringValueResolver() { @Override public String resolveStringValue(String strVal) { helper.replacePlaceholders(strVal, placeholderResolver); return strVal; } }; PlaceholderConfigurerSupport support = new PlaceholderConfigurerSupport() { @Override protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { } { doProcessProperties(beanFactory, resolver); } }; return result; }</code><technical_language>call withDefaultValue for ModuleOption IF is a colon (thus indicating a default provided RHS of colon)</technical_language>

Target:
private ModuleOptionsMetadata inferModuleOptionsMetadata(ModuleDefinition definition, ClassLoader classLoaderToUse) { final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); reader.setResourceLoader(new PathMatchingResourcePatternResolver(classLoaderToUse)); reader.loadBeanDefinitions(definition.getResource()); return defaultModuleOptionsMetadataCollector.collect(beanFactory); }
Source:
<code>public static <M, OM> StreamOperatorSpec<M, OM> createFlatMapOperatorSpec( FlatMapFunction<? super M, ? extends OM> flatMapFn, String opId) { <START> return StreamOperatorSpec.<M, OM>createStreamOperatorSpec((FlatMapFunction<M, OM>) flatMapFn, OperatorSpec.OpCode.FLAT_MAP, opId); <END> }</code><technical_language>type annotations required</technical_language>

Target:
public static <M, OM> StreamOperatorSpec<M, OM> createFlatMapOperatorSpec( FlatMapFunction<? super M, ? extends OM> flatMapFn, String opId) { return new FlatMapOperatorSpec<>((FlatMapFunction<M, OM>) flatMapFn, opId); }
Source:
<code>public Future<String> stitchBlob(BlobProperties blobProperties, byte[] userMetadata, List<ChunkInfo> chunksToStitch, Callback<String> callback) { if (blobProperties == null || chunksToStitch == null) { <START> throw new IllegalArgumentException("blobProperties or channel must not be null"); <END> } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); if (blobProperties.isEncrypted()) { routerMetrics.stitchEncryptedBlobOperationRate.mark(); } else { routerMetrics.stitchBlobOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().stitchBlob(blobProperties, userMetadata, chunksToStitch, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException, blobProperties.isEncrypted(), true); completeOperation(futureResult, callback, null, routerException); } return futureResult; }</code><technical_language>minor: blobProperties chunksToStitch null</technical_language>

Target:
public Future<String> stitchBlob(BlobProperties blobProperties, byte[] userMetadata, List<ChunkInfo> chunksToStitch, Callback<String> callback) { if (blobProperties == null || chunksToStitch == null) { throw new IllegalArgumentException("blobProperties or chunksToStitch must not be null"); } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); if (blobProperties.isEncrypted()) { routerMetrics.stitchEncryptedBlobOperationRate.mark(); } else { routerMetrics.stitchBlobOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().stitchBlob(blobProperties, userMetadata, chunksToStitch, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException, blobProperties.isEncrypted(), true); completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
<code>private void updateDeploymentConfigValues(IDeploymentConfig deploymentConfig, DebuggingContext debugContext) { Collection<IContainer> originalContainers = deploymentConfig.getContainers(); if (originalContainers != null && !originalContainers.isEmpty() && debugContext.isDebugEnabled()) { Collection<IContainer> containers = new ArrayList<>(originalContainers); IContainer container = containers.iterator().next(); Set<IPort> ports = new HashSet<>(container.getPorts()); IPort existing = ports.stream().filter(p -> p.getContainerPort() == debugContext.getDebugPort()) .findFirst().orElse(null); boolean added = false; if (existing == null) { PortSpecAdapter newPort = new PortSpecAdapter("debug", "TCP", debugContext.getDebugPort()); added = ports.add(newPort); } else { PortSpecAdapter newPort = new PortSpecAdapter(existing.getName(), existing.getProtocol(), debugContext.getDebugPort()); if (!existing.equals(newPort)) { ports.remove(existing); added = ports.add(newPort); } } if (added) { container.setPorts(ports); deploymentConfig.setContainers(containers); } } <START> deploymentConfig.setEnvironmentVariable("DEBUG_PORT", String.valueOf(debugContext.getDebugPort())); <END> deploymentConfig.setEnvironmentVariable("DEV_MODE", String.valueOf(debugContext.isDebugEnabled())); deploymentConfig.setEnvironmentVariable("DEBUG", String.valueOf(debugContext.isDebugEnabled())); }</code><technical_language>Atleast move constants in this class</technical_language>

Target:
private void updateDeploymentConfigValues(IDeploymentConfig deploymentConfig, DebuggingContext debugContext) { Collection<IContainer> originalContainers = deploymentConfig.getContainers(); if (originalContainers != null && !originalContainers.isEmpty() && debugContext.isDebugEnabled()) { Collection<IContainer> containers = new ArrayList<>(originalContainers); IContainer container = containers.iterator().next(); Set<IPort> ports = new HashSet<>(container.getPorts()); IPort existing = ports.stream().filter(p -> p.getContainerPort() == debugContext.getDebugPort()) .findFirst().orElse(null); boolean added = false; if (existing == null) { PortSpecAdapter newPort = new PortSpecAdapter("debug", "TCP", debugContext.getDebugPort()); added = ports.add(newPort); } else { PortSpecAdapter newPort = new PortSpecAdapter(existing.getName(), existing.getProtocol(), debugContext.getDebugPort()); if (!existing.equals(newPort)) { ports.remove(existing); added = ports.add(newPort); } } if (added) { container.setPorts(ports); deploymentConfig.setContainers(containers); } } deploymentConfig.setEnvironmentVariable(DEBUG_PORT_KEY, String.valueOf(debugContext.getDebugPort())); deploymentConfig.setEnvironmentVariable(DEV_MODE_KEY, String.valueOf(debugContext.isDebugEnabled())); deploymentConfig.setEnvironmentVariable(DEBUG_KEY, String.valueOf(debugContext.isDebugEnabled())); }
Source:
<code><START> public LayoutLensSupport(VisualizationViewer<V, E> vv) { <END> super(vv, new ModalLensGraphMouse()); LayoutModel<V, Point2D> layoutModel = vv.getModel().getLayoutModel(); Dimension layoutModelSize = new Dimension(layoutModel.getWidth(), layoutModel.getHeight()); Lens lens = new Lens(layoutModelSize); this.lensTransformer = new HyperbolicTransformer( lens, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)); }</code><technical_language>I signs this constructor, below, setting pickSupport. Also, relationship this constructor takes a VV a Lens is kind of confusing: this constructor calling one</technical_language>

Target:
public LayoutLensSupport(VisualizationViewer<V, E> vv) { this( vv, new HyperbolicTransformer( new Lens(vv.getModel().getLayoutSize()), vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)), new ModalLensGraphMouse()); }
Source:
<code>public void testScriptExecutableContainerNull() throws InvalidScriptException { sec = null; Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); <START> assertEquals(false, result); <END> }</code><technical_language>assertEquals is relevant</technical_language>

Target:
public void testScriptExecutableContainerNull() throws InvalidScriptException { sec = null; Mockito.when(etd.getInternal()).thenReturn(ist); Mockito.when(ist.getExecutableContainer()).thenReturn(sec); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); assertFalse(result); }
Source:
<code>public boolean doMonitor(ServiceEmitter emitter) { emitter.emit(new ServiceMetricEvent.Builder().build("segment/max", serverConfig.getMaxSize())); long totalUsed = 0; long totalCount = 0; for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) { String dataSource = entry.getKey(); long used = entry.getValue(); totalUsed += used; final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension("priority", String.valueOf(serverConfig.getPriority())); emitter.emit(builder.build("segment/used", used)); final double usedPercent = serverConfig.getMaxSize() == 0 ? 0 : used / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/usedPercent", usedPercent)); } for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) { String dataSource = entry.getKey(); long count = entry.getValue(); totalCount += count; final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/count", count)); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/totalUsed", totalUsed)); final double totalUsedPercent = serverConfig.getMaxSize() == 0 ? 0 : totalUsed / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/totalUsedPercent", totalUsedPercent)); <START> emitter.emit(builder.build("segment/totalCount", totalCount)); <END> return true; }</code><technical_language>end in /count, reason here</technical_language>

Target:
public boolean doMonitor(ServiceEmitter emitter) { emitter.emit(new ServiceMetricEvent.Builder().build("segment/max", serverConfig.getMaxSize())); for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) { String dataSource = entry.getKey(); long used = entry.getValue(); final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension("priority", String.valueOf(serverConfig.getPriority())); emitter.emit(builder.build("segment/used", used)); final double usedPercent = serverConfig.getMaxSize() == 0 ? 0 : used / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/usedPercent", usedPercent)); } for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) { String dataSource = entry.getKey(); long count = entry.getValue(); final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/count", count)); } return true; }
Source:
<code>public boolean initialize() { if (libVLC == null) { return false; } <START> if (mediaPlayer == null) { <END> mediaPlayer = new MediaPlayer(libVLC); mediaPlayer.setEventListener(this); } return true; }</code><technical_language>beast throw exception initialized</technical_language>

Target:
public void initialize() throws IllegalStateException { if (libVLC == null) { throw new IllegalStateException("Trying to initialise VlcPlayer but libVLC is null"); } if (mediaPlayer != null) { throw new IllegalStateException("MediaPlayer is already initialized"); } mediaPlayer = new MediaPlayer(libVLC); mediaPlayer.setEventListener(this); }
Source:
<code>public void testCommandClassExistence() { CommandEnumTestUtils.testCommandsExist(ActionType.class, <START> vat -> <END> CommandsFactory.getCommandClass(vat.name())); }</code><technical_language>missed this one</technical_language>

Target:
public void testCommandClassExistence() { CommandEnumTestUtils.testCommandsExist(ActionType.class, at -> CommandsFactory.getCommandClass(at.name())); }
Source:
<code>public List<WebElement> getFiltersSuggestions() { <START> return seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(" END> }</code><technical_language>"//md-chip" a constant locators, IMHO</technical_language>

Target:
public List<WebElement> getFiltersSuggestions() { String filtersSuggestionBody = " return seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(filtersSuggestionBody)); }
Source:
<code>public ArrayList<int[]> splitGeometryAfter(int segment) { int[] original = geometries.get(pairIndex); <START> ArrayList<int[]> geoms = new ArrayList<>(); <END> geoms.add(Arrays.copyOfRange(original, 0, segment * 2)); geoms.add(Arrays.copyOfRange(original, segment * 2, original.length + 1)); return geoms; }</code><technical_language>Returning a List works a practical point of view, feels a bit arbitrary number of elements modified / extended. pair tuple types defined (P2 T2), this return a P2<int[]></technical_language>

Target:
public P2<int[]> splitGeometryAfter(int segment) { int[] preSplit = EMPTY_INT_ARRAY; int[] postSplit = EMPTY_INT_ARRAY; int[] original = geometries.get(pairIndex); if (original.length > 0) { if (segment > 0) { preSplit = Arrays.copyOfRange(original, 0, segment * 2); } if (segment * 2 < original.length) { postSplit = Arrays.copyOfRange(original, segment * 2, original.length); } } return new P2<>(preSplit, postSplit); }
Source:
<code>public Date getBarcodeDate() { <START> return Stream.of(getReceivedDate(), getCreationDate(), getCreationDate()).filter(Objects::nonNull).findFirst().orElse(null); <END> }</code><technical_language>getCreationDate() is duplicated here, getCreationTime()</technical_language>

Target:
public Date getBarcodeDate() { return Stream.of(getReceivedDate(), getCreationDate(), getCreationTime()).filter(Objects::nonNull).findFirst().orElse(null); }
Source:
<code>private Object extractAttributeValue(Data key, Object value) { if (components == null) { QueryEntry queryEntry = new QueryEntry(ss, key, value, extractors); return MapEntryAttributeExtractor.extractAttributeValue(queryEntry, name, queryFieldType); } else { Comparable[] valueComponents = new Comparable[components.length]; QueryEntry queryEntry = new QueryEntry(ss, key, value, extractors); for (int i = 0; i < components.length; ++i) { Object extractedValue = MapEntryAttributeExtractor.extractAttributeValue(queryEntry, components[i], <START> QueryFieldType.fromName(components[i])); <END> if (extractedValue instanceof MultiResult) { throw new IllegalStateException( "Collection/array attributes are not supported by composite indexes: " + components[i]); } else if (extractedValue == null || extractedValue instanceof Comparable) { valueComponents[i] = (Comparable) extractedValue; } else { throw new IllegalStateException("Unsupported non-comparable value type: " + extractedValue.getClass()); } } return new CompositeValue(valueComponents); } }</code><technical_language>cache for composite indexes well</technical_language>

Target:
private Object extractAttributeValue(Data key, Object value) { if (components == null) { return extractAttributeValueByOrigin(extractors, key, value, name, attributeOrigin); } else { Comparable[] valueComponents = new Comparable[components.length]; for (int i = 0; i < components.length; ++i) { Object extractedValue = extractAttributeValueByOrigin(extractors, key, value, components[i], componentOrigins[i]); if (extractedValue instanceof MultiResult) { throw new IllegalStateException( "Collection/array attributes are not supported by composite indexes: " + components[i]); } else if (extractedValue == null || extractedValue instanceof Comparable) { valueComponents[i] = (Comparable) extractedValue; } else { throw new IllegalStateException("Unsupported non-comparable value type: " + extractedValue.getClass()); } } return new CompositeValue(valueComponents); } }
Source:
<code>public Void call() throws Exception { Objects.requireNonNull(acls, "New acls to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); <START> OzoneClient client = address.createClient(createOzoneConfiguration()); <END> String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(keyName) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().setAcl(obj, OzoneAcl.parseAcls(acls)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); return null; }</code><technical_language>client needs closed end</technical_language>

Target:
public Void call() throws Exception { Objects.requireNonNull(acls, "New acls to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(keyName) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().setAcl(obj, OzoneAcl.parseAcls(acls)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); client.close(); return null; }
Source:
<code>public void setup() throws Exception { <START> when(jsonRequest.usePostMethod()).thenReturn(jsonRequest); <END> when(jsonRequest.useGetMethod()).thenReturn(jsonRequest); when(jsonRequest.useDeleteMethod()).thenReturn(jsonRequest); when(jsonRequest.addQueryParam(anyString(), anyString())).thenReturn(jsonRequest); when(jsonRequest.request()).thenReturn(jsonResponse); when(jsonRequest.setBody(any(GenerateSshPairRequest.class))).thenReturn(jsonRequest); when(requestFactory.fromUrl(anyString())).thenReturn(jsonRequest); client = new HttpSshServiceClient(API_URL, requestFactory); }</code><technical_language>create mock mannually SelfReturningAnswer instead of this code. wit jsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer()); P.S. SelfReturningAnswer is org.eclipse.che.core:che-core-commons-test</technical_language>

Target:
public void setup() throws Exception { jsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer()); when(jsonRequest.request()).thenReturn(jsonResponse); when(requestFactory.fromUrl(anyString())).thenReturn(jsonRequest); client = new HttpSshServiceClient(API_URL, requestFactory); }
Source:
<code>Cursor findCursor () { Cursor cursor = super.findCursor (); <START> if (cursor == null && OS.VERSION < OS.VERSION(10, 14, 0)) { <END> cursor = display.getSystemCursor (SWT.CURSOR_IBEAM); } return cursor; }</code><technical_language>check for READ_ONLY style is missing</technical_language>

Target:
Cursor findCursor () { Cursor cursor = super.findCursor (); if (cursor == null && (style & SWT.READ_ONLY) == 0 && OS.VERSION < OS.VERSION(10, 14, 0)) { cursor = display.getSystemCursor (SWT.CURSOR_IBEAM); } return cursor; }
Source:
<code>void bindInfrastructure() { bindCommonInfrastructure(WebAdminPlaceManager.class); bind(ApplicationInit.class).asEagerSingleton(); bind(InternalConfiguration.class).asEagerSingleton(); bind(PostMessageDispatcher.class).asEagerSingleton(); <START> bind(CurrentUserRole.class).to(CommonCurrentUserRole.class).in(Singleton.class); <END> }</code><technical_language>Hm, do suggested in UserPortal's SystemModule.java for consistency</technical_language>

Target:
void bindInfrastructure() { bindCommonInfrastructure(WebAdminPlaceManager.class); bind(InternalConfiguration.class).asEagerSingleton(); bind(PostMessageDispatcher.class).asEagerSingleton(); bindTypeAndImplAsSingleton(CurrentUserRole.class, CommonCurrentUserRole.class); }
Source:
<code>public String toString() { <START> String startAfter = mStartAfter == null ? "null" : mStartAfter.getId(); <END> String endBefore = mEndBefore == null ? "null" : mEndBefore.getId(); return "PageKey{" + "StartAfter=" + startAfter + ", EndBefore=" + endBefore + '}'; }</code><technical_language>String.valueOf(...)? TBH, pretty compiler this for if inline so: java return "PageKey{" + "StartAfter=" + mStartAfter.getId() + ", EndBefore=" + mEndBefore.getId() + '}';</technical_language>

Target:
public String toString() { String startAfter = mStartAfter == null ? null : mStartAfter.getId(); String endBefore = mEndBefore == null ? null : mEndBefore.getId(); return "PageKey{" + "StartAfter=" + startAfter + ", EndBefore=" + endBefore + '}'; }
Source:
<code><START> public void testStateAdvancedChange_deployFails() throws InterruptedException { <END> this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void deploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testStateAdvancedChange_deployFails() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void deploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }
Source:
<code>public Response getVendor(@Context HttpHeaders headers) { try { List<String> vendorNumbers = getVendorNumbersFromRequest(); <START> List<VendorDetail> vendors = SpringContext.getBean(CuCuEinvoiceDaoOjb.class).getVendors(vendorNumbers); <END> List<Properties> vendorsSerialized = vendors.stream().map(vendor -> getVendorProperties(vendor)).collect(Collectors.toList()); return Response.ok(gson.toJson(vendorsSerialized)).build(); } catch (BadRequestException ex) { return respondGetVendorsBadRequest(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }</code><technical_language>I suggest a getter auto-loads eInvoice DAO if needed, similar for lookup DAO in this class</technical_language>

Target:
public Response getVendor(@Context HttpHeaders headers) { try { List<String> vendorNumbers = getVendorNumbersFromRequest(); List<VendorDetail> vendors = getCuEinvoiceDao().getVendors(vendorNumbers); List<Properties> vendorsSerialized = vendors.stream().map(vendor -> getVendorProperties(vendor)).collect(Collectors.toList()); return Response.ok(gson.toJson(vendorsSerialized)).build(); } catch (BadRequestException ex) { return respondGetVendorsBadRequest(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }
Source:
<code>public void errorOccured(String error) { logger.error("Error occured: {}", error); <START> updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); <END> }</code><technical_language>add error message additional argument here, in order give users a chance understand is</technical_language>

Target:
public void errorOccured(String error) { logger.error("Error occured: {}", error); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, error); }
Source:
<code>protected void ensureHashTableLoaded() { if (this.hashTables.get().isPresent()) { return; } synchronized (hashTables) { if (this.hashTables.get().isPresent()) { return; } <START> int keyPositionCount = getRawKeyBlock().getPositionCount(); <END> int[] hashTables = new int[keyPositionCount * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); verify(this.hashTables.getExpectedHashTableCount() <= offsets.length, "incorrect offsets size"); for (int i = 0; i < this.hashTables.getExpectedHashTableCount(); i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables.set(hashTables); } }</code><technical_language>this change is needed</technical_language>

Target:
protected void ensureHashTableLoaded() { if (this.hashTables.get().isPresent()) { return; } synchronized (hashTables) { if (this.hashTables.get().isPresent()) { return; } int[] hashTables = new int[getRawKeyBlock().getPositionCount() * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); verify(this.hashTables.getExpectedHashTableCount() <= offsets.length, "incorrect offsets size"); for (int i = 0; i < this.hashTables.getExpectedHashTableCount(); i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables.set(hashTables); } }
Source:
<code>private static void deleteQuotas(final Connection connection, final byte[] rowKey, final byte[] qualifier) throws IOException { Delete delete = new Delete(rowKey); if (qualifier != null) { if (Arrays.equals(qualifier,QUOTA_QUALIFIER_POLICY)) { delete.addColumns(QUOTA_FAMILY_USAGE, qualifier); } else delete.addColumns(QUOTA_FAMILY_INFO, qualifier); } if (isNamespaceRowKey(rowKey)) { NamespaceDescriptor[] descs = connection.getAdmin().listNamespaceDescriptors(); String ns = getNamespaceFromRowKey(rowKey); <START> int index = 0; <END> while (index < descs.length) { if (ns.equals(descs[index].getName())) { Quotas namespaceQuota = getNamespaceQuota(connection,ns); if (namespaceQuota != null && namespaceQuota.hasSpace()) { TableName[] tableArray = connection.getAdmin().listTableNamesByNamespace(ns); for (TableName tableName : tableArray) { deleteQuotas(connection, getTableRowKey(tableName), QUOTA_QUALIFIER_POLICY); } } index = descs.length; } else { index++; } } } doDelete(connection, delete); }</code><technical_language>happen if get exception delete a quota? necessary retry operation again</technical_language>

Target:
private static void deleteQuotas(final Connection connection, final byte[] rowKey, final byte[] qualifier) throws IOException { Delete delete = new Delete(rowKey); if (qualifier != null) { delete.addColumns(QUOTA_FAMILY_INFO, qualifier); } if (isNamespaceRowKey(rowKey)) { String ns = getNamespaceFromRowKey(rowKey); Quotas namespaceQuota = getNamespaceQuota(connection,ns); if (namespaceQuota != null && namespaceQuota.hasSpace()) { deleteTableUsageSnapshotsForNamespace(connection, ns); } } doDelete(connection, delete); }
Source:
<code>public void wikipediaSexClassificationDataset() { Map<Integer, double[]> data = new HashMap<>(); double male = 0.; double female = 1.; data.put(0, new double[] {male, 6, 180, 12}); data.put(2, new double[] {male, 5.92, 190, 11}); data.put(3, new double[] {male, 5.58, 170, 12}); data.put(4, new double[] {male, 5.92, 165, 10}); data.put(5, new double[] {female, 5, 100, 6}); data.put(6, new double[] {female, 5.5, 150, 8}); data.put(7, new double[] {female, 5.42, 130, 7}); data.put(8, new double[] {female, 5.75, 150, 9}); GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer(); GaussianNaiveBayesModel model = trainer.fit( new LocalDatasetBuilder<>(data, 2), (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)), (k, v) -> v[0] ); <START> Vector observation = new DenseVector(new double[] {6, 130, 8}); <END> Assert.assertEquals(female, model.apply(observation), PRECISION); }</code><technical_language>Lets VectorUtils.of(...)</technical_language>

Target:
public void wikipediaSexClassificationDataset() { Map<Integer, double[]> data = new HashMap<>(); double male = 0.; double female = 1.; data.put(0, new double[] {male, 6, 180, 12}); data.put(2, new double[] {male, 5.92, 190, 11}); data.put(3, new double[] {male, 5.58, 170, 12}); data.put(4, new double[] {male, 5.92, 165, 10}); data.put(5, new double[] {female, 5, 100, 6}); data.put(6, new double[] {female, 5.5, 150, 8}); data.put(7, new double[] {female, 5.42, 130, 7}); data.put(8, new double[] {female, 5.75, 150, 9}); GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer(); GaussianNaiveBayesModel model = trainer.fit( new LocalDatasetBuilder<>(data, 2), (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)), (k, v) -> v[0] ); Vector observation = VectorUtils.of(6, 130, 8); Assert.assertEquals(female, model.apply(observation), PRECISION); }
Source:
<code><START> private void syncBreedingTrackers(EntityPlayer player) { <END> IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry; Collection<ISpeciesRoot> speciesRoots = alleleRegistry.getSpeciesRoot().values(); for (ISpeciesRoot speciesRoot : speciesRoots) { IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.getEntityWorld(), player.getGameProfile()); breedingTracker.synchToPlayer(player); } }</code><technical_language>This method need changed</technical_language>

Target:
private static void syncBreedingTrackers(EntityPlayer player) { IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry; Collection<ISpeciesRoot> speciesRoots = alleleRegistry.getSpeciesRoot().values(); for (ISpeciesRoot speciesRoot : speciesRoots) { IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.getEntityWorld(), player.getGameProfile()); breedingTracker.synchToPlayer(player); } }
Source:
<code>protected boolean isFinished() { <START> log.debug("isFinished called; State is " + (execThread == null ? "[uninitialized]" : execThread.getState().toString())); <END> return execThread != null && execThread.getState() == State.TERMINATED; }</code><technical_language>a cleaner pull this logic out a variable if changes in places</technical_language>

Target:
public boolean isFinished() { log.debug("isFinished called; Thread state is " + (execThread == null ? "[uninitialized]" : execThread.getState().toString())); boolean isFinished = execThread != null && execThread.getState() == State.TERMINATED; log.debug("isFinished is " + isFinished); return isFinished; }
Source:
<code>public S batchSize(int batchSize) { <START> attributes.attribute(BATCH_SIZE).set(batchSize); <END> return self(); }</code><technical_language>this invoke new maxBatchSize method remove BATCH_SIZE attribute. This exposed afaik</technical_language>

Target:
public S batchSize(int batchSize) { this.batchSize = batchSize; maxBatchSize(batchSize); return self(); }
Source:
<code><START> public static String getExtensionLocation(String extensionName, JSONObject extensionDetailJson) { <END> String extensionType; try { extensionType = extensionDetailJson.get(LOCATION).toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); throw new FalconCLIException("Failed to get extension type for the given extension"); } return extensionType; }</code><technical_language>This method copy-paste issues. Replace references type location</technical_language>

Target:
public static String getExtensionLocation(String extensionName, JSONObject extensionDetailJson) { String extensionBuildPath; try { extensionBuildPath = extensionDetailJson.get(LOCATION).toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); throw new FalconCLIException("Failed to get extension type for the given extension"); } return extensionBuildPath; }
Source:
<code>public void define(final Service service) { <START> service.get(DOMAIN_MAPPINGS, this::get, jsonTransformer); <END> service.put(SPECIFIC_MAPPING, this::addDomainMapping); service.delete(SPECIFIC_MAPPING, this::removeDomainMapping); }</code><technical_language>I thought it, GET /domainMappins potentially expensive computation iterates content of RecipientRewrite tables find domain mappings. allow get domain mappings for a single domain. like: GET /domainMappings/fromdomain.com ["domainalias1.com", "domainalias2.org"] mind adding it</technical_language>

Target:
public void define(final Service service) { service.get(DOMAIN_MAPPINGS, this::getAllMappings, jsonTransformer); service.get(SPECIFIC_MAPPING, this::getMapping, jsonTransformer); service.put(SPECIFIC_MAPPING, this::addDomainMapping); service.delete(SPECIFIC_MAPPING, this::removeDomainMapping); }
Source:
<code>public String toString() { String s; <START> String c = ""; <END> for (AST child : children) if (child != null) c = c + child.toString(); s = "[" + type.toString() + ": " + c + "]"; return s; }</code><technical_language>a StringBuffer instead of a String. A string is a set length of memory in Java, a new length of memory need allocated chars moved time concatenate strings. A StringBuilder, call .toString() end, need copy character concatenation. strictly a necessary change (since this is fully working I doubt graded Java String efficiency), I figure if give other additional feedback code improve Java programming</technical_language>

Target:
public String toString() { StringBuilder s = new StringBuilder(); s.append("[" + type.toString() + ": "); for (AST child : children) if (child != null) s.append(child.toString()); s.append("]"); return s.toString(); }
Source:
<code>public byte[] sign(byte[] contentBytes) throws SignatureGenerationException { try { if (privateKey == null) { <START> throw new IllegalArgumentException("The given Private Key is null."); <END> } return crypto.createSignatureFor(getDescription(), privateKey, contentBytes); } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalArgumentException e) { throw new SignatureGenerationException(this, e); } }</code><technical_language>IllegalStateException</technical_language>

Target:
public byte[] sign(byte[] contentBytes) throws SignatureGenerationException { try { if (privateKey == null) { throw new IllegalStateException("The given Private Key is null."); } return crypto.createSignatureFor(getDescription(), privateKey, contentBytes); } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) { throw new SignatureGenerationException(this, e); } }
Source:
<code>public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = <START> providerProxyFactory.create(provider); <END> try { providerProxy.deallocate(nic); } catch (EngineException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("NicName", nic.getName()); removePortFailureEvent.addCustomValue("NicId", nic.getId().toString()); removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); getAuditLogDirector().log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }</code><technical_language>afraid this produce NPE runtime, ExternalNetworkManager is injected, providerProxyFactory initialized. able verify this real setup</technical_language>

Target:
public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = getProviderProxyFactory().create(provider); try { providerProxy.deallocate(nic); } catch (EngineException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("NicName", nic.getName()); removePortFailureEvent.addCustomValue("NicId", nic.getId().toString()); removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); getAuditLogDirector().log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }
Source:
<code>public void should_execute_on_python_project() { Project project = mock(Project.class); assertThat(sensor.toString()).isEqualTo("PythonSquidSensor"); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); <START> fs.add(new DefaultInputFile(TestUtils.MODULE, "test.py").setLanguage(Python.KEY)); <END> assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); }</code><technical_language>@ivandalbosco imho this module key parameter is important in unit tests. WDYT dropping TestUtils (here in squid module) passing e.g. "moduleKey" instead TestUtils.MODULE? p.s. TestUtils contains method is</technical_language>

Target:
public void should_execute_on_python_project() { Project project = mock(Project.class); assertThat(sensor.toString()).isEqualTo("PythonSquidSensor"); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); fs.add(new DefaultInputFile("", "test.py").setLanguage(Python.KEY)); assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); }
Source:
<code><START> Worker createWorker() { <END> return Worker.create(pathToVerifier); }</code><technical_language>@Rikkola If 'Worker' class managed exclusively this class possibility override behavior, I suggest put 'private' visibility this method. Anyway, choice</technical_language>

Target:
protected Worker createWorker() { return Worker.create(pathToVerifier); }
Source:
<code>protected void readDomainElementAttributes(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { Namespace ns = Namespace.forUri(reader.getAttributeNamespace(i)); switch (ns) { case XML_SCHEMA_INSTANCE: { switch (Attribute.forName(reader.getAttributeLocalName(i))) { case SCHEMA_LOCATION: { parseSchemaLocations(reader, address, list, i); break; } case NO_NAMESPACE_SCHEMA_LOCATION: { break; } default: { throw unexpectedAttribute(reader, i); } } break; } default: switch (Attribute.forName(reader.getAttributeLocalName(i))) { case NAME: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(NAME); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } <START> case ORGANIZATION: END> case DOMAIN_ORGANIZATION: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(DOMAIN_ORGANIZATION); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } default: throw unexpectedAttribute(reader, i); } } } }</code><technical_language>I this happen a lot, if a customer organization domain-organization here, end is defined last</technical_language>

Target:
protected void readDomainElementAttributes(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException { boolean hasDomainOrg = false; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { Namespace ns = Namespace.forUri(reader.getAttributeNamespace(i)); switch (ns) { case XML_SCHEMA_INSTANCE: { switch (Attribute.forName(reader.getAttributeLocalName(i))) { case SCHEMA_LOCATION: { parseSchemaLocations(reader, address, list, i); break; } case NO_NAMESPACE_SCHEMA_LOCATION: { break; } default: { throw unexpectedAttribute(reader, i); } } break; } default: switch (Attribute.forName(reader.getAttributeLocalName(i))) { case NAME: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(NAME); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } case ORGANIZATION: { if (hasDomainOrg) { throw unexpectedAttribute(reader, i); } } case DOMAIN_ORGANIZATION: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(DOMAIN_ORGANIZATION); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); hasDomainOrg = true; break; } default: throw unexpectedAttribute(reader, i); } } } }