auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void verifyIndex(PackIndex idx) throws CorruptPackIndexException { ObjectIdOwnerMap<ObjFromPack> inPack = new ObjectIdOwnerMap<>(); for (int i = 0; i < getObjectCount(); i++) { PackedObjectInfo entry = getObject(i); inPack.add(new ObjFromPack(entry)); long offs = idx.findOffset(entry); if (offs == -1) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().missingObject, <START> entry.getType(), entry.getName()), <END> ErrorType.MISSING_OBJ); } else if (offs != entry.getOffset()) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().mismatchOffset, entry.getName()), ErrorType.MISMATCH_OFFSET); } try { if (idx.hasCRC32Support() && (int) idx.findCRC32(entry) != entry.getCRC()) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().mismatchCRC, entry.getName()), ErrorType.MISMATCH_CRC); } } catch (MissingObjectException e) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().missingCRC, entry.getName()), ErrorType.MISSING_CRC); } } for (MutableEntry entry : idx) { if (!inPack.contains(entry.toObjectId())) { throw new CorruptPackIndexException(MessageFormat.format( JGitText.get().unknownObjectInIndex, entry.name()), ErrorType.UNKNOWN_OBJ); } } }</code><technical_language>I this Integer.valueOf(entry.getType()) fix warning</technical_language>

Target:
public void verifyIndex(PackIndex idx) throws CorruptPackIndexException { ObjectIdOwnerMap<ObjFromPack> inPack = new ObjectIdOwnerMap<>(); for (int i = 0; i < getObjectCount(); i++) { PackedObjectInfo entry = getObject(i); inPack.add(new ObjFromPack(entry)); long offs = idx.findOffset(entry); if (offs == -1) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().missingObject, Integer.valueOf(entry.getType()), entry.getName()), ErrorType.MISSING_OBJ); } else if (offs != entry.getOffset()) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().mismatchOffset, entry.getName()), ErrorType.MISMATCH_OFFSET); } try { if (idx.hasCRC32Support() && (int) idx.findCRC32(entry) != entry.getCRC()) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().mismatchCRC, entry.getName()), ErrorType.MISMATCH_CRC); } } catch (MissingObjectException e) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().missingCRC, entry.getName()), ErrorType.MISSING_CRC); } } for (MutableEntry entry : idx) { if (!inPack.contains(entry.toObjectId())) { throw new CorruptPackIndexException(MessageFormat.format( JGitText.get().unknownObjectInIndex, entry.name()), ErrorType.UNKNOWN_OBJ); } } }
Source:
<code>public void testMonacoMotorcycle() { List<OneRun> list = new ArrayList<OneRun>(); list.add(new OneRun(43.730729, 7.42135, 43.727697, 7.419199, 2703, 119)); list.add(new OneRun(43.727687, 7.418737, 43.74958, 7.436566, 3749, 170)); list.add(new OneRun(43.728677, 7.41016, 43.739213, 7.4277, 3175, 169)); list.add(new OneRun(43.733802, 7.413433, 43.739662, 7.424355, 5636, 298)); <START> list.add(new OneRun(43.730949, 7.412338, 43.739643, 7.424542, 5467, 277)); <END> list.add(new OneRun(43.727592, 7.419333, 43.727712, 7.419333, 0, 1)); runAlgo(testCollector, "files/monaco.osm.gz", "target/monaco-mc-gh", list, "motorcycle", true, "motorcycle", "fastest", true); assertEquals(testCollector.toString(), 0, testCollector.errors.size()); }</code><technical_language>if new routes in monaco more reasonable is this big difference</technical_language>

Target:
public void testMonacoMotorcycle() { List<OneRun> list = new ArrayList<OneRun>(); list.add(new OneRun(43.730729, 7.42135, 43.727697, 7.419199, 2703, 119)); list.add(new OneRun(43.727687, 7.418737, 43.74958, 7.436566, 3749, 170)); list.add(new OneRun(43.728677, 7.41016, 43.739213, 7.4277, 3175, 169)); list.add(new OneRun(43.733802, 7.413433, 43.739662, 7.424355, 2423, 141)); list.add(new OneRun(43.730949, 7.412338, 43.739643, 7.424542, 2253, 120)); list.add(new OneRun(43.727592, 7.419333, 43.727712, 7.419333, 0, 1)); runAlgo(testCollector, "files/monaco.osm.gz", "target/monaco-mc-gh", list, "motorcycle", true, "motorcycle", "fastest", true); assertEquals(testCollector.toString(), 0, testCollector.errors.size()); }
Source:
<code>public void test_precaching_of_account_proximityUUIDS() throws IOException, JSONException, InterruptedException { BaseResolveResponse resolveResponse = gson.fromJson(Utils.getRawResourceAsString(com.sensorberg.sdk.test.R.raw.response_resolve_precaching, InstrumentationRegistry.getContext()), BaseResolveResponse.class); Mockito.when(mockRetrofitApiService.updateBeaconLayout(Mockito.anyString())).thenReturn(Calls.response(resolveResponse)); Assertions.assertThat(spiedInternalApplicationBootstrapper.proximityUUIDs).hasSize(0); <START> System.out.println("TheInternalBootstrapperIntegration start test_precaching_of_account_proximityUUIDS"); <END> spiedTransportWithMockService.setProximityUUIDUpdateHandler(new Transport.ProximityUUIDUpdateHandler() { @Override public void proximityUUIDListUpdated(List<String> proximityUUIDs) { Assertions.assertThat(proximityUUIDs.size()).isEqualTo(5); } }); spiedInternalApplicationBootstrapper.updateBeaconLayout(); }</code><technical_language>this for debugging</technical_language>

