auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void triggerEvent(String channelId, String event) { if (getThing().getChannel(channelId) != null) { triggerChannel(getThing().getChannel(channelId).getUID(), event); return; <START> } <END> logger.warn("Event in thing does not exist, please recreate the thing", event, getThing().getUID()); }</code><technical_language>This part is related this PR topic of is replace scheduler. Next time please create a separate PR for changes. This review process a lot easier :) If want return early in a method, please do a check leads return do logic afterwards. Returning in middle of a method unreadable. please change //1. check if (getThing().getChannel(channelId) == null) { logger.warn("Event in exist, please recreate thing", event, getThing().getUID()); return; } //2. logic triggerChannel(getThing().getChannel(channelId).getUID(), event);</technical_language>

Target:
public void triggerEvent(String channelId, String event) { if (getThing().getChannel(channelId) == null) { logger.warn("Event in thing does not exist, please recreate the thing", event, getThing().getUID()); return; } triggerChannel(getThing().getChannel(channelId).getUID(), event); }
Source:
<code>private static Map<String, ClientRegistration> toUnmodifiableConcurrentMap(List<ClientRegistration> registrations) { final ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); for (ClientRegistration registration : registrations) { <START> if (result.containsKey(registration.getRegistrationId())) { <END> throw new IllegalStateException(String.format("Duplicate key %s", registration.getRegistrationId())); } result.put(registration.getRegistrationId(), registration); } return Collections.unmodifiableMap(result); }</code><technical_language>is this check necessary</technical_language>

Target:
private static Map<String, ClientRegistration> toUnmodifiableConcurrentMap(List<ClientRegistration> registrations) { ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); for (ClientRegistration registration : registrations) { if (result.containsKey(registration.getRegistrationId())) { throw new IllegalStateException(String.format("Duplicate key %s", registration.getRegistrationId())); } result.put(registration.getRegistrationId(), registration); } return Collections.unmodifiableMap(result); }
Source:
<code>private CommandImpl toWorkspaceCommand(Command devCommand, Action commandAction) { CommandImpl command = new CommandImpl(); command.setName(devCommand.getName()); command.setType(commandAction.getType()); <START> command.setCommandLine(commandAction.getCommand()); <END> if (commandAction.getWorkdir() != null) { command.getAttributes().put(WORKING_DIRECTORY_ATTRIBUTE, commandAction.getWorkdir()); } command.getAttributes().put(Constants.TOOL_NAME_COMMAND_ATTRIBUTE, commandAction.getTool()); if (devCommand.getAttributes() != null) { command.getAttributes().putAll(devCommand.getAttributes()); } return command; }</code><technical_language>Please check cases covered tests</technical_language>

Target:
private CommandImpl toWorkspaceCommand(Command devCommand, Action commandAction) { CommandImpl command = new CommandImpl(); command.setName(devCommand.getName()); command.setType(commandAction.getType()); command.setCommandLine(commandAction.getCommand()); if (commandAction.getWorkdir() != null) { command.getAttributes().put(WORKING_DIRECTORY_ATTRIBUTE, commandAction.getWorkdir()); } command.getAttributes().put(Constants.TOOL_NAME_COMMAND_ATTRIBUTE, commandAction.getTool()); command.getAttributes().putAll(devCommand.getAttributes()); return command; }
Source:
<code>public Object[] getElements(Object inputElement) { if(inputElement instanceof IBatchProperty){ return references.keySet().toArray(); }else if(inputElement instanceof IFile){ return references.get((IFile)inputElement).toArray(); } <START> return null; <END> }</code><technical_language>For simplicity, this return getChildren(inputElement);</technical_language>

Target:
public Object[] getElements(Object inputElement) { return getChildren(inputElement); }
Source:
<code>public void performAction() { boolean isSinglePanelViewNow = mainFrame.toggleSinglePanel(); if (isSinglePanelViewNow) { previousRatio = mainFrame.getSplitPane().getSplitRatio(); hideInactivePanel(); } else { mainFrame.getSplitPane().setSplitRatio(previousRatio); showInactivePanel(); } <START> MuConfigurations.getPreferences().setVariable(MuPreference.USE_SINGLE_PANEL_VIEW, isSinglePanelViewNow); <END> }</code><technical_language>This is a bit non-standard preferences set in preferences dialog. This record current selection of single panel view is more suitable for snapshot.xml configuration (holds state of application)</technical_language>

Target:
public void performAction() { boolean isSinglePanelViewNow = mainFrame.toggleSinglePanel(); if (isSinglePanelViewNow) { previousRatio = mainFrame.getSplitPane().getSplitRatio(); hideInactivePanel(); } else { mainFrame.getSplitPane().setSplitRatio(previousRatio); showInactivePanel(); } MuConfigurations.getSnapshot().setVariable("", mainFrame.isSinglePanel()); }
Source:
<code>@Override public String mimeType() { <START> return "application/json; charset=" + encode; <END> }</code><technical_language>Instead of making this string concatenation time, do in constructor cache field</technical_language>

Target:
@Override public String mimeType() { return mimeType; }
Source:
<code><START> private Collection<Slice> shardDeleteDelta(UUID oldShardUuid, Optional<UUID> oldDeltaDeleteShard, Optional<ShardInfo> newDeltaDeleteShard) <END> { return ImmutableList.of(Slices.wrappedBuffer(SHARD_DELETE_DELTA_CODEC.toJsonBytes( new ShardDeleteDelta(oldShardUuid, oldDeltaDeleteShard, newDeltaDeleteShard)))); }</code><technical_language>static</technical_language>

