auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private synchronized void sendNextRequest() { TaskStatus taskStatus = getTaskInfo().getTaskStatus(); if (!running) { return; } if (isDone(getTaskInfo())) { stop(); return; } if (future != null && !future.isDone()) { return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (!errorRateLimit.isDone()) { errorRateLimit.addListener(this::sendNextRequest, executor); return; } HttpUriBuilder httpUriBuilder = uriBuilderFrom(taskStatus.getSelf()); URI uri = summarizeTaskInfo ? httpUriBuilder.addParameter("summarize").build() : httpUriBuilder.build(); Request.Builder uriBuilder = setContentTypeHeaders(isBinaryTransportEnabled, prepareGet()); if (taskInfoRefreshMaxWait.toMillis() > 0) { uriBuilder.setHeader(PRESTO_CURRENT_STATE, taskStatus.getState().toString()) .setHeader(PRESTO_MAX_WAIT, taskInfoRefreshMaxWait.toString()); } Request request = uriBuilder.setUri(uri).build(); ResponseHandler responseHandler; if (isBinaryTransportEnabled) { responseHandler = createFullSmileResponseHandler((SmileCodec<TaskInfo>) taskInfoCodec); } else { responseHandler = createAdaptingJsonResponseHandler(unwrapJsonCodec(taskInfoCodec)); } errorTracker.startRequest(); future = httpClient.executeAsync(request, responseHandler); currentRequestStartNanos.set(System.nanoTime()); Futures.addCallback(future, new SimpleHttpResponseHandler<>(this, request.getUri(), stats), executor); }

Target:
private synchronized void sendNextRequest() { TaskStatus taskStatus = getTaskInfo().getTaskStatus(); if (!running) { return; } if (isDone(getTaskInfo())) { stop(); return; } if (future != null && !future.isDone()) { return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (!errorRateLimit.isDone()) { errorRateLimit.addListener(this::sendNextRequest, executor); return; } HttpUriBuilder httpUriBuilder = uriBuilderFrom(taskStatus.getSelf()); URI uri = summarizeTaskInfo ? httpUriBuilder.addParameter("summarize").build() : httpUriBuilder.build(); Request.Builder uriBuilder = setContentTypeHeaders(isBinaryTransportEnabled, prepareGet()); if (taskInfoRefreshMaxWait.toMillis() != 0L) { uriBuilder.setHeader(PRESTO_CURRENT_STATE, taskStatus.getState().toString()) .setHeader(PRESTO_MAX_WAIT, taskInfoRefreshMaxWait.toString()); } Request request = uriBuilder.setUri(uri).build(); ResponseHandler responseHandler; if (isBinaryTransportEnabled) { responseHandler = createFullSmileResponseHandler((SmileCodec<TaskInfo>) taskInfoCodec); } else { responseHandler = createAdaptingJsonResponseHandler(unwrapJsonCodec(taskInfoCodec)); } errorTracker.startRequest(); future = httpClient.executeAsync(request, responseHandler); currentRequestStartNanos.set(System.nanoTime()); Futures.addCallback(future, new SimpleHttpResponseHandler<>(this, request.getUri(), stats), executor); }
Source:
public List<T> query(Query query) { Uri uri = getQueryUri(query); ContentResolver contentResolver = getContentResolver(); Cursor cursor = null; List<T> dataList = new ArrayList<T>(); try { cursor = contentResolver.query(uri, null, null, null, null); System.out.println("contentResolver value = " + contentResolver); CursorDataExtractor<T> extractor = getCursorDataExtractor(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { T data = extractor.extract(cursor, query); dataList.add(data); cursor.moveToNext(); } } catch (Throwable t) { Log.e(TAG, "Error Reading data from Content Resolver", t); throw new RuntimeException(t); } finally { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } return dataList; }

Target:
public List<T> query(Query query) { Uri uri = getQueryUri(query); ContentResolver contentResolver = getContentResolver(); Cursor cursor = null; List<T> dataList = new ArrayList<T>(); try { cursor = contentResolver.query(uri, null, null, null, null); CursorDataExtractor<T> extractor = getCursorDataExtractor(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { T data = extractor.extract(cursor, query); dataList.add(data); cursor.moveToNext(); } } catch (Throwable t) { Log.e(TAG, "Error Reading data from Content Resolver", t); throw new RuntimeException(t); } finally { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } return dataList; }
Source:
public void constructorValidValues() { AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(new AmqpDataBody(Collections.singletonList(new BinaryData(CONTENTS_BYTES)))); Assertions.assertEquals(AmqpBodyType.DATA, actual.getBody().getBodyType()); Assertions.assertNotNull(actual.getProperties()); Assertions.assertNotNull(actual.getHeader()); Assertions.assertNotNull(actual.getFooter()); Assertions.assertNotNull(actual.getApplicationProperties()); Assertions.assertNotNull(actual.getDeliveryAnnotations()); Assertions.assertNotNull(actual.getMessageAnnotations()); Assertions.assertNotNull(actual.getApplicationProperties()); Assertions.assertNotNull(actual.getBody()); List<BinaryData> dataList = ((AmqpDataBody) actual.getBody()).getData().stream().collect(Collectors.toList()); assertEquals(1, dataList.size()); byte[] actualData = dataList.get(0).getData(); assertArrayEquals(CONTENTS_BYTES, actualData); }

Target:
public void constructorValidValues() { final List<BinaryData> expectedBinaryData = Collections.singletonList(DATA_BYTES); final AmqpDataBody amqpDataBody = new AmqpDataBody(expectedBinaryData); final AmqpAnnotatedMessage actual = new AmqpAnnotatedMessage(amqpDataBody); assertMessageCreation(AmqpBodyType.DATA, expectedBinaryData.size(), actual); }
Source:
private void validate(StatementsResponse readEntity, EntityKey key, Tuple tuple) { if (!readEntity.getErrors().isEmpty() ) { ErrorResponse errorResponse = readEntity.getErrors().get( 0 ); switch ( errorResponse.getCode() ) { case EmbeddedNeo4jDialect.CONSTRAINT_VIOLATION_CODE: throw extractException( key, tuple, errorResponse ); default: throw new HibernateException( String.valueOf( errorResponse ) ); } } }

Target:
private void validate(StatementsResponse readEntity, EntityKey key, Tuple tuple) { if (!readEntity.getErrors().isEmpty() ) { ErrorResponse errorResponse = readEntity.getErrors().get( 0 ); switch ( errorResponse.getCode() ) { case BaseNeo4jDialect.CONSTRAINT_VIOLATION_CODE: throw extractException( key, tuple, errorResponse ); default: throw new HibernateException( String.valueOf( errorResponse ) ); } } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.ASSIGNMENT_STMT, ctx -> { AssignmentStatement assignment = (AssignmentStatement) ctx.syntaxNode(); getSubscriptionToCookies(assignment.lhsExpressions()) .forEach(sub -> { if (isSettingFlag(sub, flagName()) && isFalsy(assignment.assignedValue())) { ctx.addIssue(assignment, message()); } }); }); context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (calleeSymbol != null && sensitiveArgumentByFQN().containsKey(calleeSymbol.fullyQualifiedName())) { if (callExpression.arguments().stream().anyMatch(argument -> argument.is(Kind.UNPACKING_EXPR))) { return; } RegularArgument secureArgument = getArgument(callExpression.arguments(), sensitiveArgumentByFQN().get(calleeSymbol.fullyQualifiedName()), flagName()); if (secureArgument == null || isFalsy(secureArgument.expression())) { ctx.addIssue(callExpression.callee(), message()); } } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.ASSIGNMENT_STMT, ctx -> { AssignmentStatement assignment = (AssignmentStatement) ctx.syntaxNode(); getSubscriptionToCookies(assignment.lhsExpressions()) .forEach(sub -> { if (isSettingFlag(sub, flagName()) && isFalsy(assignment.assignedValue())) { ctx.addIssue(assignment, message()); } }); }); context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (calleeSymbol != null && sensitiveArgumentByFQN().containsKey(calleeSymbol.fullyQualifiedName())) { if (callExpression.arguments().stream().anyMatch(argument -> argument.is(Kind.UNPACKING_EXPR))) { return; } RegularArgument flagArgument = getArgument(callExpression.arguments(), sensitiveArgumentByFQN().get(calleeSymbol.fullyQualifiedName()), flagName()); if (flagArgument == null || isFalsy(flagArgument.expression())) { ctx.addIssue(callExpression.callee(), message()); } } }); }
Source:
public GHDeployKey addDeployKey(String title, String key) throws IOException { return root.retrieve() .method("POST") .with("title", title) .with("key", key) .method("POST") .withUrlPath(getApiTailUrl("keys")) .to(GHDeployKey.class) .wrap(this); }