Target:
public void test_precaching_of_account_proximityUUIDS() throws IOException, JSONException, InterruptedException { BaseResolveResponse resolveResponse = gson.fromJson(Utils.getRawResourceAsString(com.sensorberg.sdk.test.R.raw.response_resolve_precaching, InstrumentationRegistry.getContext()), BaseResolveResponse.class); Mockito.when(mockRetrofitApiService.updateBeaconLayout(Mockito.anyString())).thenReturn(Calls.response(resolveResponse)); Assertions.assertThat(spiedInternalApplicationBootstrapper.proximityUUIDs).hasSize(0); spiedTransportWithMockService.setProximityUUIDUpdateHandler(new Transport.ProximityUUIDUpdateHandler() { @Override public void proximityUUIDListUpdated(List<String> proximityUUIDs) { Assertions.assertThat(proximityUUIDs.size()).isEqualTo(5); } }); spiedInternalApplicationBootstrapper.updateBeaconLayout(); }
Source:
<code>public void testListBreak() { String html = parseToHtml("* item 1" + BR + "* item 2" + BR + "" + BR + "first list done" + BR + "- item 3" + BR); <START> assertEquals("testListBreak", <END> html, "<ul>" + "<li> item 1</li>" + "<li> item 2</li></ul>" + "<p>first list done</p>" + BR + "<ul><li> item 3</li></ul>"); }</code><technical_language>this version of JUnit, signature is "assertEquals(String message, Object expected, Object actual)" => invert parameter</technical_language>