Target:
private static Collection<Slice> shardDeleteDelta(UUID oldShardUuid, Optional<UUID> oldDeltaDeleteShard, Optional<ShardInfo> newDeltaDeleteShard) { return ImmutableList.of(Slices.wrappedBuffer(SHARD_DELETE_DELTA_CODEC.toJsonBytes( new ShardDeleteDelta(oldShardUuid, new DeltaInfoPair(oldDeltaDeleteShard, newDeltaDeleteShard))))); }
Source:
<code>public static Permissionable findParentPermissionable(String parent) throws DotDataException { Permissionable permissionableParent = null; try { User systemUser = APILocator.getUserAPI().getSystemUser(); Identifier iden = APILocator.getIdentifierAPI().find(parent); if(UtilMethods.isSet(iden) && UtilMethods.isSet(iden.getAssetType())){ if(iden.getAssetType().equals("folder")){ permissionableParent = APILocator.getFolderAPI().find(parent,systemUser,false); }else{ Contentlet contentlet; contentlet = APILocator.getContentletAPI().findContentletByIdentifier(parent, false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false); if (contentlet == null) { List<Contentlet> results = APILocator.getContentletAPI() .search("+identifier:" + parent + " +working:true", 1, 0, null, systemUser, false); <START> if (!results.isEmpty()) { <END> contentlet = results.get(0); } } if (contentlet.isHost()) { permissionableParent = contentlet; } else { permissionableParent = contentlet.getParentPermissionable(); } } } else { throw new DotDataException("Parent Identifier: " + parent + " does NOT exist."); } } catch (DotSecurityException | IndexOutOfBoundsException e) { Logger.error(Rule.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } return permissionableParent; }</code><technical_language>![CRITICAL](<LINK_1> 'Severity: CRITICAL') Refactor this code nest more 4 if/for/while/switch/try statements. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public static Permissionable findParentPermissionable(String parent) throws DotDataException { Permissionable permissionableParent = null; try { User systemUser = APILocator.getUserAPI().getSystemUser(); Identifier iden = APILocator.getIdentifierAPI().find(parent); if(UtilMethods.isSet(iden) && UtilMethods.isSet(iden.getAssetType())){ if(iden.getAssetType().equals("folder")){ permissionableParent = APILocator.getFolderAPI().find(parent,systemUser,false); }else{ Contentlet contentlet; contentlet = APILocator.getContentletAPI().findContentletByIdentifier(parent, false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false); if (contentlet == null) { List<Contentlet> results = APILocator.getContentletAPI() .search("+identifier:" + parent + " +working:true", 1, 0, null, systemUser, false); if (!results.isEmpty()) { contentlet = results.get(0); } } if (contentlet == null) { throw new DotDataException("Identifier: " + parent + " does not exist."); } if (contentlet.isHost()) { permissionableParent = contentlet; } else { permissionableParent = contentlet.getParentPermissionable(); } } } else { throw new DotDataException("Parent Identifier: " + parent + " does NOT exist."); } } catch (DotSecurityException | IndexOutOfBoundsException e) { Logger.error(Rule.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } return permissionableParent; }
Source:
<code>@Override public boolean remove(int element) { if (element < 0) <START> throw new UnsupportedOperationException("Negative values are not supported!"); <END> boolean alreadySet = bitSet.get(element); if (alreadySet) { bitSet.clear(element); size--; } return alreadySet; }</code><technical_language>Return "false" well</technical_language>

Target:
@Override public boolean remove(int element) { if (element < 0) return false; boolean alreadySet = bitSet.get(element); if (alreadySet) { bitSet.clear(element); size--; } return alreadySet; }
Source:
<code>private <M extends Multimap<Long, String>> void testMultimapCollector(Class<? extends Multimap> erasedType, GenericType<M> genericType) { JdbiCollectors registry = dbRule.getJdbi().getConfig(JdbiCollectors.class); assertThat(registry.findElementTypeFor(genericType.getType())) .contains(new GenericType<Map.Entry<Long,String>>(){}.getType()); Collector<Map.Entry<Long,String>, ?, M> collector = (Collector<Map.Entry<Long, String>, ?, M>) registry .findFor(genericType.getType()) .orElseThrow(() -> new IllegalStateException("Missing collector for " + genericType)); M map = Stream.of(entry(1L, "foo"), entry(2L, "bar")).collect(collector); <START> Assertions.assertThat(map) <END> .isInstanceOf(erasedType) .containsAllEntriesOf(ImmutableMultimap.of(1L, "foo", 2L, "bar")); }</code><technical_language>assertThat</technical_language>

Target:
private <M extends Multimap<Long, String>> void testMultimapCollector(Class<? extends Multimap> erasedType, GenericType<M> genericType) { JdbiCollectors registry = dbRule.getJdbi().getConfig(JdbiCollectors.class); assertThat(registry.findElementTypeFor(genericType.getType())) .contains(new GenericType<Map.Entry<Long,String>>(){}.getType()); Collector<Map.Entry<Long,String>, ?, M> collector = (Collector<Map.Entry<Long, String>, ?, M>) registry .findFor(genericType.getType()) .orElseThrow(() -> new IllegalStateException("Missing collector for " + genericType)); M map = Stream.of(entry(1L, "foo"), entry(2L, "bar")).collect(collector); assertThat(map) .isInstanceOf(erasedType) .containsAllEntriesOf(ImmutableMultimap.of(1L, "foo", 2L, "bar")); }
Source:
<code>private boolean hasSameLicense(Artifact license) throws MojoExecutionException, IOException { boolean sameLicense = false; if (license != null) { InputStream licenseInfo = getZipEntry(license.getFile(), "wlp/lafiles/LI_en"); if (licenseInfo == null) { <START> log.warn("The license file may be corrupted"); <END> return sameLicense; } File lic = new File(assemblyInstallDirectory, "wlp/lafiles/LI_en"); if (!lic.exists()) { return sameLicense; } FileInputStream installedLicenseInfo = new FileInputStream(lic); sameLicense = IOUtil.contentEquals(licenseInfo, installedLicenseInfo); licenseInfo.close(); installedLicenseInfo.close(); } return sameLicense; }</code><technical_language>this added messages file? intended warn.install.license is fixed in properties file</technical_language>

Target:
private boolean hasSameLicense(Artifact license) throws MojoExecutionException, IOException { boolean sameLicense = false; if (license != null) { InputStream licenseInfo = getZipEntry(license.getFile(), "wlp/lafiles/LI_en"); if (licenseInfo == null) { log.warn(MessageFormat.format(messages.getString("warn.install.license"), license.getArtifactId())); return sameLicense; } File lic = new File(assemblyInstallDirectory, "wlp/lafiles/LI_en"); if (!lic.exists()) { FileInputStream installedLicenseInfo = new FileInputStream(lic); sameLicense = IOUtil.contentEquals(licenseInfo, installedLicenseInfo); licenseInfo.close(); installedLicenseInfo.close(); } } return sameLicense; }
Source:
<code>private List<Object> listOfArrays(SessionImplementor session, Iterator<Tuple> tuples) { List<Object> results = new ArrayList<Object>(); while ( tuples.hasNext() ) { Tuple tuple = tuples.next(); Object[] entry = null; if ( !customQuery.getCustomQueryReturns().isEmpty() ) { entry = new Object[customQuery.getCustomQueryReturns().size()]; int i = 0; for ( Return queryReturn : customQuery.getCustomQueryReturns() ) { ScalarReturn scalarReturn = (ScalarReturn) queryReturn; Type type = scalarReturn.getType(); if ( type != null ) { GridType gridType = typeTranslator.getType( type ); entry[i++] = gridType.nullSafeGet( tuple, scalarReturn.getColumnAlias(), session, null ); } else { <START> entry[i++] = tuple.get( ( scalarReturn ).getColumnAlias() ); <END> } } } else { entry = new Object[tuple.getColumnNames().size()]; int i = 0; for ( String column : tuple.getColumnNames() ) { entry[i++] = tuple.get( column ); } } if ( entry.length == 1 ) { results.add( entry[0] ); } else { results.add( entry ); } } return results; }</code><technical_language>Do need brackets scalarReturn</technical_language>

Target:
private List<Object> listOfArrays(SessionImplementor session, Iterator<Tuple> tuples) { List<Object> results = new ArrayList<Object>(); while ( tuples.hasNext() ) { Tuple tuple = tuples.next(); Object[] entry = null; if ( !customQuery.getCustomQueryReturns().isEmpty() ) { entry = new Object[customQuery.getCustomQueryReturns().size()]; int i = 0; for ( Return queryReturn : customQuery.getCustomQueryReturns() ) { ScalarReturn scalarReturn = (ScalarReturn) queryReturn; Type type = scalarReturn.getType(); if ( type != null ) { GridType gridType = typeTranslator.getType( type ); entry[i++] = gridType.nullSafeGet( tuple, scalarReturn.getColumnAlias(), session, null ); } else { entry[i++] = tuple.get( scalarReturn.getColumnAlias() ); } } } else { entry = new Object[tuple.getColumnNames().size()]; int i = 0; for ( String column : tuple.getColumnNames() ) { entry[i++] = tuple.get( column ); } } if ( entry.length == 1 ) { results.add( entry[0] ); } else { results.add( entry ); } } return results; }
Source:
<code>private static String getStoreName(JSONObject arg0) { String storeName = arg0 != null ? arg0.optString(STORE_NAME, DEFAULT_STORE_NAME) : DEFAULT_STORE_NAME; <START> return storeName==null?DEFAULT_STORE_NAME:storeName; <END> }</code><technical_language>null here</technical_language>

Target:
private static String getStoreName(JSONObject arg0) { return arg0 != null ? arg0.optString(STORE_NAME, DEFAULT_STORE_NAME) : DEFAULT_STORE_NAME; }
Source:
<code>public Factory saveFactory(Iterator<FileItem> formData, @Context UriInfo uriInfo) throws ForbiddenException, ConflictException, BadRequestException, ServerException, NotFoundException { try { final Set<FactoryImage> images = new HashSet<>(); Factory factory = null; while (formData.hasNext()) { final FileItem item = formData.next(); <START> switch (item.getFieldName()) { <END> case ("factory"): { try (InputStream factoryData = item.getInputStream()) { factory = factoryBuilder.build(factoryData); } catch (JsonSyntaxException e) { throw new BadRequestException("You have provided an invalid JSON. For more information, please visit: " + "<LINK_0>"); } break; } case ("image"): { try (InputStream imageData = item.getInputStream()) { final FactoryImage factoryImage = FactoryImage.createImage(imageData, item.getContentType(), NameGenerator.generate(null, 16)); if (factoryImage.hasContent()) { images.add(factoryImage); } } break; } } } if (factory == null) { LOG.warn("No factory information found in 'factory' section of multipart form-data."); throw new BadRequestException("No factory information found in 'factory' section of multipart/form-data."); } processDefaults(factory); createValidator.validateOnCreate(factory); final Factory storedFactory = factoryStore.getFactory(factoryStore.saveFactory(factory, images)); return storedFactory.withLinks(createLinks(storedFactory, images, uriInfo)); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); throw new ServerException(e.getLocalizedMessage(), e); } }</code><technical_language>Add default: case findbugs throw warning</technical_language>

Target:
public Factory saveFactory(Iterator<FileItem> formData, @Context UriInfo uriInfo) throws ForbiddenException, ConflictException, BadRequestException, ServerException, NotFoundException { try { final Set<FactoryImage> images = new HashSet<>(); Factory factory = null; while (formData.hasNext()) { final FileItem item = formData.next(); switch (item.getFieldName()) { case ("factory"): { try (InputStream factoryData = item.getInputStream()) { factory = factoryBuilder.build(factoryData); } catch (JsonSyntaxException e) { throw new BadRequestException("You have provided an invalid JSON. For more information, please visit: " + "<LINK_0>"); } break; } case ("image"): { try (InputStream imageData = item.getInputStream()) { final FactoryImage factoryImage = FactoryImage.createImage(imageData, item.getContentType(), NameGenerator.generate(null, 16)); if (factoryImage.hasContent()) { images.add(factoryImage); } } break; } default: } } if (factory == null) { LOG.warn("No factory information found in 'factory' section of multipart form-data."); throw new BadRequestException("No factory information found in 'factory' section of multipart/form-data."); } processDefaults(factory); createValidator.validateOnCreate(factory); final Factory storedFactory = factoryStore.getFactory(factoryStore.saveFactory(factory, images)); return storedFactory.withLinks(createLinks(storedFactory, images, uriInfo)); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); throw new ServerException(e.getLocalizedMessage(), e); } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof VmGuestAgentInterface)) { return false; } <START> VmGuestAgentInterface other = (VmGuestAgentInterface) obj; return Objects.equals(getInterfaceName(), other.getInterfaceName()) && Objects.equals(getIpv4Addresses(), other.getIpv4Addresses()) && Objects.equals(getIpv6Addresses(), other.getIpv6Addresses()) && Objects.equals(getMacAddress(), other.getMacAddress()) && Objects.equals(getVmId(), other.getVmId()); <END> }</code><technical_language>In places changed of getter direct access members, do that, intentionally</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof VmGuestAgentInterface)) { return false; } VmGuestAgentInterface other = (VmGuestAgentInterface) obj; return Objects.equals(interfaceName, other.interfaceName) && Objects.equals(ipv4Addresses, other.ipv4Addresses) && Objects.equals(ipv6Addresses, other.ipv6Addresses) && Objects.equals(macAddress, other.macAddress) && Objects.equals(vmId, other.vmId); }
Source:
<code>public void clickDeleteTableButton() { <START> waitForElementByElement(iframe); <END> driver.switchTo().frame(iframe); Actions actions = new Actions(driver); actions.contextClick(VisualModeTable).build().perform(); driver.switchTo().defaultContent(); driver.switchTo().frame(contextFrame); deleteItem.click(); driver.switchTo().defaultContent(); waitForElementNotPresent(articleTableBy); }</code><technical_language>put method contents private method WebElement parameter</technical_language>