Target:
public GHDeployKey addDeployKey(String title, String key) throws IOException { return root.createRequest() .method("POST") .with("title", title) .with("key", key) .withUrlPath(getApiTailUrl("keys")) .fetch(GHDeployKey.class) .wrap(this); }
Source:
public void testSerialization() throws IOException, ClassNotFoundException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); Schema payload = new Schema.Parser() .parse("{\"type\":\"record\",\"name\":\"KeyValue\",\"namespace\":\"org.apache.avro\"," + "\"doc\":\"generic key value type\",\"fields\":[{\"name\":\"key\",\"type\":{\"type\":\"string\"," + "\"avro.java.string\":\"String\"},\"doc\":\"generic key type\"}," + "{\"name\":\"value\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]," + "\"doc\":\"generic value type\"}]}"); oos.writeObject(payload); oos.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); Schema sp = (Schema) ois.readObject(); assertEquals(payload, sp); ois.close(); }

Target:
public void testSerialization() throws IOException, ClassNotFoundException { try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); InputStream jsonSchema = getClass().getResourceAsStream("/SchemaBuilder.avsc")) { Schema payload = new Schema.Parser().parse(jsonSchema); oos.writeObject(payload); try (ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis)) { Schema sp = (Schema) ois.readObject(); assertEquals(payload, sp); } } }
Source:
private Map<String, String> convert(String prefix, Iterable value) { Map<String, String> map = new LinkedHashMap<String, String>(); if (!value.iterator().hasNext()) { map.put(prefix, ""); return map; } int i = 0; for (Object o : value) { map.putAll(this.convert(prefix + "[" + (i++) + "]", o)); } return map; }

Target:
private Map<String, String> convert(String prefix, Iterable value) { Map<String, String> map = new LinkedHashMap<String, String>(); Iterator iterator = value.iterator(); if (!iterator.hasNext()) { map.put(prefix, ""); return map; } for (int i = 0; iterator.hasNext(); i++) { map.putAll(this.convert(prefix + "[" + i + "]", iterator.next())); } return map; }
Source:
public KafkaSystemConsumer(Consumer<K, V> kafkaConsumer, String systemName, Config config, String clientId, KafkaSystemConsumerMetrics metrics, Clock clock) { super(metrics.registry(), clock, metrics.getClass().getName()); this.kafkaConsumer = kafkaConsumer; this.samzaConsumerMetrics = metrics; this.clientId = clientId; this.systemName = systemName; this.config = config; this.metricName = String.format("%s %s", systemName, clientId); this.fetchThresholdBytesEnabled = new KafkaConfig(config).isConsumerFetchThresholdBytesEnabled(systemName); messageSink = new KafkaConsumerMessageSink(); proxy = new KafkaConsumerProxy(kafkaConsumer, systemName, clientId, messageSink, samzaConsumerMetrics, metricName); LOG.info("Created consumer proxy: " + proxy); LOG.info("Created SamzaKafkaSystemConsumer for system={}, clientId={}, metricName={}, KafkaConsumer={}", systemName, clientId, metricName, this.kafkaConsumer.toString()); }