Target:
public void testListBreak() { String html = parseToHtml("* item 1" + BR + "* item 2" + BR + "" + BR + "first list done" + BR + "- item 3" + BR); assertEquals("testListBreak", "" + "<ul>" + "<li>item 1</li>" + "<li>item 2</li></ul>" + "<p>first list done</p>\n" + "<ul><li>item 3</li></ul>", html); }
Source:
<code>public void initLandmarkWeights(final int lmIdx, int lmNodeId, final long rowSize, final int offset) { IntObjectMap<SPTEntry> map = from ? bestWeightMapFrom : bestWeightMapTo; final AtomicInteger maxedout = new AtomicInteger(0); final Map.Entry<Double, Double> finalMaxWeight = new MapEntry<>(0d, 0d); map.forEach(new IntObjectProcedure<SPTEntry>() { @Override public void apply(int nodeId, SPTEntry b) { if (!lms.setWeight(nodeId * rowSize + lmIdx * 4 + offset, b.weight)) { maxedout.incrementAndGet(); finalMaxWeight.setValue(Math.max(b.weight, finalMaxWeight.getValue())); } } }); if ((double) maxedout.get() / map.size() > 0.1) { LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " + "too many weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Use a bigger factor than " + lms.factor <START> + ". For example use the following in the config.properties: weighting=" + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2 / PRECISION); <END> } }</code><technical_language>Mhm, proposal match :/. do divide PRECISION? I set prepare.lm.weightings=fastest|maximum=100 I get log landmark 15 (45.5060110354277,-73.5529020105206): weights maxed out (294/440). a bigger factor 0.00152587890625. For example in config.properties: weighting=fastest|maximum=0.004969158898255066</technical_language>

Target:
public void initLandmarkWeights(final int lmIdx, int lmNodeId, final long rowSize, final int offset) { IntObjectMap<SPTEntry> map = from ? bestWeightMapFrom : bestWeightMapTo; final AtomicInteger maxedout = new AtomicInteger(0); final Map.Entry<Double, Double> finalMaxWeight = new MapEntry<>(0d, 0d); map.forEach(new IntObjectProcedure<SPTEntry>() { @Override public void apply(int nodeId, SPTEntry b) { if (!lms.setWeight(nodeId * rowSize + lmIdx * 4 + offset, b.weight)) { maxedout.incrementAndGet(); finalMaxWeight.setValue(Math.max(b.weight, finalMaxWeight.getValue())); } } }); if ((double) maxedout.get() / map.size() > 0.1) { LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " + "too many weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Use a bigger factor than " + lms.factor + ". For example use the following in the config.properties: weighting=" + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2); } }
Source:
<code>public Repository openMetadataRepository(Project.NameKey name) throws RepositoryNotFoundException, IOException { return <START> openRepository(name); <END> }</code><technical_language>is this normal repository? expected is able configure name (and location?) of meta data repository, creating project foo repositories foo.git foo_meta.git. I see, where/how this is done in this change</technical_language>

Target:
public Repository openMetadataRepository(Project.NameKey name) throws RepositoryNotFoundException, IOException { return openRepository(noteDbPath, name); }
Source:
<code>public boolean clickModerationHintButton() { click(By.id("moderationHintButton")); WebElement moderationHint = browser.driver.findElement(By.id("moderationHint")); <START> return moderationHint.isDisplayed(); <END> }</code><technical_language>a good idea check visibility of moderation hint method click button. Do extract moderation hint visibility check a method specifically for purpose. Additionally, for visibility check, is existing method in AppPage.java is provided, isElementVisible()</technical_language>

Target:
public void clickModerationHintButton() { click(By.id("moderationHintButton")); }
Source:
<code>public void testGetMilisToNextSunrise() { System.out.println("getMilisToNextSunrise"); <START> long dayToMilis = 86400000; <END> Calendar calendar = Calendar.getInstance(); long nextSunrise = DateTimeUtils.getMilisToNextSunrise(calendar, 40.4131699, -3.6830699); assertTrue(nextSunrise < dayToMilis); }</code><technical_language>is twice. this moved a class constant, method available</technical_language>

Target:
public void testGetMilisToNextSunrise() { System.out.println("getMilisToNextSunrise"); Calendar calendar = Calendar.getInstance(); long nextSunrise = DateTimeUtils.getMilisToNextSunrise(calendar, LATITUDE, LONGITUDE); assertTrue(nextSunrise < DAYTOMILIS); }
Source:
<code>private byte[] generateRandomData(int dataSize, boolean useChars) { byte[] buffer = null; if (useChars) { String singleByteChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; String multiByteChars = "ÅÄÇÉÑÖÕÜàäâáãçëèêéîïìíñôöòóüûùúÿ"; String punctuationChars = "!,.;?"; int maxWordLength = 20; <START> StringBuffer data = new StringBuffer(); <END> while (data.toString().getBytes().length < dataSize) { int wordLength = random.nextInt(maxWordLength); for (int i = 0; i < wordLength; i++) { if (random.nextBoolean() || dataSize - data.toString().getBytes().length == 1) { data.append(singleByteChars.charAt(random.nextInt(singleByteChars.length() - 1))); } else { data.append(multiByteChars.charAt(random.nextInt(multiByteChars.length() - 1))); } } if (random.nextBoolean()) { data.append(punctuationChars.charAt(random.nextInt(punctuationChars.length() - 1))); } if (random.nextBoolean()) { data.append(' '); } else { data.append('\n'); } } buffer = Arrays.copyOf(data.toString().getBytes(), dataSize); } else { buffer = new byte[dataSize]; random.nextBytes(buffer); } return buffer; }</code><technical_language>single-threaded access please StringBuilder instead of StringBuffer. Repeated serialization string byte[] pretty sub-optimal, bytes appending, sum byte-length in variable instead</technical_language>

Target:
private byte[] generateRandomData(int dataSize, boolean useChars) { byte[] buffer = null; if (useChars) { String punctuationChars = "!,.;?"; ByteBuffer data = ByteBuffer.allocate(dataSize); int remainingBytes = dataSize; int maxWordLength = 20; while (remainingBytes > 0) { byte[] word = this.generateRandomWord(maxWordLength); data = data.put(word); remainingBytes -= word.length; if (remainingBytes >= 2 && random.nextInt() % 5 == 0 && random.nextBoolean()) { data.put((byte) punctuationChars.charAt(random.nextInt(punctuationChars.length() - 1))); data.put((byte) '\n'); remainingBytes -= 2; } else { if (remainingBytes >= 1) { data.put((byte) ' '); remainingBytes--; } } if (remainingBytes < maxWordLength) { maxWordLength = remainingBytes; } } buffer = data.array(); } else { buffer = new byte[dataSize]; random.nextBytes(buffer); } return buffer; }
Source:
<code>public void stopSyncAndJournal(RpcContext rpcContext, AlluxioURI syncPoint) throws InvalidPathException { try (LockResource r = new LockResource(mLock)) { MountTable.Resolution resolution = mMountTable.resolve(syncPoint); if (resolution == null) { <START> throw new InvalidPathException(syncPoint + " is not a sync point."); <END> } LOG.debug("stop syncPoint {}", syncPoint.getPath()); final long mountId = resolution.getMountId(); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(mountId) .build(); applyAndJournal(rpcContext, removeSyncPoint); try { stopSyncInternal(syncPoint); } catch (Throwable e) { LOG.warn("Stop sync failed on {}", syncPoint, e); AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); applyAndJournal(rpcContext, addSyncPoint); recoverFromStopSync(syncPoint); } } }</code><technical_language>NIT: "Failed stop sync point <URI> is mounted."</technical_language>

Target:
public void stopSyncAndJournal(RpcContext rpcContext, AlluxioURI syncPoint) throws InvalidPathException { try (LockResource r = new LockResource(mLock)) { MountTable.Resolution resolution = mMountTable.resolve(syncPoint); if (resolution == null) { throw new InvalidPathException("Failed to stop sync point " + syncPoint + " because it is not mounted."); } LOG.debug("stop syncPoint {}", syncPoint.getPath()); final long mountId = resolution.getMountId(); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(mountId) .build(); applyAndJournal(rpcContext, removeSyncPoint); try { stopSyncInternal(syncPoint); } catch (Throwable e) { LOG.warn("Stop sync failed on {}", syncPoint, e); AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); applyAndJournal(rpcContext, addSyncPoint); recoverFromStopSync(syncPoint); } } }
Source:
<code>public String send(String message) throws ProducerException { <START> ProducerRecord record = new ProducerRecord<>(topic, null, message); <END> try { RecordMetadata result = (RecordMetadata)kafkaProducer.send(record).get(); return result.topic() + "-" + result.partition() + "-" + result.offset(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ProducerException("Error sending Kafka Message", e); } catch (ExecutionException e) { throw new ProducerException("Error sending Kafka Message", e); } }</code><technical_language>ignore producer level properties? thought producer level properties message overridden message level</technical_language>

Target:
public String send(String message) throws ProducerException { return sendForkliftWrappedMessage(message, null); }
Source:
<code>public Locale getCurrentTimeLocale() { Locale set; <START> if (TimeInfo.getTimeInfoByDisplayName(preferencesService.getPreferences().getChat().getUkTime()).equals(TimeInfo.AUTO)) { <END> set = locale; } else { set = TimeInfo.getTimeInfoByDisplayName(preferencesService.getPreferences().getChat().getUkTime()).getUsedLocale(); } return set; }</code><technical_language>Extract local variable</technical_language>

Target:
private Locale getCurrentTimeLocale() { ChatPrefs chatPrefs = preferencesService.getPreferences().getChat(); if (chatPrefs.getTimeFormat().equals(TimeInfo.AUTO)) { return Locale.getDefault(); } return preferencesService.getPreferences().getChat().getTimeFormat().getUsedLocale(); }
Source:
<code>private void handleBulletCreation(ByteBuffer input) { GameObjectDAO data = new GameObjectDAO(); data.x = input.getDouble(); data.y = input.getDouble(); data.height = input.getDouble(); data.velocityX = input.getDouble(); data.velocityY = input.getDouble(); <START> data.bulletType = Bullet.Type.values()[input.getInt()]; <END> data.damage = input.getDouble(); data.ownerId = input.getInt(); data.objectId = input.getInt(); map.addGameObject(data); }</code><technical_language>this is expensive. instead a static array in enum class get opcode index</technical_language>

Target:
private void handleBulletCreation(ByteBuffer input) { GameObjectDAO data = new GameObjectDAO(); data.x = input.getDouble(); data.y = input.getDouble(); data.height = input.getDouble(); data.velocityX = input.getDouble(); data.velocityY = input.getDouble(); data.bulletType = Bullet.Type.fromInteger(input.getInt()); data.damage = input.getDouble(); data.ownerId = input.getInt(); data.objectId = input.getInt(); data.entityType = EntityFactory.EntityType.fromInteger(input.getInt()); map.addGameObject(data); }
Source:
<code>private String getPathForContainer(IContainer container) { <START> return container.getLocation().toOSString(); <END> }</code><technical_language>toPortableString (and Path.fromPortableString load) better</technical_language>

Target:
private String getPathForContainer(IContainer container) { return container.getLocation().toPortableString(); }
Source:
<code>protected void readValue(BlockBuilder blockBuilder, Type type) { if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) { type.writeDouble(blockBuilder, valuesReader.readDouble()); } <START> else if (isNullValue()) { <END> blockBuilder.appendNull(); } }</code><technical_language>ditto a final else here</technical_language>

Target:
protected void readValue(BlockBuilder blockBuilder, Type type) { if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) { type.writeDouble(blockBuilder, valuesReader.readDouble()); } else if (isValueNull()) { blockBuilder.appendNull(); } }
Source:
<code>private String getZoneFromEureka() { String zone; boolean approximateZoneFromHostname = Boolean.parseBoolean( environment.getProperty(APPROXIMATE_ZONE_FROM_HOSTNAME, "false")); if (approximateZoneFromHostname && eurekaConfig != null) { return ZoneUtils.extractApproximateZone(this.eurekaConfig.getHostName(false)); } else { zone = eurekaConfig == null ? null : eurekaConfig.getMetadataMap().get("zone"); <START> if (zone == null) { <END> String[] zones = clientConfig .getAvailabilityZones(clientConfig.getRegion()); zone = zones != null && zones.length > 0 ? zones[0] : null; } return zone; } }</code><technical_language>is ok empty string</technical_language>

Target:
private String getZoneFromEureka() { String zone; boolean approximateZoneFromHostname = eurekaLoadBalancerProperties .isApproximateZoneFromHostname(); if (approximateZoneFromHostname && eurekaConfig != null) { return ZoneUtils.extractApproximateZone(this.eurekaConfig.getHostName(false)); } else { zone = eurekaConfig == null ? null : eurekaConfig.getMetadataMap().get("zone"); if (StringUtils.isEmpty(zone)) { String[] zones = clientConfig .getAvailabilityZones(clientConfig.getRegion()); zone = zones != null && zones.length > 0 ? zones[0] : null; } return zone; } }
Source:
<code><START> public boolean isIgnored(File targetFile) throws IOException { <END> String target = targetFile.getAbsolutePath(); if (!target.startsWith(baseDir.getAbsolutePath())) { return false; } if (rules.isEmpty()) { try { parse(); } catch (IOException e) { e.printStackTrace(); } } if (rules == null || rules.size() == 0) return false; matched = false; String tar = target.replaceFirst(baseDir.getAbsolutePath(), ""); int i; for (i = rules.size() -1; i > -1; i--) { matched = rules.get(i).isMatch(tar, targetFile.isDirectory()); if (matched) { break; } } if (i > -1 && rules.get(i) != null) { return rules.get(i).getResult(); } return false; }</code><technical_language>throw IOException, some lines catch it, this inconsistent</technical_language>

Target:
public boolean isIgnored(File targetFile) throws IOException { String target = targetFile.getAbsolutePath(); if (!target.startsWith(baseDir.getAbsolutePath())) { return false; } if (rules.isEmpty()) { try { parse(); } catch (IOException e) { e.printStackTrace(); } } if (rules.isEmpty()) return false; matched = false; String tar = target.replaceFirst(baseDir.getAbsolutePath(), ""); int i; for (i = rules.size() -1; i > -1; i--) { matched = rules.get(i).isMatch(tar, targetFile.isDirectory()); if (matched) { break; } } if (i > -1 && rules.get(i) != null) { return rules.get(i).getResult(); } return false; }
Source:
<code>protected void handleMergeFailure(@NonNull AuthCredential credential) { IdpResponse failureResponse = new IdpResponse.Builder(credential) .build(); <START> setResult(Resource.<IdpResponse>forFailure(new FirebaseAuthAnonymousUpgradeException( <END> ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, failureResponse))); }</code><technical_language>FirebaseAuthAnonymousUpgradeException a constructor takes AuthCredential converting credential IdpResponse</technical_language>

Target:
protected void handleMergeFailure(@NonNull AuthCredential credential) { IdpResponse failureResponse = new IdpResponse.Builder(credential).build(); handleMergeFailure(failureResponse); }
Source:
<code>public void execute() { <START> if (state.getGhost().isPresent() && state.getOriginalParent().isPresent()) { <END> final CaseManagementShapeView ghost = state.getGhost().get(); final WiresContainer originalParent = state.getOriginalParent().get(); reparentDraggedShape(ghost, originalParent); } clearState(); batch(); }</code><technical_language>a suggestion this block: suggestion state.getGhost() .ifPresent(ghost -> state.getOriginalParent() .ifPresent(originalParent -> reparentDraggedShape(ghost, originalParent)));</technical_language>

Target:
public void execute() { state.getGhost().ifPresent(ghost -> state.getOriginalParent().ifPresent(originalParent -> reparentDraggedShape(ghost, originalParent) ) ); clearState(); batch(); }
Source:
<code>public static void main(String[] args) { boolean error = false; int minApi = 1; FolderType type = FolderType.SDK; String baseFolder = null; String outPath = null; for (int i = 0; i < args.length && !error; i++) { String arg = args[i]; if (arg.equals("--prebuilt")) { type = FolderType.PREBUILT; <START> } else if (arg.equals("--min-api")) { <END> i++; if (i < args.length) { minApi = Integer.parseInt(args[i]); } else { System.err.println("Missing number >= 1 after " + arg); error = true; } } else if (baseFolder == null) { baseFolder = arg; } else if (outPath == null) { outPath = arg; } else { System.err.println("Unknown argument: " + arg); error = true; } } if (!error && baseFolder == null) { System.err.println("Missing base folder"); error = true; } if (!error && outPath == null) { System.err.println("Missing out file path"); error = true; } if (error) { printUsage(); } AndroidJarReader reader = new AndroidJarReader(type, baseFolder, minApi); Map<String, ApiClass> classes = reader.getClasses(); createApiFile(new File(outPath), classes); }</code><technical_language>or/and a flag point extra local jars? put 1.jar 2.jar (or api-generator-data-1.jar api-generator-data-2.jar) other official Android SDKs for this build script</technical_language>

Target:
public static void main(String[] args) { boolean error = false; int minApi = 1; ArrayList<String> patterns = new ArrayList<String>(); String outPath = null; for (int i = 0; i < args.length && !error; i++) { String arg = args[i]; if (arg.equals("--pattern")) { i++; if (i < args.length) { patterns.add(args[i]); } else { System.err.println("Missing argument after " + arg); error = true; } } else if (arg.equals("--min-api")) { i++; if (i < args.length) { minApi = Integer.parseInt(args[i]); } else { System.err.println("Missing number >= 1 after " + arg); error = true; } } else if (arg.length() >= 2 && arg.substring(0, 2).equals("--")) { System.err.println("Unknown argument: " + arg); error = true; } else if (outPath == null) { outPath = arg; } else if (new File(arg).isDirectory()) { String pattern = arg; if (!pattern.endsWith(File.separator)) { pattern += File.separator; } pattern += "platforms" + File.separator + "android-%" + File.separator + "android.jar"; patterns.add(pattern); } else { System.err.println("Unknown argument: " + arg); error = true; } } if (!error && outPath == null) { System.err.println("Missing out file path"); error = true; } if (!error && patterns.isEmpty()) { System.err.println("Missing SdkFolder or --pattern."); error = true; } if (error) { printUsage(); System.exit(1); } AndroidJarReader reader = new AndroidJarReader(patterns, minApi); Map<String, ApiClass> classes = reader.getClasses(); if (!createApiFile(new File(outPath), classes)) { System.exit(1); } }
Source:
<code>public void updateCache(AttestationValue value) { AttestationValue cacheValue = attestationValues.get(value.getHostName()); if (cacheValue != null) { cacheValue.setTrustLevel(value.getTrustLevel()); <START> } <END> }</code><technical_language>options here: a. (the one) if is in cache - call addToCach(value) b. return a boolean - cached not</technical_language>

Target:
public void updateCache(AttestationValue value) { AttestationValue cacheValue = attestationValues.get(value.getHostName()); if (cacheValue != null) { cacheValue.setTrustLevel(value.getTrustLevel()); }else{ addToCache(value); } }
Source:
<code>public Bitmap getImage(String url) { final File file = storedFile(url); byte[] bytes = null; if (null == file || !file.exists()) { try { bytes = mPoster.performRequest(url, null); } catch (IOException e) { Log.i(LOGTAG, "Can't download bitmap", e); } catch (RemoteService.ServiceUnavailableException e) { Log.i(LOGTAG, "Couldn't download "); } } final Bitmap bitmap; if (null != bytes) { if (null != file && bytes.length < MAX_BITMAP_SIZE) { OutputStream out = null; try { out = new FileOutputStream(file); out.write(bytes); } catch (FileNotFoundException e) { Log.e(LOGTAG, "It appears that ImageStore is misconfigured, or disk storage is unavailable- can't write to bitmap directory", e); } catch (IOException e) { Log.w(LOGTAG, "Can't store bitmap", e); } finally { if (null != out) { <START> try { <END> out.close(); } catch (IOException e) { Log.w(LOGTAG, "Problem closing output file", e); } } } } bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); if (null == bitmap) { Log.w(LOGTAG, "Downloaded bitmap could not be interpreted"); } } else { bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); if (null == bitmap) { Log.w(LOGTAG, "Bitmap on disk can't be opened or is corrupt"); final boolean ignored = file.delete(); } } return bitmap; }</code><technical_language>Is this for case out.write is throws ? (since out.close put out.write(bytes))</technical_language>