Target:
public void clickDeleteTableButton() { selectFromContextMenu(deleteItem); }
Source:
<code>public void test_FirstPollStrategy_Earliest_NotEnforced_OnTopologyActivateDeactivate() throws Exception { try (Time.SimulatedTime simulatedTime = new Time.SimulatedTime()) { final int messageCount = 2; prepareSpout(messageCount); nextTuple_verifyEmitted_ack_resetCollectorMock(0); doNothing().when(consumerSpy).close(); spout.deactivate(); verifyAllMessagesCommitted(1, 1); spout.activate(); nextTuple_verifyEmitted_ack_resetCollectorMock(1); commitAndVerifyMessagesCommitted(messageCount, 2); } <START> } <END></code><technical_language>I this test is testing different. partition reassignment case is covered test above. This is testing case spout crashed is restarted</technical_language>

Target:
public void test_FirstPollStrategy_Earliest_NotEnforced_OnTopologyActivateDeactivate() throws Exception { final int messageCount = 2; prepareSpout(messageCount); nextTuple_verifyEmitted_ack_resetCollector(0); spout.deactivate(); verifyAllMessagesCommitted(1); consumerSpy = createConsumerSpy(); spout.activate(); nextTuple_verifyEmitted_ack_resetCollector(1); commitAndVerifyAllMessagesCommitted(messageCount); }
Source:
<code>public CompilerPluginFacet() { pluginArtifact = DependencyArtifact.Compiler; dependencies = new ArrayList<DependencyBuilder>(0); executions = new ArrayList<Execution>(0); configurations = Arrays.asList(new ConfigurationElement[] { <START> ConfigurationElementBuilder.create().setName("source").setText("1.7"), <END> ConfigurationElementBuilder.create().setName("target").setText("1.7") }); }</code><technical_language>before, appreciate if update this "1.8"</technical_language>