Target:
public KafkaSystemConsumer(Consumer<K, V> kafkaConsumer, String systemName, Config config, String clientId, KafkaSystemConsumerMetrics metrics, Clock clock) { super(metrics.registry(), clock, metrics.getClass().getName()); this.kafkaConsumer = kafkaConsumer; this.clientId = clientId; this.systemName = systemName; this.config = config; this.metrics = metrics; fetchThresholdBytesEnabled = new KafkaConfig(config).isConsumerFetchThresholdBytesEnabled(systemName); messageSink = new KafkaConsumerMessageSink(); String metricName = String.format("%s", systemName); proxy = new KafkaConsumerProxy(kafkaConsumer, systemName, clientId, messageSink, metrics, metricName); LOG.info("{}: Created KafkaConsumerProxy ", this, proxy); }
Source:
private Set<File> findDotProjectFiles(List<File> files) { Set<File> result = new HashSet<File>(); for (File file : files) { if (file.isFile()) { while (file != null) { File f = new File(file.getParent() + File.separator + ".project"); if (f.exists()) { result.add(f); break; } file = file.getParentFile(); } } } return result; }

Target:
private Set<File> findDotProjectFiles(List<File> files) { Set<File> result = new HashSet<File>(); for (File file : files) { if (file.isFile()) { while (file != null) { File f = new File(file.getParent() + File.separator + ".project"); if (f.isFile()) { result.add(f); break; } file = file.getParentFile(); } } } return result; }
Source:
private void updateLocalWindowIfNeeded() { if (flowControlledBytes != 0) { int bytes = flowControlledBytes; flowControlledBytes = 0; write0(parentContext(), new DefaultHttp2WindowUpdateFrame(bytes).stream(stream)) .addListener(WINDOW_UPDATE_FRAME_LISTENER); writeDoneAndNoFlush = true; } }

Target:
private void updateLocalWindowIfNeeded() { if (flowControlledBytes != 0) { int bytes = flowControlledBytes; flowControlledBytes = 0; ChannelFuture future = write0(parentContext(), new DefaultHttp2WindowUpdateFrame(bytes).stream(stream)); if (future.isDone()) { windowUpdateFrameWriteComplete(future, AbstractHttp2StreamChannel.this); } else { future.addListener(windowUpdateFrameWriteListener); writeDoneAndNoFlush = true; } } }
Source:
public void hoverClickAndViewRecipientPhotoOnTableCell(int questionBodyIndex, int tableRow, String urlRegex) throws Exception { String idOfQuestionBody = "questionBody-" + questionBodyIndex; WebElement photoDiv = browser.driver.findElement(By.id(idOfQuestionBody)) .findElements(By.cssSelector(".dataTable tbody tr")) .get(tableRow) .findElements(By.cssSelector("td")) .get(2) .findElement(By.className("profile-pic-icon-hover")); Actions actions = new Actions(browser.driver); actions.moveToElement(photoDiv).build().perform(); waitForElementToAppear(By.cssSelector(".popover-content")); JavascriptExecutor jsExecutor = (JavascriptExecutor) browser.driver; jsExecutor.executeScript("document.getElementsByClassName('popover-content')[0]" + ".getElementsByTagName('a')[0].click();"); waitForElementToAppear(By.cssSelector(".popover-content > img")); AssertHelper.assertContainsRegex(urlRegex, browser.driver.findElements(By.cssSelector(".popover-content > img")) .get(0) .getAttribute("src")); jsExecutor.executeScript("document.getElementsByClassName('popover')[0].parentNode.removeChild(document.getElementsByClassName('popover')[0])"); }

Target:
public void hoverClickAndViewRecipientPhotoOnTableCell(int questionBodyIndex, int tableRow, String urlRegex) throws Exception { hoverClickAndViewPhotoOnTableCell(questionBodyIndex, tableRow, 2, urlRegex); }
Source:
public synchronized void start() { log.info("started"); }

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } try { log.info("starting"); listenerExecutor = Execs.singleThreaded("CuratorDruidNodeDiscoveryProvider-ListenerExecutor"); log.info("started"); lifecycleLock.started(); } finally { lifecycleLock.exitStart(); } }
Source:
protected void attemptSync() { if (ConnectivityStatus.isNetworkNotConnected(CommCareHomeActivity.this)) { if (ConnectivityStatus.isAirplaneModeOn(CommCareHomeActivity.this)) { displayMessage(Localization.get("notification.sync.airplane.action"), true, true); CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(NotificationMessageFactory.StockMessages.Sync_AirplaneMode, AIRPLANE_MODE_CATEGORY)); } else { displayMessage(Localization.get("notification.sync.connections.action"), true, true); CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(NotificationMessageFactory.StockMessages.Sync_NoConnections, AIRPLANE_MODE_CATEGORY)); } return; } CommCareApplication._().clearNotifications(AIRPLANE_MODE_CATEGORY); boolean formsSentToServer = checkAndStartUnsentTask(true); if(!formsSentToServer) { syncData(false); } }