Target:
public Bitmap getImage(String url) throws CantGetImageException { final File file = storedFile(url); byte[] bytes = null; if (null == file || !file.exists()) { try { bytes = mPoster.performRequest(url, null); } catch (IOException e) { throw new CantGetImageException("Can't download bitmap", e); } catch (RemoteService.ServiceUnavailableException e) { throw new CantGetImageException("Couldn't download image due to service availability", e); } } final Bitmap bitmap; if (null != bytes) { if (null != file && bytes.length < MAX_BITMAP_SIZE) { OutputStream out = null; try { out = new FileOutputStream(file); out.write(bytes); } catch (FileNotFoundException e) { throw new CantGetImageException("It appears that ImageStore is misconfigured, or disk storage is unavailable- can't write to bitmap directory", e); } catch (IOException e) { throw new CantGetImageException("Can't store bitmap", e); } finally { if (null != out) { try { out.close(); } catch (IOException e) { Log.w(LOGTAG, "Problem closing output file", e); } } } } bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); if (null == bitmap) { throw new CantGetImageException("Downloaded data could not be interpreted as a bitmap"); } } else { bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); if (null == bitmap) { final boolean ignored = file.delete(); throw new CantGetImageException("Bitmap on disk can't be opened or was corrupt"); } } return bitmap; }
Source:
<code>public void test1AUY() throws IOException, StructureException { AtomCache cache = new AtomCache(); StructureIO.setAtomCache(cache); cache.setUseMmCif(true); Structure s1 = StructureIO.getStructure("1AUY"); CrystalBuilder cb = new CrystalBuilder(s1); StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5); <START> assertTrue(interfaces.size()==12); <END> }</code><technical_language>this assertEquals? Minor thing, test reports nicer (on failures). below</technical_language>