Target:
public CompilerPluginFacet() { pluginArtifact = DependencyArtifact.Compiler; dependencies = new ArrayList<DependencyBuilder>(0); executions = new ArrayList<Execution>(0); configurations = Arrays.asList(new ConfigurationElement[] { ConfigurationElementBuilder.create().setName("source").setText("1.8"), ConfigurationElementBuilder.create().setName("target").setText("1.8") }); }
Source:
<code>protected <E> void remove( final E entity, final AsyncCallback<Long> responder ) { try { if( entity == null ) throw new IllegalArgumentException( ExceptionMessage.NULL_ENTITY ); AsyncCallback<Object> removalCallback = new AsyncCallback<Object>() { @Override public void handleResponse( Object response ) { FootprintsManager.getInstance().Inner.removeFootprintForObject( BackendlessSerializer.serializeToMap( entity ), entity ); if( responder == null ) return; responder.handleResponse( ((Number) response).longValue() ); } @Override public void handleFault( BackendlessFault fault ) { if( responder != null ) responder.handleFault( fault ); } }; if( ReflectionUtil.hasField( entity.getClass(), Persistence.DEFAULT_OBJECT_ID_FIELD ) ) { Invoker.invokeAsync( PERSISTENCE_MANAGER_SERVER_ALIAS, "remove", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), getSimpleName( entity.getClass() ), entity }, removalCallback ); } else { String objectId = FootprintsManager.getInstance().getObjectId( entity ); <START> Invoker.invokeAsync( PERSISTENCE_MANAGER_SERVER_ALIAS, "remove", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), getSimpleName( entity.getClass() ), objectId }, removalCallback ); <END> } } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }</code><technical_language>reason duplicate code</technical_language>

Target:
protected <E> void remove( final E entity, final AsyncCallback<Long> responder ) { try { if( entity == null ) throw new IllegalArgumentException( ExceptionMessage.NULL_ENTITY ); AsyncCallback<Object> removalCallback = new AsyncCallback<Object>() { @Override public void handleResponse( Object response ) { FootprintsManager.getInstance().Inner.removeFootprintForObject( BackendlessSerializer.serializeToMap( entity ), entity ); if( responder == null ) return; responder.handleResponse( ((Number) response).longValue() ); } @Override public void handleFault( BackendlessFault fault ) { if( responder != null ) responder.handleFault( fault ); } }; Object entityArg = ReflectionUtil.hasField( entity.getClass(), Persistence.DEFAULT_OBJECT_ID_FIELD ) ? entity : FootprintsManager.getInstance().getObjectId( entity ); Invoker.invokeAsync( PERSISTENCE_MANAGER_SERVER_ALIAS, "remove", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), getSimpleName( entity.getClass() ), entityArg }, removalCallback ); } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }
Source:
<code>public static boolean makeMossy(Block block) { switch (block.getType()) { case COBBLESTONE: case DIRT: <START> case COBBLE_WALL <END> return true; case SMOOTH_BRICK: if (block.getData() == 0) { return true; } default: return false; } }</code><technical_language>This line needs a colon, "case COBBLE_WALL:" I note lower, smooth brick check</technical_language>