Target:
protected void attemptSync() { if (!ConnectivityStatus.isNetworkAvailable(CommCareHomeActivity.this)) { if (ConnectivityStatus.isAirplaneModeOn(CommCareHomeActivity.this)) { displayMessage(Localization.get("notification.sync.airplane.action"), true, true); CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(NotificationMessageFactory.StockMessages.Sync_AirplaneMode, AIRPLANE_MODE_CATEGORY)); } else { displayMessage(Localization.get("notification.sync.connections.action"), true, true); CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(NotificationMessageFactory.StockMessages.Sync_NoConnections, AIRPLANE_MODE_CATEGORY)); } return; } CommCareApplication._().clearNotifications(AIRPLANE_MODE_CATEGORY); boolean formsSentToServer = checkAndStartUnsentTask(true); if(!formsSentToServer) { syncData(false); } }
Source:
private void handlePopulateWithDebugInfo() { if (debugPopulated) { return; } try { ((XText) getXWidget("Title")).set("tt"); if (atsAi == null) { atsAi = AtsConfigCache.instance.getSoleByGuid("AAABER+4zV8A8O7WAtxxaA", IAtsActionableItem.class); if (atsAi != null) { treeViewer.getViewer().setSelection(new StructuredSelection(Arrays.asList(atsAi))); treeViewer.setInitalChecked(Arrays.asList(atsAi)); } } getContainer().updateButtons(); debugPopulated = true; } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }

Target:
private void handlePopulateWithDebugInfo() { if (debugPopulated) { return; } try { ((XText) getXWidget("Title")).set("tt"); if (atsAi == null) { atsAi = AtsConfigCache.instance.getSoleByGuid(ATS_Actionable_Item_Guid_For_Training_And_Demos, IAtsActionableItem.class); if (atsAi != null) { treeViewer.getViewer().setSelection(new StructuredSelection(Arrays.asList(atsAi))); treeViewer.setInitalChecked(Arrays.asList(atsAi)); } } getContainer().updateButtons(); debugPopulated = true; } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
Source:
public Long int64(String name) { Int64Field field = findField(name, Int64Field.class); if (field == null) { return null; } int before = byteBuffer.position(); Long decoded = (Long) field.decode(byteBuffer); int after = byteBuffer.position(); currentlyRead += (after - before); return decoded; }

Target:
public Long int64(String name) { Int64Field field = fieldSearcher.nextField(name, Int64Field.class, null, structReadBuffer); if (field == null) { return null; } return (Long) field.decode(structReadBuffer); }
Source:
private void addDeleteKeytab(Cluster cluster, Set<String> hostFilter, String hostParamsJson, CommandParams commandParameters, OrderedRequestStageContainer stageContainer) throws AmbariException { Set<String> hostNames = (CollectionUtils.isEmpty(hostFilter)) ? null : hostFilter.stream() .filter(hostname -> ambariManagementController.getClusters().hostExists(hostname)) .collect(toSet()); if(!CollectionUtils.isEmpty(hostNames)) { Stage stage = createNewStage(stageContainer.getLastStageId(), cluster, stageContainer.getId(), "Delete Keytabs", commandParameters.asJson(), hostParamsJson); Map<String, String> requestParams = new HashMap<>(); List<RequestResourceFilter> requestResourceFilters = new ArrayList<>(); RequestResourceFilter reqResFilter = new RequestResourceFilter("KERBEROS", "KERBEROS_CLIENT", new ArrayList<>(hostNames)); requestResourceFilters.add(reqResFilter); ActionExecutionContext actionExecContext = new ActionExecutionContext( cluster.getClusterName(), "REMOVE_KEYTAB", requestResourceFilters, requestParams); customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestParams, null); stageContainer.addStage(stage); } }

Target:
private void addDeleteKeytab(Cluster cluster, Set<String> hostFilter, String hostParamsJson, CommandParams commandParameters, OrderedRequestStageContainer stageContainer) throws AmbariException { Set<String> hostNames = (CollectionUtils.isEmpty(hostFilter)) ? null : hostFilter.stream() .filter(hostname -> ambariManagementController.getClusters().hostExists(hostname)) .collect(toSet()); if(CollectionUtils.isNotEmpty(hostNames)) { Stage stage = createNewStage(stageContainer.getLastStageId(), cluster, stageContainer.getId(), "Delete Keytabs", commandParameters.asJson(), hostParamsJson); Map<String, String> requestParams = new HashMap<>(); List<RequestResourceFilter> requestResourceFilters = new ArrayList<>(); RequestResourceFilter reqResFilter = new RequestResourceFilter("KERBEROS", "KERBEROS_CLIENT", new ArrayList<>(hostNames)); requestResourceFilters.add(reqResFilter); ActionExecutionContext actionExecContext = new ActionExecutionContext( cluster.getClusterName(), REMOVE_KEYTAB, requestResourceFilters, requestParams); customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestParams, null); stageContainer.addStage(stage); } }
Source:
public static void main(String[] args) { Config coordinatorSystemConfig = null; final String coordinatorSystemEnv = System.getenv(ShellCommandConfig.ENV_COORDINATOR_SYSTEM_CONFIG()); try { log.info("Parsing coordinator system config {}", coordinatorSystemEnv); coordinatorSystemConfig = new MapConfig(SamzaObjectMapper.getObjectMapper().readValue(coordinatorSystemEnv, Config.class)); } catch (IOException e) { log.error("Exception while reading coordinator stream config {}", e); throw new SamzaException(e); } ClusterBasedJobCoordinator jc = new ClusterBasedJobCoordinator(coordinatorSystemConfig); jc.run(); log.info("Finishing"); }