Target:
public void test1AUY() throws IOException, StructureException { AtomCache cache = new AtomCache(); StructureIO.setAtomCache(cache); cache.setUseMmCif(true); Structure s1 = StructureIO.getStructure("1AUY"); CrystalBuilder cb = new CrystalBuilder(s1); StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5); assertEquals(12,interfaces.size()); s1.getCrystallographicInfo().setCrystalCell(null); cb = new CrystalBuilder(s1); interfaces = cb.getUniqueInterfaces(5.5); assertEquals(12,interfaces.size()); }
Source:
<code>void createTestGraph( GraphDatabaseService graphDb ) { IndexDefinition index; try ( Transaction tx = graphDb.beginTx() ) { index = graphDb.schema().indexFor( label( "Node" ) ).on( "prop" ).create(); tx.success(); } try ( Transaction tx = graphDb.beginTx() ) { graphDb.schema().awaitIndexOnline( index, 5, SECONDS ); tx.success(); } try ( Transaction tx = graphDb.beginTx() ) { graphDb.createNode( label( "Node" ) ).setProperty( "prop", "one" ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", "two" ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", "two" ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", "three" ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", "three" ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", "three" ); <START> graphDb.createNode( label( "Node" ) ).setProperty( "prop", 4 ); <END> graphDb.createNode( label( "Node" ) ).setProperty( "prop", 5 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 6 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 12 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 18 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 24 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 30 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 36 ); graphDb.createNode( label( "Node" ) ).setProperty( "prop", 42 ); tx.success(); } }</code><technical_language>add: - duplicate entries for numbers - boolean values - floating point values</technical_language>

Target:
void createTestGraph( GraphDatabaseService graphDb ) { IndexDefinition index; try ( Transaction tx = graphDb.beginTx() ) { index = graphDb.schema().indexFor( label( "Node" ) ).on( "prop" ).create(); tx.success(); } try ( Transaction tx = graphDb.beginTx() ) { graphDb.schema().awaitIndexOnline( index, 5, SECONDS ); tx.success(); } try ( Transaction tx = graphDb.beginTx() ) { strOne = nodeWithProp( graphDb, "one" ); strTwo1 = nodeWithProp( graphDb, "two" ); strTwo2 = nodeWithProp( graphDb, "two" ); strThree1 = nodeWithProp( graphDb, "three" ); strThree2 = nodeWithProp( graphDb, "three" ); strThree3 = nodeWithProp( graphDb, "three" ); nodeWithProp( graphDb, false ); boolTrue = nodeWithProp( graphDb, true ); nodeWithProp( graphDb, 4 ); num5 = nodeWithProp( graphDb, 5 ); num6 = nodeWithProp( graphDb, 6 ); num12a = nodeWithProp( graphDb, 12.0 ); num12b = nodeWithProp( graphDb, 12.0 ); nodeWithProp( graphDb, 18 ); nodeWithProp( graphDb, 24 ); nodeWithProp( graphDb, 30 ); nodeWithProp( graphDb, 36 ); nodeWithProp( graphDb, 42 ); tx.success(); } }
Source:
<code>@Override protected void onNewChannelCreated(Channel ch) { SSLEngine sslEngine = sslContext.createSSLEngine(); <START> sslEngine.setWantClientAuth(true); <END> sslEngine.setUseClientMode(false); ch.pipeline().addFirst(new SslHandler(sslEngine)); }</code><technical_language>For DTLSConnector this is configurable. I do configuration of TLS connector thought ..</technical_language>

Target:
protected void onNewChannelCreated(Channel ch) { SSLEngine sslEngine = createSllEngineForChannel(ch); sslEngine.setWantClientAuth(true); sslEngine.setUseClientMode(false); ch.pipeline().addFirst(new SslHandler(sslEngine)); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } <START> return element.equals(obj); <END> }</code><technical_language>for hashCode - if element is null..</technical_language>

Target:
public boolean equals(Object obj) { if (element == null) { return super.equals(obj); } if (this == obj) { return true; } return element.equals(obj); }
Source:
<code><V> void validate(FieldDescriptor descriptor, V fieldValue, String fieldName) throws ConstraintViolationThrowable; T build() throws ConstraintViolationThrowable; ValidatingBuilder<T, B> mergeFrom(T message); @Internal void setOriginalState(T state); @Internal boolean isDirty(); @Internal void clear(); <START> enum GenericParameter { <END> MESSAGE(0), MESSAGE_BUILDER(1); private final int index; GenericParameter(int index) { this.index = index; } public int getIndex() { return this.index; } }</code><technical_language>a common interface for generic params called GenericTypeIndex. in some enums this</technical_language>

Target:
<V> void validate(FieldDescriptor descriptor, V fieldValue, String fieldName) throws ConstraintViolationThrowable; T build() throws ConstraintViolationThrowable; ValidatingBuilder<T, B> mergeFrom(T message); @Internal void setOriginalState(T state); @Internal boolean isDirty(); @Internal void clear(); enum GenericParameter implements GenericTypeIndex { MESSAGE(0), MESSAGE_BUILDER(1); private final int index; GenericParameter(int index) { this.index = index; } @Override public int getIndex() { return this.index; } }
Source:
<code>public static <T> SizeEstimator<T> create(DataType<?> type) { switch (type.id()) { case UndefinedType.ID: case ObjectType.ID: <START> case GeoShapeType.ID: <END> return (SizeEstimator<T>) new SamplingSizeEstimator<>(SAMPLE_EVERY_NTH, MapSizeEstimator.INSTANCE); case StringType.ID: case IpType.ID: return (SizeEstimator<T>) StringSizeEstimator.INSTANCE; case ArrayType.ID: var innerEstimator = create(((ArrayType<?>) type).innerType()); return (SizeEstimator<T>) ArraySizeEstimator.create(innerEstimator); default: if (type instanceof FixedWidthType) { return (SizeEstimator<T>) new ConstSizeEstimator(((FixedWidthType) type).fixedSize()); } throw new UnsupportedOperationException(String.format(Locale.ENGLISH, "Cannot get SizeEstimator for type %s", type)); } }</code><technical_language>do MapSizeEstimator for UndefinedType? Imho, approach UNKNOWN_DEFAULT_RAM_BYTES_USED ok go</technical_language>

Target:
public static <T> SizeEstimator<T> create(DataType<?> type) { switch (type.id()) { case UndefinedType.ID: return (SizeEstimator<T>) new ConstSizeEstimator(UNKNOWN_DEFAULT_RAM_BYTES_USED); case ObjectType.ID: case GeoShapeType.ID: return (SizeEstimator<T>) new SamplingSizeEstimator<>(SAMPLE_EVERY_NTH, MapSizeEstimator.INSTANCE); case StringType.ID: case IpType.ID: return (SizeEstimator<T>) StringSizeEstimator.INSTANCE; case ArrayType.ID: var innerEstimator = create(((ArrayType<?>) type).innerType()); return (SizeEstimator<T>) ArraySizeEstimator.create(innerEstimator); default: if (type instanceof FixedWidthType) { return (SizeEstimator<T>) new ConstSizeEstimator(((FixedWidthType) type).fixedSize()); } throw new UnsupportedOperationException(String.format(Locale.ENGLISH, "Cannot get SizeEstimator for type %s", type)); } }
Source:
<code>public void testEncodeDecode() { SerializableTestObject b = new SerializableTestObject(); final byte[] encoded = SerializableObjectTranscoder.INSTANCE.encode(b); final SerializableTestObject testObject = (SerializableTestObject) SerializableObjectTranscoder.INSTANCE.decode(encoded); <START> assertEquals("hello", testObject.value1); <END> assertEquals("world", testObject.value2); assertEquals(5, testObject.value3); }</code><technical_language>I trust this test asserts values class defaults - remove explicit defaults set fields manually serializing</technical_language>

Target:
public void testEncodeDecode() { SerializableTestObject b = new SerializableTestObject(); b.value1 = "hello"; b.value2 = "world"; b.value3 = 5; final byte[] encoded = SerializableObjectTranscoder.INSTANCE.encode(b); final SerializableTestObject testObject = (SerializableTestObject) SerializableObjectTranscoder.INSTANCE.decode(encoded); assertEquals("hello", testObject.value1); assertEquals("world", testObject.value2); assertEquals(5, testObject.value3); }
Source:
<code>public FilterHandler(String unparsedFilters) { String[] rawFilters = unparsedFilters.split(","); filters = new Filter[rawFilters.length]; for (int i = 0; i < rawFilters.length; i++) { String currentFilter = rawFilters[i]; <START> int period = currentFilter.lastIndexOf('.'); <END> Filter filter = new Filter(currentFilter.substring(0, period), currentFilter.substring(period + 1)); filters[i] = filter; } Arrays.sort(filters); }</code><technical_language>Protect period < 0, happen if dot is found</technical_language>

Target:
public FilterHandler(String unparsedFilters) { String[] rawFilters = unparsedFilters.split(","); filters = new Filter[rawFilters.length]; for (int i = 0; i < rawFilters.length; i++) { String currentFilter = rawFilters[i]; int period = currentFilter.lastIndexOf('.'); if (period < 0) { filters[i] = new Filter(currentFilter); continue; } filters[i] = new Filter(currentFilter.substring(0, period), currentFilter.substring(period + 1)); } Arrays.sort(filters); }
Source:
<code>public void testConflictingPackage001() throws Exception { File outDir = AbstractTestTools.createTempDir(); <START> IToolchain toolchain <END> = AbstractTestTools.getCandidateToolchain(); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); toolchain.setOutputStream(out); toolchain.setErrorStream(err); try { toolchain.addToClasspath(toolchain.getDefaultBootClasspath()) .srcToLib( outDir, false, AbstractTestTools.getTestRootDir("com.android.jack.frontend.test002.jack")); Assert.fail(); } catch (FrontendCompilationException e) { Assert.assertEquals(0, out.size()); String errString = err.toString(); Assert.assertTrue(errString.contains("ERROR:")); Assert.assertTrue(errString.contains( "com.android.jack.frontend.test002.jack.PackageName")); Assert.assertTrue(errString.contains("collides")); } }</code><technical_language>a JackApiToolchainBase expect catch FrontendCompilationException</technical_language>

Target:
public void testConflictingPackage001() throws Exception { File outDir = AbstractTestTools.createTempDir(); JackApiToolchainBase toolchain = AbstractTestTools.getCandidateToolchain(JackApiToolchainBase.class); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); toolchain.setOutputStream(out); toolchain.setErrorStream(err); try { toolchain.addToClasspath(toolchain.getDefaultBootClasspath()) .srcToLib( outDir, false, AbstractTestTools.getTestRootDir("com.android.jack.frontend.test002.jack")); Assert.fail(); } catch (FrontendCompilationException e) { Assert.assertEquals(0, out.size()); String errString = err.toString(); Assert.assertTrue(errString.contains("ERROR:")); Assert.assertTrue(errString.contains( "com.android.jack.frontend.test002.jack.PackageName")); Assert.assertTrue(errString.contains("collides")); } }
Source:
<code>public void testAnnotateWf() throws Exception { Run b = mock(Run.class); when(b.getAction(JiraBuildAction.class)).thenReturn(new JiraBuildAction(b, Collections.singleton(new JiraIssue("DUMMY-1", TITLE)))); MarkupText text = new MarkupText("marking up DUMMY-1."); JiraChangeLogAnnotator annotator = spy(new JiraChangeLogAnnotator()); doReturn(site).when(annotator).getSiteForProject((AbstractProject<?, ?>) Mockito.any()); annotator.annotate(b, null, text); <START> Assert.assertTrue(text.toString(false).contains(TITLE)); <END> }</code><technical_language>please form assertThat(text.toSting(false), containsString(TITLE)); more verbosibe in case of fail</technical_language>