Target:
public static boolean makeMossy(Block block) { switch (block.getType()) { case COBBLESTONE: case DIRT: return true; case SMOOTH_BRICK: case COBBLE_WALL: if (block.getData() == 0) { return true; } default: return false; } }
Source:
<code>public void test_createXClasses() throws Exception { DocumentReference docRef = classDef.getClassRef(); <START> XWikiDocument doc = ModelAccessStub.get().injectNewDoc(docRef).doc(); <END> expect(getMock(ConfigurationSource.class).getProperty(ClassPackage.CFG_SRC_KEY)).andReturn( Arrays.asList(classPackage.getName())).anyTimes(); expect(getMock(ConfigurationSource.class).getProperty(ClassDefinition.CFG_SRC_KEY)).andReturn( null).anyTimes(); replayDefault(); creator.createXClasses(); creator.createXClasses(); verifyDefault(); assertEquals(1, ModelAccessStub.get().getInjectedDoc(docRef).getSavedCount()); assertEquals(classDef.isInternalMapping(), doc.getXClass().hasInternalCustomMapping()); @SuppressWarnings("unchecked") List<BaseCollection> xFields = new ArrayList<>(doc.getXClass().getFieldList()); assertEquals(classDef.getFields().size(), xFields.size()); int count = 0; for (ClassField<?> field : classDef.getFields()) { BaseCollection xField = xFields.get(count++); assertNotNull(xField); assertEquals(field.getName(), xField.getName()); } }</code><technical_language>mockDoc(docRef) is more clear naming</technical_language>

Target:
public void test_createXClasses() throws Exception { DocumentReference docRef = classDef.getClassRef(); XWikiDocument doc = ModelMock.get().mockDoc(docRef).doc(); expect(getMock(ConfigurationSource.class).getProperty(ClassPackage.CFG_SRC_KEY)).andReturn( Arrays.asList(classPackage.getName())).anyTimes(); expect(getMock(ConfigurationSource.class).getProperty(ClassDefinition.CFG_SRC_KEY)).andReturn( null).anyTimes(); replayDefault(); creator.createXClasses(); creator.createXClasses(); verifyDefault(); assertEquals(1, ModelMock.get().mockDoc(docRef).getSavedCount()); assertEquals(classDef.isInternalMapping(), doc.getXClass().hasInternalCustomMapping()); @SuppressWarnings("unchecked") List<BaseCollection> xFields = new ArrayList<>(doc.getXClass().getFieldList()); assertEquals(classDef.getFields().size(), xFields.size()); int count = 0; for (ClassField<?> field : classDef.getFields()) { BaseCollection xField = xFields.get(count++); assertNotNull(xField); assertEquals(field.getName(), xField.getName()); } }
Source:
<code>public static List<String> getBrokersFromURL(String url) { <START> if (url.startsWith("jdbc:")) { <END> url = url.substring(5); } URI uri = URI.create(url); return getBrokersFromURI(uri); }</code><technical_language>sense case insensitive check</technical_language>

Target:
public static List<String> getBrokersFromURL(String url) { if (url.toLowerCase().startsWith("jdbc:")) { url = url.substring(5); } URI uri = URI.create(url); return getBrokersFromURI(uri); }
Source:
<code>private static String toPatch(String type, PatchSet.Id diffBase, Patch.Key id) { PatchSet.Id ps = id.getParentKey(); Change.Id c = ps.getParentKey(); StringBuilder p = new StringBuilder(); p.append("/c/").append(c).append("/"); if (diffBase != null) { p.append(diffBase.get()).append(".."); } <START> p.append(ps.get()).append("/").append(KeyUtil.encode(id.get())); <END> if (type != null && !type.isEmpty()) { p.append(",").append(type); } return p.toString(); }</code><technical_language>If replace this fileName write new method write a tiny wrapper calls this fileName version id.get()</technical_language>

Target:
private static String toPatch(String type, PatchSet.Id diffBase, Patch.Key id) { return toPatch(type, diffBase, id.getParentKey(), id.get()); }
Source:
<code>public static PublicKey loadPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException { byte[] decodedPublicKey = Base64Encoder.decode(publicKey); KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM, PROVIDER); ECParameterSpec parameterSpec; <START> parameterSpec = ECNamedCurveTable.getParameterSpec(CURVE); <END> ECCurve curve = parameterSpec.getCurve(); ECPoint point = curve.decodePoint(decodedPublicKey); ECPublicKeySpec pubSpec = new ECPublicKeySpec(point, parameterSpec); return keyFactory.generatePublic(pubSpec); }</code><technical_language>splitting this rows</technical_language>

Target:
public static PublicKey loadPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException { byte[] decodedPublicKey = Base64Encoder.decode(publicKey); KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM, PROVIDER); ECParameterSpec parameterSpec = ECNamedCurveTable.getParameterSpec(CURVE); ECCurve curve = parameterSpec.getCurve(); ECPoint point = curve.decodePoint(decodedPublicKey); ECPublicKeySpec pubSpec = new ECPublicKeySpec(point, parameterSpec); return keyFactory.generatePublic(pubSpec); }
Source:
<code>public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { return oauth2Token(request.attributes()) .map(oauth2Token -> bearer(request, oauth2Token)) .flatMap(next::exchange) <START> .switchIfEmpty(Mono.defer(() -> next.exchange(request))); <END> }</code><technical_language>write java return oauth2Token(request.attributes()) .map(oauth2Token -> bearer(request, oauth2Token)) .defaultIfEmpty(request) .flatMap(next::exchange); This create Publishers/functions duplicate next::exchange</technical_language>