Target:
public static void main(String[] args) { Config coordinatorSystemConfig = null; final String coordinatorSystemEnv = System.getenv(ShellCommandConfig.ENV_COORDINATOR_SYSTEM_CONFIG()); try { log.info("Parsing coordinator system config {}", coordinatorSystemEnv); coordinatorSystemConfig = new MapConfig(SamzaObjectMapper.getObjectMapper().readValue(coordinatorSystemEnv, Config.class)); } catch (IOException e) { log.error("Exception while reading coordinator stream config {}", e); throw new SamzaException(e); } ClusterBasedJobCoordinator jc = new ClusterBasedJobCoordinator(coordinatorSystemConfig); jc.run(); log.info("Finished ClusterBasedJobCoordinator run"); }
Source:
public void write(final File tabixFile) { final LittleEndianOutputStream los = new LittleEndianOutputStream(new BlockCompressedOutputStream(tabixFile)); try { write(los); los.close(); } catch (final IOException e) { throw new TribbleException("Exception writing " + tabixFile.getAbsolutePath(), e); } }

Target:
public void write(final File tabixFile) throws IOException { try(final LittleEndianOutputStream los = new LittleEndianOutputStream(new BlockCompressedOutputStream(tabixFile))) { write(los); } }
Source:
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { slea.readInt(); int birthday = slea.readInt(); if (!CashOperationHandler.checkBirthday(c, birthday)) { c.announce(MaplePacketCreator.showCashShopMessage((byte) 0xC4)); c.announce(MaplePacketCreator.enableActions()); return; } MapleCharacter chr = c.getPlayer(); if(!ServerConstants.ALLOW_CASHSHOP_WORLD_TRANSFER || Server.getInstance().getWorldsSize() <= 1) { c.announce(MaplePacketCreator.sendWorldTransferRules(9, c)); return; } int worldTransferError = chr.checkWorldTransferEligibility(); if(worldTransferError != 0) { c.announce(MaplePacketCreator.sendWorldTransferRules(worldTransferError, c)); return; } try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT completionTime FROM worldtransfers WHERE characterid=?")) { ps.setInt(1, chr.getId()); ResultSet rs = ps.executeQuery(); while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) { c.announce(MaplePacketCreator.sendWorldTransferRules(6, c)); return; } else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > System.currentTimeMillis()) { c.announce(MaplePacketCreator.sendWorldTransferRules(7, c)); return; }; } } catch(SQLException e) { e.printStackTrace(); } c.announce(MaplePacketCreator.sendWorldTransferRules(0, c)); }

Target:
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { slea.readInt(); int birthday = slea.readInt(); if (!CashOperationHandler.checkBirthday(c, birthday)) { c.announce(MaplePacketCreator.showCashShopMessage((byte) 0xC4)); c.announce(MaplePacketCreator.enableActions()); return; } MapleCharacter chr = c.getPlayer(); if(!ServerConstants.ALLOW_CASHSHOP_WORLD_TRANSFER || Server.getInstance().getWorldsSize() <= 1) { c.announce(MaplePacketCreator.sendWorldTransferRules(9, c)); return; } int worldTransferError = chr.checkWorldTransferEligibility(); if(worldTransferError != 0) { c.announce(MaplePacketCreator.sendWorldTransferRules(worldTransferError, c)); return; } try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT completionTime FROM worldtransfers WHERE characterid=?")) { ps.setInt(1, chr.getId()); ResultSet rs = ps.executeQuery(); while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) { c.announce(MaplePacketCreator.sendWorldTransferRules(6, c)); return; } else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > System.currentTimeMillis()) { c.announce(MaplePacketCreator.sendWorldTransferRules(7, c)); return; }; } } catch(SQLException e) { e.printStackTrace(); return; } c.announce(MaplePacketCreator.sendWorldTransferRules(0, c)); }
Source:
@Test public void testProjectExceptWithMissingField() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP"); RexNode deptnoField = builder.field("DEPTNO"); assertThrows(CalciteException.class, () -> { builder.project( builder.field("EMPNO"), builder.field("ENAME")) .projectExcept(deptnoField); }, "Project should fail since we are trying to remove a field that does not exist."); }

Target:
@Test public void testProjectExceptWithMissingField() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP"); RexNode deptnoField = builder.field("DEPTNO"); IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> { builder.project( builder.field("EMPNO"), builder.field("ENAME")) .projectExcept(deptnoField); }, "Project should fail since we are trying to remove a field that does not exist."); assertThat(ex.getMessage(), allOf(containsString("Expression"), containsString("not found"))); }
Source:
private void processInput(String userInput) { if (userInput.isEmpty()) return; String[] userInputWords = userInput.split(" "); for (int i = 0; i < userInputWords.length; i++) { String currentWord = userInputWords[i]; if (i < userInputWords.length - 1 || userInput.endsWith(" ")) { toggleMilestone(currentWord); } else { filterMilestones(currentWord); } } }

Target:
private void processInput(String userInput) { if (userInput.isEmpty()) return; String[] userInputWords = userInput.split(" "); Stream.of(userInputWords) .forEach(this::filterMilestones); toggleFirstMatchingMilestone(currentMilestonesList); }
Source:
public DateTimeTag(){ String format = System.getProperty(SYSTEM_PROPERTY_DATE_FORMAT); if(format == null) { this.formatter = DEFAULT_FORMATTER; } else { try { this.formatter = DateTimeFormatter.ofPattern(format).withZone(ZoneId.systemDefault()); } catch (IllegalArgumentException e) { log.log(Level.WARNING, String.format("Can not use System Property %s=%s as dateformat, will fall back to default." + " Please see also java.time.format.DateTimeFormatter for the correct syntax", SYSTEM_PROPERTY_DATE_FORMAT, format) , e); this.formatter = DEFAULT_FORMATTER; } } }

Target:
public DateTimeTag(){ String format = System.getProperty(SYSTEM_PROPERTY_DATE_FORMAT); if(format == null) { this.formatter = DEFAULT_FORMATTER; } else { try { this.formatter = DateTimeFormatter.ofPattern(format).withZone(ZoneId.systemDefault()); } catch (IllegalArgumentException e) { LOG.log(Level.WARNING, String.format("Can not use System Property %s=%s as dateformat, will fall back to default." + " Please see also java.time.format.DateTimeFormatter for the correct syntax", SYSTEM_PROPERTY_DATE_FORMAT, format) , e); this.formatter = DEFAULT_FORMATTER; } } }
Source:
public void testNodeJSAppIsRunning() { ExplorerItem indexJS = new ProjectExplorer().getProject(TEST_APP_NAME).getProjectItem("index.js"); indexJS.select(); runAsNodeJSAppMenu().select(); ConsoleView console = new ConsoleView(); console.activate(); new WaitUntil(new ConsoleHasText("Listening on port 3000")); assertTrue("Node.js App is not running!", console.getConsoleText().contains("Listening on port 3000")); console.terminateConsole(); }

Target:
public void testNodeJSAppIsRunning() { ExplorerItem indexJS = new ProjectExplorer().getProject(TEST_APP_NAME).getProjectItem("index.js"); indexJS.select(); runAsNodeJSAppMenu().select(); ConsoleView console = new ConsoleView(); console.activate(); try { new WaitUntil(new ConsoleHasText("Listening on port 3000")); } catch (WaitTimeoutExpiredException e) { Assert.fail("Node.js App is not running!"); } console.terminateConsole(); }
Source:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } if (value instanceof Long) { node.setProperty(propertyName, (Long) value); } if (value instanceof Integer) { node.setProperty(propertyName, new Long((Integer) value)); } if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); Binary binaryProperty = (Binary) node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } } }

Target:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } else if (value instanceof Double) { node.setProperty(propertyName, (Double) value); } else if (value instanceof Number) { node.setProperty(propertyName, ((Number) value).longValue()); } else if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); Binary binaryProperty = (Binary) node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } else { throw new IllegalArgumentException(String.format("The value of the property %s has unknown type and couldn't be saved.", propertyName)); } } }
Source:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof ConnectionWrapper) { ConnectionWrapper connection = (ConnectionWrapper) parentElement; if (connection.load(e -> { handleLoadingException(parentElement, e); })) { return new Object[] { makeStub(parentElement) }; } else { stubs.remove(parentElement); Object[] result = connection.getProjects().toArray(); if (result == null || result.length == 0) { result = new Object[] { new NewProjectLinkNode((Connection) connection.getConnection()) }; } return result; } } else if (parentElement instanceof ProjectWrapper) { ProjectWrapper project = (ProjectWrapper) parentElement; if (project.load(e -> { handleLoadingException(parentElement, e); })) { return new Object[] { makeStub(parentElement) }; } else { stubs.remove(parentElement); return project.getResourcesOfKind(ResourceKind.SERVICE).toArray(); } } else if (parentElement instanceof ServiceWrapper) { ServiceWrapper wrapper = (ServiceWrapper) parentElement; ArrayList<Object> result = new ArrayList<>(); wrapper.getResourcesOfKind(ResourceKind.BUILD).stream() .filter(b -> !isTerminatedBuild((IBuild) b.getResource())).forEach(r -> result.add(r)); wrapper.getResourcesOfKind(ResourceKind.POD).stream().filter(p -> !isBuildPod((IPod) p.getResource())) .forEach(r -> result.add(r)); return result.toArray(); } else if (parentElement instanceof LoadingStub) { return ((LoadingStub) parentElement).getChildren(); } return new Object[0]; }

Target:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IConnectionWrapper) { IConnectionWrapper connection = (IConnectionWrapper) parentElement; if (connection.getState() == LoadingState.LOADED) { synchronized (stubs) { stubs.remove(parentElement); } Object[] result = connection.getResources().toArray(); if (result == null || result.length == 0) { result = new Object[] { new NewProjectLinkNode((Connection) connection.getWrapped()) }; } return result; } else { connection.load(e -> { handleLoadingException(parentElement, e); }); return new Object[] { makeStub(parentElement) }; } } else if (parentElement instanceof IProjectWrapper) { IProjectWrapper project = (IProjectWrapper) parentElement; if (project.getState() == LoadingState.LOADED) { synchronized (stubs) { stubs.remove(parentElement); } return project.getResourcesOfKind(ResourceKind.SERVICE).toArray(); } else { project.load(e -> { handleLoadingException(parentElement, e); }); return new Object[] { makeStub(parentElement) }; } } else if (parentElement instanceof IServiceWrapper) { IServiceWrapper wrapper = (IServiceWrapper) parentElement; ArrayList<Object> result = new ArrayList<>(); wrapper.getResourcesOfKind(ResourceKind.BUILD).stream() .filter(b -> !isTerminatedBuild((IBuild) b.getWrapped())).forEach(r -> result.add(r)); wrapper.getResourcesOfKind(ResourceKind.POD).stream() .filter(p -> !ResourceUtils.isBuildPod((IPod) p.getWrapped())).forEach(r -> result.add(r)); return result.toArray(); } else if (parentElement instanceof LoadingStub) { return ((LoadingStub) parentElement).getChildren(); } return new Object[0]; }
Source:
default List<DocumentType> getSpecialDocumentTypes() { return new ArrayList<>(); }