Target:
public void testAnnotateWf() throws Exception { Run b = mock(Run.class); when(b.getAction(JiraBuildAction.class)).thenReturn(new JiraBuildAction(b, Collections.singleton(new JiraIssue("DUMMY-1", TITLE)))); MarkupText text = new MarkupText("marking up DUMMY-1."); JiraChangeLogAnnotator annotator = spy(new JiraChangeLogAnnotator()); doReturn(site).when(annotator).getSiteForProject((AbstractProject<?, ?>) Mockito.any()); annotator.annotate(b, null, text); assertThat(text.toString(false), containsString(TITLE)); }
Source:
<code>public void addPending(PendingResource resource) { synchronized (this) { if (pendingResources.containsKey(resource)) { PendingResource old = pendingResources.get(resource); log.warn("Clearing stale pending resource (host: {}, vm: {})", old, old.getHost(), old.getVm()); resourcesByVm.compute(old.getVm(), <START> (vmId, vmResources) ->{ vmResources.remove(old); return vmResources; }); <END> resourcesByHost.compute(old.getHost(), (hostId, hostResources) -> { hostResources.remove(old); return hostResources; }); } log.debug("Adding pending resource (host: {}, vm: {})", resource, resource.getHost(), resource.getVm()); if (!resourcesByVm.containsKey(resource.getVm())) { resourcesByVm.put(resource.getVm(), new HashSet<>()); } if (!resourcesByHost.containsKey(resource.getHost())) { resourcesByHost.put(resource.getHost(), new HashSet<>()); } resourcesByVm.compute(resource.getVm(), (vmId, vmResources) -> { vmResources.add(resource); return vmResources; }); resourcesByHost.compute(resource.getHost(), (vmId, hostResources) -> { hostResources.add(resource); return hostResources; }); pendingResources.put(resource, resource); } }</code><technical_language>Care extract this a nice static method stays oneliner (you reuse well)</technical_language>