Target:
public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { return oauth2Token(request.attributes()) .map(oauth2Token -> bearer(request, oauth2Token)) .defaultIfEmpty(request) .flatMap(next::exchange); }
Source:
<code>public void testIncrementalReconfigInvokedOnHiearchicalQS() throws Exception { qu = new QuorumUtil(2); qu.disableJMXTest = true; qu.startAll(); ZooKeeper[] zkArr = ReconfigTest.createHandles(qu); ZooKeeperAdmin[] zkAdminArr = ReconfigTest.createAdminHandles(qu); ArrayList<String> members = new ArrayList<String>(); members.add("group.1=3:4:5"); members.add("group.2=1:2"); members.add("weight.1=0"); members.add("weight.2=0"); members.add("weight.3=1"); members.add("weight.4=1"); members.add("weight.5=1"); for (int i = 1; i <= 5; i++) { <START> members.add("server." <END> + i + "=127.0.0.1:" + qu.getPeer(i).peer.getQuorumAddress().getPort() + ":" + qu.getPeer(i).peer.getElectionAddress().getPort() + ";" + "127.0.0.1:" + qu.getPeer(i).peer.getClientPort()); } ReconfigTest.reconfig(zkAdminArr[1], null, null, members, -1); ReconfigTest.testNormalOperation(zkArr[1], zkArr[2]); List<String> leavingServers = new ArrayList<String>(); leavingServers.add("3"); try { zkAdminArr[1].reconfigure(null, leavingServers, null, -1, null); Assert.fail("Reconfig should have failed since the current config isn't Majority QS"); } catch (KeeperException.BadArgumentsException e) { } catch (Exception e) { Assert.fail("Should have been BadArgumentsException!"); } ReconfigTest.closeAllHandles(zkArr, zkAdminArr); }</code><technical_language>is worth reverting</technical_language>

Target:
public void testIncrementalReconfigInvokedOnHiearchicalQS() throws Exception { qu = new QuorumUtil(2); qu.disableJMXTest = true; qu.startAll(); ZooKeeper[] zkArr = ReconfigTest.createHandles(qu); ZooKeeperAdmin[] zkAdminArr = ReconfigTest.createAdminHandles(qu); ArrayList<String> members = new ArrayList<String>(); members.add("group.1=3:4:5"); members.add("group.2=1:2"); members.add("weight.1=0"); members.add("weight.2=0"); members.add("weight.3=1"); members.add("weight.4=1"); members.add("weight.5=1"); for (int i = 1; i <= 5; i++) { members.add("server." + i + "=127.0.0.1:" + qu.getPeer(i).peer.getQuorumAddress().getPort() + ":" + qu.getPeer(i).peer.getElectionAddress().getPort() + ";" + "127.0.0.1:" + qu.getPeer(i).peer.getClientPort()); } ReconfigTest.reconfig(zkAdminArr[1], null, null, members, -1); ReconfigTest.testNormalOperation(zkArr[1], zkArr[2]); List<String> leavingServers = new ArrayList<String>(); leavingServers.add("3"); try { zkAdminArr[1].reconfigure(null, leavingServers, null, -1, null); fail("Reconfig should have failed since the current config isn't Majority QS"); } catch (KeeperException.BadArgumentsException e) { } catch (Exception e) { fail("Should have been BadArgumentsException!"); } ReconfigTest.closeAllHandles(zkArr, zkAdminArr); }
Source:
<code><START> public int compareTo(final OrganisationPreviousName o) { <END> return getName().compareTo(o.getName()); }</code><technical_language>this based endDate DESC, name ASC name</technical_language>

Target:
public int compareTo(final OrganisationPreviousName o) { final int compare = this.getEndDate().compareTo(o.getEndDate()); if (compare == 0) { final int nameCompare = this.getName().compareTo(o.getName()); return nameCompare; } else { return compare; } }
Source:
<code>public String getDisplayName() { <START> return "Send a delayed Gerrit approval"; <END> }</code><technical_language>This I18n'ed</technical_language>

Target:
public String getDisplayName() { return Messages.SendDelayedGerritApproval(); }
Source:
<code>public boolean isSortable() { if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { final UserPostListingURL.Type type = url.asUserPostListURL().type; <START> return (type != UserPostListingURL.Type.SAVED && type != UserPostListingURL.Type.UPVOTED <END> && type != UserPostListingURL.Type.DOWNVOTED && type != UserPostListingURL.Type.HIDDEN); } return (url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) || (url.pathType() == RedditURLParser.MULTIREDDIT_POST_LISTING_URL) || (url.pathType() == RedditURLParser.SEARCH_POST_LISTING_URL); }</code><technical_language>return type == SUBMITTED</technical_language>

Target:
public boolean isSortable() { if(url.pathType() == RedditURLParser.USER_POST_LISTING_URL) { return (url.asUserPostListURL().type == UserPostListingURL.Type.SUBMITTED); } return (url.pathType() == RedditURLParser.SUBREDDIT_POST_LISTING_URL) || (url.pathType() == RedditURLParser.MULTIREDDIT_POST_LISTING_URL) || (url.pathType() == RedditURLParser.SEARCH_POST_LISTING_URL); }
Source:
<code>public void verifyHistoryPageHeader(String targetText) { Assertion.assertStringContains(targetText, getModeName()); <START> PageObjectLogging.log("verifyHistoryPageHeader", <END> "verifying the summary shows " + targetText, true); }</code><technical_language>wrong formatting - parameter in new line</technical_language>

Target:
public void verifyHistoryPageHeader(String targetText) { Assertion.assertStringContains(targetText, getModeName()); PageObjectLogging.log( "verifyHistoryPageHeader", "The summary shows " + targetText, true ); }
Source:
<code>public static ClientConfig fromServiceConfig(ServiceConfiguration serviceConfig) { ClientConfig clientConfig = new ClientConfig(); if (serviceConfig.security().isPresent()) { clientConfig.ssl(SslSocketFactories.createSslSocketFactory(serviceConfig.security().get()), (X509TrustManager) SslSocketFactories.createTrustManagers(serviceConfig.security().get())[0]); } if (serviceConfig.connectTimeout().isPresent()) { <START> clientConfig.connectTimeout(serviceConfig.connectTimeout().get()); <END> } if (serviceConfig.readTimeout().isPresent()) { clientConfig.readTimeout(serviceConfig.readTimeout().get()); } if (serviceConfig.writeTimeout().isPresent()) { clientConfig.writeTimeout(serviceConfig.writeTimeout().get()); } if (serviceConfig.proxyConfiguration().isPresent()) { clientConfig.proxy(serviceConfig.proxyConfiguration().get()); } return clientConfig; }</code><technical_language>this change clientConfig#connectTimeout(Optional<Duration>) additional method simplify this code</technical_language>