Target:
default Set<String> getSpecialDocumentTypes() { return Collections.emptySet(); }
Source:
Double getDefaultElevation(CoverageInfo coverage, ReaderDimensionsAccessor dimensions) throws IOException { DimensionInfo elevation = coverage.getMetadata().get(ResourceInfo.ELEVATION, DimensionInfo.class); if (elevation == null || !coverage.isEnabled()) { throw new ServiceException("Layer " + coverage.getPrefixedName() + " does not have time support enabled"); } if (elevation.getDefaultValue() != null) { try { return Double.parseDouble(elevation.getDefaultValue()); } catch (NumberFormatException e) { return dimensions.getMinElevation(); } } else { return dimensions.getMinElevation(); } }

Target:
Double getDefaultElevation(CoverageInfo coverage, ReaderDimensionsAccessor dimensions) throws IOException { DimensionInfo elevationDimensionInfo = coverage.getMetadata().get(ResourceInfo.ELEVATION, DimensionInfo.class); if (elevationDimensionInfo == null || !coverage.isEnabled()) { throw new ServiceException("Layer " + coverage.getPrefixedName() + " does not have elevation support enabled"); } if (elevationDimensionInfo.getDefaultValue() != null) { Double defaultValue = null; try { defaultValue = Double.parseDouble(elevationDimensionInfo.getDefaultValue()); } catch (NumberFormatException e) { throw new ServiceException("Layer " + coverage.getPrefixedName() + " has an invalid elevation default value." + " " + DEFAULT_ELEVATION_NOT_DOUBLE_MSG); } boolean defaultValueIsInElevationDomain = false; Collection<Object> elevationDomain = dimensions.getElevationDomain(); if (elevationDomain != null && !elevationDomain.isEmpty()) { for (Object elevation : elevationDomain) { if (elevation instanceof Double) { if (((Double)elevation).compareTo(defaultValue) == 0) { defaultValueIsInElevationDomain = true; break; } } else if (elevation instanceof NumberRange) { if (((NumberRange)elevation).contains((Number)defaultValue)) { defaultValueIsInElevationDomain = true; break; } } } } if (!defaultValueIsInElevationDomain) { throw new ServiceException("Layer " + coverage.getPrefixedName() + " has an invalid elevation default value." + " " + DEFAULT_ELEVATION_NOT_IN_DOMAIN_MSG); } return defaultValue; } else { return dimensions.getMinElevation(); } }
Source:
public synchronized void setLookupSource(Supplier<LookupSource> lookupSource) { requireNonNull(lookupSource, "lookupSource is null"); assertIn(State.UNSPILLING); requireNonNull(unspilledLookupSource).set(lookupSource); unspilledLookupSource = null; setState(State.PRODUCED); }

Target:
public synchronized void setLookupSource(Supplier<LookupSource> lookupSource) { requireNonNull(lookupSource, "lookupSource is null"); if (state == State.DISPOSED) { return; } assertState(State.UNSPILLING); checkState(unspilledLookupSource != null, "unspilledLookupSource not set"); unspilledLookupSource.set(lookupSource); unspilledLookupSource = null; setState(State.PRODUCED); }
Source:
static <T, C, R extends Iterable<T>> Map<C, R> groupBy(Traversable<T> source, Function<? super T, ? extends C> classifier, Function<? super Iterable<T>, R> mapper) { Objects.requireNonNull(classifier, "classifier is null"); Objects.requireNonNull(mapper, "mapper is null"); final java.util.Map<C, Collection<T>> mutableResults = new java.util.LinkedHashMap<>(source.size()); for (T value : source) { final C key = classifier.apply(value); mutableResults.computeIfAbsent(key, k -> new ArrayList<>()).add(value); } Map<C, R> results = LinkedHashMap.empty(); for (java.util.Map.Entry<C, Collection<T>> entry : mutableResults.entrySet()) { results = results.put(entry.getKey(), mapper.apply(entry.getValue())); } return results; }

Target:
static <T, C, R extends Iterable<T>> Map<C, R> groupBy(Traversable<T> source, Function<? super T, ? extends C> classifier, Function<? super Iterable<T>, R> mapper) { Objects.requireNonNull(classifier, "classifier is null"); Objects.requireNonNull(mapper, "mapper is null"); final java.util.Map<C, Collection<T>> mutableResults = new java.util.LinkedHashMap<>(source.isTraversableAgain() ? source.size() : 16); for (T value : source) { final C key = classifier.apply(value); mutableResults.computeIfAbsent(key, k -> new ArrayList<>()).add(value); } Map<C, R> results = LinkedHashMap.empty(); for (java.util.Map.Entry<C, Collection<T>> entry : mutableResults.entrySet()) { results = results.put(entry.getKey(), mapper.apply(entry.getValue())); } return results; }
Source:
public static DebugFeatures fromString(String value) { String normalized = value.toUpperCase().replace("-", "_"); return DebugFeatures.valueOf(normalized); }

Target:
public static EndpointDebugFeatures fromString(String value) { String normalized = value.toUpperCase().replace("-", "_"); return EndpointDebugFeatures.valueOf(normalized); }
Source:
private TransactionComponents createTransactionComponents( @Output List<AutoCloseable> closeables, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier) { CoordinationService<InternalSchemaMetadata> coordinationService = getSchemaMetadataCoordinationService( metricsManager, lockAndTimestampServices, keyValueService); TransactionSchemaManager transactionSchemaManager = new TransactionSchemaManager(coordinationService); TransactionService transactionService = initializeCloseable(() -> AtlasDbMetrics.instrumentTimed( metricsManager.getRegistry(), TransactionService.class, TransactionServices.createTransactionService(keyValueService, transactionSchemaManager)), closeables); Optional<TransactionSchemaInstaller> schemaInstaller = getTransactionSchemaInstallerIfSupported( closeables, keyValueService, runtimeConfigSupplier, transactionSchemaManager); return ImmutableTransactionComponents.builder() .transactionService(transactionService) .schemaInstaller(schemaInstaller) .build(); }