Target:
public void addPending(PendingResource resource) { synchronized (this) { if (pendingResources.containsKey(resource)) { PendingResource old = pendingResources.get(resource); log.warn("Clearing stale pending resource (host: {}, vm: {})", old, old.getHost(), old.getVm()); removeFromSetMap(resourcesByVm, old.getVm(), old); removeFromSetMap(resourcesByHost, old.getHost(), old); } log.debug("Adding pending resource (host: {}, vm: {})", resource, resource.getHost(), resource.getVm()); resourcesByVm.putIfAbsent(resource.getVm(), new HashSet<>()); resourcesByHost.putIfAbsent(resource.getHost(), new HashSet<>()); addToSetMap(resourcesByVm, resource.getVm(), resource); addToSetMap(resourcesByHost, resource.getHost(), resource); pendingResources.put(resource, resource); } }
Source:
<code>public ComponentDescriptor<?> resolveDescriptor(DataCleanerEnvironment env, String componentName) { ComponentDescriptor<?> descriptor = env.getDescriptorProvider() .getTransformerDescriptorByDisplayName(componentName); <START> if (descriptor == null) { <END> descriptor = env.getDescriptorProvider() .getAnalyzerDescriptorByDisplayName(componentName); } if (descriptor == null) { logger.info("Component not found.", componentName); throw ComponentNotFoundException.createTypeNotFound(componentName); } if (!_remoteComponentsConfiguration.isAllowed(descriptor)) { logger.info("Component is not allowed.", componentName); throw ComponentNotAllowed.createInstanceNotAllowed(componentName); } return descriptor; }</code><technical_language>Yuck, add a new method DescriptorProvider getComponentDescriptorByDisplayName(...). check for component types (incl. Filters missing here)</technical_language>