Target:
public static ClientConfig fromServiceConfig(ServiceConfiguration serviceConfig) { ClientConfig.Builder clientConfig = builder(); if (serviceConfig.security().isPresent()) { clientConfig.sslSocketFactory(SslSocketFactories.createSslSocketFactory(serviceConfig.security().get())); clientConfig.trustManager( (X509TrustManager) SslSocketFactories.createTrustManagers(serviceConfig.security().get())[0]); } clientConfig.connectTimeout(serviceConfig.connectTimeout().or(CONNECT_TIMEOUT)); clientConfig.readTimeout(serviceConfig.readTimeout().or(READ_TIMEOUT)); clientConfig.writeTimeout(serviceConfig.writeTimeout().or(WRITE_TIMEOUT)); clientConfig.proxy(serviceConfig.proxyConfiguration()); return clientConfig.build(); }
Source:
<code>public void testSMSSendingExploit() throws Exception { <START> int inboxSizeBeforeExploit <END> = getSMSInboxSize(); TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE); if(!telephonyManager.isSmsCapable()) { return; } SmsManager manager = SmsManager.getDefault(); manager.sendTextMessage("25578", null, "STOP", null, null); SystemClock.sleep(250); int inboxSizeAfterExploit = getSMSInboxSize(); assertTrue("Device is vulnerable to bug #22314646!! For more information " + "please refer - <LINK_0>" + "opt/telephony/+/ce058be%5E!/", inboxSizeBeforeExploit == inboxSizeAfterExploit); }</code><technical_language>move this line check logic below? Calling getSMSInboxSize() caused exception if is telephony</technical_language>

Target:
public void testSMSSendingExploit() throws Exception { TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE); if(!telephonyManager.isSmsCapable()) { return; } int inboxSizeBeforeExploit = getSMSInboxSize(); SmsManager manager = SmsManager.getDefault(); manager.sendTextMessage("25578", null, "STOP", null, null); SystemClock.sleep(250); int inboxSizeAfterExploit = getSMSInboxSize(); assertTrue("Device is vulnerable to bug #22314646!! For more information " + "please refer - <LINK_0>" + "opt/telephony/+/ce058be%5E!/", inboxSizeBeforeExploit == inboxSizeAfterExploit); }
Source:
<code>public void testUnZipInvalidFile() { String usrDir = System.getProperty("java.io.tmpdir"); long currentTimeMillis = System.currentTimeMillis(); File zipFolder = new File(usrDir + File.separator + currentTimeMillis); if (!zipFolder.exists()) { zipFolder.mkdirs(); } File unzipFolder = new File(usrDir + File.separator + currentTimeMillis + 1); if (!unzipFolder.exists()) { unzipFolder.mkdirs(); } String file = new File(zipFolder, "testzp.zip").getAbsolutePath(); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(file); IOUtil.copyCompletely(getClass().getResourceAsStream("/resources/zip-slip.zip"), fileOutputStream); Util.unZipFile(file, unzipFolder.getAbsolutePath(), 8, new NullProgressMonitor()); String[] unzippedFiles = unzipFolder.list(); assertNotNull(unzippedFiles); assertTrue(unzippedFiles.length == 1); } catch (IOException e) { assertTrue(e.getMessage().contains("Invalid output path")); } finally { try { if (fileOutputStream != null) { fileOutputStream.close(); } <START> } catch (IOException e) { <END> } try { ZipToFile.deleteDirectory(zipFolder); ZipToFile.deleteDirectory(unzipFolder); } catch (Exception e) { } } }</code><technical_language>add some log for exception</technical_language>