Target:
private TransactionComponents createTransactionComponents( @Output List<AutoCloseable> closeables, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier) { CoordinationService<InternalSchemaMetadata> coordinationService = getSchemaMetadataCoordinationService( metricsManager, lockAndTimestampServices, keyValueService); TransactionSchemaManager transactionSchemaManager = new TransactionSchemaManager(coordinationService); TransactionService transactionService = initializeCloseable(() -> AtlasDbMetrics.instrument( metricsManager.getRegistry(), TransactionService.class, TransactionServices.createTransactionService(keyValueService, transactionSchemaManager)), closeables); Optional<TransactionSchemaInstaller> schemaInstaller = getTransactionSchemaInstallerIfSupported( closeables, keyValueService, runtimeConfigSupplier, transactionSchemaManager); return ImmutableTransactionComponents.builder() .transactionService(transactionService) .schemaInstaller(schemaInstaller) .build(); }
Source:
public org.infinispan.transaction.TransactionMode getMode() { switch (this) { case NON_XA: case NON_DURABLE_XA: case FULL_XA: return org.infinispan.transaction.TransactionMode.TRANSACTIONAL; default: return org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL; } }

Target:
public org.infinispan.transaction.TransactionMode getMode() { return this == NONE ? org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL : org.infinispan.transaction.TransactionMode.TRANSACTIONAL; }
Source:
public static Map<Class<?>, Serde<?, ?>> getSerdes() { return SERDES; }

Target:
public static Map<Class<?>, Serde<?, ?>> getSerdes() { return Collections.unmodifiableMap(SERDES); }
Source:
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { ClientStatistics clientStatistics = statsRef.get(); if (clientStatistics != null && clientStatistics.metricsBlob() != null) { long timestamp = clientStatistics.timestamp(); byte[] metricsBlob = clientStatistics.metricsBlob(); MetricConsumer consumer = new MetricConsumer() { @Override public void consumeLong(MetricDescriptor descriptor, long value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } @Override public void consumeDouble(MetricDescriptor descriptor, double value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } private MetricDescriptor enhanceDescriptor(MetricDescriptor descriptor, long timestamp) { return descriptor .withExcludedTargets(asList(MetricTarget.values())) .withIncludedTarget(MANAGEMENT_CENTER) .withTag(METRICS_TAG_CLIENT, getUuid().toString()) .withTag(METRICS_TAG_TIMESTAMP, Long.toString(timestamp)); } }; MetricsCompressor.extractMetrics(metricsBlob, consumer); } }

Target:
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { ClientStatistics clientStatistics = statsRef.get(); if (clientStatistics != null && clientStatistics.metricsBlob() != null) { long timestamp = clientStatistics.timestamp(); byte[] metricsBlob = clientStatistics.metricsBlob(); MetricConsumer consumer = new MetricConsumer() { @Override public void consumeLong(MetricDescriptor descriptor, long value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } @Override public void consumeDouble(MetricDescriptor descriptor, double value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } private MetricDescriptor enhanceDescriptor(MetricDescriptor descriptor, long timestamp) { return descriptor .withExcludedTargets(MetricTarget.VALUES_LIST) .withIncludedTarget(MANAGEMENT_CENTER) .withTag(METRICS_TAG_CLIENT, getUuid().toString()) .withTag(METRICS_TAG_TIMESTAMP, Long.toString(timestamp)); } }; MetricsCompressor.extractMetrics(metricsBlob, consumer); } }
Source:
private String updateInstanceStatus(InstanceMetaData instanceMetaData, DetailedStackStatus detailedStackStatus) { String instanceStatusInfo = ""; switch (detailedStackStatus) { case AVAILABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.CREATED); instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.CREATED.toString()); break; case UNHEALTHY: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNHEALTHY); instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.UNHEALTHY.toString()); break; case UNREACHABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNREACHABLE); instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.UNREACHABLE.toString()); break; default: LOGGER.info(":::Auto sync::: the '{}' status is not converted", detailedStackStatus); } return instanceStatusInfo; }

Target:
private void updateInstanceStatus(InstanceMetaData instanceMetaData, DetailedStackStatus detailedStackStatus) { switch (detailedStackStatus) { case AVAILABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.CREATED); break; case UNHEALTHY: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNHEALTHY); break; case UNREACHABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNREACHABLE); break; default: LOGGER.info(":::Auto sync::: the '{}' status is not converted", detailedStackStatus); } }
Source:
public Properties readZipFile(String zipFilePath) { try { ZipFile zipFile = new ZipFile(zipFilePath); Enumeration<? extends ZipEntry> e = zipFile.entries(); while (e.hasMoreElements()) { ZipEntry entry = e.nextElement(); String end = "pom.properties"; if (!entry.isDirectory() && entry.getName().startsWith(MAVEN_META_INF) && entry.getName().endsWith(end)) { BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry)); Properties props = new Properties(); props.load(bis); bis.close(); return props; } else { continue; } } } catch (IOException e) { logger.error("IOError :{}", e.getMessage(), e); } return new Properties(); }

Target:
private Properties readZipFile(String zipFilePath) { try { ZipFile zipFile = new ZipFile(zipFilePath); Enumeration<? extends ZipEntry> e = zipFile.entries(); while (e.hasMoreElements()) { ZipEntry entry = e.nextElement(); if (!entry.isDirectory() && entry.getName().startsWith(MAVEN_META_INF) && entry.getName().endsWith("pom.properties")) { try (BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry))) { Properties props = new Properties(); props.load(bis); return props; } } } } catch (IOException e) { logger.error("IOError :{}", e.getMessage(), e); } return new Properties(); }