Target:
public ComponentDescriptor<?> resolveDescriptor(DataCleanerEnvironment env, String componentName) { ComponentDescriptor<?> descriptor = env.getDescriptorProvider() .getComponentDescriptorByDisplayName(componentName); if (descriptor == null) { logger.info("Component not found.", componentName); throw ComponentNotFoundException.createTypeNotFound(componentName); } if (!_remoteComponentsConfiguration.isAllowed(descriptor)) { logger.info("Component is not allowed.", componentName); throw ComponentNotAllowed.createInstanceNotAllowed(componentName); } return descriptor; }
Source:
<code>public ElasticSearchAdapter() { if (restClient != null || !elasticSearchConfigured) { return; } if (!isSearchEndpointConfigured()) { LOGGER.info("no valid elasticsearch endpoint configured."); elasticSearchConfigured = false; return; } try { int portSeparator = endpoint.lastIndexOf(':'); String host = endpoint.substring(0, portSeparator); int port = Integer.parseInt(endpoint.substring(portSeparator + 1), 10); restClient = new RestHighLevelClient( RestClient.builder(new HttpHost(InetAddress.getByName(host), port, "http"))); <START> Settings emptySettings = Settings.Builder.EMPTY_SETTINGS; <END> } catch (Throwable e) { LOGGER.error("Could not connect to Elastic Search Engine", e); } }</code><technical_language>put this lines in a private method call prepareEmptySettingToAvoidClassloadingDeadlockInElasticSearch</technical_language>

Target:
public ElasticSearchAdapter() { if (restClient != null || elasticSearchConfigurationMissing) { return; } if (!isSearchEndpointConfigured()) { LOGGER.info("no valid elasticsearch endpoint configured."); elasticSearchConfigurationMissing = true; return; } try { int portSeparator = endpoint.lastIndexOf(':'); String host = endpoint.substring(0, portSeparator); int port = Integer.parseInt(endpoint.substring(portSeparator + 1), 10); restClient = new RestHighLevelClient( RestClient.builder(new HttpHost(InetAddress.getByName(host), port, "http"))); prepareEmptySettingsToAvoidClassloadingDeadlockInElasticSearch(); } catch (Throwable e) { LOGGER.error("Could not connect to Elastic Search Engine", e); } }
Source:
<code>public static Block wrapBlock(Block block, int positionCount, List<Encoding> wrappings) { <START> checkArgument(!wrappings.isEmpty()); <END> Block wrappedBlock = block; for (int i = wrappings.size() - 1; i >= 0; i--) { switch (wrappings.get(i)) { case DICTIONARY: wrappedBlock = createDictionaryBlock(wrappedBlock, positionCount); break; case RUN_LENGTH: wrappedBlock = createRLEBlock(wrappedBlock, positionCount); break; default: throw new IllegalArgumentException(format("wrappings %s is incorrect", wrappings)); } } return wrappedBlock; }</code><technical_language>Please add a message, in case fails</technical_language>

Target:
public static Block wrapBlock(Block block, int positionCount, List<Encoding> wrappings) { checkArgument(!wrappings.isEmpty(), "wrappings is empty"); Block wrappedBlock = block; for (int i = wrappings.size() - 1; i >= 0; i--) { switch (wrappings.get(i)) { case DICTIONARY: wrappedBlock = createRandomDictionaryBlock(wrappedBlock, positionCount); break; case RUN_LENGTH: wrappedBlock = createRleBlockWithRandomValue(wrappedBlock, positionCount); break; default: throw new IllegalArgumentException(format("wrappings %s is incorrect", wrappings)); } } return wrappedBlock; }