Target:
public void testUnZipInvalidFile() throws IOException { File zipFolder = Files.createTempDirectory("zipfolder").toFile(); File unzipFolder = Files.createTempDirectory("unzipfolder").toFile(); String file = new File(zipFolder, "testzp.zip").getAbsolutePath(); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(file); IOUtil.copyCompletely(getClass().getResourceAsStream("/resources/zip-slip.zip"), fileOutputStream); Util.unZipFile(file, unzipFolder.getAbsolutePath(), 8, new NullProgressMonitor()); } catch (IOException e) { assertTrue(e.getMessage().contains("Invalid output path")); } finally { try { if (fileOutputStream != null) { fileOutputStream.close(); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } try { ZipToFile.deleteDirectory(zipFolder); ZipToFile.deleteDirectory(unzipFolder); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } }
Source:
<code>public RedirectAction getRedirectAction(final WebContext context) { init(); if (ajaxRequestResolver.isAjax(context)) { logger.info("AJAX request detected -> returning 401"); RedirectAction action = redirectActionBuilder.redirect(context); cleanRequestedUrl(context); final String url = action.getLocation(); if (CommonHelper.isNotBlank(url)) { context.setResponseHeader(HttpConstants.LOCATION_HEADER, url); } throw HttpAction.unauthorized(context); } <START> final String attemptedAuth = (String) context.getSessionStore().get(context, getName() + ATTEMPTED_AUTHENTICATION_SUFFIX).get(); <END> if (CommonHelper.isNotBlank(attemptedAuth)) { cleanAttemptedAuthentication(context); cleanRequestedUrl(context); throw HttpAction.unauthorized(context); } return redirectActionBuilder.redirect(context); }</code><technical_language>again, calling .get() alone..</technical_language>

Target:
public RedirectAction getRedirectAction(final WebContext context) { init(); if (ajaxRequestResolver.isAjax(context)) { logger.info("AJAX request detected -> returning 401"); RedirectAction action = redirectActionBuilder.redirect(context); cleanRequestedUrl(context); final String url = action.getLocation(); if (CommonHelper.isNotBlank(url)) { context.setResponseHeader(HttpConstants.LOCATION_HEADER, url); } throw HttpAction.unauthorized(context); } context .getSessionStore().get(context, getName() + ATTEMPTED_AUTHENTICATION_SUFFIX) .ifPresent( attemptedAuth -> { if (CommonHelper.isNotBlank((String) attemptedAuth)) { cleanAttemptedAuthentication(context); cleanRequestedUrl(context); throw HttpAction.unauthorized(context); } }); return redirectActionBuilder.redirect(context); }
Source:
<code>private void determineNumberOfValidGroupLines(Rect newRootViewDimensions) { FrameLayout header = (FrameLayout)findViewById(R.id.form_entry_header); TextView groupLabel = ((TextView)header.findViewById(R.id.form_entry_group_label)); int contentSize = newRootViewDimensions.height(); View navBar = this.findViewById(R.id.nav_pane); int headerSize = navBar.getHeight(); if(headerSize == 0) { headerSize = this.getResources().getDimensionPixelSize(R.dimen.new_progressbar_minheight); } int availableWindow = contentSize - headerSize - getActionBarSize(); int questionFontSize = getFontSizeInPx(); int spaceRequested = questionFontSize * 6; int spaceAvailable = availableWindow - spaceRequested; int defaultHeaderSpace = this.getResources().getDimensionPixelSize(R.dimen.content_min_margin) * 2; float textSize = groupLabel.getTextSize(); int numberOfGroupLinesAllowed = (int)((spaceAvailable - defaultHeaderSpace) / textSize); if(numberOfGroupLinesAllowed < 0) { numberOfGroupLinesAllowed = 0; } <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { <END> if (groupLabel.getMaxLines() == numberOfGroupLinesAllowed) { return; } } if(numberOfGroupLinesAllowed <= 0) { this.mGroupForcedInvisible = true; updateGroupViewVisibility(); groupLabel.setMaxLines(0); } else { this.mGroupForcedInvisible = false; updateGroupViewVisibility(); groupLabel.setMaxLines(numberOfGroupLinesAllowed); } }</code><technical_language>Why</technical_language>

Target:
private void determineNumberOfValidGroupLines(Rect newRootViewDimensions) { FrameLayout header = (FrameLayout)findViewById(R.id.form_entry_header); TextView groupLabel = ((TextView)header.findViewById(R.id.form_entry_group_label)); int contentSize = newRootViewDimensions.height(); View navBar = this.findViewById(R.id.nav_pane); int headerSize = navBar.getHeight(); if(headerSize == 0) { headerSize = this.getResources().getDimensionPixelSize(R.dimen.new_progressbar_minheight); } int availableWindow = contentSize - headerSize - getActionBarSize(); int questionFontSize = getFontSizeInPx(); int spaceRequested = questionFontSize * 6; int spaceAvailable = availableWindow - spaceRequested; int defaultHeaderSpace = this.getResources().getDimensionPixelSize(R.dimen.content_min_margin) * 2; float textSize = groupLabel.getTextSize(); int numberOfGroupLinesAllowed = (int)((spaceAvailable - defaultHeaderSpace) / textSize); if(numberOfGroupLinesAllowed < 0) { numberOfGroupLinesAllowed = 0; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (groupLabel.getMaxLines() == numberOfGroupLinesAllowed) { return; } } if(numberOfGroupLinesAllowed == 0) { this.mGroupForcedInvisible = true; updateGroupViewVisibility(); groupLabel.setMaxLines(0); } else { this.mGroupForcedInvisible = false; updateGroupViewVisibility(); groupLabel.setMaxLines(numberOfGroupLinesAllowed); } }
Source:
<code>public void close() throws Exception { try { <START> try { <END> invokeFinishBundle(); } finally { if (pythonFunctionRunner != null) { pythonFunctionRunner.close(); pythonFunctionRunner = null; } } } finally { super.close(); } }</code><technical_language>purpose of this change</technical_language>

Target:
public void close() throws Exception { try { invokeFinishBundle(); } finally { super.close(); } }
Source:
<code><START> protected IStructuredSelection getViewerSelection() { <END> return fViewerPart.getViewer().getStructuredSelection(); }</code><technical_language><LINK_0></technical_language>

Target:
protected ISelection getViewerSelection() { return fViewerPart.getViewer().getSelection(); }
Source:
<code>void removeTemporaryWs() throws ServerException, ConflictException { final int count = 100; int skip = 0; List<WorkspaceImpl> workspaces = workspaceDao.getWorkspaces(true, skip, count); while (!workspaces.isEmpty()) { for (WorkspaceImpl workspace : workspaces) { <START> workspaceDao.remove(workspace.getId()); <END> } skip = skip + count; workspaces = workspaceDao.getWorkspaces(true, skip, count); } }</code><technical_language>add try catch continue removing other a error occurs removing workspace</technical_language>

Target:
void removeTemporaryWs() throws ServerException { final int count = 100; int skip = 0; List<WorkspaceImpl> workspaces = workspaceDao.getWorkspaces(true, skip, count); while (!workspaces.isEmpty()) { for (WorkspaceImpl workspace : workspaces) { try { workspaceDao.remove(workspace.getId()); } catch (ServerException | ConflictException e) { LOG.error("Unable to cleanup temporary workspace {}. Reason is {}",workspace.getId(), e.getLocalizedMessage()); } } skip = skip + count; workspaces = workspaceDao.getWorkspaces(true, skip, count); } }
Source:
<code>protected boolean executePendingPreparedStatements() throws SQLException { boolean exec = false; for (Map.Entry<PreparedStatement, Integer> preparedStatementIntegerEntry : pStatements.entrySet()) { if (preparedStatementIntegerEntry.getValue() > 0) { preparedStatementIntegerEntry.getKey().executeBatch(); pStatements.put(preparedStatementIntegerEntry.getKey(), 0); <START> exec = true; <END> } } return exec; }</code><technical_language>This code is readable previous, I leave previous one</technical_language>

Target:
protected boolean executePendingPreparedStatements() throws SQLException { boolean exec = false; for (PreparedStatement p : pStatements.keySet()) { if (pStatements.get(p) > 0) { p.executeBatch(); pStatements.put(p, 0); exec = true; } } return exec; }